/* The Blueprint look (D-G11): every colour is a token here; dark only, by design. */

@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/BarlowCondensed-600-latin.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 100 700; font-stretch: 100%; font-display: swap;
  src: url("fonts/IBMPlexSans-latin.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/IBMPlexMono-400-latin.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/IBMPlexMono-500-latin.woff2") format("woff2"); }

:root {
  --bg: #0d1b33;
  --surface: #12264a;
  --ink: #e4edfb;
  --muted: #8fa6cc;
  --line: #284a7e;
  --accent: #7cc7ff;
  --accent-ink: #06172e;
  --ok: #7be0b0;
  --warn: #ffd27a;
  --bad: #ff8f8f;
  --grid: rgba(124, 199, 255, .07);
  --qr-paper: #ffffff; /* a QR code reads only dark on light */

  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 2px;

  color-scheme: dark;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
}

a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1 { font-family: var(--display); font-weight: 600; font-size: 26px; text-transform: uppercase; letter-spacing: .06em; margin: 0; text-wrap: balance; }

.fine { font-size: 12px; color: var(--muted); margin: 0; }

/* Shared text styles: a small mono capital label, and a line of mono detail. */
.field span, .eyebrow, .choices legend { font-family: var(--mono); font-weight: 400; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.meta { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* Read out, not shown: what a repeated button acts on, and a page's heading where the page shows none. */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Forms */
.stack { display: grid; gap: 10px; width: min(300px, 100%); }
.stack > button, .stack > .buttons { justify-self: start; }
.field { display: grid; gap: 4px; text-align: left; }
input:not([type=checkbox]):not([type=hidden]) {
  font: inherit; font-size: 16px; padding: 10px 12px;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
}
button { font: inherit; cursor: pointer; }
button.primary, a.button.primary, button.secondary {
  font-weight: 600; padding: 10px 12px; border: 0; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink);
  text-transform: uppercase; letter-spacing: .06em;
}
a.button { display: inline-block; text-decoration: none; }
button.secondary { background: none; border: 1px solid var(--accent); color: var(--accent); }
button.quiet { min-height: 32px; padding: 4px 0; border: 0; background: none; color: var(--accent); text-decoration: underline; }
input[type=checkbox] { accent-color: var(--accent); margin: 0; }

/* The front door */
.door { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px; padding: 44px 16px; text-align: center; }
.door .fine { max-width: 34ch; overflow-wrap: anywhere; }

/* A refusal or a warning above a form, and an admin change's done-notice */
.notice { margin: 0; padding: 8px 12px; max-width: 300px; border: 1px solid var(--bad); border-radius: var(--radius); color: var(--bad); font-size: 14px; }
/* What an admin change just did: the same box, neutral */
.notice.done { border-color: var(--line); color: var(--ink); }

/* Setting up an authenticator app, and backup codes shown once */
.qr { justify-self: center; width: 196px; height: 196px; image-rendering: pixelated; background: var(--qr-paper); padding: 8px; border-radius: var(--radius); }
.key code, .codes code { font-family: var(--mono); font-size: 14px; letter-spacing: .06em; overflow-wrap: anywhere; }
.key { margin: 0; max-width: 300px; justify-self: center; text-align: center; }
.codes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, auto); gap: 8px 24px; }
/* A link code just made, read off the screen and typed in an installed app */
.link-code { font-family: var(--mono); font-size: 32px; font-weight: 500; letter-spacing: .12em; }

