/* The dashboard's one stylesheet. The page runs no script and carries no inline style
   (its content-security-policy forbids both), so everything that has a size is a class:
   h0..h100 (height), w0..w100 (width) and b0..b100 (distance from the bottom), in per cent.
   Those three hundred small rules are added by admin/server.js when it starts.

   Colours: one hue for every bar (a chart here shows one thing), the reserved four for a state,
   and both sets chosen separately for the light and the dark screen. */
:root {
  color-scheme: light dark;
  --page: #f9f9f7; --surface: #fcfcfb; --ink: #0b0b0b; --ink2: #52514e; --muted: #898781;
  --grid: #e1e0d9; --axis: #c3c2b7; --border: rgba(11, 11, 11, .10); --wash: rgba(11, 11, 11, .05);
  --series: #2a78d6; --track: #cde2fb;
  --good: #0ca30c; --warning: #fab219; --critical: #d03b3b;
  --warning-track: #fdecc2; --critical-track: #f6d3d3;
  --tip: #0b0b0b; --tip-ink: #fcfcfb;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0d0d0d; --surface: #1a1a19; --ink: #f0efec; --ink2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, .10); --wash: rgba(255, 255, 255, .06);
    --series: #3987e5; --track: #0d366b;
    --warning-track: #4a3608; --critical-track: #4a1717;
    --tip: #f0efec; --tip-ink: #0d0d0d;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; }
a { color: inherit; text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--series); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.wrap { max-width: 68rem; margin: 0 auto; padding: 0 16px; }
.ic { width: 16px; height: 16px; flex: none; vertical-align: -3px; }

/* ---- the bar across the top ---- */
.top { background: var(--surface); border-bottom: 1px solid var(--border); }
.top .wrap { display: flex; align-items: center; gap: 8px 20px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.brand { font-weight: 600; margin-right: auto; }
.brand span { font-weight: 400; color: var(--ink2); margin-left: 6px; }
.top nav { display: flex; gap: 4px; }
.top nav a { padding: 6px 12px; border-radius: 8px; text-decoration: none; color: var(--ink2); }
.top nav a:hover { background: var(--wash); }
.top nav a[aria-current] { color: var(--ink); font-weight: 600; background: var(--wash); }
.count { font-size: .8125rem; color: var(--ink2); font-weight: 400; margin-left: 4px; }
.quiet { font: inherit; color: var(--ink2); background: none; border: 1px solid var(--border); border-radius: 8px; padding: 5px 12px; cursor: pointer; }
.quiet:hover { background: var(--wash); color: var(--ink); }

main { padding: 20px 0 40px; display: grid; gap: 20px; }
main > *, .card > *, .two > * { min-width: 0; } /* a wide table scrolls inside its own frame and never widens the page */
.head { display: flex; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; }
h1 { font-size: 1.375rem; font-weight: 600; }
h2 { font-size: 1.0625rem; font-weight: 600; }
.sub, .note { color: var(--ink2); font-size: .875rem; }
.note { max-width: 46rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; display: grid; gap: 14px; align-content: start; }
.two { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr)); }

/* ---- something that needs attention: an icon and words, never a colour alone ---- */
.state { display: flex; gap: 10px; align-items: flex-start; }
.state .ic { margin-top: 3px; }
.state.good .ic { color: var(--good); }
.state.warning .ic { color: var(--warning); }
.state.critical .ic { color: var(--critical); }
.alert { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; }
.alert .state + .state { margin-top: 8px; }
.alert.critical { border-color: var(--critical); }
.alert.warning { border-color: var(--warning); }

