:root {
  --bg: #0a1020;
  --bg-grad: radial-gradient(1200px 600px at 20% -10%, rgba(30,58,95,0.35), transparent 60%), radial-gradient(900px 500px at 110% 10%, rgba(201,161,74,0.08), transparent 60%), #0a1020;
  --surface: #101a30;
  --surface-2: #16223c;
  --surface-3: #1d2c4a;
  --border: rgba(148,163,184,0.13);
  --border-strong: rgba(148,163,184,0.24);
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --muted: #8496b3;
  --faint: #54647e;
  --accent: #c9a14a;
  --accent-2: #5b7fb0;
  --accent-grad: linear-gradient(135deg, #c9a14a 0%, #a8842f 100%);
  --navy-grad: linear-gradient(135deg, #1e3a5f 0%, #0f1e36 100%);
  --good: #3fae7a;
  --good-2: rgba(63,174,122,0.13);
  --warn: #e0a23a;
  --warn-2: rgba(224,162,58,0.13);
  --bad: #d9534f;
  --bad-2: rgba(217,83,79,0.13);
  --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.25);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --serif: "Spectral", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; min-height: 100%; background: var(--bg); }
body { font-family: var(--font); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; background: var(--bg-grad); background-attachment: fixed; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1, h2, h3 { font-family: var(--serif); }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--surface-2); padding: 2px 6px; border-radius: 4px; }

/* ============ Sign-in splash ============ */
.splash { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; gap: 40px; }
.splash-card { background: linear-gradient(165deg, rgba(22,34,60,0.92), rgba(16,26,48,0.92)); border: 1px solid var(--border-strong); border-radius: var(--r-lg); padding: 44px 40px; width: 100%; max-width: 460px; box-shadow: var(--shadow), 0 0 0 1px rgba(201,161,74,0.07) inset; backdrop-filter: blur(10px); }
.splash-logo { width: 52px; height: 52px; margin-bottom: 18px; display: block; }
.splash-card h1 { font-size: 36px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.02em; color: var(--text); }
.splash-card h1 .accent { color: var(--accent); }
.splash-tag { color: var(--text-secondary); margin-bottom: 26px; font-size: 15px; }
.splash-features { list-style: none; padding: 0; margin: 0 0 28px; }
.splash-features li { display: flex; align-items: center; gap: 10px; padding: 8px 0; color: var(--text-secondary); font-size: 14px; }
.splash-features .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; box-shadow: 0 0 10px var(--accent); }
.splash-fine { margin-top: 18px; font-size: 12px; color: var(--muted); text-align: center; }
.splash-disclaimer { margin-top: 22px; font-size: 11.5px; line-height: 1.6; color: var(--muted); border-top: 1px solid var(--border); padding-top: 16px; }
.splash-footer { color: var(--muted); font-size: 13px; text-align: center; max-width: 620px; }
.splash-footer a { color: var(--text-secondary); transition: color 0.15s; }
.splash-footer a:hover { color: var(--accent); }

/* ============ App shell ============ */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
@media (max-width: 860px) { .app { grid-template-columns: 1fr; } }

/* ============ Sidebar ============ */
.sidebar { background: linear-gradient(180deg, rgba(16,26,48,0.7), rgba(10,16,32,0.8)); border-right: 1px solid var(--border); padding: 22px 16px 18px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
@media (max-width: 860px) { .sidebar { position: relative; height: auto; border-right: 0; border-bottom: 1px solid var(--border); } }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 6px; }
.sidebar-brand img { width: 34px; height: 34px; }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }

.sidebar-section { display: flex; flex-direction: column; gap: 6px; }
.sidebar-label { font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); padding: 0 8px 4px; font-weight: 600; }
/* .ci-avatar is still used by the signed-in user chip fallback. */
.ci-avatar { width: 26px; height: 26px; border-radius: 6px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; color: var(--accent); }

