/* The staff admin: the hub panel's colours (a deep teal accent, red only
   for danger), denser - it is a desk tool with tables, not a phone app. */

:root {
  color-scheme: light dark;
  --bg: #f2f4f5;
  --surface: #ffffff;
  --surface-2: #e8ecee;
  --line: #d9dfe2;
  --text: #13181b;
  --text-2: #4a555c;
  --accent: #0a6c70;
  --accent-soft: #d6eded;
  --on-accent: #ffffff;
  --ok: #18774a;
  --ok-soft: #dcf1e5;
  --warn-soft: #fbedd5;
  --danger: #b3261e;
  --danger-soft: #fbe3e1;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  /* Activity levels: 0 is no activity, a neutral that recedes; 1-4 are
     one hue, light to dark, so the order reads without a legend. Steps of
     the data-viz reference blue ramp (250, 350, 500, 650), validated as an
     ordinal ramp against --surface: monotone lightness, every step at
     least 0.06 apart, the palest at 2.1:1. Blue, not the teal accent, so
     data never looks like a link or a button. */
  --hm-0: #e8ecee;
  --hm-1: #86b6ef;
  --hm-2: #5598e7;
  --hm-3: #256abf;
  --hm-4: #104281;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1214;
    --surface: #171c1f;
    --surface-2: #20272b;
    --line: #283035;
    --text: #e6ebee;
    --text-2: #a7b2b8;
    --accent: #52c3be;
    --accent-soft: #143b3b;
    --on-accent: #042322;
    --ok: #62d399;
    --ok-soft: #133122;
    --warn-soft: #382a10;
    --danger: #ff8b80;
    --danger-soft: #3d1815;
    /* Dark flips the anchor: little activity recedes into the dark
       surface, much activity is bright. Steps 600, 500, 400, 250 of the
       same ramp, validated against this --surface (palest-to-surface end
       at 2.1:1). */
    --hm-0: #283035;
    --hm-1: #184f95;
    --hm-2: #256abf;
    --hm-3: #3987e5;
    --hm-4: #86b6ef;
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
}

a { color: var(--accent); }
code, .mono { font-family: var(--mono); font-size: 0.9em; word-break: break-all; }

.bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.bar .brand { font-size: 1.05rem; }
.bar .who { margin-left: auto; color: var(--text-2); }

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  padding: 8px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.nav:empty { display: none; }
.nav a { text-decoration: none; padding: 4px 0; }
.nav a.current { font-weight: 600; border-bottom: 2px solid var(--accent); }
.nav a.later { color: var(--text-2); }

.main { max-width: 1200px; margin: 0 auto; padding: 20px; outline: none; }

h1 { font-size: 1.4rem; margin: 0 0 16px; }
h2 { font-size: 1.1rem; margin: 0 0 10px; }

.card, .block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.card.narrow { max-width: 480px; margin: 40px auto; }

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }

.btn {
  font: inherit;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.danger { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn.small { padding: 3px 10px; font-size: 0.9em; }
.actions, .actions-block { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }

.field {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  min-width: 220px;
  max-width: 100%;
}
input.field.mono { width: 100%; }
textarea.field { width: 100%; }
.label { display: grid; gap: 4px; margin: 8px 0; }
.check, .choice, .warning { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; }
.choices, .warnings { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 12px 0; }
.warnings { background: var(--warn-soft); }

.note { margin: 8px 0; }
.note:empty { display: none; }
.note.bad { color: var(--danger); }
.note.ok { color: var(--ok); }
.muted { color: var(--text-2); }
.strong { font-weight: 600; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0 0 12px; }
.facts dt { color: var(--text-2); }
.facts dd { margin: 0; }

.table-wrap { overflow-x: auto; }
.table { border-collapse: collapse; width: 100%; }
.table th, .table td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--text-2); font-weight: 500; }

.tiles { display: flex; gap: 16px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 18px; display: grid; }
.tile-value { font-size: 1.8rem; font-weight: 600; }

.pill { padding: 1px 8px; border-radius: 999px; background: var(--surface-2); }
.pill.on { background: var(--ok-soft); color: var(--ok); }

.secret { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius); padding: 12px 16px; margin: 12px 0; display: grid; gap: 8px; }
.secret-value { user-select: all; }

