:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --ink: #1d2433;
  --ink-2: #4a5263;
  --muted: #7b8291;
  --line: #e3e0d8;
  --navy: #1f2d4d;
  --navy-2: #2d3f68;
  --gold: #a8844a;
  --gold-soft: #f3ebdc;
  --ok: #2f7d4f;
  --ok-soft: #e4f2e9;
  --warn: #9a6a14;
  --warn-soft: #fbf1dc;
  --err: #b3362c;
  --err-soft: #fbe6e3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 24, 36, .06), 0 4px 16px rgba(20, 24, 36, .05);
  --font: "Heebo", "Segoe UI", "Arial Hebrew", Arial, sans-serif;
  --font-doc: "Frank Ruhl Libre", "David", "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.55; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 22px; background: var(--navy); color: #fff;
  border-bottom: 3px solid var(--gold);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { font-size: 26px; color: var(--gold); }
.brand-name { font-family: var(--font-doc); font-size: 22px; font-weight: 700; letter-spacing: .5px; }
.brand-sub { font-size: 12.5px; opacity: .75; }
.model-badge { font-size: 12.5px; background: rgba(255, 255, 255, .1); padding: 4px 10px; border-radius: 999px; direction: ltr; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 270px 1fr; height: calc(100% - 62px); }
.sidebar { background: var(--surface-2); border-left: 1px solid var(--line); padding: 16px; overflow-y: auto; }
.main { overflow-y: auto; padding: 22px 28px 40px; }