.sidebar-nav { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); color: var(--text-secondary); font-size: 13.5px; font-weight: 500; cursor: pointer; border: 1px solid transparent; }
.nav-item:hover:not(.disabled) { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.nav-item.disabled { opacity: 0.4; cursor: not-allowed; }
.nav-item .ico { display: inline-flex; width: 20px; justify-content: center; color: var(--accent); font-size: 14px; }

.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 10px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip img { width: 28px; height: 28px; border-radius: 50%; }
.user-chip .uc-body { min-width: 0; overflow: hidden; }
.user-chip .uc-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .uc-role { font-size: 11px; color: var(--muted); }

/* ============ Main ============ */
.main { padding: 26px 32px 16px; display: flex; flex-direction: column; gap: 22px; min-width: 0; }
@media (max-width: 560px) { .main { padding: 18px 16px; } }
.main-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.eyebrow { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.main-header h1 { font-family: var(--serif); font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.main-sub { color: var(--muted); margin-top: 6px; font-size: 13.5px; }
.main-header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ============ Company select (header) ============ */
.company-select { display: flex; align-items: center; gap: 8px; }
.company-select select { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: 8px 12px; font: inherit; font-size: 13px; }
.company-select select:focus { outline: none; border-color: var(--accent); }

/* ============ Cards ============ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 20px 22px; }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.card h3 { font-size: 16px; font-weight: 600; }
.card p.muted { font-size: 12.5px; margin-top: 3px; }
.cards-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .cards-row { grid-template-columns: 1fr; } }

/* ============ KPI cards ============ */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .kpi-grid { grid-template-columns: 1fr 1fr; } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px 16px 14px; position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent-grad); opacity: 0.8; }
.kpi-label { font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.kpi-value { font-family: var(--serif); font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-top: 8px; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ============ Footer ============ */
.main-footer { margin-top: auto; padding: 18px 4px 8px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); }
.main-footer .footer-links { text-align: center; }
.main-footer a { color: var(--text-secondary); transition: color 0.15s; }
.main-footer a:hover { color: var(--accent); }
.legal-disclaimer { background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--r-sm); padding: 12px 16px; margin: 0 0 14px; font-size: 12px; line-height: 1.6; color: var(--text-secondary); }
.legal-disclaimer strong { color: var(--text); }

/* ============ Buttons + chips ============ */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: var(--r-sm); font-size: 13.5px; font-weight: 500; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn-primary { background: var(--accent-grad); color: #0b111f; border: 0; font-weight: 600; transition: filter 0.15s; }
/* Re-assert the gold background + dark text on hover: the base `.btn:hover`
   rule (a dark background) otherwise outranks `.btn-primary` by specificity,
   leaving dark text on a dark button. */
.btn-primary:hover { filter: brightness(1.08); background: var(--accent-grad); color: #0b111f; }
.btn-navy { background: var(--navy-grad); color: #f1f5f9; border: 1px solid rgba(201,161,74,0.3); font-weight: 600; }
.btn-navy:hover { filter: brightness(1.15); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-lg { padding: 12px 18px; font-size: 14.5px; width: 100%; justify-content: center; border-radius: 10px; }
.btn.sm, .btn-ghost.sm { padding: 6px 10px; font-size: 12.5px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-danger { color: var(--bad); border-color: rgba(217,83,79,0.32); }
.btn-danger:hover { background: var(--bad-2); border-color: rgba(217,83,79,0.5); }
.settings-danger-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.chip-accent { background: rgba(201,161,74,0.14); color: var(--accent); border-color: rgba(201,161,74,0.32); }
.chip-good { background: var(--good-2); color: var(--good); border-color: rgba(63,174,122,0.32); }
.chip-warn { background: var(--warn-2); color: var(--warn); border-color: rgba(224,162,58,0.32); }
.chip-bad { background: var(--bad-2); color: var(--bad); border-color: rgba(217,83,79,0.32); }
.muted { color: var(--muted); }
.err { color: var(--bad); margin-top: 10px; font-size: 13px; }

/* ============ Views ============ */
.view { display: flex; flex-direction: column; gap: 22px; }
/* Action buttons are direct children of the .view flex column; without this
   they stretch to the full pane width. Keep them at their natural size. */
.view > .btn { align-self: flex-start; }

/* ============ Tables ============ */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; padding: 10px 16px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table th.right, .data-table td.right { text-align: right; }
.pad { padding: 30px 22px; text-align: center; }

/* severity dots / cells */
.sev { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.sev::before { content: ""; width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.sev-high { color: var(--bad); }
.sev-high::before { background: var(--bad); box-shadow: 0 0 6px var(--bad); }
.sev-medium { color: var(--warn); }
.sev-medium::before { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.sev-low { color: var(--good); }
.sev-low::before { background: var(--good); box-shadow: 0 0 6px var(--good); }
.row-sev-high { border-left: 3px solid var(--bad); }
.row-sev-medium { border-left: 3px solid var(--warn); }
.row-sev-low { border-left: 3px solid var(--good); }

/* ============ Forms ============ */
.form-label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-secondary); margin-bottom: 16px; }
.form-label input, .form-label textarea, .form-label select { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 8px; color: var(--text); font-family: inherit; font-size: 13.5px; box-sizing: border-box; }
.form-label input:focus, .form-label textarea:focus, .form-label select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201,161,74,0.16); }
/* Make the native date-picker calendar icon visible on the dark theme. */
.form-label input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.85); cursor: pointer; opacity: 0.85; }
.form-label input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
.form-label textarea { min-height: 120px; resize: vertical; font-family: var(--font); }
.form-label textarea.code { font-family: var(--mono); font-size: 12.5px; min-height: 220px; }
.form-row { display: flex; gap: 14px; }
.form-row > * { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--r-sm); overflow: hidden; }
.seg button { padding: 8px 14px; background: var(--surface-2); border: 0; border-right: 1px solid var(--border); font-size: 13px; color: var(--text-secondary); }
.seg button:last-child { border-right: 0; }
.seg button.active { background: var(--accent-grad); color: #0b111f; font-weight: 600; }

/* ============ Chat ============ */
.chat-wrap { display: flex; flex-direction: column; gap: 0; height: calc(100vh - 230px); min-height: 420px; }
.chat-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding: 6px 4px 18px; }
.chat-empty { margin: auto; text-align: center; color: var(--muted); max-width: 460px; }
.chat-empty .ce-icon { font-size: 34px; }
.chat-empty h3 { margin: 12px 0 6px; font-size: 18px; color: var(--text); }
.msg { max-width: 760px; }
.msg.user { align-self: flex-end; }
.msg.assistant { align-self: flex-start; width: 100%; }
.msg-bubble { padding: 12px 16px; border-radius: var(--r-md); font-size: 13.5px; line-height: 1.6; }
.msg.user .msg-bubble { background: var(--navy-grad); border: 1px solid rgba(201,161,74,0.25); }
.msg.assistant .msg-bubble { background: var(--surface); border: 1px solid var(--border); }
.msg-meta { font-size: 11px; color: var(--faint); margin: 4px 4px 0; }
.answer-block { display: flex; flex-direction: column; gap: 12px; }
.answer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.conf-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.conf-high { background: var(--good-2); color: var(--good); border: 1px solid rgba(63,174,122,0.35); }
.conf-medium { background: var(--warn-2); color: var(--warn); border: 1px solid rgba(224,162,58,0.35); }
.conf-low { background: var(--bad-2); color: var(--bad); border: 1px solid rgba(217,83,79,0.35); }
.answer-disclaimer { background: var(--warn-2); border-left: 3px solid var(--warn); border-radius: 6px; padding: 10px 13px; font-size: 12px; line-height: 1.55; color: var(--text-secondary); }
.citations { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.citations li { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; font-size: 12.5px; color: var(--text-secondary); }
.citations li .cite-src { color: var(--accent); font-weight: 600; }
.citations li a.cite-src:hover { text-decoration: underline; }
.escalate-box { background: linear-gradient(135deg, rgba(217,83,79,0.12), rgba(224,162,58,0.10)); border: 1px solid rgba(217,83,79,0.3); border-radius: var(--r-md); padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.escalate-box .eb-text { font-size: 13px; color: var(--text-secondary); }
.escalate-box .eb-text strong { color: var(--text); }
.chat-input-row { display: flex; gap: 10px; align-items: flex-end; border-top: 1px solid var(--border); padding-top: 14px; }
.chat-input-row textarea { flex: 1; min-height: 46px; max-height: 160px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--r-sm); color: var(--text); font: inherit; font-size: 13.5px; resize: vertical; }
.chat-input-row textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201,161,74,0.16); }

/* ============ Chat multi-session layout ============ */
.chat-view { padding: 0; overflow: hidden; }
.chat-layout { display: grid; grid-template-columns: 232px 1fr; min-height: 0; }
@media (max-width: 760px) { .chat-layout { grid-template-columns: 1fr; } }
.conv-rail { border-right: 1px solid var(--border); padding: 16px 12px; display: flex; flex-direction: column; gap: 12px; background: rgba(10,16,32,0.35); }
@media (max-width: 760px) { .conv-rail { border-right: 0; border-bottom: 1px solid var(--border); } }
.conv-list { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; max-height: calc(100vh - 320px); }
.conv-empty { font-size: 12px; padding: 14px 8px; text-align: center; }
.conv-item { display: flex; align-items: center; gap: 6px; padding: 8px 9px; border-radius: var(--r-sm); cursor: pointer; border: 1px solid transparent; transition: background 0.15s, border-color 0.15s; }
.conv-item:hover { background: var(--surface-2); }
.conv-item.active { background: var(--surface-2); border-color: var(--border); }
.conv-item-main { flex: 1; min-width: 0; }
.conv-title { font-size: 13px; font-weight: 500; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item.active .conv-title { color: var(--text); }
.conv-date { font-size: 10.5px; color: var(--faint); margin-top: 1px; }
.conv-actions { display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s; }
.conv-item:hover .conv-actions, .conv-item.active .conv-actions { opacity: 1; }
.conv-act { background: transparent; border: 0; color: var(--muted); font-size: 12px; padding: 3px 5px; border-radius: 5px; }
.conv-act:hover { background: var(--surface-3); color: var(--text); }
.chat-wrap { padding: 18px 22px 20px; }

/* ============ Chat input tools ============ */
.chat-input-tools { display: flex; gap: 4px; align-items: center; }
.chat-iconbtn { padding: 9px 10px; font-size: 15px; line-height: 1; }
.chat-iconbtn.recording { background: var(--bad-2); border-color: rgba(217,83,79,0.4); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.chat-attachments { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0 0; }
.chat-attachments:empty { padding: 0; }
.attach-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px 5px 10px; border-radius: 999px; font-size: 12px; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-secondary); }
.attach-x { background: transparent; border: 0; color: var(--muted); font-size: 11px; padding: 0 2px; }
.attach-x:hover { color: var(--bad); }

/* ============ Knowledge drop zone ============ */
.kn-drop { margin-top: 6px; border: 1.5px dashed var(--border-strong); border-radius: var(--r-md); padding: 22px 16px; text-align: center; cursor: pointer; color: var(--text-secondary); transition: border-color 0.15s, background 0.15s; }
.kn-drop:hover, .kn-drop.dragover { border-color: var(--accent); background: rgba(201,161,74,0.06); }
.kn-drop-icon { font-size: 22px; color: var(--accent); margin-bottom: 6px; }
.kn-drop-link { color: var(--accent); font-weight: 600; }

/* ============ Result panels ============ */
.result-panel { display: flex; flex-direction: column; gap: 16px; }
.risk-banner { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-radius: var(--r-md); border: 1px solid var(--border); }
.risk-banner .rb-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 600; }
.risk-banner .rb-value { font-family: var(--serif); font-size: 24px; font-weight: 700; }
.risk-banner.risk-high { background: var(--bad-2); border-color: rgba(217,83,79,0.3); }
.risk-banner.risk-high .rb-value { color: var(--bad); }
.risk-banner.risk-medium { background: var(--warn-2); border-color: rgba(224,162,58,0.3); }
.risk-banner.risk-medium .rb-value { color: var(--warn); }
.risk-banner.risk-low { background: var(--good-2); border-color: rgba(63,174,122,0.3); }
.risk-banner.risk-low .rb-value { color: var(--good); }
.clause-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.clause-list li { background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--warn); border-radius: 6px; padding: 10px 13px; font-size: 13px; color: var(--text-secondary); }
.redline { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 12px 14px; white-space: pre-wrap; line-height: 1.6; }
.redline .del { color: var(--bad); text-decoration: line-through; }
.redline .ins { color: var(--good); }
.draft-output { font-family: var(--serif); font-size: 14px; line-height: 1.75; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-md); padding: 32px 36px; white-space: pre-wrap; max-height: 620px; overflow-y: auto; }

