/* Hardkeep War Room: night-shift control room.
 * Hardkeep's own language (graphite, steel, hairline rules, one amber signal)
 * set for a console you watch at any hour. Amber means "needs you"; cool
 * white means "work is happening"; everything else stays quiet. */
:root {
  color-scheme: dark;
  --bg: #0D0E10;
  --bg-2: #111215;
  --panel: #15171A;
  --panel-2: #1B1E22;
  --panel-3: #22262B;
  --line: #262A2F;
  --line-2: #343940;
  --ink: #E7E9EC;
  --ink-2: #A9AEB4;
  --ink-3: #868B92;
  --amber: #FF7A18;
  --amber-ink: #FFB27A;
  --amber-dim: rgba(255, 122, 24, .12);
  --amber-line: rgba(255, 122, 24, .38);
  --live: #CFE8FF;
  --ok: #3FBF7F;
  --ok-dim: rgba(63, 191, 127, .14);
  --bad: #EF6A61;
  --bad-dim: rgba(239, 106, 97, .13);
  --idle: #6F757C;
  --disp: "Archivo", system-ui, sans-serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --rail: 380px;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--amber); color: #16181B; }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; border: 2px solid var(--bg-2); }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
h1, h2, h3 { font-family: var(--disp); margin: 0; letter-spacing: -0.015em; text-wrap: balance; }
.sub { margin: 2px 0 0; color: var(--ink-2); font-size: 12.5px; }
.num, .tile b, .count, .handoffs strong, .clock, time { font-variant-numeric: tabular-nums; }
.icon { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* --- Top bar ---------------------------------------------------------- */
.topbar {
  height: 52px; display: flex; align-items: center; gap: 18px;
  padding: 0 16px; background: rgba(13, 14, 16, .92); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20; backdrop-filter: blur(10px);
}
.brand { font: 800 16px var(--disp); display: flex; align-items: center; gap: 9px; white-space: nowrap; letter-spacing: -0.01em; }
.brand small { font: 500 11px var(--mono); color: var(--ink-3); letter-spacing: .08em; }
.brand-mark { width: 20px; height: 20px; border-radius: 5px; background: var(--panel-3); border: 1px solid var(--line-2); position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 6px 5px 5px 5px; background: var(--amber); border-radius: 1px; }
.tabs { display: flex; align-items: center; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tab, .dept-tab {
  border: 0; background: none; padding: 6px 10px; border-radius: 7px; color: var(--ink-2);
  font-weight: 500; white-space: nowrap; display: flex; align-items: center; gap: 7px;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.tab:hover, .dept-tab:hover { background: var(--panel-2); color: var(--ink); }
.tab.active, .dept-tab.active { color: var(--ink); background: var(--panel-3); }
.dept-tabs { display: flex; gap: 2px; }
.dept-tab .sw { width: 7px; height: 7px; border-radius: 2px; }
.tab-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.top-right form { margin: 0; }
.working-chip {
  display: flex; align-items: center; gap: 8px; padding: 5px 11px; border-radius: 999px;
  background: var(--ok-dim); color: #8FE3B6; font-weight: 500; font-size: 12.5px; border: 1px solid rgba(63,191,127,.25);
}
.closed .working-chip { background: var(--panel-2); color: var(--ink-2); border-color: var(--line); }
.offline .working-chip { background: var(--bad-dim); color: #F4A29C; border-color: rgba(239,106,97,.35); }
.offline .working-chip #working-count { display: none; }
.offline .pulse-dot { background: var(--bad); }
.clock { font: 500 12.5px var(--mono); color: var(--ink-2); }
.chief-btn {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--line-2); background: var(--panel-2); padding: 5px 11px; border-radius: 8px; font-weight: 600;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.chief-btn:hover { border-color: var(--amber-line); background: var(--panel-3); }
.ghost-btn { border: 0; background: none; color: var(--ink-3); padding: 5px 6px; }
.ghost-btn:hover { color: var(--ink); }
.signout { position: relative; }
.signout > summary { list-style: none; cursor: pointer; }
.signout > summary::-webkit-details-marker { display: none; }
.signout-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; display: grid; min-width: 140px;
  padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.signout-menu .ghost-btn { width: 100%; text-align: left; padding: 7px 10px; border-radius: 6px; white-space: nowrap; }
.signout-menu .ghost-btn:hover { background: var(--panel-2); }
.demo-badge {
  font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .08em;
  padding: 4px 8px; border-radius: 6px; background: var(--amber-dim); color: var(--amber-ink); border: 1px solid var(--amber-line);
}
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); position: relative; flex: none; }
.pulse-dot::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 1.5px solid var(--ok); animation: ping 1.8s ease-out infinite; }
.closed .pulse-dot { background: var(--idle); box-shadow: none; }
.closed .pulse-dot::after { display: none; }
@keyframes ping { from { transform: scale(.6); opacity: .9; } to { transform: scale(1.9); opacity: 0; } }

/* --- Layout ---------------------------------------------------------------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) var(--rail); height: calc(100vh - 52px); position: relative; overflow-x: clip; }
.stage {
  position: relative; overflow: hidden;
  background:
    radial-gradient(70% 60% at 50% 55%, rgba(207, 232, 255, .055) 0%, transparent 70%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
.hello { position: absolute; top: 20px; left: 22px; z-index: 5; max-width: 340px; }
.hello h1 { font-size: 34px; font-weight: 800; line-height: 1.02; letter-spacing: -0.03em; }
.hello-kpis { display: grid; grid-template-columns: repeat(2, auto); gap: 6px 22px; margin: 0 0 16px; justify-content: start; }
.hello-kpis dt { font-size: 11px; color: var(--ink-3); }
.hello-kpis dd { margin: 0; font: 600 15px var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.summary { margin: 10px 0 14px; color: var(--ink-2); }
.summary b { color: var(--ink); font-weight: 600; }
.primary-btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 0; background: var(--amber); color: #16181B; padding: 7px 14px; border-radius: 8px; font-weight: 600;
  box-shadow: 0 6px 16px -8px rgba(0,0,0,.7);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
}
.primary-btn:hover { background: #FF8A33; transform: translateY(-1px); box-shadow: 0 10px 20px -10px rgba(0,0,0,.8); }
.primary-btn:disabled { opacity: .5; transform: none; }
.vitals { position: absolute; top: 20px; right: 20px; z-index: 5; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.vital {
  background: rgba(21, 23, 26, .78); backdrop-filter: blur(8px); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 12px; font-size: 12px; color: var(--ink-2); white-space: nowrap;
}
.vital b { color: var(--ink); font: 500 12px var(--mono); margin-left: 4px; }
.vital.warn { border-color: rgba(239,106,97,.4); }
.vital.warn b { color: var(--bad); }

.closed-banner {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 6;
  background: rgba(21, 23, 26, .9); backdrop-filter: blur(10px); color: var(--ink);
  border: 1px solid var(--amber-line); border-radius: 12px; padding: 11px 18px;
  width: max-content; max-width: min(440px, calc(100% - 540px)); font-size: 13px; text-align: center;
  box-shadow: 0 16px 40px -18px rgba(0,0,0,.8);
}
.closed-banner b { font-family: var(--disp); font-size: 14px; display: block; margin-bottom: 2px; color: var(--amber-ink); }
.closed-banner code { font: 500 11.5px var(--mono); color: var(--ink); background: var(--panel-3); padding: 1px 5px; border-radius: 4px; }

.scene-wrap { position: absolute; inset: 0; display: grid; place-items: center; padding: 76px 16px 60px; }
.scene { position: relative; }
.scene svg { display: block; width: 100%; height: 100%; overflow: visible; }

/* --- Room ----------------------------------------------------------------------- */
.agent-g { cursor: pointer; transition: opacity .3s var(--ease); }
.agent-g.dim, .rug.dim, .agent-label.dim { opacity: .18; }
.agent-g.working .person { animation: bob 2.4s ease-in-out infinite; }
.agent-g.working .screen { animation: flicker 3.2s steps(1) infinite; }
.agent-g.waiting .ring, .agent-g.waiting .halo { animation: ring 1.8s ease-in-out infinite; }
.agent-g:hover .ring { stroke-width: 3; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.4px); } }
@keyframes flicker { 0%, 100% { opacity: 1; } 47% { opacity: .8; } 52% { opacity: 1; } }
@keyframes ring { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.ring { fill: none; stroke-width: 2; }
.led { animation: led 1.3s steps(2) infinite; }
.led:nth-child(3n) { animation-duration: .9s; }
.led:nth-child(4n) { animation-duration: 2.1s; }
@keyframes led { 50% { opacity: .2; } }
/* The one authored moment: a scan line crosses the floor as the room powers on. */
.sweep { animation: sweep 2.4s var(--ease) .2s 1 both; }
@keyframes sweep { from { transform: translateX(-120%); opacity: 0; } 15% { opacity: 1; } to { transform: translateX(120%); opacity: 0; } }
body.paused *, body.paused *::after, body.closed .agent-g *, body.closed .led { animation-play-state: paused !important; }
body.closed .agent-g .screen { opacity: .6; }

/* Status rings: working desks get a slow tracing arc, a quiet sign the desk is live. */
.ring-trace { fill: none; stroke-width: 2.4; stroke-dasharray: 16 140; opacity: 0; }
.agent-g.working .ring-trace { opacity: 1; animation: trace 3.6s linear infinite; }
.agent-g.waiting .ring-trace { opacity: 1; animation: trace 1.8s linear infinite; }
@keyframes trace { to { stroke-dashoffset: -156; } }
.agent-g .halo { transition: opacity .4s var(--ease); }
.agent-g:hover { filter: brightness(1.18); }
.agent-g:hover .ring { stroke-width: 3; }
.pulse-ring { fill: none; stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: pulse-out 1.4s var(--ease) forwards; }
@keyframes pulse-out { from { transform: scale(1); opacity: .95; } to { transform: scale(2.8); opacity: 0; } }
.fixtures { pointer-events: none; }

/* Camera */
.scene { transform-origin: 0 0; transition: transform .35s var(--ease); will-change: transform; }
.scene.no-anim { transition: none; }
.scene-wrap { overflow: hidden; touch-action: none; }
.scene-wrap.zoomed { cursor: grab; }
.scene-wrap.dragging { cursor: grabbing; }
.zoom-controls { position: absolute; right: 16px; bottom: 76px; z-index: 5; display: flex; flex-direction: column;
  background: rgba(21, 23, 26, .82); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.zoom-controls button { border: 0; background: none; color: var(--ink-2); width: 34px; height: 32px; display: grid; place-items: center; }
.zoom-controls button + button { border-top: 1px solid var(--line); }
.zoom-controls button:hover { color: var(--ink); background: var(--panel-3); }

/* --- Labels over the room ------------------------------------------------------- */
.labels { position: absolute; inset: 0; pointer-events: none; }
.agent-label {
  position: absolute; transform: translate(-50%, -100%) translateY(calc(var(--lift, 0) * -1px - 6px)) scale(calc(1 / var(--zoom, 1)));
  transform-origin: 50% 100%;
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; pointer-events: auto; transition: opacity .3s var(--ease);
}
.agent-label:hover, .agent-label:focus-within { z-index: 4; }
.stem { position: absolute; left: 50%; top: 100%; width: 1px; height: calc(var(--lift, 0) * 1px + 6px);
  background: linear-gradient(180deg, var(--line-2), rgba(52,57,64,0)); pointer-events: none; }
.status-waiting .stem { background: linear-gradient(180deg, var(--amber-line), rgba(255,122,24,0)); }
.city-light { opacity: var(--city, .8); transition: opacity 1.2s linear; }
svg.focus .agent-g:not(.focused), .labels.focus .agent-label:not(.focused) { opacity: .28; }
svg.focus .agent-g.focused { filter: brightness(1.25); }
svg.focus .agent-g.focused .ring { stroke-width: 3; }
.pill {
  display: flex; align-items: center; gap: 6px; padding: 3px 9px 3px 7px; border-radius: 999px;
  background: rgba(21, 23, 26, .9); border: 1px solid var(--line-2); box-shadow: 0 4px 12px -4px rgba(0,0,0,.6);
  font: 600 11px var(--sans); color: var(--ink); white-space: nowrap; backdrop-filter: blur(6px);
  box-shadow: 0 4px 12px -4px rgba(0,0,0,.6), inset 0 -1px 0 var(--dept, transparent);
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.pill:hover { border-color: var(--ink-3); transform: translateY(-1px); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.pill .tag { font: 500 11px var(--sans); color: var(--amber-ink); }
.status-working .dot { background: var(--ok); }
.status-waiting .dot { background: var(--amber); }
.status-waiting .pill { border-color: var(--amber-line); }
.status-blocked .dot { background: var(--bad); }
.status-idle .dot, .status-off .dot { background: var(--idle); }
.status-empty .pill { border-style: dashed; background: rgba(21,23,26,.55); color: var(--ink-3); }
.status-empty .dot { background: transparent; border: 1px dashed var(--ink-3); }
.bubble {
  max-width: 180px; padding: 3px 9px; border-radius: 7px; background: var(--panel-3); color: var(--ink);
  border: 1px solid var(--line-2); font-size: 11px; line-height: 1.35; text-align: center; display: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.agent-label.show-bubble .bubble, .agent-label:hover .bubble { display: block; }
.status-waiting .bubble { background: #2A1A0D; border-color: var(--amber-line); color: var(--amber-ink); }
/* Compact labels: a status dot per desk until hovered, focused or zoomed in. Desks waiting on you keep their name. */
.labels.compact .agent-label:not(.status-waiting):not(:hover):not(:focus-within):not(.focused) .pill { padding: 4px; gap: 0; font-size: 0; }
.labels.compact .agent-label:not(.status-waiting):not(:hover):not(:focus-within):not(.focused) .pill .dot { width: 7px; height: 7px; }
.labels.compact .agent-label .bubble { display: none; }
.labels.compact .agent-label .tag { display: none; }
.walker { pointer-events: none; }

.closed-banner b.inline { display: inline; font-size: inherit; margin: 0; color: var(--ink); }
.sim-hud { border-color: rgba(207,232,255,.28); text-align: left; width: min(500px, calc(100% - 620px)); max-width: none; padding: 10px 14px;
  top: 14px; bottom: auto; }
.sim-hud .hud-assume { max-height: 46vh; overflow-y: auto; }
.hud-speed { margin: 0 0 0 auto; flex: none; }
.recap-jump { display: flex; align-items: center; gap: 6px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2);
  background: rgba(21, 23, 26, .82); backdrop-filter: blur(10px); color: var(--ink); font: 600 13px var(--sans); }
.recap-jump:hover { border-color: var(--amber-line); color: var(--amber-ink); }
.recap-back { margin-left: 12px; vertical-align: middle; display: inline-flex; align-items: center; gap: 5px; font-family: var(--sans); }
/* The page's own scroll bar, on the left edge: drag the thumb, click the track, or a stop. */
.page-rail { position: fixed; left: 0; top: 52px; bottom: 0; width: 16px; z-index: 12; padding: 10px 3px; }
.pr-track { position: relative; height: 100%; border-radius: 6px; background: rgba(255,255,255,.04); cursor: pointer; }
.page-rail:hover .pr-track { background: rgba(255,255,255,.07); }
.pr-thumb { position: absolute; left: 0; right: 0; top: 0; border-radius: 6px; background: var(--ink-3); cursor: grab; touch-action: none;
  transition: background .15s var(--ease); }
.pr-thumb:hover, .pr-thumb:active { background: var(--amber); cursor: grabbing; }
.pr-stop { position: absolute; left: -1px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--bg);
  background: var(--line-2); padding: 0; z-index: 1; }
.pr-stop.here { background: var(--amber); }
.pr-stop span { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); white-space: nowrap; font: 600 11.5px var(--sans);
  color: var(--ink); background: var(--panel-3); border: 1px solid var(--line-2); border-radius: 6px; padding: 2px 7px;
  opacity: 0; pointer-events: none; transition: opacity .15s var(--ease); }
.page-rail:hover .pr-stop span, .pr-stop:focus-visible span { opacity: 1; }
.zoom-hint { position: absolute; left: 50%; top: 45%; transform: translateX(-50%); z-index: 7; pointer-events: none;
  background: rgba(13, 14, 16, .92); border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 14px; font-size: 13px; color: var(--ink); }
.zoom-hint kbd { font: 600 11.5px var(--mono); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 5px; background: var(--panel-3); }

/* --- Recap under the room ----------------------------------------------------------- */
.recap { padding: 24px 28px 40px; border-top: 1px solid var(--line); background: var(--bg); }
.recap-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.recap-head h2 { font: 700 22px var(--disp); margin: 0; }
.recap-headline { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; }
.recap-nav { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.recap-seg { margin: 0; width: 210px; }
.recap-date { display: flex; align-items: center; gap: 6px; }
.recap-date #recap-label { font: 600 13px var(--sans); min-width: 170px; text-align: center; }
.recap-date .btn-sm { display: grid; place-items: center; }
.recap-date .btn-sm:disabled { opacity: .35; cursor: default; }
/* Tiles stretch to fill each row (no half-empty last row); 1px gaps draw the grid lines. */
.b-summary.recap-totals { display: flex; flex-wrap: wrap; gap: 1px; background: var(--line); }
.b-summary.recap-totals div { flex: 1 1 150px; border: 0 !important; background: var(--panel); }
.recap-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1.2fr); gap: 14px; margin-bottom: 14px; }
.recap-grid h3 { font: 600 14px var(--sans); margin: 0 0 10px; }
.recap-grid .card-head h3 { margin: 0; }
.recap-bars { display: flex; align-items: flex-end; gap: 2px; height: 120px; padding-top: 6px; }
.recap-bars button { flex: 1; min-width: 0; height: 100%; border: 0; padding: 0; background: none; display: flex; flex-direction: column;
  justify-content: flex-end; align-items: stretch; cursor: pointer; border-radius: 4px 4px 0 0; }
.recap-bars button span { display: block; background: var(--ink-3); border-radius: 4px 4px 0 0; min-height: 2px; transition: background .15s var(--ease); }
.recap-bars button.money span { background: var(--live); }
.recap-bars button:hover span, .recap-bars button:focus-visible span { background: var(--amber); }
.recap-bars button.current span { outline: 1px solid var(--amber); }
.recap-axis { display: flex; justify-content: space-between; font: 11px var(--mono); color: var(--ink-3); margin-top: 6px; }
.recap-depts { list-style: none; margin: 0; padding: 0; }
.recap-depts li { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.recap-depts .d-top { display: flex; justify-content: space-between; gap: 8px; }
.recap-depts .d-top b { font-weight: 600; display: flex; align-items: center; gap: 7px; }
.recap-depts .sw { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.recap-depts .d-agents { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.recap-list { list-style: none; margin: 0; padding: 0; }
.recap-list li { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.recap-list .avatar { width: 22px; height: 22px; font-size: 10px; border-radius: 6px; }
.recap-list time { font: 11px var(--mono); color: var(--ink-3); white-space: nowrap; margin-left: auto; padding-left: 8px; }
.recap-details { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.recap-details > summary { cursor: pointer; padding: 13px 16px; font-weight: 600; list-style: none; display: flex; gap: 8px; align-items: center; }
.recap-details > summary::-webkit-details-marker { display: none; }
.recap-details > summary::before { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--ink-2); border-bottom: 1.5px solid var(--ink-2);
  transform: rotate(-45deg); transition: transform .15s var(--ease); }
.recap-details[open] > summary::before { transform: rotate(45deg); }
.recap-timeline { padding: 0 16px 14px; max-height: 70vh; overflow-y: auto; }
.recap-group > summary, .recap-hour { font: 600 12px var(--mono); color: var(--ink-3); padding: 10px 0 4px; cursor: pointer; }
.recap-hour { cursor: default; }
.recap-group > summary b { color: var(--ink-2); font-family: var(--sans); }
.recap-ev { display: grid; grid-template-columns: 56px 150px minmax(0, 1fr); gap: 10px; padding: 5px 0; font-size: 13px; color: var(--ink-2);
  border-bottom: 1px solid var(--line); }
.recap-ev time { font: 11.5px var(--mono); color: var(--ink-3); padding-top: 1px; }
.recap-ev .who { display: flex; gap: 6px; align-items: center; color: var(--ink); font-weight: 500; min-width: 0; }
.recap-ev .who span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recap-ev .k-won, .recap-ev .k-money_in { color: var(--ink); }
.recap-ev .k-failed { color: #F4A29C; }
.recap-ev .k-rehearsed { color: var(--ink-3); }
@media (max-width: 1100px) { .recap-grid { grid-template-columns: 1fr; } }
/* Leave the page scroll bar its own strip on the left in the stacked layout. */
@media (max-width: 900px) { .layout .stage { padding-left: 26px; } }
@media (max-width: 640px) {
  .recap { padding: 18px 16px 32px 24px; }
  .recap-ev { grid-template-columns: 48px minmax(0, 1fr); }
  .recap-ev .who { grid-column: 2; }
  .recap-ev > span:last-child { grid-column: 2; }
}
.hud-speed button { padding: 3px 8px; font: 500 11px var(--mono); white-space: nowrap; flex: none; }
body.zoomed .hello, body.zoomed .vitals { opacity: 0; pointer-events: none; }
.hello, .vitals { transition: opacity .3s var(--ease); }
.hud-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 7px; }
.hud-row:last-of-type { margin-bottom: 0; }
.sim-hud .hud-row b { display: inline; color: var(--ink); margin: 0; font-size: 14px; }
.hud-live { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: ping-dot 1.4s ease-in-out infinite; }
.hud-live.off { background: var(--idle); animation: none; }
@keyframes ping-dot { 50% { opacity: .35; } }
.hud-time { font: 500 12.5px var(--mono); color: var(--live); }
.hud-meta { font-size: 11.5px; color: var(--ink-3); margin-left: auto; }
.hud-seg { margin: 0; flex: 1; }
.hud-stats { font: 500 12px var(--mono); color: var(--ink-2); gap: 14px; }
.hud-stats .btn-sm:first-of-type { margin-left: auto; }
.hud-assume { list-style: none; margin: 8px 0 0; padding: 8px 0 0; border-top: 1px solid var(--line); display: grid; gap: 4px; font-size: 12px; }
.hud-assume[hidden] { display: none; }
.hud-assume li { display: flex; justify-content: space-between; gap: 12px; color: var(--ink-2); }
.hud-assume b { color: var(--ink); font-weight: 500; text-align: right; display: inline !important; font-size: 12px !important; }

/* --- Rollup + controls --------------------------------------------------------- */
.rollup, .handoffs, .pause-btn {
  background: rgba(21, 23, 26, .82); backdrop-filter: blur(10px); border: 1px solid var(--line);
}
.rollup { position: absolute; left: 16px; bottom: 16px; z-index: 5; width: 232px; border-radius: 12px; padding: 6px; }
.rollup button {
  width: 100%; display: flex; align-items: center; gap: 9px; border: 0; background: none;
  padding: 6px 8px; border-radius: 7px; font-size: 12.5px; text-align: left; color: var(--ink-2);
  transition: background .2s var(--ease), color .2s var(--ease);
}
.rollup button:hover, .rollup button.active { background: var(--panel-3); color: var(--ink); }
.rollup .sw { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.rollup .count { margin-left: auto; font: 500 11.5px var(--mono); color: var(--ink-3); }
.rollup .foot { margin: 4px 8px 2px; font-size: 11px; color: var(--ink-3); }
.room-controls { position: absolute; right: 16px; bottom: 16px; z-index: 5; display: flex; gap: 8px; align-items: stretch; }
.handoffs { border-radius: 10px; padding: 5px 13px; display: flex; flex-direction: column; justify-content: center; }
.handoffs span { font-size: 11px; color: var(--ink-3); }
.handoffs strong { font: 600 16px var(--mono); }
.pause-btn { display: flex; align-items: center; gap: 8px; border-radius: 10px; padding: 0 14px; font-weight: 600; transition: border-color .2s var(--ease); }
.pause-btn:hover { border-color: var(--ink-3); }
.pause-icon { width: 10px; height: 11px; background: linear-gradient(90deg, var(--ink) 0 3px, transparent 3px 7px, var(--ink) 7px); }
body.paused .pause-icon { background: var(--ink); clip-path: polygon(0 0, 100% 50%, 0 100%); }

/* --- Rail ------------------------------------------------------------------------ */
.rail { background: var(--bg-2); border-left: 1px solid var(--line); overflow-y: auto; display: flex; flex-direction: column; }
.asks, .feed-wrap { padding: 16px 14px 8px; }
.feed-wrap { border-top: 1px solid var(--line); flex: 1; }
.rail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.rail-head h2 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.count-badge { font: 600 11px var(--mono); background: var(--amber); color: #16181B; border-radius: 999px; padding: 1px 7px; }
.count-badge:empty { display: none; }
.live { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ink-2); padding-top: 2px; }
.decisions, .feed { list-style: none; margin: 0; padding: 0; }
.decision {
  background: linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,0) 40%), var(--panel);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px; margin-bottom: 8px;
  box-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 18px -14px rgba(0,0,0,.8);
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.decision:hover { border-color: var(--line-2); transform: translateY(-1px); }
.decision.high { border-color: var(--amber-line); background: linear-gradient(180deg, rgba(255,122,24,.07), rgba(255,122,24,0) 70%), var(--panel); }
.decision.approval { border-color: rgba(207,232,255,.22); }
.decision .who { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-3); margin-bottom: 3px; }
.decision .who .sw { width: 6px; height: 6px; border-radius: 2px; }
.decision .urgent { margin-left: auto; font: 500 11px var(--mono); color: var(--amber-ink); text-transform: uppercase; letter-spacing: .08em; }
.decision h3 { margin: 0; font: 600 13px/1.4 var(--sans); letter-spacing: 0; color: var(--ink); }
.decision .more { display: none; margin-top: 6px; color: var(--ink-2); font-size: 12.5px; }
.decision.open .more { display: block; }
.decision .hint {
  margin-top: 7px; font: 400 11.5px/1.5 var(--mono); background: var(--bg); border: 1px solid var(--line);
  padding: 7px 9px; border-radius: 7px; color: var(--ink); word-break: break-word;
}
.decision .mail { margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; background: var(--bg); font-size: 12px; }
.decision .mail div { display: flex; gap: 8px; }
.decision .mail span { width: 52px; flex: none; color: var(--ink-3); }
.decision .mail pre { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--line); white-space: pre-wrap; font: 12px/1.55 var(--sans); color: var(--ink); max-height: 220px; overflow: auto; }
.decision .row { display: none; gap: 6px; margin-top: 9px; align-items: center; }
.decision.open .row { display: flex; }
.decision:not(.open) { padding-top: 9px; padding-bottom: 9px; }
.decision:not(.open) h3 { font-weight: 500; color: var(--ink-2); }
.decision:not(.open):hover h3 { color: var(--ink); }
.asks-more { width: 100%; border: 1px dashed var(--line-2); background: none; color: var(--ink-2); border-radius: 10px;
  padding: 7px; font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.asks-more:hover { color: var(--ink); border-color: var(--ink-3); }
.decision .expand { border: 0; background: none; padding: 0; text-align: left; width: 100%; }
.btn-sm {
  border: 1px solid var(--line-2); background: transparent; color: var(--ink); padding: 4px 11px; border-radius: 7px;
  font-size: 12px; font-weight: 600; transition: border-color .2s var(--ease), background .2s var(--ease);
}
.btn-sm:hover { border-color: var(--ink-3); background: var(--panel-2); }
.btn-sm.dark { background: var(--ink); border-color: var(--ink); color: #16181B; }
.btn-sm.dark:hover { background: #fff; }
.decision.approval .btn-sm.dark, .decision.high .btn-sm.dark { background: var(--amber); border-color: var(--amber); }
.btn-sm:disabled { opacity: .45; }
.empty { color: var(--ink-3); font-size: 12.5px; padding: 6px 2px 12px; }
.feed li.feed-item {
  display: flex; gap: 10px; padding: 7px 6px; font-size: 12.5px; color: var(--ink-2); line-height: 1.4;
  cursor: pointer; border-radius: 8px; transition: background .2s var(--ease);
}
.feed-group { font: 600 11px var(--sans); color: var(--ink-3); padding: 10px 6px 4px; letter-spacing: .02em; }
.feed-group:first-child { padding-top: 0; }
.feed-top { display: flex; justify-content: space-between; gap: 8px; }
.feed-body { min-width: 0; flex: 1; }
.feed .feed-top .t { margin-top: 0; }
.feed li b { color: var(--ink); font-weight: 600; }
.feed li:hover { background: var(--panel); }
.feed li.fresh { animation: fresh 2.4s var(--ease); }
@keyframes fresh { from { background: var(--amber-dim); } to { background: transparent; } }
.feed .t { display: block; color: var(--ink-3); font: 11px var(--mono); margin-top: 2px; white-space: nowrap; }
.avatar {
  width: 26px; height: 26px; border-radius: 8px; flex: none; display: grid; place-items: center;
  font: 700 11px var(--disp); color: var(--ink); background: color-mix(in srgb, var(--av, #4A5057) 30%, var(--panel-2));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--av, #4A5057) 55%, transparent);
}
.avatar.hk { --av: #FF7A18; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; border-radius: 11px; }

/* --- Ask your CEO ---------------------------------------------------------------- */
.ask-wrap { position: sticky; bottom: 0; background: rgba(17,18,21,.94); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 10px 14px 12px; }
.ask-log { max-height: 220px; overflow-y: auto; margin-bottom: 8px; display: flex; flex-direction: column; gap: 6px; }
.ask-log .q { align-self: flex-end; background: var(--panel-3); border-radius: 10px 10px 2px 10px; padding: 6px 10px; font-size: 12.5px; max-width: 85%; }
.ask-log .a { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: 10px 10px 10px 2px; padding: 6px 10px; font-size: 12.5px; white-space: pre-wrap; max-width: 92%; color: var(--ink); }
.ask-log .a.pending { color: var(--ink-3); }
.ask-form { display: flex; gap: 6px; }
.ask-form input {
  flex: 1; min-width: 0; font: 13px var(--sans); padding: 9px 12px; color: var(--ink);
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel); caret-color: var(--amber);
}
.ask-form input::placeholder { color: var(--ink-3); }
.ask-form input:focus { outline: none; border-color: var(--amber-line); box-shadow: 0 0 0 3px var(--amber-dim); }
.ask-form button { width: 38px; border: 0; border-radius: 10px; background: var(--amber); color: #16181B; display: grid; place-items: center; }
.ask-form button:hover { background: #FF8A33; }

/* --- Drawer ------------------------------------------------------------------------ */
/* Pinned to the window, not the room: the page scrolls down to the recap, and a
   drawer opened from there (or from the CEO brief button) must open where you are. */
.drawer {
  position: fixed; top: 52px; right: 0; bottom: 0; width: var(--rail); background: var(--panel); overscroll-behavior: contain;
  border-left: 1px solid var(--line-2); box-shadow: -24px 0 48px -12px rgba(0,0,0,.6);
  transform: translateX(105%); transition: transform .32s var(--ease); z-index: 15;
  overflow-y: auto; padding: 18px 16px;
}
.drawer.open { transform: none; }
.drawer-close { position: absolute; top: 12px; right: 12px; border: 0; background: none; color: var(--ink-3); padding: 4px; border-radius: 6px; display: grid; place-items: center; }
.drawer-close:hover { color: var(--ink); background: var(--panel-3); }
.d-head { display: flex; gap: 12px; align-items: flex-start; padding-right: 24px; }
.d-head h2 { font-size: 20px; font-weight: 800; }
.status-chip { display: inline-block; margin-top: 6px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--panel-3); color: var(--ink-2); }
.status-chip.working { background: var(--ok-dim); color: #8FE3B6; }
.status-chip.waiting { background: var(--amber-dim); color: var(--amber-ink); }
.status-chip.blocked { background: var(--bad-dim); color: #F4A29C; }
.right-now { margin: 14px 0; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font-size: 13px; }
.right-now span { display: block; font: 500 11px var(--mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 3px; }
.d-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.d-tabs button { border: 0; background: none; padding: 7px 10px; font-weight: 500; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.d-tabs button:hover { color: var(--ink); }
.d-tabs button.active { color: var(--ink); border-bottom-color: var(--amber); font-weight: 600; }
.d-body p { margin: 0 0 12px; color: var(--ink-2); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 14px; }
.tile { border: 1px solid var(--line); border-radius: 9px; padding: 9px; background: var(--bg-2); }
.tile b { display: block; font: 600 18px var(--mono); color: var(--ink); }
.tile span { font-size: 11px; color: var(--ink-3); }
.d-section { font: 600 11.5px var(--sans); color: var(--ink-3); margin: 16px 0 7px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { font-size: 11.5px; padding: 3px 8px; border-radius: 6px; background: var(--panel-3); color: var(--ink-2); }
.latest { list-style: none; margin: 0; padding: 0; }
.latest li { display: grid; grid-template-columns: 56px 1fr; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.latest time { font: 400 11px var(--mono); color: var(--ink-3); padding-top: 1px; }
.latest small { display: block; color: var(--ink-3); font-size: 11.5px; }
.latest .task-done { margin-top: 5px; }
.blocked-note { background: var(--bad-dim); color: #F4A29C; border: 1px solid rgba(239,106,97,.3); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; margin-bottom: 12px; }
.waiting-box { border: 1px solid var(--amber-line); border-radius: 12px; padding: 4px 12px 10px; margin-bottom: 14px;
  background: linear-gradient(180deg, rgba(255,122,24,.06), rgba(255,122,24,0) 60%); }
.waiting-box .d-section { color: var(--amber-ink); margin-top: 10px; }
.w-list { list-style: none; margin: 0; padding: 0; }
.w-item { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--ink); display: grid; gap: 6px; }
.w-item:last-child { border-bottom: 0; }
.brief-acts { list-style: none; margin: 0 0 6px; padding: 0; }
.brief-acts li { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; padding: 6px 0;
  border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--ink); }
.brief-acts li:last-child { border-bottom: 0; }
.ba-who { color: var(--ink-3); }
.brief-card.fresh-brief { animation: fresh-brief 1.6s var(--ease); }
@keyframes fresh-brief { from { border-color: var(--amber-line); box-shadow: 0 0 0 3px var(--amber-dim); } to { border-color: var(--line); box-shadow: none; } }
.brief-card { border: 1px solid var(--line); border-radius: 12px; padding: 13px; margin-bottom: 14px; background: var(--bg-2); }
.brief-meta { font: 500 11px var(--mono); color: var(--ink-3); margin-bottom: 7px; }
.tag-rehearsal { color: var(--amber-ink); }
.brief-text { color: var(--ink) !important; font-size: 13.5px; line-height: 1.55; }
.priorities { margin: 0 0 10px; padding-left: 18px; font-size: 12.5px; color: var(--ink); }
.priorities li { margin-bottom: 4px; }
.priorities li::marker { color: var(--amber); font: 500 11px var(--mono); }
.brief-actions { display: flex; align-items: center; gap: 10px; margin: 8px 0 8px; }

/* --- Billing ----------------------------------------------------------------------- */
.billing { padding: 22px 24px 40px; max-width: 1400px; margin: 0 auto; }
.b-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.b-head h1 { font-size: 28px; font-weight: 800; }
.b-status { margin: 6px 0 0; display: flex; gap: 8px; flex-wrap: wrap; }
.b-status span { font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2); }
.b-status span.on { border-color: rgba(63,191,127,.35); color: #8FE3B6; }
.b-status span.off { border-color: var(--amber-line); color: var(--amber-ink); }
.b-form { background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; padding: 16px; margin-bottom: 18px; }
.f-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.f-grid .wide { grid-column: 1 / -1; }
.b-form label { display: grid; gap: 5px; font-size: 12px; color: var(--ink-2); font-weight: 500; }
.b-form input, .b-form select, .e-form input, .e-form select {
  font: 13px var(--sans); color: var(--ink); background: var(--bg); border: 1px solid var(--line-2);
  border-radius: 8px; padding: 8px 10px; min-width: 0; caret-color: var(--amber); color-scheme: dark;
}
.b-form input:focus, .b-form select:focus, .e-form input:focus, .e-form select:focus { outline: none; border-color: var(--amber-line); box-shadow: 0 0 0 3px var(--amber-dim); }
.f-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.f-msg { font-size: 12.5px; color: var(--ink-2); }
.f-msg.err { color: var(--bad); }
.chart-card { margin-bottom: 16px; }
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.chart-head h2 { margin: 0 0 2px !important; }
.chart-range { margin: 0; flex: 0 1 460px; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.chart-legend i.dash { background: repeating-linear-gradient(90deg, var(--ink-2) 0 4px, transparent 4px 7px); }
.chart-box { position: relative; }
.chart-box svg { width: 100%; height: auto; display: block; overflow: visible; }
.c-grid { stroke: var(--line); stroke-width: 1; }
.c-zero { stroke: var(--line-2); stroke-width: 1; }
.c-axis { fill: var(--ink-3); font: 11px var(--mono); }
.c-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.c-proj { stroke-dasharray: 6 4; }
.c-end { fill: var(--ink-2); font: 500 11px var(--sans); }
.c-dot { stroke: var(--panel); stroke-width: 2; }
.c-cross { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 2 3; }
.chart-tip { position: absolute; top: 8px; pointer-events: none; background: var(--panel-2); border: 1px solid var(--line-2);
  border-radius: 10px; padding: 8px 10px; font-size: 12px; min-width: 190px; box-shadow: 0 10px 24px -12px rgba(0,0,0,.8); }
.tip-when { color: var(--ink-3); font-size: 11px; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.tip-row b { margin-left: auto; color: var(--ink); font: 600 12px var(--mono); }
.tip-sw { width: 8px; height: 8px; border-radius: 2px; }
.tip-range { color: var(--ink-3); font: 11px var(--mono); margin: 0 0 3px 14px; }
.chart-foot { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; margin-top: 8px; }
.chart-assume { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 11.5px; color: var(--ink-3); }
.chart-assume span { color: var(--ink-2); font-weight: 600; }
.b-summary { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 0 0 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow: hidden; }
.b-summary div { padding: 12px 14px; border-right: 1px solid var(--line); }
.b-summary div:last-child { border-right: 0; }
.b-summary dt { font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.b-summary dd { margin: 0; font: 600 17px var(--mono); font-variant-numeric: tabular-nums; }
.b-summary dd.warn { color: var(--bad); }
.b-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
.b-side { display: grid; gap: 16px; }
.b-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.b-card h2 { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.table-wrap { overflow-x: auto; }
.b-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.b-table th { text-align: left; font-weight: 500; color: var(--ink-3); padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.b-table td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.b-table tr:last-child td { border-bottom: 0; }
.b-table .money { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.b-table th.money { text-align: right; }
.b-table .co { font-weight: 600; color: var(--ink); }
.b-table .muted { color: var(--ink-3); font-size: 12px; }
.b-table a { color: var(--ink); text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.b-table a:hover { text-decoration-color: var(--amber); }
.st { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--panel-3); color: var(--ink-2); white-space: nowrap; }
.st.open { background: rgba(207,232,255,.1); color: var(--live); }
.st.paid { background: var(--ok-dim); color: #8FE3B6; }
.st.overdue, .st.failed { background: var(--bad-dim); color: #F4A29C; }
.st.waiting { background: var(--amber-dim); color: var(--amber-ink); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pay-form { display: flex; gap: 6px; margin-top: 8px; }
.pay-form input { font: 12.5px var(--sans); color: var(--ink); background: var(--bg); border: 1px solid var(--line-2); border-radius: 7px; padding: 5px 8px; min-width: 0; color-scheme: dark; }
.pnl td.bar { width: 34%; }
.pnl .net { display: block; height: 6px; border-radius: 3px; background: var(--ok); opacity: .8; }
.pnl .net.neg { background: var(--bad); }
.e-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.e-form input[name=description] { grid-column: 1 / -1; }
.e-form .f-msg { grid-column: 1 / -1; }
.entries { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow-y: auto; }
.entries li { display: grid; grid-template-columns: 76px 1fr auto auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.entries time { font: 11.5px var(--mono); color: var(--ink-3); }
.entries .amt { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.entries .amt.in { color: #8FE3B6; }
.entries .del { border: 0; background: none; color: var(--ink-3); padding: 2px; display: grid; place-items: center; border-radius: 5px; }
.entries .del:hover { color: var(--bad); background: var(--panel-3); }
body.view-billing .layout, body.view-billing .dept-tabs, body.view-billing .tab-sep { display: none; }
/* A narrow room (a side pane, a small laptop): the launch card and the simulation
   HUD run full width along the bottom instead of squeezing between the legend and
   the controls, which lift above them by the card's measured height (--foot). */
.stage { container: room / inline-size; }
@media (min-width: 901px) {
  @container room (max-width: 1000px) {
    .closed-banner, .sim-hud { left: 16px; right: 16px; top: auto; bottom: 16px; transform: none; width: auto; max-width: none; }
    .rollup, .room-controls { bottom: calc(16px + var(--foot, 0px)); }
    .zoom-controls { bottom: calc(76px + var(--foot, 0px)); }
    .sim-hud .hud-assume { max-height: 30vh; }
  }
}
@media (max-width: 1100px) {
  .b-grid { grid-template-columns: 1fr; }
  .b-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .b-summary div:nth-child(3) { border-right: 0; }
  .b-summary div:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .billing { padding: 16px; }
  .f-grid { grid-template-columns: 1fr; }
  .b-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .b-summary div { border-right: 0; border-bottom: 1px solid var(--line); }
  .b-head { flex-direction: column; align-items: stretch; }
}

/* --- Tickets / Pipeline / Marketing ---------------------------------------------------- */
body.view-other .layout, body.view-other .dept-tabs, body.view-other .tab-sep, body.view-other .recap { display: none; }
.muted-p { color: var(--ink-3); font-size: 12.5px; margin: 0 0 10px; }
.b-form textarea, .t-detail textarea {
  font: 13px/1.55 var(--sans); color: var(--ink); background: var(--bg); border: 1px solid var(--line-2);
  border-radius: 8px; padding: 9px 11px; resize: vertical; caret-color: var(--amber); width: 100%;
}
.b-form textarea:focus, .t-detail textarea:focus { outline: none; border-color: var(--amber-line); box-shadow: 0 0 0 3px var(--amber-dim); }
.t-grid { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
.seg { display: flex; gap: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 3px; margin-bottom: 10px; }
.seg button { flex: 1; border: 0; background: none; color: var(--ink-2); padding: 5px 6px; border-radius: 6px; font-size: 12px; font-weight: 500; }
.seg button.active { background: var(--panel-3); color: var(--ink); }
.t-items { list-style: none; margin: 0; padding: 0; max-height: calc(100vh - 260px); overflow-y: auto; }
.t-items li { padding: 10px 8px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 7px; }
.t-items li:hover, .t-items li.sel { background: var(--panel-2); }
.t-items .top { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--ink-3); }
.t-items .subj { font-weight: 600; font-size: 13px; margin: 2px 0; color: var(--ink); }
.t-items .meta { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.t-detail h2 { font-size: 17px; margin-bottom: 4px; }
.t-detail .who { color: var(--ink-2); font-size: 12.5px; margin-bottom: 8px; }
.t-detail .summary-line { font-size: 12.5px; color: var(--ink-2); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 12px; }
.thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; max-height: 56vh; overflow-y: auto; padding-right: 4px; }
.msg-row { display: flex; gap: 8px; align-items: flex-start; max-width: 92%; }
.msg-row.out { align-self: flex-end; flex-direction: row-reverse; }
.msg-row .msg { max-width: none; }
.m-role { font-size: 10.5px; color: var(--ink-3); padding: 0 6px; border: 1px solid var(--line-2); border-radius: 999px; }
.m-head b { color: var(--ink); font-weight: 600; }
.msg { border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font-size: 13px; white-space: pre-wrap; max-width: 92%; }
.msg.in { background: var(--bg-2); border-top-left-radius: 3px; }
.msg.out { background: color-mix(in srgb, var(--amber) 9%, var(--panel-2)); border-color: var(--amber-line); border-top-right-radius: 3px; }
.msg .m-head { font-size: 11px; color: var(--ink-3); margin-bottom: 4px; white-space: normal; }
.draft-note { font-size: 12px; color: var(--amber-ink); margin: 0 0 6px; }
.p-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.p-col { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; min-height: 160px; }
.p-col h2 { font-size: 13px; font-weight: 700; display: flex; justify-content: space-between; margin: 2px 4px 10px; }
.p-col h2 span { font: 500 12px var(--mono); color: var(--ink-3); }
.deal { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; font-size: 12.5px; }
.deal .co { font-weight: 600; font-size: 13px; }
.deal .val { font-family: var(--mono); color: var(--ink-2); }
.deal .src { color: var(--ink-3); font-size: 11.5px; }
.deal .row-actions { margin-top: 8px; }
.deal select { font: 12px var(--sans); background: var(--bg); color: var(--ink); border: 1px solid var(--line-2); border-radius: 7px; padding: 3px 6px; color-scheme: dark; }
.m-preview { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; font-size: 14px; line-height: 1.65; max-width: 72ch; }
.m-preview h2, .m-preview h3 { margin: 18px 0 6px; }
.flow-card { margin-bottom: 16px; }
.flow-card .card-head { align-items: baseline; flex-wrap: wrap; }
.flow-board { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 10px; overflow-x: auto; }
.flow-col { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; min-height: 120px; }
.flow-col h3 { font: 600 12px var(--sans); color: var(--ink-2); display: flex; justify-content: space-between; margin: 2px 2px 8px; }
.flow-col h3 span { font: 500 11px var(--mono); color: var(--ink-3); }
.flow-item { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 8px; margin-bottom: 6px; font-size: 12px; }
.flow-item.stuck { border-color: var(--amber-line); }
.fi-title { color: var(--ink); font-weight: 600; margin: 5px 0 3px; line-height: 1.35; }
.fi-meta { color: var(--ink-3); font-size: 11px; }
.fi-meta.warn { color: var(--amber-ink); margin-top: 4px; }
.fi-notes { margin: 6px 0 0; padding-left: 14px; color: var(--ink-2); font-size: 11px; }
.pillar-chip { font: 600 11px var(--sans); padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2); }
.pillar-chip.p-assets { border-color: rgba(57,135,229,.5); }
.pillar-chip.p-inventory { border-color: rgba(201,133,0,.5); }
.pillar-chip.p-finance { border-color: rgba(213,81,129,.5); }
.pillar-chip.p-help { border-color: rgba(91,155,213,.55); }
.theme-list { list-style: none; margin: 0; padding: 0; counter-reset: th; }
.theme-list li { display: grid; grid-template-columns: 22px 1fr auto; gap: 4px 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); counter-increment: th; }
.theme-list li::before { content: counter(th); font: 600 12px var(--mono); color: var(--ink-3); padding-top: 1px; }
.theme-list b { font-weight: 600; color: var(--ink); }
.theme-list .meta { grid-column: 2 / 4; font-size: 12px; color: var(--ink-3); }
.theme-list .score { font: 600 12px var(--mono); color: var(--ink-2); }
.theme-list .bar { grid-column: 2 / 4; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.theme-list .bar span { display: block; height: 100%; background: var(--ink-3); border-radius: 2px; }
.theme-list li:first-child .bar span { background: var(--amber); }
.r-head { font-size: 14px; color: var(--ink); margin: 0 0 12px; }
.r-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 14px; }
.r-split h3 { font: 600 12px var(--sans); color: var(--ink-3); margin: 0 0 6px; }
.r-split ul { list-style: none; margin: 0; padding: 0; }
.r-split li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.r-split li span:last-child { font-family: var(--mono); color: var(--ink); }
.c-list { list-style: none; margin: 10px 0 0; padding: 0; }
.c-list li { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.c-list .c-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.c-list b { color: var(--ink); font-weight: 600; }
.c-list .c-url { font: 11px var(--mono); color: var(--ink-3); word-break: break-all; }
.c-list .c-change { margin-top: 6px; font-size: 12px; }
.n-preview { white-space: pre-wrap; font: 12.5px/1.55 var(--sans); color: var(--ink-2); background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; max-height: 320px; overflow-y: auto; margin: 8px 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.card-head h2 { margin: 0 !important; }
.seo-score { display: flex; gap: 14px; align-items: center; margin-bottom: 6px; }
.seo-ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--panel-3) 0); }
.seo-ring b { width: 52px; height: 52px; border-radius: 50%; background: var(--panel); display: grid; place-items: center;
  font: 700 18px var(--mono); }
.seo-meta { font-size: 13px; color: var(--ink); }
.seo-delta { font: 500 11.5px var(--mono); }
.seo-delta.up { color: #8FE3B6; } .seo-delta.down { color: #F4A29C; }
.seo-list { list-style: none; margin: 0; padding: 0; }
.seo-list > li { border-bottom: 1px solid var(--line); padding: 7px 0; font-size: 12.5px; display: flex; justify-content: space-between; gap: 8px; }
.seo-list details { width: 100%; }
.seo-list summary { display: flex; gap: 8px; align-items: center; cursor: pointer; list-style: none; }
.seo-list summary::-webkit-details-marker { display: none; }
.seo-list summary span:first-child { flex: 1; }
.seo-count { font: 600 12px var(--mono); color: var(--ink-2); }
.seo-urls { list-style: none; margin: 6px 0 2px; padding: 0 0 0 10px; font: 12px var(--mono); }
.seo-urls a { color: var(--ink-2); text-underline-offset: 3px; }
.social-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.social-list > li { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--bg-2); }
.social-list > li.posted { opacity: .6; }
.social-list pre { margin: 0 0 8px; white-space: pre-wrap; font: 12.5px/1.5 var(--sans); color: var(--ink); }
.m-import { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.file-btn { cursor: pointer; display: inline-block; }
.m-counts { display: flex; gap: 18px; margin: 0 0 10px; flex-wrap: wrap; }
.m-counts dt { font-size: 11.5px; color: var(--ink-3); }
.m-counts dd { margin: 0; font: 600 15px var(--mono); }
.m-paused { border: 1px solid var(--amber-line); background: var(--amber-dim); border-radius: 10px; padding: 10px 12px;
  margin-bottom: 12px; font-size: 13px; color: var(--ink); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.m-paused strong { color: var(--amber-ink); }
.web-card { margin-bottom: 16px; }
.web-card .card-head { align-items: baseline; flex-wrap: wrap; gap: 10px; }
.web-card .card-head .btn-sm { margin-left: auto; }
.w-weeks { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; align-items: end; height: 120px;
  margin: 4px 0 16px; }
.w-week { display: grid; grid-template-rows: 1fr auto auto; height: 100%; text-align: center; gap: 3px; }
.w-bar { align-self: end; height: max(2px, var(--h)); background: var(--amber); border-radius: 4px 4px 0 0; opacity: .85; }
.w-week:hover .w-bar { opacity: 1; }
.w-week b { font: 600 12.5px var(--mono); color: var(--ink); }
.w-week span:last-child { font: 11px var(--mono); color: var(--ink-3); }
.w-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.w-cols h3 { font: 600 12px var(--sans); color: var(--ink-2); margin: 0 0 6px; text-transform: none; }
.w-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.w-list li { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; border-bottom: 1px solid var(--line);
  padding: 3px 0; }
.w-list li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.w-list li b { font: 600 12.5px var(--mono); color: var(--ink-2); }
.muted-p.warn { color: var(--amber-ink); }
@media (max-width: 720px) {
  .w-cols { grid-template-columns: 1fr; }
}
@media (max-width: 1000px) {
  .t-grid { grid-template-columns: 1fr; }
  .p-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .p-board { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; }
}

/* --- Login ------------------------------------------------------------------------- */
body.login { display: grid; place-items: center; min-height: 100vh; padding: 16px;
  background: radial-gradient(60% 50% at 50% 40%, rgba(207,232,255,.06), transparent 70%), var(--bg); }
.login-card { background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; padding: 26px; width: 100%; max-width: 360px; display: grid; gap: 10px; box-shadow: 0 30px 60px -30px rgba(0,0,0,.8); }
.login-card .brand { margin-bottom: 8px; }
.login-card label { font-weight: 600; font-size: 13px; }
.login-card input { font: 14px var(--mono); padding: 10px 11px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg); color: var(--ink); caret-color: var(--amber); }
.login-card input:focus { outline: none; border-color: var(--amber-line); box-shadow: 0 0 0 3px var(--amber-dim); }
.login-card button { border: 0; background: var(--amber); color: #16181B; padding: 10px; border-radius: 8px; font-weight: 600; }
.login-card .error { margin: 0; color: var(--bad); font-size: 12.5px; }

/* --- Narrow screens --------------------------------------------------------------------- */
@media (max-width: 1700px) {
  .dept-tabs, .tab-sep { display: none; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .stage { display: flex; flex-direction: column; gap: 12px; padding: 16px; overflow: visible; }
  .hello { position: static; max-width: none; order: 0; }
  .scene-wrap { position: relative; inset: auto; height: min(78vw, 62vh); padding: 0; order: 1; }
  .closed-banner { position: static; transform: none; width: auto; max-width: none; order: 2; }
  .room-controls { position: static; justify-content: flex-end; order: 3; }
  .rollup, .vitals, .clock { display: none; }
  .zoom-controls { position: static; order: 3; flex-direction: row; align-self: flex-start; }
  .zoom-controls button + button { border-top: 0; border-left: 1px solid var(--line); }
  .sim-hud { width: auto; }
  .hello-kpis { grid-template-columns: repeat(4, auto); }
  .chief-btn span { display: none; }
  .rail { border-left: 0; border-top: 1px solid var(--line); }
  .drawer { position: fixed; top: 52px; width: min(100%, var(--rail)); }
  .bubble { display: none !important; }
}
@media (max-width: 560px) {
  .dept-tabs, .working-chip, .chief-btn { display: none; }
  .topbar { gap: 10px; }
  .hello h1 { font-size: 24px; }
  .summary { font-size: 12.5px; }
  .scene-wrap { height: 78vw; }
  .hello-kpis { grid-template-columns: repeat(2, auto); }
  .pill { padding: 2px 7px 2px 6px; gap: 5px; }
  .pill .tag { display: none; }
  .agent-label.status-idle, .agent-label.status-empty { display: none; }
  .brand small, .demo-badge { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Kavrix Discovery content */
.article-preview { border: 1px solid var(--line-2); border-radius: 10px; padding: 14px 16px; margin: 12px 0; max-height: 520px; overflow: auto; line-height: 1.55; }
.article-preview h2, .article-preview h3 { font-size: 15px; margin: 14px 0 6px; }
.article-preview blockquote { border-left: 3px solid var(--line-2); margin: 8px 0; padding-left: 10px; color: var(--ink-2); }
.social-draft { border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.social-draft pre { white-space: pre-wrap; font-family: inherit; font-size: 13px; margin: 6px 0 8px; }
.social-draft .k { font-size: 11.5px; color: var(--ink-3); text-transform: none; }

/* Kavrix Store tab */
.sub-h { font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 16px 0 6px; }
.card-head a.btn-sm { margin-left: auto; text-decoration: none; color: inherit; }
.stage-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.stage-btns .btn-sm[aria-pressed="true"] { border-color: var(--amber-line); color: var(--ink); }
.b-table td.num, .b-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.b-table .down { color: var(--amber); font-weight: 600; }
