/* ============================================================================
   OPSMERA — The control room (app)
   A calm, dense, audit-ready operations cockpit. Foundations from
   ../colors_and_type.css. White = primary action; mint = live/resolved status;
   status palette carries ops semantics. No gradients, no electric blue, no cream.
   ============================================================================ */
* { box-sizing: border-box; }
html, body { height: 100%; }
/* On mobile, free html + body to grow with content so the page can actually
   scroll. With both pinned to 100% the .app overflows but the viewport never
   becomes scrollable (real wheel events have no scroll container). */
@media (max-width: 820px) {
  html, body { height: auto !important; min-height: 100dvh; }
}
/* The dashboard drops the monospace face entirely - every label, number and ID
   uses Manrope. Numerics keep tabular alignment so columns still line up. */
body { margin: 0; background: var(--navy-900); color: var(--fg-2); overflow-x: hidden; overflow-y: auto;
  font-family: var(--font-sans);
  --font-mono: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-text-size-adjust: 100%; max-width: 100vw; -webkit-overflow-scrolling: touch; }
img, svg, video, canvas, table { max-width: 100%; }
body { font-variant-numeric: tabular-nums; }
[data-lucide] { width: 17px; height: 17px; stroke-width: 1.75; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--navy-600); border-radius: 6px; border: 3px solid var(--navy-900); }

.app { display: grid; grid-template-columns: 236px 1fr; height: 100vh; overflow: hidden; }

