/* The console's look. Tokens first: colours, sizes and spacing live here, so a change of look is a change of this block.
   Light by default, dark when the system asks for it. The accent never means a state; status colours only mean status. */
:root {
  --bg: #f7f7f8; --surface: #ffffff; --ink: #1d1f23; --muted: #646a73; --line: #e3e5e8; --field: #c9cdd3;
  --accent: #1f5fd0; --accent-ink: #ffffff; --accent-soft: #e8effb;
  --ok: #1a7f45; --warn: #a86400; --bad: #c22f28; --notice: #fff7e0; --notice-line: #ecd48c;
  --radius: 8px; --gap: 16px; --page: 1040px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --mono: ui-monospace, "SF Mono", Consolas, monospace;
  --size: 15px; --small: 13px; --h1: 22px; --h2: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121316; --surface: #1b1d21; --ink: #e8e9eb; --muted: #9aa0a8; --line: #2c2f35; --field: #3a3e45;
    --accent: #7aa5f0; --accent-ink: #0d1420; --accent-soft: #1d2a40;
    --ok: #4cc27f; --warn: #e3a646; --bad: #ef6b63; --notice: #2b2616; --notice-line: #5a4c22;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body { margin: 0; font: var(--size)/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Page frame: one header, the page below it. On a phone the menu scrolls sideways rather than hiding. */
header.top { position: relative; display: flex; align-items: center; gap: 24px; padding: 0 24px; min-height: 56px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 17px; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
header nav { display: flex; align-items: center; gap: 20px; flex: 1; overflow-x: auto; white-space: nowrap; }
header nav a { color: var(--muted); text-decoration: none; padding: 17px 0 15px; border-bottom: 2px solid transparent; }
header nav a:hover { color: var(--ink); }
header nav a.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
#who { margin-left: auto; display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: var(--small); }
#who .account { color: var(--ink); font-weight: 600; }
/* The account menu: drops below the header (placed against the header, so the scrolling menu bar never clips it). */
#who details.accounts .account { display: inline; }
details.accounts summary { cursor: pointer; display: flex; gap: 6px; align-items: center; }
details.accounts ul { position: absolute; right: 24px; top: 100%; z-index: 10; margin: 0; padding: 8px 0; list-style: none; min-width: 260px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 24px rgb(0 0 0 / .12); }
details.accounts li { display: flex; gap: 8px; align-items: center; padding: 6px 14px; color: var(--ink); }
details.accounts li > span:first-child { flex: 1; }
main { max-width: var(--page); margin: 28px auto; padding: 0 24px; }
@media (max-width: 640px) {
  header.top { gap: 14px; padding: 0 14px; }
  main { margin: 18px auto; padding: 0 14px; }
  #who .account { display: none; }
}

h1 { font-size: var(--h1); margin: 0 0 18px; letter-spacing: -.01em; }
h2 { font-size: var(--h2); margin: 0 0 12px; }
.crumb { margin: 0 0 6px; font-size: var(--small); }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--ink); }

/* Sub-menu inside an area (developers, staff). */
nav.tabs { display: flex; gap: 18px; margin: -6px 0 20px; border-bottom: 1px solid var(--line); }
nav.tabs a { color: var(--muted); text-decoration: none; padding: 8px 0; border-bottom: 2px solid transparent; margin-bottom: -1px; }
nav.tabs a.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

label { display: block; margin-bottom: 12px; font-size: var(--small); color: var(--muted); }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; color: var(--ink); border: 1px solid var(--field); border-radius: 6px; background: var(--surface); }
input[type=checkbox] { display: inline; width: auto; margin: 0 6px 0 0; }
textarea { min-height: 130px; font-family: var(--mono); font-size: var(--small); }
textarea.tall { min-height: 320px; font-family: inherit; font-size: 14px; }
label.check { display: flex; align-items: center; color: var(--ink); }
select.language { width: auto; margin: 0; padding: 3px 6px; font-size: var(--small); }