/* ---- numbers that stand alone ---- */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(9.25rem, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.tile .l { color: var(--ink2); font-size: .8125rem; }
.tile .v { font-size: 1.75rem; font-weight: 600; line-height: 1.25; }
.tile .sub { font-size: .8125rem; }
.tile .meter { margin-top: 8px; }

/* ---- one amount against its limit ---- */
.meter { height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 4px; background: var(--series); }
.meter.warning { background: var(--warning-track); } .meter.warning span { background: var(--warning); }
.meter.critical { background: var(--critical-track); } .meter.critical span { background: var(--critical); }
.limits { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
.limit .line { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 6px; }
.limit .line b { font-weight: 600; }

/* ---- the days to show: one row, above everything it changes ---- */
.presets { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.presets .lab { color: var(--ink2); font-size: .875rem; margin-right: 2px; }
.presets a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; color: var(--ink2); background: var(--surface); }
.presets a:hover { background: var(--wash); }
.presets a[aria-current] { color: var(--ink); font-weight: 600; border-color: var(--ink2); }

/* ---- a column for each day ---- */
.charts { display: grid; gap: 16px 28px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.chart { margin: 0; min-width: 0; }
.chart figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.chart .t { font-weight: 600; }
.plot { position: relative; height: 132px; margin: 26px 2px 0 30px; }
.plot .g { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--grid); }
.plot .g.b0 { border-top-color: var(--axis); }
.plot .g i { position: absolute; right: calc(100% + 6px); top: -.7em; font-style: normal; font-size: .75rem; line-height: 1.4; color: var(--muted); font-variant-numeric: tabular-nums; }
.cols { position: absolute; inset: 0; display: flex; align-items: stretch; gap: 2px; }
.cols.dense { gap: 1px; }
.col { flex: 1 1 0; min-width: 0; position: relative; display: flex; align-items: flex-end; justify-content: center; }
.col:hover { background: var(--wash); }
.bar { width: 100%; max-width: 24px; background: var(--series); border-radius: 4px 4px 0 0; }
.cols.dense .bar { border-radius: 2px 2px 0 0; }
.nz { min-height: 2px; min-width: 2px; }
.col:hover .bar { filter: brightness(1.15); }
.cap { position: absolute; left: 50%; transform: translate(-50%, -3px); font-size: .75rem; line-height: 1.3; color: var(--ink2); white-space: nowrap; font-variant-numeric: tabular-nums; pointer-events: none; }
.tip { display: none; position: absolute; z-index: 2; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); white-space: nowrap; background: var(--tip); color: var(--tip-ink); border-radius: 6px; padding: 3px 8px; font-size: .8125rem; pointer-events: none; }
.tip b { font-weight: 600; margin-right: 6px; }
.col.l .tip { left: 0; transform: none; }
.col.r .tip { left: auto; right: 0; transform: none; }
.col:hover .tip { display: block; }
.col:hover .cap { visibility: hidden; }
.xaxis { display: flex; justify-content: space-between; margin: 4px 2px 0 30px; font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--ink2); font-size: .875rem; pointer-events: none; }

