/* Chronicle — shared styles. Clean, professional, consistent with the fleet
   (navy + gold palette from litigation-roadmap). Vanilla CSS, no framework. */

:root {
  --navy: #1b2a4a;
  --navy-2: #243558;
  --gold: #c9a84c;
  --bg: #f0f2f7;
  --panel: #ffffff;
  --line: #e3e7ef;
  --text: #1f2735;
  --muted: #6b7488;
  --ok: #2e9e5b;
  --warn: #d9881f;
  --danger: #c0392b;
  --radius: 12px;
  --shadow: 0 2px 16px rgba(27, 42, 74, 0.08);
}

* { box-sizing: border-box; }

/* The hidden attribute must always win over display-setting rules
   (e.g. .modal { display: flex }) regardless of specificity. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--navy); }

/* ── Top nav ── */
.topnav {
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 24px;
  height: 56px;
  box-shadow: var(--shadow);
}
.topnav .brand {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.topnav .brand .dot { color: var(--gold); }
.topnav .firm {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.9;
}
.topnav .spacer { flex: 1; }
.topnav a.navlink {
  color: #cdd6e8;
  text-decoration: none;
  font-size: 0.9rem;
  padding: 6px 10px;
  border-radius: 6px;
}
.topnav a.navlink:hover { background: var(--navy-2); color: #fff; }
.topnav form { margin: 0; }
.topnav button.logout {
  background: transparent;
  border: 1px solid #3a4a6b;
  color: #cdd6e8;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}
.topnav button.logout:hover { background: var(--navy-2); }

/* ── Layout ── */
.wrap {
  max-width: 1200px;
  margin: 28px auto;
  padding: 0 24px;
}
.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
}
.page-head h1 { font-size: 1.5rem; color: var(--navy); margin: 0; }
.page-head .sub { color: var(--muted); font-size: 0.9rem; }

/* ── Cards / panels ── */
.panel {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 22px;
}
.panel h2 {
  font-size: 1rem;
  margin: 0 0 14px;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Storage meter ── */
.meter-row { display: flex; align-items: baseline; justify-content: space-between; }
.meter-row .big { font-size: 1.35rem; font-weight: 700; color: var(--navy); }
.meter-row .cap { color: var(--muted); font-size: 0.9rem; }
.bar {
  height: 14px;
  background: #eef1f7;
  border-radius: 8px;
  overflow: hidden;
  margin: 10px 0 8px;
}
.bar .fill { height: 100%; border-radius: 8px; transition: width 0.3s; }
.bar .fill.ok { background: var(--ok); }
.bar .fill.warn { background: var(--warn); }
.bar .fill.danger { background: var(--danger); }
.meter-note { color: var(--muted); font-size: 0.82rem; }

/* ── Case grid ── */
.case-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.case-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.12s, box-shadow 0.12s;
  display: block;
}
.case-card:hover { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(27,42,74,0.14); }
.case-card .name { font-weight: 700; color: var(--navy); font-size: 1.05rem; }
.case-card .meta { color: var(--muted); font-size: 0.82rem; margin-top: 6px; }
.case-card .badge-ocr {
  display: inline-block;
  margin-top: 10px;
  background: #fdf3e3;
  color: var(--warn);
  border: 1px solid #f3e0bd;
  font-size: 0.74rem;
  padding: 3px 8px;
  border-radius: 999px;
}
.empty {
  color: var(--muted);
  text-align: center;
  padding: 40px 0;
  font-style: italic;
}

/* ── Forms ── */
label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
input[type="text"], input[type="password"], input[type="number"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  margin-bottom: 14px;
  background: #fff;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.18);
}
textarea { resize: vertical; min-height: 60px; }
.field-row { display: flex; gap: 14px; }
.field-row > div { flex: 1; }

.btn {
  background: var(--navy);
  color: #fff;
  border: none;
  padding: 11px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
}
.btn:hover { background: var(--navy-2); }
.btn.gold { background: var(--gold); color: var(--navy); }
.btn.gold:hover { background: #d8b95e; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--navy); }

/* ── Tabs (case workspace) ── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--line);
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.tabs a {
  text-decoration: none;
  color: var(--muted);
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.9rem;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  text-transform: capitalize;
}
.tabs a:hover { color: var(--navy); }
.tabs a.active { color: var(--navy); border-bottom-color: var(--gold); }

/* ── Coming soon panel ── */
.coming {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.coming .icon { font-size: 2.6rem; }
.coming h3 { color: var(--navy); margin: 14px 0 6px; }
.coming .pass { display: inline-block; background: #eef1f7; padding: 4px 12px; border-radius: 999px; font-size: 0.8rem; margin-top: 8px; }

/* ── Login / enroll cards ── */
.auth-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
}
.auth-card {
  background: #fff; border-radius: 14px; padding: 44px 38px;
  width: 420px; max-width: 92vw; box-shadow: 0 4px 28px rgba(27,42,74,0.14);
  text-align: center;
}
.auth-card .firm {
  font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--gold); font-weight: 700; margin-bottom: 4px;
}
.auth-card h2 { color: var(--navy); font-weight: 700; font-size: 1.4rem; margin: 0 0 6px; }
.auth-card .tag { color: var(--muted); font-size: 0.85rem; margin-bottom: 26px; }
.auth-card form { text-align: left; }
.auth-card .btn { width: 100%; margin-top: 6px; }
.msg {
  border-radius: 8px; padding: 10px 14px; font-size: 0.85rem; margin-bottom: 16px; text-align: left;
}
.msg.error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.msg.info { background: #eef5ff; color: #1e4e8c; border: 1px solid #cfe0f7; }
.msg.ok { background: #effaf2; color: #1d7a44; border: 1px solid #c8ecd5; }
.qr { margin: 18px auto; }
.qr img { width: 200px; height: 200px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: #fff; }
.secret {
  font-family: 'Consolas', monospace; background: #f4f6fb; border: 1px solid var(--line);
  border-radius: 6px; padding: 8px; font-size: 0.82rem; word-break: break-all; margin: 8px 0 18px;
}

/* ── Error page ── */
.error-page { text-align: center; padding: 80px 20px; }
.error-page .code { font-size: 4rem; font-weight: 800; color: var(--gold); }
.error-page h2 { color: var(--navy); }

/* ── Documents: upload dropzone (Pass 2a) ── */
.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: #fafbfe;
  text-align: center;
  padding: 28px 20px;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone.dragover { border-color: var(--gold); background: #fff8e9; }
.dropzone .dz-icon { font-size: 2rem; color: var(--gold); }
.dropzone p { margin: 6px 0; }
.dropzone .dz-pick { color: var(--navy); font-weight: 700; cursor: pointer; text-decoration: underline; }
.dropzone .dz-note { color: var(--muted); font-size: 0.82rem; }
.upload-status {
  margin-top: 14px; border-radius: 8px; padding: 10px 14px; font-size: 0.86rem;
}
.upload-status.info { background: #eef5ff; color: #1e4e8c; border: 1px solid #cfe0f7; }
.upload-status.ok { background: #effaf2; color: #1d7a44; border: 1px solid #c8ecd5; }
.upload-status.err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* ── Documents: table header tools ── */
.table-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 12px; flex-wrap: wrap;
}
.table-tools { display: flex; align-items: center; gap: 14px; }
.selcount { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.trash-toggle { font-size: 0.82rem; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 5px; margin: 0; }
.trash-toggle input { width: auto; margin: 0; }

/* Bulk-actions button + menu */
.bulk-wrap { position: relative; }
.bulk-menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 30;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow); min-width: 200px; padding: 6px; display: flex; flex-direction: column;
}
.bulk-item {
  background: transparent; border: none; text-align: left; padding: 9px 12px;
  border-radius: 6px; cursor: pointer; font-size: 0.88rem; color: var(--text); font-weight: 600;
}
.bulk-item:hover { background: #f1f4fa; }
.bulk-item.danger { color: var(--danger); }

/* ── Documents: table ── */
.doc-table-scroll { overflow-x: auto; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.doc-table thead th {
  text-align: left; color: var(--muted); font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.05em; border-bottom: 2px solid var(--line); padding: 8px 10px; font-weight: 700;
}
.doc-table th.num, .doc-table td.num { text-align: right; }
.doc-table tbody td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.doc-table tbody tr:hover { background: #fafbfe; }
.doc-table .cb-cell { width: 34px; text-align: center; }
.doc-table .cb-cell input { width: auto; margin: 0; }
.doc-table td.type { text-transform: uppercase; color: var(--muted); font-size: 0.78rem; }
.doc-table .actions-col { white-space: nowrap; }
.doc-table .row-link {
  background: none; border: none; color: var(--navy); cursor: pointer; font-size: 0.82rem;
  font-weight: 600; padding: 2px 6px; text-decoration: none;
}
.doc-table .row-link:hover { text-decoration: underline; }
.doc-table .row-link.trash1, .doc-table .row-link.restore { color: var(--danger); }
.doc-table .empty-row td { border-bottom: none; }

/* OCR status chips */
.chip {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; white-space: nowrap;
}
.chip-ok { background: #e7f6ed; color: #1d7a44; border: 1px solid #bfe6cd; }
.chip-proc { background: #eaf2ff; color: #1e4e8c; border: 1px solid #cfe0f7; }
.chip-queued { background: #eef1f7; color: #4a5876; border: 1px solid #d8dfee; }
.chip-warn { background: #fdf3e3; color: #8a5d12; border: 1px solid #f0dcb4; }
.chip-err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.chip-none { background: #f4f6fb; color: var(--muted); border: 1px solid var(--line); }

/* Viewed-% indicators */
.badge-new {
  display: inline-block; background: var(--gold); color: var(--navy);
  font-size: 0.68rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; text-transform: uppercase;
}
.viewed-done { color: var(--ok); font-weight: 700; font-size: 0.8rem; }
.viewed-pct { color: var(--muted); font-size: 0.82rem; font-weight: 600; }

/* ── Contacts (Pass 2b) ── */
.contact-form .form-actions {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px;
}
.contact-form .form-actions .btn { width: auto; }
.lbl-hint { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); }

/* @handle input with a leading @ adornment */
.handle-input { position: relative; }
.handle-input .at {
  position: absolute; left: 12px; top: 10px; color: var(--muted); font-weight: 700;
  pointer-events: none;
}
.handle-input input { padding-left: 26px; }

/* Contact list table */
.contact-table td.role-cell { color: var(--muted); }
.contact-table .inline-del { display: inline; margin: 0; }
.contact-table .inline-del .trash1 { font-family: inherit; }
.handle-chip {
  display: inline-block; background: #eef1f7; color: var(--navy);
  font-size: 0.78rem; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  font-family: 'Consolas', monospace;
}
.type-chip {
  display: inline-block; font-size: 0.7rem; font-weight: 700; padding: 2px 8px;
  border-radius: 999px; text-transform: uppercase; letter-spacing: 0.04em;
}
.type-chip.type-person { background: #eaf2ff; color: #1e4e8c; border: 1px solid #cfe0f7; }
.type-chip.type-org { background: #fdf3e3; color: #8a5d12; border: 1px solid #f0dcb4; }

/* Contact detail layout */
.contact-detail-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px;
}
@media (max-width: 820px) { .contact-detail-grid { grid-template-columns: 1fr; } }
.delete-form { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.delete-form .btn { width: auto; }
.btn.danger-text { color: var(--danger); border-color: #f3c9c4; }
.btn.danger-text:hover { background: #fef2f2; }
.related-facts { margin: 0; padding-left: 18px; }
.related-facts li { margin-bottom: 8px; }

/* @-mention linked-set readout (demo + future fact editor) */
.mention-linked { margin-top: 10px; color: var(--muted); font-size: 0.85rem; }
.mention-linked-list .handle-chip { margin-right: 4px; }

/* ── @-mention autocomplete dropdown (reusable widget) ── */
.mention-dropdown {
  position: absolute; z-index: 200; background: #fff;
  border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow);
  max-height: 260px; overflow-y: auto; min-width: 220px; padding: 4px;
}
.mention-row {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: 6px; cursor: pointer; font-size: 0.85rem;
}
.mention-row:hover, .mention-row.active { background: #f1f4fa; }
.mention-row .mention-handle {
  font-family: 'Consolas', monospace; font-weight: 700; color: var(--navy);
}
.mention-row .mention-name { color: var(--text); flex: 1; }
.mention-row .mention-type {
  font-size: 0.65rem; font-weight: 700; padding: 1px 7px; border-radius: 999px;
  text-transform: uppercase;
}
.mention-row .mention-type.type-person { background: #eaf2ff; color: #1e4e8c; }
.mention-row .mention-type.type-org { background: #fdf3e3; color: #8a5d12; }
.mention-empty { padding: 10px 12px; color: var(--muted); font-size: 0.85rem; font-style: italic; }

/* AI-process popover (stub) */
.popover {
  position: fixed; inset: 0; background: rgba(27,42,74,0.35);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.popover-card {
  background: #fff; border-radius: 12px; padding: 24px; width: 360px; max-width: 92vw;
  box-shadow: 0 8px 36px rgba(27,42,74,0.25);
}
.popover-card h3 { margin: 0 0 8px; color: var(--navy); }
.popover-note { color: var(--muted); font-size: 0.8rem; }
.popover-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.popover-actions .btn { width: auto; }

/* ── Issues tree (Pass 2c) ── */
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.head-actions .btn { width: auto; }
.empty.small { padding: 18px 0; }
.legend { font-size: 0.78rem; color: var(--muted); display: flex; align-items: center; gap: 4px; }

.cause-panel .table-head h2 { color: var(--navy); }
.cause-head-actions { display: flex; align-items: center; gap: 12px; }
.cause-head-actions .row-link {
  background: none; border: none; cursor: pointer; padding: 0;
  color: var(--navy); font-size: 0.82rem; text-decoration: none;
}
.cause-head-actions .row-link:hover { text-decoration: underline; }
.cause-head-actions .row-link.trash1 { color: var(--danger); }
.cause-head-actions .inline-del { display: inline; margin: 0; }

.issue-tree, .issue-children { list-style: none; margin: 0; padding: 0; }
.issue-children { padding-left: 22px; border-left: 1px dashed var(--line); margin-left: 9px; }
.issue-node.collapsed > .issue-children { display: none; }

.issue-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 6px; border-radius: 8px;
}
.issue-row:hover { background: #fafbfe; }
.issue-row:hover .issue-actions { opacity: 1; }

.twisty {
  background: none; border: none; cursor: pointer; padding: 0;
  width: 16px; color: var(--muted); font-size: 0.8rem; line-height: 1;
}
.twisty-spacer { display: inline-block; width: 16px; }

.issue-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.issue-type-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 5px; font-size: 0.66rem;
  font-weight: 700; flex: 0 0 auto;
}
.issue-type-badge.type-element { background: #eaf2ff; color: #1e4e8c; border: 1px solid #cfe0f7; }
.issue-type-badge.type-factual { background: #effaf2; color: #1d7a44; border: 1px solid #c8ecd5; }
.issue-type-badge.type-legal   { background: #fdf3e3; color: #8a5d12; border: 1px solid #f0dcb4; }
.issue-name { font-size: 0.9rem; }

.caci-chip, .cause-chip {
  display: inline-block; font-size: 0.7rem; padding: 2px 8px; border-radius: 999px;
}
.caci-chip { background: #eef1f7; color: var(--navy); }
.cause-chip { background: #f3eafe; color: #5b3e8a; }

.issue-actions {
  margin-left: auto; display: flex; gap: 10px; opacity: 0;
  transition: opacity 0.12s;
}
.issue-actions .row-link {
  background: none; border: none; cursor: pointer; padding: 0;
  color: var(--navy); font-size: 0.8rem;
}
.issue-actions .row-link:hover { text-decoration: underline; }
.issue-actions .row-link.trash1 { color: var(--danger); }
.issue-actions .inline-del { display: inline; margin: 0; }

/* ── Facts (Pass 2d) ── */
.fact-list { display: flex; flex-direction: column; gap: 10px; }
.fact-card {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  background: #fff;
}
.fact-card:hover { box-shadow: var(--shadow); }
.fact-card-main { flex: 1; min-width: 0; }
.fact-card-text { font-size: 0.95rem; color: var(--text); }
.fact-card-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.fact-card-meta .fc-date { color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.fact-card-row { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.fact-card-row.src-row { font-size: 0.78rem; }
.fact-card-actions { display: flex; flex-direction: column; gap: 4px; white-space: nowrap; }
.fact-card-actions .row-link {
  background: none; border: none; cursor: pointer; color: var(--navy);
  font-size: 0.8rem; font-weight: 600; padding: 2px 4px; text-align: right;
}
.fact-card-actions .row-link:hover { text-decoration: underline; }
.fact-card-actions .row-link.trash1 { color: var(--danger); }
.wit-sep { color: var(--muted); }

/* source chips */
.src-chip {
  display: inline-block; background: #eef1f7; color: var(--navy);
  font-size: 0.74rem; font-weight: 600; padding: 2px 8px; border-radius: 6px;
  text-decoration: none; border: 1px solid #dde3ef;
}
.src-chip.link:hover { background: #e0e7f6; text-decoration: none; }
.src-chip.none { background: #f4f6fb; color: var(--muted); font-style: italic; border-style: dashed; }
.src-chip.trashed { background: #fef2f2; color: #b91c1c; border-color: #fecaca; text-decoration: line-through; }
.src-quote { color: var(--muted); font-size: 0.78rem; font-style: italic; }

/* mini issue chips */
.mini-issue {
  display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 2px 8px;
  border-radius: 999px;
}
.mini-issue.type-element { background: #eaf2ff; color: #1e4e8c; }
.mini-issue.type-factual { background: #effaf2; color: #1d7a44; }
.mini-issue.type-legal   { background: #fdf3e3; color: #8a5d12; }

/* position + rating chips */
.pr-chip {
  display: inline-block; font-size: 0.7rem; font-weight: 700; padding: 2px 8px;
  border-radius: 999px; text-transform: capitalize;
}
.pr-chip.pos-disputed   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.pr-chip.pos-undisputed { background: #effaf2; color: #1d7a44; border: 1px solid #c8ecd5; }
.pr-chip.pos-unknown    { background: #f4f6fb; color: var(--muted); border: 1px solid var(--line); }
.pr-chip.rate-for_us     { background: #e7f6ed; color: #1d7a44; border: 1px solid #bfe6cd; }
.pr-chip.rate-against_us { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.pr-chip.rate-neutral    { background: #eef1f7; color: #4a5876; border: 1px solid #d8dfee; }
.muted-dash { color: var(--muted); }

/* ── Fact editor modal ── */
.modal[hidden] { display: none; }
.modal {
  position: fixed; inset: 0; background: rgba(27,42,74,0.4);
  display: flex; align-items: flex-start; justify-content: center; z-index: 150;
  overflow-y: auto; padding: 30px 16px;
}
.modal-card {
  background: #fff; border-radius: 12px; width: 720px; max-width: 96vw;
  box-shadow: 0 8px 40px rgba(27,42,74,0.3); padding: 22px 24px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.modal-head h3 { margin: 0; color: var(--navy); }
.modal-x {
  background: none; border: none; font-size: 1.5rem; line-height: 1; color: var(--muted);
  cursor: pointer; padding: 0 4px;
}
.modal-x:hover { color: var(--navy); }

.fact-form .form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.fact-form .form-actions .btn { width: auto; }
.fact-fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 0 0 14px; }
.fact-fieldset legend { font-size: 0.78rem; font-weight: 700; color: var(--navy); text-transform: uppercase; letter-spacing: 0.04em; padding: 0 6px; }

/* chip pickers (issues + witnesses) */
.chip-picker { display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; }
.pick-chip {
  display: flex; align-items: center; gap: 6px; font-size: 0.85rem; font-weight: 400;
  color: var(--text); cursor: pointer; text-transform: none; letter-spacing: 0; margin: 0;
  padding: 3px 4px; border-radius: 6px;
}
.pick-chip:hover { background: #f1f4fa; }
.pick-chip input { width: auto; margin: 0; }

/* sources editor */
.fact-sources-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.source-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.source-item .row-link { background: none; border: none; cursor: pointer; font-size: 0.78rem; font-weight: 600; padding: 0; }
.source-item .row-link.trash1 { color: var(--danger); }
.add-source-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.add-source-row select, .add-source-row input { margin-bottom: 0; }
.add-source-row select { flex: 1 1 200px; }
.add-source-row input[type="text"] { flex: 2 1 220px; }
.add-source-row .btn { width: auto; white-space: nowrap; }

/* ── Chronology table (Pass 2d) ── */
.chronology-wrap { max-width: 1320px; }
.filter-bar { padding: 14px 18px; }
.filter-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.filter-row > div { display: flex; flex-direction: column; }
.filter-row select { margin-bottom: 0; min-width: 120px; }
.filter-search { flex: 1 1 220px; }
.filter-search input { margin-bottom: 0; }
.filter-clear { justify-content: flex-end; }
.filter-clear .btn { width: auto; }

.chron-table th.sortable { cursor: pointer; user-select: none; }
.chron-table th.sortable:hover { color: var(--navy); }
.chron-table th.active-sort { color: var(--navy); }
.chron-table th .sort-ind { font-size: 0.7rem; color: var(--gold); }
.chron-table td.chron-fact { max-width: 380px; }
.chron-table td.chron-date { white-space: nowrap; font-weight: 600; color: var(--navy); }
.chron-table td.chron-src, .chron-table td.chron-issue, .chron-table td.chron-wit {
  font-size: 0.8rem;
}
.chron-table td.chron-src .src-chip,
.chron-table td.chron-src a.src-chip { margin: 1px 2px; }
.chron-table td.chron-issue .mini-issue,
.chron-table td.chron-wit .handle-chip { margin: 1px 2px; }

/* ── Dispute / DISPROVE feature (Pass 2e, feature #9a) ── */

/* Editor: the inline dispute section (revealed when Position = Disputed) */
.dispute-fieldset {
  border-color: #f0c2c2; background: #fffafa;
}
.dispute-fieldset legend { color: #b91c1c; }
.dispute-fieldset label { margin-top: 4px; }
.dispute-block { margin-top: 12px; }
.disproof-block { margin-top: 14px; }
.disproof-head {
  font-size: 0.74rem; font-weight: 700; color: #b91c1c;
  text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 6px;
}
.source-item.disproof-item .src-chip { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.promote-row { display: flex; align-items: center; gap: 10px; margin: 10px 0 4px; flex-wrap: wrap; }
.promote-row .btn { width: auto; }
.promote-row .lbl-hint.err { color: #b91c1c; font-weight: 600; }

/* Disproof chips (cards + chronology) */
.src-chip.disproof { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.handle-chip.disproof { background: #fdeaea; color: #b91c1c; }

/* Disputed badge */
.dispute-badge {
  display: inline-block; background: #fbe9e9; color: #b91c1c;
  font-size: 0.66rem; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  border: 1px solid #f3c9c9; text-transform: uppercase; letter-spacing: 0.03em;
  margin-bottom: 4px;
}

/* Fact card: disputed styling + rebuttal block */
.fact-card.disputed { border-left: 3px solid #e07a7a; }
.fact-card .asserted-by { font-size: 0.78rem; color: var(--muted); }
.rebuttal-block {
  margin-top: 8px; padding: 8px 10px; border-radius: 8px;
  background: #fff5f5; border: 1px solid #f4d4d4;
}
.true-fact { font-size: 0.85rem; color: var(--text); margin: 4px 0; }
.true-fact-lbl { font-weight: 700; color: #1d7a44; }
.disproof-evidence { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.disproof-lbl { font-weight: 700; color: #b91c1c; }

/* Chronology: disputed row + expandable rebuttal sub-row */
.chron-table td.chron-pos .dispute-badge { display: inline-block; }
.chron-table td.chron-pos .asserted-by { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.chron-table td.chron-pos .dispute-toggle {
  background: none; border: none; padding: 0; margin-top: 3px; cursor: pointer;
  font-size: 0.74rem; font-weight: 600; color: #b91c1c;
}
.chron-table td.chron-pos .dispute-toggle:hover { text-decoration: underline; }
.chron-table tr.rebuttal-subrow td.rebuttal-cell {
  background: #fff5f5; border-top: 1px dashed #f0c2c2;
}
.rebuttal-cell .rebuttal-asserted { font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.rebuttal-cell .true-fact { font-size: 0.86rem; }

/* ── Exhibit List + Witness List (Pass 3a) ───────────────────────── */
.muted-dash { color: var(--muted); font-style: italic; font-size: 0.82rem; }

/* Exhibit table */
.exhibit-table .ex-num-col { width: 110px; }
.ex-num-input {
  width: 92px; padding: 5px 7px; font-size: 0.85rem; font-weight: 600;
  border: 1px solid var(--line); border-radius: 6px; background: #fbfcfe;
  color: var(--navy);
}
.ex-num-input:focus { outline: none; border-color: var(--gold); background: #fff; }
.ex-facts-cell, .ex-wit-cell { font-size: 0.85rem; vertical-align: top; }
.ex-facts { list-style: none; margin: 0; padding: 0; }
.ex-facts .ex-fact {
  padding: 4px 0; border-bottom: 1px dashed #eef1f7; line-height: 1.35;
}
.ex-facts .ex-fact:last-child { border-bottom: none; }
.ex-facts .ex-fact.disproof { color: #8a3b3b; }
.ex-fact-date { color: var(--muted); font-weight: 600; font-size: 0.78rem; margin-right: 4px; }
.ex-fact-page { color: var(--muted); font-size: 0.74rem; }
.ex-wit-cell .row-link { margin-left: 6px; }

/* Authenticating-witness picker (in the exhibit modal) + checkbox list */
.witness-pick-list {
  max-height: 320px; overflow-y: auto; border: 1px solid var(--line);
  border-radius: 8px; padding: 6px; margin-bottom: 12px;
}
.witness-pick {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px;
  border-radius: 6px; cursor: pointer;
}
.witness-pick:hover { background: #f4f6fb; }
.witness-pick input { margin: 0; }
.witness-pick .wp-name { color: var(--text); font-size: 0.9rem; }
.witness-pick .wp-role,
.wp-role {
  color: var(--muted); font-size: 0.76rem; background: #eef1f7;
  border-radius: 999px; padding: 1px 8px;
}

/* Witness List cards */
.witness-card {
  border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
  margin-bottom: 12px; background: #fff;
}
.witness-card:hover { box-shadow: var(--shadow); }
.witness-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.witness-head .wc-name { font-weight: 600; color: var(--navy); }
.witness-section { margin-top: 8px; }
.witness-section .ws-label {
  font-size: 0.74rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); margin-bottom: 4px;
}
.ws-exhibits { display: flex; flex-wrap: wrap; gap: 5px; }
.ws-exhibits .src-chip { font-size: 0.8rem; }

/* ── Shareable chronology (Pass 3c) ── */
.share-form label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--navy); margin: 0 0 12px; }
.share-form input[type=text], .share-form input[type=date], .share-form select {
  display: block; width: 100%; margin-top: 4px; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: 7px; font-size: 0.9rem; font-weight: 400;
}
.share-cols { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; }
.share-cols label { display: inline-flex; align-items: center; gap: 5px; font-weight: 400; margin: 0; }
.share-cols input { width: auto; margin: 0; }
.share-form .form-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.share-form .form-actions .btn { width: auto; }
.share-facts-list { max-height: 200px; overflow-y: auto; border: 1px solid var(--line);
  border-radius: 7px; padding: 8px 10px; margin-bottom: 12px; }
.share-fact-row { display: flex; align-items: flex-start; gap: 6px; font-weight: 400;
  font-size: 0.85rem; margin: 0 0 5px; cursor: pointer; }
.share-fact-row input { width: auto; margin: 3px 0 0; }
.manage-list { display: flex; flex-direction: column; gap: 10px; }
.manage-row { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; }
.manage-info { flex: 1; min-width: 0; }
.manage-title { font-weight: 700; color: var(--navy); }
.manage-meta { font-size: 0.78rem; color: var(--muted); margin: 2px 0 6px; }
.manage-url { width: 100%; font-size: 0.78rem; padding: 4px 6px; border: 1px solid var(--line);
  border-radius: 6px; color: var(--text); }
.manage-revoke { width: auto; flex-shrink: 0; }

/* ── AI Review queue (Phase 2) ───────────────────────────────────── */
.ai-summary { font-size: 0.92rem; color: var(--text); line-height: 1.5; }
.ai-summary p { margin: 0; }
.ai-meta { font-size: 0.78rem; color: var(--muted); margin-top: 8px; }

.dispute-party-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #fff8e9; border: 1px solid #ecd9a3; border-radius: 8px;
  padding: 10px 12px; margin: 10px 0;
}
.dispute-party-row label { font-weight: 600; color: var(--navy); margin: 0; }
.dispute-party-row select { width: auto; min-width: 220px; }

.rev-list { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.rev-row {
  display: flex; gap: 12px; padding: 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.rev-cb { padding-top: 2px; }
.rev-cb input { width: auto; }
.rev-body { flex: 1; min-width: 0; }
.rev-text {
  width: 100%; font-size: 0.95rem; line-height: 1.4; resize: vertical;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; color: var(--text);
}
.rev-fields { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; margin: 8px 0; }
.rev-date { font-size: 0.72rem; color: var(--muted); font-weight: 600; display: flex; flex-direction: column; gap: 3px; margin: 0; }
.rev-date input { font-size: 0.82rem; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; width: 130px; }
.rev-disputed { font-size: 0.8rem; color: #b45309; font-weight: 700; display: flex; align-items: center; gap: 5px; margin: 0; }
.rev-disputed input { width: auto; }
.rev-elems { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.elem-chip { background: #eef2fb; color: var(--navy); border-width: 2px; border-style: solid; }
.rev-source { font-size: 0.82rem; color: var(--muted); margin-top: 6px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.rev-srclink { font-weight: 700; color: var(--navy); text-decoration: none; border-bottom: 1px dotted var(--navy); }
.rev-quote { font-style: italic; color: var(--text); }
.chip-conf { background: #f3f0e2; color: #8a6d12; border: 1px solid #e3d9b3; }

.rev-footer { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.rev-footer .spacer { flex: 1; }
.rp-status { font-size: 0.85rem; font-weight: 600; }
.rp-note { font-size: 0.78rem; color: var(--muted); margin: 6px 0 0; }

#rev-dispute-all.on { background: #b45309; color: #fff; border-color: #b45309; }
