:root {
  /* Layout: the night map on the left, the pager and the agreement rules on the right,
     the shift's numbers underneath. The night wears the Swytch footer ink; the morning
     report wears the site's daylight paper. Orange is reserved for things Swytch does. */
  --ink: #14181b;
  --paper: #e7ebea;
  --slate: #4b555b;
  --mist: #9aa5a9;
  --swytch: #f36b15;
  --alarm: #e43f52;
  --session: #a99cff;
  --seat: #5fd4e6;
  --panel: #1b2125;
  --raise: #242c31;
  --line: #323c43;
  --lcd: #a7b2ad;
  --lcd-lit: #dfe7e3;
  --display: "Unbounded", "Arial Black", sans-serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--ink); color: var(--paper); font: 400 15px/1.45 var(--body); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--swytch); outline-offset: 2px; }
h1, h2, h3, h4, p { margin: 0; }
code, pre { font-family: var(--mono); }

.app { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }

/* ---- top bar ---- */
.bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 22px; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.mark { font: 800 14px/1 var(--display); text-transform: uppercase; letter-spacing: -0.01em; }
.phase { display: flex; align-items: baseline; gap: 8px; font-size: 14px; color: var(--mist); }
.phase b { color: var(--paper); font-weight: 600; }
.grow { flex: 1 1 0; }
.you { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--mist); min-width: 118px; }
.you i { width: 9px; height: 9px; border-radius: 50%; background: var(--slate); }
.you[data-awake="true"] { color: var(--paper); }
.you[data-awake="true"] i { background: var(--alarm); animation: pulse 1s infinite; }
.clock { font: 600 26px/1 var(--display); letter-spacing: -0.02em; display: flex; }
.clock span { display: inline-block; width: 0.82em; text-align: center; }
.clock span.sep { width: 0.36em; }
.clock .secs { display: flex; align-items: baseline; font-size: 0.62em; color: var(--mist); align-self: flex-end; padding-bottom: 0.08em; }
.clock .secs span { width: 0.82em; }
.clock .secs span.sep { width: 0.36em; }
.btns { display: flex; gap: 8px; }
.ghost { background: none; border: 1px solid var(--line); border-radius: 4px; padding: 6px 12px; font-size: 14px; color: var(--paper); }
.ghost:hover { border-color: var(--mist); }
.ghost[aria-pressed="true"] { border-color: var(--swytch); color: var(--swytch); }

/* ---- map ---- */
main { display: grid; grid-template-columns: minmax(0, 1fr) 392px; min-height: 0; }
.map { position: relative; min-height: 0; overflow: hidden; background: var(--ink); }
.map canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.legend { position: absolute; left: 16px; bottom: 12px; right: 16px; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--mist); pointer-events: none; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; flex: none; }
.lg-view { width: 5px; height: 5px; border-radius: 50%; background: var(--paper); opacity: .8; }
.lg-sess { width: 7px; height: 7px; border-radius: 50%; background: var(--session); }
.lg-seat { width: 6px; height: 6px; background: var(--seat); transform: rotate(45deg); }
.lg-fail { width: 9px; height: 9px; background: linear-gradient(45deg, transparent 42%, var(--alarm) 42% 58%, transparent 58%), linear-gradient(-45deg, transparent 42%, var(--alarm) 42% 58%, transparent 58%); }
.lg-wait { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--seat); }
.paused-note { position: absolute; top: 12px; left: 16px; font-size: 13px; color: var(--mist); }
.paused-note.rt { color: var(--paper); background: rgba(16, 19, 21, .82); border-left: 3px solid var(--alarm); border-radius: 4px; padding: 5px 10px; }

/* ---- side panel ---- */
.side { border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; gap: 14px; padding: 14px; overflow-y: auto; min-height: 0; }
.side h3 { font: 600 13px/1.2 var(--body); color: var(--mist); margin-bottom: 8px; }

