/* Atkinson Hyperlegible: drawn by the Braille Institute for low-vision legibility. A wall board read from across
   the theatre and a family reading on a phone in a corridor are both that case. */
@import url("https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible+Next:wght@400;500;700;800&display=swap");

/* Palette comes from the logo: navy ground, mint signal. Stage colours are the one place colour means something:
   surgery started = scrub blue, closing = amber, recovery = the mint signal. Validated with the dataviz CVD check. */
:root {
  --bg: #eef1f4; --panel: #ffffff; --ink: #142033; --ink2: #44526a; --muted: #6f7c90; --line: #d9dee6;
  --navy: #18283f; --accent: #17735f; --accent-ink: #ffffff;
  --st-started: #2f6fd6; --st-closing: #b8621b; --st-recovery: #1a8a72; --on-stage: #ffffff;
  --green: #15803d; --green-bg: #dcf3e4; --yellow: #8a5a00; --yellow-bg: #fbf0d0; --grey: #6b7280; --grey-bg: #e6eaf0;
  --red: #b42318; --red-bg: #fde4e1; --blue: #2f5bc4; --orange: #c2410c;
  --bar: #17735f;
  --radius: 8px;
  font-family: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", ui-sans-serif, system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --bg: #0e1828; --panel: #162338; --ink: #edf2f8; --ink2: #b3c0d2; --muted: #8291a7; --line: #273750;
    --accent: #4fc4a9; --accent-ink: #082019;
    --st-started: #5b8be0; --st-closing: #cf7a3c; --st-recovery: #33a98e; --on-stage: #08131f;
    --green: #5fd38a; --green-bg: #133325; --yellow: #f2c94c; --yellow-bg: #3a2f0e; --grey: #9aa6b6; --grey-bg: #1f2e46;
    --red: #ff8a7a; --red-bg: #3d1a1d; --blue: #8fb1ff; --orange: #fb923c; --bar: #4fc4a9;
    color-scheme: dark;
  }
}
.dark {
  --bg: #0b1422; --panel: #132036; --ink: #f1f5fa; --ink2: #b7c3d4; --muted: #8392a8; --line: #24344d;
  --accent: #4fc4a9; --accent-ink: #082019;
  --st-started: #5b8be0; --st-closing: #cf7a3c; --st-recovery: #33a98e; --on-stage: #08131f;
  --green: #5fd38a; --green-bg: #133325; --yellow: #f2c94c; --yellow-bg: #3a2f0e; --grey: #9aa6b6; --grey-bg: #1c2b42;
  --red: #ff8a7a; --red-bg: #401b1e; --blue: #8fb1ff; --orange: #fb923c; --bar: #4fc4a9;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--st-started); outline-offset: 2px; }
button, select, input, textarea { font: inherit; color: inherit; }
button {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
button.danger { color: var(--red); border-color: var(--red); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
select, input, textarea {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; width: 100%;
}
label { display: block; font-size: 13px; color: var(--ink2); margin-bottom: 10px; }
label > select, label > input, label > textarea { margin-top: 3px; }

header.top {
  display: flex; align-items: center; gap: 16px; padding: 10px 18px; background: var(--navy); color: #edf2f8;
  flex-wrap: wrap;
}
header.top .brand { font-weight: 800; letter-spacing: 0.04em; font-size: 17px; display: inline-flex; align-items: center; }
header.top .brand .logo { width: 28px; height: 28px; border-radius: 6px; margin-right: 9px; }
header.top .brand small { font-weight: 400; letter-spacing: 0; color: #9fb0c6; margin-left: 8px; font-size: 14px; }
header.top nav { display: flex; gap: 2px; overflow-x: auto; max-width: 100%; }
header.top nav a { white-space: nowrap; padding: 6px 11px; border-radius: 6px; text-decoration: none; color: #b9c6d8; }
header.top nav a:hover { color: #fff; }
header.top nav a.on { color: #fff; font-weight: 700; box-shadow: inset 0 -2px 0 #4fc4a9; border-radius: 0; }
header.top a { color: #b9c6d8; }
header.top .spacer { flex: 1; }

.chip { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 4px; background: var(--grey-bg); color: var(--ink2); white-space: nowrap; }
.chip.Immediate { background: var(--red); color: #fff; }
.chip.Urgent { background: var(--orange); color: #fff; }
.chip.Expedited { background: var(--blue); color: #fff; }
.chip.flag { background: var(--red-bg); color: var(--red); }
.chip.delay { background: var(--red-bg); color: var(--red); }
.chip.green { background: var(--green-bg); color: var(--green); }
.chip.yellow { background: var(--yellow-bg); color: var(--yellow); }
.chip.started, .chip.closing, .chip.recovery { color: var(--on-stage); }
.chip.started { background: var(--st-started); } .chip.closing { background: var(--st-closing); } .chip.recovery { background: var(--st-recovery); }
.ic { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex-shrink: 0; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--grey); vertical-align: middle; }
.dot.green { background: var(--green); } .dot.yellow { background: var(--yellow); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel h3 { margin: 0 0 10px; font-size: 16px; font-weight: 700; color: var(--ink); }
.muted { color: var(--muted); }
.banner { background: var(--yellow-bg); color: var(--yellow); padding: 8px 18px; font-weight: 700; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

dialog { border: 1px solid var(--line); border-radius: 14px; padding: 0; background: var(--panel); color: var(--ink); width: min(560px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(14, 24, 40, 0.55); }
dialog .head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
dialog .head h2 { margin: 0; font-size: 19px; }
dialog .body { padding: 16px 18px; max-height: 70vh; overflow: auto; }
dialog .foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.warn { background: var(--red-bg); color: var(--red); border-radius: 6px; padding: 8px 10px; margin: 6px 0 10px; }
.note { background: var(--grey-bg); color: var(--ink2); border-radius: 6px; padding: 8px 10px; margin: 6px 0 10px; font-size: 14px; }

#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; align-items: center; }
.toast { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(8,16,30,.35); display: flex; gap: 14px; align-items: center; font-size: 16px; }
.toast.error { background: #7a1d16; }
.toast button { background: #fff; color: var(--navy); border: 0; font-weight: 700; }

.log { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.log li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.log li:last-child { border-bottom: 0; }
.log time { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 8px; }

@media (max-width: 720px) {
  .grid2 { grid-template-columns: 1fr; }
  header.top { padding: 10px 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0s !important; transition-duration: 0s !important; } }
