/* Unified design for the whole site (editor, settings, lab, learn, books, comments, and the sources DB at /sources).
   One set of tokens; every page uses templates/_base.html + _nav.html. 13.11.2026 */
:root {
  --bg: #f5f3ee; --surface: #ffffff; --surface-2: #faf9f6; --sunken: #f0ede6;
  --ink: #1d2126; --ink-2: #3d434b; --muted: #6a7079; --line: #e4dfd4; --line-2: #d6cfc0;
  --brand: #8a6a2c; --brand-strong: #6f5422; --brand-soft: #f5eddb; --brand-tint: #fbf7ee;
  --accent: #24557d; --accent-soft: #e6eff7;
  --ok: #1f7a4a; --ok-soft: #e4f3ea; --warn: #9a5b00; --warn-soft: #fdf1dc; --bad: #b3261e; --bad-soft: #fbe8e6;
  --hl: #fff5cc; --src: #e8f0fb; --src-ink: #1d4f91; --fn: #e8f5e4; --fn-ink: #2d6a1e;
  --r: 10px; --r-sm: 7px; --shadow: 0 1px 2px rgba(30, 25, 10, .06), 0 2px 8px rgba(30, 25, 10, .05);
  --shadow-lg: 0 10px 30px rgba(20, 16, 6, .18);
  --ui: "Heebo", "Segoe UI", "Assistant", Arial, sans-serif;
  --read: "Frank Ruhl Libre", "David", "Times New Roman", serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--ui); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 700; color: var(--ink); }
h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 16px; } h4 { font-size: 15px; }
code, kbd { font-family: Consolas, "Courier New", monospace; font-size: .9em; }
kbd { background: rgba(255,255,255,.18); border: 1px solid rgba(0,0,0,.12); border-radius: 4px; padding: 0 4px; font-size: 11px; }
small, .muted { color: var(--muted); font-weight: normal; }
.hidden { display: none !important; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* ---------- form controls ---------- */
button, select, input, textarea { font-family: inherit; font-size: 14px; color: var(--ink); }
input[type=text], input:not([type]), input[type=number], input[type=password], input[type=search], select, textarea {
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 6px 9px; min-height: 34px;
  transition: border-color .15s, box-shadow .15s; }
textarea { min-height: 80px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(138, 106, 44, .16); }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); width: 16px; height: 16px; vertical-align: -3px; margin: 0 0 0 4px; }
input[type=file] { font-size: 14px; max-width: 100%; }
label { color: var(--ink-2); }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 6px 13px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); border-radius: var(--r-sm); cursor: pointer;
  font-weight: 500; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; }
button:hover, .btn:hover { background: var(--surface-2); border-color: var(--brand); text-decoration: none; }
button:focus-visible, .btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(138, 106, 44, .25); }
button:disabled { opacity: .55; cursor: default; }
button.primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover, .btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
button.ghost, .btn.ghost { background: transparent; border-color: transparent; color: var(--brand-strong); }
button.ghost:hover, .btn.ghost:hover { background: var(--brand-soft); border-color: transparent; }
button.danger { color: var(--bad); } button.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
button.small, .btn.small { min-height: 26px; padding: 2px 9px; font-size: 12.5px; border-radius: 6px; }
button.icon { min-width: 34px; padding: 4px 8px; }

/* ---------- app bar (all pages) ---------- */
.appbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 14px; height: 54px; padding: 0 18px;
  background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(0,0,0,.02); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none !important; flex: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--brand); color: #fff;
  font-family: var(--read); font-weight: 700; font-size: 19px; line-height: 1; }
.brand-name { font-weight: 700; font-size: 15px; line-height: 1.15; }
.brand-name small { display: block; font-size: 11.5px; font-weight: 400; }
.mainnav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a { padding: 7px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 500; white-space: nowrap; text-decoration: none; font-size: 14px; }
.mainnav a:hover { background: var(--sunken); color: var(--ink); }
.mainnav a.on { background: var(--brand-soft); color: var(--brand-strong); font-weight: 700; }
.appbar-end { display: flex; align-items: center; gap: 6px; flex: none; }
.fb-open { position: relative; }
.fb-dot { position: absolute; top: 3px; left: 3px; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); border: 2px solid var(--surface); }

