:root {
  --sp-red: #CF1019;
  --sp-red-hover: #DD585F;
  --bg: #000;
  --surface: #121212;
  --surface-2: #1B1B1B;
  --border: #2A2A2A;
  --text: #fff;
  --muted: #BBBBBB;
  --subtle: #808080;
  --ok: #84BD00;
  --warn: #FDC32D;
  --bad: #FF3B3B;
  --info: #4C8DFF;
  --font-display: "Archivo", "Archivo Black", sans-serif;
  --font-cond: "Anton", "Bebas Neue", sans-serif;
  --font-body: "Montserrat", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --pill: 22.7px;
  --r: 4px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 14px; }
body { min-height: 100vh; }
button { font-family: inherit; }
a { color: inherit; }

/* Top bar */
.top {
  display: flex; align-items: center; gap: 16px; padding: 12px 20px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #000; z-index: 20;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 30px; width: 30px; }
.brand-name { font-family: var(--font-display); font-stretch: 125%; font-weight: 900; text-transform: uppercase; font-size: 17px; letter-spacing: .25px; line-height: 1; }
.brand-name span { color: var(--sp-red); }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: .2em; text-transform: uppercase; margin-top: 3px; }
.event { margin-left: 8px; padding-left: 16px; border-left: 1px solid var(--border); }
.event b { display: block; font-size: 13px; }
.event small { color: var(--muted); font-size: 12px; }
.spacer { flex: 1; }
.concept { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; }