button, .button { display: inline-block; font: inherit; padding: 8px 14px; border: 1px solid var(--accent); border-radius: 6px; background: var(--accent); color: var(--accent-ink); text-decoration: none; cursor: pointer; }
button.quiet, .button.quiet { background: transparent; color: var(--accent); }
button.quiet[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
button.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
button.small { padding: 3px 10px; font-size: var(--small); }
button:disabled { opacity: .55; cursor: default; }
.wide { display: block; text-align: center; margin-bottom: 10px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 var(--gap); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; margin-top: 0; }
.space { margin-top: 20px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: var(--small); }
.mono { font-family: var(--mono); font-size: var(--small); word-break: break-all; }
.prewrap { white-space: pre-wrap; }
ul { margin: 0; padding-left: 18px; }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 12px; margin: 0; overflow: auto; white-space: pre-wrap; word-break: break-word; font: var(--small)/1.5 var(--mono); }

/* Status: a dot and a word, never a colour alone. */
.badge { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.error { color: var(--bad); margin: 0 0 12px; }
.notice { background: var(--notice); border: 1px solid var(--notice-line); border-radius: 6px; padding: 12px; margin: 0 0 16px; }

.bars { display: block; width: 100%; height: 120px; }
.bars rect { fill: var(--accent); }
.bars rect.empty { fill: var(--line); }

/* Pages without the menu: login, sign-up, legal texts, not found. */
.login { max-width: 380px; margin: 10vh auto; }
.reading { max-width: 720px; margin: 0 auto; }
.narrow { max-width: 560px; margin: 8vh auto; }

/* Staff acting in a customer's account: always visible. */
.acting { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 8px 16px; background: var(--bad); color: #fff; font-weight: 600; }
.acting button { color: #fff; border-color: #fff; }

/* Printers. A switched-off printer reads as set aside, not as broken. */
tr.off td { color: var(--muted); }
tr.off a { color: var(--muted); }
.badge.muted { color: var(--muted); }
input[type=search] { width: 100%; max-width: 420px; margin-bottom: 14px; }
.card table.facts { border: 0; margin: 0; background: transparent; }
table.facts th { width: 34%; text-transform: none; letter-spacing: 0; font-size: var(--small); font-weight: 500; }
table.facts tr:last-child th, table.facts tr:last-child td { border-bottom: 0; }
details.card > summary { cursor: pointer; font-weight: 600; }
details.card[open] > summary { margin-bottom: 12px; }

/* Adding a printer: its kind as two cards to choose from, and the camera when scanning its QR code. */
fieldset.choices { border: 0; padding: 0; margin: 0 0 14px; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
fieldset.choices legend { font-size: var(--small); color: var(--muted); margin-bottom: 6px; }
label.choice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
label.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
label.choice > span { display: flex; flex-direction: column; gap: 2px; }
label.choice input { width: auto; margin-top: 3px; }
video.scan { width: 100%; max-width: 420px; border-radius: var(--radius); background: #000; display: block; margin: 10px 0; }

/* Tickets: the filters on one line where there's room, and a ticket's journey as steps. */
form.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
form.filters label { flex: 1 1 140px; }
ol.journey { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
ol.journey li { position: relative; display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 5px 0; }
ol.journey li::before { content: ""; position: absolute; left: -19px; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
ol.journey li.bad::before { background: var(--bad); }

/* "Do this with the API", under every private page. */
details.api { max-width: var(--page); margin: 0 auto 28px; padding: 0 24px; font-size: var(--small); color: var(--muted); }
details.api summary { cursor: pointer; }
details.api pre { white-space: pre-wrap; word-break: break-all; }

/* Activation codes: QR codes stay black on white in dark mode too; the label sheet shows only when printed. */
.qr { display: block; background: #fff; }
.qr path { fill: #000; }
.qr-small { width: 96px; }
.code { font-family: var(--mono); font-size: 1.2em; letter-spacing: 0.05em; }
.labels { display: none; }
@media print {
  body * { visibility: hidden; }
  .labels, .labels * { visibility: visible; }
  .labels { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8mm; position: absolute; left: 0; top: 0; width: 100%; color: #000; }
  .label { break-inside: avoid; border: 1px dashed #999; padding: 4mm; text-align: center; }
  .label .qr { width: 40mm; margin: 2mm auto; }
  .label .code { font-size: 20pt; font-weight: bold; }
}