/* The small rack: its lights blink, and stay still for anyone who asks for less motion. */
.rack { width: min(260px, 70vw); height: auto; color: var(--ink); }
.rack.mark { display: block; width: auto; height: 48px; }
.rack .stroke { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.rack .soft { fill: color-mix(in srgb, var(--accent) 18%, transparent); }
.rack .led { fill: var(--ok); }
.rack .led.warn { fill: var(--warn); }
/* The header's mark is much smaller: its lines and lights are drawn heavier to read as the same rack. */
.rack.mark .stroke { stroke-width: 5; }
.rack.mark .led { r: 5px; }
@media (prefers-reduced-motion: no-preference) {
  .rack .led { animation: blink 1.6s infinite steps(2, jump-none); }
  .rack .led:nth-of-type(2n) { animation-duration: .9s; }
  .rack .led:nth-of-type(3n) { animation-duration: 2.3s; animation-delay: .4s; }
  @keyframes blink { 0% { opacity: 1 } 100% { opacity: .25 } }
}

/* The header and a signed-in page */
.masthead { display: flex; justify-content: space-between; align-items: center; padding: 6px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.actions { display: flex; gap: 16px; align-items: center; font-size: 14px; }
.actions form { margin: 0; }
.page { max-width: 1000px; margin: 0 auto; padding: 28px 16px 48px; }
.top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.who { font-size: 13px; color: var(--muted); margin: 0; }
.who b { color: var(--ink); font-weight: 600; }
.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: var(--radius); border: 1px solid var(--accent); color: var(--accent); margin-left: 6px; vertical-align: 1px; }
.eyebrow { margin: 0 0 10px; }

/* The admin pages' section nav (D-A10): the page shown is marked. */
.sections { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 22px; padding-bottom: 8px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.sections a, .periods a { color: var(--muted); text-decoration: none; }
.sections a { padding: 2px 0; }
.sections a:hover, .periods a:hover { color: var(--ink); }
.sections a[aria-current="page"], .periods a[aria-current="page"] { color: var(--accent); border-bottom: 2px solid var(--accent); }

/* The Usage, Refusals and System pages (D-A6, D-A8, D-A9): the period chosen, tables of figures and a bar per day against the busiest */
.periods { display: flex; gap: 14px; font-family: var(--mono); font-size: 12px; }
.table-scroll { width: 100%; overflow-x: auto; }
table.figures { border-collapse: collapse; font-size: 13px; }
table.figures th, table.figures td { padding: 4px 12px 4px 0; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.figures thead th { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
table.figures tbody th { font-weight: 600; }
table.figures td.wrap { white-space: normal; overflow-wrap: anywhere; min-width: 24ch; }
table.figures .num { text-align: right; font-variant-numeric: tabular-nums; }
table.figures .bad { color: var(--bad); }
table.figures meter { width: 120px; height: 8px; background: var(--line); border: 0; }
table.figures meter::-webkit-meter-bar { background: var(--line); border: 0; }
table.figures meter::-webkit-meter-optimum-value { background: var(--accent); }
table.figures meter::-moz-meter-bar { background: var(--accent); }
table.figures tr.warn td, table.figures tr.warn th { color: var(--warn); font-weight: 600; }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 22px; }
.tile { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 16px; background: var(--surface); border: 1px solid var(--line); color: inherit; text-decoration: none; }
.tile:hover { border-color: var(--accent); }
.tile .ico { grid-row: span 3; width: 36px; height: 36px; border-radius: var(--radius); display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.tile .ico svg { width: 20px; height: 20px; }
.name { font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.tile .desc { font-size: 13px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.up { background: var(--ok); }
.dot.down { background: var(--bad); }

/* The device card: the certificate this device signed in with, on the bare ground, its warning on the
   right 30 days before it expires */
.device { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; padding: 14px 16px; border: 1px dashed var(--line); border-radius: var(--radius); font-size: 13px; }
.device .left { min-width: 0; display: grid; gap: 4px; }
.warnline { color: var(--warn); font-weight: 600; }
.device.warn { border-color: var(--warn); }

/* The account page: a panel per section, a row per passkey, session or certificate */
.account .panel { display: grid; gap: 12px; justify-items: start; margin-bottom: 18px; padding: 16px; background: var(--surface); border: 1px solid var(--line); }
.account .panel .eyebrow { margin: 0; }
.account .who { overflow-wrap: anywhere; }
.buttons { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.buttons form { margin: 0; }
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; width: 100%; }
.rows li { display: grid; gap: 4px; justify-items: start; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.rows li:last-child { border-bottom: 0; padding-bottom: 0; }
.rows form { margin: 0; }
.rows .children { padding-left: 16px; gap: 4px; }
.rows .children li { padding-bottom: 0; border-bottom: 0; }
form.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.fingerprint { font-family: var(--mono); font-size: 12px; font-weight: 400; overflow-wrap: anywhere; }
.pill.bad { border-color: var(--bad); color: var(--bad); }

/* The People page: a person's roles chosen with checkboxes */
.later { min-width: 0; margin: 0; padding: 0; border: 0; }
.choices { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 0; border: 0; }
.choices legend { padding: 0; margin-bottom: 4px; }
.choices label { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; }
.setup-link { display: grid; gap: 8px; justify-items: start; }

/* The public landing page (D-F5): the brand in the masthead, one reading column, the hero with the rack,
   and the footer. */
.public .masthead { gap: 12px; }
.public .brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--display); font-weight: 600; font-size: 20px; letter-spacing: .06em; text-transform: uppercase; }
.public .brand .rack.mark { height: 30px; }
.public .brand .rack.mark .stroke { stroke-width: 6; }
.public .page { max-width: 720px; padding: 40px 16px 0; display: grid; gap: 36px; line-height: 1.55; }
.public h1 { font-size: clamp(34px, 7vw, 48px); line-height: 1.05; letter-spacing: .05em; }
.public p { margin: 0; max-width: 65ch; }
.public .lede { font-size: 18px; max-width: 60ch; }
.public .hero { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; }
.public .hero .copy { display: grid; gap: 14px; min-width: 0; }
.public .hero .rack { width: 200px; }

/* The footer, after <main>, keeps the reading column: 720px less its 16px gutters, so its rule spans the text. */
.public .foot { max-width: 688px; margin: 36px max(16px, calc((100% - 688px) / 2)) 0; padding: 16px 0 56px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }

/* A phone (390px wide and so): nothing scrolls sideways; a table's rows stack, each figure labelled by
   its column (`data-label`); forms and their main buttons take the width; every target is 44px tall. */
@media (max-width: 600px) {
  .actions { flex-wrap: wrap; justify-content: flex-end; gap: 0 16px; }
  .actions a, .actions button.quiet { display: inline-flex; align-items: center; min-height: 44px; }

  .door { justify-content: stretch; }
  .page { padding-top: 20px; }
  .account .panel { padding: 14px 12px; }
  .stack { width: 100%; }
  .stack > button, .stack > .buttons { justify-self: stretch; }
  .notice, .key { max-width: none; }
  .account .panel > form { justify-self: stretch; }
  button.primary, a.button.primary, button.secondary { width: 100%; min-height: 44px; text-align: center; }
  .buttons { gap: 8px 16px; align-items: center; }
  .buttons > a { display: inline-flex; align-items: center; min-height: 44px; }
  button.quiet { min-height: 44px; }
  .choices label { min-height: 44px; }
  .name, .meta, .who, .setup-link .fine { overflow-wrap: anywhere; }

  /* The admin nav: two rows of three, each a whole target. */
  .sections { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; padding-bottom: 0; }
  .sections a { display: flex; align-items: center; min-height: 44px; padding: 0; }
  .periods a { display: inline-flex; align-items: center; min-height: 44px; }

  /* The header row is read out, not shown, like .visually-hidden: a rule cannot share one block between an
     always-on selector and a phone-only one, so only the declarations that hide are repeated here. */
  table.figures thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.figures, table.figures tbody, table.figures tr, table.figures tbody th, table.figures td { display: block; width: 100%; }
  table.figures tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.figures tbody tr:last-child { border-bottom: 0; }
  table.figures tbody th, table.figures td { padding: 2px 0; border-bottom: 0; white-space: normal; overflow-wrap: anywhere; }
  table.figures .num { text-align: left; }
  table.figures td.wrap { min-width: 0; }
  table.figures td.bar, table.figures td:empty { display: none; }
  table.figures [data-label]::before {
    content: attr(data-label); display: inline-block; min-width: 13ch; margin-right: 8px;
    font-family: var(--mono); font-size: 11px; font-weight: 400; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  }

  /* The public page: the hero's picture gives way to the words. */
  .public .hero { grid-template-columns: 1fr; }
  .public .hero .rack { display: none; }
}