.camera { width: 100%; max-width: 420px; border-radius: var(--radius); background: #000; margin: 8px 0; }
.camera[hidden] { display: none; }
.inline-form { display: grid; gap: 8px; max-width: 480px; margin: 12px 0; }
.plain { padding-left: 18px; }

.sub-title { font-size: 1rem; margin: 12px 0 6px; }
.with-edit { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.field.mono-short { font-family: var(--mono); min-width: 140px; width: 180px; }
.label.inline { display: inline-grid; }
.notice { width: 100%; margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--warn-soft); }
.trend { margin: 8px 0; }

.notes { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 10px; }
.dossier-note { border-left: 3px solid var(--accent); padding: 4px 0 4px 12px; }
.dossier-note p { margin: 2px 0; }
.note-meta { color: var(--text-2); font-size: 0.9em; }
/* A note keeps its line breaks: it is text as staff typed it. */
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.dossier-note.struck { border-left-color: var(--line); }
.dossier-note.struck .note-text { text-decoration: line-through; color: var(--text-2); }
.note-form { max-width: 720px; }

/* The activity grid: 53 week columns of 7 day rows, filled column by
   column; cells are 11px with a 2px surface gap so neighbours stay apart. */
.heatmap { --hm-size: 11px; --hm-gap: 2px; }
.hm-scroll { overflow-x: auto; padding-bottom: 4px; }
.hm-frame { display: inline-grid; grid-template-columns: auto auto; gap: 4px 6px; }
.hm-months, .hm-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--hm-size);
  column-gap: var(--hm-gap);
}
.hm-months { font-size: 0.75rem; color: var(--text-2); line-height: 1; }
/* A month's name runs over the empty columns after it. */
.hm-months span { white-space: nowrap; overflow: visible; }
.hm-grid { grid-template-rows: repeat(7, var(--hm-size)); row-gap: var(--hm-gap); }
.hm-weekdays { display: grid; grid-template-rows: repeat(7, var(--hm-size)); row-gap: var(--hm-gap); font-size: 0.7rem; line-height: var(--hm-size); color: var(--text-2); }
.hm-cell { display: block; width: var(--hm-size); height: var(--hm-size); border-radius: 2px; }
.hm-cell.blank { background: transparent; }
.hm-cell.l0 { background: var(--hm-0); }
.hm-cell.l1 { background: var(--hm-1); }
.hm-cell.l2 { background: var(--hm-2); }
.hm-cell.l3 { background: var(--hm-3); }
.hm-cell.l4 { background: var(--hm-4); }
.hm-legend { display: flex; align-items: center; gap: 3px; margin-top: 6px; font-size: 0.8rem; --hm-size: 11px; }
.hm-legend .muted { margin: 0 4px; }
/* The strip in a list: 91 days in a row, narrow bars so it fits a table. */
.hm-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 4px; column-gap: 1px; --hm-size: 16px; }
.hm-strip .hm-cell { width: 4px; border-radius: 1px; }
/* The last 48 hours of refused attempts: a bar an hour, a label every six
   hours running over the bars after it. */
.hm-hours-frame { display: inline-grid; gap: 3px; max-width: 100%; overflow-x: auto; }
.hm-hours, .hm-hours-labels { display: grid; grid-auto-flow: column; grid-auto-columns: 12px; column-gap: 2px; }
.hm-hours .hm-cell { width: 12px; height: 24px; }
.hm-hours-labels { font-size: 0.7rem; color: var(--text-2); line-height: 1; }
.hm-hours-labels span { white-space: nowrap; overflow: visible; }
/* Forced colours would strip the levels away; the titles and the totals
   table still say the values, but the grid should keep its shades. */
@media (forced-colors: active) {
  .hm-cell { forced-color-adjust: none; }
}

.overlay { position: fixed; inset: 0; background: rgb(0 0 0 / 45%); display: grid; place-items: center; padding: 16px; z-index: 10; }
.dialog { background: var(--surface); border-radius: var(--radius); padding: 18px 20px; max-width: 520px; width: 100%; }

/* Firmware updates: release notes keep their lines; red marks what needs a
   look - a halted rollout, a hub a security release does not reach by
   itself; the current wave stands out. */
.release-notes { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; max-width: 48ch; }
.untrusted { white-space: pre-wrap; overflow-wrap: anywhere; }
.block-line { display: block; }
.pills { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.bad-text { color: var(--danger); }
.table tr.alert td { background: var(--danger-soft); }
.table tr.current td { font-weight: 600; }
.notice.danger { background: var(--danger-soft); color: var(--danger); }
.rollout { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.rollout:first-child { border-top: none; margin-top: 0; }
.label[hidden] { display: none; }
/* The live status line under a page's title (live.js). */
.live-status { margin: 0 0 12px; }
.live-line { margin: 0; }
.live-note { margin: 2px 0 0; font-size: 0.85em; }
