/* HypX Fleet. The design language of the HypX admin console: Geist, a warm
   off-white page, white cards with hairline borders, pill buttons, and
   colour kept for what needs attention. */

@font-face {
  font-family: "Geist";
  src: url("/static/fonts/geist-1.9.2.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/static/fonts/geist-mono-1.9.2.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f6f6f3;
  --surface: #ffffff;
  --line: #e5e5df;
  --line-strong: #d6d6ce;
  --fill: #edede8;
  --hover: #fafaf8;
  --ink: #1b1b18;
  --ink-2: #4b4b45;
  --muted: #76766d; /* the console's #8a8a80, a shade darker so small text stays readable */
  --brand: #6b2ed9;
  --bad: #d6453d;
  --bad-ink: #b8342c;
  --bad-bg: #faedeb;
  --warn: #e0870f;
  --warn-ink: #96560a;
  --warn-bg: #fcf2e3;
  --good: #218c54;
  --good-bg: #e5f5e8;
  --info: #3b82f5;
  --info-ink: #1f5fcc;
  --info-bg: #eaf1fe;
  --off: #b9b9b0;
  --on-ink: #ffffff;
  --scrim: rgba(27, 27, 24, 0.36);
  --shadow: 0 1px 2px rgba(27, 27, 24, 0.04);
  --pop: 0 12px 32px rgba(27, 27, 24, 0.14), 0 2px 6px rgba(27, 27, 24, 0.06);
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --side: 232px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211;
    --surface: #1b1b19;
    --line: #2c2c29;
    --line-strong: #3a3a36;
    --fill: #262623;
    --hover: #20201e;
    --ink: #ededea;
    --ink-2: #c4c4bd;
    --muted: #96968c;
    --brand: #9d6bff;
    --bad: #ef6158;
    --bad-ink: #f4877f;
    --bad-bg: #351a17;
    --warn: #f0a033;
    --warn-ink: #f3b55f;
    --warn-bg: #33250f;
    --good: #46c07f;
    --good-bg: #13291c;
    --info: #6aa1ff;
    --info-ink: #8db6ff;
    --info-bg: #15233b;
    --off: #5d5d57;
    --on-ink: #121211;
    --scrim: rgba(0, 0, 0, 0.55);
    --shadow: none;
    --pop: 0 12px 32px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

/* ---- base ---- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.45 var(--sans);
  font-feature-settings: "ss01" 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body.noscroll { overflow: hidden; }

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
b, strong { font-weight: 600; }
small { font-size: 12px; }
code, .mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: -0.01em; }
code { background: var(--fill); border-radius: 5px; padding: 1px 5px; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.sr {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.i {
  width: 16px; height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.soft { color: var(--muted); }
.warn-text, .who small.warn-text { color: var(--warn-ink); font-weight: 500; }
.num { font-variant-numeric: tabular-nums; }

/* ---- the frame: sidebar and main column ---- */

.shell {
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr);
  min-height: 100vh;
}

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 26px 12px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 28px;
  padding: 0 12px;
  color: var(--ink);
  text-decoration: none;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.logo .mark { width: 20px; height: 20px; color: var(--brand); stroke-width: 2.4; }
.logo-sub { color: var(--muted); font-weight: 500; }

.nav { display: flex; flex-direction: column; gap: 6px; margin-top: 34px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background-color 0.15s, color 0.15s;
}
.nav a .i { width: 17px; height: 17px; color: var(--ink); opacity: 0.5; transition: opacity 0.15s; }
.nav a:hover { color: var(--ink); background: var(--hover); }
.nav a:hover .i { opacity: 0.8; }
.nav a[aria-current] { background: var(--fill); color: var(--ink); font-weight: 600; }
.nav a[aria-current] .i { opacity: 1; }

.me { position: relative; margin-top: auto; }
.me summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 12px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 500;
}
.me summary::-webkit-details-marker { display: none; }
.me summary:hover { background: var(--hover); }
.me summary > .i { margin-left: auto; color: var(--muted); transition: transform 0.15s; }
.me[open] summary > .i { transform: rotate(180deg); }
.me-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-menu {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(100% + 6px);
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--pop);
  z-index: 20;
}
.me-who { padding: 8px 10px 10px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.me-who b { display: block; color: var(--ink); font-size: 13px; }
.me-menu button { width: 100%; justify-content: flex-start; height: 38px; border-radius: 8px; color: var(--ink); }

.main {
  min-width: 0;
  width: 100%;
  max-width: 1348px;
  padding: 34px 40px 72px;
}
.bare { min-height: 100vh; display: grid; place-items: center; padding: 40px 16px; }

/* ---- page header ---- */

.head {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  margin-bottom: 26px;
}
.head-text { min-width: 0; flex: 1; }
.head h1 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.sub { margin-top: 4px; color: var(--muted); font-size: 13px; }
.sub .count { font-weight: 600; color: var(--ink); }
.sub .count.bad { color: var(--bad); }
.sub .count.warn { color: var(--warn-ink); }
.head-actions { display: flex; align-items: center; gap: 10px; flex: none; }

.count-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  background: var(--fill);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.back {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  margin-left: -8px;
  border-radius: 50%;
  color: var(--ink);
  flex: none;
  align-self: flex-start;
}
.back .i { width: 20px; height: 20px; }
.back:hover { background: var(--fill); }

/* "Live": this page keeps itself current. Hidden while the link is down. */
.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}
.live::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 3px var(--good-bg);
}
body:has(#link-state:not([hidden])) .live { display: none; }

.link-state {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border-radius: 17px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--pop);
}
.link-state::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--warn);
  animation: blink 1.2s ease-in-out infinite;
}
@keyframes blink { 50% { opacity: 0.25; } }

