/* Triage Console + shared app shell — theme-agnostic structural CSS.
   Every color/font/radius/shadow comes from a CSS variable defined in
   nightshift.css ([data-theme=daybreak|night]). This file is the ONE
   component library for the whole app: the sidebar/topbar/nav rendered by
   app.js on every screen use the same classes as the Triage engine itself,
   so nothing drifts. New (Phase 3): customer context card, AI-authorship
   blocks with provenance chips, quote card, reject reason sheet, guarded
   approve + Sunrise/Advance motion, live spine, Inbox-Zero day-plan +
   cafezinho, ⌘K palette, why-popover. */

/* ---------- shell ---------- */
.app { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 232px; flex-shrink: 0; background: var(--sidebar); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--canvas); }

.logo { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 16px; flex-shrink: 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.logo-mark { width: 30px; height: 30px; border-radius: var(--radius-sm); background: var(--brand-mark-bg); color: var(--brand-mark-fg);
  display: grid; place-items: center; font: 800 13px var(--font-display); letter-spacing: -0.02em; box-shadow: var(--brand-mark-shadow); }
.logo-name { font-weight: 700; font-size: 14px; line-height: 1.15; font-family: var(--font-display); font-variation-settings: 'wdth' 115; }
.logo-sub { font-size: 11px; color: var(--ink-4); }

.nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-group + .nav-group { margin-top: 18px; }
.nav-label { padding: 0 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-size: 13px; font-weight: 450; position: relative; transition: background .12s, color .12s;
  width: 100%; text-align: left; text-decoration: none; cursor: pointer; }
.nav-item:hover { background: var(--hover); }
.nav-item .ic { width: 17px; height: 17px; color: var(--ink-3); flex-shrink: 0; }
.nav-item.active { background: var(--accent-weak); color: var(--accent-ink); font-weight: 550; }
.nav-item.active .ic { color: var(--accent); }
.nav-item.active::before { content: ''; position: absolute; left: -10px; top: 6px; bottom: 6px; width: 2px; border-radius: 0 2px 2px 0; background: var(--accent); }
.nav-count { margin-left: auto; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 9999px; background: var(--count-bg); color: var(--count-fg); }
.nav-count.warn { background: var(--warn-weak); color: var(--warn-ink); }
.nav-count.moon { background: var(--moon-wash); color: var(--moon); }

.side-foot { padding: 10px 8px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; flex-shrink: 0; }
.lang-mini { display: flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; font-size: 11.5px; }
.lang-mini button { flex: 1; background: none; border: none; padding: 6px 4px; color: var(--ink-3); cursor: pointer; font-family: var(--font-body); }
.lang-mini button.on { background: var(--panel); color: var(--ink); font-weight: 600; }
.user { display: flex; align-items: center; gap: 10px; padding: 4px 4px; }
.avatar { width: 28px; height: 28px; border-radius: 9999px; display: grid; place-items: center; font-size: 11px; font-weight: 600; background: var(--avatar-bg); color: var(--avatar-fg); flex-shrink: 0; }

/* Sidebar-footer icon buttons — Settings (v2 IA: moved out of the main nav,
   lives as a footer icon) and the v3 §E night-theme toggle share this base;
   .side-settings adds only the page-active highlight on top of it. */
.side-iconbtn { width: 28px; height: 28px; border-radius: var(--radius-sm); display: grid; place-items: center; color: var(--ink-3); flex-shrink: 0; transition: background .12s, color .12s; border: none; background: none; cursor: pointer; text-decoration: none; }
.side-iconbtn:hover { background: var(--hover); color: var(--ink); }
.side-iconbtn .ic { width: 16px; height: 16px; }
.side-settings.active { background: var(--accent-weak); color: var(--accent-ink); }

/* topbar — v3 §C single compact band: 14px vertical padding owns the height
   (no fixed height any more), title+subtitle sit inline on one row via
   .tb-title, one hairline below. Triage's spine (below) visually continues
   this same band — see ".topbar:has(+ .spine)" below. */
.topbar { flex-shrink: 0; display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--topbar-bg); }
.tb-title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; row-gap: 2px; }
.topbar h1 { margin: 0; font-family: var(--font-display); font-variation-settings: 'wdth' 118; font-size: 18px; font-weight: 700; white-space: nowrap; }
/* the separator + subtitle wrap as ONE unit (never splitting the dot from
   its text onto different lines — a lone trailing "·" reads as broken) */
