/* Askzone desk - own identity (13 Oct 2026). Brand: static/brand/nilbot-*.png (the Nil Bot WhatsApp profile picture, 13 Oct 2026), violet #9a7bff / #d0c2ff on ink #0f1314.
   Paper light theme by default, warm ink dark theme by prefers-color-scheme or the toggle (data-theme on <html>).
   Status is always colour + a word, never colour alone. */

/* ---------- tokens: paper (light) ---------- */
:root {
  --bg: #f5f2ec; --surface: #fffdf9; --raised: #ffffff; --sunk: #eee9e1; --hover: #f0ebe3;
  --line: #e3ddd2; --line-2: #d4ccbf;
  --ink: #1b1d1e; --ink-2: #4b4f51; --ink-3: #75797b;
  --acc: #5b3fd1; --acc-fill: #6d4fe0; --acc-on: #ffffff; --acc-soft: #efeaff; --acc-line: #d5c9ff; --acc-ink: #3e2a9e;
  --mark: #9a7bff; --mark-2: #d0c2ff;
  --red: #b42318; --red-soft: #fdecea; --red-line: #f5c2bc;
  --amber: #8f4f00; --amber-soft: #fdf1dc; --amber-line: #f0d39d;
  --green: #22703f; --green-soft: #e6f4ea; --green-line: #b9dfc6;
  --clay: #a8471f; --clay-soft: #fbece4; --clay-line: #f0c9b4;     /* Claude, the automatic assistant */
  --note: #fbf3d6; --note-line: #ecd98f; --note-ink: #5c4a07;      /* lines for Neil only */
  --bub-in: #ffffff; --bub-bot: #f1ede6; --bub-neil: #ebe4ff;
  --shadow-1: 0 1px 2px rgba(40, 30, 10, .06), 0 1px 1px rgba(40, 30, 10, .04);
  --shadow-2: 0 12px 32px rgba(40, 30, 10, .14), 0 2px 6px rgba(40, 30, 10, .06);
  --overlay: rgba(27, 29, 30, .42);
  --r-sm: 6px; --r: 10px; --r-lg: 14px; --r-xl: 18px;
  --fs-xs: 12px; --fs-sm: 13px; --fs: 14px; --fs-md: 15px; --fs-lg: 17px; --fs-xl: 20px; --fs-2xl: 26px;
  --font: "IBM Plex Sans Hebrew", "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
/* ---------- tokens: ink (dark) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1314; --surface: #151a1b; --raised: #1b2122; --sunk: #0b0e0f; --hover: #1e2526;
    --line: #242c2d; --line-2: #313b3c;
    --ink: #ece8e1; --ink-2: #b4aea5; --ink-3: #888379;
    --acc: #c4b3ff; --acc-fill: #9a7bff; --acc-on: #0f1314; --acc-soft: rgba(154, 123, 255, .14); --acc-line: rgba(154, 123, 255, .42); --acc-ink: #d0c2ff;
    --red: #ff8a7e; --red-soft: rgba(255, 110, 96, .12); --red-line: rgba(255, 110, 96, .36);
    --amber: #f3bb5c; --amber-soft: rgba(243, 187, 92, .11); --amber-line: rgba(243, 187, 92, .34);
    --green: #74d39c; --green-soft: rgba(116, 211, 156, .11); --green-line: rgba(116, 211, 156, .32);
    --clay: #f0a07c; --clay-soft: rgba(240, 160, 124, .11); --clay-line: rgba(240, 160, 124, .34);
    --note: rgba(236, 210, 110, .09); --note-line: rgba(236, 210, 110, .3); --note-ink: #e9d48e;
    --bub-in: #1d2425; --bub-bot: #161c1d; --bub-neil: #2a2346;
    --shadow-1: none; --shadow-2: 0 14px 36px rgba(0, 0, 0, .55);
    --overlay: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1314; --surface: #151a1b; --raised: #1b2122; --sunk: #0b0e0f; --hover: #1e2526;
  --line: #242c2d; --line-2: #313b3c;
  --ink: #ece8e1; --ink-2: #b4aea5; --ink-3: #888379;
  --acc: #c4b3ff; --acc-fill: #9a7bff; --acc-on: #0f1314; --acc-soft: rgba(154, 123, 255, .14); --acc-line: rgba(154, 123, 255, .42); --acc-ink: #d0c2ff;
  --red: #ff8a7e; --red-soft: rgba(255, 110, 96, .12); --red-line: rgba(255, 110, 96, .36);
  --amber: #f3bb5c; --amber-soft: rgba(243, 187, 92, .11); --amber-line: rgba(243, 187, 92, .34);
  --green: #74d39c; --green-soft: rgba(116, 211, 156, .11); --green-line: rgba(116, 211, 156, .32);
  --clay: #f0a07c; --clay-soft: rgba(240, 160, 124, .11); --clay-line: rgba(240, 160, 124, .34);
  --note: rgba(236, 210, 110, .09); --note-line: rgba(236, 210, 110, .3); --note-ink: #e9d48e;
  --bub-in: #1d2425; --bub-bot: #161c1d; --bub-neil: #2a2346;
  --shadow-1: none; --shadow-2: 0 14px 36px rgba(0, 0, 0, .55);
  --overlay: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 400 var(--fs)/1.55 var(--font); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--acc-fill); outline-offset: 2px; }
[hidden] { display: none !important; }
svg[viewBox="0 0 24 24"] { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.banner > svg { margin-top: 2px; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.005em; }
h1 { font-size: var(--fs-xl); line-height: 1.3; }
h2 { font-size: var(--fs-lg); line-height: 1.35; }
h3 { font-size: var(--fs-md); line-height: 1.4; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.mut { color: var(--ink-3); }
.sub { color: var(--ink-2); }
.sm-t { font-size: var(--fs-sm); }
.xs-t { font-size: var(--fs-xs); }
.row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stack { display: grid; gap: 12px; }
.kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; font: 500 11px/1 var(--mono); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; color: var(--ink-2); background: var(--surface); }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 500 var(--fs-sm)/1 var(--font); white-space: nowrap; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn.p { background: var(--acc-fill); border-color: var(--acc-fill); color: var(--acc-on); }
.btn.p:hover { filter: brightness(1.07); background: var(--acc-fill); }
.btn.g { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.g:hover { background: var(--hover); color: var(--ink); }
.btn.sm { height: 30px; padding: 0 11px; font-size: var(--fs-xs); border-radius: 8px; }
.btn.danger { color: var(--red); }
.btn.ic-only { width: 34px; padding: 0; }
.btn[disabled] { opacity: .45; cursor: not-allowed; filter: none; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.inp, select.inp { height: 36px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); padding: 0 12px; font: 400 var(--fs-sm) var(--font); min-width: 0; }
.inp:focus { outline: none; border-color: var(--acc-fill); box-shadow: 0 0 0 3px var(--acc-soft); }
.inp::placeholder, textarea::placeholder { color: var(--ink-3); }
textarea.inp { height: auto; padding: 10px 12px; line-height: 1.55; resize: vertical; }
select.inp { padding-inline-end: 8px; }
.tag { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: var(--fs-xs); line-height: 1;
  background: var(--sunk); color: var(--ink-2); white-space: nowrap; border: 1px solid transparent; }
.tag.mono { font-size: 11.5px; }
.tag i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
button.tag { cursor: pointer; font-family: var(--font); }
button.tag:hover { border-color: var(--line-2); }
button.tag[aria-pressed="true"] { background: var(--acc-soft); color: var(--acc); border-color: var(--acc-line); }
.t-red { background: var(--red-soft) !important; color: var(--red) !important; border-color: var(--red-line) !important; }
.t-amber { background: var(--amber-soft) !important; color: var(--amber) !important; border-color: var(--amber-line) !important; }
.t-green { background: var(--green-soft) !important; color: var(--green) !important; border-color: var(--green-line) !important; }
.t-acc { background: var(--acc-soft) !important; color: var(--acc) !important; border-color: var(--acc-line) !important; }
.t-clay { background: var(--clay-soft) !important; color: var(--clay) !important; border-color: var(--clay-line) !important; }
.t-line { background: transparent !important; border-color: var(--line-2) !important; }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font: 600 11px/1 var(--mono); background: var(--sunk); color: var(--ink-2); }
.badge.hot { background: var(--red); color: #fff; }
.badge.acc { background: var(--acc-fill); color: var(--acc-on); }
.c-red { color: var(--red); } .c-amber { color: var(--amber); } .c-green { color: var(--green); } .c-acc { color: var(--acc); } .c-clay { color: var(--clay); }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--sunk); }
.seg a, .seg button { height: 30px; padding: 0 12px; border-radius: 9px; border: 0; background: none; color: var(--ink-2); font: 500 var(--fs-sm)/30px var(--font); cursor: pointer; white-space: nowrap; text-decoration: none; }
.seg a:hover, .seg button:hover { color: var(--ink); text-decoration: none; }
.seg .on, .seg [aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* ---------- app shell: slim rail + main ---------- */
.app { display: grid; grid-template-columns: 84px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.rail { background: var(--surface); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 14px 8px 12px; min-height: 0; overflow-y: auto; }
.rail .mark { display: grid; place-items: center; padding: 2px 0 12px; }
.rail .mark img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; display: block; }
.nav a { position: relative; display: grid; justify-items: center; gap: 4px; padding: 9px 2px 8px; border-radius: 12px; color: var(--ink-2); font-size: 11.5px; font-weight: 500; line-height: 1.2; text-align: center; text-decoration: none; }
.nav a svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.nav a.on { background: var(--acc-soft); color: var(--acc); font-weight: 600; }
.nav a .badge { position: absolute; top: 4px; inset-inline-end: 8px; height: 17px; min-width: 17px; font-size: 10px; }
.rail .nav { display: grid; gap: 2px; }
.rail .foot { margin-top: auto; display: grid; gap: 6px; justify-items: center; padding-top: 10px; }
.iconbtn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; border: 0; background: none; color: var(--ink-2); cursor: pointer; text-decoration: none; position: relative; }
.iconbtn:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.iconbtn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.live-dot.stale { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.rail .clock { font: 500 11px var(--mono); color: var(--ink-3); }
.srv-m { display: grid; justify-items: center; gap: 3px; cursor: default; }
.srv-m .bars { display: flex; gap: 3px; align-items: flex-end; height: 26px; }
.srv-m .bars i { width: 6px; height: 100%; border-radius: 3px; background: linear-gradient(to top, var(--t) var(--v), var(--line) var(--v)); }
.srv-m b { font: 600 10px var(--mono); color: var(--t); }
.srv-tip{position:fixed;z-index:10000;max-width:360px;padding:9px 11px;border-radius:8px;background:#0f1516;color:#eef3f2;border:1px solid rgba(255,255,255,.14);box-shadow:0 8px 24px rgba(0,0,0,.28);font:12px/1.5 system-ui,-apple-system,"Segoe UI",sans-serif;white-space:pre-line;text-align:left;pointer-events:none}
[data-srv-tip]{cursor:help}
[data-srv-tip]:focus-visible{outline:2px solid currentColor;outline-offset:1px}
#main { min-width: 0; height: 100vh; height: 100dvh; overflow-y: auto; }
.mnav { display: none; }
.mtop { display: none; }

/* ---------- board: list + thread + facts ---------- */
.board { display: grid; grid-template-columns: 400px minmax(0, 1fr) 300px; height: 100vh; height: 100dvh; min-height: 0; }
.board:not(.has-detail) { grid-template-columns: 400px minmax(0, 1fr); }
.board:not(.has-detail) .facts { display: none; }
.lpane { display: flex; flex-direction: column; min-height: 0; border-inline-end: 1px solid var(--line); background: var(--bg); }
.lhead { padding: 18px 18px 12px; display: grid; gap: 12px; }
.lhead .titlerow { display: flex; align-items: center; gap: 10px; }
.lhead .hello { font-size: var(--fs-sm); color: var(--ink-3); }
.counts { display: flex; flex-wrap: wrap; gap: 6px; }
.count { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: var(--fs-xs); color: var(--ink-2); cursor: pointer; font-family: var(--font); }
.count b { font: 600 var(--fs-md)/1 var(--mono); color: var(--ink); }
.count.hot b, .count.hot { color: var(--red); }
.count.hot { border-color: var(--red-line); background: var(--red-soft); }
.count[aria-pressed="true"] { border-color: var(--acc-fill); box-shadow: 0 0 0 1px var(--acc-fill); }
.count.zero { opacity: .62; }
.search { position: relative; display: flex; }
.search .inp { flex: 1; padding-inline-end: 34px; background: var(--surface); }
.search .kbd { position: absolute; inset-inline-end: 9px; top: 8px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filters select.inp { height: 30px; font-size: var(--fs-xs); border-radius: 999px; padding: 0 10px; background: var(--surface); }
.filters select.inp.on { border-color: var(--acc-line); background: var(--acc-soft); color: var(--acc); }
.llist { flex: 1; overflow-y: auto; padding: 4px 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.lfoot { padding: 8px 16px; border-top: 1px solid var(--line); display: flex; gap: 12px; align-items: center; font-size: var(--fs-xs); color: var(--ink-3); }
.lfoot button { background: none; border: 0; padding: 0; color: var(--ink-2); cursor: pointer; font: inherit; display: inline-flex; gap: 6px; align-items: center; }
.lfoot button:hover { color: var(--ink); }
.group-h { display: flex; align-items: center; gap: 8px; padding: 10px 6px 2px; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); }
.group-h .line { flex: 1; height: 1px; background: var(--line); }

/* queue card */
.qc { position: relative; display: grid; gap: 6px; padding: 12px 14px 12px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); cursor: pointer; text-align: start; color: inherit; width: 100%; }
.qc:hover { border-color: var(--line-2); }
.qc.sel { border-color: var(--acc-fill); box-shadow: 0 0 0 1px var(--acc-fill), var(--shadow-1); }
.qc.late::before { content: ""; position: absolute; inset-block: 12px; inset-inline-start: -1px; width: 3px; border-radius: 3px; background: var(--red); }
.qc .l1 { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.qc .who { font-weight: 600; font-size: var(--fs); flex-shrink: 0; max-width: 60%; }
.qc .l1 .tag { flex: none; }
.qc .dept { font-size: var(--fs-xs); color: var(--ink-3); }
.qc .sla { margin-inline-start: auto; font-size: var(--fs-xs); font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.qc .sla.late { color: var(--red); font-weight: 600; }
.qc .sla.soon { color: var(--amber); }
.qc .sum { font-size: var(--fs-md); line-height: 1.45; color: var(--ink); }
.qc .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.qc .trail { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--ink-3); }
.qc .trail b { font-weight: 500; color: var(--ink-2); }
.qc .trail .arr { opacity: .55; }
.qc .acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding-top: 2px; }
.qc.learn { background: linear-gradient(0deg, var(--surface), var(--surface)) padding-box; border-style: dashed; border-color: var(--acc-line); }
.qc.incident { background: var(--red-soft); border-color: var(--red-line); }
.qc.claude { border-color: var(--clay-line); }
.qc.child { margin-inline-start: 14px; }
.qc.sel, .qc.claude.sel, .qc.learn.sel { border-color: var(--acc-fill); border-style: solid; box-shadow: 0 0 0 1px var(--acc-fill), var(--shadow-1); }
.kind { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.kind svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sev { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.sev i { width: 7px; height: 7px; border-radius: 50%; display: block; }
.sev.p1 { color: var(--red); } .sev.p1 i { background: var(--red); }
.sev.p2 { color: var(--amber); } .sev.p2 i { background: var(--amber); }
.sev.p3 { color: var(--ink-3); font-weight: 500; } .sev.p3 i { background: var(--line-2); }
.empty { margin: auto; text-align: center; padding: 48px 24px; color: var(--ink-2); max-width: 400px; display: grid; justify-items: center; gap: 6px; }
.empty b { color: var(--ink); font-size: var(--fs-lg); }
.empty img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; margin-bottom: 8px; }
.empty .stat { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; font-size: var(--fs-sm); color: var(--ink-3); margin-top: 6px; }

/* thread pane */
.tpane { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--surface); }
.thead { padding: 14px 24px 12px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; background: var(--surface); }
.thead .top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.thead .back { display: none; }
.thead h2 { font-size: var(--fs-lg); line-height: 1.35; }
.thead .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: var(--fs-sm); color: var(--ink-2); }
.thead .meta .dot { color: var(--line-2); }
.av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--acc-soft); color: var(--acc); font-weight: 600; flex: none; }
.av.sm { width: 28px; height: 28px; font-size: var(--fs-xs); }
.banner { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: var(--r); font-size: var(--fs-sm); border: 1px solid var(--line); background: var(--sunk); color: var(--ink); }
.banner.t-red, .banner.t-amber, .banner.t-acc, .banner.t-clay { color: var(--ink) !important; }
.banner .bt { flex: 1; min-width: 0; }
.tbody { flex: 1; overflow-y: auto; padding: 20px 24px; background: var(--bg); }
.thread { display: flex; flex-direction: column; gap: 6px; max-width: 760px; margin: 0 auto; }
.day { align-self: center; margin: 10px 0 4px; padding: 2px 10px; border-radius: 999px; background: var(--sunk); font-size: 11.5px; color: var(--ink-3); }
.bub { position: relative; max-width: min(78%, 560px); padding: 8px 12px 6px; border-radius: 14px; font-size: var(--fs); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; display: grid; gap: 3px; box-shadow: var(--shadow-1); }
.bub .by { font-size: var(--fs-xs); font-weight: 600; }
.bub .ft { display: flex; gap: 6px; justify-content: flex-end; align-items: center; font: 400 11px var(--mono); color: var(--ink-3); white-space: normal; }
.bub.in { align-self: flex-start; background: var(--bub-in); border: 1px solid var(--line); border-start-start-radius: 4px; }
.bub.in .by { color: var(--ink-2); }
.bub.out { align-self: flex-end; border-start-end-radius: 4px; }
.bub.bot { background: var(--bub-bot); border: 1px solid var(--line); color: var(--ink-2); }
.bub.bot .by { color: var(--ink-3); }
.bub.neil { background: var(--bub-neil); border: 1px solid var(--acc-line); }
.bub.neil .by { color: var(--acc); }
.bub.claude { background: var(--clay-soft); border: 1px solid var(--clay-line); }
.bub.claude .by { color: var(--clay); }
.bub.tpl { border-style: dashed; }
.bub.fail { border-color: var(--red); }
.bub.tap { padding: 6px 10px; }
.bub .opts { display: flex; flex-wrap: wrap; gap: 4px; white-space: normal; }
.bub + .bub.same { margin-top: -2px; }
.tick.read { color: var(--acc); } .tick.fail { color: var(--red); font-family: var(--font); }
.shot { width: 240px; max-width: 100%; height: 150px; border-radius: 10px; border: 1px solid var(--line); background: var(--sunk) center / cover; cursor: zoom-in; padding: 0; }
.shot.vid { cursor: auto; background: #000; object-fit: contain; }
.sys { align-self: center; max-width: 90%; text-align: center; font-size: var(--fs-xs); color: var(--ink-3); padding: 2px 10px; }
.note { align-self: stretch; margin: 4px 0; padding: 10px 14px; border-radius: var(--r); background: var(--note); border: 1px dashed var(--note-line); color: var(--ink); font-size: var(--fs-sm); line-height: 1.55; white-space: normal; overflow-wrap: anywhere; display: grid; gap: 4px; }
.note .nh { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--note-ink); font-weight: 600; }
.note .nh .mono { font-weight: 400; margin-inline-start: auto; }
.tool { align-self: stretch; margin: 2px 0; border-radius: var(--r); border: 1px solid var(--clay-line); background: var(--surface); font-size: var(--fs-sm); overflow: hidden; }
.tool > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 8px 12px; color: var(--ink-2); }
.tool > summary::-webkit-details-marker { display: none; }
.tool > summary .nm { font: 600 var(--fs-xs) var(--mono); color: var(--clay); }
.tool > summary .chev { margin-inline-start: auto; transition: transform .15s; opacity: .6; }
.tool[open] > summary .chev { transform: rotate(180deg); }
.tool pre { margin: 0; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--sunk); font: 400 12px/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; direction: ltr; text-align: left; max-height: 280px; overflow: auto; }
.qa { align-self: center; width: min(560px, 100%); margin: 4px 0; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
.qa > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: var(--fs-xs); color: var(--ink-3); }
.qa > summary::-webkit-details-marker { display: none; }
.qa > summary .pv { display: flex; flex-wrap: wrap; gap: 4px 8px; color: var(--ink); font-size: var(--fs-sm); flex: 1; min-width: 0; }
.qa > summary .chev { opacity: .6; transition: transform .15s; }
.qa[open] > summary .chev { transform: rotate(180deg); }
.qa dl { margin: 0; padding: 4px 12px 10px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; font-size: var(--fs-sm); }
.qa dt { color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa dd { margin: 0; display: flex; gap: 6px; align-items: center; }
.lcard { align-self: stretch; margin: 10px 0 4px; padding: 14px 16px; border-radius: var(--r-lg); border: 1px dashed var(--acc-line); background: var(--surface); display: grid; gap: 8px; }
.lcard .lh { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lcard .say { padding: 10px 12px; border-radius: var(--r); background: var(--acc-soft); font-size: var(--fs-sm); }
.lcard .warn { font-size: var(--fs-xs); color: var(--red); }
.lcard .inote { font-size: var(--fs-xs); color: var(--note-ink); }

/* composer */
.composer { border-top: 1px solid var(--line); padding: 10px 24px 14px; display: grid; gap: 8px; background: var(--surface); }
.composer .tpls { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; align-items: center; }
.composer .tpls::-webkit-scrollbar { display: none; }
.composer .tpls .tag { cursor: pointer; max-width: 240px; overflow: hidden; text-overflow: ellipsis; flex: none; height: 26px; font-family: var(--font); }
.composer .tpls .tag:hover { color: var(--acc); border-color: var(--acc-line); }
.composer textarea { width: 100%; min-height: 64px; max-height: 40vh; resize: none; border-radius: var(--r-lg); border: 1px solid var(--line-2); background: var(--bg); color: var(--ink); padding: 10px 14px; font: 400 var(--fs)/1.55 var(--font); }
.composer textarea:focus { outline: none; border-color: var(--acc-fill); box-shadow: 0 0 0 3px var(--acc-soft); background: var(--surface); }
.composer .acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.composer .hint { font-size: var(--fs-xs); color: var(--ink-3); }
.more { position: relative; }
.menu { position: absolute; min-width: 220px; background: var(--raised); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: 6px; z-index: 40; display: grid; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; background: none; border: 0; color: var(--ink); text-align: start; cursor: pointer; font-size: var(--fs-sm); text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--hover); text-decoration: none; }
.menu button.danger { color: var(--red); }
.menu button[disabled] { opacity: .4; cursor: not-allowed; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }

/* facts panel */
.facts { border-inline-start: 1px solid var(--line); background: var(--surface); overflow-y: auto; min-height: 0; }
.fsec { padding: 16px 18px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.fsec:last-child { border-bottom: 0; }
.fsec > .h { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: var(--fs-sm); }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.idrow { display: grid; gap: 2px; padding: 8px 10px; border-radius: var(--r); background: var(--sunk); }
.idrow .v { font: 600 var(--fs) var(--mono); }
.idrow .links { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: var(--fs-xs); }
.fsel { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 8px; align-items: center; font-size: var(--fs-sm); }
.fsel select { height: 32px; }
.sim { display: grid; gap: 4px; padding: 10px 12px; border-radius: var(--r); background: var(--sunk); color: inherit; font-size: var(--fs-sm); text-decoration: none; }
.sim:hover { text-decoration: none; background: var(--hover); }
.facts .closex { display: none; }

/* ---------- pages ---------- */
.page { padding: 24px 28px 40px; display: grid; gap: 20px; max-width: 1280px; align-content: start; }
.phead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.phead .sub { font-size: var(--fs-sm); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-1); min-width: 0; }
.panel > .ph { display: flex; align-items: center; gap: 10px; padding: 16px 20px 0; flex-wrap: wrap; }
.panel > .ph .sub { font-size: var(--fs-xs); flex-basis: 100%; }
.panel > .pb { padding: 14px 20px 20px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 16px; align-items: start; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { padding: 14px 16px; display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.kpi .l { font-size: var(--fs-xs); color: var(--ink-3); }
.kpi .v { font: 600 var(--fs-2xl)/1.15 var(--mono); }
.kpi .c { font-size: var(--fs-xs); color: var(--ink-3); }
.kpi.bad .v { color: var(--red); } .kpi.good .v { color: var(--green); } .kpi.warn .v { color: var(--amber); }
table.dt { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table.dt th { text-align: start; color: var(--ink-3); font-weight: 600; font-size: var(--fs-xs); padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.dt td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.dt tr:last-child td { border-bottom: 0; }
.tablewrap { overflow-x: auto; max-width: 100%; }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: minmax(80px, 160px) 1fr 44px; gap: 10px; align-items: center; font-size: var(--fs-sm); }
.bar .t { height: 10px; background: var(--sunk); border-radius: 5px; overflow: hidden; }
.bar .t i { display: block; height: 100%; background: var(--acc-fill); border-radius: 5px; }
.cols { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding-top: 10px; }
.cols .c { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; font-size: 11px; color: var(--ink-3); }
.cols .c i { width: 100%; max-width: 40px; background: var(--acc-fill); border-radius: 5px 5px 0 0; min-height: 2px; }
.list { display: grid; gap: 10px; }
.item { padding: 14px 16px; border-radius: var(--r-lg); background: var(--bg); border: 1px solid var(--line); display: grid; gap: 8px; min-width: 0; }
.item .ih { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prog { display: grid; gap: 4px; font-size: var(--fs-xs); color: var(--ink-3); min-width: 150px; }
.prog .t { height: 6px; border-radius: 3px; background: var(--sunk); overflow: hidden; }
.prog .t i { display: block; height: 100%; background: var(--green); }
.lib-grid { display: grid; gap: 10px; }
.lib { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 8px 20px; padding: 14px 16px; border-radius: var(--r-lg); background: var(--bg); border: 1px solid var(--line); }
.lib .side { display: grid; gap: 8px; align-content: start; }
.lib .ans { font-size: var(--fs-sm); color: var(--ink-2); }
.mode-off { color: var(--ink-3); }
.person { display: grid; grid-template-columns: minmax(180px, 1.3fr) minmax(150px, 1fr) minmax(160px, 1fr) auto; gap: 10px 16px; align-items: center; padding: 12px 14px; border-radius: var(--r-lg); background: var(--bg); border: 1px solid var(--line); }
.person .inp { height: 32px; width: 100%; }
.person .pstack { display: grid; gap: 4px; }
.person .acts { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.hrow { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 4px 14px; align-items: center; padding: 12px 14px; border-radius: var(--r-lg); background: var(--bg); border: 1px solid var(--line); cursor: pointer; color: inherit; text-align: start; width: 100%; font: inherit; }
.hrow:hover { border-color: var(--line-2); }
.hrow .s { grid-column: 2; }
.qcols { columns: 3 360px; column-gap: 16px; }
.qcols > .qed { break-inside: avoid; margin-bottom: 16px; }
.qed { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px; display: grid; gap: 8px; background: var(--bg); }
.qed .qed { background: var(--surface); }
.qed .tag { white-space: normal; height: auto; min-height: 22px; padding-block: 3px; }
.awaypick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.awaypick button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 84px; padding: 14px 8px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.awaypick button svg, .awaybtn svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.awaypick button[aria-pressed="true"] { border-color: var(--acc-fill); background: var(--acc-soft); box-shadow: 0 0 0 1px var(--acc-fill); color: var(--acc); }
.awayprev { white-space: pre-wrap; background: var(--sunk); border-radius: var(--r); padding: 10px 12px; font-size: var(--fs-sm); color: var(--ink-2); }
.awaybtn { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: 500 var(--fs-xs) var(--font); cursor: pointer; }
.awaybtn svg { width: 15px; height: 15px; }
.awaybtn .live-dot { width: 7px; height: 7px; }
.awaybtn.on { background: var(--amber-soft); border-color: var(--amber-line); color: var(--ink); }
.awaybtn.on svg { color: var(--amber); }
.zones { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; background: var(--overlay); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal { width: min(560px, 100%); background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-2); padding: 22px; display: grid; gap: 14px; max-height: 90vh; overflow: auto; }
.modal label { display: grid; gap: 5px; font-size: var(--fs-sm); color: var(--ink-2); }
.modal .inp, .modal textarea, .modal select { width: 100%; }
.picker { display: grid; gap: 6px; max-height: 55vh; overflow: auto; }
.picker button { text-align: start; display: grid; gap: 3px; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; }
.picker button:hover { border-color: var(--acc-line); background: var(--acc-soft); }
.brief { width: 100%; min-height: 300px; font: 400 13px/1.6 var(--font); direction: rtl; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 12px; }
.flash { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 70; background: var(--ink); color: var(--bg); border-radius: 12px; padding: 10px 16px; font-size: var(--fs-sm); box-shadow: var(--shadow-2); max-width: calc(100vw - 32px); }
.help dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; align-items: center; font-size: var(--fs-sm); }
.help dt { display: flex; gap: 4px; }
.help dd { margin: 0; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.login form { width: min(380px, 100%); display: grid; gap: 14px; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-1); }
.login label { display: grid; gap: 5px; font-size: var(--fs-sm); color: var(--ink-2); }
.login .inp { width: 100%; height: 42px; }
.lockup { display: flex; align-items: center; gap: 10px; }
.lockup img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.lockup b { font-size: var(--fs-lg); }

/* ---------- laptop: facts become a drawer ---------- */
@media (max-width: 1360px) and (min-width: 861px) {
  .board, .board.has-detail { grid-template-columns: 360px minmax(0, 1fr); }
  .facts { position: fixed; inset-block: 0; inset-inline-end: 0; width: 340px; z-index: 50; box-shadow: var(--shadow-2); transform: translateX(-110%); transition: transform .18s; display: block !important; }
  .facts.open { transform: none; box-shadow: 0 0 0 100vmax var(--overlay); }
  .facts .closex { display: inline-flex; }
  .board:not(.has-detail) .facts { display: none !important; }
}
@media (max-width: 1100px) and (min-width: 861px) {
  .board, .board.has-detail, .board:not(.has-detail) { grid-template-columns: 320px minmax(0, 1fr); }
  .thead, .tbody, .composer { padding-inline: 16px; }
}
@media (min-width: 1361px) { .factsbtn { display: none !important; } }

/* ---------- phone ---------- */
@media (max-width: 860px) {
  .app { display: block; height: auto; }
  .rail { display: none; }
  #main { height: auto; overflow: visible; padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .app.in-thread #main { padding-bottom: 0; }
  .mtop { display: flex; position: sticky; top: 0; z-index: 30; height: 56px; padding: 0 16px; align-items: center; gap: 10px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
  .mtop img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
  .mtop b { font-size: var(--fs-md); }
  .app.in-thread .mtop { display: none; }
  .mnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px env(safe-area-inset-bottom, 4px); }
  .mnav a { flex: 1 1 0; padding: 6px 0 5px; border-radius: 10px; font-size: 11px; }
  .mnav a svg { width: 22px; height: 22px; }
  .mnav a .badge { inset-inline-end: calc(50% - 22px); top: 1px; }
  .app.in-thread .mnav { display: none; }
  .board, .board.has-detail, .board:not(.has-detail) { display: block; height: auto; }
  .lpane { border: 0; }
  .lhead { padding: 14px 16px 10px; }
  .llist { overflow: visible; padding: 0 12px 16px; }
  .lfoot { display: none; }
  .search .kbd { display: none; }
  .board.has-detail .lpane { display: none; }
  .board:not(.has-detail) .tpane { display: none; }
  .tpane { min-height: 100dvh; }
  .thead { position: sticky; top: 0; z-index: 20; padding: 8px 12px 10px; }
  .thead .back { display: inline-flex; }
  .thead h2 { font-size: var(--fs-md); }
  .thead .meta { font-size: var(--fs-xs); }
  .thead .hide-m { display: none; }
  .tbody { padding: 14px 12px; overflow: visible; flex: 1; }
  .bub { max-width: 86%; }
  .composer { position: sticky; bottom: 0; z-index: 15; padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -6px 18px rgba(0, 0, 0, .06); }
  .composer textarea { min-height: 48px; }
  .composer .hint { display: none; }
  .composer .acts .btn { height: 40px; }
  .facts { position: fixed; inset: auto 0 0 0; max-height: 82dvh; z-index: 55; border: 0; border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--shadow-2); transform: translateY(105%); transition: transform .2s; display: block !important; }
  .facts.open { transform: none; box-shadow: 0 0 0 100vmax var(--overlay); }
  .facts .closex { display: inline-flex; }
  .board:not(.has-detail) .facts { display: none !important; }
  .menu.sheet { position: fixed; inset: auto 10px calc(10px + env(safe-area-inset-bottom, 0px)) 10px !important; top: auto !important; min-width: 0; align-content: start; z-index: 60; box-shadow: 0 0 0 100vmax var(--overlay); }
  .menu.sheet button { min-height: 44px; font-size: var(--fs); }
  .page { padding: 14px 16px 24px; gap: 16px; }
  .panel > .ph { padding: 14px 14px 0; }
  .panel > .pb { padding: 12px 14px 16px; }
  .lib { grid-template-columns: minmax(0, 1fr); }
  .person { grid-template-columns: minmax(0, 1fr); }
  .person .acts { justify-content: flex-start; }
  .hrow { grid-template-columns: 56px minmax(0, 1fr); }
  .hrow .end { grid-column: 2; }
  .btn { height: 40px; }
  .btn.sm { height: 34px; }
  .inp, select.inp { height: 42px; font-size: 15px; }
  .filters select.inp { height: 34px; font-size: 13px; }
  .bar { grid-template-columns: 100px 1fr 40px; }
  .help-btn { display: none !important; }
  .tool .when { display: none; }
}