/* ---------- Sidebar ---------- */
.side { background: var(--navy-800); border-right: 1px solid var(--line-1); display: flex; flex-direction: column; height: 100vh; min-height: 0; overflow: hidden; }
.side-logo { display: flex; align-items: center; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--line-1); }
.side-logo img { width: 20px; height: 20px; }
.side-logo b { font-family: var(--font-sans); font-weight: 600; letter-spacing: .3em; font-size: 13px; color: var(--fg-1); }
.side-scroll { flex: 1; overflow: auto; padding: 8px 14px; }
.side-section h6 { font-family: var(--font-sans); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--fg-3); margin: 16px 0 8px; padding: 0 10px; font-weight: 500; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 6px; color: var(--fg-2); font-size: 13.5px; cursor: pointer; transition: all var(--dur); margin-bottom: 1px; }
.nav-item:hover { background: rgba(255,255,255,.04); color: var(--fg-1); }
.nav-item.on { background: rgba(255,255,255,.07); color: var(--fg-1); }
.nav-item [data-lucide] { color: currentColor; opacity: .85; }
.nav-item .count { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); }
.nav-item .count.alert { color: #f0938a; }
.nav-item.ai [data-lucide] { color: var(--mint-500); opacity: 1; }

/* ---------- AI affordances (AiStrip / AiBlock) ---------- */
.ai-strip { display: flex; align-items: flex-start; gap: 11px; padding: 12px 15px;
  background: linear-gradient(180deg, rgba(78,143,232,.20), rgba(78,143,232,.11));
  border-top: 1px solid rgba(78,143,232,.32); box-shadow: inset 3px 0 0 #4E8FE8;
  transition: background var(--dur); }
.ai-strip.dense { padding: 9px 12px; gap: 9px; }
.ai-spark { width: 24px; height: 24px; border-radius: 7px; background: linear-gradient(135deg, #6BA5F5, #3A78D8);
  display: flex; align-items: center; justify-content: center; flex: none; margin-top: 1px;
  box-shadow: 0 2px 9px rgba(58,120,216,.5); }
.ai-spark [data-lucide] { width: 13px; height: 13px; color: #f3f8ff; stroke-width: 2.25; }
.ai-strip-body { flex: 1; min-width: 0; }
.ai-do { font-size: 13px; color: var(--fg-1); line-height: 1.45; font-weight: 500; }
.ai-tag { display: inline-block; font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: #dce9fc; background: rgba(78,143,232,.34); border-radius: 4px; padding: 1px 6px; margin-right: 8px; vertical-align: 1px; }
.ai-basis { font-size: 11.5px; color: #a6bad6; line-height: 1.45; margin-top: 5px; }
.ai-basis-k { color: #8dbcf7; font-weight: 700; margin-right: 6px; }
.ai-act { flex: none; align-self: center; display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-sans); font-weight: 600; font-size: 12px; color: var(--fg-1);
  background: rgba(78,143,232,.14); border: 1px solid rgba(78,143,232,.42); border-radius: 6px;
  padding: 7px 11px; cursor: pointer; transition: all var(--dur); white-space: nowrap; }
.ai-act:hover { border-color: #5B9BF0; background: rgba(78,143,232,.24); }
.ai-act [data-lucide] { width: 13px; height: 13px; }
body.theme-light .ai-act { background: rgba(78,143,232,.08); }

/* historical basis line inside AiBlock / ai-card */
.ai-card-basis { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; padding-top: 12px;
  border-top: 1px solid rgba(78,143,232,.32); font-size: 12px; line-height: 1.5; color: #cdd9ee; }
.ai-card-basis [data-lucide] { width: 14px; height: 14px; color: #8dbcf7; flex: none; margin-top: 2px; }
.ai-card-basis b { color: #eaf1fc; font-weight: 600; }
.ai-card-acts { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* Light theme: darken AI text + icons so they pop on the light-blue panels */
body.theme-light .ai-strip,
body.theme-light .ai-card { background: linear-gradient(180deg, rgba(78,143,232,.13), rgba(78,143,232,.07)); }
body.theme-light .ai-basis-k,
body.theme-light .ai-card .hd,
body.theme-light .ai-card .hd [data-lucide],
body.theme-light .ai-card-basis [data-lucide],
body.theme-light .sugg-basis,
body.theme-light .sugg-basis [data-lucide] { color: #2563c9; }
body.theme-light .ai-tag { color: #1f57b8; background: rgba(78,143,232,.2); }
body.theme-light .ai-basis,
body.theme-light .job-ai-basis { color: #5a6c88; }
body.theme-light .ai-card p,
body.theme-light .ai-card-basis,
body.theme-light .ai-card-basis b { color: var(--fg-1); }
.side-foot { padding: 14px; border-top: 1px solid var(--line-1); }
.side-user { display: flex; align-items: center; gap: 10px; }
.side-user .av { width: 30px; height: 30px; border-radius: 50%; background: var(--navy-600); display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 12px; color: var(--fg-1); }
.side-user .nm { font-size: 13px; color: var(--fg-1); }
.side-user .rl { font-size: 11px; color: var(--fg-3); }

/* ---------- Main / topbar ---------- */
/* Grid items default to min-height:auto (expand-to-content). That defeats
   the .view-host scroll because main grows past .app's 100vh. Force the grid
   track height + min-height:0 so the inner overflow:auto can do its job. */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; overflow: hidden; background: var(--navy-900); }
.topbar { height: 56px; border-bottom: 1px solid var(--line-1); display: flex; align-items: center; gap: 16px; padding: 0 24px; background: var(--navy-800); flex: none; }
.crumb { font-size: 13px; color: var(--fg-3); display: flex; align-items: center; gap: 8px; }
.crumb b { color: var(--fg-1); font-weight: 500; }
.search { margin-left: 8px; flex: 1; max-width: 360px; display: flex; align-items: center; gap: 9px; background: var(--navy-900); border: 1px solid var(--line-1); border-radius: 6px; padding: 7px 12px; }
.search input { flex: 1; background: transparent; border: 0; outline: none; color: var(--fg-1); font-family: var(--font-sans); font-size: 13px; }
.search input::placeholder { color: var(--fg-3); }
.search [data-lucide] { color: var(--fg-3); width: 15px; height: 15px; }
.search kbd { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); border: 1px solid var(--line-1); border-radius: 4px; padding: 1px 5px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.top-pulse { display: flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; color: var(--fg-3); }
.top-pulse .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--mint-500); box-shadow: 0 0 8px rgba(51,212,153,.9); animation: blip 2.4s ease-in-out infinite; }
@keyframes blip { 0%,100%{opacity:1} 50%{opacity:.4} }
.icon-btn { width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--line-1); background: transparent; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--fg-2); transition: all var(--dur); }
.icon-btn:hover { color: var(--fg-1); border-color: var(--line-3); }

/* .view is a plain flex item — overflow lives on the parent (.view-host).
   If we put overflow:auto here too, wheel events get ambiguously captured. */
.view { flex: 1; min-height: 0; }
.wrap { padding: 26px 28px 40px; max-width: 1320px; }

/* ---------- shared bits ---------- */
.h-serif { font-family: var(--font-display); font-weight: 500; color: var(--fg-1); letter-spacing: -.015em; }
.h-serif em { font-style: italic; }
.eyebrow { font-family: var(--font-sans); font-size: 10px; letter-spacing: .26em; text-transform: uppercase; color: var(--fg-3); }
.btn { font-family: var(--font-sans); font-weight: 600; font-size: 13px; cursor: pointer; border-radius: 6px; padding: 9px 16px; border: 1px solid transparent; display: inline-flex; align-items: center; gap: 8px; transition: all var(--dur); white-space: nowrap; }
.btn [data-lucide] { width: 15px; height: 15px; }
.btn-primary { background: #fff; color: var(--on-light-ink); }
.btn-primary:hover { background: rgba(255,255,255,.88); }
.btn-ghost { background: transparent; color: var(--fg-1); border-color: var(--line-1); }
.btn-ghost:hover { border-color: var(--line-3); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }

.chip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.chip .d { width: 6px; height: 6px; border-radius: 50%; }
.chip.resolved { background: var(--tint-resolved); border-color: rgba(51,212,153,.4); color: #7fe9c2; } .chip.resolved .d { background: var(--mint-500); }
.chip.info { background: var(--tint-info); border-color: rgba(91,155,240,.4); color: #9dc2f7; } .chip.info .d { background: var(--status-info); }
.chip.warning { background: var(--tint-warning); border-color: rgba(232,178,62,.4); color: #f0cd82; } .chip.warning .d { background: var(--status-warning); }
.chip.urgent { background: var(--tint-urgent); border-color: rgba(226,87,74,.45); color: #f0938a; } .chip.urgent .d { background: var(--status-urgent); }
.chip.auto { background: var(--tint-violet); border-color: rgba(155,140,240,.4); color: #c3b9f7; } .chip.auto .d { background: var(--status-violet); }
.chip.neutral { background: rgba(255,255,255,.05); border-color: var(--line-1); color: var(--fg-2); } .chip.neutral .d { background: var(--fg-3); }

/* ============================================================================
   LOCKED TAG SYSTEM — three independent dimensions.
   Anything wearing a label in the app uses one of these three classes:
     .tag-track   (RAG: on / risk / breach / done)  — the urgency rail
     .tag-prio    (P1..P4)                          — severity
     .tag-stage   (workflow position)               — neutral, icon-led
   See app/Tags.jsx for the JS contract + canonical dictionaries.
   ============================================================================ */
.tag { display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-sans); font-weight: 600; font-size: 11px; letter-spacing: .02em;
  padding: 3px 9px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; line-height: 1.4; }
.tag [data-lucide] { width: 12px; height: 12px; flex: none; }
.tag-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }

/* SYSTEM 1 — TRACK: RAG. The ONLY place red/amber/green colors appear as
   a chip background. Each track has its own filled tint + colored dot. */
.tag-track.track-on-track { background: var(--track-on-bg);     border-color: var(--track-on-border);     color: var(--track-on-fg); }
.tag-track.track-on-track .tag-dot { background: var(--track-on-dot); box-shadow: 0 0 6px rgba(51,212,153,.55); }
.tag-track.track-at-risk  { background: var(--track-risk-bg);   border-color: var(--track-risk-border);   color: var(--track-risk-fg); }
.tag-track.track-at-risk .tag-dot { background: var(--track-risk-dot); }
.tag-track.track-breached { background: var(--track-breach-bg); border-color: var(--track-breach-border); color: var(--track-breach-fg); }
.tag-track.track-breached .tag-dot { background: var(--track-breach-dot); box-shadow: 0 0 8px rgba(226,87,74,.45); }
.tag-track.track-done     { background: var(--track-done-bg);   border-color: var(--track-done-border);   color: var(--track-done-fg); }
.tag-track.track-done .tag-dot { background: var(--track-done-dot); }

/* SYSTEM 2 — PRIORITY: 4 levels, monochrome. P1 solid, P2 solid (lighter),
   P3 outlined, P4 minimal. Square corners so it's visually distinct from tracks. */
.tag-prio { font-family: var(--font-mono); font-weight: 600; font-size: 10.5px; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 4px; min-width: 26px; justify-content: center; }
.tag-prio.prio-p1 { background: #E2574A; color: #fff; }
.tag-prio.prio-p2 { background: #E8B23E; color: #2a1d04; }
.tag-prio.prio-p3 { background: transparent; border-color: var(--line-3); color: var(--fg-2); }
.tag-prio.prio-p4 { background: transparent; border-color: var(--line-1); color: var(--fg-3); }

/* SYSTEM 3 — STAGE: one neutral pill for EVERY workflow stage. The icon
   carries the meaning, not the color. This is the rule that stops "Quoting"
   and "Dispatching" both screaming amber. */
.tag-stage { background: var(--stage-bg); border-color: var(--stage-border); color: var(--stage-fg); }
.tag-stage [data-lucide] { color: var(--fg-2); opacity: .85; }

/* light theme — track tags retain RAG colors (with darker text), stage tags
   become a muted blue-grey so they recede on a white canvas. */
body.theme-light .tag-track.track-on-track { color: #1b6f4d; border-color: rgba(33,168,120,.5); background: rgba(51,212,153,.16); }
body.theme-light .tag-track.track-at-risk  { color: #8a5d10; border-color: rgba(232,178,62,.6); background: rgba(232,178,62,.18); }
body.theme-light .tag-track.track-breached { color: #a32316; border-color: rgba(226,87,74,.55); background: rgba(226,87,74,.14); }
body.theme-light .tag-track.track-done     { color: rgba(11,37,69,.55); border-color: rgba(11,37,69,.18); background: rgba(11,37,69,.04); }
body.theme-light .tag-stage { background: rgba(11,37,69,.05); border-color: rgba(11,37,69,.16); color: rgba(11,37,69,.78); }
body.theme-light .tag-stage [data-lucide] { color: rgba(11,37,69,.55); }
body.theme-light .tag-prio.prio-p3 { border-color: rgba(11,37,69,.25); color: rgba(11,37,69,.6); }
body.theme-light .tag-prio.prio-p4 { border-color: rgba(11,37,69,.15); color: rgba(11,37,69,.4); }

/* ============================================================================
   STREET VIEW + MAP PIN thumbnails (Google Static APIs, with placeholders)
   See app/StreetView.jsx.
   ============================================================================ */
.bldg-loc { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bldg-loc-thumb { grid-template-columns: 1fr 1fr; max-width: 460px; }

.streetview { position: relative; display: block; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line-1); background: var(--navy-700);
  text-decoration: none; transition: border-color var(--dur), transform var(--dur) var(--ease-out); }
.streetview:hover { border-color: var(--line-3); }
.streetview:hover .sv-chip { background: #fff; color: var(--navy-800); }
.streetview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.streetview.sv-thumb { aspect-ratio: 16/9; }
.streetview.sv-card  { aspect-ratio: 16/9; }
.streetview.sv-pill  { aspect-ratio: 16/9; }
.streetview.sv-lg    { aspect-ratio: 2/1; }

.sv-chip { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px;
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  background: rgba(11,37,69,.72); backdrop-filter: blur(6px);
  color: rgba(255,255,255,.92); transition: background var(--dur), color var(--dur); }
.sv-chip [data-lucide] { width: 13px; height: 13px; stroke-width: 2; }

.sv-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, #0E2B50 0%, #16365E 60%, #1E3A5C 100%); }
.sv-pin { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14); display: flex; align-items: center; justify-content: center; }
.sv-pin [data-lucide] { width: 17px; height: 17px; color: rgba(244,247,251,.85); stroke-width: 1.75; }
.sv-label { font-family: var(--font-sans); font-weight: 500; font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: rgba(244,247,251,.55); }

/* Map pin placeholder — faint road grid behind a big red marker */
.mp-placeholder { background: linear-gradient(135deg, #0E2B50 0%, #1E3A5C 100%); overflow: hidden; }
.mp-grid { position: absolute; inset: 0; width: 100%; height: 100%; stroke: rgba(255,255,255,.06);
  stroke-width: .25; fill: none; pointer-events: none; }
.mp-pin { width: 40px; height: 40px; border-radius: 50%; background: var(--status-urgent);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 4px rgba(226,87,74,.18), 0 8px 24px rgba(0,0,0,.4);
  position: relative; z-index: 1; }
.mp-pin [data-lucide] { width: 22px; height: 22px; color: #fff; stroke-width: 2; }
.mp-placeholder .sv-label { position: relative; z-index: 1; color: rgba(244,247,251,.7); }

/* Light theme */
body.theme-light .streetview { background: #F0F4FA; border-color: rgba(11,37,69,.12); }
body.theme-light .streetview:hover { border-color: rgba(11,37,69,.3); }
body.theme-light .sv-placeholder { background: linear-gradient(135deg, #EAF0F8 0%, #D8E3F2 100%); }
body.theme-light .sv-pin { background: #fff; border-color: rgba(11,37,69,.12); }
body.theme-light .sv-pin [data-lucide] { color: var(--navy-800); }
body.theme-light .sv-label { color: rgba(11,37,69,.55); }
body.theme-light .mp-placeholder { background: linear-gradient(135deg, #EAF0F8 0%, #D6E3F2 100%); }
body.theme-light .mp-grid { stroke: rgba(11,37,69,.1); }
body.theme-light .sv-chip { background: rgba(255,255,255,.85); color: var(--navy-800); }
body.theme-light .streetview:hover .sv-chip { background: var(--navy-800); color: #fff; }

/* ============================================================================
   RESOLVED RECORD — the after-action artefact for a closed ticket.
   See app/ResolvedRecord.jsx.
   ============================================================================ */
.resolved-banner { display: flex; align-items: center; gap: 12px; padding: 12px 18px;
  background: linear-gradient(180deg, rgba(51,212,153,.16), rgba(51,212,153,.08));
  border-bottom: 1px solid rgba(51,212,153,.32); box-shadow: inset 3px 0 0 var(--mint-500); }
.resolved-banner .rb-ic { width: 30px; height: 30px; border-radius: 7px; background: var(--mint-500);
  color: #06251a; display: flex; align-items: center; justify-content: center; flex: none; }
.resolved-banner .rb-ic [data-lucide] { width: 16px; height: 16px; stroke-width: 2.25; }
.resolved-banner .rb-t { font-family: var(--font-display); font-weight: 500; font-size: 16px; color: var(--fg-1); letter-spacing: -.005em; }
.resolved-banner .rb-id { font-family: var(--font-mono); font-weight: 400; font-size: 12px; color: var(--fg-3); margin-left: 4px; }
.resolved-banner .rb-s { font-size: 12px; color: var(--fg-2); margin-top: 2px; line-height: 1.5; }
.resolved-banner .rb-s b { color: var(--fg-1); }
.resolved-banner .sla-ok, .resolved-banner .sla-no { display: inline-flex; align-items: center; gap: 4px; padding: 0 2px; }
.resolved-banner .sla-ok { color: #6FE3B6; }
.resolved-banner .sla-no { color: #F0938A; }
.resolved-banner .sla-ok [data-lucide], .resolved-banner .sla-no [data-lucide] { width: 13px; height: 13px; }

/* Before / after photo strip */
.ba { display: flex; flex-direction: column; gap: 10px; }
.ba-grid { display: grid; grid-template-columns: 1fr 22px 1fr; gap: 10px; align-items: center; }
.ba-arrow { display: flex; align-items: center; justify-content: center; color: var(--fg-3); }
.ba-arrow [data-lucide] { width: 18px; height: 18px; }
.photo { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.photo-tile { position: relative; aspect-ratio: 4/3; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line-1); display: flex; align-items: center; justify-content: center;
  background: var(--navy-700); }
.photo-tile::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(135deg, rgba(255,255,255,.012) 0 8px, transparent 8px 16px); }
.photo-icon { width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14); display: flex; align-items: center; justify-content: center; z-index: 1; }
.photo-icon [data-lucide] { width: 22px; height: 22px; color: rgba(244,247,251,.85); }
.photo-side { position: absolute; top: 8px; left: 8px; font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: .18em; padding: 2px 6px; border-radius: 4px; background: rgba(11,37,69,.8);
  color: rgba(244,247,251,.85); z-index: 1; }
.photo-cap { font-size: 12px; color: var(--fg-2); line-height: 1.45; }
.tile-breach .photo-tile { background: linear-gradient(135deg, #2a1115 0%, #4a1a1f 100%); border-color: rgba(226,87,74,.4); }
.tile-breach .photo-side { background: rgba(226,87,74,.85); color: #fff; }
.tile-risk .photo-tile   { background: linear-gradient(135deg, #2a210b 0%, #4a3a14 100%); border-color: rgba(232,178,62,.4); }
.tile-risk .photo-side   { background: rgba(232,178,62,.85); color: #2a1d04; }
.tile-ok .photo-tile     { background: linear-gradient(135deg, #0d2a22 0%, #154a3a 100%); border-color: rgba(51,212,153,.4); }
.tile-ok .photo-side     { background: rgba(51,212,153,.9); color: #06251a; }

/* shared block header */
.blk-h { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.blk-h h4 { margin: 0; }
.blk-hint { font-size: 11px; color: var(--fg-3); }
.work-summary { font-size: 13.5px; line-height: 1.55; color: var(--fg-1); margin: 0; }

/* Linked invoice mini-card */
.invoice-link { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--line-1); border-radius: 8px; padding: 12px 14px; background: var(--navy-700); }
.invoice-link .il-l { display: flex; align-items: center; gap: 10px; }
.invoice-link .il-ic { width: 32px; height: 32px; border-radius: 7px; background: rgba(255,255,255,.06);
  border: 1px solid var(--line-1); display: flex; align-items: center; justify-content: center; flex: none; }
.invoice-link .il-ic [data-lucide] { width: 17px; height: 17px; color: var(--fg-1); }
.invoice-link .il-h { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--fg-1); font-weight: 500; }
.invoice-link .il-m { font-family: var(--font-mono); font-size: 12px; color: var(--fg-3); margin-top: 2px; }

/* Compliance impact card */
.compliance-impact { display: flex; align-items: center; gap: 11px; padding: 12px 14px;
  background: linear-gradient(180deg, rgba(51,212,153,.10), rgba(51,212,153,.04));
  border: 1px solid rgba(51,212,153,.32); border-radius: 8px; box-shadow: inset 3px 0 0 var(--mint-500); }
.compliance-impact .ci-ic { width: 28px; height: 28px; border-radius: 7px; background: var(--mint-500);
  color: #06251a; display: flex; align-items: center; justify-content: center; flex: none; }
.compliance-impact .ci-ic [data-lucide] { width: 15px; height: 15px; stroke-width: 2.25; }
.compliance-impact .ci-h { font-size: 13px; font-weight: 600; color: var(--fg-1); }
.compliance-impact .ci-m { font-size: 12px; color: var(--fg-2); margin-top: 2px; }

/* Audit log */
.audit { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.audit li { display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; padding: 9px 0;
  border-bottom: 1px solid var(--line-2); align-items: center; }
.audit li:last-child { border-bottom: 0; }
.audit .au-ic { width: 22px; height: 22px; border-radius: 50%; background: rgba(255,255,255,.04);
  border: 1px solid var(--line-1); display: flex; align-items: center; justify-content: center; color: var(--fg-2); }
.audit .au-ic [data-lucide] { width: 12px; height: 12px; }
.audit .au-tx { font-size: 13px; color: var(--fg-1); }
.audit .au-when { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); white-space: nowrap; }

/* Evidence pack */
.evidence { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
@media (max-width: 760px) { .evidence { grid-template-columns: 1fr; } }
.evidence li { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--fg-1);
  padding: 7px 10px; background: rgba(255,255,255,.03); border: 1px solid var(--line-1); border-radius: 6px; }
.evidence .ev-ic { color: var(--fg-3); display: flex; }
.evidence .ev-ic [data-lucide] { width: 13px; height: 13px; }

/* Resolved actions row */
.resolved-actions { background: var(--navy-800); }

/* Share sheet */
.share-sheet { position: fixed; inset: 0; background: rgba(6,12,20,.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.share-card { width: 100%; max-width: 480px; background: var(--navy-800); border: 1px solid var(--line-1);
  border-radius: 12px; box-shadow: 0 24px 60px rgba(0,0,0,.45); padding: 20px 22px; }
.share-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.share-h h4 { margin: 0; }
.share-blurb { font-size: 12.5px; color: var(--fg-3); margin-bottom: 14px; line-height: 1.5; }
.share-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.share-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 12px; border: 1px solid var(--line-1); border-radius: 7px; background: rgba(255,255,255,.02); }
.share-list li span { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; color: var(--fg-1); }
.share-list li [data-lucide] { width: 13px; height: 13px; color: var(--fg-3); }
.share-foot { display: flex; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line-2); }

/* intake empty */
.intake-empty { padding: 32px 20px; text-align: center; color: var(--fg-3); }
.intake-empty [data-lucide] { width: 28px; height: 28px; margin-bottom: 10px; color: var(--mint-500); }
.intake-empty h4 { font-family: var(--font-display); font-weight: 500; font-size: 17px; color: var(--fg-1); margin: 0 0 4px; }
.intake-empty p { margin: 0; font-size: 12.5px; }

/* segmented filter count */
.seg-count { display: inline-block; min-width: 16px; height: 16px; padding: 0 4px; margin-left: 6px;
  border-radius: 8px; background: rgba(255,255,255,.08); font-family: var(--font-mono); font-size: 10px;
  line-height: 16px; text-align: center; color: var(--fg-2); }
.seg button.on .seg-count { background: rgba(11,37,69,.18); color: var(--navy-800); }

/* light theme */
body.theme-light .resolved-banner { background: linear-gradient(180deg, rgba(51,212,153,.16), rgba(51,212,153,.08)); border-bottom-color: rgba(33,168,120,.4); }
body.theme-light .resolved-banner .rb-s { color: rgba(11,37,69,.7); }
body.theme-light .resolved-banner .sla-ok { color: #0d8a5e; }
body.theme-light .photo-tile { border-color: rgba(11,37,69,.12); }
body.theme-light .tile-breach .photo-tile { background: linear-gradient(135deg, #FDECEA 0%, #FAD1CC 100%); border-color: rgba(226,87,74,.4); }
body.theme-light .tile-risk .photo-tile   { background: linear-gradient(135deg, #FEF3D6 0%, #FCDF96 100%); }
body.theme-light .tile-ok .photo-tile     { background: linear-gradient(135deg, #DCFBE9 0%, #A8EBC8 100%); }
body.theme-light .photo-icon { background: #fff; border-color: rgba(11,37,69,.1); }
body.theme-light .photo-icon [data-lucide] { color: var(--navy-800); }
body.theme-light .invoice-link, body.theme-light .audit .au-ic, body.theme-light .evidence li, body.theme-light .share-list li { background: #fff; border-color: rgba(11,37,69,.1); }
body.theme-light .compliance-impact { background: linear-gradient(180deg, rgba(51,212,153,.13), rgba(51,212,153,.05)); border-color: rgba(33,168,120,.4); }
body.theme-light .compliance-impact .ci-m { color: rgba(11,37,69,.7); }
body.theme-light .share-card { background: #fff; }
body.theme-light .audit .au-when { color: rgba(11,37,69,.55); }

/* PRINT — collapse chrome to a 1-page A4 audit-ready artefact.
   Trigger this layout in two ways:
     1. Real print (browser print dialog → @media print)
     2. The "Export PDF" button which adds body.print-mode for a deliberate
        on-screen preview then launches the print dialog.
   Layout rules:
     • A4 portrait, 14mm margins
     • Black on white, brand mint kept for status accents
     • Hide every nav, drawer, toolbar, persona pill, bottom nav, toolbars
     • Header band: logo + ticket id + closed date + exported timestamp
     • Footer: SHA-256-style audit reference + page n/total (browser-rendered)
     • Page-break-inside: avoid on the major content blocks
*/
@page { size: A4 portrait; margin: 14mm; }

@media print, .print-mode {
  /* nothing — empty target keeps the next rule alone */
}
body.print-mode { background: #fff !important; }

@media print {
  html, body { background: #fff !important; color: #0B2545 !important;
    -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;
    font-family: 'Manrope', -apple-system, system-ui, sans-serif !important; }
  /* Hide every piece of chrome / navigation / action bar */
  .side, .sidebar, .topbar, .m-header, .bottom-nav, .mobile-header,
  .tabbar-mobile, .det-actions, .resolved-actions, .inv-actions,
  .share-sheet, .toast-host, .modal-scrim, .modal,
  .split-list, .detail-back, .nav-pill, .persona-pill,
  .scrim, .side-scrim, .field-card,
  .app > .topbar, body > div[class*="toast"] { display: none !important; }
  /* Free the layout */
  .app, .main, .view, .view-host, .split, .split-detail, .resolved-record, .detail {
    display: block !important; height: auto !important; min-height: 0 !important;
    overflow: visible !important; background: #fff !important; color: #0B2545 !important;
    padding: 0 !important; margin: 0 !important; box-shadow: none !important; border: 0 !important; }
  /* Header band - injected via ::before on the resolved record root */
  .resolved-record::before {
    content: 'OPSMERA  ·  Audit-ready resolved record';
    display: block; font-family: 'Manrope', sans-serif; font-size: 10pt; font-weight: 600;
    letter-spacing: .14em; color: #0B2545; padding-bottom: 10pt; margin-bottom: 14pt;
    border-bottom: 1.5pt solid #0B2545;
  }
  /* Banner */
  .resolved-banner { background: #ECFBF3 !important; color: #06251a !important;
    border: 1pt solid #33D499 !important; border-radius: 6pt !important;
    padding: 10pt 12pt !important; margin-bottom: 14pt !important; box-shadow: none !important; }
  .resolved-banner *, .compliance-impact * { color: #06251a !important; }
  /* Headings */
  h1, h2, h3, h4, .h-serif { color: #0B2545 !important; }
  h1 { font-size: 20pt !important; line-height: 1.2 !important; margin: 6pt 0 8pt !important; }
  h2 { font-size: 16pt !important; margin: 4pt 0 6pt !important; }
  h3 { font-size: 12pt !important; margin: 10pt 0 4pt !important; }
  h4 { font-size: 11pt !important; margin: 8pt 0 4pt !important; }
  p, li, td, .sub, .work-summary, .story-row p { font-size: 10.5pt !important; line-height: 1.5 !important; color: #0B2545 !important; }
  /* Cards, blocks, story rows */
  .card, .blk, .story, .invoice-link, .compliance-impact, .audit, .evidence, .ba {
    background: #FFFFFF !important; border: 1pt solid #C8D3DF !important; border-radius: 6pt !important;
    padding: 10pt 12pt !important; box-shadow: none !important; margin-bottom: 10pt !important;
    page-break-inside: avoid !important; }
  /* Before / after tiles */
  .ba-grid { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 10pt !important; page-break-inside: avoid !important; }
  .photo-tile { background: #F4F7FB !important; border: 1pt solid #C8D3DF !important;
    aspect-ratio: 4/3 !important; border-radius: 4pt !important; }
  .tile-breach .photo-tile { background: #FDECEA !important; border-color: #E2574A !important; }
  .tile-risk   .photo-tile { background: #FEF3D6 !important; border-color: #E8B23E !important; }
  .tile-ok     .photo-tile { background: #DCFBE9 !important; border-color: #33D499 !important; }
  .photo-cap   { color: #0B2545 !important; font-size: 9.5pt !important; }
  /* Audit log */
  .audit { padding: 6pt 10pt !important; }
  .audit li { display: flex !important; align-items: baseline !important; gap: 8pt !important;
    border-bottom: .5pt solid #E5ECF3 !important; padding: 4pt 0 !important; font-size: 9.5pt !important; }
  .audit li:last-child { border-bottom: 0 !important; }
  /* Evidence */
  .evidence { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 4pt 14pt !important; }
  .evidence li { background: transparent !important; border: 0 !important; padding: 2pt 0 !important; font-size: 9.5pt !important; }
  /* Hide interactive sparkles + chevrons in print */
  .dl-chev, .dl-bar, .icon-btn, .ai-spark, .more, .exp-all,
  [data-lucide="chevron-down"], [data-lucide="chevron-up"] { display: none !important; }
  /* Page-break rules */
  .ba, .blk, .story, .invoice-link, .compliance-impact, .audit, .evidence { page-break-inside: avoid; }
  h1, h2, h3, h4 { page-break-after: avoid; }
  /* Footer line on every page */
  .resolved-record::after {
    content: 'This document is a verbatim render of audit-trail rows. Generated by Opsmera AI.';
    display: block; margin-top: 14pt; padding-top: 8pt; border-top: .5pt solid #C8D3DF;
    font-family: 'Manrope', sans-serif; font-size: 8.5pt; color: #6B7280 !important;
    letter-spacing: .04em;
  }
}

/* On-screen "print preview" mode triggered by Export PDF button before the print
   dialog opens — same look but visible so the user sees what they're about to save. */
body.print-export .app > *:not(.main),
body.print-export .topbar, body.print-export .m-header, body.print-export .bottom-nav,
body.print-export .side, body.print-export .det-actions, body.print-export .resolved-actions { display: none !important; }

.card { border: 1px solid var(--line-1); border-radius: 9px; background: var(--navy-800); }
.card-h { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line-1); }
.card-h h3 { font-family: var(--font-display); font-weight: 500; font-size: 17px; color: var(--fg-1); margin: 0; }
.card-h .more { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.card-h .more:hover { color: var(--fg-1); }

/* ---------- DASHBOARD ---------- */
.dash-hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line-1); padding: 30px 28px 26px; }
.dash-hero .globe { position: absolute; inset: 0; width: 100%; height: 100%; -webkit-mask-image: radial-gradient(46% 120% at 88% 40%, #000 30%, transparent 75%); mask-image: radial-gradient(46% 120% at 88% 40%, #000 30%, transparent 75%); }
.dash-hero .z { position: relative; z-index: 2; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.dash-hero h1 { font-family: var(--font-display); font-weight: 500; font-size: 32px; color: var(--fg-1); margin: 12px 0 0; letter-spacing: -.02em; }
.dash-hero h1 em { font-style: italic; }
.dash-hero .sub { font-size: 13.5px; color: var(--fg-2); margin-top: 8px; }
.hero-pulse { display: flex; gap: 1px; background: var(--line-1); border: 1px solid var(--line-1); border-radius: 8px; overflow: hidden; flex: none; }
.hero-pulse .cell { background: rgba(11,37,69,.7); backdrop-filter: blur(6px); padding: 14px 20px; min-width: 116px; }
.hero-pulse .n { font-family: var(--font-mono); font-weight: 500; font-size: 22px; color: var(--fg-1); font-variant-numeric: tabular-nums; }
.hero-pulse .l { font-size: 10.5px; color: var(--fg-3); margin-top: 5px; text-transform: uppercase; letter-spacing: .08em; }
.hero-pulse .n.alert { color: #f0938a; }

.dash-board-strip { padding: 22px 28px 0; }
.dash-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; padding: 22px 28px 40px; align-items: start; }
@media (max-width: 1180px){ .dash-grid { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 18px; }

/* deadline spine (the wedge) */
.deadline-wrap { border-bottom: 1px solid var(--line-1); }
.deadline-wrap:last-child { border-bottom: 0; }
.deadline { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; padding: 13px 18px; cursor: pointer; transition: background var(--dur); }
.deadline:hover { background: rgba(255,255,255,.02); }
.dl-days { text-align: center; }
.dl-days .num { font-family: var(--font-mono); font-weight: 600; font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; }
.dl-days .lab { font-size: 9px; text-transform: uppercase; letter-spacing: .1em; color: var(--fg-3); margin-top: 4px; }
.dl-days.urgent .num { color: #e2574a; } .dl-days.warning .num { color: #e8b23e; } .dl-days.ok .num { color: var(--fg-1); }
.dl-main .t { font-size: 13.5px; color: var(--fg-1); }
.dl-main .m { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); margin-top: 3px; }
.dl-bar { width: 90px; height: 4px; border-radius: 999px; background: var(--navy-600); overflow: hidden; }
.dl-bar i { display: block; height: 100%; border-radius: 999px; }

/* accordion chevron on each deadline row */
.dl-chev { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--line-1); background: transparent;
  display: flex; align-items: center; justify-content: center; color: var(--fg-3); cursor: pointer; flex: none;
  transition: transform var(--dur) var(--ease-out), border-color var(--dur), color var(--dur); }
.dl-chev [data-lucide] { width: 15px; height: 15px; }
.dl-chev:hover { border-color: var(--line-3); color: var(--fg-1); }
.dl-chev.open { transform: rotate(180deg); border-color: rgba(78,143,232,.55); color: #5B9BF0; }

/* collapsible AI strip — conditionally rendered; subtle drop on mount.
   NB: animate transform only (no opacity / no fill-mode) so the strip stays
   visible even where the engine freezes CSS animations at frame 0. */
.dl-acc { overflow: hidden; animation: accDrop .24s var(--ease-out); }
@keyframes accDrop {
  from { transform: translateY(-8px); }
  to { transform: none; }
}
@media (prefers-reduced-motion: reduce) { .dl-acc { animation: none; } }

/* expand-all toggle in the card header */
.exp-all { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-sans); font-weight: 600;
  font-size: 11.5px; color: var(--fg-2); background: transparent; border: 1px solid var(--line-1); border-radius: 6px;
  padding: 5px 10px; cursor: pointer; transition: all var(--dur); white-space: nowrap; }
.exp-all [data-lucide] { width: 14px; height: 14px; }
.exp-all:hover { border-color: var(--line-3); color: var(--fg-1); }

/* intake mini rows */
.mini-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line-1); cursor: pointer; transition: background var(--dur); }
.mini-row:last-child { border-bottom: 0; }
.mini-row:hover { background: rgba(255,255,255,.02); }
.chan { width: 28px; height: 28px; border-radius: 7px; background: var(--navy-700); border: 1px solid var(--line-1); display: flex; align-items: center; justify-content: center; color: var(--fg-2); flex: none; }
.chan [data-lucide] { width: 14px; height: 14px; }
.mini-row .tx { flex: 1; min-width: 0; }
.mini-row .tx .s { font-size: 13px; color: var(--fg-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-row .tx .b { font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-3); margin-top: 2px; }
.mini-row .tm { font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-3); white-space: nowrap; }

/* field-capture promo card */
.field-card { padding: 20px; display: flex; gap: 16px; align-items: center; }
.field-card .ph { width: 52px; height: 52px; border-radius: 12px; background: var(--mint-500); display: flex; align-items: center; justify-content: center; color: #06251a; flex: none; }
.field-card .ph [data-lucide] { width: 24px; height: 24px; stroke-width: 2; }
.field-card h4 { font-family: var(--font-display); font-weight: 500; font-size: 17px; color: var(--fg-1); margin: 0 0 4px; }
.field-card p { font-size: 12.5px; color: var(--fg-2); margin: 0; line-height: 1.45; }

/* ---------- TABLES (compliance) ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.seg { display: inline-flex; gap: 2px; background: var(--navy-800); border: 1px solid var(--line-1); border-radius: 7px; padding: 2px; }
.seg button { font-family: var(--font-sans); font-size: 12px; font-weight: 500; padding: 6px 13px; border-radius: 5px; background: transparent; color: var(--fg-3); border: 0; cursor: pointer; transition: all var(--dur); }
.seg button.on { background: #fff; color: var(--on-light-ink); }
.tbl { width: 100%; border-collapse: collapse; }
.tbl thead th { text-align: left; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3); font-weight: 500; padding: 11px 16px; border-bottom: 1px solid var(--line-1); }
.tbl tbody td { padding: 14px 16px; border-bottom: 1px solid var(--line-1); font-size: 13px; color: var(--fg-2); }
.tbl tbody tr { cursor: pointer; transition: background var(--dur); }
.tbl tbody tr:hover { background: rgba(255,255,255,.02); }
.tbl .asset { color: var(--fg-1); font-weight: 500; }
.tbl .mono { font-family: var(--font-mono); font-size: 12px; color: var(--fg-3); }
.tbl .exposure { font-family: var(--font-mono); color: #f0cd82; }

/* ---------- INTAKE (two-pane) ---------- */
.split { display: grid; grid-template-columns: 1.1fr 1fr; height: 100%; }
.split-list { border-right: 1px solid var(--line-1); overflow: auto; }
.in-toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line-1); position: sticky; top: 0; background: var(--navy-900); z-index: 2; }
.in-row { display: grid; grid-template-columns: auto 1fr auto; gap: 13px; padding: 15px 20px; border-bottom: 1px solid var(--line-1); cursor: pointer; transition: background var(--dur); align-items: start; }
.in-row:hover { background: rgba(255,255,255,.02); }
.in-row.sel { background: rgba(255,255,255,.045); box-shadow: inset 2px 0 0 #fff; }
.in-row .left { display: flex; flex-direction: column; align-items: center; gap: 7px; padding-top: 1px; }
.in-row .prio { font-family: var(--font-mono); font-size: 10px; font-weight: 500; padding: 2px 6px; border-radius: 4px; }
.prio.p1 { background: var(--tint-urgent); color: #f0938a; } .prio.p2 { background: var(--tint-warning); color: #f0cd82; } .prio.p3 { background: rgba(255,255,255,.06); color: var(--fg-2); }
.in-row .bldg { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); margin-bottom: 4px; }
.in-row .summ { font-size: 13.5px; color: var(--fg-1); line-height: 1.4; }
.in-row .meta { display: flex; align-items: center; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.in-row .ai { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 10.5px; color: var(--status-violet); }
.in-row .rt { display: flex; flex-direction: column; align-items: flex-end; gap: 9px; }
.in-row .rt .tm { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); }
.detail { overflow: auto; display: flex; flex-direction: column; }
.det-head { padding: 22px 24px 18px; border-bottom: 1px solid var(--line-1); }
.det-head .bldg { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); }
.det-head h2 { font-family: var(--font-display); font-weight: 500; font-size: 21px; color: var(--fg-1); margin: 10px 0 14px; line-height: 1.2; }
.det-head .site-line { display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin: 0 0 14px;
  background: var(--navy-800); border: 1px solid var(--line-1); border-radius: 7px;
  font-size: 13px; color: var(--fg-1); flex-wrap: wrap; }
.det-head .site-line [data-lucide] { width: 14px; height: 14px; color: var(--mint-500); flex: none; }
.det-head .site-line .sep { color: var(--fg-3); opacity: .6; }
.det-head .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.det-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 22px; }
/* ===== Thread story card (per-ticket ELI5 summary) =====
   Three rows on a vertical timeline rail: How it started -> What's happened
   since -> What we need to do next (+ due date). Designed for any stakeholder
   to grok a ticket in 10 seconds; sits ABOVE the AI triage card. */
.story { border: 1px solid var(--line-1); border-radius: 8px; padding: 18px 20px 14px;
  background: var(--navy-700); position: relative; }
body.theme-light .story { background: #FAFBFD; }
.story-h { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.story-ic { width: 30px; height: 30px; border-radius: 7px; background: rgba(255,255,255,.06);
  border: 1px solid var(--line-1); display: flex; align-items: center; justify-content: center; flex: none; }
.story-ic [data-lucide] { width: 16px; height: 16px; color: var(--fg-1); stroke-width: 1.75; }
body.theme-light .story-ic { background: #fff; }
.story-t { font-family: var(--font-display); font-weight: 500; font-size: 17px; color: var(--fg-1); letter-spacing: -.005em; }
.story-s { font-size: 12px; color: var(--fg-3); margin-top: 2px; }
.story-by { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-sans);
  font-weight: 600; font-size: 11.5px; padding: 5px 10px; border-radius: 999px;
  background: rgba(255,255,255,.06); border: 1px solid var(--line-1); color: var(--fg-1); white-space: nowrap; }
.story-by [data-lucide] { width: 13px; height: 13px; }
.story-by.warn { background: var(--tint-warning); border-color: rgba(232,178,62,.4); color: #f0cd82; }
.story-by.urgent { background: var(--tint-urgent); border-color: rgba(226,87,74,.45); color: #f0938a; }
body.theme-light .story-by { background: #fff; }

/* timeline rail through the three dots */
.story-rows { list-style: none; margin: 0; padding: 0; position: relative; }
.story-rows::before { content: ''; position: absolute; left: 7px; top: 10px; bottom: 10px;
  width: 1px; background: linear-gradient(180deg, var(--line-3), var(--line-1)); }
.story-row { display: grid; grid-template-columns: 16px 1fr; gap: 14px; padding: 8px 0; position: relative; }
.story-row .dot { width: 11px; height: 11px; border-radius: 50%; margin-left: 2px; margin-top: 6px;
  border: 2px solid var(--navy-700); box-shadow: 0 0 0 1px var(--line-3); background: var(--fg-3); flex: none; }
body.theme-light .story-row .dot { border-color: #FAFBFD; }
.story-row.started .dot { background: var(--fg-2); }
.story-row.sofar .dot { background: #5B9BF0; box-shadow: 0 0 0 1px rgba(91,155,240,.6); }
.story-row.next .dot { background: var(--mint-500); box-shadow: 0 0 0 1px rgba(51,212,153,.6); }
.story-row.next.done .dot { background: var(--fg-3); box-shadow: 0 0 0 1px var(--line-1); }
.story-row .k { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--fg-3); margin-bottom: 4px; font-weight: 500; }
.story-row p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--fg-1); }
body.theme-light .story-row p { color: #1F2937; }
.story-row.next p { font-weight: 500; }
.ai-card .hd { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: #8dbcf7; margin-bottom: 10px; }
.ai-card .hd [data-lucide] { color: #5B9BF0; }
.ai-card p { margin: 0; font-size: 13.5px; line-height: 1.55; color: #e8effb; }
.blk h4 { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-3); margin: 0 0 12px; }
.flow-step { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.flow-step:last-child { border-bottom: 0; }
.flow-step .ic { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; border: 1px solid var(--line-1); color: var(--fg-3); }
.flow-step.done .ic { background: var(--tint-resolved); border-color: transparent; color: #7fe9c2; }
.flow-step.active .ic { background: #fff; border-color: transparent; color: var(--navy-800); }
.flow-step .tx { font-size: 13px; color: var(--fg-1); }
.flow-step .tx small { display: block; color: var(--fg-3); font-size: 11.5px; margin-top: 2px; }
.det-actions { margin-top: auto; padding: 16px 24px; border-top: 1px solid var(--line-1); display: flex; gap: 10px; position: sticky; bottom: 0; background: var(--navy-900); }

/* ---------- JOB BOARD ---------- */
.board { display: flex; gap: 14px; padding: 22px 24px 30px; overflow-x: auto; height: 100%; align-items: flex-start; }
.col { flex: none; width: 268px; }
.col-h { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 12px; }
.col-h .nm { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-2); display: flex; align-items: center; gap: 8px; }
.col-h .nm .dot { width: 7px; height: 7px; border-radius: 50%; }
.col-h .ct { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); }
.col-body { display: flex; flex-direction: column; gap: 10px; }
.job { border: 1px solid var(--line-1); border-radius: 8px; background: var(--navy-800); padding: 13px 14px; cursor: pointer; transition: all var(--dur); }
.job:hover { border-color: var(--line-3); transform: translateY(-2px); }
.job .jt { font-size: 13px; color: var(--fg-1); line-height: 1.4; }
.job .jb { font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-3); margin-top: 7px; }
.job .jf { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; }
.job .ven { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--fg-2); }
.job .ven .av { width: 18px; height: 18px; border-radius: 50%; background: var(--navy-600); font-family: var(--font-mono); font-size: 9px; color: var(--fg-1); display: flex; align-items: center; justify-content: center; }
.job .amt { font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-1); }
.job.flag { box-shadow: inset 3px 0 0 #e2574a; }
.job .stall { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 10px; color: #f0938a; margin-top: 8px; }
.job-ai { display: flex; gap: 8px; margin-top: 11px; padding-top: 11px; border-top: 1px solid rgba(78,143,232,.32); }
.job-ai .ai-spark { width: 18px; height: 18px; border-radius: 5px; }
.job-ai .ai-spark [data-lucide] { width: 11px; height: 11px; }
.job-ai-do { font-size: 11.5px; color: var(--fg-1); line-height: 1.4; font-weight: 500; }
.job-ai-basis { font-size: 10.5px; color: #93a8c6; line-height: 1.4; margin-top: 4px; }

/* ---------- BUILDING DRAWER ---------- */
.scrim { position: fixed; inset: 0; background: rgba(4,12,22,.6); backdrop-filter: blur(2px); z-index: 40; opacity: 0; pointer-events: none; transition: opacity var(--dur); }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: 540px; max-width: 94vw; background: var(--navy-800); border-left: 1px solid var(--line-1); z-index: 41; transform: translateX(100%); transition: transform var(--dur-slow) var(--ease-out); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.drawer.open { transform: none; }
.drawer-h { padding: 22px 24px; border-bottom: 1px solid var(--line-1); }
.drawer-h .top { display: flex; align-items: center; justify-content: space-between; }
.drawer-h .addr { font-family: var(--font-mono); font-size: 12px; color: var(--fg-3); margin-top: 6px; }
.drawer-h h2 { font-family: var(--font-display); font-weight: 500; font-size: 24px; color: var(--fg-1); margin: 14px 0 0; letter-spacing: -.01em; }
.drawer-body { overflow: auto; padding: 22px 24px; display: flex; flex-direction: column; gap: 24px; }
.kpis { display: grid; grid-template-columns: repeat(3,1fr); gap: 1px; background: var(--line-1); border: 1px solid var(--line-1); border-radius: 8px; overflow: hidden; }
.kpis .k { background: var(--navy-800); padding: 16px; }
.kpis .k .n { font-family: var(--font-mono); font-weight: 500; font-size: 22px; color: var(--fg-1); }
.kpis .k .l { font-size: 10.5px; color: var(--fg-3); margin-top: 5px; text-transform: uppercase; letter-spacing: .08em; }
.tl { display: flex; flex-direction: column; }
.tl-item { display: grid; grid-template-columns: 16px 1fr; gap: 14px; }
.tl-item .rail { display: flex; flex-direction: column; align-items: center; }
.tl-item .dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--navy-600); background: var(--navy-800); margin-top: 4px; }
.tl-item .dot.mint { background: var(--mint-500); border-color: var(--mint-500); }
.tl-item .line { width: 2px; flex: 1; background: var(--line-1); margin: 4px 0; }
.tl-item .c { padding-bottom: 18px; }
.tl-item .c .t { font-size: 13px; color: var(--fg-1); }
.tl-item .c .m { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); margin-top: 3px; }
.drawer-foot { margin-top: auto; padding: 16px 24px; border-top: 1px solid var(--line-1); display: flex; gap: 10px; }

/* ---------- FIELD APP (mobile, voice-first) ---------- */
.field-stage { height: 100%; display: flex; align-items: center; justify-content: center; gap: 60px; padding: 30px; position: relative; overflow: auto; }
.field-stage .globe { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .5; -webkit-mask-image: radial-gradient(40% 60% at 20% 50%, #000, transparent 70%); mask-image: radial-gradient(40% 60% at 20% 50%, #000, transparent 70%); }
.field-copy { position: relative; z-index: 2; max-width: 320px; }
.field-copy h1 { font-family: var(--font-display); font-weight: 500; font-size: 34px; color: var(--fg-1); margin: 16px 0 0; letter-spacing: -.02em; line-height: 1.1; }
.field-copy h1 em { font-style: italic; }
.field-copy p { font-size: 14px; color: var(--fg-2); line-height: 1.6; margin: 16px 0 0; }
.field-copy .steps { margin-top: 22px; display: flex; flex-direction: column; gap: 12px; }
.field-copy .st { display: flex; gap: 11px; align-items: flex-start; font-size: 13px; color: var(--fg-2); }
.field-copy .st .n { font-family: var(--font-mono); font-size: 11px; color: var(--mint-500); border: 1px solid rgba(51,212,153,.4); border-radius: 4px; padding: 1px 6px; flex: none; }

.phone { position: relative; z-index: 2; width: 300px; height: 624px; background: #060f18; border-radius: 42px; padding: 11px; box-shadow: 0 40px 90px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.06); flex: none; }
.phone .screen { width: 100%; height: 100%; border-radius: 32px; overflow: hidden; background: var(--navy-800); position: relative; display: flex; flex-direction: column; }
.phone .notch { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 120px; height: 26px; background: #060f18; border-radius: 0 0 16px 16px; z-index: 5; }
.fa-top { padding: 30px 18px 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line-1); }
.fa-top .b { font-family: var(--font-sans); font-weight: 600; letter-spacing: .22em; font-size: 11px; color: var(--fg-1); display: flex; align-items: center; gap: 7px; }
.fa-top .b img { width: 15px; height: 15px; }
.fa-top .loc { font-family: var(--font-mono); font-size: 9.5px; color: var(--fg-3); }
.fa-body { flex: 1; padding: 18px; overflow: auto; }
.fa-body .lab { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-3); }
.fa-body h2 { font-family: var(--font-display); font-weight: 500; font-size: 21px; color: var(--fg-1); margin: 8px 0 0; line-height: 1.25; }
.fa-transcript { margin-top: 16px; border: 1px solid var(--line-1); border-radius: 10px; padding: 14px; font-size: 13px; color: var(--fg-1); line-height: 1.55; background: var(--navy-900); }
.fa-transcript .live { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--mint-500); margin-bottom: 9px; }
.fa-transcript .live .d { width: 6px; height: 6px; border-radius: 50%; background: var(--mint-500); animation: blip 1.4s ease-in-out infinite; }
.fa-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.fa-photo { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fa-photo .ph { aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--line-1); background: linear-gradient(135deg, #15324f, #0c2138); display: flex; align-items: center; justify-content: center; color: var(--fg-3); }
.fa-photo .ph.add { border-style: dashed; }
.fa-photo .ph [data-lucide] { width: 18px; height: 18px; }
.fa-foot { padding: 16px 18px 22px; border-top: 1px solid var(--line-1); display: flex; align-items: center; gap: 14px; }
.mic { width: 56px; height: 56px; border-radius: 50%; background: var(--mint-500); display: flex; align-items: center; justify-content: center; color: #06251a; flex: none; cursor: pointer; box-shadow: 0 0 0 0 rgba(51,212,153,.5); animation: mic 2s ease-out infinite; }
.mic [data-lucide] { width: 24px; height: 24px; stroke-width: 2; }
@keyframes mic { 0%{box-shadow:0 0 0 0 rgba(51,212,153,.45)} 70%{box-shadow:0 0 0 16px rgba(51,212,153,0)} 100%{box-shadow:0 0 0 0 rgba(51,212,153,0)} }
.fa-foot .save { flex: 1; }
.fa-foot .save .btn { width: 100%; justify-content: center; }

/* ---------- INVOICE HUB (competitor best-of: online invoice approval) ---------- */
.stat-strip { display: grid; grid-template-columns: repeat(4,1fr); gap: 1px; background: var(--line-1); border: 1px solid var(--line-1); border-radius: 9px; overflow: hidden; margin-bottom: 18px; }
.stat-strip .s { background: var(--navy-800); padding: 16px 18px; }
.stat-strip .s .n { font-family: var(--font-mono); font-weight: 500; font-size: 22px; color: var(--fg-1); font-variant-numeric: tabular-nums; }
.stat-strip .s .n.alert { color: #e2574a; }
.stat-strip .s .l { font-size: 10.5px; color: var(--fg-3); margin-top: 5px; text-transform: uppercase; letter-spacing: .08em; }
.inv-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--line-1); cursor: pointer; transition: background var(--dur); align-items: center; }
.inv-row:hover { background: rgba(255,255,255,.02); }
.inv-row.sel { background: rgba(255,255,255,.045); box-shadow: inset 2px 0 0 #fff; }
.inv-row .cr { font-size: 13.5px; color: var(--fg-1); font-weight: 500; }
.inv-row .mb { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); margin-top: 3px; }
.inv-row .amt { font-family: var(--font-mono); font-size: 14px; color: var(--fg-1); text-align: right; }
.inv-row .prog { display: flex; align-items: center; gap: 5px; margin-top: 7px; justify-content: flex-end; }
.inv-row .pip { width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--line-3); }
.inv-row .pip.ok { background: var(--mint-500); border-color: var(--mint-500); }
.inv-row .pip.no { background: var(--status-urgent); border-color: var(--status-urgent); }
.inv-row .pip.q { background: var(--status-warning); border-color: var(--status-warning); }

.inv-detail { overflow: auto; display: flex; flex-direction: column; }
.inv-sum { padding: 22px 24px; border-bottom: 1px solid var(--line-1); }
.inv-sum .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.inv-sum .big { font-family: var(--font-mono); font-weight: 600; font-size: 30px; color: var(--fg-1); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.inv-sum .big small { display: block; font-size: 11px; font-weight: 400; color: var(--fg-3); margin-top: 4px; letter-spacing: .04em; }
.inv-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 24px; }
.lines { width: 100%; border-collapse: collapse; }
.lines td { padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; color: var(--fg-2); }
.lines td.r { text-align: right; font-family: var(--font-mono); color: var(--fg-1); }
.lines tr:last-child td { border-bottom: 0; }
.lines tr.total td { font-weight: 600; color: var(--fg-1); border-top: 1px solid var(--line-1); padding-top: 12px; }

.tally { display: flex; flex-direction: column; gap: 8px; }
.appr { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border: 1px solid var(--line-1); border-radius: 8px; }
.appr .av { width: 30px; height: 30px; border-radius: 50%; background: var(--navy-600); display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 11px; color: var(--fg-1); flex: none; }
.appr .who { flex: 1; }
.appr .who .nm { font-size: 13px; color: var(--fg-1); }
.appr .who .rl { font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-3); margin-top: 2px; }
.appr .st { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; }
.appr .st.approved { color: #7fe9c2; } .appr .st.denied { color: #f0938a; } .appr .st.query { color: #f0cd82; } .appr .st.pending { color: var(--fg-3); }
.appr .st [data-lucide] { width: 14px; height: 14px; }
.maj { height: 5px; border-radius: 999px; background: var(--navy-600); overflow: hidden; display: flex; margin-top: 4px; }
.maj i { height: 100%; }
.thread { display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; gap: 10px; }
.msg .av { width: 26px; height: 26px; border-radius: 50%; background: var(--navy-600); display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 10px; color: var(--fg-1); flex: none; }
.msg .bub { flex: 1; }
.msg .bub .mh { display: flex; gap: 8px; align-items: baseline; }
.msg .bub .mh .nm { font-size: 12.5px; color: var(--fg-1); font-weight: 500; }
.msg .bub .mh .tm { font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-3); }
.msg .bub p { margin: 4px 0 0; font-size: 13px; color: var(--fg-2); line-height: 1.5; }
.inv-actions { margin-top: auto; padding: 16px 24px; border-top: 1px solid var(--line-1); display: flex; gap: 10px; position: sticky; bottom: 0; background: var(--navy-900); }

/* ---------- MEETINGS & E-VOTING (best-of: StrataVote-style motions) ---------- */
.meet-head { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: start; padding: 4px 0 22px; }
.meet-meta { display: flex; gap: 26px; margin-top: 14px; flex-wrap: wrap; }
.meet-meta .m .k { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--fg-3); }
.meet-meta .m .v { font-size: 14px; color: var(--fg-1); margin-top: 5px; }
.quorum { border: 1px solid var(--line-1); border-radius: 9px; padding: 16px 18px; min-width: 190px; }
.quorum .lab { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--mint-500); }
.quorum .lab .d { width: 7px; height: 7px; border-radius: 50%; background: var(--mint-500); box-shadow: 0 0 8px rgba(51,212,153,.8); }
.quorum .big { font-family: var(--font-mono); font-weight: 600; font-size: 26px; color: var(--fg-1); margin-top: 10px; }
.quorum .big small { font-size: 12px; color: var(--fg-3); font-weight: 400; }
.motion { border: 1px solid var(--line-1); border-radius: 10px; padding: 18px 20px; margin-bottom: 12px; background: var(--navy-800); }
.motion .mtop { display: flex; align-items: flex-start; gap: 14px; }
.motion .no { font-family: var(--font-mono); font-size: 12px; color: var(--fg-3); padding-top: 2px; }
.motion h3 { font-family: var(--font-display); font-weight: 500; font-size: 18px; color: var(--fg-1); margin: 0; line-height: 1.3; }
.motion p { font-size: 13px; color: var(--fg-2); line-height: 1.5; margin: 7px 0 0; max-width: 70ch; }
.vote { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; margin-top: 16px; }
.vote-bar { height: 8px; border-radius: 999px; overflow: hidden; display: flex; background: var(--navy-600); }
.vote-bar .for { background: var(--mint-500); } .vote-bar .ag { background: var(--status-urgent); } .vote-bar .ab { background: var(--navy-500); }
.vote-legend { display: flex; gap: 16px; margin-top: 9px; }
.vote-legend span { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); display: inline-flex; align-items: center; gap: 6px; }
.vote-legend .d { width: 7px; height: 7px; border-radius: 2px; }
.vote-cta { display: flex; gap: 8px; }
.btn-vote { font-family: var(--font-sans); font-weight: 600; font-size: 12.5px; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line-1); background: transparent; color: var(--fg-1); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: all var(--dur); }
.btn-vote.for:hover { border-color: var(--mint-500); color: var(--mint-400); }
.btn-vote.ag:hover { border-color: var(--status-urgent); color: #f0938a; }

/* ---------- ASSISTANT (Opsmera AI co-pilot: reads all data, suggests) ---------- */
.asst-hero { position: relative; overflow: hidden; padding: 26px 28px 22px; border-bottom: 1px solid var(--line-1); }
.asst-hero .globe { position: absolute; inset: 0; width: 100%; height: 100%; -webkit-mask-image: radial-gradient(46% 120% at 90% 30%, #000 20%, transparent 72%); mask-image: radial-gradient(46% 120% at 90% 30%, #000 20%, transparent 72%); }
.asst-hero .z { position: relative; z-index: 2; }
.asst-hero h1 { font-family: var(--font-display); font-weight: 500; font-size: 30px; color: var(--fg-1); margin: 12px 0 0; letter-spacing: -.02em; }
.asst-hero h1 em { font-style: italic; }
.asst-hero .sub { font-size: 13.5px; color: var(--fg-2); margin-top: 8px; max-width: 64ch; line-height: 1.55; }
.asst-ask { display: flex; align-items: center; gap: 10px; margin-top: 18px; max-width: 560px; background: var(--navy-900); border: 1px solid var(--line-1); border-radius: 8px; padding: 11px 14px; }
.asst-ask [data-lucide] { color: var(--mint-500); width: 16px; height: 16px; }
.asst-ask input { flex: 1; background: transparent; border: 0; outline: none; color: var(--fg-1); font-family: var(--font-sans); font-size: 14px; }
.asst-ask input::placeholder { color: var(--fg-3); }
.asst-chips { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.asst-chip { font-family: var(--font-mono); font-size: 11px; color: var(--fg-2); border: 1px solid var(--line-1); border-radius: 999px; padding: 5px 11px; cursor: pointer; transition: all var(--dur); }
.asst-chip:hover { border-color: var(--line-3); color: var(--fg-1); }

.asst-bar { display: flex; align-items: center; gap: 12px; padding: 18px 28px 0; }
.asst-bar .lab { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--fg-3); }
.sugg-list { padding: 16px 28px 40px; display: flex; flex-direction: column; gap: 12px; max-width: 980px; }
.sugg { display: grid; grid-template-columns: 38px 1fr; gap: 14px; border: 1px solid var(--line-1); border-radius: 10px; padding: 16px 18px; background: var(--navy-800); transition: all var(--dur); }
.sugg:hover { border-color: var(--line-3); }
.sugg .rail { width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex: none; }
.sugg .rail [data-lucide] { width: 18px; height: 18px; }
.sugg .top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.sugg h3 { font-family: var(--font-display); font-weight: 500; font-size: 17px; color: var(--fg-1); margin: 0; line-height: 1.3; }
.sugg .impact { font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid; }
.sugg .impact.high { background: var(--tint-urgent); border-color: rgba(226,87,74,.4); color: #f0938a; }
.sugg .impact.med { background: var(--tint-warning); border-color: rgba(232,178,62,.4); color: #f0cd82; }
.sugg .impact.save { background: var(--tint-resolved); border-color: rgba(51,212,153,.4); color: #7fe9c2; }
.sugg .why { font-size: 13px; color: var(--fg-2); line-height: 1.55; margin: 8px 0 0; }
.sugg-basis { display: flex; gap: 7px; align-items: flex-start; margin-top: 10px; font-size: 12px; color: #8dbcf7; line-height: 1.45; }
.sugg-basis [data-lucide] { width: 13px; height: 13px; flex: none; margin-top: 2px; opacity: 1; }
.sugg .src { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.sugg .src .from { font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-3); }
.sugg .src .rec { font-family: var(--font-mono); font-size: 11px; color: var(--fg-2); border: 1px solid var(--line-1); border-radius: 5px; padding: 2px 8px; }
.sugg .act { display: flex; gap: 8px; margin-top: 14px; }
.asst-go { background: transparent; border: 0; cursor: pointer; padding: 0; display: inline-flex; }
.asst-go kbd { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); border: 1px solid var(--line-1); border-radius: 4px; padding: 1px 6px; }
.asst-go:hover kbd { color: var(--fg-1); border-color: var(--line-3); }

/* view host (was inline) */
/* Single scroll container — overflow:auto + min-height:0 forces flex to
   constrain .view-host to its grid track, and .view inside scrolls within it.
   Previously had overflow:auto on BOTH view-host AND view, which made wheel
   events ambiguous; now only one element is the scroll target. */
.view-host { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; }

/* topbar search is now a button (opens command palette) */
.search { border: 1px solid var(--line-1); cursor: pointer; text-align: left; }
.search .search-ph { flex: 1; color: var(--fg-3); font-size: 13px; }
.search:hover { border-color: var(--line-3); }
.bell-dot { position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--status-urgent); box-shadow: 0 0 0 2px var(--navy-800); }
.icon-btn { position: relative; }

/* split detail wrapper (master-detail) */
.split-detail { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.split-detail > .detail, .split-detail > .inv-detail { flex: 1; min-height: 0; }
.detail-back { display: none; }

/* ============================================================================
   OVERLAYS — toasts + modal + notifications + command palette
   ============================================================================ */
.toast-host { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 90;
  display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; width: max-content; max-width: 92vw; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 11px; min-width: 280px; max-width: 440px;
  background: var(--navy-700); border: 1px solid var(--line-3); border-radius: 10px; padding: 13px 15px;
  box-shadow: var(--shadow-lg); cursor: pointer; animation: toastIn .26s var(--ease-out); }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast .ti { width: 26px; height: 26px; border-radius: 7px; display: flex; align-items: center; justify-content: center; flex: none; }
.toast .ti [data-lucide] { width: 15px; height: 15px; }
.toast.resolved .ti { background: var(--tint-resolved); color: #7fe9c2; }
.toast.info .ti { background: var(--tint-info); color: #9dc2f7; }
.toast.warning .ti { background: var(--tint-warning); color: #f0cd82; }
.toast.urgent .ti { background: var(--tint-urgent); color: #f0938a; }
.toast.auto .ti { background: linear-gradient(135deg, #6BA5F5, #3A78D8); color: #fff; }
.toast .tm { font-size: 13.5px; color: var(--fg-1); font-weight: 600; line-height: 1.3; }
.toast .ts { font-size: 12px; color: var(--fg-2); margin-top: 3px; line-height: 1.4; }

.modal-scrim { position: fixed; inset: 0; background: rgba(4,12,22,.62); backdrop-filter: blur(3px); z-index: 80;
  display: flex; align-items: flex-start; justify-content: center; padding: 64px 20px; animation: fadeIn .18s ease; overflow: auto; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { width: 480px; max-width: 100%; background: var(--navy-800); border: 1px solid var(--line-3); border-radius: 14px;
  box-shadow: var(--shadow-lg); overflow: hidden; animation: modalIn .24s var(--ease-out); }
.modal.wide { width: 620px; }
@keyframes modalIn { from { transform: translateY(12px) scale(.99); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 18px 14px; border-bottom: 1px solid var(--line-1); }
.modal-h h3 { font-family: var(--font-display); font-weight: 500; font-size: 19px; color: var(--fg-1); margin: 0; }
.modal-sub { font-size: 12px; color: var(--fg-3); margin-top: 4px; }
.modal-body { padding: 8px; max-height: 70vh; overflow: auto; }

/* notifications */
.notif-list { display: flex; flex-direction: column; }
.notif { display: flex; align-items: center; gap: 12px; padding: 13px 12px; border-radius: 9px; cursor: pointer; transition: background var(--dur); }
.notif:hover { background: rgba(255,255,255,.03); }
.notif-ic { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex: none; }
.notif-ic [data-lucide] { width: 16px; height: 16px; }
.notif-ic.urgent { background: var(--tint-urgent); color: #f0938a; }
.notif-ic.warning { background: var(--tint-warning); color: #f0cd82; }
.notif-ic.auto { background: var(--tint-violet); color: #c3b9f7; }
.notif-ic.info { background: var(--tint-info); color: #9dc2f7; }
.notif-ic.resolved { background: var(--tint-resolved); color: #7fe9c2; }
.notif-tx { flex: 1; min-width: 0; }
.notif-tx .t { font-size: 13.5px; color: var(--fg-1); }
.notif-tx .s { font-size: 12px; color: var(--fg-3); margin-top: 2px; }
.notif-tm { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); flex: none; }

/* command palette */
.palette-search { display: flex; align-items: center; gap: 10px; padding: 12px 13px; margin: 6px 8px 10px; border: 1px solid var(--line-1); border-radius: 9px; background: var(--navy-900); }
.palette-search [data-lucide] { color: var(--fg-3); width: 16px; height: 16px; }
.palette-search input { flex: 1; background: transparent; border: 0; outline: none; color: var(--fg-1); font-family: var(--font-sans); font-size: 14px; }
.palette-list { display: flex; flex-direction: column; }
.palette-cmd { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 8px; background: transparent; border: 0; cursor: pointer;
  font-family: var(--font-sans); font-size: 13.5px; color: var(--fg-1); text-align: left; transition: background var(--dur); }
.palette-cmd:hover { background: rgba(255,255,255,.04); }
.palette-cmd [data-lucide] { width: 16px; height: 16px; color: var(--fg-3); }
.palette-cmd .k { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); border: 1px solid var(--line-1); border-radius: 4px; padding: 1px 6px; }

/* ============================================================================
   MOBILE SHELL — header, off-canvas sidebar, bottom tab bar  (hidden by default)
   ============================================================================ */
.m-header { display: none; }
.bottom-nav { display: none; }
.side-scrim { display: none; }
.side-x { display: none; }

/* ============================================================================
   DEMO LOGIN + PERSONA SYSTEM
   ============================================================================ */

/* ---- Login / persona-select screen --------------------------------------- */
.login { position: fixed; inset: 0; background: var(--navy-900); color: var(--fg-1);
  overflow: auto; display: flex; align-items: flex-start; justify-content: center; }
.login-globe { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; opacity: .35;
  -webkit-mask-image: radial-gradient(70% 70% at 50% 35%, #000 35%, transparent 100%);
          mask-image: radial-gradient(70% 70% at 50% 35%, #000 35%, transparent 100%); }
.login-z { position: relative; z-index: 2; width: 100%; max-width: 1100px; padding: 48px 40px 80px; }
.login-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.login-logo { display: flex; align-items: center; gap: 11px; }
.login-logo img { width: 24px; height: 24px; }
.login-logo b { font-family: var(--font-sans); font-weight: 600; letter-spacing: .32em; font-size: 14px; color: var(--fg-1); }
.demo-badge { display: inline-flex; align-items: center; gap: 9px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid rgba(51,212,153,.4); background: rgba(51,212,153,.1);
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: #7fe9c2; }
.demo-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--mint-500); box-shadow: 0 0 8px rgba(51,212,153,.9); animation: blip 2.4s ease-in-out infinite; }
@keyframes blip { 0%,100%{opacity:1} 50%{opacity:.35} }
.login-hero { margin: 56px 0 36px; max-width: 760px; }
.login-hero .eyebrow { font-family: var(--font-sans); font-weight: 500; font-size: 11px;
  letter-spacing: .28em; text-transform: uppercase; color: rgba(255,255,255,.45); display: block; }
.login-hero h1 { font-family: var(--font-display); font-weight: 500; color: var(--fg-1);
  font-size: clamp(2rem, 1.2rem + 3.2vw, 3.4rem); line-height: 1.08; letter-spacing: -.02em; margin: 16px 0 18px; }
.login-hero h1 em { font-style: italic; }
.login-hero p { color: rgba(255,255,255,.65); font-size: 16px; line-height: 1.55; margin: 0; max-width: 620px; }

.persona-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.persona-card { --pa: var(--mint-500); display: flex; flex-direction: column; gap: 14px;
  text-align: left; background: var(--navy-800); border: 1px solid var(--line-1); border-radius: 12px;
  padding: 22px 22px 18px; cursor: pointer; transition: all var(--dur) var(--ease-out); position: relative; overflow: hidden; }
.persona-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--pa); opacity: .9; }
.persona-card:hover { border-color: rgba(255,255,255,.22); transform: translateY(-2px);
  box-shadow: 0 12px 36px rgba(0,0,0,.35); }
.pc-top { display: flex; align-items: center; gap: 12px; }
.pc-av { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 600; font-size: 14px; color: #06251a; flex: none; }
.pc-id { flex: 1; min-width: 0; }
.pc-name { font-family: var(--font-display); font-weight: 500; font-size: 19px; color: var(--fg-1); line-height: 1.1; }
.pc-role { font-size: 12.5px; color: rgba(255,255,255,.55); margin-top: 3px; }
.pc-go { color: var(--fg-3); transition: color var(--dur), transform var(--dur); }
.pc-go [data-lucide] { width: 18px; height: 18px; }
.persona-card:hover .pc-go { color: var(--pa); transform: translateX(2px); }
.pc-org { font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; color: var(--pa); }
.pc-blurb { margin: 0; font-size: 14px; line-height: 1.55; color: rgba(255,255,255,.7); }
.pc-pains { display: flex; flex-direction: column; gap: 6px; padding: 12px 0 4px; border-top: 1px solid var(--line-1); }
.pc-pain { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: rgba(255,255,255,.6); }
.pc-pain [data-lucide] { width: 12px; height: 12px; color: var(--pa); flex: none; }
.pc-enter { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-sans); font-weight: 600;
  font-size: 12.5px; color: var(--pa); letter-spacing: .02em; margin-top: 4px; }
.pc-enter [data-lucide] { width: 14px; height: 14px; }

.login-foot { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); margin-top: 36px; letter-spacing: .04em; }

/* The login screen is ALWAYS the dark "control room" canvas, even when the
   user has the light app theme saved. Stops white-on-white on the persona
   cards when localStorage holds opsmera-canvas = light. */
body.theme-light .login {
  --navy-900: #0B2545; --navy-800: #0F2C50; --navy-700: #16365E; --navy-600: #1E3A5C; --navy-500: #1E3A5C;
  --fg-1: #F4F7FB; --fg-2: rgba(244,247,251,.7); --fg-3: rgba(244,247,251,.5);
  --line-1: rgba(255,255,255,.10); --line-2: rgba(255,255,255,.06); --line-3: rgba(255,255,255,.16);
  background: #0B2545; color: var(--fg-1);
}

@media (max-width: 760px) { .persona-grid { grid-template-columns: 1fr; } .login-z { padding: 32px 18px 100px; } }

/* ---- Topbar persona pill (always visible — the "DEMO" toggle) ----------- */
.persona-pill { display: inline-flex; align-items: center; gap: 10px; padding: 5px 12px 5px 5px; border-radius: 999px;
  background: rgba(255,255,255,.04); border: 1px solid var(--line-1); cursor: pointer;
  font-family: var(--font-sans); color: var(--fg-1); transition: all var(--dur); }
.persona-pill:hover { border-color: var(--line-3); background: rgba(255,255,255,.07); }
.pp-badge { font-family: var(--font-mono); font-weight: 600; font-size: 9px; letter-spacing: .18em;
  text-transform: uppercase; color: #7fe9c2; background: rgba(51,212,153,.16); border: 1px solid rgba(51,212,153,.4);
  border-radius: 6px; padding: 3px 7px; }
.pp-av { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 600; font-size: 11px; color: #06251a; }
.pp-tx { display: flex; flex-direction: column; line-height: 1.1; }
.pp-name { font-size: 12.5px; font-weight: 600; color: var(--fg-1); }
.pp-role { font-size: 10.5px; color: var(--fg-3); margin-top: 2px; }
.persona-pill [data-lucide] { width: 14px; height: 14px; color: var(--fg-3); }
@media (max-width: 1100px) { .pp-tx { display: none; } }

/* ---- Sidebar foot — make user a clickable button -------------------------- */
.side-user { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px;
  background: transparent; border: 1px solid transparent; border-radius: 9px; cursor: pointer;
  text-align: left; transition: all var(--dur); }
.side-user:hover { background: rgba(255,255,255,.04); border-color: var(--line-1); }
.su-id { flex: 1; min-width: 0; }
.su-id .nm { font-size: 13px; color: var(--fg-1); font-weight: 600; }
.su-id .rl { font-size: 11px; color: var(--fg-3); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.su-switch { color: var(--fg-3); flex: none; }
.su-switch [data-lucide] { width: 14px; height: 14px; }

/* ---- Persona switcher modal body ----------------------------------------- */
.switch-list { display: flex; flex-direction: column; padding: 4px; }
.switch-row { display: flex; align-items: center; gap: 12px; padding: 12px 12px; border-radius: 9px;
  background: transparent; border: 1px solid transparent; cursor: pointer; transition: all var(--dur); text-align: left; }
.switch-row:hover { background: rgba(255,255,255,.04); border-color: var(--line-1); }
.switch-row.on { background: rgba(255,255,255,.06); border-color: var(--line-3); }
.sr-av { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 600; font-size: 12.5px; color: #06251a; flex: none; }
.sr-id { flex: 1; min-width: 0; }
.sr-name { font-size: 14px; color: var(--fg-1); font-weight: 600; }
.sr-role { font-size: 11.5px; color: var(--fg-3); margin-top: 3px; }
.sr-now { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: #7fe9c2; background: rgba(51,212,153,.14); border: 1px solid rgba(51,212,153,.35); border-radius: 6px; padding: 3px 8px; }
.switch-row [data-lucide] { color: var(--fg-3); width: 16px; height: 16px; }
.switch-out { display: inline-flex; align-items: center; gap: 8px; margin: 8px 4px 4px; padding: 9px 12px;
  background: transparent; border: 1px solid var(--line-1); border-radius: 8px;
  font-family: var(--font-sans); font-size: 12.5px; color: var(--fg-2); cursor: pointer; align-self: flex-start; }
.switch-out:hover { color: var(--fg-1); border-color: var(--line-3); }
.switch-out [data-lucide] { width: 14px; height: 14px; }

/* light theme tweaks */
body.theme-light .persona-pill { background: rgba(11,37,69,.04); }
body.theme-light .demo-badge { color: #1f8f6b; background: rgba(51,212,153,.13); }
body.theme-light .login { background: var(--navy-900); }

@media (max-width: 1180px) {
  .app { grid-template-columns: 208px 1fr; }
  .hero-pulse { flex-wrap: wrap; }
}

/* JS-detected mobile fallback — applies the same mobile rules whenever the React
   hook adds .is-mobile, even if @media doesn't trigger (cached CSS, zoom, etc.). */
/* On mobile, free body+app to scroll naturally so iOS touch-scroll works. */
.app.is-mobile { grid-template-columns: 1fr !important; height: auto !important; min-height: 100dvh; overflow: visible !important; }
.app.is-mobile .main { height: auto !important; min-height: 100dvh; }
.app.is-mobile .view-host { overflow: visible !important; flex: none !important; }
.app.is-mobile .view { overflow: visible !important; }
.app.is-mobile .side { position: fixed !important; top: 0 !important; left: 0 !important; height: 100dvh !important;
  width: 280px !important; max-width: 86vw !important; z-index: 61 !important;
  transform: translateX(-100%) !important; box-shadow: var(--shadow-lg); transition: transform var(--dur-slow) var(--ease-out); }
.app.is-mobile .side.mobile-open { transform: translateX(0) !important; }
.app.is-mobile .side-scrim { display: block !important; position: fixed; inset: 0; background: rgba(4,12,22,.6);
  backdrop-filter: blur(2px); z-index: 60; opacity: 0; pointer-events: none; transition: opacity var(--dur); }
.app.is-mobile .side-scrim.open { opacity: 1; pointer-events: auto; }
.app.is-mobile .side-x { display: flex !important; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); }
.app.is-mobile .topbar { display: none !important; }
.app.is-mobile .m-header { display: flex !important; align-items: center; gap: 8px; height: 56px; padding: 0 12px;
  background: var(--navy-800); border-bottom: 1px solid var(--line-1); flex: none; position: sticky; top: 0; z-index: 30; }
.app.is-mobile .m-title { flex: 1; font-family: var(--font-display); font-weight: 500; font-size: 18px; color: var(--fg-1); }
.app.is-mobile .bottom-nav { display: flex !important; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: 60px;
  background: var(--navy-800); border-top: 1px solid var(--line-1); padding-bottom: env(safe-area-inset-bottom, 0); }
/* Bottom nav is 60px + iOS safe-area inset - reserve enough room so the last
   row of every scroll surface is not hidden behind it. */
.app.is-mobile .view, .app.is-mobile .field-stage, .app.is-mobile .board,
.app.is-mobile .wrap, .app.is-mobile .split-list, .app.is-mobile .sugg-list,
.app.is-mobile .dash-grid, .app.is-mobile .asst-bar { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0)) !important; }
.app.is-mobile { padding-bottom: env(safe-area-inset-bottom, 0); }

/* Resolved-record action bar — on mobile, do NOT stick. Sticky bottom only works
   when the parent is the scroll container; with body-scroll on mobile it lands
   mid-content. Sit it inline at the end so it scrolls into view with the rest. */
.app.is-mobile .det-actions,
.app.is-mobile .inv-actions,
.app.is-mobile .resolved-actions { position: static !important; bottom: auto !important;
  flex-wrap: wrap !important; gap: 8px !important; padding: 16px !important;
  margin-top: 12px !important; border-radius: 12px !important;
  background: var(--navy-800) !important; border: 1px solid var(--line-1) !important; }
.app.is-mobile .det-actions .btn,
.app.is-mobile .inv-actions .btn,
.app.is-mobile .resolved-actions .btn { flex: 1 1 calc(50% - 8px) !important; justify-content: center !important; min-width: 0 !important; }

/* Right-side drawer on mobile: full-width, dynamic viewport height, body scrolls
   with iOS momentum, foot clears safe-area, drawer sits ABOVE the bottom nav. */
.app.is-mobile .drawer { width: 100vw !important; max-width: 100vw !important; height: 100dvh !important; z-index: 200 !important; }
.app.is-mobile .drawer-body { overflow-y: auto !important; -webkit-overflow-scrolling: touch !important; padding-bottom: calc(100px + env(safe-area-inset-bottom, 0)) !important; }
.app.is-mobile .drawer-foot { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0)) !important; flex-wrap: wrap; gap: 8px; }
.app.is-mobile .drawer-foot .btn { flex: 1; justify-content: center; }
.app.is-mobile .scrim { z-index: 199 !important; }
/* Hide the bottom tab bar while a drawer or modal is open so it doesn't cover the foot. */
.app.is-mobile:has(.drawer.open) .bottom-nav,
.app.is-mobile:has(.modal-scrim) .bottom-nav { display: none !important; }
.app.is-mobile .dash-hero { padding: 22px 16px; }
.app.is-mobile .dash-hero .z { flex-direction: column; align-items: stretch; gap: 18px; }
.app.is-mobile .dash-hero h1 { font-size: 25px; }
.app.is-mobile .hero-pulse { display: grid; grid-template-columns: 1fr 1fr; }
.app.is-mobile .hero-pulse .cell { min-width: 0; }
.app.is-mobile .dash-grid { padding: 16px !important; gap: 14px !important; grid-template-columns: 1fr !important; }
.app.is-mobile .dash-board-strip { padding: 16px 16px 0 !important; }
.app.is-mobile .dash-board-strip > .card > div[style*="repeat(6"] { grid-template-columns: repeat(3,1fr) !important; }
.app.is-mobile .wrap { padding: 18px 16px 90px !important; }
.app.is-mobile .card { overflow-x: auto; }
.app.is-mobile .tbl { min-width: 640px; }
.app.is-mobile .split { display: block !important; position: relative; height: 100%; overflow: hidden; }
.app.is-mobile .split-list { border-right: 0 !important; height: 100%; overflow: auto; -webkit-overflow-scrolling: touch; }
.app.is-mobile .split-detail { position: absolute !important; inset: 0; background: var(--navy-900); transform: translateX(100%);
  transition: transform var(--dur-slow) var(--ease-out); z-index: 6; }
.app.is-mobile .split.show-detail .split-detail { transform: translateX(0) !important; }
.app.is-mobile .stat-strip, .app.is-mobile .pf-stats { grid-template-columns: 1fr 1fr !important; }
.app.is-mobile .view .wrap > div[style*="repeat(3,1fr)"] { grid-template-columns: 1fr !important; }
.app.is-mobile .view .wrap > div[style*="repeat(4,1fr)"] { grid-template-columns: 1fr 1fr !important; }

@media (max-width: 820px) {
  body { overflow: auto; }
  .app { grid-template-columns: 1fr; height: 100dvh; }

  /* sidebar → off-canvas drawer */
  .side { position: fixed; top: 0; left: 0; height: 100dvh; width: 280px; max-width: 86vw; z-index: 61;
    transform: translateX(-100%); transition: transform var(--dur-slow) var(--ease-out); box-shadow: var(--shadow-lg); }
  .side.mobile-open { transform: translateX(0) !important; }
  .side-scrim { display: block; position: fixed; inset: 0; background: rgba(4,12,22,.6); backdrop-filter: blur(2px);
    z-index: 60; opacity: 0; pointer-events: none; transition: opacity var(--dur); }
  .side-scrim.open { opacity: 1; pointer-events: auto; }
  .side-logo { position: relative; }
  .side-x { display: flex; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); }

  /* topbar → compact mobile header */
  .topbar { display: none; }
  .m-header { display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 12px;
    background: var(--navy-800); border-bottom: 1px solid var(--line-1); flex: none; position: sticky; top: 0; z-index: 30; }
  .m-title { flex: 1; font-family: var(--font-display); font-weight: 500; font-size: 18px; color: var(--fg-1); }
  .icon-btn { width: 40px; height: 40px; }

  /* bottom tab bar */
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: 60px;
    background: var(--navy-800); border-top: 1px solid var(--line-1); padding-bottom: env(safe-area-inset-bottom, 0); }
  .bn-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    background: transparent; border: 0; cursor: pointer; color: var(--fg-3); font-family: var(--font-sans); font-size: 10px; font-weight: 600; letter-spacing: .02em; }
  .bn-item [data-lucide] { width: 20px; height: 20px; }
  .bn-item.on { color: var(--fg-1); }
  .bn-item.ai.on, .bn-item.ai [data-lucide] { color: var(--mint-500); }
  .bn-item.on:not(.ai) [data-lucide] { color: var(--fg-1); }

  /* leave room for the bottom bar on every scroll surface */
  .view, .field-stage, .board { padding-bottom: 78px !important; }
  .det-actions, .inv-actions { bottom: 60px; }

  /* hero stacks */
  .dash-hero { padding: 22px 16px; }
  .dash-hero .z { flex-direction: column; align-items: stretch; gap: 18px; }
  .dash-hero h1 { font-size: 25px; }
  .hero-pulse { display: grid; grid-template-columns: 1fr 1fr; }
  .hero-pulse .cell { min-width: 0; }
  .dash-board-strip { padding: 16px 16px 0; }
  .dash-grid { padding: 16px; gap: 14px; }

  /* generic wraps */
  .wrap { padding: 18px 16px 90px; }
  .card-h { padding: 14px 15px; }
  .deadline { grid-template-columns: 52px 1fr auto; padding: 12px 14px; }
  .dl-bar { display: none; }
  .mini-row { padding: 12px 15px; }

  /* two-pane → master-detail */
  .split { display: block; position: relative; height: 100%; overflow: hidden; }
  .split-list { border-right: 0; height: 100%; overflow: auto; -webkit-overflow-scrolling: touch; }
  .split-detail { position: absolute; inset: 0; background: var(--navy-900); transform: translateX(100%);
    transition: transform var(--dur-slow) var(--ease-out); z-index: 6; }
  .split.show-detail .split-detail { transform: translateX(0) !important; }
  .detail-back { display: flex; align-items: center; gap: 8px; flex: none; width: 100%;
    padding: 13px 16px; background: var(--navy-800); border: 0; border-bottom: 1px solid var(--line-1);
    color: var(--fg-1); font-family: var(--font-sans); font-size: 13.5px; font-weight: 600; cursor: pointer; position: sticky; top: 0; z-index: 3; }
  .detail-back [data-lucide] { width: 16px; height: 16px; }
  .det-head, .inv-sum { padding: 18px 16px; }
  .det-body, .inv-body { padding: 16px; }
  .det-actions, .inv-actions { padding: 12px 16px; flex-wrap: wrap; }
  .det-actions .btn, .inv-actions .btn { flex: 1; justify-content: center; }

  /* tables scroll horizontally inside their card */
  .card { overflow-x: auto; }
  .tbl { min-width: 640px; }

  /* field app stacks; phone scales down */
  .field-stage { flex-direction: column; gap: 30px; padding: 22px 16px 90px; height: auto; }
  .field-copy { max-width: 100%; }

  /* meetings / invoice / portfolio grids */
  .meet-head { grid-template-columns: 1fr; }
  .vote { grid-template-columns: 1fr; gap: 12px; }
  .vote-cta { justify-content: flex-start; }
  .stat-strip, .pf-stats { grid-template-columns: 1fr 1fr !important; }
  .sugg { grid-template-columns: 1fr; }
  .sugg .rail { display: none; }
  .asst-hero, .sugg-list, .asst-bar { padding-left: 16px; padding-right: 16px; }
  .asst-hero h1 { font-size: 24px; }
  .asst-bar { flex-wrap: wrap; }

  /* portfolio cards single column */
  .view .wrap > div[style*="repeat(3,1fr)"] { grid-template-columns: 1fr !important; }
  .view .wrap > div[style*="repeat(4,1fr)"] { grid-template-columns: 1fr 1fr !important; }
}

@media (max-width: 420px) {
  .hero-pulse { grid-template-columns: 1fr 1fr; }
  .seg { flex-wrap: wrap; }
  .toast { min-width: 0; width: 92vw; }
}

/* ============================================================================
   MOBILE OVERFLOW GUARDS — keep every section inside viewport width with a
   touch of right-side breathing room. Without these, `.card { overflow-x: auto }`
   (intentional for wide tables) lets deadline rows / mini-rows / field-card
   content push past the right edge of the screen.
   ============================================================================ */
@media (max-width: 820px) {
  .card { overflow-x: hidden !important; max-width: 100%; }
  .card:has(> .tbl), .card:has(> div > .tbl) { overflow-x: auto !important; }
  .deadline { min-width: 0; }
  .dl-main { min-width: 0; }
  .dl-main .t, .dl-main .m { word-break: break-word; overflow-wrap: anywhere; }
  .mini-row .tx { min-width: 0; }
  .mini-row .tx .b { word-break: break-word; overflow-wrap: anywhere; }
  .field-card { flex-direction: column; align-items: stretch; gap: 12px; padding: 18px; }
  .field-card .ph { align-self: flex-start; }
  .field-card .btn { align-self: flex-start; }
  .mini-row { padding: 12px 14px; gap: 10px; }
  .view, .wrap, .dash-grid, .dash-board-strip, .dash-hero { max-width: 100vw; box-sizing: border-box; }
}
.app.is-mobile .card { overflow-x: hidden !important; max-width: 100%; }
.app.is-mobile .card:has(> .tbl), .app.is-mobile .card:has(> div > .tbl) { overflow-x: auto !important; }
.app.is-mobile .deadline, .app.is-mobile .dl-main, .app.is-mobile .mini-row .tx { min-width: 0; }
.app.is-mobile .dl-main .t,
.app.is-mobile .dl-main .m,
.app.is-mobile .mini-row .tx .b { word-break: break-word; overflow-wrap: anywhere; }
.app.is-mobile .field-card { flex-direction: column !important; align-items: stretch !important; gap: 12px !important; padding: 18px !important; }
.app.is-mobile .field-card .ph,
.app.is-mobile .field-card .btn { align-self: flex-start !important; }

/* ============================================================================
   RESIDENT COMMS — multi-channel broadcasts with delivery stats
   ============================================================================ */

/* Top stats strip in the comms list (Sent / wk · Open rate · etc.) */
.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line-1);
  border: 1px solid var(--line-1); border-radius: 9px; overflow: hidden; }
.stat-strip .s { background: var(--navy-800); padding: 14px 16px; }
.stat-strip .s .n { font-family: var(--font-mono); font-weight: 500; font-size: 22px; color: var(--fg-1); }
.stat-strip .s .l { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--fg-3); margin-top: 6px; }

/* Comms row variant (extends .mini-row) — separator + selected state */
.comms-row { border-bottom: 1px solid var(--line-1); cursor: pointer; transition: background var(--dur); }
.comms-row:hover { background: rgba(255,255,255,.03); }
.comms-row.sel { background: rgba(91,155,240,.10);
  border-left: 3px solid var(--info, #5B9BF0); }

/* Detail panel right side */
.comms-detail { display: flex; flex-direction: column; height: 100%; }
.cd-head { padding: 22px 24px 18px; border-bottom: 1px solid var(--line-1); }
.cd-head .bldg { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); }
.cd-head h2 { font-family: var(--font-display); font-weight: 500; font-size: 22px; color: var(--fg-1);
  margin: 10px 0 14px; line-height: 1.25; }
.cd-head .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.aud { font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-3); letter-spacing: .04em; }
.cd-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 18px; flex: 1; overflow: visible; }
.cd-actions { margin-top: auto; padding: 16px 24px; border-top: 1px solid var(--line-1);
  display: flex; gap: 10px; position: sticky; bottom: 0; background: var(--navy-900); flex-wrap: wrap; }

/* Message composer card — channel toggles + body + variables */
.msg-card { border: 1px solid var(--line-1); border-radius: 10px; background: var(--navy-800); padding: 0; }
.msg-chans { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 14px 0; }
.chan-toggle { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px;
  font-family: var(--font-sans); font-size: 12.5px; color: var(--fg-2); cursor: pointer;
  background: transparent; border: 1px solid var(--line-1); transition: all var(--dur); }
.chan-toggle:hover { color: var(--fg-1); border-color: var(--line-3); }
.chan-toggle.on { background: rgba(91,155,240,.16); color: var(--fg-1); border-color: rgba(91,155,240,.45); }
.chan-toggle [data-lucide] { width: 14px; height: 14px; }
.msg-body { padding: 16px; margin: 14px; background: var(--navy-900); border: 1px solid var(--line-1);
  border-radius: 8px; font-family: var(--font-sans); font-size: 13.5px; color: var(--fg-1); line-height: 1.6;
  white-space: pre-wrap; }
.msg-vars { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 0 14px 14px; }
.var { font-family: var(--font-mono); font-size: 11px; padding: 3px 8px; border-radius: 5px;
  background: rgba(91,155,240,.13); color: #7fb1f4; border: 1px solid rgba(91,155,240,.3); }
.msg-meta { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); letter-spacing: .04em; }

/* Delivery stats grid (4 tiles with mini bars) */
.deliver { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--line-1); border: 1px solid var(--line-1); border-radius: 10px; overflow: hidden; }
.dl-stat { background: var(--navy-800); padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 5px; }
.dl-stat .n { font-family: var(--font-mono); font-weight: 500; font-size: 22px; color: var(--fg-1); }
.dl-stat .l { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--fg-3); }
.dl-stat .bar { height: 3px; border-radius: 999px; background: rgba(255,255,255,.06); margin-top: 6px; overflow: hidden; }
.dl-stat .bar i { display: block; height: 100%; border-radius: inherit; transition: width var(--dur-slow) var(--ease-out); }

/* Mobile pass — Comms */
@media (max-width: 820px) {
  .stat-strip { grid-template-columns: 1fr 1fr; }
  .deliver { grid-template-columns: 1fr 1fr; }
  .cd-actions { flex-direction: row; }
  .cd-actions .btn { flex: 1; justify-content: center; }
}

/* ============================================================================
   REPORTS — trend cards, report-template grid, compliance bars, scheduled list
   ============================================================================ */

/* 4-up trend cards at the top of /reports */
.rep-trends { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.rep-trend { background: var(--navy-800); border: 1px solid var(--line-1); border-radius: 11px;
  padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px;
  transition: border-color var(--dur), transform var(--dur); }
.rep-trend:hover { border-color: var(--line-3); transform: translateY(-1px); }
.rt-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.rt-val { font-family: var(--font-mono); font-weight: 500; font-size: 24px; color: var(--fg-1); letter-spacing: -.01em; }
.rt-delta { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 11.5px;
  padding: 3px 9px; border-radius: 999px; letter-spacing: .03em; }
.rt-delta.good { background: rgba(51,212,153,.14); color: #6fe1b9; }
.rt-delta.bad  { background: rgba(226,87,74,.14);  color: #f0938a; }
.rt-delta [data-lucide] { width: 13px; height: 13px; }
.rt-label { font-family: var(--font-sans); font-size: 13px; color: var(--fg-2); }
.rt-spark { height: 4px; border-radius: 999px; background: rgba(255,255,255,.05); margin-top: 4px; overflow: hidden; position: relative; }
.rt-spark i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--mint-500), var(--info, #5B9BF0));
  transition: width var(--dur-slow) var(--ease-out); }

/* Two-column layout: main report templates + side panels */
.rep-cols { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; align-items: start; }
.rep-main { display: flex; flex-direction: column; gap: 10px; }
.rep-side { display: flex; flex-direction: column; gap: 14px; }

.card-h.plain { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 14px; border: 0; }
.card-h.plain h3 { font-family: var(--font-display); font-weight: 500; font-size: 18px; color: var(--fg-1); margin: 0; }
.card-h.plain .more { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 11.5px;
  color: var(--fg-3); cursor: pointer; transition: color var(--dur); }
.card-h.plain .more:hover { color: var(--fg-1); }

/* Report-template grid (2 columns of beautiful cards) */
.rep-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rep-card { background: var(--navy-800); border: 1px solid var(--line-1); border-radius: 11px;
  padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start;
  transition: all var(--dur); cursor: pointer; }
.rep-card:hover { border-color: var(--line-3); transform: translateY(-1px); box-shadow: var(--shadow-sm, 0 1px 4px rgba(0,0,0,.2)); }
.rc-ic { flex: none; width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  background: rgba(91,155,240,.13); color: #7fb1f4; }
.rc-ic [data-lucide] { width: 18px; height: 18px; }
.rc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.rc-title { font-family: var(--font-sans); font-weight: 600; font-size: 14px; color: var(--fg-1); }
.rc-desc { font-family: var(--font-sans); font-size: 12.5px; color: var(--fg-2); line-height: 1.5; }
.rc-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.rc-tag { font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-3); letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 4px; background: rgba(255,255,255,.04); border: 1px solid var(--line-1); }

/* Compliance-by-scheme list inside the side card */
.rep-bar-row { display: grid; grid-template-columns: 1.4fr 1fr 56px; align-items: center; gap: 14px;
  padding: 11px 18px; cursor: pointer; transition: background var(--dur); border-bottom: 1px solid var(--line-1); }
.rep-bar-row:last-child { border-bottom: 0; }
.rep-bar-row:hover { background: rgba(255,255,255,.03); }
.rbr-name { font-family: var(--font-sans); font-size: 13px; color: var(--fg-1); display: flex; flex-direction: column; gap: 2px; }
.rbr-name small { font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-3); letter-spacing: .04em; }
.rbr-track { position: relative; height: 6px; border-radius: 999px; background: rgba(255,255,255,.06); overflow: hidden; }
.rbr-track i { display: block; height: 100%; border-radius: inherit; transition: width var(--dur-slow) var(--ease-out); }
.rbr-val { font-family: var(--font-mono); font-size: 12.5px; color: var(--fg-1); text-align: right; font-variant-numeric: tabular-nums; }

/* Scheduled mini list */
.rep-schedule .card-h { border-bottom: 1px solid var(--line-1); }
.rep-schedule .mini-row { padding: 12px 18px; }

/* Mobile pass — Reports */
@media (max-width: 1100px) { .rep-trends { grid-template-columns: 1fr 1fr; } }
@media (max-width: 820px) {
  .rep-cols { grid-template-columns: 1fr; }
  .rep-grid { grid-template-columns: 1fr; }
  .rep-trends { grid-template-columns: 1fr 1fr; }
  .rep-bar-row { grid-template-columns: 1fr 80px 46px; padding: 11px 14px; gap: 10px; }
}