.tb-subwrap { display: inline-flex; align-items: baseline; gap: 8px; min-width: 0; }
.topbar .tb-sep { color: var(--ink-4); font-size: 13px; flex-shrink: 0; }
.topbar .sub { font-size: 13px; color: var(--ink-3); line-height: 1.4; }
.spacer { flex: 1; }

/* ---------- narrow-viewport shell (phone widths) ----------
   The app shell is desktop-primary business software (not a public site),
   so this is intentionally a light adaptation rather than a full redesign:
   the sidebar collapses to an icon rail (labels/counts still reachable —
   nothing is removed, just denser) and the topbar is allowed to wrap onto
   a second line instead of fixed-height overflow painting over .content
   below it. Scoped tight (max-width:640px) so tablet/desktop are untouched. */
@media (max-width: 640px) {
  .sidebar { width: 76px; }
  .logo { padding: 0; justify-content: center; gap: 0; }
  .logo-name, .logo-sub { display: none; }
  .nav-item { justify-content: center; padding: 0; position: relative; }
  .nav-item span:not(.nav-count) { display: none; }
  .nav-item.active::before { left: 0; }
  .nav-count { position: absolute; top: 2px; right: 6px; margin-left: 0; font-size: 9px; padding: 1px 5px; }
  .nav-label { display: none; }
  .side-foot { padding: 8px 6px; }
  .lang-mini { flex-direction: column; }
  .lang-mini button { padding: 5px 2px; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* v3 §E added a 2nd footer icon button (theme toggle) alongside Settings —
     the row now holds 2 icon buttons, not avatar+1, so the avatar (already
     redundant with the nav's icon-only treatment at this width) steps aside
     and the sidebar widens slightly (64->76px) so both fit without crowding. */
  .user { justify-content: center; gap: 6px; }
  .user > div, .user .avatar { display: none; }

  .topbar { flex-wrap: wrap; padding: 10px 12px; row-gap: 6px; }
  .tb-title { flex-basis: 100%; }
  .cmdk { width: auto; flex: 1; min-width: 0; }
  .cmdk span:not(.kbd-r) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
.cmdk { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; width: 230px; border-radius: var(--radius-sm);
  background: var(--input-bg); border: 1px solid var(--line); color: var(--ink-4); font-size: 12.5px; cursor: text; }
.cmdk .ic { width: 15px; height: 15px; flex-shrink: 0; }
.cmdk .kbd-r { margin-left: auto; }

/* ---------- spine ribbon (live — counts/fill update as the queue clears) ---
   v3 §C: merges INTO the header band as a slim ~28px second row — same
   background as .topbar (not --spine-bg), no seam between them; the hairline
   that used to sit under .topbar moves down to sit under the spine instead
   (the band's actual bottom edge now). Only fires when a spine really
   follows a topbar (Triage only) — every other page's topbar keeps its own
   hairline via the base rule above. */
.topbar:has(+ .spine) { border-bottom: none; }
.topbar + .spine { background: var(--topbar-bg); }
.spine { display: flex; align-items: center; gap: 0; padding: 4px 20px 8px; border-bottom: 1px solid var(--line); background: var(--spine-bg); }
.spine-step { display: flex; align-items: center; gap: 8px; }
.spine-node { display: flex; align-items: center; gap: 7px; padding: 3px 9px; border-radius: 9999px; font: 500 11px var(--font-mono); color: var(--ink-4); white-space: nowrap; }
.spine-node .dot { width: 7px; height: 7px; border-radius: 9999px; background: var(--line-strong); transition: background .3s; }
.spine-node .n { font-size: 10.5px; opacity: .8; }
.spine-node.done { color: var(--ink-3); }
.spine-node.done .dot { background: var(--ok); }
.spine-node.current { color: var(--accent-ink); background: var(--accent-weak); font-weight: 600; }
.spine-node.current .dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-halo); }
.spine-node.lead-fill .dot { background: var(--ok); }
.spine-line { width: 26px; height: 1px; background: var(--line-strong); margin: 0 2px; position: relative; overflow: hidden; }
.spine-line i { position: absolute; inset: 0; background: var(--ok); width: 0%; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.spine .hint { margin-left: auto; font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 14px; }
.spine .hint .grp { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- console (queue | detail) ---------- */
.console { flex: 1; display: flex; min-height: 0; }
.queue { width: 33%; min-width: 300px; max-width: 380px; border-right: 1px solid var(--line); display: flex; flex-direction: column; background: var(--queue-bg); }
.queue-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.queue-head .title { font-size: 13px; font-weight: 600; }
.queue-list { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }

.draft { text-align: left; width: 100%; padding: 11px 12px; border-radius: var(--radius); border: 1px solid transparent; background: var(--draft-bg);
  display: flex; flex-direction: column; gap: 7px; transition: background .12s, border-color .12s, box-shadow .12s; position: relative; cursor: pointer; }
.draft:hover { background: var(--hover); }
.draft.active { background: var(--draft-active-bg); border-color: var(--line-strong); box-shadow: var(--draft-active-shadow); }
.draft.active::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 2px; border-radius: 2px; background: var(--accent); }
.draft-top { display: flex; align-items: center; gap: 7px; }
.draft-name { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.draft-time { margin-left: auto; font-size: 11px; color: var(--ink-4); white-space: nowrap; }
.draft-sub { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.draft-sub .ai-star { color: var(--moon); }
.draft-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- detail pane ----------
   .pane is the positioning context for .actionbar but must NOT also be the
   scrolling element: a plain position:absolute child scrolls away with its
   containing block's own content (only position:fixed/sticky are exempt),
   so pinning the bar to "bottom:0 of .pane" only holds if .pane itself never
   scrolls. .pane-in is the one that scrolls internally instead. */
.pane { background: var(--panel); display: flex; flex-direction: column; min-height: 0; position: relative; }
.pane-in { overflow-y: auto; flex: 1; min-height: 0; padding: 20px 26px 118px; display: flex; flex-direction: column; gap: 14px; max-width: 820px; width: 100%; }
/* .pane-in is the SCROLL container by design (overflow-y:auto) — its
   children should never compress to fit, only the pane should scroll. But
   any child with its own overflow:hidden (.ctx, .quote) gets an automatic
   flexbox min-height of 0 per spec, so once total content is tall enough to
   need shrinking, THOSE children collapse to ~0 while siblings don't. Seen
   for real once a draft's content got tall enough to trigger it (v2 photo-
   order card). flex-shrink:0 on every direct child removes the whole class
   of bug rather than patching each overflow:hidden component individually. */
.pane-in > * { flex-shrink: 0; }
.dhead { display: flex; align-items: flex-start; gap: 14px; }
.dhead .avatar { width: 44px; height: 44px; border-radius: var(--radius); font-size: 15px; }
.dhead h2 { font-family: var(--font-display); font-variation-settings: 'wdth' 115; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dhead .company { font-size: 13px; color: var(--ink-3); margin-top: 1px; }
.dhead .chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.dhead .right { margin-left: auto; text-align: right; flex-shrink: 0; }
.dhead .right .time { font-size: 12px; color: var(--ink-4); margin-top: 4px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.panel.pad { padding: 14px; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.panel-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.panel-title .ic { width: 14px; height: 14px; }

/* ---- customer context card — DIR-03 ---- */
.ctx { border: 1px solid var(--line-strong); border-radius: var(--radius-lg); overflow: hidden; }
.ctx-head { display: flex; align-items: center; gap: 8px; padding: 9px 14px; background: var(--sunken); font: 600 11px var(--font-display);
  font-variation-settings: 'wdth' 110; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.ctx-head .known { margin-left: auto; font: 500 11px var(--font-mono); color: var(--ok-ink); text-transform: none; letter-spacing: 0; }
.ctx-head .new { margin-left: auto; font: 500 11px var(--font-mono); color: var(--ink-3); text-transform: none; letter-spacing: 0; }
.ctx-head a.mkcust { margin-left: 8px; color: var(--accent-ink); text-transform: none; letter-spacing: 0; font: 600 11px var(--font-body); text-decoration: none; }
.ctx-body { display: grid; grid-template-columns: repeat(5, 1fr); }
.ctx.quiet .ctx-body { grid-template-columns: repeat(4, 1fr); }
.ctx-cell { padding: 12px 14px; border-right: 1px solid var(--line); min-width: 0; }
.ctx-cell:last-child { border: none; }
.ctx-cell .k { font-size: 10.5px; color: var(--ink-3); margin-bottom: 3px; }
.ctx-cell .v { font: 600 14px var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-cell .v small { font: 500 10.5px var(--font-mono); color: var(--ink-3); }
/* v5 Q5 fix — at phone widths the fixed 5-column grid (4 in .quiet) leaves
   ~70px/cell, and .ctx-cell .v's single-line ellipsis then hides real
   information behind "…" (e.g. the price rendered as literally "$…") —
   flagged but left unfixed by the product-detail.html build (F5), which
   correctly identified it as pre-existing on customer-detail.html too (a
   shared component, not a new regression) and deferred the call to QA.
   Reflowing to 2 columns + letting the value wrap fixes both consumers at
   once. Placed HERE (immediately after the component, not in the shared
   narrow-viewport block near the top of this file) because that block's
   position is earlier in source order than this component's own base
   rules above — same specificity, so the LATER rule (this component's
   unconditional 5/4-column definition) would otherwise win the cascade
   regardless of the media condition, silently no-op'ing an override placed
   up there. Scoped to the same max-width:640px breakpoint as that block. */
@media (max-width: 640px) {
  .ctx-body, .ctx.quiet .ctx-body { grid-template-columns: repeat(2, 1fr); }
  .ctx-cell { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .ctx-cell:nth-child(2n) { border-right: none; }
  .ctx-cell .v { white-space: normal; overflow: visible; text-overflow: clip; word-break: break-word; }
}
.ctx-quiet-banner { display: flex; align-items: center; gap: 8px; padding: 9px 14px; background: var(--warn-weak); color: var(--warn-ink); font-size: 12.5px; border-top: 1px solid var(--line); }
.ctx-quiet-banner .ic { width: 14px; height: 14px; flex-shrink: 0; }
.ctx-quiet-banner a { margin-left: auto; font-weight: 700; text-decoration: none; color: var(--warn-ink); }

/* ---- AI-authored blocks (moonlight) — summary + transcript + why popover --- */
.blk { border-radius: var(--radius-lg); border: 1px solid var(--line); }
.blk.ai-auth { background: var(--ai-bg); border-color: var(--ai-border); transition: background .5s ease, border-color .5s ease; }
.blk-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font: 600 11px var(--font-display);
  font-variation-settings: 'wdth' 110; letter-spacing: .08em; text-transform: uppercase; color: var(--moon); position: relative; }
.blk-head .why { margin-left: auto; font: 500 10.5px var(--font-mono); letter-spacing: 0; text-transform: none; cursor: pointer;
  text-decoration: underline dotted; color: var(--ink-3); background: none; border: none; }
.blk-body { padding: 0 14px 13px; font-size: 13.5px; line-height: 1.6; color: var(--ink); }
.blk-body .summary-line { padding: 2px 0 11px; color: var(--ink-2); }
.blk-body .trans-toggle { float: right; font: 500 10.5px var(--font-mono); color: var(--ink-3); background: none; border: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }

.turn { display: grid; grid-template-columns: 46px 1fr; gap: 10px; padding: 9px 0; border-top: 1px dashed var(--moon-line); }
.turn:first-child { border-top: none; }
.turn .ts { font: 500 11px var(--font-mono); color: var(--ink-3); padding-top: 2px; }
.turn .who { font: 600 11px var(--font-mono); margin-bottom: 2px; color: var(--ink-2); }
.turn.ai .who { color: var(--moon); }
.turn .pt, .turn .orig { font-size: 13.5px; color: var(--ink); }
.turn .en { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.hide-en .en { display: none; }
.turn.hl { background: var(--accent-weak); border-radius: 8px; margin: 0 -8px; padding: 9px 8px; border-top-color: transparent; }
.turn .answer-chips { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }

/* ---- photo -> draft order (v2 §4.1) — the "photo" is a styled inline
   artifact, never an external image (file:// safe, no assets to fetch). ---- */
.photo-artifact { display: flex; flex-direction: column; align-items: center; padding: 6px 0 14px; }
.photo-paper { background: oklch(0.98 0.014 85); border: 1px solid oklch(0.89 0.02 80); border-radius: 3px;
  padding: 18px 22px 14px; max-width: 340px; transform: rotate(-1.6deg); position: relative;
  box-shadow: 0 14px 28px oklch(0.35 0.05 60 / .16), 0 3px 8px oklch(0.35 0.05 60 / .12); }
.photo-paper::before { content: '📎'; position: absolute; top: -14px; left: 22px; font-size: 22px; transform: rotate(14deg); }
.photo-hw { font-family: 'Caveat', cursive; font-size: 25px; line-height: 1.45; color: oklch(0.30 0.07 258); }
.photo-cap { margin-top: 9px; font: 500 11px var(--font-mono); color: var(--ink-4); display: flex; align-items: center; gap: 5px; }
.photo-cap .ic { width: 12px; height: 12px; }
.approved .photo-paper { box-shadow: 0 4px 10px oklch(0.35 0.05 60 / .08); }

/* order lines — photo-order's quote-card content (see .quote/.q-line) */
.q-line .oc-raw { font-size: 11.5px; color: var(--ink-4); font-style: italic; display: block; margin-top: 2px; }

/* message (chat/whatsapp) */
.msg-bubble { background: var(--sunken); border-radius: var(--radius); padding: 11px 13px; font-size: 14px; }
.msg-bubble .en { font-size: 13px; color: var(--ink-3); margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }

/* suggested reply */
.reply-box { background: var(--reply-bg); border: 1px solid var(--reply-border); border-radius: var(--radius); padding: 12px; font-size: 13.5px; line-height: 1.55; color: var(--ink); }

/* extracted fields — moonlight-until-confirmed (iA Writer pattern) */
.fields { display: flex; flex-direction: column; gap: 2px; }
.f-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.f { display: flex; align-items: center; gap: 10px; border: 1px solid var(--moon-line); background: var(--moon-wash);
  border-radius: var(--radius); padding: 9px 12px; transition: background .5s ease, border-color .5s ease; min-width: 0; }
.f .k { font-size: 11px; color: var(--ink-3); width: 100px; flex: none; }
.f .v { font-weight: 600; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f .v .note { font-weight: 400; color: var(--ink-4); font-size: 11px; }
.f .src { margin-left: auto; font: 500 10px var(--font-mono); color: var(--moon); cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.f.missing { border-color: var(--bad-border); background: var(--bad-weak); }
.f.missing .v { color: var(--bad-ink); font-weight: 500; }
.approved .blk.ai-auth { background: var(--panel); border-color: var(--line); }
.approved .blk-head { color: var(--ink-3); }
.approved .f { background: var(--panel); border-color: var(--line); }
.approved .f .src { color: var(--ink-3); }
.approved .f.missing { background: var(--bad-weak); border-color: var(--bad-border); }

/* ---- quote card — DIR-02 ---- */
.quote { border: 1px solid var(--line-strong); border-radius: var(--radius-lg); overflow: hidden; }
.q-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--sunken);
  font: 600 11px var(--font-display); font-variation-settings: 'wdth' 110; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.q-head .kbd-hint { margin-left: auto; letter-spacing: 0; text-transform: none; font: 500 11px var(--font-mono); color: var(--ink-3); }
.q-line { display: flex; justify-content: space-between; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 13px; gap: 10px; }
.q-line .l { color: var(--ink-2); } .q-line .r { font: 600 13px var(--font-mono); flex-shrink: 0; text-align: right; }
.q-line.total { background: var(--sunken); }
.q-line.total .l { color: var(--ink); font-weight: 600; } .q-line.total .r { font-size: 15px; color: var(--signal); }
.q-actions { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.q-actions .prov { margin-left: auto; font: 500 10.5px var(--font-mono); color: var(--ink-3); }
.q-empty { padding: 16px 14px; font-size: 13px; color: var(--ink-3); }

/* ---- v2 §4.3 Below-Margin Guard — editable qty/price on the quote card --- */
.q-edit-input { width: 54px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--input-bg);
  padding: 2px 6px; font: 600 13px var(--font-mono); color: var(--ink); text-align: right; }
.q-edit-input:focus-visible { outline: 2px solid var(--signal-bg); outline-offset: 1px; }
.q-line.total.q-line-bad { background: var(--bad-weak); }
.q-line.total.q-line-bad .r { color: var(--bad-ink); }
.q-guard { display: flex; align-items: center; gap: 8px; padding: 9px 14px; background: var(--bad-weak); color: var(--bad-ink); font-size: 12.5px; border-top: 1px solid var(--bad-border); }
.q-guard[hidden] { display: none; }
.q-guard .ic { width: 14px; height: 14px; flex-shrink: 0; }
.q-reset-link { margin-left: auto; background: none; border: none; color: var(--bad-ink); font: 600 11.5px var(--font-body); text-decoration: underline; cursor: pointer; padding: 0; flex-shrink: 0; }

/* ---- reject reason sheet — DIR-07, two-tap ---- */
.overlay-scrim { position: fixed; inset: 0; background: oklch(0 0 0 / .35); z-index: 70; display: flex; align-items: center; justify-content: center; }
.sheet { background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop);
  width: 380px; max-width: calc(100vw - 40px); overflow: hidden; }
.sheet-head { padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.sheet-head .ic { width: 16px; height: 16px; color: var(--bad-ink); }
.sheet-body { padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.sheet-opt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); text-align: left; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.sheet-opt:hover { background: var(--hover); }
.sheet-opt kbd { margin-left: auto; }
.sheet-foot { padding: 10px 16px 14px; text-align: right; }

/* ---- WhatsApp broadcast composer (shared modal) — v2 §4.4 ---- */
.bcast-sheet { background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop); width: 560px; max-width: calc(100vw - 40px); max-height: calc(100vh - 80px);
  display: flex; flex-direction: column; overflow: hidden; }
.bcast-sub { padding: 10px 16px; font-size: 12.5px; color: var(--ink-3); border-bottom: 1px solid var(--line); flex-shrink: 0; line-height: 1.5; }
.bcast-list { overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; }
.bcast-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.bcast-who { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bcast-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.bcast-meta { font-size: 11px; color: var(--ink-3); }
.bcast-msg { width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--input-bg);
  padding: 8px 10px; font: 13px/1.5 var(--font-body); color: var(--ink); resize: vertical; }
.bcast-foot { flex-shrink: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; justify-content: space-between; }
.bcast-promise { font-size: 11px; color: var(--ink-3); }

/* ---- why popover ---- */
.why-pop { position: absolute; z-index: 40; top: calc(100% + 6px); right: 14px; width: 240px; background: var(--panel);
  border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 11px 13px; font-size: 12px; color: var(--ink-2); }
.why-pop .row { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.why-pop .row b { color: var(--ink); font-weight: 600; }

/* ---- guarded approve / next-action ---- */
.next { border-left: 3px solid var(--accent); background: var(--accent-weak); border-radius: var(--radius); padding: 11px 14px; }
.next .micro { color: var(--accent-ink); display: flex; align-items: center; gap: 6px; }
.next p { font-size: 13.5px; font-weight: 500; color: var(--ink); margin-top: 4px; }
.estimate { display: flex; align-items: center; gap: 8px; padding: 11px 14px; background: var(--sunken); border-radius: var(--radius); font-size: 13px; color: var(--ink-2); }
.estimate .ic { width: 15px; height: 15px; color: var(--ink-3); }
.estimate .val { margin-left: auto; font-weight: 600; color: var(--ink); }

/* ---------- action bar ---------- */
.actionbar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; gap: 8px;
  padding: 12px 26px; border-top: 1px solid var(--line); background: var(--actionbar-bg); backdrop-filter: blur(12px); }
.actionbar .row { display: flex; align-items: center; gap: 8px; max-width: 820px; flex-wrap: wrap; }
.btn .key, .btn kbd { font-family: var(--font-mono); font-size: 10px; padding: 2px 5px; border-radius: 4px; background: var(--key-bg); color: var(--key-fg); border: 1px solid var(--key-border); }
.btn-primary .key, .btn-primary kbd { background: var(--key-on-accent-bg); color: var(--btn-primary-fg); border-color: transparent; }
.btn-primary.guarded { background: var(--btn-bg); color: var(--ink-3); border-color: var(--line-strong); box-shadow: none; cursor: not-allowed; }
.btn-primary.guarded .key { background: var(--key-bg); color: var(--ink-4); }
.actionbar .guard-note { font-size: 12px; color: var(--warn-ink); display: flex; align-items: center; gap: 6px; }
.actionbar .guard-note .ic { width: 14px; height: 14px; }
.actionbar .ab-note { margin-left: auto; font: 500 11px var(--font-mono); color: var(--ink-3); }
@keyframes sz-shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }
.shake { animation: sz-shake .28s; }

/* ---------- toggle switch — settings.html AI-automation rows, Products &
   Pricing's live auto-quote column (shared so neither page hand-copies it) */
.stg-toggle { width: 38px; height: 22px; border-radius: 9999px; border: none; background: var(--sunken); position: relative; cursor: pointer; flex-shrink: 0; padding: 0; transition: background .15s; }
.stg-toggle .knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 9999px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.stg-toggle.on { background: var(--signal-bg); }
.stg-toggle.on .knob { transform: translateX(16px); }
.stg-toggle.locked { opacity: .55; cursor: not-allowed; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 8px; border-radius: 9999px; font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.badge .ic { width: 12px; height: 12px; }
.badge .bdot { width: 6px; height: 6px; border-radius: 9999px; }
.badge-pt { background: var(--pt-bg); color: var(--pt-fg); font-weight: 700; border-radius: 5px; padding: 0 6px; height: 19px; font-size: 11px; }
.badge-en { background: var(--sunken); color: var(--ink-3); border-radius: 5px; padding: 0 6px; height: 19px; font-size: 11px; font-weight: 500; }
.badge-neutral { background: var(--sunken); color: var(--ink-2); }
.badge-high { background: var(--ok-weak); color: var(--ok-ink); }
.badge-medium { background: var(--warn-weak); color: var(--warn-ink); }
.badge-low { background: var(--bad-weak); color: var(--bad-ink); }
.badge-need { background: var(--bad-weak); color: var(--bad-ink); }
.badge-ok { background: var(--ok-weak); color: var(--ok-ink); }
.conf { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; }
.conf .bdot { width: 6px; height: 6px; border-radius: 9999px; }

/* ---------- empty state — the day-plan (Triage's Inbox Zero) ---------- */
.empty { flex: 1; display: grid; place-items: center; padding: 40px; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 24px 24px; }
.empty-card { max-width: 480px; text-align: center; }
.empty-mark { width: 60px; height: 60px; border-radius: 9999px; background: var(--ok-weak); color: var(--ok); display: grid; place-items: center; margin: 0 auto 18px; }
.empty-mark .ic { width: 30px; height: 30px; }
.empty h2 { font-family: var(--font-display); font-variation-settings: 'wdth' 122; font-size: 25px; font-weight: 750; letter-spacing: -0.01em; }
.empty p { font-size: 14px; color: var(--ink-3); margin-top: 8px; line-height: 1.6; }
.empty-stats { display: flex; justify-content: center; gap: 20px; margin: 18px 0; }
.empty-stat .n { font: 650 24px var(--font-mono); }
.empty-stat .l { font-size: 11px; color: var(--ink-4); text-transform: uppercase; letter-spacing: 0.05em; }
.empty .cta { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 20px; border-radius: var(--radius); margin-top: 8px;
  background: var(--btn-primary-bg); color: var(--btn-primary-fg); font-weight: 600; font-size: 14px; box-shadow: var(--btn-primary-shadow); text-decoration: none; }
.cafe { position: relative; width: 46px; height: 40px; margin: 22px auto 4px; cursor: pointer; }
.cafe .cup { position: absolute; bottom: 0; left: 6px; width: 34px; height: 22px; border: 2.5px solid var(--ink-3); border-top: none; border-radius: 0 0 10px 10px; }
.cafe .handle { position: absolute; bottom: 4px; right: -6px; width: 10px; height: 12px; border: 2.5px solid var(--ink-3); border-left: none; border-radius: 0 8px 8px 0; }
.cafe .steam { position: absolute; bottom: 22px; width: 3px; height: 10px; border-radius: 3px; background: var(--ink-4); }
.cafe .steam:nth-child(3) { left: 12px; } .cafe .steam:nth-child(4) { left: 20px; } .cafe .steam:nth-child(5) { left: 28px; }
.cafe-hint { font: 500 11px var(--font-mono); color: var(--ink-4); }

/* entrance */
.rise { animation: sz-rise .28s cubic-bezier(.2,.7,.3,1) both; }

/* ---------- ⌘K command palette — real fuzzy actions + records ---------- */
.cmdk-scrim { position: fixed; inset: 0; background: oklch(0 0 0 / .38); z-index: 90; display: none;
  align-items: flex-start; justify-content: center; padding-top: 12vh; }
.cmdk-scrim.show { display: flex; }
.cmdk-panel { width: 560px; max-width: calc(100vw - 40px); background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); overflow: hidden; backdrop-filter: blur(12px); }
.cmdk-inputwrap { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.cmdk-inputwrap .ic { width: 17px; height: 17px; color: var(--ink-3); flex-shrink: 0; }
.cmdk-inputwrap input { flex: 1; border: none; outline: none; background: none; font: 15px var(--font-body); color: var(--ink); }
.cmdk-inputwrap input::placeholder { color: var(--ink-4); }
.cmdk-list { max-height: 360px; overflow-y: auto; padding: 6px; }
.cmdk-row { width: 100%; display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--radius-sm); text-align: left; cursor: pointer; }
.cmdk-row.on { background: var(--hover); }
.cmdk-ic { width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--sunken); color: var(--ink-3); display: grid; place-items: center; flex-shrink: 0; }
.cmdk-ic .ic { width: 15px; height: 15px; }
.cmdk-ic.moon { background: var(--moon-wash); color: var(--moon); }
.cmdk-tx { min-width: 0; display: flex; flex-direction: column; }
.cmdk-tx .l { font-size: 13.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-tx .s { font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-go { margin-left: auto; font: 500 11px var(--font-mono); color: var(--ink-4); flex-shrink: 0; }
.cmdk-empty { padding: 22px; text-align: center; font-size: 13px; color: var(--ink-3); }
.cmdk-foot { display: flex; align-items: center; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--line); font-size: 11px; color: var(--ink-3); }
.cmdk-foot span { display: inline-flex; align-items: center; gap: 4px; }
.cmdk-foot .ic { width: 12px; height: 12px; }
.cmdk-foot .sp { flex: 1; }

/* ---- Ask-Anything (v2 §4.2) — honest fallback + computed-answer view ---- */
.cmdk-fallback { padding: 20px 18px; }
.cmdk-fallback-msg { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--ink-2); line-height: 1.5; margin-bottom: 14px; }
.cmdk-fallback-msg .ic { width: 16px; height: 16px; color: var(--moon); flex-shrink: 0; margin-top: 1px; }
.cmdk-fallback-suggestions { display: flex; flex-direction: column; gap: 6px; }
.cmdk-suggest { text-align: left; background: var(--moon-wash); border: 1px solid var(--moon-line); color: var(--ink); border-radius: var(--radius); padding: 10px 12px; font: 500 13px var(--font-body); cursor: pointer; }
.cmdk-suggest:hover { border-color: var(--moon); }
.cmdk-answer { padding: 16px 18px 18px; }
.cmdk-back { display: inline-flex; align-items: center; gap: 6px; background: none; border: none; color: var(--ink-3); font: 500 12px var(--font-body); cursor: pointer; padding: 0 0 12px; }
.cmdk-back:hover { color: var(--ink); }
.cmdk-back .ic { width: 13px; height: 13px; }
.cmdk-answer-q { font: 650 15px var(--font-display); font-variation-settings: 'wdth' 115; color: var(--ink); margin-bottom: 12px; }
.cmdk-answer-body { display: flex; gap: 10px; align-items: flex-start; background: var(--moon-wash); border: 1px solid var(--moon-line); border-radius: var(--radius); padding: 13px 14px; font-size: 13.5px; line-height: 1.6; color: var(--ink); }
.cmdk-answer-body .ic { width: 16px; height: 16px; color: var(--moon); flex-shrink: 0; margin-top: 2px; }
.cmdk-answer-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.cmdk-chip { display: inline-flex; align-items: center; gap: 5px; font: 500 12px var(--font-body); color: var(--accent-ink); background: var(--accent-weak); border-radius: 999px; padding: 6px 12px; text-decoration: none; }
.cmdk-chip:hover { background: var(--accent-halo); }
.cmdk-chip .go { font-size: 10px; opacity: .7; }
