/* Themistia app styles. Tokens mirror design-system/tokens.json v2.0.0 (Standard Risk Global brand). */

:root {
  --bg: #FFFDFA; --panel: #F7F5F1; --paper: #FFFFFF; --note: #F3EEDF;
  --ink: #171A1F; --ink2: #4F4B45; --muted: #6B675F;
  --line: #E8E5DE; --line2: #CFCAC0; --ctl: #8F897E;
  --signal: #C8371F; --btn: #171A1F; --on-btn: #FFFDFA;
  --ok: #1A6850; --warn: #8A5E00;
  --scrim: rgba(20, 23, 28, .36);
  --sans: 'Archivo', 'Noto Sans HK', 'PingFang HK', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --court-en: 'Tinos', 'Times New Roman', serif;
  --court-zh: 'Noto Serif HK', 'Songti TC', serif;
  --gutter: 32px;
  color-scheme: light;
}
/* Before the app sets data-theme (first paint, thumbnails), follow the OS; an explicit light choice wins. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14171C; --panel: #1A1E24; --paper: #1C2027; --note: #2A2B26;
    --ink: #ECE9E2; --ink2: #C2BDB3; --muted: #9C978D;
    --line: #2B3038; --line2: #454C57; --ctl: #6A7380;
    --signal: #E24B31; --btn: #ECE9E2; --on-btn: #14171C;
    --ok: #4CC39A; --warn: #F0B44C;
    --scrim: rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14171C; --panel: #1A1E24; --paper: #1C2027; --note: #2A2B26;
  --ink: #ECE9E2; --ink2: #C2BDB3; --muted: #9C978D;
  --line: #2B3038; --line2: #454C57; --ctl: #6A7380;
  --signal: #E24B31; --btn: #ECE9E2; --on-btn: #14171C;
  --ok: #4CC39A; --warn: #F0B44C;
  --scrim: rgba(0, 0, 0, .5);
  color-scheme: dark;
}
@media (max-width: 1024px) { :root { --gutter: 24px; } }
@media (max-width: 600px) { :root { --gutter: 16px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 14.5px; line-height: 1.6; -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, h4, p, ul, ol, figure, blockquote, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
img, svg { display: block; }
/* Only elements that set lang get the CJK stack; their children inherit it, so court documents keep their serif. */
[lang^="zh-Hant"] { font-family: 'Noto Sans HK', 'PingFang HK', sans-serif; }
/* The Chinese interface: English and figures stay in Archivo and Plex Mono, Chinese takes Noto Sans HK.
   Labels drop the mono capitals, which only suit Latin letters. */
