/* Two themes, one layout system. Staff page: light. Office TV (body.screen): dark. Colours follow the dataviz palette:
   one series colour (blue) for the trend line, and the fixed status colours, which always come with a mark and a word. */
:root {
  color-scheme: light;
  --bg:#f3f2ef; --card:#fcfcfb; --ink:#0b0b0b; --muted:#52514e; --line:#dddcd6;
  --series:#2a78d6; --accent:#256abf; --bad:#a3361f;
  --good:#0ca30c; --warn:#fab219; --crit:#d03b3b;
}
body.screen {
  color-scheme: dark;
  --bg:#111110; --card:#1a1a19; --ink:#f0efec; --muted:#c3c2b7; --line:#383835;
  --series:#3987e5; --accent:#86b6ef; --bad:#f08a72;
}
* { box-sizing: border-box; }
[hidden] { display:none !important; }
body { margin:0; background:var(--bg); color:var(--ink); font:16px/1.45 system-ui, sans-serif; font-variant-numeric:tabular-nums; padding:0 16px 48px; }
header { display:flex; flex-wrap:wrap; gap:8px 16px; justify-content:space-between; align-items:center; max-width:1280px; margin:0 auto; padding:16px 0; }
h1 { font-size:1.3rem; margin:0; } h2 { font-size:1.05rem; }
main { max-width:1280px; margin:0 auto; }
button { font:inherit; padding:6px 12px; border:1px solid var(--line); background:var(--card); color:var(--ink); border-radius:6px; cursor:pointer; }
button:hover { border-color:var(--accent); }
.signout { margin-left:8px; }
.weekbar { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin:8px 0 16px; }
.weekbar input { font:inherit; }
#range { color:var(--muted); }

/* Tiles: number first, then status, trend, counts. A thick left bar in the status colour, plus the mark and word. */
.tiles { display:grid; grid-template-columns:1fr; gap:12px; }
@media (min-width:640px) { .tiles { grid-template-columns:repeat(2, 1fr); } }
@media (min-width:900px) { .tiles { grid-template-columns:repeat(3, 1fr); } }
/* Six tiles stay three across at every wide width: two rows of three. */
.tiles > div { display:flex; min-width:0; }
.tiles > div > .tile { flex:1; }
.tile { display:flex; flex-direction:column; align-items:stretch; --bar:var(--line); --mark-ink:#fff; text-align:left; background:var(--card); border:1px solid var(--line); border-left:6px solid var(--bar); border-radius:10px; padding:14px 16px; min-width:0; }
.tile.on { --bar:var(--good); }
.tile.close { --bar:var(--warn); --mark-ink:#1a1a19; }
.tile.below { --bar:var(--crit); }
.tile.selected { outline:2px solid var(--accent); outline-offset:1px; }
.tile h3 { margin:0 0 2px; font-size:.95rem; color:var(--muted); font-weight:600; }
.tile .big { font-size:2.6rem; font-weight:700; line-height:1.1; }
.tile .counts { font-size:1rem; font-weight:600; margin-top:2px; }
.tile .status { display:flex; flex-wrap:wrap; align-items:center; gap:4px 8px; margin:8px 0 2px; min-height:1.6em; }
.tile .mark { display:none; width:1.5em; height:1.5em; border-radius:50%; background:var(--bar); color:var(--mark-ink); font-weight:700; font-size:.85em; line-height:1.5em; text-align:center; }
.tile.on .mark, .tile.close .mark, .tile.below .mark { display:inline-block; }
.tile .word { font-weight:600; }
.tile .target { color:var(--muted); font-size:.9rem; }
.spark { display:block; width:100%; height:auto; max-height:72px; margin:4px 0; overflow:visible; }
.spark-line { fill:none; stroke:var(--series); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.spark-target { stroke:var(--muted); stroke-width:1; stroke-dasharray:4 4; opacity:.7; }
.spark-dot { fill:var(--series); stroke:var(--card); stroke-width:2; }
.spark-dot.hollow { fill:var(--card); stroke:var(--series); }
.spark-hit { fill:transparent; }
.tile .sub { color:var(--muted); font-size:.9rem; }
.tile .updated { font-size:.8rem; color:var(--muted); }
.tile .foot { display:flex; flex-wrap:wrap; align-items:center; gap:6px 8px; margin-top:auto; padding-top:8px; }
.tile .foot .updated { margin-left:auto; }
.tile button { padding:4px 10px; font-size:.85rem; }
.tile .details-toggle { border-color:transparent; background:none; color:var(--accent); padding-left:4px; padding-right:4px; }
.tile .details-panel { margin-top:6px; font-size:.8rem; color:var(--muted); }
.tile .details-panel p, .tile .details-panel .sub { margin:6px 0 0; font-size:.8rem; }
.tile .word:empty { display:none; }
.tile .stale { color:var(--bad); }
.error { color:var(--bad); }
table { border-collapse:collapse; width:100%; font-size:.9rem; }
th, td { text-align:left; padding:6px 8px; border-bottom:1px solid var(--line); vertical-align:top; }
td.miss { color:var(--bad); font-weight:600; }
.scroll { overflow-x:auto; }
.checked { color:var(--muted); font-size:.9rem; }
.stale { color:var(--bad); }

/* Screen mode (office TV, dark): three tiles over two that fill the screen. Number, status word, trend and counts; the detail
   lines stay in the page for the screen reader but are not drawn. */
html:has(body.screen) { height:100%; }
body.screen { height:100%; display:flex; flex-direction:column; font-size:clamp(16px, 1.45vh, 30px); padding:0 1.6vw 1.2vh; overflow:hidden; }
body.screen header, body.screen main { max-width:none; width:100%; margin:0; }
body.screen header { padding:1.2vh 0; flex:none; }
body.screen h1 { font-size:1.5em; }
body.screen #who { color:var(--muted); font-size:1.2em; }
body.screen main { flex:1; min-height:0; display:flex; flex-direction:column; }
body.screen .tiles { flex:1; min-height:0; grid-template-columns:repeat(6, 1fr); grid-template-rows:repeat(2, 1fr); gap:1.4vh 1.2vw; }
body.screen .tile { grid-column:span 2; padding:1.2vh 1.4vw; border-left-width:.8vh; min-height:0; }
body.screen .tile h3 { font-size:1.5em; color:var(--ink); }
body.screen .tile .big { font-size:min(13vh, 8vw); line-height:1; margin-top:.4vh; }
body.screen .tile .counts { font-size:1.5em; }
body.screen .tile .status { font-size:1.5em; margin:1vh 0 0; }
body.screen .tile .target { font-size:.8em; }
body.screen .spark { flex:1; min-height:0; max-height:none; width:100%; height:auto; margin:1vh 0; }
body.screen .spark-line { stroke-width:3.5; }
body.screen .spark-dot { stroke-width:3; }
body.screen .tile .detail { display:none; }
body.screen .tile .updated { font-size:.85em; margin-top:auto; }
body.screen .checked { font-size:.85em; text-align:right; margin:.4vh 0 0; flex:none; }
body.screen .stale { font-weight:700; }
body.screen #signed-out { display:flex; min-height:90vh; align-items:center; justify-content:center; }
body.screen #sign-in-error { font-size:3em; }
