/* Anek Telugu (SIL Open Font License): one Telugu + Latin file, bundled (not Google Fonts)
   so the kiosk never flashes a fallback font and works without internet. */
@font-face {
  font-family: 'Anek Telugu';
  font-style: normal;
  font-weight: 400 800;
  font-display: block;
  src: url(fonts/anek-telugu.woff2) format('woff2');
}

/* PGRS voice kiosk.
   Layout: one full-screen app shell (header · stage). Everything is sized in rem from a
   viewport-scaled root, so the same page fills a 720p kiosk, a 1080p panel or a portrait
   tablet; on portrait / small screens the two columns stack. */
:root {
  --saffron: #e8761a;        /* brand: PGRS orange */
  --saffron-deep: #c85f0c;
  --saffron-wash: #fdeede;
  --leaf: #7cb342;           /* go / success: light green */
  --leaf-deep: #3f7d20;
  --leaf-wash: #edf6e2;
  --ink: #26221d;
  --ink-soft: #6f675d;
  --paper: #faf6f0;
  --surface: #ffffff;
  --rule: #ebe2d4;
  --alert: #c0392b;
  --pgrs-purple: #5a3fa3;    /* PGRS system name, as on the Analytics Dashboard */
  --font-display: "Anek Telugu", "Noto Sans Telugu", "Nirmala UI", sans-serif;
  --font-body: "Anek Telugu", "Noto Sans Telugu", "Segoe UI", "Nirmala UI", system-ui, sans-serif;
  --radius: 1.1rem;
  --lift: 0 0.9rem 2.4rem rgba(120, 72, 20, 0.10), 0 0.1rem 0.3rem rgba(120, 72, 20, 0.06);
  color-scheme: light;
}

/* ---------- scale + shell ---------- */
html { height: 100%; font-size: clamp(14px, calc(1.6vmin + 0.45vw), 34px); }
body {
  height: 100%; margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font-body); line-height: 1.45;
  user-select: none; overscroll-behavior: none; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
img { max-width: 100%; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 0.2rem solid var(--saffron); outline-offset: 0.15rem; }

.app { height: 100dvh; display: grid; grid-template-rows: auto auto 1fr; }
.icon { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- government header (same as the PGRS Analytics Dashboard) ----------
   Emblem + system name | Chief Minister | Minister. Shared by the kiosk and the staff desk. */
.gov-header {
  display: grid; grid-template-columns: minmax(0, 1.2fr) auto minmax(0, 1fr); align-items: center;
  gap: 0.6rem 2rem; padding: 0.5rem clamp(1rem, 2.5vw, 2.5rem);
  background: var(--surface); border-top: 0.14rem solid var(--ink);
  border-bottom: 0.18rem solid transparent;
  border-image: linear-gradient(90deg, var(--saffron) 0%, var(--saffron) 55%, var(--leaf) 100%) 1;
}
.gov-brand { display: flex; align-items: center; gap: 0.9rem; min-width: 0; }
.gov-brand .emblem { height: 3.6rem; width: auto; flex: none; }
.gov-title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; line-height: 1.15;
  color: var(--pgrs-purple); text-wrap: balance; }
.gov-title small { display: block; font-size: 0.82em; font-weight: 600; }
.leader { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.leader.right { justify-self: end; text-align: right; }
.leader img { width: 3.1rem; height: 3.4rem; object-fit: cover; border-radius: 0.35rem; flex: none; background: var(--paper); }
.leader-name { font-family: var(--font-display); font-weight: 600; font-size: 0.92rem; line-height: 1.15; color: var(--ink); }
.leader-role { font-size: 0.66rem; line-height: 1.35; color: var(--ink-soft); }

/* green strip under the header: test-mode note (centre, test mode only) · language (right, always) */
.subbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem;
  background: var(--leaf-wash); padding: 0.25rem clamp(1rem, 2.5vw, 2.5rem); }
.test-ribbon { grid-column: 2; color: var(--leaf-deep); text-align: center;
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; }

/* ---------- stage ---------- */
.stage { min-height: 0; display: flex; }
.screen { display: none; flex: 1; min-height: 0; gap: clamp(1rem, 2vw, 2rem);
  padding: clamp(0.8rem, 2vh, 1.8rem) clamp(1rem, 2.5vw, 2.5rem); }
.screen.active { display: grid; }
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--lift); min-width: 0; }

