@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  --brand: #4D2272;
  --blue: #3A86D1;
  --deep: #2B6099;
  --sky: #C8E4FB;
  --ink: #1B1622;
  --muted: #6E6879;
  --faint: #948DA1;
  --line: #E4E0EB;
  --line-soft: #F0EDF5;
  --paper: #FFFFFF;
  --bg: #F5F4F8;
  --critical: #A81E14;
  --critical-bg: #FBEBEA;
  --urgent: #96590A;
  --urgent-bg: #FCF3E4;
  --ok: #1B6249;
  --ok-bg: #E8F3EF;
  --r: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top demo bar ---------- */

.topnav {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  min-height: 58px;
  position: sticky;
  top: 0;
  z-index: 40;
  flex-wrap: wrap;
}
.topnav .brand { display: flex; align-items: center; text-decoration: none; }
.topnav .brand img { display: block; height: 34px; width: auto; }
.topnav .tag {
  background: var(--sky); color: var(--deep);
  border-radius: 20px; padding: 2px 10px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em;
}
.topnav .links { display: flex; gap: 2px; margin-left: auto; flex-wrap: wrap; }
.topnav a { color: var(--muted); text-decoration: none; padding: 6px 11px; border-radius: 7px; font-size: 13px; }
.topnav a:hover { background: var(--bg); color: var(--ink); }
.topnav a[aria-current="page"] { background: #F3EEF8; color: var(--brand); font-weight: 500; }
.topnav span.off { color: var(--faint); padding: 6px 11px; font-size: 13px; }

/* ---------- Shell ---------- */

.shell { display: flex; align-items: flex-start; }

.side {
  width: 228px; flex: 0 0 228px;
  background: var(--paper); border-right: 1px solid var(--line);
  min-height: calc(100vh - 58px);
  padding: 16px 0 30px;
  position: sticky; top: 58px;
}
.side .place { padding: 0 16px 14px; border-bottom: 1px solid var(--line-soft); }
.side .place b { display: block; font-size: 13.5px; }
.side .place span { color: var(--muted); font-size: 12px; }
.side .badge { display: inline-block; margin-top: 8px; background: var(--sky); color: var(--deep); border-radius: 20px; padding: 2px 9px; font-size: 11.5px; font-weight: 500; }
.side .who { padding: 13px 16px; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid var(--line-soft); }
.side .av { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 11.5px; font-weight: 600; }
.side .who b { display: block; font-size: 13px; font-weight: 500; }
.side .who span { color: var(--muted); font-size: 11.5px; }
.side .grp { padding: 15px 16px 5px; font-size: 11px; color: var(--faint); letter-spacing: 0.03em; }
.side .item { display: flex; align-items: center; gap: 9px; padding: 6px 16px; color: var(--ink); text-decoration: none; font-size: 13.5px; }
.side .item i { font-style: normal; width: 16px; text-align: center; opacity: 0.85; }
.side .item:hover { background: var(--bg); }
.side .item.on { background: #F3EEF8; color: var(--brand); font-weight: 500; box-shadow: inset 3px 0 0 var(--brand); }
.side .item .ct { margin-left: auto; background: var(--critical-bg); color: var(--critical); border-radius: 20px; padding: 0 7px; font-size: 11.5px; font-weight: 600; }
.side .item.dim { color: var(--faint); }

.main { flex: 1; min-width: 0; }
.head { padding: 24px 26px 4px; }
.head h1 { margin: 0; font-size: 23px; letter-spacing: -0.02em; font-weight: 600; }
.head p { margin: 3px 0 0; color: var(--muted); }
.body { padding: 20px 26px 64px; max-width: 1200px; }

/* ---------- Stat tiles ---------- */

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.tile span { color: var(--muted); font-size: 12.5px; display: block; }
.tile b { display: block; margin-top: 4px; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 27px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.1; }
.tile em { font-style: normal; font-size: 12px; color: var(--muted); }
.tile.crit b { color: var(--critical); }
.tile.urg b { color: var(--urgent); }
.tile.good b, .tile.good em { color: var(--ok); }

/* ---------- Cards and tables ---------- */

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 20px; overflow: hidden; }
.card > header { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.card > header h2 { margin: 0; font-size: 14.5px; font-weight: 600; }
.card > header p { margin: 0; color: var(--muted); font-size: 12.5px; }

table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; font-weight: 500; font-size: 11.5px; color: var(--faint); padding: 9px 16px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
tbody td { padding: 11px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.pick { cursor: pointer; }
tbody tr.pick:hover { background: #FBFAFD; }
tbody tr.on { background: #F3EEF8; }
td.num, th.num { font-family: "IBM Plex Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
td .sub { display: block; color: var(--muted); font-size: 12px; }
td b { font-weight: 500; }
tfoot td { padding: 11px 16px; background: var(--bg); font-weight: 500; border-top: 1px solid var(--line); }

/* ---------- Pills ---------- */

.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; white-space: nowrap; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.pill.critical { background: var(--critical-bg); border-color: #EDCECB; color: var(--critical); }
.pill.urgent { background: var(--urgent-bg); border-color: #EBD9BC; color: var(--urgent); }
.pill.ok { background: var(--ok-bg); border-color: #C6E0D6; color: var(--ok); }
.pill.info { background: var(--sky); border-color: #A9D0F1; color: var(--deep); }
.pill.live { background: #F3EEF8; border-color: #DCCBEB; color: var(--brand); }

/* ---------- Clock ---------- */

.clock { display: flex; align-items: center; gap: 8px; min-width: 148px; }
.clock .n { font-family: "IBM Plex Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; font-weight: 600; width: 26px; text-align: right; }
.clock .u { color: var(--faint); font-size: 11px; }
.bar { position: relative; height: 8px; border-radius: 4px; background: var(--line-soft); flex: 1; overflow: hidden; min-width: 56px; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--deep); }
.bar u { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--paper); }
.auth { display: flex; gap: 3px; flex: 1; align-items: center; }
.auth s { height: 8px; width: 12px; border-radius: 2px; background: var(--deep); text-decoration: none; display: block; }
.auth s.now { background: var(--urgent); }
.auth s.now.hot { background: var(--critical); }
.auth s.next { background: transparent; border: 1px dashed var(--faint); }
.b-urgent .bar i { background: var(--urgent); }
.b-urgent .n { color: var(--urgent); }
.b-critical .bar i { background: var(--critical); }
.b-critical .n { color: var(--critical); }

/* ---------- Detail ---------- */

.split { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.detail { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); }
.detail header { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.detail header h3 { margin: 0 0 2px; font-size: 15px; }
.detail header p { margin: 0; color: var(--muted); font-size: 12.5px; }
.detail dl { margin: 0; padding: 14px 16px; display: grid; grid-template-columns: 108px 1fr; gap: 7px 12px; }
.detail dt { color: var(--muted); font-size: 12.5px; }
.detail dd { margin: 0; }
.detail .act { padding: 12px 16px; border-top: 1px solid var(--line-soft); display: flex; gap: 8px; flex-wrap: wrap; }
.detail .empty { padding: 30px 16px; color: var(--faint); text-align: center; }
.guard { padding: 12px 16px; border-top: 1px solid var(--line-soft); background: var(--bg); font-size: 12.5px; color: var(--muted); }
.guard b { color: var(--ink); font-weight: 500; }

/* ---------- Buttons ---------- */

button { font: inherit; cursor: pointer; border-radius: 7px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); padding: 7px 13px; }
button:hover { background: var(--bg); }
button.go { background: var(--brand); border-color: var(--brand); color: #fff; }
button.go:hover { background: #5C2C86; }
button.sm { padding: 3px 10px; font-size: 12.5px; }
button:disabled { opacity: 0.45; cursor: default; }
button:focus-visible, a:focus-visible, tr:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- Note ---------- */

.note { background: var(--paper); border: 1px solid var(--line); border-left: 3px solid var(--blue); border-radius: var(--r); padding: 13px 16px; margin-bottom: 20px; max-width: 78ch; }
.note h3 { margin: 0 0 4px; font-size: 13.5px; }
.note p { margin: 0; color: var(--muted); }

/* ---------- Split bar for structural vs recoverable ---------- */

.vac { display: flex; height: 9px; border-radius: 4px; overflow: hidden; background: var(--line-soft); min-width: 88px; }
.vac s { display: block; height: 9px; text-decoration: none; }
.vac s.str { background: #B9B2C6; }
.vac s.rec { background: var(--blue); }
.key { display: flex; gap: 16px; color: var(--muted); font-size: 12.5px; align-items: center; }
.key i { font-style: normal; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Home ---------- */

.home { padding: 34px 26px 64px; max-width: 940px; }
.home h1 { font-size: 29px; letter-spacing: -0.025em; margin: 0 0 8px; }
.home > p { color: var(--muted); max-width: 66ch; margin: 0; }
.grid { margin-top: 26px; }
.grid a, .grid .off { display: grid; grid-template-columns: 34px 1fr 96px 92px; gap: 12px; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--line-soft); text-decoration: none; color: var(--ink); }
.grid a:last-child, .grid .off:last-child { border-bottom: 0; }
.grid a:hover { background: #FBFAFD; }
.grid .off { color: var(--faint); }
.grid .n { font-family: "IBM Plex Mono", monospace; color: var(--faint); font-size: 12.5px; }
.grid .nm { font-weight: 500; }
.grid .nm small { display: block; font-weight: 400; color: var(--muted); }
.grid .cl, .grid .st { font-size: 12.5px; color: var(--muted); }
.tl { margin-top: 30px; }
.tl ol { list-style: none; margin: 12px 0 0; padding: 0; }
.tl li { display: grid; grid-template-columns: 118px 1fr; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.tl li b { font-family: "IBM Plex Mono", monospace; color: var(--deep); font-weight: 500; }

@media (max-width: 940px) {
  .shell { display: block; }
  .side { width: auto; flex: none; position: static; min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .split { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Scenario switcher on the episode timeline */
.scen { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.scen button {
  display: flex; flex-direction: column; gap: 2px; text-align: left;
  font: inherit; font-size: 13px; color: var(--ink); cursor: pointer;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r); padding: 8px 12px; min-width: 150px;
}
.scen button small { color: var(--muted); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.scen button:hover { border-color: var(--blue); }
.scen button[aria-current="true"] { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.scen button[aria-current="true"] small { color: var(--brand); }
.scen-lede { color: var(--muted); margin: 12px 0 0; max-width: 72ch; }
.tl li.past b { color: var(--faint); }
.tl li.past span { color: var(--muted); }
.tl li.now { background: var(--sky); border-radius: 6px; padding-left: 8px; padding-right: 8px; }
.tl li.now b { color: var(--deep); }
@media (max-width: 560px) {
  .tl li { grid-template-columns: 1fr; gap: 2px; }
  .scen button { flex: 1 1 100%; }
}