/* Buttons */
.btn {
  height: 36px; padding: 0 16px; border-radius: var(--pill); border: 0; cursor: pointer;
  text-transform: uppercase; letter-spacing: .04em; font-weight: 700; font-size: 12px;
  background: var(--sp-red); color: #fff; transition: background .2s ease;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { background: var(--sp-red-hover); }
.btn.dark { background: #2A2A2A; }
.btn.dark:hover { background: #3A3A3A; }
.btn.ghost { background: transparent; border: 1px solid #555; }
.btn.ghost:hover { background: #1F1F1F; }
.btn.sm { height: 28px; padding: 0 12px; font-size: 11px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* Tabs */
.tabs { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--border); background: #000; position: sticky; top: 61px; z-index: 19; overflow-x: auto; }
.tab {
  background: none; border: 0; color: var(--muted); padding: 14px 14px 12px; cursor: pointer;
  text-transform: uppercase; letter-spacing: .08em; font-weight: 800; font-size: 12px; border-bottom: 3px solid transparent;
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
.tab.on { color: #fff; border-bottom-color: var(--sp-red); }
.count { background: var(--sp-red); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; font-weight: 700; letter-spacing: 0; }
.count.grey { background: #333; }

.daytoggle { display: inline-flex; border: 1px solid #444; border-radius: 999px; overflow: hidden; }
.daytoggle button { background: none; border: 0; color: var(--muted); padding: 7px 14px; font-weight: 700; font-size: 12px; cursor: pointer; text-transform: uppercase; letter-spacing: .04em; }
.daytoggle button.on { background: #fff; color: #000; }

main { padding: 20px; max-width: 1500px; margin: 0 auto; }
.view { display: none; }
.view.on { display: block; }

h1, h2, h3 { font-family: var(--font-display); font-stretch: 125%; font-weight: 900; text-transform: uppercase; letter-spacing: .25px; margin: 0; line-height: 1.04; }
h1 { font-size: 26px; }
h2 { font-size: 16px; }
h3 { font-size: 13px; }
.eyebrow { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.lede { color: var(--muted); max-width: 760px; margin: 8px 0 0; line-height: 1.5; }
.head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }

/* Alerts strip */
.alerts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 18px; }
.alert {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; cursor: pointer; text-align: left; color: inherit;
}
.alert:hover { background: var(--surface-2); }
.alert.on { outline: 2px solid #fff; }
.alert .n { font-family: var(--font-cond); font-size: 30px; line-height: 1; }
.alert .l { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 600; }
.alert.bad .n { color: var(--bad); }
.alert.warn .n { color: var(--warn); }
.alert.ok .n { color: var(--ok); }

/* Wave board */
.board-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.lane { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
.lane-head { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: #fff; }
.lane-head .meta { margin-left: auto; color: var(--muted); font-size: 12px; font-family: var(--font-mono); }
.wave { padding: 10px 14px; border-bottom: 1px solid #1E1E1E; cursor: pointer; display: grid; grid-template-columns: 62px 1fr; gap: 10px; align-items: center; }
.wave:last-child { border-bottom: 0; }
.wave:hover { background: var(--surface-2); }
.wave.dim { opacity: .35; }
.wave .time { font-family: var(--font-cond); font-size: 24px; line-height: 1; }
.wave .row1 { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.wave .row1 b { color: #fff; font-family: var(--font-mono); }
.bar { height: 6px; background: #2A2A2A; border-radius: 3px; margin: 6px 0 4px; overflow: hidden; position: relative; }
.bar i { display: block; height: 100%; background: #fff; }
.bar i.over { background: var(--bad); }
.bar i.warn { background: var(--warn); }
.flags { display: flex; gap: 4px; flex-wrap: wrap; }
.flag { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 3px; background: #2A2A2A; color: #ddd; }
.flag.bad { background: rgba(255, 59, 59, .18); color: #FF8A8A; }
.flag.warn { background: rgba(253, 195, 45, .16); color: var(--warn); }
.flag.ok { background: rgba(132, 189, 0, .16); color: var(--ok); }
.flag.info { background: rgba(76, 141, 255, .16); color: #9DBEFF; }

/* Side panel */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); position: sticky; top: 120px; max-height: calc(100vh - 140px); display: flex; flex-direction: column; }
.panel-head { padding: 14px; border-bottom: 1px solid var(--border); }
.panel-body { overflow-y: auto; }
.req { padding: 12px 14px; border-bottom: 1px solid #1E1E1E; }
.req .who { font-weight: 700; }
.req .move { font-family: var(--font-mono); font-size: 12px; margin: 4px 0; color: var(--muted); }
.req .move b { color: #fff; }
.req .note { font-size: 12px; color: var(--muted); font-style: italic; margin: 4px 0 8px; }
.req .verdict { font-size: 12px; margin-bottom: 8px; display: flex; gap: 6px; align-items: flex-start; line-height: 1.4; }
.req .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.req.done { opacity: .5; }

/* Drawer */
.drawer-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 40; display: none; }
.drawer-bg.on { display: block; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: #0B0B0B; border-left: 1px solid var(--border); z-index: 41; transform: translateX(100%); transition: transform .25s ease; display: flex; flex-direction: column; }
.drawer.on { transform: none; }
.drawer-head { padding: 18px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: flex-start; }
.drawer-body { padding: 0 18px 18px; overflow-y: auto; }
.x { margin-left: auto; background: none; border: 1px solid #444; color: #fff; border-radius: 50%; width: 32px; height: 32px; cursor: pointer; font-size: 16px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--subtle); font-weight: 700; padding: 10px 8px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #0B0B0B; }
td { padding: 8px; border-bottom: 1px solid #1A1A1A; vertical-align: middle; }
td.mono, .mono { font-family: var(--font-mono); font-size: 12px; }
select, input[type=text], input[type=search], textarea {
  background: #1A1A1A; color: #fff; border: 1px solid #333; border-radius: var(--r); padding: 8px 10px; font-family: inherit; font-size: 13px;
}
select:focus, input:focus, textarea:focus { outline: 2px solid var(--sp-red); outline-offset: 0; border-color: transparent; }

/* Check-in */
.ci-grid { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 18px; align-items: start; }
.clock { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; }
.clock .now { font-family: var(--font-cond); font-size: 56px; line-height: 1; }
.clock input[type=range] { width: 100%; accent-color: var(--sp-red); margin: 12px 0; }
.scan { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; margin-top: 14px; }
.scan input { width: 100%; font-size: 18px; padding: 12px; font-family: var(--font-mono); }
.scan-result { margin-top: 12px; border-radius: var(--r); padding: 14px; background: #1A1A1A; border: 1px solid #333; }
.scan-result.ok { border-color: rgba(132,189,0,.5); background: rgba(132,189,0,.08); }
.scan-result.warn { border-color: rgba(253,195,45,.5); background: rgba(253,195,45,.07); }
.scan-result.bad { border-color: rgba(255,59,59,.5); background: rgba(255,59,59,.08); }
.scan-result .big { font-family: var(--font-cond); font-size: 32px; line-height: 1.05; }
.scan-result .sub { color: var(--muted); margin-top: 4px; }
.hint { font-size: 12px; color: var(--subtle); margin-top: 8px; line-height: 1.5; }
.hint code { color: #ddd; font-family: var(--font-mono); cursor: pointer; text-decoration: underline dotted; }

.waves-ci { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.wci { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 12px; }
.wci.ok .pct { color: var(--ok); }
.wci.warn { border-color: rgba(253,195,45,.5); }
.wci.warn .pct { color: var(--warn); }
.wci.bad { border-color: rgba(255,59,59,.6); background: rgba(255,59,59,.07); }
.wci.bad .pct { color: var(--bad); }
.wci.gone { opacity: .45; }
.wci .t { display: flex; justify-content: space-between; align-items: baseline; }
.wci .t .time { font-family: var(--font-cond); font-size: 26px; }
.wci .pct { font-family: var(--font-cond); font-size: 26px; }
.wci .s { font-size: 12px; color: var(--muted); }
.callouts { margin-bottom: 14px; display: grid; gap: 8px; }
.callout { background: rgba(253,195,45,.07); border: 1px solid rgba(253,195,45,.45); padding: 12px 14px; border-radius: var(--r); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.callout.bad { background: rgba(255,59,59,.08); border-color: rgba(255,59,59,.5); }
.callout p { margin: 0; flex: 1; min-width: 220px; line-height: 1.45; }

/* Inbox */
.inbox { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 18px; align-items: start; }
.mlist { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
.m { padding: 12px 14px; border-bottom: 1px solid #1E1E1E; cursor: pointer; }
.m:hover { background: var(--surface-2); }
.m.on { background: #2a1214; box-shadow: inset 0 0 0 1px #cf101966; }
.m.done { opacity: .45; }
.m .r1 { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.m .r1 b { color: #fff; font-size: 13px; }
.m .subj { margin: 3px 0 6px; font-weight: 600; }
.mview { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 18px; }
.mview .body { white-space: pre-wrap; line-height: 1.55; background: #0B0B0B; padding: 14px; border-radius: var(--r); border: 1px solid #222; }
.mview textarea { width: 100%; min-height: 220px; line-height: 1.5; resize: vertical; }
.ctx { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 14px 0; }
.ctx div { background: #0B0B0B; border: 1px solid #222; border-radius: var(--r); padding: 8px 10px; }
.ctx small { display: block; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--subtle); }
.ctx b { font-family: var(--font-mono); font-size: 13px; }
.policy { font-size: 12px; color: var(--muted); background: #0B0B0B; border: 1px solid #222; border-radius: var(--r); padding: 6px 10px; margin: 6px 0; }
.held { background: rgba(255, 59, 59, .1); border: 1px solid rgba(255, 59, 59, .35); color: #FFB3B3; padding: 10px 12px; border-radius: var(--r); margin: 12px 0; font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sec { margin-top: 16px; }

/* Sheet */
.sheet-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px; }
.stat .n { font-family: var(--font-cond); font-size: 34px; line-height: 1; }
.stat .l { font-size: 12px; color: var(--muted); margin-top: 4px; }
.tablebox { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); max-height: 420px; overflow: auto; }
.tablebox th { background: var(--surface); }
.flow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 18px; font-size: 13px; color: var(--muted); }
.flow span.node { border: 1px solid #444; border-radius: 999px; padding: 6px 12px; color: #fff; font-weight: 600; }
.flow span.node.me { border-color: var(--sp-red); }
.log { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.log div { padding: 6px 0; border-bottom: 1px solid #1A1A1A; }
.log b { color: #fff; font-weight: 700; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(100px); background: #fff; color: #000; padding: 12px 18px; border-radius: 999px; font-weight: 700; z-index: 60; transition: transform .25s ease; max-width: calc(100vw - 32px); }
.toast.on { transform: translateX(-50%); }

.empty { padding: 30px; text-align: center; color: var(--subtle); }

@media (max-width: 1000px) {
  .board-wrap, .ci-grid, .inbox { grid-template-columns: 1fr; }
  .panel { position: static; max-height: none; }
  .event { display: none; }
}
@media (max-width: 600px) {
  main { padding: 16px; }
  .top { padding: 10px 16px; }
  .top { position: static; }
  .tabs { padding: 0 8px; top: 0; }
  .alerts { grid-template-columns: 1fr 1fr; }
  .alert .n { font-size: 24px; }
  .concept { display: none; }
}