/* ---- a bar for each row, all on one line to compare ---- */
.rows { display: grid; grid-template-columns: minmax(8rem, 17rem) minmax(4rem, 1fr) auto; grid-auto-flow: dense; gap: 8px 12px; align-items: center; max-width: 46rem; }
.rows .name { grid-column: 1; min-width: 0; }
.rows .name span { display: block; color: var(--ink2); font-size: .8125rem; }
.rows .track { grid-column: 2; height: 12px; }
.rows .fill { display: block; height: 100%; background: var(--series); border-radius: 0 4px 4px 0; }
.rows .num { grid-column: 3; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 560px) { /* the name and its number on one line, the bar under them */
  .rows { grid-template-columns: 1fr auto; gap: 4px 12px; }
  .rows .num { grid-column: 2; }
  .rows .track { grid-column: 1 / -1; margin-bottom: 8px; }
}
.plain { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.plain li { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.plain li span { color: var(--ink2); font-size: .875rem; display: block; }
.plain b { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- every number, day by day ---- */
details > summary { cursor: pointer; font-weight: 600; }
.scroll { overflow-x: auto; margin-top: 12px; }
table { border-collapse: collapse; width: 100%; font-size: .875rem; font-variant-numeric: tabular-nums; }
th, td { padding: 6px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--grid); }
th { color: var(--ink2); font-weight: 600; vertical-align: bottom; }
th:first-child, td:first-child { text-align: left; }
td.zero { color: var(--muted); }
tfoot td { font-weight: 600; border-bottom: 0; border-top: 1px solid var(--axis); }

/* ---- what visitors sent ---- */
.items { display: grid; gap: 12px; }
.item { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: grid; gap: 8px; min-width: 0; }
.item header { display: flex; gap: 6px 10px; flex-wrap: wrap; align-items: baseline; }
.item .day { font-weight: 600; }
.chip { font-size: .8125rem; color: var(--ink2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 9px; }
.ticked { margin: 0; padding: 0 0 0 1.1rem; color: var(--ink2); font-size: .9375rem; }
.words { white-space: pre-wrap; overflow-wrap: anywhere; }
.item blockquote { margin: 8px 0 0; padding: 2px 0 2px 12px; border-left: 3px solid var(--axis); }
.item details > summary { font-weight: 400; color: var(--ink2); font-size: .9375rem; }
.pages { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.pages a { padding: 5px 12px; border: 1px solid var(--border); border-radius: 8px; text-decoration: none; background: var(--surface); }
.pages a:hover { background: var(--wash); }

/* ---- signing in ---- */
.door { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.door form { width: 100%; max-width: 22rem; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px; display: grid; gap: 12px; }
.door h1 { font-size: 1.25rem; }
.door label { display: grid; gap: 4px; font-size: .875rem; color: var(--ink2); }
.door input { font: inherit; color: var(--ink); background: var(--page); border: 1px solid var(--axis); border-radius: 8px; padding: 9px 10px; width: 100%; }
.door button { font: inherit; font-weight: 600; color: var(--surface); background: var(--ink); border: 0; border-radius: 8px; padding: 10px; cursor: pointer; margin-top: 4px; }
.door .state { font-size: .9375rem; }

footer { border-top: 1px solid var(--border); padding: 16px 0 32px; }
footer p + p { margin-top: 8px; }
.h0{height:0%}.w0{width:0%}.b0{bottom:0%}
.h1{height:1%}.w1{width:1%}.b1{bottom:1%}
.h2{height:2%}.w2{width:2%}.b2{bottom:2%}
.h3{height:3%}.w3{width:3%}.b3{bottom:3%}
.h4{height:4%}.w4{width:4%}.b4{bottom:4%}
.h5{height:5%}.w5{width:5%}.b5{bottom:5%}
.h6{height:6%}.w6{width:6%}.b6{bottom:6%}
.h7{height:7%}.w7{width:7%}.b7{bottom:7%}
.h8{height:8%}.w8{width:8%}.b8{bottom:8%}
.h9{height:9%}.w9{width:9%}.b9{bottom:9%}
.h10{height:10%}.w10{width:10%}.b10{bottom:10%}
.h11{height:11%}.w11{width:11%}.b11{bottom:11%}
.h12{height:12%}.w12{width:12%}.b12{bottom:12%}
.h13{height:13%}.w13{width:13%}.b13{bottom:13%}
.h14{height:14%}.w14{width:14%}.b14{bottom:14%}
.h15{height:15%}.w15{width:15%}.b15{bottom:15%}
.h16{height:16%}.w16{width:16%}.b16{bottom:16%}
.h17{height:17%}.w17{width:17%}.b17{bottom:17%}
.h18{height:18%}.w18{width:18%}.b18{bottom:18%}
.h19{height:19%}.w19{width:19%}.b19{bottom:19%}
.h20{height:20%}.w20{width:20%}.b20{bottom:20%}
.h21{height:21%}.w21{width:21%}.b21{bottom:21%}
.h22{height:22%}.w22{width:22%}.b22{bottom:22%}
.h23{height:23%}.w23{width:23%}.b23{bottom:23%}
.h24{height:24%}.w24{width:24%}.b24{bottom:24%}
.h25{height:25%}.w25{width:25%}.b25{bottom:25%}
.h26{height:26%}.w26{width:26%}.b26{bottom:26%}
.h27{height:27%}.w27{width:27%}.b27{bottom:27%}
.h28{height:28%}.w28{width:28%}.b28{bottom:28%}
.h29{height:29%}.w29{width:29%}.b29{bottom:29%}
.h30{height:30%}.w30{width:30%}.b30{bottom:30%}
.h31{height:31%}.w31{width:31%}.b31{bottom:31%}
.h32{height:32%}.w32{width:32%}.b32{bottom:32%}
.h33{height:33%}.w33{width:33%}.b33{bottom:33%}
.h34{height:34%}.w34{width:34%}.b34{bottom:34%}
.h35{height:35%}.w35{width:35%}.b35{bottom:35%}
.h36{height:36%}.w36{width:36%}.b36{bottom:36%}
.h37{height:37%}.w37{width:37%}.b37{bottom:37%}
.h38{height:38%}.w38{width:38%}.b38{bottom:38%}
.h39{height:39%}.w39{width:39%}.b39{bottom:39%}
.h40{height:40%}.w40{width:40%}.b40{bottom:40%}
.h41{height:41%}.w41{width:41%}.b41{bottom:41%}
.h42{height:42%}.w42{width:42%}.b42{bottom:42%}
.h43{height:43%}.w43{width:43%}.b43{bottom:43%}
.h44{height:44%}.w44{width:44%}.b44{bottom:44%}
.h45{height:45%}.w45{width:45%}.b45{bottom:45%}
.h46{height:46%}.w46{width:46%}.b46{bottom:46%}
.h47{height:47%}.w47{width:47%}.b47{bottom:47%}
.h48{height:48%}.w48{width:48%}.b48{bottom:48%}
.h49{height:49%}.w49{width:49%}.b49{bottom:49%}
.h50{height:50%}.w50{width:50%}.b50{bottom:50%}
.h51{height:51%}.w51{width:51%}.b51{bottom:51%}
.h52{height:52%}.w52{width:52%}.b52{bottom:52%}
.h53{height:53%}.w53{width:53%}.b53{bottom:53%}
.h54{height:54%}.w54{width:54%}.b54{bottom:54%}
.h55{height:55%}.w55{width:55%}.b55{bottom:55%}
.h56{height:56%}.w56{width:56%}.b56{bottom:56%}
.h57{height:57%}.w57{width:57%}.b57{bottom:57%}
.h58{height:58%}.w58{width:58%}.b58{bottom:58%}
.h59{height:59%}.w59{width:59%}.b59{bottom:59%}
.h60{height:60%}.w60{width:60%}.b60{bottom:60%}
.h61{height:61%}.w61{width:61%}.b61{bottom:61%}
.h62{height:62%}.w62{width:62%}.b62{bottom:62%}
.h63{height:63%}.w63{width:63%}.b63{bottom:63%}
.h64{height:64%}.w64{width:64%}.b64{bottom:64%}
.h65{height:65%}.w65{width:65%}.b65{bottom:65%}
.h66{height:66%}.w66{width:66%}.b66{bottom:66%}
.h67{height:67%}.w67{width:67%}.b67{bottom:67%}
.h68{height:68%}.w68{width:68%}.b68{bottom:68%}
.h69{height:69%}.w69{width:69%}.b69{bottom:69%}
.h70{height:70%}.w70{width:70%}.b70{bottom:70%}
.h71{height:71%}.w71{width:71%}.b71{bottom:71%}
.h72{height:72%}.w72{width:72%}.b72{bottom:72%}
.h73{height:73%}.w73{width:73%}.b73{bottom:73%}
.h74{height:74%}.w74{width:74%}.b74{bottom:74%}
.h75{height:75%}.w75{width:75%}.b75{bottom:75%}
.h76{height:76%}.w76{width:76%}.b76{bottom:76%}
.h77{height:77%}.w77{width:77%}.b77{bottom:77%}
.h78{height:78%}.w78{width:78%}.b78{bottom:78%}
.h79{height:79%}.w79{width:79%}.b79{bottom:79%}
.h80{height:80%}.w80{width:80%}.b80{bottom:80%}
.h81{height:81%}.w81{width:81%}.b81{bottom:81%}
.h82{height:82%}.w82{width:82%}.b82{bottom:82%}
.h83{height:83%}.w83{width:83%}.b83{bottom:83%}
.h84{height:84%}.w84{width:84%}.b84{bottom:84%}
.h85{height:85%}.w85{width:85%}.b85{bottom:85%}
.h86{height:86%}.w86{width:86%}.b86{bottom:86%}
.h87{height:87%}.w87{width:87%}.b87{bottom:87%}
.h88{height:88%}.w88{width:88%}.b88{bottom:88%}
.h89{height:89%}.w89{width:89%}.b89{bottom:89%}
.h90{height:90%}.w90{width:90%}.b90{bottom:90%}
.h91{height:91%}.w91{width:91%}.b91{bottom:91%}
.h92{height:92%}.w92{width:92%}.b92{bottom:92%}
.h93{height:93%}.w93{width:93%}.b93{bottom:93%}
.h94{height:94%}.w94{width:94%}.b94{bottom:94%}
.h95{height:95%}.w95{width:95%}.b95{bottom:95%}
.h96{height:96%}.w96{width:96%}.b96{bottom:96%}
.h97{height:97%}.w97{width:97%}.b97{bottom:97%}
.h98{height:98%}.w98{width:98%}.b98{bottom:98%}
.h99{height:99%}.w99{width:99%}.b99{bottom:99%}
.h100{height:100%}.w100{width:100%}.b100{bottom:100%}
