:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e2e5ea;
  --border-strong: #cfd4dc;
  --text: #1c2330;
  --text-2: #4c5566;
  --muted: #6b7486;
  --accent: #3b5bdb;
  --accent-soft: #eef2ff;
  --accent-text: #2f4ac0;
  --yes: #1f7a4d;
  --yes-bg: #e6f4ec;
  --maybe: #946200;
  --maybe-bg: #fdf3dc;
  --no: #5f6878;
  --no-bg: #eef0f3;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --mark: #ffe58a;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218;
    --surface: #171b23;
    --surface-2: #1e232d;
    --border: #2a303c;
    --border-strong: #3a4250;
    --text: #e6e9ef;
    --text-2: #b8bfcc;
    --muted: #8a93a3;
    --accent: #7c93f5;
    --accent-soft: #1d2440;
    --accent-text: #a5b4fc;
    --yes: #5fd39a;
    --yes-bg: #13301f;
    --maybe: #f2c35b;
    --maybe-bg: #33280e;
    --no: #9aa3b2;
    --no-bg: #222834;
    --danger: #ff8a80;
    --danger-bg: #3a1614;
    --mark: #6b5a12;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5em; }
h1 { font-size: 1.6rem; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
h4 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-top: 1.2em; }
p { margin: 0 0 0.75em; }
code { font-family: var(--mono); font-size: 0.85em; }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.nowrap { white-space: nowrap; }
.warn-text { color: var(--maybe); }
.row { display: flex; align-items: center; }
.row.gap { gap: 8px; }
.row.between { justify-content: space-between; gap: 12px; }
.row.wrap { flex-wrap: wrap; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px; height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand svg { width: 22px; height: 22px; }
.brand svg rect { fill: var(--accent); }
.brand svg path { stroke: #fff; stroke-width: 2.4; stroke-linecap: round; }
.tabs { display: flex; gap: 4px; height: 100%; }
.tabs a {
  display: flex; align-items: center; padding: 0 12px; color: var(--text-2);
  border-bottom: 2px solid transparent; font-weight: 500;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.status { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 0.85rem; }
.spend { color: var(--muted); }
.jobs-pill {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px;
  background: var(--accent-soft); color: var(--accent-text); border-radius: 999px;
  max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.spinner {
  width: 12px; height: 12px; border-radius: 50%; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.banner { padding: 10px 24px; font-size: 0.9rem; }
.banner-warn { background: var(--maybe-bg); color: var(--maybe); }

main { max-width: 1240px; margin: 0 auto; padding: 28px 24px 80px; outline: none; }
.page-head { margin-bottom: 20px; }
.lede { color: var(--text-2); max-width: 760px; }
.crumbs { margin-bottom: 12px; font-size: 0.9rem; color: var(--muted); }
.loading { color: var(--muted); padding: 40px 0; }

/* ---------- building blocks ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.panel { border-radius: var(--radius); padding: 14px 18px; margin-bottom: 16px; }
.panel-accent { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.error-box { background: var(--danger-bg); color: var(--danger); padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty h3 { color: var(--text-2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 550; font-size: 0.9rem; line-height: 1;
  padding: 9px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: var(--surface); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-small { padding: 6px 10px; font-size: 0.82rem; }
.btn-tiny { padding: 3px 7px; font-size: 0.75rem; border-radius: 6px; }

.input, .field input, .field select, .field textarea, .search, textarea, select, input[type="date"] {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 10px; width: 100%;
}
textarea { resize: vertical; }
.input:focus, input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 0; border-color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; }
.field > span { color: var(--muted); font-weight: 500; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field.inline select { width: auto; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 0.88rem; color: var(--text-2); white-space: nowrap; }
.form-grid { display: grid; gap: 12px; margin-top: 12px; }
.summary-btn { cursor: pointer; font-weight: 600; color: var(--accent-text); list-style: none; }
.summary-btn::-webkit-details-marker { display: none; }

.chip {
  display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border); white-space: nowrap;
}
.chip-yes { background: var(--yes-bg); color: var(--yes); border-color: transparent; }
.chip-maybe { background: var(--maybe-bg); color: var(--maybe); border-color: transparent; }
.chip-no { background: var(--no-bg); color: var(--no); border-color: transparent; }
.chip-override { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.chip-soft { font-weight: 500; margin-left: 6px; }
.chip-status-pending { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; margin-left: 6px; }
.chip-status-error { background: var(--danger-bg); color: var(--danger); border-color: transparent; margin-left: 6px; }
.tag { display: inline-block; margin: 0 4px 4px 0; padding: 0 7px; border-radius: 6px; background: var(--surface-2); font-size: 0.8rem; }
.tone { font-size: 0.78rem; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.tone-tense, .tone-critical, .tone-mixed { background: var(--maybe-bg); color: var(--maybe); }
.tone-hostile { background: var(--danger-bg); color: var(--danger); }
.tone-cordial, .tone-conciliatory, .tone-apologetic { background: var(--yes-bg); color: var(--yes); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 0 8px; font-size: 0.88rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.hash { font-size: 0.75rem; word-break: break-all; }

.quote {
  margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--border-strong);
  background: var(--surface-2); border-radius: 0 6px 6px 0; font-size: 0.9rem;
}
.quote a { color: var(--text); }
.quote-unverified { border-left-color: var(--maybe); }
.verify { margin-left: 8px; font-size: 0.75rem; white-space: nowrap; }
.verify.ok { color: var(--yes); }
.verify.bad { color: var(--maybe); font-weight: 600; }

.progress { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; margin-top: 8px; }
.progress-label { grid-column: 1 / -1; font-size: 0.88rem; color: var(--text-2); }
.progress-track { height: 8px; background: color-mix(in srgb, var(--accent) 15%, var(--surface)); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); transition: width 0.4s; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); opacity: 0;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; z-index: 100;
  transition: all 0.25s; max-width: min(90vw, 560px); font-size: 0.9rem;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: var(--danger); color: #fff; }

/* ---------- library ---------- */
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface);
  padding: 22px; text-align: center; margin-bottom: 16px; display: grid; gap: 10px; justify-items: center;
}
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-title { font-weight: 650; font-size: 1.05rem; }
.dropzone-sub { color: var(--muted); font-size: 0.85rem; max-width: 640px; }
.upload-log { font-size: 0.88rem; color: var(--text-2); }
.upload-errors { text-align: left; }

.filters { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; display: grid; gap: 12px; }
.search-row { display: flex; gap: 12px; align-items: center; }
.search-row .search { flex: 1; font-size: 1rem; padding: 10px 12px; }
.filter-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filter-row .field { min-width: 130px; flex: 1; }
.list-head { margin: 8px 0 10px; }
.list-head h2 { margin: 0; }

.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.doc-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.doc-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc-table tbody tr { cursor: pointer; }
.doc-table tbody tr:hover { background: var(--surface-2); }
.doc-table.compact td, .doc-table.compact th { padding: 6px 10px; }
.doc-table.compact tbody tr { cursor: default; }
.doc-title { font-weight: 600; color: var(--text); }
.doc-cell { min-width: 320px; }
.summary, .snippet { color: var(--text-2); font-size: 0.85rem; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.match-by { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.people-cell { max-width: 220px; font-size: 0.85rem; }

/* ---------- document ---------- */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.subtabs { display: flex; gap: 4px; margin-bottom: 8px; }
.subtabs button { font: inherit; font-size: 0.88rem; padding: 6px 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 8px; cursor: pointer; }
.subtabs button.active { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; font-weight: 600; }
.doc-text {
  margin: 0; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  white-space: pre-wrap; word-wrap: break-word; font: 0.9rem/1.6 var(--font); max-height: 78vh; overflow: auto;
}
.hl-miss { background: var(--maybe-bg); color: var(--maybe); padding: 6px 10px; border-radius: 6px; margin-bottom: 10px; font-size: 0.85rem; }
.original { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; text-align: center; }
.original img { max-width: 100%; height: auto; }
.original-pdf { width: 100%; height: 78vh; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.doc-side .card { padding: 16px; }
.people { margin: 0; padding-left: 18px; font-size: 0.9rem; }
.children { margin: 0 0 12px; padding-left: 18px; font-size: 0.88rem; max-height: 300px; overflow: auto; }
.concept-line { margin-bottom: 8px; }

/* ---------- ask / screenings ---------- */
.ask-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start; }
.ask-history ul { list-style: none; padding: 0; margin: 0; }
.ask-history li { padding: 8px 10px; border-radius: 8px; }
.ask-history li.active { background: var(--accent-soft); }
.ask-history li a { color: var(--text); font-size: 0.9rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.question-input { font-size: 1.05rem; padding: 12px; }
.question-text { font-size: 1.1rem; font-weight: 600; }
.examples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0 14px; }
.example { font: inherit; font-size: 0.8rem; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); border-radius: 999px; padding: 3px 10px; cursor: pointer; text-align: left; }
.example:hover { border-color: var(--accent); color: var(--accent-text); }
.mode-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.mode-opt { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.mode-opt.active { border-color: var(--accent); background: var(--accent-soft); }
.mode-opt input { grid-row: span 2; margin-top: 3px; }
.mode-title { font-weight: 600; font-size: 0.9rem; }
.mode-desc { font-size: 0.8rem; color: var(--muted); }
.estimate { font-size: 0.88rem; color: var(--text-2); }
.answer { font-size: 0.97rem; line-height: 1.65; }
.answer h3, .answer h4, .answer h5 { margin-top: 1.2em; text-transform: none; letter-spacing: 0; color: var(--text); font-size: 1rem; }
.answer ul, .answer ol { padding-left: 22px; }
.answer li { margin-bottom: 4px; }
.answer blockquote { margin: 8px 0; padding-left: 12px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.cite { font-size: 0.82em; font-weight: 600; background: var(--accent-soft); padding: 0 4px; border-radius: 4px; }
.screen-group { margin-bottom: 20px; }
.screen-group > summary { cursor: pointer; }
h3.inline { display: inline; }
.screen-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.screen-list > li { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.screen-list > li:last-child { border-bottom: 0; }
.reason { color: var(--text-2); font-size: 0.88rem; margin-top: 4px; }
.override-btns { margin-left: auto; display: inline-flex; gap: 4px; opacity: 0.35; transition: opacity 0.15s; }
.screen-list li:hover .override-btns { opacity: 1; }

/* ---------- concepts / timelines lists ---------- */
.concept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.concept-card { color: var(--text); display: block; margin: 0; }
.concept-card:hover { border-color: var(--accent); text-decoration: none; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 0.88rem; }
.toolbar { margin-bottom: 14px; }
.notes h3 { font-size: 0.9rem; margin-top: 8px; }
.notes ul { margin: 0 0 8px; padding-left: 20px; font-size: 0.9rem; }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0 0 20px; padding: 0 0 0 8px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 8px; bottom: 8px; width: 2px; background: var(--border-strong); }
.tl-year { font-weight: 700; color: var(--muted); margin: 18px 0 8px 32px; font-size: 0.85rem; letter-spacing: 0.05em; }
.tl-item { position: relative; padding-left: 32px; margin-bottom: 14px; }
.tl-dot { position: absolute; left: 1px; top: 18px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); }
.tl-item.has-conflict .tl-dot { border-color: var(--maybe); }
.tl-body { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); }
.tl-date { font-weight: 650; color: var(--accent-text); font-size: 0.9rem; margin-bottom: 2px; }
.tl-title { font-size: 1.02rem; margin: 2px 0 6px; }
.flags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.flag { font-size: 0.78rem; padding: 2px 8px; border-radius: 6px; background: var(--no-bg); color: var(--text-2); }
.flag-conflict { background: var(--maybe-bg); color: var(--maybe); font-weight: 600; }
.tl-sources { margin-top: 8px; }
.tl-source { margin-bottom: 6px; }
.source-chip { font-size: 0.82rem; font-weight: 600; }
.event-form .row .field { flex: 1; min-width: 140px; }
.print-only { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .doc-layout, .ask-layout { grid-template-columns: 1fr; }
  .topbar { gap: 12px; padding: 0 12px; overflow-x: auto; }
  .status .spend { display: none; }
}
@media (max-width: 640px) {
  main { padding: 20px 16px 60px; }
  .brand { font-size: 0; gap: 0; }
  .mode-toggle { grid-template-columns: 1fr; }
  .search-row { flex-wrap: wrap; }
  .doc-cell { min-width: 220px; }
}

/* ---------- print (timelines) ---------- */
@media print {
  :root { --bg: #fff; --surface: #fff; --shadow: none; }
  .topbar, #banner, .no-print, .ask-history, .override-btns, .btn { display: none !important; }
  .print-only { display: inline; }
  main { padding: 0; max-width: none; }
  .tl-body, .card { break-inside: avoid; border-color: #ccc; }
  a { color: #000; }
  .verify.ok { color: #1f7a4d; }
}

/* ---------- source & sharing ---------- */
.upload-labels { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; width: 100%; max-width: 760px; text-align: left; }
.upload-labels > .field:first-child { flex: 1; min-width: 220px; }
.shared-field { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.shared-field .date-inline, .thread-head .date-inline { width: auto; padding: 4px 8px; }
.field input[type="checkbox"], .check input[type="checkbox"], .check input[type="radio"] { width: auto; padding: 0; }
.form-grid.tight { gap: 8px; margin-top: 4px; }
.source-tag { font-size: 0.78rem; padding: 1px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.share { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 1px 7px; border-radius: 6px; margin: 0 4px 2px 0; white-space: nowrap; }
.share-company { background: var(--no-bg); color: var(--text-2); }
.share-mine { background: var(--yes-bg); color: var(--yes); }
.share-cell { min-width: 110px; }
.doc-table th.sel, .doc-table td.sel { width: 32px; padding-right: 0; cursor: default; }
.bulk-bar {
  position: sticky; top: 64px; z-index: 5; display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px;
}
.bulk-bar[hidden] { display: none; }
.bulk-bar .input { width: auto; min-width: 170px; padding: 6px 8px; font-size: 0.88rem; }
.history ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- Jira ticket view ---------- */
.ticket { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.ticket-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 4px; }
.ticket-key { font-family: var(--mono); font-weight: 700; color: var(--accent-text); }
.ticket-summary { font-size: 1.1rem; font-weight: 650; }
.ticket-fields { margin-top: 12px; }
.ticket-desc { white-space: pre-wrap; font-size: 0.92rem; background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.small-tabs button { font-size: 0.8rem; padding: 4px 10px; }
.activity { list-style: none; margin: 8px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--border); }
.act { position: relative; margin: 0 0 12px; padding-left: 12px; }
.act::before { content: ""; position: absolute; left: -21px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); }
.act-comment::before { border-color: var(--accent); }
.act-head { font-size: 0.88rem; }
.act-comment .act-body { white-space: pre-wrap; margin-top: 4px; padding: 8px 12px; background: var(--surface-2); border-radius: 8px; font-size: 0.92rem; }
.act-change .act-body { font-size: 0.85rem; color: var(--text-2); }
.changes { margin: 2px 0 0; padding-left: 16px; font-size: 0.85rem; color: var(--text-2); }
.field-name { font-weight: 600; color: var(--text); }
.changes .from { text-decoration: line-through; opacity: 0.75; }

/* ---------- text-message conversation ---------- */
.panel-plain { background: var(--surface); border: 1px dashed var(--border-strong); }
.thread-opt { white-space: normal; }
.thread { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.thread-head { display: grid; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.name-input { width: auto; min-width: 180px; padding: 4px 8px; }
.legend { color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: -1px; }
.dot.me { background: #0a84ff; }
.dot.other { background: #d1d1d6; }
.chat { display: flex; flex-direction: column; gap: 2px; max-height: 78vh; overflow: auto; padding: 4px 2px; }
.chat-time { text-align: center; font-size: 0.78rem; color: var(--muted); margin: 14px 0 6px; font-weight: 600; }
.bubble-row { display: flex; flex-direction: column; max-width: 78%; margin-bottom: 6px; }
.bubble-row.me { align-self: flex-end; align-items: flex-end; }
.bubble-row.other, .bubble-row.unknown { align-self: flex-start; align-items: flex-start; }
.bubble { padding: 7px 12px; border-radius: 18px; font-size: 0.93rem; line-height: 1.35; white-space: pre-wrap; word-wrap: break-word; }
.bubble.me { background: #0a84ff; color: #fff; border-bottom-right-radius: 6px; }
.bubble.me.green { background: #30b94d; }
.bubble.other { background: #e9e9eb; color: #111; border-bottom-left-radius: 6px; }
.bubble.unknown { background: var(--maybe-bg); color: var(--text); border: 1px dashed var(--maybe); }
.bubble-att { font-style: italic; opacity: 0.9; }
.bubble-meta { font-size: 0.78rem; opacity: 0.85; margin-top: 2px; }
.bubble-foot { font-size: 0.72rem; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.page-link, .swap { font: inherit; background: none; border: none; color: var(--accent-text); cursor: pointer; padding: 0 2px; }
.swap { opacity: 0; transition: opacity 0.15s; }
.bubble-row:hover .swap { opacity: 1; }
.edited { color: var(--accent-text); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bubble.other { background: #3a3a3c; color: #f2f2f7; }
}

/* ---------- exclusions ---------- */
.suggest { display: grid; gap: 6px; }
.suggest-rules { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 4px; }
.suggest-rule { display: flex; align-items: center; gap: 8px; }
.chip-excluded { background: var(--no-bg); color: var(--no); border-color: transparent; margin-left: 6px; }
.row-excluded td { opacity: 0.55; }
.exclude-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 0.85rem; }
.exclude-row.on { color: var(--text-2); }
.check.block { display: flex; white-space: normal; margin: 6px 0; align-items: flex-start; }

/* ---------- sign-in & roles ---------- */
.login-body { display: grid; min-height: 100vh; place-items: center; }
.login-main { width: 100%; max-width: 380px; padding: 16px; }
.login-card { display: grid; gap: 12px; padding: 24px; }
.login-brand { font-size: 1.1rem; margin-bottom: 4px; }
.user-pill { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.user-pill .btn { padding: 4px 8px; font-size: 0.8rem; }
.allowance { color: var(--accent-text); font-weight: 600; }
.allowance.low { color: var(--danger); }
body[data-role="reviewer"] .owner-only { display: none !important; }
.password-box { font-family: var(--mono); font-size: 1rem; background: var(--surface-2); padding: 10px 12px; border-radius: 8px; user-select: all; word-break: break-all; }
body:not([data-role="reviewer"]) .reviewer-only { display: none !important; }
.row-warn td { color: var(--danger); }
.activity-log { max-height: 420px; overflow: auto; }
.add-person { margin-top: 12px; }
.history-item { position: relative; padding-right: 26px !important; }
.history-del { position: absolute; right: 4px; top: 6px; border: none; background: none; color: var(--muted); font-size: 1.05rem; line-height: 1; cursor: pointer; opacity: 0; padding: 2px 6px; border-radius: 6px; }
.history-item:hover .history-del, .history-del:focus { opacity: 1; }
.history-del:hover { background: var(--danger-bg); color: var(--danger); }
