/* "Watch it work" story player. Uses the token names defined in index.html. */
.st-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; }
.st-head > div:first-child { flex: 1 1 auto; min-width: 0; }
.st-head h1 { max-width: 720px; }
.st-controls { display: flex; gap: 8px; align-items: center; flex: none; }
#stClock { min-width: 140px; text-align: right; }
#stPlay { min-width: 108px; }
@media (max-width: 980px) {
  .st-head { flex-wrap: wrap; }
  .st-controls { flex-wrap: wrap; }
  #stClock { min-width: 0; text-align: left; }
}
.st-controls .btn { min-width: 44px; }
.st-clock { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); padding: 0 6px; white-space: nowrap; }
.st-clock b { color: var(--text-primary); font-weight: 600; }

.st-chapters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 14px; padding-bottom: 2px; }
.st-chapters::-webkit-scrollbar { display: none; }
.st-ch { appearance: none; cursor: pointer; white-space: nowrap; min-height: 36px; padding: 0 12px; border-radius: 999px; font-size: 12px; border: 1px solid var(--border-strong); background: var(--bg-card); color: var(--text-muted); }
.st-ch .n { font-family: var(--font-mono); color: var(--text-subtle); margin-right: 6px; }
.st-ch.done { color: var(--success); border-color: transparent; background: var(--success-bg); }
.st-ch.done .n { color: var(--success); }
.st-ch.on { color: var(--brand); border-color: var(--brand-border); background: var(--brand-subtle); font-weight: 600; }
.st-ch.on .n { color: var(--brand); }

.st-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.st-stat { background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 14px; min-width: 0; }
.st-stat .l { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-subtle); }
.st-stat .v { font-family: var(--font-mono); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 2px; }
.st-stat .d { font-size: 11px; color: var(--text-muted); }
.st-stat.bump .v { color: var(--success); transition: color 0.6s; }