/* Matters — create form + per-row status select */
.matter-create { border-top: 1px solid var(--border); padding-top: 16px; }
.matter-status-sel { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); border-radius: 6px; padding: 4px 8px; font: inherit; font-size: 12.5px; }
.matter-status-sel:focus { outline: none; border-color: var(--accent); }

/* ============ Saved reviews / drafts list ============ */
/* Accent edge keeps the saved-reviews / saved-drafts card visually prominent
   so prior work is easy to find rather than buried below the result panel. */
.card-list { border-left: 3px solid var(--accent); }
.saved-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.saved-toolbar-note:empty { display: none; }
.saved-list { display: flex; flex-direction: column; gap: 4px; }
.saved-item { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: var(--r-sm); border: 1px solid transparent; transition: background 0.15s, border-color 0.15s; }
.saved-item:hover { background: var(--surface-2); border-color: var(--border); }
.saved-item-check { width: 15px; height: 15px; flex-shrink: 0; accent-color: var(--accent); cursor: pointer; }
.saved-item-main { flex: 1; min-width: 0; cursor: pointer; }
.saved-item-name { font-size: 13.5px; font-weight: 500; color: var(--text); display: flex; align-items: center; gap: 4px; }
.saved-item-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-item-date { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.saved-item-meta { flex-shrink: 0; }

/* Small inline icon buttons (rename / delete on a row). */
.icon-btn { background: transparent; border: 0; padding: 3px; margin: 0; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); border-radius: 5px; cursor: pointer; flex-shrink: 0; }
.icon-btn:hover { color: var(--accent); background: var(--surface-3); }
.icon-btn-danger:hover { color: var(--bad); background: var(--bad-2); }