/* ---- buttons ---- */

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 500 12.5px/1 var(--sans);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}
button .i, .button .i { width: 15px; height: 15px; opacity: 0.7; }
button:hover, .button:hover { border-color: var(--line-strong); background: var(--hover); }
button:active, .button:active { transform: scale(0.98); }
button[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }
button[aria-busy="true"] { cursor: progress; }
button[aria-busy="true"]::after {
  content: "";
  width: 12px; height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.primary, .button.primary {
  height: 40px;
  padding: 0 20px;
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-ink);
  font-weight: 600;
}
.primary .i { opacity: 1; }
.primary:hover, .button.primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--bg)); border-color: transparent; }

.danger {
  background: var(--bad);
  border-color: var(--bad);
  color: #fff;
  font-weight: 600;
}
.danger:hover { background: color-mix(in srgb, var(--bad) 88%, #000); border-color: transparent; }

.danger-text, .act-danger { color: var(--bad-ink); }
.danger-text:hover, .act-danger:hover { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.danger-outline { color: var(--bad-ink); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.danger-outline:hover { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 50%, transparent); }

.quiet { border-color: transparent; background: transparent; color: var(--muted); }
.quiet:hover { background: var(--fill); border-color: transparent; color: var(--ink); }

.small { height: 32px; padding: 0 12px; font-size: 12px; }
.wide { width: 100%; }

/* ---- cards ---- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.card-title + .hint { margin-top: 4px; }
.card-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.card-head > div { flex: 1; min-width: 0; }
.card-head .hint { margin-bottom: 0; }
.hint { color: var(--muted); font-size: 13px; margin-bottom: 16px; max-width: 68ch; }
.hint:last-child { margin-bottom: 0; }

.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.split.left { grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); }
.narrow { max-width: 880px; }
.spaced { margin-bottom: 20px; }
.spaced-sm { margin-bottom: 12px; }

/* ---- stat cards ---- */

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  display: flex;
  flex-direction: column;
  min-height: 112px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.stat .i { width: 18px; height: 18px; opacity: 0.55; }
.stat b {
  margin-top: auto;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat span { margin-top: 4px; font-size: 13px; font-weight: 500; color: var(--muted); }
.stat.bad b { color: var(--bad); }
.stat.bad .i { color: var(--bad); opacity: 1; }
.stat.warn b { color: var(--warn-ink); }
.stat.zero b { color: var(--off); }

/* ---- banners and badges ---- */

.banner, .note, .form-msg, .act-result {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
}
.banner .i, .note .i { width: 16px; height: 16px; }
a.banner { text-decoration: none; }
.banner-go { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; }
.banner-go .i { width: 14px; height: 14px; transition: transform 0.15s; }
a.banner:hover .banner-go .i { transform: translateX(2px); }

.banner.info, .note { background: var(--info-bg); color: var(--info-ink); }
.note.warn, .banner.warn { background: var(--warn-bg); color: var(--warn-ink); }
.banner.bad, .form-msg, .act-result.err { background: var(--bad-bg); color: var(--bad-ink); }
.banner.good, .form-msg.ok, .act-result.ok { background: var(--good-bg); color: var(--good); }
.banner.off { background: var(--fill); color: var(--ink-2); }
.act-result:not(.ok):not(.err) { background: var(--fill); color: var(--ink-2); }
.note a { font-weight: 600; }
.note code { background: color-mix(in srgb, currentColor 10%, transparent); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: 12px;
  background: var(--fill);
  color: var(--ink-2);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: middle;
}
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.bad { background: var(--bad-bg); color: var(--bad-ink); }
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge.info { background: var(--info-bg); color: var(--info-ink); }
.badge.pip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 11px;
  background: var(--fill);
  color: var(--ink-2);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--off);
  flex: none;
}
.lamp-bad .dot { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.lamp-warn .dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.lamp-ok .dot { background: var(--good); }

/* ---- tables (lists laid out as rows) ---- */

.table {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.thead, .trow {
  display: grid;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
}
.thead {
  height: 44px;
  border-bottom: 1px solid var(--line);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.trow {
  position: relative;
  min-height: 62px;
  padding-top: 12px;
  padding-bottom: 12px;
  color: inherit;
  text-decoration: none;
  font-size: 13px;
}
.rows > li + li > .trow::before, .rows > .trow + .trow::before {
  content: "";
  position: absolute;
  top: 0; left: 20px; right: 20px;
  height: 1px;
  background: var(--line);
}
a.trow { transition: background-color 0.12s; }
a.trow:hover { background: var(--hover); }
a.trow:hover .go { opacity: 1; transform: none; }
.cell { min-width: 0; overflow-wrap: anywhere; }
.cell small, .who small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.thead .end, .trow .end { text-align: right; justify-self: end; }
.go { color: var(--muted); opacity: 0; transform: translateX(-4px); transition: opacity 0.15s, transform 0.15s; }
.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
}
.group {
  padding: 18px 20px 8px;
  border-top: 1px solid var(--line);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.group + li > .trow::before { display: none; }

.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who-text { min-width: 0; }
.who b {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  flex: none;
  border-radius: 50%;
  background: var(--fill);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.avatar .i { width: 17px; height: 17px; opacity: 0.7; }
.avatar.dark { background: var(--ink); color: var(--on-ink); }
.avatar.sm { width: 32px; height: 32px; font-size: 11px; }

/* the kiosk list */
.kiosks .thead, .kiosks .trow {
  grid-template-columns: minmax(180px, 1.25fr) minmax(200px, 2fr) minmax(96px, 0.7fr) minmax(110px, 0.8fr) minmax(110px, 0.8fr) 72px 16px;
}
.state { display: flex; align-items: center; gap: 10px; min-width: 0; }
.state-text { min-width: 0; font-weight: 500; color: var(--ink); }
.lamp-ok .state-text, .lamp-off .state-text { color: var(--muted); font-weight: 400; }
.more { color: var(--muted); font-weight: 500; white-space: nowrap; }
.printed { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.printed small { display: none; }
.online { color: var(--good); font-weight: 500; }
.lamp-off .who b, .lamp-off .avatar { opacity: 0.6; }

/* expos, themes, releases, history */
.expos .thead, .expos .trow { grid-template-columns: minmax(200px, 1.6fr) minmax(140px, 1fr) minmax(170px, 1.3fr) 80px 120px 16px; }
/* Each row is its own grid, so every column is either fixed or a share of
   the width; a column sized by its content would drift from the header. */
.themes .thead, .themes .trow { grid-template-columns: minmax(180px, 1.5fr) 90px 130px minmax(140px, 1.2fr) 84px; }
.releases .thead, .releases .trow { grid-template-columns: minmax(150px, 1fr) minmax(200px, 1.6fr) 110px 84px; }
.themes .trow > button, .releases .trow > button { justify-self: end; }
.audit .thead, .audit .trow { grid-template-columns: 120px minmax(0, 1fr) minmax(120px, 220px); }
.audit .trow { align-items: start; }
.audit .trow > :first-child { color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 1px; }
.audit a { font-weight: 500; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.audit a:hover { text-decoration-color: currentColor; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 56px 24px;
  color: var(--muted);
}
.empty.compact { padding: 28px 8px 12px; }
.empty .avatar { width: 48px; height: 48px; margin-bottom: 6px; }
.empty .avatar .i { width: 22px; height: 22px; }
.empty b { color: var(--ink); font-size: 15px; }
.empty p { max-width: 44ch; font-size: 13px; }
.empty .button { margin-top: 10px; }

/* ---- forms ---- */

form { display: flex; flex-direction: column; gap: 16px; }
label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
label small, label a {
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.45;
}

input, select, textarea {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font: 500 13px/1.4 var(--sans);
  letter-spacing: 0;
  text-transform: none;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.75; font-weight: 400; }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--ink) 40%, var(--line));
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 8%, transparent);
}
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2376766d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 15px;
  cursor: pointer;
}
textarea { height: auto; min-height: 88px; padding: 12px 14px; resize: vertical; }
textarea.code {
  min-height: 420px;
  font: 400 12.5px/1.6 var(--mono);
  tab-size: 2;
  white-space: pre;
  overflow-x: auto;
}
input[type="file"] {
  height: auto;
  padding: 18px 16px;
  border-style: dashed;
  border-width: 1.5px;
  cursor: pointer;
  font-weight: 400;
  color: var(--muted);
}
input[type="file"]::file-selector-button {
  margin-right: 12px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  color: var(--ink);
  font: 500 12.5px var(--sans);
  cursor: pointer;
}
input.mono { font-family: var(--mono); font-size: 12.5px; }
input[type="checkbox"] {
  width: 18px; height: 18px;
  padding: 0;
  accent-color: var(--ink);
  flex: none;
}

.check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  cursor: pointer;
}

.pair, .fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.fields { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); align-items: end; }
.form-end { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.form-end .form-msg { margin-right: auto; }

progress {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border: 0;
  border-radius: 2px;
  background: var(--fill);
  overflow: hidden;
}
progress::-webkit-progress-bar { background: var(--fill); border-radius: 2px; }
progress::-webkit-progress-value { background: var(--info); border-radius: 2px; transition: width 0.2s; }
progress::-moz-progress-bar { background: var(--info); border-radius: 2px; }

/* the code a kiosk shows when it wants adding */
.code-input {
  height: 60px;
  font: 600 26px/1 var(--mono);
  letter-spacing: 0.22em;
  text-align: center;
  text-transform: uppercase;
}
.code-input::placeholder { letter-spacing: 0.22em; opacity: 0.35; }

/* ---- one kiosk ---- */

.problems { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.problems:empty { display: none; }
.problems li { display: flex; align-items: flex-start; gap: 10px; }
.problems .i { margin-top: 1px; }

.tallies {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: -4px 0 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.tallies div { padding: 0 12px; border-left: 1px solid var(--line); min-width: 0; }
.tallies div:first-child { padding-left: 0; border-left: 0; }
.tallies b { display: block; font-size: 24px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.tallies span { font-size: 12px; font-weight: 500; color: var(--muted); }
.tallies .bad b { color: var(--bad); }

.facts { display: flex; flex-direction: column; margin-top: 4px; }
.facts > div {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  column-gap: 14px;
  padding: 10px 0;
}
.facts .i { grid-row: 1 / span 3; width: 17px; height: 17px; margin-top: 1px; color: var(--ink); opacity: 0.55; }
.facts dt { font-size: 10px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin-top: 2px; font-size: 13.5px; font-weight: 500; overflow-wrap: anywhere; }
.facts dd small { display: block; margin-top: 1px; color: var(--muted); font-size: 12px; font-weight: 400; }
.facts .bad { color: var(--bad-ink); }
.facts .good { color: var(--good); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.do .act-result { margin-top: 14px; }
.more-actions { margin-top: 14px; }
.more-actions summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 2px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  border-radius: 6px;
}
.more-actions summary::-webkit-details-marker { display: none; }
.more-actions summary:hover { color: var(--ink); }
.more-actions summary .i { width: 14px; height: 14px; transition: transform 0.15s; }
.more-actions[open] summary .i { transform: rotate(180deg); }
.more-actions .actions { margin-top: 10px; }

.output {
  margin-top: 14px;
  max-height: 360px;
  overflow: auto;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  font: 400 12px/1.6 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.output.logs {
  height: 420px;
  max-height: 60vh;
  margin-top: 0;
  border-color: #2a2a26;
  background: #161614;
  color: #e4e4de;
  white-space: pre;
  overflow-wrap: normal;
}

.shot { margin-top: 14px; }
.shot img { width: auto; max-width: 100%; max-height: 440px; border-radius: 10px; border: 1px solid var(--line); background: var(--fill); }
.shot figcaption { margin-top: 8px; color: var(--muted); font-size: 12px; }

.log li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.log li:first-child { border-top: 0; padding-top: 2px; }
.log li:last-child { padding-bottom: 0; }
.log-what { min-width: 0; font-size: 13px; }
.log-what b { font-weight: 600; }
.log-detail { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.log-when { grid-column: 2; grid-row: 1; color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar select { width: auto; height: 38px; border-radius: 19px; padding-left: 16px; font-size: 12.5px; }

.danger-zone { display: flex; align-items: center; gap: 16px; }
.danger-zone > div { flex: 1; min-width: 0; }
.danger-zone .hint { margin: 4px 0 0; }

/* lists inside cards */
.list > li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.list > li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .grow small { display: block; color: var(--muted); font-size: 12px; }
.list a { text-decoration: none; }
.list a:hover b { text-decoration: underline; text-underline-offset: 3px; }
.card .list { margin-top: -8px; }
.card .list:last-child { margin-bottom: -8px; }

.channel-form { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; width: 100%; }
.channel-form .form-msg, .inline .form-msg { flex-basis: 100%; grid-column: 1 / -1; }
.channel-form .grow { flex: 1; min-width: 0; }
.channel-form select { width: 180px; height: 38px; border-radius: 19px; font-size: 12.5px; }
.inline { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 12px; }
.divided { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ---- the confirm dialog ---- */

dialog.modal {
  width: min(440px, calc(100vw - 32px));
  padding: 28px;
  border: 0;
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--pop);
}
dialog.modal::backdrop { background: var(--scrim); }
dialog.modal[open] { animation: rise 0.18s ease-out; }
dialog.modal[open]::backdrop { animation: fade 0.18s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px) scale(0.985); } }
@keyframes fade { from { opacity: 0; } }
dialog.modal form { gap: 0; }
.modal-head { display: flex; gap: 16px; align-items: flex-start; }
.modal-icon {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  flex: none;
  border-radius: 50%;
  background: var(--bad-bg);
  color: var(--bad);
  font-size: 18px;
  font-weight: 700;
}
.modal-icon .i { width: 20px; height: 20px; }
dialog[data-tone="go"] .modal-icon { background: var(--fill); color: var(--ink); }
.modal h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; padding-top: 10px; }
.modal p { margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 28px; }
dialog.modal button:focus-visible { outline: 2px solid color-mix(in srgb, var(--ink) 28%, transparent); outline-offset: 2px; }
.modal-actions button { height: 44px; min-width: 104px; padding: 0 22px; font-size: 13px; }

/* ---- toast ---- */

#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 60;
  max-width: min(560px, calc(100vw - 32px));
  padding: 13px 18px;
  border-radius: 12px;
  background: #1b1b18;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--pop);
  animation: rise 0.18s ease-out;
}
#toast:empty { display: none; }

/* ---- sign in ---- */

.signin { width: 100%; max-width: 400px; }
.wordmark {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 30px;
  color: var(--brand);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
}
.wordmark .mark { width: 18px; height: 18px; stroke-width: 2.6; }
.signin h1 { text-align: center; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.signin .sub { text-align: center; margin: 6px 0 24px; }
.signin .card { padding: 24px; border-radius: 16px; }
.signin .primary { height: 44px; margin-top: 4px; font-size: 13px; }
.signin .note { margin-bottom: 16px; }

/* ---- terminal: takes the whole screen, sized to what the keyboard leaves ---- */

.term-sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: #12110e;
  color: #e8e8e3;
  padding-top: env(safe-area-inset-top);
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 52px;
  padding: 0 10px 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.term-bar b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term-bar .soft { margin-right: auto; font-size: 12px; color: #9a9a92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-bar button { background: transparent; color: #e8e8e3; border-color: rgba(255, 255, 255, 0.18); }
.term-bar button:hover { background: rgba(255, 255, 255, 0.08); }
.term { flex: 1; min-height: 0; padding: 8px 4px 0 10px; overflow: hidden; }
.term-keys {
  display: flex;
  gap: 6px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  overflow-x: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  scrollbar-width: none;
}
.term-keys::-webkit-scrollbar { display: none; }
.term-keys button {
  flex: none;
  min-width: 48px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border-color: rgba(255, 255, 255, 0.14);
  background: #22211d;
  color: #e8e8e3;
  font: 600 12.5px var(--mono);
}
.term-keys button:hover { background: #2c2b26; }
.term-keys button:active { background: #3a3832; }

/* ---- smaller screens ---- */

@media (max-width: 1180px) {
  .kiosks .thead, .kiosks .trow { grid-template-columns: minmax(170px, 1.2fr) minmax(190px, 2fr) minmax(96px, 0.8fr) minmax(110px, 0.9fr) 64px 16px; }
  .kiosks .c-soft { display: none; }
  .split { grid-template-columns: minmax(0, 1fr) 340px; }
  .split.left { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); }
}

@media (max-width: 1023px) {
  :root { --side: 76px; }
  .side { padding: 22px 12px 14px; align-items: center; }
  .logo { padding: 0; justify-content: center; }
  .logo span, .nav a span, .me-name, .me summary > .i { display: none; }
  .nav a { width: 48px; justify-content: center; padding: 0; }
  .me summary { padding: 4px; }
  .me-menu { left: 0; right: auto; width: 200px; }
  .main { padding: 28px 28px 64px; }
  .stats { gap: 12px; }
  .split, .split.left { grid-template-columns: minmax(0, 1fr); }
  .kiosks .thead, .kiosks .trow { grid-template-columns: minmax(160px, 1.2fr) minmax(180px, 2fr) minmax(90px, 0.8fr) 60px 16px; }
  .kiosks .c-seen { display: none; }
  .expos .thead, .expos .trow { grid-template-columns: minmax(180px, 1.5fr) minmax(150px, 1.3fr) 70px 110px 16px; }
  .expos .c-theme { display: none; }
}

/* Phones: a bar at the top, the sections along the bottom where a thumb
   reaches them, and every list as two-line rows. */
@media (max-width: 760px) {
  body { font-size: 14px; }
  .shell { display: block; }
  .side {
    position: sticky;
    top: 0;
    z-index: 30;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: calc(8px + env(safe-area-inset-top)) 12px 8px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: var(--surface); /* no backdrop-filter here: it would pin the fixed tab bar inside this bar */
  }
  .logo { padding: 0; }
  .logo span { display: inline; }
  .nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    backdrop-filter: saturate(1.4) blur(12px);
    border-top: 1px solid var(--line);
  }
  .nav a {
    width: auto;
    height: 52px;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 0;
    border-radius: 12px;
    font-size: 10.5px;
  }
  .nav a span { display: inline; }
  .nav a .i { width: 20px; height: 20px; }
  .nav a[aria-current] { background: transparent; }
  .nav a:hover { background: transparent; }
  .me { margin: 0 0 0 auto; }
  .me summary { padding: 2px; }
  .me-menu { top: calc(100% + 8px); bottom: auto; left: auto; right: 0; width: 220px; }

  .main { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
  .head { flex-wrap: wrap; margin-bottom: 18px; gap: 10px 12px; }
  .head h1 { font-size: 21px; }
  .head-actions { align-self: flex-start; }
  .head-actions .button.primary { height: 40px; padding: 0 16px; }
  .head-actions .live { display: none; }
  .back { margin-top: -2px; }

  .card { padding: 18px 16px; border-radius: 14px; }
  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    margin-bottom: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
  }
  .stat { min-height: 0; padding: 14px 10px 12px 14px; border: 0; border-left: 1px solid var(--line); border-radius: 0; box-shadow: none; }
  .stat:first-child { border-left: 0; }
  .stat .i { display: none; }
  .stat b { font-size: 22px; }
  .stat span { font-size: 11.5px; line-height: 1.25; }

  .thead { display: none; }
  .trow { gap: 4px 12px; padding: 14px 16px; }
  .rows > li + li > .trow::before, .rows > .trow + .trow::before { left: 16px; right: 16px; }
  .go { display: none; }
  .table-foot { padding: 12px 16px; }
  .group { padding: 16px 16px 6px; }

  .kiosks .trow { grid-template-columns: 36px minmax(0, 1fr) auto; align-items: start; }
  .kiosks .who { display: contents; }
  .kiosks .who .avatar { grid-row: 1 / span 2; }
  .kiosks .who-text { grid-column: 2; }
  .kiosks .state { grid-column: 2; grid-row: 2; align-items: baseline; gap: 8px; }
  .kiosks .state .dot { transform: translateY(-1px); }
  .kiosks .printed { grid-column: 3; grid-row: 1 / span 2; text-align: right; align-self: center; }
  .kiosks .printed small { display: block; margin: 0; font-weight: 400; color: var(--muted); font-size: 11px; }
  .kiosks .c-printer, .kiosks .c-seen, .kiosks .c-soft { display: none; }

  .expos .trow, .themes .trow, .releases .trow, .audit .trow { grid-template-columns: minmax(0, 1fr) auto; }
  .expos .c-theme, .expos .c-secrets, .expos .c-changed, .themes .c-size, .themes .c-used, .releases .c-when { display: none; }
  .expos .c-count { text-align: right; }
  .themes .c-when, .releases .c-targets { grid-column: 1; font-size: 12px; color: var(--muted); }
  .themes .trow > :last-child, .releases .trow > :last-child { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .audit .trow { grid-template-columns: minmax(0, 1fr) auto; }
  .audit .trow > :first-child { grid-column: 2; grid-row: 1; font-size: 12px; }
  .audit .c-what { grid-column: 1; grid-row: 1; }
  .audit .c-who { grid-column: 1; font-size: 12px; color: var(--muted); }

  .split > .stack { display: contents; }
  .split { display: flex; flex-direction: column; align-items: stretch; gap: 16px; }
  .device .do { order: 1; }
  .device .profile { order: 2; }
  .device .events { order: 3; }
  .device .split > .stack > * { order: 4; }
  .device .split > .stack > .do { order: 1; }
  .device .split > .stack > .events { order: 3; }

  .actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .actions button { height: 44px; }
  .pair, .inline { grid-template-columns: minmax(0, 1fr); }
  .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-end { flex-direction: column-reverse; align-items: stretch; }
  .form-end .primary, .form-end button { width: 100%; height: 46px; }
  .danger-zone { flex-direction: column; align-items: stretch; }
  .danger-zone button { height: 44px; }
  .channel-form { flex-wrap: wrap; }
  .channel-form .grow { flex-basis: 100%; }
  .channel-form select { flex: 1; width: auto; }
  .output.logs { height: 55vh; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions button { width: 100%; }
  dialog.modal { padding: 22px; }
  #toast { bottom: calc(86px + env(safe-area-inset-bottom)); }
  .link-state { top: calc(64px + env(safe-area-inset-top)); }
  textarea.code { min-height: 320px; font-size: 12px; }
}

/* Touch: fingers need 44px, and phones zoom into any field smaller than
   16px; keep the page where it is. */
@media (pointer: coarse) {
  button, .button, .toolbar select, .channel-form select { min-height: 44px; }
  .small { min-height: 40px; }
  .back { width: 44px; height: 44px; }
  .me summary { min-width: 44px; min-height: 44px; justify-content: center; }
  .more-actions summary { min-height: 44px; }
  input, select, textarea { font-size: 16px; }
  .code-input { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