.st-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.st-stage { min-height: 520px; min-width: 0; }
.st-where { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.st-app { font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; padding: 3px 9px; border-radius: 6px; background: var(--bg-secondary); border: 1px solid var(--border-strong); color: var(--text-secondary); }
.st-where .ctx { font-size: 13px; color: var(--text-muted); }
.st-enter { animation: stIn 0.35s ease both; }
@keyframes stIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Console feed (always dark, like a terminal; colors come from the --console-* tokens in app.css) */
.st-console { background: var(--console-bg); border: 1px solid var(--console-border); border-radius: 12px; overflow: hidden; position: sticky; top: 76px; }
.st-console-bar { display: flex; align-items: center; gap: 8px; padding: 9px 13px; background: var(--console-bar); border-bottom: 1px solid var(--console-divider); }
.st-dot { width: 9px; height: 9px; border-radius: 999px; }
.st-dot.r { background: var(--console-red); } .st-dot.y { background: var(--console-warn); } .st-dot.g { background: var(--console-ok); }
.st-console-title { font-family: var(--font-mono); font-size: 11px; color: var(--console-title); margin-left: 6px; }
.st-live { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; color: var(--console-work); display: flex; align-items: center; gap: 6px; }
.st-live i { width: 6px; height: 6px; border-radius: 999px; background: var(--console-ok); }
.st-live.on i { animation: stPulse 0.6s infinite alternate; }
@keyframes stPulse { to { opacity: 0.25; } }
.st-feed { padding: 12px 14px; font-family: var(--font-mono); font-size: 11.5px; line-height: 1.7; color: var(--console-text); max-height: 560px; overflow-y: auto; }
.st-feed .when { color: var(--console-dim); margin: 8px 0 2px; font-size: 10.5px; }
.st-feed .when:first-child { margin-top: 0; }
.st-ln { display: flex; gap: 9px; align-items: baseline; }
.st-ln.new { animation: stIn 0.3s ease both; }
.st-ln .tk { flex-shrink: 0; width: 13px; text-align: center; }
.st-ln .tk.ok { color: var(--console-ok); } .st-ln .tk.work { color: var(--console-work); } .st-ln .tk.warn { color: var(--console-warn); } .st-ln .tk.you { color: var(--console-you); }
.st-ln .tx { overflow-wrap: anywhere; }
.st-ln .tx em { color: var(--console-em); font-style: normal; font-weight: 600; }
.st-ln .tx .dim { color: var(--console-dim-2); }
.st-ln.alert .tx { color: var(--console-alert); } .st-ln.alert .tx em { color: var(--console-alert-em); }
.st-feed .idle { color: var(--console-dim); padding: 24px 0; text-align: center; }

/* Gate (needs a person) */
.st-gate { margin-top: 16px; border: 1px solid var(--brand-border); background: var(--brand-subtle); border-radius: 12px; padding: 16px 18px; }
.st-gate .who { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brand); }
.st-gate h3 { margin-top: 4px; }
.st-gate p { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.st-gate .btn.primary { animation: stGlow 0.8s ease-in-out infinite alternate; }
@keyframes stGlow { to { box-shadow: 0 0 0 5px var(--brand-subtle); } }
.st-gate.ok { border-color: transparent; background: var(--success-bg); }
.st-gate.ok .who { color: var(--success); }

/* Intro + connect */
.st-intro { display: grid; place-items: center; text-align: center; min-height: 460px; gap: 12px; padding: 20px; }
.st-intro h2 { max-width: 520px; }
.st-intro p { color: var(--text-muted); max-width: 520px; }
.st-intro .btn.primary { min-height: 48px; padding: 0 22px; font-size: 14px; }
.st-conns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.st-conn { border: 1px solid var(--border-strong); border-radius: 10px; padding: 14px; background: var(--bg-surface); }
.st-conn .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.st-conn .nm { font-weight: 600; }
.st-conn .what { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.st-conn .cnt { font-family: var(--font-mono); font-size: 12px; color: var(--text-primary); margin-top: 8px; min-height: 18px; }
.st-state { font-size: 11px; font-weight: 600; white-space: nowrap; }
.st-state.wait { color: var(--text-subtle); } .st-state.read { color: var(--brand); } .st-state.done { color: var(--success); }
.st-note { font-size: 12px; color: var(--text-muted); margin-top: 14px; }

/* Map */
.st-maprow { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr) 92px; gap: 12px; align-items: center; padding: 6px 0; font-size: 13px; }
.st-maprow .nm { color: var(--text-secondary); }
.st-bars { position: relative; height: 16px; }
.st-bars .doc { position: absolute; left: 0; top: 0; height: 16px; border: 1.5px dashed var(--text-subtle); border-radius: 4px; }
.st-bars .act { position: absolute; left: 0; top: 4px; height: 8px; border-radius: 4px; background: var(--brand); }
.st-bars .act.slow { background: var(--warning); }
.st-maprow .dd { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); text-align: right; white-space: nowrap; }
.st-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--text-muted); margin: 6px 0 12px; }
.st-find { border-left: 3px solid var(--warning); background: var(--warning-bg); border-radius: 0 8px 8px 0; padding: 9px 12px; margin-top: 8px; font-size: 13px; color: var(--text-secondary); }
.st-find b { color: var(--text-primary); }
.st-find.catch { border-left-width: 4px; }

/* Limits */
.st-limit { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: center; }
.st-limit:last-child { border-bottom: 0; }
.st-limit .a { font-size: 13px; color: var(--text-primary); }
.st-limit .m { font-size: 12px; color: var(--text-muted); grid-column: 1; }
.st-limit .lv { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 6px; align-items: center; }
.st-lock { font-size: 11px; color: var(--text-subtle); }