.pager { position: relative; background: #0d1012; border: 1px solid #000; border-radius: 10px; padding: 10px 30px 10px 10px; box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.lcd { background: var(--lcd); color: var(--ink); border-radius: 3px; padding: 8px 10px; font: 500 12.5px/1.35 var(--mono); text-transform: uppercase; min-height: 54px; box-shadow: inset 0 1px 3px rgba(0,0,0,.35); transition: background .15s; }
.lcd-b { opacity: .62; }
.led { position: absolute; right: 11px; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: #3a2226; }
.pager[data-on="true"] .lcd { background: var(--lcd-lit); }
.pager[data-on="true"] .lcd-b { opacity: .85; }
.pager[data-on="true"] .led { background: var(--alarm); box-shadow: 0 0 8px var(--alarm); animation: pulse .6s infinite; }
.pager.buzz { animation: buzz .09s linear 8; }

.incs { display: flex; flex-direction: column; gap: 10px; }
.incs:empty { display: none; }
.inc { background: var(--raise); border-left: 3px solid var(--alarm); border-radius: 4px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.inc.adv { border-left-color: var(--seat); }
.inc h4 { font: 600 15px/1.3 var(--body); }
.inc p { font-size: 13.5px; color: var(--mist); }
.acts { display: flex; flex-direction: column; gap: 6px; }
.act { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; background: #2e383e; border: 1px solid #3d4850; border-radius: 4px; padding: 8px 12px; font-weight: 600; font-size: 14.5px; }
.act:hover { border-color: var(--paper); }
.act small { font-weight: 400; font-size: 12.5px; color: var(--mist); }
.work { font-size: 13.5px; }
.prog { height: 4px; background: #14181b; border-radius: 2px; overflow: hidden; margin-top: 6px; }
.prog i { display: block; height: 100%; width: 0; background: var(--paper); }
.note { font-size: 12.5px; color: var(--mist); }

/* ---- agreement rules ---- */
.policy { display: flex; flex-direction: column; gap: 12px; }
.rule { display: flex; flex-direction: column; gap: 6px; border-radius: 4px; }
.rule.nudge { animation: nudge 1.2s 2; }
.rule-head code { font-size: 13.5px; font-weight: 500; color: var(--paper); }
.rule-head span { display: block; font-size: 13px; color: var(--mist); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.seg.four { grid-template-columns: repeat(4, 1fr); }
.seg button { background: none; border: 0; padding: 7px 10px; text-align: left; font-size: 13.5px; font-weight: 600; display: flex; flex-direction: column; gap: 1px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button small { font-weight: 400; font-size: 12px; color: var(--mist); }
.seg button:hover { background: rgba(255,255,255,.04); }
.seg button[aria-checked="true"] { background: var(--swytch); color: #140a03; }
.seg button[aria-checked="true"] small { color: #3b1c05; }
.seg-label { font-size: 12.5px; color: var(--mist); margin-top: 2px; }
.compact .rule-head span, .compact .seg button small { display: none; }
.compact .policy { gap: 10px; }
.seg.plain button[aria-checked="true"] { background: var(--paper); color: var(--ink); }
.seg.plain button[aria-checked="true"] small { color: var(--slate); }
.auto { display: flex; flex-direction: column; gap: 6px; border-radius: 4px; }
.auto-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auto .auto-row h3 { margin: 0; color: var(--paper); font-size: 14px; }
.auto .seg { grid-template-columns: auto auto; }
.auto .seg button { padding: 5px 18px; }
.auto.nudge { animation: nudge 1.2s 2; }
.cmd { margin: 0; background: #0d1012; border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; font-size: 12px; line-height: 1.55; color: #cfd6d3; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- lab ---- */
.lab { display: flex; flex-direction: column; gap: 10px; }
.lab-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.lab-grid button { background: #2e383e; border: 1px solid #3d4850; border-radius: 4px; padding: 6px 8px; font-size: 13px; text-align: left; }
.lab-grid button:hover { border-color: var(--paper); }
.lab-grid button[data-down="true"] { border-color: var(--alarm); color: #ffb3bc; }

/* ---- log ---- */
.pager { order: 0; }
#auto { order: 1; }
.incs { order: 2; }
#policy-side, .lab { order: 3; }
.logwrap { order: 4; min-height: 0; }
.side > * { flex: none; }
body[data-phase="night3"] .logwrap, body[data-phase="lab"] .logwrap { order: 6; }
body[data-phase="lab"] .incs { order: 1; }
body[data-phase="lab"] #auto { order: 2; }
body[data-phase="lab"] #policy-side { order: 4; }
.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.log li { display: grid; grid-template-columns: 44px 1fr; gap: 8px; color: var(--mist); }
.log time { font-variant-numeric: tabular-nums; color: var(--slate); }
.log li[data-tone="bad"] { color: #f0a7af; }
.log li[data-tone="calm"] { color: var(--paper); }
.log li[data-tone="wait"] { color: var(--seat); }
.log:empty::after { content: "Nothing yet."; color: var(--slate); font-size: 13px; }

/* ---- shift numbers ---- */
.hud { border-top: 1px solid var(--line); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 36px; padding: 12px 20px; align-items: center; }
.stats { display: flex; flex-wrap: wrap; gap: 8px 30px; }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 74px; }
.stat span { font-size: 12.5px; color: var(--mist); }
.stat b { font: 600 20px/1.1 var(--display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat[data-tone="bad"] b { color: var(--alarm); }
.stat[data-tone="wait"] b { color: var(--seat); }
.tl { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 4px 10px; align-items: center; font-size: 12px; color: var(--mist); }
.tl-hours { grid-column: 2; display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; color: var(--slate); }
.tl-track { position: relative; height: 8px; background: var(--raise); border-radius: 2px; overflow: hidden; }
.tl-lane { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tl-track.marks { background: none; height: 8px; overflow: visible; }
.tl-track i { position: absolute; top: 0; bottom: 0; min-width: 2px; }
.tl-track i.awake { background: var(--alarm); }
.tl-track i.wait { background: repeating-linear-gradient(135deg, var(--seat) 0 2px, transparent 2px 5px); }
.tl-track i.crash { width: 6px; height: 6px; top: 1px; bottom: auto; margin-left: -3px; background: var(--mist); transform: rotate(45deg); }
.tl-track i.isolate { top: 3px; bottom: 3px; background: var(--mist); }
.tl-track i.head { width: 1px; min-width: 1px; background: var(--paper); }
.tl-key { grid-column: 2; display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--slate); }

/* ---- overlays ---- */
.overlay { position: fixed; inset: 0; z-index: 10; display: flex; overflow: auto; padding: 24px 16px; background: rgba(13, 16, 18, .6); }
.card { margin: auto; width: 100%; max-width: 660px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 32px; display: flex; flex-direction: column; gap: 18px; }
.card.two { max-width: 1060px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px 40px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card h1 { font: 800 clamp(26px, 5vw, 42px)/1.04 var(--display); text-transform: uppercase; letter-spacing: -0.01em; text-wrap: balance; }
.card h2 { font: 800 18px/1.15 var(--display); text-transform: uppercase; letter-spacing: -0.01em; color: var(--swytch); }
.card h2.plain { color: var(--paper); }
.card p { max-width: 62ch; color: #c9d0cd; }
.card ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; max-width: 62ch; color: #c9d0cd; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.cta { background: var(--swytch); color: #140a03; border: 1px solid var(--swytch); border-radius: 4px; padding: 11px 18px; font-weight: 600; font-size: 15.5px; text-decoration: none; display: inline-block; }
.cta:hover { filter: brightness(1.08); }
.link { background: none; border: 0; padding: 0; color: var(--mist); text-decoration: underline; text-underline-offset: 3px; font-size: 14px; }
.link:hover { color: var(--paper); }
.fine { font-size: 13px; color: var(--mist); }
.fine a { color: inherit; text-underline-offset: 3px; }
.fine a:hover { color: var(--paper); }
.report { display: flex; flex-wrap: wrap; gap: 10px 34px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.report .stat b { font-size: 24px; }

/* ---- morning: the site's daylight ---- */
.overlay.morning { background: var(--paper); color: var(--ink); color-scheme: light; padding: 0; animation: dawn .9s ease-out; }
.sheet { margin: auto; width: 100%; max-width: 900px; padding: 48px 24px; display: flex; flex-direction: column; gap: 26px; }
.sheet h1 { font: 800 clamp(30px, 6.2vw, 58px)/1.02 var(--display); text-transform: uppercase; letter-spacing: -0.01em; text-wrap: balance; }
.sheet .lede { font-size: 18px; line-height: 1.5; max-width: 60ch; color: var(--slate); }
.cmp { width: 100%; border-collapse: collapse; font-size: 15.5px; }
.cmp th, .cmp td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid #c9d0ce; vertical-align: baseline; }
.cmp thead th { font-weight: 600; font-size: 13.5px; color: var(--slate); border-bottom-color: var(--ink); }
.cmp td.n { font: 600 20px/1.1 var(--display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cmp td.n.bad { color: #c22a3d; }
.cmp td.n.na { color: var(--mist); font-weight: 600; }
.cmp small { display: block; font: 400 12.5px/1.35 var(--body); letter-spacing: 0; color: var(--slate); margin-top: 2px; white-space: normal; }
.cmp th[scope="row"] { max-width: 300px; }
.sheet .bill { font-size: 16px; line-height: 1.5; max-width: 62ch; border-left: 3px solid #c22a3d; padding-left: 14px; }
.cmp-wrap { overflow-x: auto; }
.sheet .design { font-size: 14.5px; color: var(--slate); }
.sheet .design code { font-size: 13.5px; background: #d7dddb; padding: 1px 5px; border-radius: 3px; color: var(--ink); }
.sheet .cta { font-size: 16px; padding: 12px 20px; }
.sheet .out { border: 1px solid var(--ink); border-radius: 4px; padding: 11px 18px; font-weight: 600; background: none; color: var(--ink); text-decoration: none; display: inline-block; font-size: 15.5px; }
.sheet .out:hover { background: var(--ink); color: var(--paper); }
.sheet a.text { color: var(--ink); text-underline-offset: 3px; }
.sheet details { border-top: 1px solid #c9d0ce; padding-top: 14px; font-size: 14.5px; color: var(--slate); max-width: 70ch; }
.sheet summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.sheet details ul { margin: 10px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.sheet .tl { color: var(--slate); max-width: 720px; }
.sheet .tl-track { background: #d3dad8; }
.sheet .tl-track.marks { background: none; }
.sheet .tl-track i.crash, .sheet .tl-track i.isolate { background: var(--slate); }
.sheet .tl-track i.awake { background: #d5384b; }
.sheet .tl-track i.wait { background: repeating-linear-gradient(135deg, #2a8ea0 0 2px, transparent 2px 5px); }

@keyframes pulse { 50% { opacity: .35; } }
@keyframes buzz { 0% { transform: translateX(-2px); } 50% { transform: translateX(2px); } 100% { transform: translateX(-2px); } }
@keyframes nudge { 50% { box-shadow: 0 0 0 6px rgba(243, 107, 21, .28); } }
@keyframes dawn { from { opacity: 0; } }

@media (max-width: 900px) {
  .app { height: auto; min-height: 100%; }
  main { grid-template-columns: minmax(0, 1fr); }
  .map { aspect-ratio: 1 / 1; }
  .side { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .hud { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 22px 18px; }
  .card.two { grid-template-columns: minmax(0, 1fr); }
  .clock { font-size: 22px; }
  .grow { flex-basis: 100%; height: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .pager.buzz, .rule.nudge, .auto.nudge, .overlay.morning { animation: none; }
  .you[data-awake="true"] i, .pager[data-on="true"] .led { animation: none; }
}