/* ============ Help screen ============ */
.help-features { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 760px) { .help-features { grid-template-columns: 1fr; } }
.help-feature { display: flex; gap: 12px; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.help-feature .hf-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; font-size: 15px; color: var(--accent); flex-shrink: 0; }
.help-feature .hf-name { font-weight: 600; font-size: 13.5px; color: var(--text); }
.help-feature .hf-blurb { font-size: 12.5px; color: var(--text-secondary); line-height: 1.55; margin-top: 4px; }
.help-suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.help-suggestion { padding: 7px 12px; border-radius: 999px; font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-secondary); transition: background 0.15s, border-color 0.15s, color 0.15s; }
.help-suggestion:hover { background: var(--surface-3); border-color: var(--accent); color: var(--text); }
.help-messages { height: auto; min-height: 200px; max-height: calc(100vh - 420px); }
.help-answer { font-size: 13.5px; line-height: 1.65; }

/* ============ Empty / loading ============ */
.empty-state { text-align: center; color: var(--muted); padding: 48px 20px; }
.empty-state .es-icon { font-size: 32px; }
.empty-state h3 { margin: 12px 0 6px; color: var(--text); font-size: 17px; }
.loading-note { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.spinner { width: 14px; height: 14px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Modal ============ */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,16,32,0.74); backdrop-filter: blur(4px); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; animation: fadeIn 0.15s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); width: 100%; max-width: 540px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); max-height: 90vh; display: flex; flex-direction: column; }
.modal-header { padding: 22px 24px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.modal-header h3 { font-size: 18px; font-weight: 600; margin-top: 4px; }
.modal-body { padding: 20px 24px; flex: 1; overflow-y: auto; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.18); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,0.28); }