:root[lang^="zh-Hant"] { --mono: 'IBM Plex Mono', ui-monospace, Menlo, 'Noto Sans HK', 'PingFang HK', monospace; }
:root[lang^="zh-Hant"] body { font-family: var(--sans); line-height: 1.72; }
:root[lang^="zh-Hant"] .lbl { font-family: var(--sans); font-size: 12px; letter-spacing: .08em; }
.lang-btn { min-width: 40px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
h1 { font-size: 26px; line-height: 1.25; font-weight: 600; letter-spacing: -.015em; }
h2 { font-size: 15px; line-height: 22px; font-weight: 600; }
h3 { font-size: 14.5px; font-weight: 600; }
@media (max-width: 600px) { h1 { font-size: 22px; } body { font-size: 15px; } }

/* Text helpers */
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.lbl { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.sub { color: var(--ink2); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.court { font-family: var(--court-en); font-size: 16px; line-height: 1.75; }
/* A court sheet follows its own lang (or a parent's below the page), never the interface language. */
.court[lang^="zh-Hant"], .court [lang^="zh-Hant"], #app [lang^="zh-Hant"] .court:not([lang]) { font-family: var(--court-zh); }
.court[lang^="zh-Hant"], #app [lang^="zh-Hant"] .court:not([lang]) { line-height: 1.9; }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 3px; border: 1px solid var(--line2); background: transparent; color: var(--ink); font-size: 14px; font-weight: 500; line-height: 1.2; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn-p { background: var(--btn); border-color: var(--btn); color: var(--on-btn); }
.btn-q { border-color: transparent; color: var(--ink2); padding: 0 10px; }
.btn-s { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn-l { min-height: 48px; padding: 0 22px; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.link { padding: 0; border: 0; background: none; color: var(--ink2); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font-size: inherit; }
@media (pointer: coarse) { .btn { min-height: 44px; } .btn-s { min-height: 40px; } }

/* Icons and markers */
.ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ico-l { width: 18px; height: 18px; }
.sq { display: inline-block; width: 8px; height: 8px; flex: none; background: var(--signal); }
.live { display: inline-block; width: 8px; height: 8px; flex: none; background: var(--ink); animation: tmPulse 1.4s ease-in-out infinite; }
.live.rec { background: var(--signal); }
@keyframes tmPulse { 0%, 100% { opacity: 1; } 50% { opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .live { animation: none; } * { scroll-behavior: auto !important; } }

/* AI states: Suggested (dashed), Confirmed (solid ink), Working (.live), Signal (.sq) */
.state { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink2); white-space: nowrap; }
.state i { display: inline-block; width: 9px; height: 9px; border: 1px dashed var(--muted); }
.state.ok i { border: 0; background: var(--ink); }
.sug { border: 1px dashed var(--line2); border-radius: 4px; }
.conf { border: 1px solid var(--ink); border-radius: 4px; }
.card { border: 1px solid var(--line); border-radius: 4px; }
.panel { background: var(--panel); border-radius: 4px; }
.status-ok { color: var(--ok); }
.status-warn { color: var(--warn); }
.status-sig { color: var(--signal); }

/* Fields */
.fld { width: 100%; min-height: 40px; padding: 0 12px; border: 1px solid var(--ctl); border-radius: 3px; background: var(--bg); color: var(--ink); }
textarea.fld { padding: 10px 12px; resize: vertical; line-height: 1.55; }
select.fld { padding: 0 10px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--ink); width: 16px; height: 16px; margin: 0; flex: none; }
.check { display: flex; gap: 10px; align-items: baseline; cursor: pointer; }
.check input { position: relative; top: 3px; }

/* Chips, tabs, segmented, switch */
.chip { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 16px; background: transparent; font-size: 13px; color: var(--ink2); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.tabs { display: flex; flex-wrap: wrap; gap: 0 22px; border-bottom: 1px solid var(--line); }
.tab { padding: 12px 0 10px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 3px; overflow: hidden; }
.seg > button { padding: 6px 12px; font-size: 12.5px; font-weight: 500; color: var(--ink2); border: 0; background: transparent; cursor: pointer; }
.seg > button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.switch { position: relative; width: 36px; height: 22px; border-radius: 11px; border: 0; background: var(--ctl); cursor: pointer; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); transition: left .15s; }
.switch[aria-checked="true"] { background: var(--ink); }
.switch[aria-checked="true"]::after { left: 17px; }
.ref { font-family: var(--mono); font-size: 12px; padding: 1px 6px; border: 1px solid var(--line2); border-radius: 3px; background: transparent; cursor: pointer; color: var(--ink2); white-space: nowrap; }

/* Progress / meters */
.bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--ink); }

/* Streamed step list (Working state) */
.steps { display: flex; flex-direction: column; gap: 10px; }
.steps li { display: flex; align-items: center; gap: 12px; }
.steps li.wait { color: var(--muted); }
.steps .tick { width: 16px; flex: none; display: inline-flex; justify-content: center; }

/* Layout */
.page { width: 100%; max-width: 1440px; margin: 0 auto; padding: 28px var(--gutter) 64px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 32px; align-items: start; }
.split-6040 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 32px; align-items: start; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.spacer { flex: 1; }
.hr { border-top: 1px solid var(--line); }
@media (max-width: 1100px) { .split, .split-6040 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) { .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .cols-2, .cols-3 { grid-template-columns: minmax(0, 1fr); } .page { padding-top: 20px; } }

/* Prototype notice under every screen */
.proto-note { padding: 14px var(--gutter) 20px; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.5; color: var(--muted); }

/* Tables built from divs (role=table) */
.trow { display: grid; gap: 12px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--line); }
.trow.head { border-top: 0; padding-top: 0; }

/* App chrome */
.hdr { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px 16px; padding: 10px var(--gutter); border-bottom: 1px solid var(--line); background: var(--bg); }
.hdr-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hdr-right { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.brand-word { font-size: 13.5px; font-weight: 600; letter-spacing: .14em; }
.hdr-matter { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 340px; padding: 4px 10px; border: 1px solid var(--line2); border-radius: 4px; background: var(--panel); text-decoration: none; color: var(--ink); }
.hdr-matter:hover { border-color: var(--ink2); }
.hdr-tdot { width: 7px; height: 7px; flex: none; background: var(--ink2); }
.hdr-tdot.tier-red { background: var(--signal); }
.hdr-tdot.tier-amb { background: #8A5E00; }
.hdr-tdot.tier-grn { background: #1A6850; }
.hdr-badge { display: inline-block; padding: 0 5px; margin-left: 4px; border: 1px solid var(--line2); border-radius: 3px; font-size: 11px; }
.crumb { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.crumb > .mono { white-space: nowrap; flex: none; }
.crumb-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-btn { width: 320px; max-width: 100%; justify-content: space-between; color: var(--muted); background: var(--panel); }
.hdr-sep { color: var(--line2); flex: none; }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line2); background: var(--panel); font-size: 11px; font-weight: 600; flex: none; cursor: pointer; list-style: none; user-select: none; }
.avatar::-webkit-details-marker { display: none; }
.hdr-acct { position: relative; }
.hdr-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 45; min-width: 190px; padding: 6px; border: 1px solid var(--line2); border-radius: 4px; background: var(--bg); box-shadow: 0 12px 32px rgba(20, 23, 28, .18); display: flex; flex-direction: column; gap: 2px; }
.hdr-me { padding: 6px 8px; border-bottom: 1px solid var(--line); margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; }
.hdr-mi { width: 100%; padding: 7px 8px; border: 0; border-radius: 3px; background: none; color: var(--ink); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.hdr-mi:hover { background: var(--panel); }
.navbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; padding: 0 var(--gutter); border-bottom: 1px solid var(--line); background: var(--bg); }
.subnav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 7px var(--gutter); border-bottom: 1px solid var(--line); background: var(--panel); }
.subpill { padding: 4px 10px; border: 1px solid transparent; border-radius: 3px; font-size: 12.5px; color: var(--ink2); text-decoration: none; }
.subpill:hover { color: var(--ink); border-color: var(--line2); }
.subpill[aria-current] { background: var(--bg); border-color: var(--line2); color: var(--ink); font-weight: 600; }
.nav-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0 24px; min-width: 0; }
.navbar a.step, .navbar a.mod { display: flex; align-items: center; gap: 7px; padding: 12px 0; text-decoration: none; color: var(--muted); font-size: 13.5px; white-space: nowrap; }
.navbar a.done { color: var(--ink2); }
.navbar a[aria-current] { color: var(--ink); font-weight: 600; padding-bottom: 10px; border-bottom: 2px solid var(--ink); }
.navbar .num { font-family: var(--mono); font-size: 11.5px; }
.deadline { display: flex; align-items: center; gap: 8px; padding: 10px 0; font-size: 13px; color: var(--ink2); }
.deadline .mono { color: var(--signal); font-weight: 500; }
a.deadline { text-decoration: none; }
a.deadline:hover .deadline-what { text-decoration: underline; }
/* A screen that needs a matter when none is open: the latest matters (TM.shell.noMatter). */
.nm-list { margin-top: 20px; border-top: 1px solid var(--line); }
.nm-list li { border-bottom: 1px solid var(--line); }
.nm-open { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 16px; width: 100%; min-height: 48px; padding: 12px 2px; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.nm-open:hover .nm-name { text-decoration: underline; }
.nm-name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .hdr { display: flex; flex-wrap: nowrap; justify-content: space-between; }
  .hdr-left { flex: 1 1 auto; }
  .search-btn { width: auto; min-width: 0; }
  .search-btn .search-label { display: none; }
  .navbar, .nav-links { gap: 0 16px; }
}
@media (max-width: 600px) {
  .crumb .mono { display: none; }
  .hdr { gap: 8px; }
  .brand-word, .hdr-sep, .search-btn kbd { display: none; }
  .navbar a.step .step-name { display: none; }
  .navbar a.step[aria-current] .step-name { display: inline; }
  .deadline { width: 100%; padding-top: 0; }
  .hide-phone { display: none !important; }
}