/* Chat (Slack-style) */
.st-chat { border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; }
.st-chat-h { padding: 10px 14px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13px; background: var(--bg-surface); }
.st-chat-h span { font-weight: 400; color: var(--text-muted); font-size: 12px; margin-left: 6px; }
.st-msgs { padding: 6px 14px 12px; }
.st-msg { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; padding: 10px 0; }
.st-av { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--bg-secondary); color: var(--text-secondary); border: 1px solid var(--border-strong); }
.st-av.agent { background: var(--brand); color: var(--on-brand); border-color: transparent; }
.st-mh { font-size: 13px; font-weight: 600; }
.st-mh .tag { font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: var(--brand-subtle); color: var(--brand); margin-left: 6px; vertical-align: 1px; }
.st-mh .t { font-weight: 400; font-size: 11px; color: var(--text-subtle); margin-left: 6px; }
.st-mb { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.st-mb pre { margin-top: 8px; background: var(--code-bg); border: 1px solid var(--border); border-radius: 6px; padding: 10px; font-family: var(--font-mono); font-size: 11.5px; line-height: 1.6; overflow-x: auto; color: var(--text-secondary); }
.st-msg.draft .st-mb { border: 1px dashed var(--brand-border); border-radius: 8px; padding: 8px 10px; background: var(--brand-subtle); }
.st-sys { font-size: 11.5px; color: var(--text-subtle); text-align: center; padding: 6px 0; font-family: var(--font-mono); }
.st-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.st-file { font-family: var(--font-mono); font-size: 11px; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--bg-surface); color: var(--text-muted); }

/* Email */
.st-mail { border: 1px solid var(--border-strong); border-radius: 10px; padding: 14px; margin-bottom: 10px; background: var(--bg-surface); }
.st-mail.draft { border-style: dashed; border-color: var(--brand-border); }
.st-mail .hd { font-family: var(--font-mono); font-size: 11px; color: var(--text-subtle); line-height: 1.6; }
.st-mail .sj { font-weight: 600; margin: 6px 0; }
.st-mail .bd { font-size: 13px; color: var(--text-secondary); }

/* Logs */
.st-log { display: grid; grid-template-columns: 50px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); }
.st-log:last-of-type { border-bottom: 0; }
.st-log .id { font-family: var(--font-mono); font-size: 11px; color: var(--text-subtle); }
.st-log .ev { font-family: var(--font-mono); font-size: 12px; color: var(--text-primary); overflow-wrap: break-word; }
.st-log .ev small { display: block; font-family: var(--font-body); font-size: 11px; color: var(--text-muted); }
.st-res { font-size: 12px; font-weight: 600; white-space: nowrap; }
.st-res.pass { color: var(--success); } .st-res.fail { color: var(--error); } .st-res.run { color: var(--brand); }

/* Build */
.st-build { display: grid; gap: 8px; }
.st-bf { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--bg-surface); }
.st-bf .ic { color: var(--success); font-weight: 700; }
.st-bf .fn { font-family: var(--font-mono); font-size: 12px; color: var(--text-primary); overflow-wrap: anywhere; }
.st-bf .ds { font-size: 11px; color: var(--text-muted); }