/* dropdown menus (<details class="menu">) */
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary.btn::after, details.menu > summary.caret::after { content: "▾"; font-size: 11px; opacity: .7; }
.menu-pop { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 60; min-width: 230px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.menu-pop.wide { min-width: 300px; }
.menu-pop > a, .menu-pop > button, .menu-pop .mi { display: flex; justify-content: flex-start; align-items: center; gap: 8px; width: 100%; padding: 8px 10px;
  border: 0; border-radius: 7px; background: transparent; color: var(--ink); font-weight: 500; text-align: start; min-height: 0; }
.menu-pop > a:hover, .menu-pop > button:hover { background: var(--sunken); text-decoration: none; }
.menu-pop > button { flex-wrap: wrap; row-gap: 0; }
.menu-pop .mi-sub { font-size: 12px; color: var(--muted); font-weight: 400; display: block; flex-basis: 100%; }
.menu-pop .sep { height: 1px; background: var(--line); margin: 4px 2px; }
.menu-pop .menu-h { font-size: 12px; color: var(--muted); padding: 6px 10px 2px; font-weight: 600; }
.menu-pop .row { padding: 4px 10px; }
.user-chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 6px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 13px; }

/* ---------- page layout ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 22px 18px 60px; }
.page.wide { max-width: 1400px; }
.page.narrow { max-width: 760px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
details.card > summary { cursor: pointer; font-weight: 700; }
.grid { display: grid; gap: 16px; } .grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.row { display: flex; gap: 10px 16px; flex-wrap: wrap; align-items: center; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 14px; margin: 12px 0; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field input, .field select, .field textarea { width: 100%; font-weight: 400; }
.card form label:not(.field):not(.chk):not(.drop) { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0; }
.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.hint { color: var(--muted); font-size: 13.5px; margin: 6px 0 10px; line-height: 1.6; }
.okmsg, .flash-msg { background: var(--ok-soft); color: var(--ok); border: 1px solid #bfe1cc; padding: 10px 14px; border-radius: var(--r-sm); font-weight: 600; margin: 0 0 14px; }
.err { color: var(--bad); font-weight: 600; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 14px; min-width: 96px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 20px; line-height: 1.2; } .stat span { font-size: 12px; color: var(--muted); }
.steps-list { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 6px; }
ul.clean { padding-inline-start: 18px; margin: 4px 0; } ul.clean li { margin: 4px 0; }

/* tabs (segmented) */
.seg-tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--sunken); border-radius: 9px; flex-wrap: wrap; }
.seg-tabs button { border: 0; background: transparent; min-height: 30px; padding: 4px 12px; border-radius: 7px; color: var(--ink-2); font-weight: 500; }
.seg-tabs button:hover { background: rgba(255,255,255,.6); }
.seg-tabs button.active, .seg-tabs button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 700; }

/* tables */
.tablebox { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-sm); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: start; font-weight: 600; font-size: 12.5px; color: var(--muted); background: var(--surface-2); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: center; font-variant-numeric: tabular-nums; }
table.talks tbody tr { cursor: pointer; } table.talks tbody tr:hover td { background: var(--brand-tint); }
table.talks .t-name { font-weight: 700; color: var(--ink); } table.talks .t-sub { font-size: 12.5px; color: var(--muted); display: block; }
.tablebox table.settings td { padding: 5px 6px; } table.settings input, table.settings select { font-size: 13px; min-height: 30px; padding: 4px 6px; }
table.lab td, table.lab th { font-size: 13px; }

/* badges */
.badge, span.st { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 20px; background: var(--sunken); color: var(--ink-2); white-space: nowrap; }
span.st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.st-new { background: var(--accent-soft); color: var(--accent); }
.st-queued { background: var(--warn-soft); color: var(--warn); }
.st-running, .st-downloading, .st-review { background: var(--accent-soft); color: var(--accent); }
.st-running::before, .st-downloading::before { animation: pulse 1.2s infinite; }
.st-done { background: var(--ok-soft); color: var(--ok); }
.st-error, .st-declined { background: var(--bad-soft); color: var(--bad); }
.st-waiting { background: var(--warn-soft); color: var(--warn); }
.st-final { background: var(--brand-soft); color: var(--brand-strong); }
@keyframes pulse { 50% { opacity: .2; } }
p.st-error, div.st-error { background: none; padding: 0; } p.st-error::before { display: none; }