/* The screen list (TM.shell rail): out of sight until the pointer reaches the left edge, the Screens button
   is pressed or ⌘\ is typed; it hides again when the pointer leaves. Kept open, it sits beside the page on a
   wide screen. Hidden, it is out of the tab order and the accessibility tree. */
:root { --rail-w: 264px; }
.rail-btn { padding: 0 10px; }
.rail-edge { display: none; }
@media (hover: hover) and (pointer: fine) {
  .rail-edge { display: block; position: fixed; left: 0; top: 0; bottom: 0; width: 10px; z-index: 38; }
}
.rail { position: fixed; left: 0; top: 0; bottom: 0; z-index: 40; width: var(--rail-w); max-width: 86vw; display: flex; flex-direction: column; gap: 18px; padding: 12px 0 20px; overflow-y: auto; overscroll-behavior: contain; background: var(--bg); border-right: 1px solid var(--line2); box-shadow: 0 12px 40px rgba(20, 23, 28, .16);
  visibility: hidden; transform: translateX(-100%); transition: transform .18s ease .25s, visibility 0s linear .43s; }
.rail.open, .rail-edge:hover + .rail:not(.hush), .rail:not(.hush):hover, .rail:has(:focus-visible) { visibility: visible; transform: none; transition: transform .18s ease .08s, visibility 0s; }
.rail.open { transition: transform .18s ease, visibility 0s; }
.rail.hush { transition: transform .18s ease, visibility 0s linear .18s; }   /* closed on purpose: no waiting */
.rail-scrim { position: fixed; inset: 0; z-index: 39; background: var(--scrim); }
.rail-hd { display: flex; align-items: center; gap: 2px; min-height: 40px; padding: 0 10px 0 20px; }
.rail-matter { padding: 12px 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rail-mname { margin-top: 4px; font-weight: 600; overflow-wrap: anywhere; }
.rail-gh { padding: 0 20px; }
.rail-grp { padding-bottom: 4px; }
.rail-grp + .rail-grp { padding-top: 10px; border-top: 1px solid var(--line); }
.rail-sum { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; user-select: none; }
.rail-sum::-webkit-details-marker { display: none; }
.rail-sum::after { content: '+'; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.rail-more[open] .rail-sum::after { content: '−'; }
.rail-grp ul { margin-top: 4px; }
.rail-a { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 6px 20px 6px 18px; border-left: 2px solid transparent; color: var(--ink2); text-decoration: none; }
.rail-a:hover { color: var(--ink); background: var(--panel); }
.rail-a[aria-current] { border-left-color: var(--ink); color: var(--ink); font-weight: 600; }
.rail-num { width: 20px; flex: none; font-size: 12px; color: var(--muted); }
.rail-ft { margin-top: auto; padding: 0 20px; }
.rail-pin { display: none; }
.rail-pin[aria-pressed="true"] { color: var(--ink); background: var(--panel); }
@media (min-width: 1280px) {
  .rail-pin { display: inline-flex; }
  .tm-rail-pinned #app { padding-left: var(--rail-w); }
  .tm-rail-pinned .rail { visibility: visible; transform: none; box-shadow: none; transition: none; }
  .tm-rail-pinned .rail-edge, .tm-rail-pinned .rail-scrim { display: none; }
}
@media (pointer: coarse) { .rail-a { min-height: 44px; } }
@media (prefers-reduced-motion: reduce) { .rail, .rail.open, .rail:hover { transition: visibility 0s; } }

/* Dialogs */
.scrim { position: fixed; inset: 0; background: var(--scrim); display: flex; justify-content: center; align-items: flex-start; padding: 56px 16px 16px; overflow-y: auto; z-index: 50; }
.dialog { width: 640px; max-width: 100%; background: var(--bg); border: 1px solid var(--line2); border-radius: 6px; box-shadow: 0 24px 60px rgba(20, 23, 28, .28); }
.dialog-hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dialog-hd h2 { font-size: 17px; line-height: 24px; }
.dialog-bd { padding: 20px; }
.dialog-ft { margin-top: 18px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.sheet-scrim { align-items: flex-end; padding: 0; }
.sheet { width: 100%; max-width: 620px; border-radius: 8px 8px 0 0; border-bottom: 0; }
@media (max-width: 600px) { .scrim { padding: 0; align-items: flex-end; } .dialog { border-radius: 8px 8px 0 0; max-height: 92vh; overflow-y: auto; } }

/* Record or upload dialog */
.uptab { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 4px; margin-right: 18px; border: 0; border-bottom: 2px solid transparent; background: transparent; font-size: 14px; font-weight: 500; color: var(--ink2); cursor: pointer; }
.uptab[aria-selected="true"] { border-bottom-color: var(--ink); color: var(--ink); }
.opt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 72px; padding: 12px; border: 1px solid var(--line2); border-radius: 4px; background: transparent; text-align: left; font-size: 14px; color: var(--ink); cursor: pointer; width: 100%; }
.opt[aria-checked="true"], .opt[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.opt-row { flex-direction: row; gap: 16px; min-height: 0; }
.wave { display: flex; align-items: center; gap: 3px; height: 48px; }
.wave span { flex: 1; border-radius: 1px; background: var(--ink); }
.dev-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 600px) { .dev-grid { grid-template-columns: minmax(0, 1fr); } }

/* A matter's own files and recordings (app/js/files.js) */
.mf-list { margin-top: 12px; border-bottom: 1px solid var(--line); }
.mf-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.mf-ico { flex: none; padding-top: 4px; color: var(--muted); }
.mf-what { flex: 1 1 260px; min-width: 0; }
.mf-name { display: block; font-weight: 500; overflow-wrap: anywhere; }
.mf-meta { display: flex; flex-wrap: wrap; gap: 0 12px; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.mf-meta.status-warn { color: var(--warn); }
.mf-act { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.mf-player { flex: 1 1 100%; min-width: 0; }
.mf-player audio, .mf-player video { display: block; width: 100%; max-width: 640px; }
.mf-player video { max-height: 360px; background: #000; }
.mf-drop { padding: 24px 20px; border: 1px dashed var(--line2); border-radius: 4px; text-align: center; }
.mf-clock { margin-top: 14px; font-size: 44px; line-height: 1; letter-spacing: -.02em; }
.navbar .rec-btn { margin: 6px 0; }
/* A file chooser inside a button-shaped label: show the focus ring on the label. */
label.btn:has(:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (max-width: 600px) { .mf-act { width: 100%; justify-content: flex-end; } .mf-clock { font-size: 36px; } }
/* A file's reading on its row, and the viewer of its text or transcript (js/files.js) */
.mf-read { align-items: center; margin-top: 2px; }
.mf-read .live { width: 6px; height: 6px; margin-right: -6px; }
.mf-tick { display: inline-flex; margin-right: -8px; color: var(--ok); }
.mf-tick svg { width: 13px; height: 13px; }
.dialog.dialog-wide { width: 1040px; }
.vw-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vw-media { position: sticky; top: 0; z-index: 2; margin: 0 -20px 16px; padding: 12px 20px; background: var(--bg); border-bottom: 1px solid var(--line); }
.vw-media audio { display: block; width: 100%; }
.vw-notes { margin-top: 10px; display: grid; gap: 4px; }
.vw-notes li { align-items: flex-start; }
.vw-notes svg { flex: none; width: 14px; height: 14px; margin-top: 3px; }
/* A file read by OCR on the server: said once above its text, and on each page so read. */
.vw-ocr { align-items: flex-start; gap: 6px; max-width: 80ch; margin-top: 10px; }
.vw-ocr svg { flex: none; width: 14px; height: 14px; margin-top: 3px; }
.vw-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
.vw-pager select { width: auto; flex: 0 1 200px; min-width: 0; min-height: 32px; }
.vw-doc { border-top: 1px solid var(--line); }
.vw-page { padding: 16px 0; border-bottom: 1px solid var(--line); }
.vw-pn { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 8px; font-size: 13px; line-height: 20px; font-weight: 500; }
.vw-text { max-width: 80ch; white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 4; font-size: 14px; }
/* What a model wrote and no lawyer has confirmed is dashed; what a lawyer corrected or signed off is solid ink. */
.vw-tag { display: inline-block; padding: 0 6px; border: 1px dashed var(--line2); border-radius: 3px; font-size: 11.5px; font-weight: 400; color: var(--ink2); }
.vw-tag.is-ink { border-style: solid; border-color: var(--ink2); }
.vw-sign { padding: 12px 14px; border: 1px dashed var(--line2); border-radius: 4px; }
.vw-sign.is-signed { border-style: solid; border-color: var(--ink); }
.vw-sign svg { flex: none; margin-top: 4px; }
.vw-confirm { margin-top: 10px; padding: 10px 12px; background: var(--panel); border-radius: 4px; }
.vw-speakers { margin-top: 16px; }
.vw-spk { display: inline-flex; align-items: center; gap: 2px; padding-left: 10px; border: 1px solid var(--line2); border-radius: 16px; font-size: 13px; }
.vw-rename .fld { width: 200px; max-width: 100%; min-height: 32px; }
.vw-head, .vw-line { display: grid; grid-template-columns: 76px minmax(0, 1fr) minmax(0, 1fr) 84px; gap: 4px 16px; }
.vw-head { margin-top: 16px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.vw-head span:last-child { text-align: right; }
.vw-lines { border-bottom: 1px solid var(--line); }
.vw-line { padding: 10px 0; border-top: 1px solid var(--line); align-items: start; }
.vw-line:first-child { border-top: 0; }
.vw-line.vw-editing { display: block; }
.vw-t .btn { gap: 4px; padding: 0 6px; font-size: 12px; }
.vw-t .btn svg { width: 11px; height: 11px; }
.vw-t > span.mono { display: inline-block; padding-top: 4px; font-size: 12px; }
.vw-who { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-size: 12.5px; font-weight: 600; color: var(--ink2); }
.vw-said p[lang], .vw-en p[lang] { overflow-wrap: anywhere; }
.vw-en p[lang] { color: var(--ink2); }
.vw-act { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.vw-act .check { align-items: center; gap: 6px; padding: 6px; }
.vw-act .check input { top: 0; width: 16px; height: 16px; }
.vw-ckl { display: none; }
.vw-edit { display: grid; gap: 10px; padding: 4px 0; }
.vw-fl { display: grid; gap: 4px; }
/* Cantonese and Mandarin as spoken take the Hong Kong Chinese face; Mainland documents keep their own. */
[lang^="yue"] { font-family: 'Noto Sans HK', 'PingFang HK', sans-serif; }
[lang^="zh-Hans"] { font-family: 'Noto Sans SC', 'PingFang SC', 'Noto Sans HK', sans-serif; }
@media (max-width: 600px) {
  .vw-head { display: none; }
  .vw-line { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; }
  .vw-t { grid-column: 1; grid-row: 1; align-self: center; }
  .vw-act { grid-column: 2; grid-row: 1; }
  .vw-said, .vw-en { grid-column: 1 / -1; }
  .vw-ckl { display: inline; }
}

/* Command palette */
.palette { width: 600px; max-width: 100%; background: var(--bg); border: 1px solid var(--line2); border-radius: 6px; box-shadow: 0 24px 60px rgba(20, 23, 28, .28); overflow: hidden; }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 16px 18px; background: transparent; font-size: 16px; outline: none; }
.palette li button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 18px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.palette li button[aria-selected="true"] { background: var(--panel); }

/* Phone frame helpers (device routes) */
.phone { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.phone .btn { min-height: 48px; font-size: 15px; }

/* Guided tour: a ring round the stop, a card beside it, and the one-time offer */
.tour { position: fixed; inset: 0; z-index: 80; }
.tour-dim { position: fixed; inset: 0; background: var(--scrim); }
.tour-hole { position: fixed; border-radius: 6px; box-shadow: 0 0 0 200vmax var(--scrim); outline: 2px solid var(--bg); outline-offset: 0; pointer-events: none; transition: top .18s, left .18s, width .18s, height .18s; }
.tour-card { position: fixed; background: var(--bg); color: var(--ink); border: 1px solid var(--line2); border-radius: 6px; padding: 18px 20px 16px; box-shadow: 0 24px 60px rgba(20, 23, 28, .28); }
.tour-card.dock { left: 12px; right: 12px; bottom: 12px; }
.tour-ft { margin-top: 16px; display: flex; align-items: center; gap: 8px; }
.tour-hint { margin-top: 24px; padding: 16px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
@media (max-width: 600px) { .tour-card .btn-s, .tour-hint .btn-s { min-height: 44px; } }
@media (prefers-reduced-motion: reduce) { .tour-hole { transition: none; } }

/* A long matter name must not push the header onto two rows: the crumb gives way first. */
.hdr { flex-wrap: nowrap; }
.crumb { flex: 0 1 auto; }
.hdr .btn, .hdr .avatar, .hdr .brand, .hdr .hdr-sep { flex: none; }

/* Found, not read (js/live.js notRead): judgments research may not read, added by the lawyer in one step. */
.nr { margin-top: 20px; padding: 14px 16px; max-width: 760px; border: 1px dashed var(--line2); border-radius: 4px; }
.nr > .small { margin-top: 4px; }
.nr-list { margin-top: 10px; display: flex; flex-direction: column; }
.nr-item { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.nr-item:first-child { border-top: 0; }
.nr-item.is-over { outline: 2px dashed var(--ink); outline-offset: 2px; }
.nr-main { flex: 1 1 260px; min-width: 0; }
.nr-hd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; overflow-wrap: anywhere; }
.nr-name { font-weight: 600; }
.nr-name.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 500; }
.nr-parties { color: var(--ink2); }
.nr-meta { margin-top: 2px; overflow-wrap: anywhere; }
.nr-st { margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.nr-item.is-done .nr-st { color: var(--ok); }
.nr-btns { gap: 8px; justify-content: flex-end; }
.nr-file { position: relative; cursor: pointer; }
.nr-file:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }
.nr-snip { margin-top: 4px; overflow-wrap: anywhere; }
.nr-notes { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; color: var(--ink2); }
.nr-notes li { overflow-wrap: anywhere; min-width: 0; }
.nr-note { display: block; margin-top: 2px; }
.nr-paste { margin-top: 10px; }
.nr-snip { margin-top: 4px; overflow-wrap: anywhere; }
.nr-notes { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; color: var(--ink2); }
.nr-notes li { overflow-wrap: anywhere; min-width: 0; }
.nr-note { display: block; margin-top: 2px; }
.nr-paste .fld { width: 100%; margin-top: 4px; }
.nr-drop { margin-top: 8px; }
.nr-again { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); gap: 10px; justify-content: space-between; align-items: center; }
@media (max-width: 560px) { .nr-btns { justify-content: flex-start; } }
