/* Layout idea: a control-room desk. Queue of incoming texts on the left, sorted by grade;
   the selected text and its worked triage on the right. Grade colour is the only loud thing. */
/* Bright, light-only by choice: one high-contrast palette, the same in every viewer theme. */
:root {
  color-scheme: light;
  --bg: #f5f9fd;
  --surface: #ffffff;
  --sunken: #edf4fc;
  --ink: #0b1b2b;
  --muted: #3f5165;
  --line: #c5d4e3;
  --accent: #0b5fd6;
  --on-accent: #ffffff;
  --g-immediate: #d42a1c;
  --g-priority: #bf6200;
  --g-scheduled: #0b7499;
  --g-none: #5a6675;
  --on-grade: #ffffff;
  --ok: #14602b;
  --ok-bg: #e3f4e8;
  --sim-bg: #fff1b8;
  --sim-ink: #4a3800;
  --ev: #fff0a6;
  --ev-strong: #ffc928;
  --font-display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 17px; line-height: 1.55; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 20px 48px; display: flex; flex-direction: column; gap: 18px; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; text-wrap: balance; letter-spacing: 0.01em; }
h1 { font-size: 34px; font-weight: 700; line-height: 1.05; text-transform: uppercase; }
h2 { font-size: 20px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
h3 { font-size: 15px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
p { margin: 0; }
button, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.simbar { position: sticky; top: 0; z-index: 5; background: var(--sim-bg); color: var(--sim-ink); font-size: 14px; text-align: center; padding: 4px 16px; border-bottom: 1px solid var(--sim-ink); }
.head { display: flex; flex-wrap: wrap; gap: 8px 28px; align-items: baseline; justify-content: space-between; background: var(--accent); color: var(--on-accent); padding: 14px 20px; border-radius: 6px; }
.brand { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; }
.brand .sub { font-size: 16px; }
.shift { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: baseline; font-size: 15px; }
#clock { font-family: var(--font-mono); font-size: 18px; font-variant-numeric: tabular-nums; }

.counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.count { background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--g); border-radius: 4px; padding: 8px 12px; display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.count b { font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.count span { font-size: 15px; color: var(--muted); }

.desk { display: grid; grid-template-columns: 350px minmax(0, 1fr); gap: 18px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.compose { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.compose label { font-family: var(--font-display); font-size: 15px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.compose textarea { width: 100%; min-height: 84px; resize: vertical; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.btn { background: var(--accent); color: var(--on-accent); border: 0; border-radius: 4px; padding: 8px 14px; font-weight: 600; cursor: pointer; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); padding: 4px 10px; font-size: 15px; }
.hint { font-size: 15px; color: var(--muted); }

.queue { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.item { width: 100%; text-align: left; background: var(--t, var(--surface)); border: 1px solid var(--line); border-left: 6px solid var(--g, var(--line)); border-radius: 4px; padding: 8px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.item[aria-current="true"] { border-color: var(--accent); border-left-color: var(--g, var(--accent)); box-shadow: 0 0 0 1px var(--accent); }
.item .top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.item .top strong { color: var(--g, var(--muted)); font-family: var(--font-display); font-size: 15px; letter-spacing: 0.06em; text-transform: uppercase; }
.item .snip { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 16px; }

.detail { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 18px; display: flex; flex-direction: column; gap: 18px; }
.sms { background: var(--sunken); border-radius: 4px 14px 14px 14px; padding: 12px 14px; max-width: 65ch; overflow-wrap: anywhere; font-size: 16px; }
.meta { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.verdict { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; background: var(--t); border-left: 6px solid var(--g); border-radius: 4px; padding: 10px 14px; }
.pill { background: var(--g); color: var(--on-grade); font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 12px; border-radius: 3px; }
.cat { font-weight: 600; }
.reason { max-width: 65ch; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px 18px; margin: 0; }
.facts div { min-width: 0; border-top: 1px solid var(--line); padding-top: 6px; }
.facts dt { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.flags { display: flex; flex-wrap: wrap; gap: 6px; }
.flag { border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; font-size: 15px; }
.block { display: flex; flex-direction: column; gap: 6px; }
.block ul { margin: 0; padding-left: 18px; max-width: 65ch; }
.out { background: var(--sunken); border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; overflow-wrap: anywhere; white-space: pre-wrap; max-width: 75ch; }
.out.log { font-family: var(--font-mono); font-size: 15px; }
.override { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; border-top: 1px solid var(--line); padding-top: 14px; }
.override select { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 5px 8px; }
.working { color: var(--muted); }
.foot { font-size: 15px; color: var(--muted); max-width: 80ch; }
[hidden] { display: none !important; }
.tabs { display: flex; gap: 6px; }
.tab { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 12px; font-size: 15px; cursor: pointer; }
.tab[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.acts { display: flex; flex-wrap: wrap; gap: 8px; }
.acts .btn { padding: 9px 14px; font-size: 16px; }
.acts .btn.ghost { background: var(--surface); }
.btn.dark { background: var(--ink); color: var(--surface); }
.btn.done, .btn.done:disabled { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok); opacity: 1; }
textarea.field { width: 100%; min-height: 104px; resize: vertical; background: var(--sunken); border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; max-width: 75ch; }
.closedbar { background: var(--ok-bg); color: var(--ok); border-radius: 4px; padding: 8px 12px; font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.newtag { background: var(--accent); color: var(--on-accent); border-radius: 3px; padding: 0 6px; margin-left: 8px; font-family: var(--font-body); font-size: 12px; font-weight: 600; letter-spacing: 0; }
@keyframes arrive { from { opacity: 0; transform: translateY(-16px); box-shadow: 0 0 0 3px var(--accent); } to { opacity: 1; transform: none; box-shadow: 0 0 0 0 transparent; } }
.item.arrive { animation: arrive 0.7s ease-out; }
@media (prefers-reduced-motion: reduce) { .item.arrive { animation: none; } }
.qtags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.qtag { background: var(--surface); border: 1px solid currentColor; border-radius: 3px; padding: 0 6px; font-size: 12px; font-weight: 600; }
.qtag.rep, .flag.rep { color: var(--g-immediate); border-color: var(--g-immediate); font-weight: 600; }
.qtag.vul, .flag.vul { color: var(--g-priority); border-color: var(--g-priority); font-weight: 600; }
.hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 15px; max-width: 75ch; }
.headbtn { background: var(--surface); color: var(--accent); border: 0; border-radius: 4px; padding: 5px 12px; font-size: 15px; font-weight: 600; cursor: pointer; }
.ho h2 { color: var(--ink); font-size: 26px; }
.ho ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; max-width: 85ch; }
.sms .ev { background: var(--ev); border-radius: 2px; box-shadow: 0 0 0 2px var(--ev); transition: background 0.15s, box-shadow 0.15s; }
.sms.pick .ev { background: transparent; box-shadow: none; }
.sms.pick .ev.on { background: var(--ev-strong); box-shadow: 0 0 0 2px var(--ev-strong); }
.facts div[tabindex] { cursor: default; border-radius: 3px; }
.facts div.on { background: var(--ev); box-shadow: 0 0 0 4px var(--ev); }
.inferred { margin-left: 6px; border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; font-size: 12px; text-transform: none; letter-spacing: 0; }
.wait { font-family: var(--font-mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.item.late .wait { background: var(--g-immediate); color: var(--on-grade); border-radius: 3px; padding: 0 5px; font-weight: 600; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }
@keyframes arriveHot { 0% { opacity: 0; transform: translateY(-16px); box-shadow: 0 0 0 6px var(--g-immediate); } 30% { opacity: 1; transform: none; } 55% { box-shadow: 0 0 0 0 transparent; } 75% { box-shadow: 0 0 0 5px var(--g-immediate); } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes arriveWarm { from { opacity: 0; transform: translateY(-10px); box-shadow: 0 0 0 3px var(--g-priority); } to { opacity: 1; transform: none; box-shadow: 0 0 0 0 transparent; } }
@keyframes arriveQuiet { from { opacity: 0; } to { opacity: 1; } }
.item.arrive[data-g="immediate"] { animation: arriveHot 1.6s ease-out; }
.item.arrive[data-g="priority"] { animation: arriveWarm 0.8s ease-out; }
.item.arrive[data-g="scheduled"], .item.arrive[data-g="none"] { animation: arriveQuiet 0.6s ease-out; }
@keyframes bump { 30% { transform: scale(1.06); } }
.count.bump { animation: bump 0.5s ease-out; }
.heldbar { width: 100%; border: 0; border-radius: 4px; padding: 6px 10px; background: var(--accent); color: var(--on-accent); font-size: 15px; font-weight: 600; cursor: pointer; }
.heldbar[data-g="immediate"] { background: var(--g-immediate); }
.heldbar.idle { background: var(--sunken); color: var(--muted); font-weight: 400; cursor: default; }
.prog { display: flex; gap: 3px; margin-top: 3px; }
.prog i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.prog i.on { background: var(--ok); }
.steps { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; margin: 0; padding: 0; font-size: 15px; color: var(--muted); }
.steps li::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border: 2px solid var(--line); border-radius: 50%; }
.steps li.on { color: var(--ok); font-weight: 600; }
.steps li.on::before { background: var(--ok); border-color: var(--ok); }
@keyframes pop { 40% { transform: scale(1.6); } }
.steps li.pop::before { animation: pop 0.5s ease-out; }
@media (prefers-reduced-motion: reduce) { .item.arrive, .item.late .wait, .count.bump, .steps li.pop::before { animation: none !important; } }
.timeline time { font-family: var(--font-mono); color: var(--muted); margin-right: 10px; }
[data-g="immediate"] { --g: var(--g-immediate); --t: #fdebe8; }
[data-g="priority"] { --g: var(--g-priority); --t: #fff3df; }
[data-g="scheduled"] { --g: var(--g-scheduled); --t: #e4f5fb; }
[data-g="none"] { --g: var(--g-none); --t: #eef1f4; }
.count { background: var(--t); }
@media (max-width: 820px) {
  .desk { grid-template-columns: minmax(0, 1fr); }
  .counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: 28px; }
}