/* upload drop zone */
.drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 22px; border: 2px dashed var(--line-2);
  border-radius: var(--r); background: var(--surface-2); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-tint); }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop .drop-ic { font-size: 26px; line-height: 1; } .drop b { font-size: 15px; } .drop .fname { color: var(--brand-strong); font-weight: 700; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type=search] { flex: 1 1 220px; max-width: 340px; }
.empty { text-align: center; color: var(--muted); padding: 26px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 18px; inset-inline-start: 50%; transform: translateX(50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #23272d; color: #fff; padding: 10px 16px; border-radius: 9px; box-shadow: var(--shadow-lg); font-size: 14px; pointer-events: auto; max-width: min(560px, 92vw); animation: tin .2s ease-out; }
.toast.ok { background: var(--ok); } .toast.bad { background: var(--bad); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

/* ---------- comments drawer ---------- */
.drawer-back { position: fixed; inset: 0; background: rgba(20, 18, 12, .32); z-index: 200; animation: fade .15s; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(440px, 100vw); background: var(--surface); z-index: 201; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: din .2s ease-out; }
@keyframes din { from { transform: translateX(-30px); opacity: 0; } } @keyframes fade { from { opacity: 0; } }
.drawer-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.drawer-h h2 { margin: 0; }
.drawer-b { padding: 16px 18px; overflow-y: auto; flex: 1; }
.drawer textarea { width: 100%; min-height: 110px; }
.kinds { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 10px; }
.kinds label { display: inline-flex; align-items: center; gap: 4px; padding: 4px 11px; border: 1px solid var(--line-2); border-radius: 20px; cursor: pointer; font-size: 13px; }
.kinds input { display: none; } .kinds label:has(input:checked) { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-strong); font-weight: 700; }
.fb-item { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; margin: 8px 0; background: var(--surface-2); }
.fb-item.unseen { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.fb-item .fb-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.fb-item .fb-text { white-space: pre-wrap; }
.fb-thread { margin-top: 8px; border-inline-start: 3px solid var(--line); padding-inline-start: 10px; display: flex; flex-direction: column; gap: 6px; }
.fb-thread .msg { font-size: 13.5px; white-space: pre-wrap; } .fb-thread .msg b { font-size: 12px; color: var(--brand-strong); }
.fb-thread .msg.claude b { color: var(--accent); }
.fb-reply { display: flex; gap: 6px; margin-top: 8px; } .fb-reply input { flex: 1; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: grid; grid-template-columns: 128px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.timeline .tl-time { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.timeline .tl-act { font-weight: 700; margin-inline-end: 6px; }

/* ---------- guided tour ---------- */
.tour-shade { position: fixed; inset: 0; z-index: 400; }
.tour-dim { position: fixed; background: rgba(18, 15, 8, .58); transition: all .25s ease; }
.tour-spot { position: fixed; z-index: 401; border-radius: 10px; box-shadow: 0 0 0 3px var(--brand), 0 0 0 7px rgba(255,255,255,.35); transition: all .25s ease; pointer-events: none; }
.tour-spot.none { display: none; }
.tour-pop { position: fixed; z-index: 402; width: min(380px, calc(100vw - 24px)); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg);
  padding: 18px 20px 14px; transition: top .25s ease, left .25s ease; }
.tour-pop.center { width: min(520px, calc(100vw - 24px)); }
.tour-step { font-size: 12px; color: var(--brand-strong); font-weight: 700; letter-spacing: .02em; }
.tour-pop h3 { margin: 4px 0 8px; font-size: 18px; }
.tour-pop .tour-body { color: var(--ink-2); line-height: 1.65; font-size: 14.5px; }
.tour-pop .tour-body ul { padding-inline-start: 18px; margin: 6px 0; } .tour-pop .tour-body li { margin: 3px 0; }
.tour-nav { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.tour-nav .sp { flex: 1; }
.tour-dots { display: flex; gap: 4px; } .tour-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); } .tour-dots i.on { background: var(--brand); width: 16px; border-radius: 4px; }
.tour-skip { font-size: 12.5px; color: var(--muted); background: none; border: 0; min-height: 0; padding: 4px; }
.tour-skip:hover { background: none; color: var(--ink); text-decoration: underline; }

/* ---------- login ---------- */
body.login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 500px at 50% -10%, var(--brand-soft), var(--bg)); }
.login-card { width: min(410px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 30px 28px; box-shadow: var(--shadow-lg); }
.login-card .brand { justify-content: center; margin-bottom: 18px; } .login-card .brand-mark { width: 44px; height: 44px; font-size: 26px; border-radius: 12px; }
.login-card .brand-name { font-size: 18px; } .login-card .field { margin: 12px 0; } .login-card button { width: 100%; margin-top: 8px; min-height: 40px; font-size: 15px; }

/* ================= editor (talk page) ================= */
body.editor { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.talkbar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.tb-meta { display: flex; align-items: center; gap: 6px; flex: 1 1 520px; min-width: 0; flex-wrap: wrap; }
.tb-meta .back { color: var(--muted); font-size: 13px; white-space: nowrap; padding: 4px 6px; border-radius: 6px; }
.tb-meta .back:hover { background: var(--sunken); color: var(--ink); text-decoration: none; }
.tb-meta input { border-color: transparent; background: transparent; min-height: 32px; }
.tb-meta input:hover { border-color: var(--line-2); background: var(--surface); }
.tb-meta input:focus { background: var(--surface); }
.tb-meta input.title { flex: 1 1 260px; font-size: 18px; font-weight: 700; font-family: var(--read); min-width: 180px; }
.tb-meta input.occasion { width: 150px; font-weight: 600; color: var(--brand-strong); }
.tb-meta #m-year { width: 82px; } .tb-meta #m-date { width: 150px; color: var(--muted); }
.tb-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.status { font-size: 12.5px; color: var(--muted); max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status.dirty { color: var(--warn); font-weight: 600; } .status.dirty::before { content: "● "; }
.status.busy { color: var(--accent); font-weight: 600; }
.tb-actions .ver-pick select { max-width: 210px; min-height: 32px; font-size: 13px; }
.menu-pop .pages-pick input { width: 4em; }
.ver-banner { background: var(--warn-soft); border-bottom: 1px solid #ecd29e; padding: 7px 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-weight: 600; color: var(--warn); }
body.viewing #pane-draft { background: #fffdf6; }
.panes { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, .95fr); gap: 10px; padding: 10px; }
body.no-verbatim .panes { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } body.no-verbatim #pane-verbatim { display: none; }
.pane { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow-y: auto; position: relative; box-shadow: var(--shadow); }
.pane-h { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 10px 14px;
  background: rgba(255,255,255,.96); backdrop-filter: blur(4px); border-bottom: 1px solid var(--line); }
.pane-h h3 { margin: 0; font-size: 14px; color: var(--ink-2); }
.pane-h small { font-size: 12px; }
.pane-b { padding: 10px 14px 18px; }
#verbatim .seg { padding: 7px 10px; border-inline-start: 3px solid transparent; border-radius: 0 6px 6px 0; margin-bottom: 4px; line-height: 1.7; color: var(--ink-2); cursor: pointer; font-family: var(--read); font-size: 16px; }
#verbatim .seg:hover { background: var(--surface-2); }
#verbatim .seg.active { background: var(--hl); border-inline-start-color: var(--brand); }
#verbatim .seg .t { font-family: var(--ui); color: var(--accent); font-size: 11.5px; font-weight: 600; margin-inline-end: 6px; cursor: pointer; background: var(--accent-soft); padding: 1px 6px; border-radius: 10px; }
#verbatim .seg .t.playing { background: var(--accent); color: #fff; }
.blk { position: relative; margin: 4px 0; padding: 6px 10px; border-inline-start: 3px solid transparent; border-radius: 0 6px 6px 0; }
.blk:hover { background: var(--surface-2); }
.blk.active { background: var(--brand-tint); border-inline-start-color: var(--brand); }
.blk .txt { outline: none; line-height: 1.85; min-height: 1.2em; font-family: var(--read); font-size: 17px; }
.blk .txt:focus { background: #fff; box-shadow: inset 0 0 0 1px var(--line-2); border-radius: 4px; }
.blk.heading .txt { font-weight: 700; color: var(--brand-strong); font-size: 19px; }
.blk.closing .txt { font-weight: 700; color: var(--brand-strong); font-size: 17px; }
.blk .tools { position: absolute; left: 4px; top: -12px; display: none; gap: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 2px; box-shadow: var(--shadow); z-index: 2; }
.blk:hover .tools, .blk.active .tools { display: flex; }
.blk .tools select, .blk .tools button { font-size: 11.5px; padding: 1px 6px; min-height: 24px; }
.src-chip, .fn-chip { display: inline-block; font-size: 10.5px; font-family: var(--ui); font-weight: 700; padding: 0 5px; margin: 0 2px; border-radius: 5px; cursor: pointer; vertical-align: super; user-select: none; line-height: 1.5; }
.src-chip { background: var(--src); color: var(--src-ink); border: 1px solid #b8cdee; }
.src-chip.filled { background: var(--ok-soft); color: var(--ok); border-color: #a9d6b9; }
.fn-chip { background: var(--fn); color: var(--fn-ink); border: 1px solid #b5d9aa; }
.src-chip.flash, .srccard.flash, .fnrow.flash { outline: 3px solid #f0a020; outline-offset: 2px; }
.fn-h { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.fn-h h4 { margin: 0; color: var(--ink-2); }
.fnrow { display: flex; gap: 8px; align-items: flex-start; margin: 5px 0; }
.fnrow .id { font-weight: 700; color: var(--fn-ink); min-width: 28px; font-size: 12px; padding-top: 6px; }
.fnrow .txt { flex: 1; border: 1px dashed var(--line-2); border-radius: 6px; padding: 5px 8px; line-height: 1.6; outline: none; font-family: var(--read); }
.fnrow .txt:focus { border-style: solid; border-color: var(--brand); }
.side-tabs { position: sticky; top: 0; z-index: 3; background: rgba(255,255,255,.97); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.side-tabs .seg-tabs { display: flex; } .side-tabs .seg-tabs button { flex: 1; padding: 4px 6px; font-size: 13px; }
.side-tabs .seg-tabs button span { font-size: 11px; color: var(--muted); font-weight: 500; }
#pane-side .tab { padding: 8px 12px 18px; }
.srcbar { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 4px 0 8px; font-size: 13px; }
.srcbar .miss { color: var(--bad); }
.srcbar .seg { display: inline-flex; gap: 2px; padding: 2px; background: var(--sunken); border-radius: 7px; }
.srcbar .seg button { border: 0; background: transparent; min-height: 24px; }
.srcbar .seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.1); font-weight: 700; }
#approve-sure { background: var(--ok); color: #fff; border-color: var(--ok); } #approve-sure:hover { background: #17633b; }
#tab-sources > p.status { white-space: normal; max-width: none; margin: 0 0 8px; }
.srccard { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 11px; margin: 8px 0; font-size: 14px; background: var(--surface); transition: box-shadow .15s; }
.srccard:hover { box-shadow: var(--shadow); }
.srccard:focus { outline: none; box-shadow: 0 0 0 3px rgba(36, 85, 125, .25); }
.srccard .hdr { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.srccard .id { font-weight: 700; font-size: 11.5px; background: var(--src); color: var(--src-ink); padding: 1px 6px; border-radius: 5px; cursor: pointer; }
.srccard .type { background: var(--brand-soft); color: var(--brand-strong); font-size: 11.5px; padding: 1px 6px; border-radius: 5px; }
.srccard .q { margin: 6px 0 4px; font-family: var(--read); font-size: 15.5px; line-height: 1.6; }
.srccard .tq { color: var(--muted); font-size: 12.5px; }
.srccard .loc { font-size: 13px; margin: 3px 0; }
.conf-high { color: var(--ok); } .conf-medium { color: var(--warn); } .conf-low { color: var(--bad); } .conf-none { color: var(--muted); }
.srccard input.es { width: 100%; margin-top: 6px; }
.srccard .lookup-res { font-size: 13px; color: var(--ink-2); margin-top: 4px; display: flex; flex-direction: column; gap: 4px; }
.srccard .lookup-res:empty { display: none; }
.srccard .okbtn { background: var(--ok); color: #fff; border-color: var(--ok); font-weight: 700; }
.srccard .okbtn:hover { background: #17633b; }
.srccard .okbtn.ghost { background: transparent; color: var(--muted); border-color: var(--line-2); font-weight: 500; }
.srccard.approved { background: var(--surface-2); padding: 6px 11px; }
.srccard.approved > *:not(.hdr):not(.printed) { display: none; }
.srccard.approved .hdr b { color: var(--ink-2); font-weight: 600; }
.srccard .lookup { margin-top: 6px; }
.item { border-bottom: 1px solid var(--line); padding: 9px 2px; font-size: 14px; cursor: default; }
#tab-doubtful .item, #tab-questions .item { cursor: pointer; } #tab-doubtful .item:hover, #tab-questions .item:hover { background: var(--surface-2); }
.item .k { font-size: 11.5px; background: var(--sunken); padding: 1px 6px; border-radius: 5px; margin-inline-end: 4px; }
#tab-notes .hf .t { cursor: pointer; color: var(--accent); font-weight: 600; }
.picked { background: var(--ok-soft); border-radius: 7px; padding: 7px 9px; margin: 6px 0; font-size: 13.5px; }
.picked .lbl { color: var(--ok); font-weight: 700; }
.picked .snip, .cand .snip { color: var(--muted); font-size: 12.5px; }
.picked details { margin-top: 4px; } .picked .cand { margin: 5px 0; }
.verify { border-top: 1px dashed #b9cbbf; margin-top: 6px; padding-top: 5px; font-size: 12.5px; }
.verify.warn { background: var(--warn-soft); border-radius: 6px; padding: 5px 7px; border-top: 0; }
.ver-ok { color: var(--ok); font-size: 12.5px; margin-top: 3px; font-weight: 600; }
.vd { margin: 1px 0; } .vd .k { color: var(--muted); font-size: 11.5px; }
.vd-hearing b, .vd-hearing s { color: var(--bad); } .vd-hearing .k { color: var(--bad); font-weight: 600; }
.printed { font-size: 13px; color: var(--accent); margin: 3px 0; } .printed.miss { color: var(--bad); }
.playq { margin-inline-start: auto; color: var(--accent); }
.playq.playing { background: var(--accent); color: #fff; border-color: var(--accent); }
.player { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 6px;
  background: #23272d; color: #fff; border-radius: 30px; padding: 6px 8px 6px 14px; box-shadow: var(--shadow-lg); font-size: 13.5px; }
.player button { background: rgba(255,255,255,.12); color: #fff; border-color: transparent; }
.player button:hover { background: rgba(255,255,255,.22); border-color: transparent; }
.status-chip { font-size: 12px; }
.demo { cursor: default; }

/* blind comparison */
.ab { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.abcol p { font-family: var(--read); font-size: 16.5px; line-height: 1.8; }
.quote { font-family: var(--read); line-height: 1.75; color: var(--ink-2); }
table.vote td { padding: 6px 10px; }
.talks-pick { flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.savebar { position: sticky; bottom: 0; z-index: 10; display: flex; gap: 10px; align-items: center; justify-content: flex-start; padding: 12px 0;
  background: linear-gradient(to top, var(--bg) 70%, rgba(245, 243, 238, 0)); }

@media (max-width: 980px) {
  .panes { grid-template-columns: 1fr; overflow-y: auto; } .pane { max-height: none; overflow: visible; }
  body.editor { height: auto; overflow: auto; } .ab { grid-template-columns: 1fr; }
  .brand-name small { display: none; }
}
@media (max-width: 640px) {
  .appbar { padding: 0 10px; gap: 8px; } .brand-name { display: none; } .user-chip .uname { display: none; }
  .page { padding: 16px 12px 50px; } .card { padding: 14px; } .timeline li { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- 19.11: editor requests ---------- */
#btn-full.playing { background: var(--accent); color: #fff; border-color: var(--accent); }
.player select { min-height: 26px; padding: 1px 4px; background: rgba(255,255,255,.12); color: #fff; border-color: transparent; }
.player select option { color: var(--ink); }
.src-chip[draggable="true"], .fn-chip[draggable="true"] { cursor: grab; }
.src-chip.dragging, .fn-chip.dragging { opacity: .4; }
.fnrow .fback { min-width: 46px; color: var(--fn-ink); font-weight: 700; padding: 2px 6px; }
.ap-list { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 6px; }
.ap-list > summary { cursor: pointer; color: var(--ok); font-weight: 600; padding: 4px 0; }
.printed .how { font-size: 12px; color: var(--muted); }
.printed.ok { color: var(--ok); } .printed.ok b { color: var(--ink); }
.printed.miss { background: var(--hl); border-radius: 5px; padding: 1px 6px; }
.rephrase-btn { position: fixed; z-index: 70; box-shadow: var(--shadow-lg); background: var(--brand); color: #fff; border-color: var(--brand); }
.rephrase-btn:hover { background: var(--brand-strong); }
.rephrase-pop { position: fixed; z-index: 71; max-height: calc(100vh - 16px); overflow-y: auto; width: min(520px, 92vw); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-lg); padding: 10px 12px; }
.rephrase-pop .rp-h { font-weight: 700; margin-bottom: 6px; }
.rephrase-pop .rp-alt { display: flex; gap: 8px; align-items: flex-start; border-top: 1px solid var(--line); padding: 8px 0; }
.rephrase-pop .rp-t { flex: 1; font-family: var(--read); font-size: 16px; line-height: 1.6; }
.rephrase-pop .rp-f { text-align: end; padding-top: 4px; }
.hidden { display: none !important; }
#tab-check .chk-sum { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; margin-bottom: 8px; font-size: 14px; }
.chk-item { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; margin: 7px 0; font-size: 14px; background: var(--surface); }
.chk-item.done { opacity: .55; }
.chk-item .k { background: var(--brand-soft); color: var(--brand-strong); font-size: 11.5px; padding: 1px 6px; border-radius: 5px; font-weight: 600; }
.chk-item .chk-d { font-family: var(--read); font-size: 15px; line-height: 1.6; margin: 4px 0; }
.chk-item .chk-d s { color: var(--bad); } .chk-item .chk-d b { color: var(--ok); font-weight: 600; }
.chk-item .chk-a { margin-top: 5px; }

/* ---- real-time collaboration (collab.js): who is here, their cursors, offline state ---- */
.presence { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.presence:empty { display: none; }
.presence .pr-u { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px 1px 6px; border-radius: 999px; background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); font-weight: 600; border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); }
.presence .pr-u::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
#cursors { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 4; pointer-events: none; }
#cursors .rcursor { position: absolute; width: 2px; border-radius: 1px; }
#cursors .rcursor .flag { position: absolute; bottom: 100%; inset-inline-start: -1px; margin-bottom: 1px; padding: 0 5px; font: 600 11px/16px var(--ui, sans-serif); color: #fff; border-radius: 4px 4px 4px 0; white-space: nowrap; opacity: .92; }
#cursors .rsel { position: absolute; opacity: .22; border-radius: 2px; }
body.offline #status { color: var(--warn); font-weight: 700; }

/* ---------- 19.11: track changes ---------- */
#btn-track { margin-inline-start: auto; } #btn-track.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.track-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px 12px; background: var(--accent-soft); border-bottom: 1px solid var(--line); font-size: 13px; }
.track-bar select { max-width: 260px; } .track-bar .sp { flex: 1; }
#changes .tc-blk .txt { cursor: default; }
ins.tc-ins { text-decoration: underline 2px #1f7a4a; background: #e4f3ea; color: #145a34; }
del.tc-del { text-decoration: line-through 2px #b3261e; background: #fbe8e6; color: #8f1f19; }
ins.tc-ins.acc, del.tc-del.acc { background: transparent; opacity: .55; }
.tc-acts { display: inline-flex; gap: 2px; align-items: center; vertical-align: super; font-size: 10.5px; font-family: var(--ui); margin: 0 2px; user-select: none; }
.tc-acts button { min-height: 0; padding: 0 5px; font-size: 11px; line-height: 16px; border-radius: 4px; }
.tc-acts .tc-a { color: var(--ok); border-color: #a9d6b9; } .tc-acts .tc-r { color: var(--bad); border-color: #efb8b3; }
.tc-tag { background: var(--sunken); color: var(--ink-2); padding: 0 4px; border-radius: 4px; }
.tc-ok { color: var(--ok); }

/* ---------- 19.11: usage and costs (settings) ---------- */
table.usage td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.usage tr.over td { background: var(--warn-soft); }
table.usage input { min-height: 26px; padding: 2px 4px; width: auto; }
table.usage td:first-child { white-space: nowrap; } table.usage td:last-child { min-width: 140px; }

.rephrase-pop .rp-h { cursor: move; user-select: none; }

/* ---------- 20.11: internal notes on sources (FB-011) ---------- */
.srccard .tn-row { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.srccard input.tn { flex: 1; background: #fffbea; border-color: #ead9a0; font-size: 13px; }
.srccard .tn-badge { cursor: help; }

/* 27.11: sources missing */
.src-warn { background: #fdecea; border: 1px solid #e0928a; color: #7a1f16; border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; font-weight: 600; }