h1, h2 { font-family: var(--font-display); font-weight: 700; margin: 0; line-height: 1.15; text-wrap: balance; }
h1 { font-size: 2.1rem; }
h2 { font-size: 1.5rem; }
.lead { margin: 0; color: var(--ink-soft); max-width: 36em; }
.eyebrow { margin: 0; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--leaf-deep); }

/* ---------- buttons ---------- */
.btn {
  border: 0; border-radius: 0.85rem; cursor: pointer; font-weight: 700; font-size: 1rem;
  min-height: 3.4rem; padding: 0 1.4rem; display: inline-flex; align-items: center; justify-content: center;
  gap: 0.6rem; position: relative; overflow: hidden; transition: transform 0.1s, box-shadow 0.2s, background 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: linear-gradient(135deg, var(--saffron), var(--saffron-deep)); color: #fff;
  box-shadow: 0 0.5rem 1.2rem rgba(200, 95, 12, 0.28); }
.btn-primary:disabled { background: #efd9c1; color: #fff; box-shadow: none; cursor: default; }
.btn-go { background: linear-gradient(135deg, var(--leaf), var(--leaf-deep)); color: #fff;
  box-shadow: 0 0.5rem 1.2rem rgba(63, 125, 32, 0.25); }
.btn-ghost { background: var(--surface); color: var(--ink); border: 0.12rem solid var(--rule); }
.actions { display: flex; gap: 0.8rem; }
.actions > * { flex: 1; }

/* ---------- login ---------- */
#screen-login { grid-template-columns: 1.15fr minmax(0, 1fr); align-items: stretch; }
.welcome {
  position: relative; overflow: hidden; border-radius: var(--radius);
  padding: clamp(1.2rem, 4vh, 3rem) clamp(1.2rem, 3vw, 3rem);
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 1rem;
  background: linear-gradient(160deg, var(--saffron-wash) 0%, #fff7ee 55%, var(--leaf-wash) 100%);
}
.welcome > * { position: relative; }
.welcome > .watermark { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(38%, 60vh); height: auto; opacity: 0.06; pointer-events: none; }
.steps { list-style: none; margin: 0.6rem 0 0; padding: 0; display: grid; gap: 0.7rem; justify-items: start; }
.step { display: flex; align-items: center; gap: 0.8rem; color: var(--ink-soft); font-size: 1rem; }
.step b { width: 2.3rem; height: 2.3rem; flex: none; display: grid; place-items: center; border-radius: 50%;
  background: var(--surface); border: 0.13rem solid var(--rule); font-variant-numeric: tabular-nums; }
.step.on { color: var(--ink); font-weight: 700; }
.step.on b { background: var(--saffron); border-color: var(--saffron); color: #fff; }
.step.ok b { background: var(--leaf); border-color: var(--leaf); color: #fff; }
/* language: a small pill on the right of the green strip under the header */
.lang-toggle { grid-column: 3; justify-self: end; display: inline-flex; align-items: center; gap: 0.15rem; padding: 0.15rem;
  border-radius: 99rem; background: var(--surface); border: 0.1rem solid var(--rule);
  box-shadow: 0 0.2rem 0.6rem rgba(120, 72, 20, 0.08); color: var(--ink-soft); }
.lang-toggle button { border: 0; background: transparent; color: var(--ink-soft); font-weight: 600; font-size: 0.75rem;
  padding: 0.2rem 0.85rem; min-height: 1.9rem; border-radius: 99rem; cursor: pointer; }
.lang-toggle button.on { background: var(--saffron); color: #fff; }

.login-panel { display: flex; flex-direction: column; gap: clamp(0.5rem, 1.4vh, 0.9rem);
  padding: clamp(1rem, 2.5vh, 1.8rem) clamp(1rem, 2vw, 1.8rem); }
.field-label { font-weight: 700; font-size: 0.95rem; }
.digits { display: flex; justify-content: center; gap: 0.35rem; padding: 0.6rem; min-height: 3.6rem;
  align-items: center; background: var(--paper); border: 0.12rem solid var(--rule); border-radius: 0.85rem;
  font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.digits .slot { width: 1.05em; text-align: center; border-bottom: 0.16rem solid var(--rule); line-height: 1.25; }
.digits .slot.filled { border-color: var(--saffron); }
.digits .gap { width: 0.6em; flex: none; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(0.35rem, 1vh, 0.6rem); }
.key { height: clamp(2.6rem, 8.2vh, 4.4rem); border: 0.12rem solid var(--rule); border-radius: 0.85rem;
  background: var(--surface); font-size: 1.4rem; font-weight: 600; cursor: pointer;
  display: grid; place-items: center; position: relative; overflow: hidden; font-variant-numeric: tabular-nums; }
.key:active { background: var(--saffron-wash); border-color: var(--saffron); }
.consent { display: flex; gap: 0.7rem; align-items: flex-start; font-size: 0.78rem; color: var(--ink-soft); cursor: pointer; }
.consent .box { width: 1.7rem; height: 1.7rem; flex: none; border: 0.14rem solid var(--leaf-deep); border-radius: 0.4rem;
  display: grid; place-items: center; color: #fff; }
.consent.on .box { background: var(--leaf-deep); }
.consent .box .icon { width: 1rem; height: 1rem; opacity: 0; }
.consent.on .box .icon { opacity: 1; }
.hint { font-size: 0.78rem; color: var(--ink-soft); text-align: center; }
.hint u { color: var(--saffron-deep); font-weight: 700; cursor: pointer; }
.error-text { color: var(--alert); font-weight: 600; font-size: 0.85rem; }
#login-error:empty, #login-hint:empty { display: none; }

/* ---------- conversation ---------- */
#screen-talk { grid-template-columns: minmax(0, 1.7fr) minmax(16rem, 1fr); }
.question { display: flex; flex-direction: column; gap: 1rem; overflow: auto;
  padding: clamp(1.1rem, 3vh, 2.2rem) clamp(1.1rem, 2.5vw, 2.4rem); }
.speaker-tag { display: inline-flex; align-self: flex-start; align-items: center; gap: 0.45rem;
  font-size: 0.75rem; font-weight: 700; color: var(--saffron-deep); background: var(--saffron-wash);
  padding: 0.3rem 0.8rem; border-radius: 99rem; }
.bot-text { font-family: var(--font-display); font-weight: 600; font-size: 1.75rem; line-height: 1.3; white-space: pre-line; }
.details { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.25rem 1.2rem;
  padding: 0.9rem 1.1rem; background: var(--paper); border: 0.12rem solid var(--rule); border-radius: 0.85rem; font-size: 0.85rem; }
.details div { display: flex; gap: 0.5rem; min-width: 0; }
.details dt { color: var(--ink-soft); white-space: nowrap; }
.details dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.heard { font-size: 1.05rem; color: var(--ink-soft); font-style: italic; border-left: 0.2rem solid var(--leaf); padding-left: 0.8rem; }
.heard:empty { display: none; }
.choices { display: flex; flex-wrap: wrap; gap: 0.7rem; }
.choice { min-height: 3.3rem; padding: 0 1.4rem; border-radius: 0.85rem; cursor: pointer; font-weight: 700; font-size: 1rem;
  border: 0.14rem solid var(--saffron); background: var(--surface); color: var(--saffron-deep);
  display: inline-flex; align-items: center; gap: 0.5rem; position: relative; overflow: hidden; }
.choice.primary { background: linear-gradient(135deg, var(--leaf), var(--leaf-deep)); border-color: var(--leaf-deep); color: #fff; }
.option-box { display: grid; gap: 0.7rem; min-height: 0; }
.list-search { width: 100%; font: inherit; font-size: 1rem; padding: 0.8rem 1rem; border: 0.12rem solid var(--rule); border-radius: 0.8rem; }
.option-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 0.55rem; max-height: 36vh; overflow: auto; }
.option-list .choice { justify-content: flex-start; min-height: 2.9rem; font-weight: 600; }

.mic-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.2rem;
  border-radius: var(--radius); background: linear-gradient(180deg, var(--surface), var(--paper)); box-shadow: var(--lift);
  padding: 1.2rem; min-width: 0; }
.mic { --level: 0; position: relative; width: clamp(7.5rem, 26vmin, 12rem); aspect-ratio: 1; max-width: 100%;
  border: 0; border-radius: 50%; cursor: pointer; color: #fff; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--saffron), var(--saffron-deep)); box-shadow: 0 1rem 2.4rem rgba(200, 95, 12, 0.35);
  transition: background 0.25s; }
.mic .icon { width: 40%; height: 40%; position: relative; }
.mic .ring { position: absolute; inset: 0; border-radius: 50%; border: 0.25rem solid var(--leaf); opacity: 0; }
.mic.listening { background: linear-gradient(135deg, var(--leaf), var(--leaf-deep)); box-shadow: 0 1rem 2.4rem rgba(63, 125, 32, 0.35); }
.mic.listening .r1 { transform: scale(calc(1.06 + var(--level) * 0.5)); opacity: calc(0.25 + var(--level)); transition: transform 0.08s; }
.mic.listening .r2 { animation: pulse 1.8s ease-out infinite; }
.mic.busy { background: linear-gradient(135deg, #d9cfc2, #bfb2a2); box-shadow: none; }
@keyframes pulse { from { transform: scale(1); opacity: 0.5; } to { transform: scale(1.45); opacity: 0; } }
.status { font-weight: 700; font-size: 1.05rem; text-align: center; min-height: 1.5em; }
.talk-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; width: 100%; }

/* ---------- done ---------- */
#screen-done { place-items: center; }
.done-card { width: min(46rem, 100%); padding: clamp(1.4rem, 5vh, 3rem) clamp(1.2rem, 4vw, 3rem);
  display: flex; flex-direction: column; align-items: center; gap: 0.9rem; text-align: center; }
.done-mark { color: var(--leaf-deep); }
.done-mark .icon { width: 4rem; height: 4rem; }
.ticket { font-size: 2.4rem; font-weight: 800; letter-spacing: 0.08em; font-variant-numeric: tabular-nums;
  padding: 0.4rem 1.6rem; border-radius: 0.9rem; background: var(--leaf-wash); color: var(--leaf-deep);
  border: 0.14rem dashed var(--leaf); overflow-wrap: anywhere; }
.officer { margin: 0; font-weight: 600; }
.done-card .actions { width: 100%; }
.countdown { font-size: 0.8rem; color: var(--ink-soft); }

/* ---------- overlay ---------- */
.overlay { position: fixed; inset: 0; z-index: 10; display: none; align-items: center; justify-content: center;
  padding: 1.5rem; background: rgba(38, 34, 29, 0.55); backdrop-filter: blur(3px); }
.overlay.show { display: flex; }
.dialog { width: min(34rem, 100%); padding: 1.8rem; display: flex; flex-direction: column; gap: 1rem; text-align: center; align-items: center; }
.dialog .icon { width: 3.4rem; height: 3.4rem; color: var(--saffron); }
.dialog .actions { width: 100%; }

.receipt-card { width: min(60rem, 100%); height: min(92vh, 100%); padding: 1rem; display: flex; flex-direction: column; gap: 0.8rem; }
.receipt-card iframe { flex: 1; width: 100%; border: 0.12rem solid var(--rule); border-radius: 0.8rem; background: #fff; }

/* tap ripple (utils/ui.js) */
.ripple { position: absolute; border-radius: 50%; transform: scale(0); pointer-events: none;
  background: rgba(255, 255, 255, 0.45); animation: ripple 0.5s ease-out; }
.btn-ghost .ripple, .key .ripple, .choice:not(.primary) .ripple { background: rgba(232, 118, 26, 0.18); }
@keyframes ripple { to { transform: scale(3); opacity: 0; } }

/* ---------- portrait tablets / small screens: stack and allow scrolling ---------- */
@media (max-aspect-ratio: 1/1), (max-width: 760px) {
  .app { height: auto; min-height: 100dvh; }
  #screen-login, #screen-talk { grid-template-columns: 1fr; }
  .welcome { padding-block: 1.2rem; }
  .welcome > .watermark { display: none; }
  .gov-header { grid-template-columns: 1fr 1fr; }
  .gov-brand { grid-column: 1 / -1; }
  .leader-role { display: none; }
  .mic { width: clamp(6.5rem, 30vw, 10rem); }
}
@media (max-width: 520px) { .gov-header .leader { display: none; } .gov-brand .emblem { height: 2.6rem; } }

@media (prefers-reduced-motion: reduce) {
  .mic.listening .r2, .ripple { animation: none; }
  .btn, .mic { transition: none; }
}

/* receipt print: only the done card */
@media print {
  body * { visibility: hidden; }
  #screen-done, #screen-done * { visibility: visible; }
  #screen-done { position: absolute; inset: 0; }
  #screen-done .actions, .countdown { display: none; }
}

/* ================= Staff desk (staff.html: <body class="staff">) =================
   Kiosk brand tokens on a desktop scale. Layout: header · toolbar with status counts ·
   two panes (record list | record file). Nested under body.staff, so none of it can
   reach the kiosk screen. */
html:has(body.staff) { font-size: 16px; }
body.staff {
  user-select: text; display: flex; flex-direction: column;
  --ink-faint: #9a9084;
  --row-on: #fff6ec;
  --bot-bubble: #f4efe7;
  --cit-bubble: var(--leaf-wash);
  --warn: #b7791f;
  --warn-wash: #fbf1dc;
  --alert-wash: #fbe7e6;
  --font-data: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;

  /* Government header: shared styles in kiosk.css, sized up for the 16px desk scale. */
  .gov-brand .emblem { height: 5rem; }
  .gov-title { font-size: 1.45rem; line-height: 1.12; }
  .gov-title small { font-size: 1em; }   /* three equal lines, as on the dashboard */
  .leader { gap: 1rem; }
  .leader img { width: 4.9rem; height: 5.4rem; border-radius: 0.4rem; }
  .leader-name { font-size: 1.3rem; }
  .leader-role { font-size: 0.95rem; }
  .toolbar .push { margin-left: auto; }
  @media (max-width: 72rem) { .gov-header { grid-template-columns: 1fr 1fr; } .gov-brand { grid-column: 1 / -1; } }

  /* ---------- toolbar ---------- */
  .toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem;
    padding: 0.9rem clamp(1rem, 2.5vw, 2rem); border-bottom: 1px solid var(--rule); background: var(--surface); }
  .field { font: inherit; font-size: 0.95rem; padding: 0.55rem 0.8rem; min-height: 2.6rem;
    border: 1px solid var(--rule); border-radius: 0.6rem; background: var(--paper); color: var(--ink); min-width: 0; }
  .field:focus-visible { outline: 0.15rem solid var(--saffron); outline-offset: 0; border-color: var(--saffron); }
  #search { flex: 1 1 16rem; }
  #key { flex: 0 1 18rem; }
  .chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
  .chip { border: 1px solid var(--rule); background: var(--surface); border-radius: 99rem; cursor: pointer;
    padding: 0.35rem 0.8rem; font-size: 0.85rem; font-weight: 600; color: var(--ink-soft);
    display: inline-flex; align-items: center; gap: 0.45rem; min-height: 2.3rem; }
  .chip .n { font-variant-numeric: tabular-nums; color: var(--ink-faint); font-weight: 700; }
  .chip.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
  .chip.on .n { color: var(--saffron-wash); }
  .tool-btn { border: 0; border-radius: 0.6rem; cursor: pointer; font-weight: 700; font-size: 0.9rem;
    min-height: 2.6rem; padding: 0 1rem; background: var(--saffron); color: #fff; display: inline-flex; align-items: center; gap: 0.4rem; }
  .tool-btn:hover { background: var(--saffron-deep); }
  .tool-btn.quiet { background: transparent; color: var(--ink-soft); border: 1px solid var(--rule); }
  .tool-btn.quiet:hover { background: var(--paper); color: var(--ink); }
  .error-bar { padding: 0.6rem clamp(1rem, 2.5vw, 2rem); background: var(--alert-wash); color: var(--alert); font-weight: 600; font-size: 0.9rem; }

  /* ---------- panes ---------- */
  .desk { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(19rem, 26rem) minmax(0, 1fr); }
  .list { overflow: auto; border-right: 1px solid var(--rule); background: var(--surface); }
  .list-head { position: sticky; top: 0; background: var(--surface); padding: 0.6rem 1rem; font-size: 0.72rem;
    font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); border-bottom: 1px solid var(--rule); z-index: 1; }
  .row { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 1fr auto; gap: 0.2rem 0.75rem; width: 100%;
    padding: 0.8rem 1rem; border-bottom: 1px solid var(--rule); cursor: pointer; border-left: 0.2rem solid transparent; }
  .row:hover { background: var(--paper); }
  .row.on { background: var(--row-on); border-left-color: var(--saffron); }
  .row:focus-visible { outline: 0.15rem solid var(--saffron); outline-offset: -0.15rem; }
  .row .gid { font-family: var(--font-data); font-size: 0.88rem; font-weight: 600; }
  .row .gid.none { font-family: var(--font-body); color: var(--ink-faint); font-weight: 500; }
  .row .who { grid-column: 1 / -1; font-size: 0.92rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .row .meta { grid-column: 1 / -1; font-size: 0.8rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

  .pill { font-size: 0.72rem; font-weight: 700; padding: 0.15rem 0.6rem; border-radius: 99rem; white-space: nowrap;
    align-self: start; letter-spacing: 0.02em; }
  .pill.registered { background: var(--leaf-wash); color: var(--leaf-deep); }
  .pill.in_progress { background: var(--saffron-wash); color: var(--saffron-deep); }
  .pill.failed { background: var(--alert-wash); color: var(--alert); }
  .pill.abandoned { background: var(--bot-bubble); color: var(--ink-soft); }

  .file { overflow: auto; padding: clamp(1rem, 2.5vw, 2rem); }
  .file-inner { max-width: 60rem; display: grid; gap: 1.25rem; }
  .empty { display: grid; place-items: center; text-align: center; color: var(--ink-soft); min-height: 60%; padding: 2rem; }
  .empty h2 { font-size: 1.15rem; color: var(--ink); margin-bottom: 0.3rem; }

  .file-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; }
  .file-head h1 { font-family: var(--font-data); font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; }
  .file-head .when { color: var(--ink-soft); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
  .file-head .spacer { flex: 1; }
  .danger { border: 1px solid var(--rule); background: var(--surface); color: var(--ink-soft); border-radius: 0.6rem;
    min-height: 2.4rem; padding: 0 0.9rem; font-weight: 600; font-size: 0.85rem; cursor: pointer; display: inline-flex; align-items: center; gap: 0.4rem; }
  .danger:hover { color: var(--alert); border-color: var(--alert); }
  .danger.armed { background: var(--alert); border-color: var(--alert); color: #fff; }
  .notice { background: var(--alert-wash); color: var(--alert); border-radius: 0.6rem; padding: 0.7rem 0.9rem; font-size: 0.9rem; }

  .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }
  .card-s { background: var(--surface); border: 1px solid var(--rule); border-radius: 0.8rem; padding: 1rem 1.1rem; min-width: 0; }
  .label { margin: 0 0 0.6rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }
  .kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.4rem 1rem; margin: 0; font-size: 0.95rem; }
  .kv dt { color: var(--ink-soft); }
  .kv dd { margin: 0; overflow-wrap: anywhere; }
  .kv .mono { font-family: var(--font-data); font-size: 0.88rem; }
  .said { margin: 0; font-size: 1.05rem; line-height: 1.6; max-width: 65ch; }
  .summary { margin: 0.8rem 0 0; padding-top: 0.8rem; border-top: 1px dashed var(--rule); color: var(--ink-soft); font-size: 0.92rem; max-width: 65ch; }
  .tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.8rem; }
  .tag { font-size: 0.78rem; padding: 0.15rem 0.55rem; border-radius: 0.4rem; background: var(--paper); border: 1px solid var(--rule); color: var(--ink-soft); }
  .tag b { color: var(--ink); font-family: var(--font-data); font-weight: 600; }

  /* ---------- conversation ---------- */
  .convo-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; justify-content: space-between; }
  audio { width: 100%; margin-top: 0.4rem; }
  .thread { display: grid; gap: 0.6rem; margin-top: 1rem; }
  .msg { max-width: min(46rem, 88%); padding: 0.6rem 0.85rem; border-radius: 0.8rem; font-size: 0.95rem; line-height: 1.5;
    white-space: pre-line; overflow-wrap: anywhere; }
  .msg.bot { background: var(--bot-bubble); border-top-left-radius: 0.2rem; justify-self: start; color: var(--ink); }
  .msg.cit { background: var(--cit-bubble); border-top-right-radius: 0.2rem; justify-self: end; }
  .msg.cit.silent { background: transparent; border: 1px dashed var(--rule); color: var(--ink-faint); font-style: italic; }
  .msg.cit.playing { box-shadow: 0 0 0 0.15rem var(--leaf); }
  .who-line { display: flex; align-items: center; gap: 0.5rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--ink-faint); margin-bottom: 0.2rem; }
  .msg.cit .who-line { justify-content: flex-end; color: var(--leaf-deep); }
  .seek { border: 0; background: var(--surface); color: var(--leaf-deep); border-radius: 99rem; cursor: pointer;
    font: 700 0.75rem var(--font-data); padding: 0.1rem 0.5rem; display: inline-flex; align-items: center; gap: 0.25rem; }
  .seek:hover { background: var(--leaf); color: #fff; }

  @media (max-width: 52rem) {
    .desk { grid-template-columns: 1fr; grid-template-rows: minmax(12rem, 40vh) 1fr; }
    .list { border-right: 0; border-bottom: 1px solid var(--rule); }
  }
  @media (prefers-reduced-motion: no-preference) { .row, .chip, .seek, .danger { transition: background 120ms, color 120ms, border-color 120ms; } }
}