/* Record */
.st-rec { border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; }
.st-rec-h { padding: 10px 14px; background: var(--bg-surface); border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13px; }
.st-field { display: grid; grid-template-columns: minmax(0, 160px) minmax(0, 1fr); gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.st-field:last-child { border-bottom: 0; }
.st-field .k { color: var(--text-subtle); font-family: var(--font-mono); font-size: 11px; padding-top: 2px; }
.st-field .old { color: var(--text-subtle); text-decoration: line-through; margin-right: 8px; }
.st-field .new { color: var(--success); font-weight: 600; }
.st-field .bad { color: var(--warning); font-weight: 600; }
.st-catch { margin-top: 14px; border: 1px solid var(--warning); background: var(--warning-bg); border-radius: 10px; padding: 12px 14px; }
.st-catch .h { color: var(--warning); font-weight: 700; font-size: 14px; }
.st-catch p { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* Live + results */
.st-livecard { border: 1px solid var(--success); background: var(--success-bg); border-radius: 12px; padding: 18px; text-align: center; }
.st-livecard .big { font-size: 22px; font-weight: 700; color: var(--success); margin-top: 6px; }
.st-livecard .evt { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); margin-top: 8px; }
.st-impact { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.st-imp { border: 1px solid var(--border-strong); border-radius: 10px; padding: 12px 14px; background: var(--bg-surface); }
.st-imp .k { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-subtle); }
.st-imp .v { font-size: 20px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.st-imp .v .from { color: var(--text-subtle); text-decoration: line-through; font-weight: 500; margin-right: 6px; font-size: 16px; }
.st-imp .s { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.st-foot { font-size: 12px; color: var(--text-muted); margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }

@media (max-width: 980px) {
  .st-grid { grid-template-columns: minmax(0, 1fr); }
  .st-console { position: static; }
  .st-feed { max-height: 300px; }
  .st-stage { min-height: 0; }
}
@media (max-width: 600px) {
  .st-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-conns, .st-impact { grid-template-columns: minmax(0, 1fr); }
  .st-maprow { grid-template-columns: minmax(0, 1fr) 80px; }
  .st-maprow .st-bars { grid-column: 1 / -1; grid-row: 2; }
  .st-log { grid-template-columns: 44px minmax(0, 1fr); }
  .st-log .st-res { grid-column: 2; }
  .st-field { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .st-controls { width: 100%; }
}

/* Scoreboard: onboarding completion + leading indicators */
.st-score { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 3fr); gap: 10px; margin-bottom: 14px; }
.st-outcome, .st-ind { background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 14px; min-width: 0; transition: border-color 0.5s; }
.st-outcome .l, .st-ind .l { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-subtle); }
.st-outcome .nums { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.st-outcome .today { font-family: var(--font-mono); font-size: 24px; font-weight: 600; color: var(--text-secondary); }
.st-outcome .pred { font-family: var(--font-mono); font-size: 28px; font-weight: 700; color: var(--success); }
.st-outcome .arrow { color: var(--text-subtle); }
.st-outcome .lbl { font-size: 11px; color: var(--text-muted); }
.st-outcome .calc, .st-ind .calc { font-size: 13px; font-weight: 400; color: var(--text-muted); font-family: var(--font-body); }
.st-outcome .meter { position: relative; height: 10px; border-radius: 5px; background: var(--bg-secondary); margin: 10px 0 20px; }
.st-outcome .meter .now { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px 0 0 5px; background: var(--text-subtle); }
.st-outcome .meter .gain { position: absolute; top: 0; bottom: 0; background: var(--success); }
.st-outcome .meter .range { position: absolute; top: -3px; bottom: -3px; border: 1.5px solid var(--success); border-radius: 4px; opacity: 0.55; }
.st-outcome .meter .goal { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--brand); }
.st-outcome .meter .goal span { position: absolute; top: 18px; left: 1px; width: 0; display: flex; justify-content: center; font-family: var(--font-mono); font-size: 10px; color: var(--brand); white-space: nowrap; }
.st-outcome .d, .st-ind .d { font-size: 11px; color: var(--text-muted); }
.st-inds { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.st-ind .v { font-family: var(--font-mono); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.25; margin: 4px 0 2px; }
.st-ind .v .from { font-size: 13px; font-weight: 500; color: var(--text-subtle); text-decoration: line-through; margin-right: 6px; }
.st-ind.better .v { color: var(--success); }
.st-outcome.bump, .st-ind.bump { border-color: var(--success); }
.st-driver { font-size: 13px; color: var(--text-secondary); margin-top: 12px; }
@media (max-width: 1080px) { .st-score { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .st-inds { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) { .st-inds { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.st-outcome-top { display: flex; justify-content: space-between; align-items: center; gap: 4px 10px; flex-wrap: wrap; }
@media (max-width: 600px) { .st-ch { min-height: 44px; } }
