/* ABRA asistent — the whole page style (no inline CSS in the templates). */
:root {
  --bg: #f4f6f9; --card: #fff; --ink: #1d2330; --muted: #667085; --line: #e3e6eb; --accent: #1f6feb;
  --accent-soft: #e8f0fe; --ok: #1a7f37; --ok-soft: #e6f4ea; --warn: #b26b00; --warn-soft: #fff4e5;
  --bad: #c62828; --bad-soft: #fdecea; --radius: 10px; --shadow: 0 1px 2px rgba(16, 24, 40, .06);
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink);
       background: var(--bg); }
a { color: var(--accent); }

/* header */
header { display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--card);
         border-bottom: 1px solid var(--line); flex-wrap: wrap; position: sticky; top: 0; z-index: 10; }
header .app { font-weight: 700; letter-spacing: .01em; }
header .subtitle { margin-left: -10px; color: var(--muted); font-weight: 600; }  /* the client: ABRA asistent · Janda */
header .subtitle::before { content: "· "; }
header nav { display: flex; gap: 14px; flex: 1; align-items: center; }
header nav a { color: var(--ink); text-decoration: none; padding: 4px 2px; border-bottom: 2px solid transparent; }
header nav a:hover { color: var(--accent); border-bottom-color: var(--accent); }
header nav a.admin { margin-left: auto; }
header .user { color: var(--muted); }

/* layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; padding: 20px; max-width: 1400px;
          margin: 0 auto; align-items: start; }
.layout.single { grid-template-columns: minmax(0, 1fr); max-width: 480px; }
.layout.single-wide { grid-template-columns: minmax(0, 1fr); max-width: 1100px; }
.layout.with-doc { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); max-width: 1600px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
        margin-bottom: 16px; box-shadow: var(--shadow); }
h1 { font-size: 20px; margin: 0 0 12px; } h2 { font-size: 16px; margin: 16px 0 8px; }

/* tables and forms */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .error { color: var(--bad); } .ok { color: var(--ok); } .warn { color: var(--warn); }
.short { color: var(--bad); font-weight: 600; }
label { display: block; margin: 10px 0 4px; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=date], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit;
  background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
button, .btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 6px;
               border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit;
               cursor: pointer; text-decoration: none; }
button:hover, .btn:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--bad); }
.btn.back { padding: 6px 12px; font-size: 14px; }
.btn.disabled { opacity: .45; pointer-events: none; }
.doc-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
           margin: 0 0 12px; }
.doc-nav-steps { display: inline-flex; align-items: center; gap: 8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.inline { display: inline; }
.alert { border-left: 4px solid var(--bad); background: var(--bad-soft); color: var(--bad); padding: 10px 12px;
         border-radius: 6px; margin-top: 14px; }

/* list */
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
             margin-bottom: 14px; }
.list-head .tabs { margin-bottom: 0; }
.quick-search { display: flex; gap: 8px; flex: 1; justify-content: flex-end; }
.quick-search input[type=search] { min-width: 260px; max-width: 420px; padding: 8px 10px; border: 1px solid var(--line);
                                   border-radius: 6px; font: inherit; }
.advanced summary { cursor: pointer; color: var(--muted); }
.advanced[open] summary { margin-bottom: 10px; }
.page-size { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.page-size select { width: auto; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 6px 12px; border-radius: 6px; text-decoration: none; color: var(--ink); border: 1px solid var(--line);
          background: var(--card); }
.tabs a.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input[type=text] { width: auto; min-width: 180px; flex: 1; }
.filters input[type=date] { width: auto; }
.filters label { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.pager { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 16px; }
a.card { display: block; color: inherit; text-decoration: none; } a.card:hover { border-color: var(--accent); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--line); white-space: nowrap; }
.badge-pending { background: var(--accent-soft); color: var(--accent); }
.badge-written { background: var(--ok-soft); color: var(--ok); }
.badge-to_finish, .badge-writing { background: var(--warn-soft); color: var(--warn); }
.badge-rejected { background: var(--bad-soft); color: var(--bad); }
.result { margin-top: 6px; }
ul.checks { list-style: none; padding: 0; margin: 10px 0; }
li.check { padding: 4px 0 4px 22px; position: relative; }
li.check.ok::before { content: "✓"; position: absolute; left: 4px; color: var(--ok); font-weight: 700; }
li.check.error::before { content: "!"; position: absolute; left: 6px; color: var(--bad); font-weight: 700; }

/* help page */
.help h2 { margin-top: 28px; }
.help li { margin: 4px 0; }
.help table td:first-child { font-weight: 600; white-space: nowrap; }

/* chat */
.chat { display: flex; flex-direction: column; position: sticky; top: 64px; }
.chat .messages { display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 400px); min-height: 160px;
                  overflow-y: auto;
                  margin-bottom: 10px; padding-right: 4px; scroll-behavior: smooth; }
.msg { padding: 8px 10px; border-radius: 12px; max-width: 90%; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: #dcf5e3; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: #eef0f3; border-bottom-left-radius: 4px; }
.msg.pending { color: var(--muted); font-style: italic; }
.msg.pending::after { content: ""; display: inline-block; width: 1.2em; animation: typing 1.2s steps(4, end) infinite; }
@keyframes typing { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.chat .drop { display: block; margin: 8px 0 0; padding: 12px; border: 2px dashed var(--line); border-radius: 8px;
              color: var(--muted); text-align: center; cursor: pointer; }
.chat .drop:hover { border-color: var(--accent); color: var(--accent); }
.chat.dragging { border-color: var(--accent); background: var(--accent-soft); }
.chat.dragging .drop { border-color: var(--accent); color: var(--accent); }
.chat-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; }
/* the review panel's floating buttons sit bottom-right: keep the chat's Poslať clear of them */
body:has(review-panel) .chat-actions { margin-bottom: 64px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
                   clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* original document beside the proposal */
.doc-viewer { position: sticky; top: 64px; }
.doc-viewer iframe { width: 100%; height: calc(100vh - 120px); border: 1px solid var(--line); border-radius: var(--radius);
                     background: #fff; }
@media (min-width: 1101px) { .doc-link { display: none; } }

/* confirmation dialog */
dialog#confirm-dialog { border: none; border-radius: var(--radius); padding: 18px 20px; max-width: 420px;
                        box-shadow: 0 12px 32px rgba(16, 24, 40, .25); }
dialog#confirm-dialog::backdrop { background: rgba(16, 24, 40, .45); }
.dialog-title { font-weight: 700; font-size: 17px; margin: 0 0 6px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

@media (max-width: 1100px) {
  .layout.with-doc { grid-template-columns: minmax(0, 1fr); }
  .doc-viewer { display: none; }
}
@media (max-width: 800px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .chat { position: static; }
}