.new-case { display: flex; gap: 6px; margin-bottom: 14px; }
.new-case input { flex: 1; min-width: 0; }
.case-list { display: flex; flex-direction: column; gap: 4px; }
.case-item {
  display: block; text-align: right; width: 100%; padding: 9px 12px; border-radius: 8px;
  border: 1px solid transparent; background: none; cursor: pointer;
}
.case-item:hover { background: #fff; border-color: var(--line); }
.case-item.active { background: #fff; border-color: var(--gold); box-shadow: var(--shadow); }
.case-item .name { font-weight: 500; }
.case-item .sub { font-size: 12.5px; color: var(--muted); }

.empty-state { max-width: 560px; margin: 80px auto; text-align: center; color: var(--ink-2); }
.empty-state h2 { font-family: var(--font-doc); color: var(--navy); font-size: 28px; margin-bottom: 8px; }

/* ---------- controls ---------- */
input[type=text], input:not([type]), input[type=search], select, textarea {
  border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 10px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.btn {
  border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 14px; cursor: pointer;
  white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: var(--ink-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--navy-2); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--err); }
.btn.small { padding: 3px 9px; font-size: 13px; }

/* ---------- case header / tabs ---------- */
.case-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.case-header h1 { margin: 0; font-family: var(--font-doc); color: var(--navy); font-size: 28px; }
.case-stats { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.case-actions { display: flex; gap: 6px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab {
  background: none; border: none; padding: 10px 16px; cursor: pointer; color: var(--ink-2);
  border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 500;
}
.tab.active { color: var(--navy); border-bottom-color: var(--gold); }
.tab .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); margin-inline-start: 6px; vertical-align: middle; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- documents ---------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px;
  border: 2px dashed #cfc8b8; border-radius: var(--radius); background: var(--surface-2);
  cursor: pointer; text-align: center; color: var(--ink-2); transition: .15s;
}
.dropzone input { display: none; }
.dropzone span { font-size: 13px; color: var(--muted); }
.dropzone.drag { border-color: var(--gold); background: var(--gold-soft); }
.upload-status { margin-top: 10px; font-size: 13.5px; color: var(--ink-2); }

.doc-toolbar { display: flex; gap: 8px; margin: 16px 0 8px; }
.doc-toolbar input { flex: 1; max-width: 360px; }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
table.docs { width: 100%; border-collapse: collapse; font-size: 14px; }
table.docs th { text-align: right; font-weight: 500; color: var(--muted); font-size: 12.5px; background: var(--surface-2); position: sticky; top: 0; }
table.docs th, table.docs td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.docs tr:last-child td { border-bottom: none; }
table.docs tr.excluded td { opacity: .5; }
.doc-label { font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--navy); white-space: nowrap; }
.doc-name { font-size: 12.5px; color: var(--muted); }
.doc-title { font-weight: 500; }
.doc-title a { color: inherit; text-decoration: none; }
.doc-title a:hover { color: var(--gold); text-decoration: underline; }
.chip { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.chip.ready { background: var(--ok-soft); color: var(--ok); }
.chip.pending, .chip.processing { background: var(--warn-soft); color: var(--warn); }
.chip.error { background: var(--err-soft); color: var(--err); }
.doc-error { color: var(--err); font-size: 12.5px; margin-top: 2px; }
.doc-warn { color: var(--warn); font-size: 12.5px; margin-top: 2px; }
.row-actions { white-space: nowrap; }

/* ---------- summary ---------- */
.summary-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.summary-toolbar .spacer { flex: 1; }
.summary-meta { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.notice { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 9px 13px; margin-bottom: 12px; font-size: 14px; }
.notice.error { background: var(--err-soft); color: var(--err); }
.stale-flag { margin-inline-start: 8px; padding: 1px 7px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); font-size: 12px; }

.md { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 34px; box-shadow: var(--shadow); font-size: 15.5px; line-height: 1.75; }
.md:empty { display: none; }
.md h2, .md h3, .md h4, .md h5 { font-family: var(--font-doc); color: var(--navy); margin: 1.4em 0 .5em; line-height: 1.3; }
.md h2 { font-size: 23px; border-bottom: 2px solid var(--gold-soft); padding-bottom: 6px; }
.md h3 { font-size: 19px; }
.md h4 { font-size: 16.5px; }
.md > :first-child { margin-top: 0; }
.md p { margin: .5em 0; }
.md ul, .md ol { padding-inline-start: 1.4em; margin: .4em 0; }
.md li { margin: .2em 0; }
.md blockquote { margin: .8em 0; padding: 8px 14px; border-inline-start: 4px solid var(--gold); background: var(--gold-soft); border-radius: 4px; }
.md code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: .92em; }
.md hr { border: none; border-top: 1px solid var(--line); margin: 1.4em 0; }
.md-table { overflow-x: auto; margin: .8em 0; }
.md table { border-collapse: collapse; width: 100%; font-size: 14px; line-height: 1.55; }
.md th, .md td { border: 1px solid var(--line); padding: 7px 10px; text-align: right; vertical-align: top; }
.md th { background: var(--surface-2); font-weight: 700; color: var(--navy); }
.md tr:nth-child(even) td { background: #fcfbf8; }
.cite {
  display: inline-block; font-size: 11.5px; line-height: 1.5; padding: 0 7px; margin: 0 1px; border-radius: 999px;
  background: var(--gold-soft); color: #7a5a24; text-decoration: none; white-space: nowrap; vertical-align: 1px;
  border: 1px solid #e6d7bb;
}
.cite:hover { background: var(--gold); color: #fff; }
.streaming::after { content: "▍"; color: var(--gold); animation: pulse 1s infinite; }
.working { color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.spinner { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- chat ---------- */
.chat-panel { display: flex; flex-direction: column; gap: 12px; }
.chat-log { display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 920px; }
.msg.user { align-self: flex-start; background: var(--navy); color: #fff; padding: 10px 15px; border-radius: 14px 14px 14px 4px; white-space: pre-wrap; }
.msg.assistant .md { padding: 16px 22px; }
.msg .msg-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.msg.assistant.error .md { border-color: var(--err); }
.suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
.suggestions button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: 13.5px; color: var(--ink-2); }
.suggestions button:hover { border-color: var(--gold); color: var(--navy); }
.chat-form { position: sticky; bottom: 0; background: var(--bg); padding-top: 8px; display: flex; gap: 8px; align-items: flex-end; }
.chat-form textarea { flex: 1; resize: vertical; min-height: 48px; }
.chat-buttons { display: flex; flex-direction: column; gap: 6px; }

/* ---------- dialog ---------- */
.doc-dialog { width: min(980px, 94vw); height: 88vh; border: none; border-radius: 14px; padding: 0; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.doc-dialog[open] { display: flex; flex-direction: column; }
.doc-dialog::backdrop { background: rgba(20, 24, 36, .45); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.dialog-title { font-weight: 700; color: var(--navy); }
.dialog-sub { font-size: 12.5px; color: var(--muted); }
.dialog-actions { display: flex; gap: 6px; }
.dialog-body { flex: 1; min-height: 0; display: grid; }
.dialog-body[data-view="text"] { grid-template-columns: 1fr; }
.dialog-body[data-view="text"] .pane-source,
.dialog-body[data-view="source"] .pane-text { display: none; }
.dialog-body[data-view="source"] { grid-template-columns: 1fr; }
.dialog-body[data-view="split"] { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.pane { min-width: 0; overflow-y: auto; }
.pane-text { padding: 18px 26px; white-space: pre-wrap; font-size: 14.5px; line-height: 1.7; }
.dialog-body[data-view="split"] .pane-text { border-inline-start: 1px solid var(--line); }
.pane-source { background: #f3f4f7; display: flex; }
.pane-source iframe { flex: 1; border: 0; }
.pane-source img { width: 100%; height: auto; object-fit: contain; background: #fff; }
.pane-source .empty { margin: auto; color: var(--muted); font-size: 14px; padding: 20px; text-align: center; }
.docx-view { flex: 1; overflow-y: auto; background: #fff; padding: 26px 34px; font-size: 14.5px; line-height: 1.7; }
.docx-view p { margin: 0 0 8px; }
.docx-view h3 { margin: 16px 0 8px; font-size: 16px; color: var(--navy); }
.docx-view p.center { text-align: center; }
.docx-view p.left { text-align: left; }
.docx-view p.both { text-align: justify; }
.docx-view p.meta { color: var(--muted); font-size: 12px; }
.docx-view table { width: 100%; border-collapse: collapse; margin: 8px 0 14px; }
.docx-view td { border: 1px solid var(--line); padding: 5px 8px; vertical-align: top; }
.docx-view td p { margin: 0; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg-btn { border: 0; background: transparent; padding: 6px 11px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg-btn + .seg-btn { border-inline-start: 1px solid var(--line); }
.seg-btn.active { background: var(--navy); color: #fff; }
.seg-btn[disabled] { opacity: .45; cursor: not-allowed; }
.page-marker { display: block; margin: 16px 0 6px; padding: 3px 10px; background: var(--gold-soft); color: #7a5a24; border-radius: 6px; font-size: 12.5px; font-weight: 500; }
.page-marker.target { background: var(--gold); color: #fff; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px; box-shadow: var(--shadow); z-index: 10; max-width: 90vw; }
.toast.error { background: var(--err); }

/* ---------- overview (dashboard) ---------- */
.ov-toolbar { display: flex; justify-content: flex-end; gap: 6px; margin-bottom: 10px; }
.heb { color: var(--muted); font-size: 12.5px; }
.ov-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; background: #eef3fb; color: var(--navy); }
.ov-banner.warn { background: var(--warn-soft); color: var(--warn); }
.ov-banner.error { background: var(--err-soft); color: var(--err); }
.ov-banner > span:not(.spinner) { flex: 1; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); }
.kpi-label { font-size: 13px; color: var(--muted); }
.kpi-value { font-size: 26px; font-weight: 700; color: var(--navy); line-height: 1.25; margin-top: 2px; }
.kpi-sub { font-size: 12.5px; color: var(--ink-2); }

.ov-grid { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(290px, 1fr); gap: 16px; align-items: start; }
.ov-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h3 { margin: 0; font-family: var(--font-doc); color: var(--navy); font-size: 18px; display: flex; align-items: center; gap: 8px; }
.card-head .count { font-family: var(--font); font-size: 12px; background: var(--gold-soft); color: #7a5a24; border-radius: 999px; padding: 0 8px; }
.card-link { font-size: 13px; color: var(--navy); }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.tag { font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; color: var(--ink-2); }
.core { font-weight: 500; color: var(--navy); margin: 0 0 8px; }
.summary-text { margin: 0; line-height: 1.8; }
.muted { color: var(--muted); font-size: 13.5px; }
.src { margin-top: 8px; }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); white-space: nowrap; }
.facts dd { margin: 0; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.list li { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: none; padding-bottom: 0; }
.list.compact { gap: 6px; }
.list.compact li { padding-bottom: 6px; }
.list.compact a { color: inherit; text-decoration: none; display: flex; gap: 8px; align-items: baseline; }
.list.compact a:hover { color: var(--gold); }
.row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 2px; }

.pill { font-size: 12px; padding: 1px 9px; border-radius: 999px; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.pill.open { background: var(--warn-soft); color: var(--warn); border-color: #f0dcb0; }
.pill.partial { background: var(--gold-soft); color: #7a5a24; border-color: #e6d7bb; }
.pill.done { background: var(--ok-soft); color: var(--ok); border-color: #c6e3d0; }

.attention li { display: flex; gap: 10px; align-items: flex-start; }
.att-icon { flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.att-high .att-icon { background: var(--err-soft); color: var(--err); border-color: #f1c9c4; }
.att-kind { font-weight: 500; }

.ask-chips { display: flex; flex-direction: column; gap: 6px; }
.ask-chips button { text-align: right; border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 7px 11px; cursor: pointer; font-size: 13.5px; color: var(--ink); }
.ask-chips button:hover { border-color: var(--gold); background: var(--gold-soft); }

.qa { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; background: var(--surface-2); }
.qa summary { cursor: pointer; padding: 9px 12px; display: flex; justify-content: space-between; gap: 10px; list-style: none; }
.qa summary::-webkit-details-marker { display: none; }
.qa summary::before { content: "◂"; color: var(--gold); transition: transform .15s; }
.qa[open] summary::before { transform: rotate(-90deg); }
.qa .q { flex: 1; font-weight: 500; }
.qa .when { font-size: 12px; color: var(--muted); white-space: nowrap; }
.qa .md { border: none; box-shadow: none; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; padding: 12px 16px; font-size: 14.5px; }
.quick-ask { display: flex; gap: 6px; margin-top: 10px; }
.quick-ask input { flex: 1; min-width: 0; }

/* timeline */
.tl-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip-filter { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 10px; cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.chip-filter i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.chip-filter b { font-weight: 500; color: var(--muted); }
.chip-filter.on { border-color: var(--navy); color: var(--navy); background: #eef3fb; }
.timeline { list-style: none; margin: 0; padding: 0; max-height: 620px; overflow-y: auto; }
.tl-item { display: grid; grid-template-columns: 96px 18px 1fr; gap: 0 8px; }
.tl-item .tl-date { padding: 6px 0; font-size: 13px; font-weight: 500; color: var(--ink); text-align: left; font-variant-numeric: tabular-nums; }
.tl-date small { display: block; font-weight: 400; font-size: 11.5px; color: var(--muted); }
.tl-rail { position: relative; }
.tl-rail::after { content: ""; position: absolute; top: 0; bottom: 0; right: 8px; width: 2px; background: var(--line); }
.tl-rail::before { content: ""; position: absolute; top: 11px; right: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px #fff; z-index: 1; }
.tl-item:first-child .tl-rail::after { top: 12px; }
.tl-item:last-child .tl-rail::after { bottom: calc(100% - 12px); }
.tl-body { padding: 6px 0 12px; min-width: 0; }
.tl-head { display: flex; gap: 8px; font-size: 12px; color: var(--muted); }
.tl-type { color: var(--ink-2); font-weight: 500; }
.tl-party::before { content: "·"; margin-inline-end: 8px; }
.tl-title { font-weight: 500; }
.tl-details { font-size: 13.5px; color: var(--ink-2); }
.timeline .empty { color: var(--muted); padding: 10px 0; }

/* activity chart */
.activity:empty { display: none; }
.activity { margin-bottom: 10px; }
.chart-title { font-size: 13px; font-weight: 500; color: var(--ink-2); margin-bottom: 2px; }
.chart-title span { font-weight: 400; color: var(--muted); font-size: 12px; margin-inline-start: 6px; }
.chart-wrap { position: relative; }
.chart-wrap svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-wrap .bar { fill: #2a78d6; }
.chart-wrap .bar.hover { fill: #5598e7; }
.chart-wrap .bar.sel { fill: #184f95; }
.chart-wrap .hit { fill: transparent; cursor: pointer; outline: none; }
.chart-wrap .grid, .chart-wrap .axis { stroke: var(--line); stroke-width: 1; }
.chart-wrap text { font-size: 10.5px; fill: var(--muted); font-family: var(--font); }
.chart-tip { position: absolute; top: -6px; transform: translate(-50%, -100%); background: var(--ink); color: #fff; border-radius: 6px; padding: 5px 9px; font-size: 12px; pointer-events: none; white-space: nowrap; display: flex; gap: 6px; align-items: baseline; }
.chart-tip strong { font-size: 13px; }

table.mini { font-size: 13.5px; }

@media (max-width: 1100px) {
  .ov-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .sidebar { border-left: none; border-bottom: 1px solid var(--line); }
  .main { padding: 16px; }
  .md { padding: 16px; }
  .case-header { flex-direction: column; }
}

@media print {
  .topbar, .sidebar, .tabs, .case-header .case-actions, .summary-toolbar, .notice,
  #panel-documents, #panel-chat, .ov-toolbar, .ov-banner, .tl-filters, .activity,
  #tl-order, .quick-ask, .card-link, .kpi-sub { display: none !important; }
  .layout { display: block; height: auto; }
  .main { padding: 0; overflow: visible; }
  body { background: #fff; }
  .md { border: none; box-shadow: none; padding: 0; }
  .cite { border: none; background: none; padding: 0; color: #555; }
  /* the overview prints as one column, and nothing is cut across a page */
  .ov-grid { display: block; }
  .card { break-inside: avoid; box-shadow: none; border-color: #ccc; margin-bottom: 12px; }
  .kpis { break-inside: avoid; }
  .qa[open] > summary ~ * { display: block; }
  .tl-item { break-inside: avoid; }
}

/* ---------- login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100%; background: var(--bg); padding: 24px; }
.login { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: 0; width: min(1020px, 100%);
  background: var(--surface); border-radius: 16px; overflow: hidden; box-shadow: 0 24px 70px rgba(20, 24, 36, .18); }
.login-art { position: relative; background: var(--navy); padding: 26px; display: flex; flex-direction: column; gap: 14px; }
.login-art svg { width: 100%; height: auto; max-height: 360px; }
.login-art-text { color: #fff; text-align: center; padding: 0 12px 6px; }
.login-art-text h2 { font-family: var(--font-doc); font-size: 26px; margin: 0 0 6px; color: var(--gold); }
.login-art-text p { margin: 0; font-size: 14px; opacity: .85; line-height: 1.6; }
.login-form { padding: 34px 38px; display: flex; flex-direction: column; }
.login-form .brand { margin-bottom: 26px; }
.login-form .brand-name { color: var(--navy); }
.login-form .brand-sub { color: var(--muted); font-size: 12.5px; }
.login-form h1 { font-family: var(--font-doc); color: var(--navy); font-size: 26px; margin: 0 0 6px; }
.login-form .muted { color: var(--muted); font-size: 13.5px; margin: 0 0 20px; }
.login-form label { font-size: 13.5px; color: var(--ink-2); margin-bottom: 5px; display: block; }
.login-form input { width: 100%; margin-bottom: 16px; padding: 9px 12px; }
.login-form .btn { width: 100%; justify-content: center; padding: 10px; margin-top: 4px; }
.login-error { background: var(--err-soft); color: var(--err); border-radius: 8px; padding: 9px 12px; font-size: 14px; margin-bottom: 12px; }
.login-foot { margin-top: auto; padding-top: 26px; font-size: 13px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.login-foot a { color: var(--gold); }
@media (max-width: 820px) {
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-form { padding: 28px 22px; }
}

/* ---------- user chip, trash and audit ---------- */
.user-chip { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.user-chip .who { line-height: 1.25; text-align: left; }
.user-chip .who b { display: block; font-weight: 500; }
.user-chip .who span { opacity: .7; font-size: 12px; }
.user-chip .btn { border-color: rgba(255, 255, 255, .25); color: #fff; background: transparent; padding: 4px 10px; }
.user-chip .btn:hover { border-color: #fff; }
tr.trashed td { opacity: .65; }
tr.trashed .doc-title { text-decoration: line-through; }
.trash-note { font-size: 12.5px; color: var(--muted); }
table.audit { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.audit th { text-align: right; font-weight: 500; color: var(--muted); font-size: 12.5px; background: var(--surface-2); }
table.audit th, table.audit td { padding: 7px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.audit td.when { white-space: nowrap; color: var(--muted); }
table.audit td.detail { color: var(--ink-2); }
