/* GECAMed Link admin. Design tokens and shell from the Claude Design handback
   (docs/design-handoff/gateway-ui/result, GW-058), rewritten by hand: light and
   dark by prefers-color-scheme; system fonts only; no url(), no @import. The CSP
   is default-src 'self': no inline style, no inline script. */
:root {
  --page: #f8fafc; --surface: #ffffff; --sunken: #f8fafc; --hairline: #f1f5f9;
  --border: #e2e8f0; --border-input: #cbd5e1;
  --text: #0f172a; --text-2: #334155; --text-3: #475569; --text-4: #64748b;
  --accent: #0369a1; --accent-hover: #075985; --accent-soft: #f0f9ff;
  --primary: #0f172a; --primary-fg: #ffffff;
  --danger: #dc2626; --danger-text: #b91c1c;
  --good-bg: #d1fae5; --good-fg: #065f46; --good-bar: #10b981;
  --updating-bg: #e0f2fe; --updating-fg: #075985; --updating-bar: #0ea5e9;
  --warn-bg: #fef3c7; --warn-fg: #92400e; --warn-bar: #f59e0b;
  --bad-bg: #fee2e2; --bad-fg: #991b1b; --bad-bar: #ef4444;
  --unknown-bg: #f1f5f9; --unknown-fg: #334155; --unknown-bar: #94a3b8;
  --env-production-bg: var(--primary); --env-production-fg: var(--primary-fg); --env-production-top: var(--surface);
  --env-staging-bg: #f59e0b; --env-staging-fg: #0f172a; --env-staging-top: #fffbeb;
  --env-development-bg: #e2e8f0; --env-development-fg: #334155; --env-development-top: #f8fafc; --env-development-rule: #94a3b8;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --r-control: 6px; --r-card: 8px; --r-dialog: 10px; --r-sheet: 12px;
  --shadow-card: 0 1px 2px rgb(15 23 42 / .04);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0b1220; --surface: #0f172a; --sunken: #111a2e; --hairline: #1e293b;
    --border: #1e293b; --border-input: #334155;
    --text: #e2e8f0; --text-2: #cbd5e1; --text-3: #94a3b8; --text-4: #94a3b8;
    --accent: #38bdf8; --accent-hover: #7dd3fc; --accent-soft: #0c2a40;
    --primary: #e2e8f0; --primary-fg: #0f172a;
    --danger: #ef4444; --danger-text: #f87171;
    --good-bg: #052e22; --good-fg: #6ee7b7;
    --updating-bg: #062a43; --updating-fg: #7dd3fc;
    --warn-bg: #3a2306; --warn-fg: #fcd34d;
    --bad-bg: #3b0d0d; --bad-fg: #fca5a5;
    --unknown-bg: #1e293b; --unknown-fg: #cbd5e1;
    --env-staging-top: #2a1d05; --env-development-bg: #334155; --env-development-fg: #e2e8f0; --env-development-top: #111a2e;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--text);
  font: 14px/1.45 var(--font);
}
/* The environment class is on the body too, so every part of the shell can tint itself. */
body.env-production, .envband.env-production { --env-bg: var(--env-production-bg); --env-fg: var(--env-production-fg); --env-top: var(--env-production-top); --env-rule: var(--env-production-bg); }
body.env-staging, .envband.env-staging { --env-bg: var(--env-staging-bg); --env-fg: var(--env-staging-fg); --env-top: var(--env-staging-top); --env-rule: var(--env-staging-bg); }
body.env-development, .envband.env-development { --env-bg: var(--env-development-bg); --env-fg: var(--env-development-fg); --env-top: var(--env-development-top); --env-rule: var(--env-development-rule); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
h1 { font-size: 26px; line-height: 1.2; font-weight: 650; letter-spacing: -.01em; margin: 0 0 16px; }
h2 { font-size: 14px; font-weight: 600; margin: 20px 0 8px; }
.meta { font-size: 13px; color: var(--text-3); }
.mono, code { font-family: var(--mono); }
code { font-size: 12px; color: var(--text-2); }
.icon { flex: none; vertical-align: -3px; }

/* Environment band: full width, 32 px, sticky, on every page and width. */
.envband {
  position: sticky; top: 0; z-index: 30; height: 32px; padding: 0 12px; overflow: hidden; white-space: nowrap;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--env-bg); color: var(--env-fg);
  font-size: 12px; font-weight: 700; letter-spacing: .06em;
}
.envchip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px;
  background: var(--env-bg); color: var(--env-fg); font-size: 12px; font-weight: 700; letter-spacing: .04em; white-space: nowrap;
}

/* Shell: sidebar (>= 1024 px) and a main column with the top bar. */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: calc(100vh - 32px); }
.sidenav {
  position: sticky; top: 32px; height: calc(100vh - 32px); overflow-y: auto;
  padding: 16px 12px; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
}
.side-brand { padding: 4px 10px 16px; font-size: 15px; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.side-brand:hover { color: var(--text); text-decoration: none; }
.brand-sub { font-weight: 400; color: var(--text-3); }
.sidenav a.nav {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: var(--r-control);
  color: var(--text-2); font-weight: 500;
}
.sidenav a.nav:hover { background: var(--hairline); color: var(--text); text-decoration: none; }
.sidenav a.nav.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 32px; z-index: 20; height: 56px; display: flex; align-items: center; gap: 16px; padding: 0 24px;
  background: var(--env-top, var(--surface)); border-bottom: 2px solid var(--env-rule, var(--border));
}
.brand { display: none; font-weight: 650; color: var(--text); margin-right: auto; }
.brand:hover { color: var(--text); text-decoration: none; }
.top-env { display: flex; align-items: center; gap: 10px; margin-right: auto; min-width: 0; }
.updated {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: var(--r-control);
  font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums;
}
body.is-stale .updated { color: var(--warn-fg); background: var(--warn-bg); font-weight: 600; }
body.is-stale .content > main { opacity: .55; }
.who { font-size: 13px; color: var(--text-2); }
.signout { margin: 0; }
.content { flex: 1; min-width: 0; padding: 24px; max-width: 1280px; width: 100%; }

/* Cards, bands, empty states */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: var(--shadow-card); padding: 14px 20px; margin-bottom: 16px; min-width: 0;
}
.card h2:first-child { margin-top: 0; }
.band {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-card); margin-bottom: 16px;
  border: 1px solid transparent;
}
.band[hidden] { display: none; }
.band-warn { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-bar); }
.band-bad { background: var(--bad-bg); color: var(--bad-fg); border-color: var(--bad-bar); }
.empty { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 0; color: var(--text-3); }
.orchlink { font-size: 12px; }

/* Status component: icon, word, tone. */
.status {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 20px; white-space: nowrap;
}
.tone-good { background: var(--good-bg); color: var(--good-fg); }
.tone-updating { background: var(--updating-bg); color: var(--updating-fg); }
.tone-warn { background: var(--warn-bg); color: var(--warn-fg); }
.tone-bad { background: var(--bad-bg); color: var(--bad-fg); }
.tone-unknown { background: var(--unknown-bg); color: var(--unknown-fg); }

/* Buttons and forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px;
  padding: 6px 14px; border-radius: var(--r-control); border: 1px solid var(--border-input); font: inherit; font-weight: 600;
  background: var(--surface); color: var(--text); cursor: pointer;
}
.btn:hover { background: var(--sunken); }
.btn-primary { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary); opacity: .9; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--text-2); }
.btn:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.form { display: flex; flex-direction: column; gap: 6px; }
.form label { font-weight: 600; margin-top: 8px; }
.form input {
  font: inherit; min-height: 40px; padding: 8px 10px; border-radius: var(--r-control);
  border: 1px solid var(--border-input); background: var(--surface); color: var(--text);
}
.form .btn { margin-top: 16px; }
.alert, .notice { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-control); margin: 0 0 12px; }
.alert { background: var(--bad-bg); color: var(--bad-fg); }
.notice { background: var(--good-bg); color: var(--good-fg); }

/* Sign-in and setup: a centred card. */
.center { display: flex; justify-content: center; padding: 48px 16px; }
.signin { width: 100%; max-width: 420px; padding: 24px; }
.product { font-weight: 650; margin: 0 0 16px; }
.qr { display: block; width: 246px; height: 246px; margin: 8px 0; background: #fff; padding: 8px; border-radius: 8px; image-rendering: pixelated; }
.key { font-size: 18px; letter-spacing: .04em; margin: 4px 0; word-spacing: .2em; }

@media (max-width: 1023px) {
  /* Below 1024: no sidebar; the navigation is a bottom bar with a 4 px rule in the environment colour. */
  .shell { display: block; padding-bottom: 68px; }
  .sidenav {
    position: fixed; z-index: 25; left: 0; right: 0; bottom: 0; top: auto; height: 64px; padding: 0; overflow: hidden;
    flex-direction: row; border-right: 0; border-top: 4px solid var(--env-rule, var(--border));
  }
  .side-brand { display: none; }
  .sidenav a.nav {
    flex: 1; flex-direction: column; justify-content: center; gap: 3px; min-height: 44px; height: auto;
    padding: 4px 0; border-radius: 0; font-size: 11px; min-width: 0;
  }
  .brand { display: block; }
  .top-env { display: none; }
  .topbar { padding: 0 12px 0 16px; gap: 10px; }
  .btn { min-height: 44px; }
  .form input { min-height: 44px; }
}
@media (max-width: 639px) {
  h1 { font-size: 22px; }
  .content { padding: 16px; }
  .envband { font-size: 11px; letter-spacing: .03em; }
  .who { display: none; }
  .signout .btn span { display: none; }
  .form .btn { width: 100%; }
}

/* Pages (GW-053..055, styled to the design handback in GW-058). */
.num { font-variant-numeric: tabular-nums; }
.micro { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-4); }
/* Verdict first (A2): tone background, icon, one sentence. */
.verdict { display: flex; align-items: center; gap: 14px; padding: 16px 20px; margin-bottom: 16px; border-radius: var(--r-card); border: 1px solid transparent; }
.verdict.card { box-shadow: none; }
.verdict.tone-good { background: var(--good-bg); color: var(--good-fg); border-color: var(--good-bar); }
.verdict.tone-updating { background: var(--updating-bg); color: var(--updating-fg); border-color: var(--updating-bar); }
.verdict.tone-warn { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-bar); }
.verdict.tone-bad { background: var(--bad-bg); color: var(--bad-fg); border-color: var(--bad-bar); }
.verdict.tone-unknown { background: var(--unknown-bg); color: var(--unknown-fg); border-color: var(--unknown-bar); }
.verdict-icon { width: 40px; height: 40px; border-radius: 999px; background: var(--surface); display: grid; place-items: center; flex: none; }
.verdict-icon .icon { width: 22px; height: 22px; vertical-align: 0; }
.verdict h2 { font-size: 18px; font-weight: 650; line-height: 1.3; margin: 0; }
.verdict p { margin: 2px 0 0; font-weight: 400; text-wrap: pretty; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px 16px; border-radius: var(--r-card);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-card); color: var(--text); text-decoration: none;
}
a.tile:hover { background: var(--sunken); text-decoration: none; color: var(--text); }
.tile-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; color: var(--text-4); }
.big { font-size: 26px; line-height: 1.2; font-weight: 650; font-variant-numeric: tabular-nums; }
.count-zero { color: var(--text-4); }
.fg-good { color: var(--good-fg); } .fg-warn { color: var(--warn-fg); } .fg-bad { color: var(--bad-fg); } .fg-updating { color: var(--updating-fg); }
.todayhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.counts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 12px; margin: 8px 0 0; }
.count { display: flex; flex-direction: column; gap: 2px; padding: 6px 0 10px; }
.count-label { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-2); }
.extra { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.extra b { color: var(--text); font-weight: 600; }
.paused-note { color: var(--warn-fg); font-weight: 600; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 16px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--text-3); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.events { list-style: none; margin: 0; padding: 0; }
.events li { padding: 6px 0; border-bottom: 1px solid var(--hairline); display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-4); padding: 6px 8px; border-bottom: 1px solid var(--border); }
.table td { padding: 8px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.table .num { text-align: right; }
.table tfoot td { font-weight: 650; border-top: 1px solid var(--border); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chips a { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border-input); color: var(--text-2); text-decoration: none; font-size: 13px; }
.chips a.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--warn-bg); color: var(--warn-fg); font-size: 12px; }
.tone-text-bad { color: var(--bad-fg); font-weight: 600; }
.tone-text-warn { color: var(--warn-fg); font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; margin-bottom: 16px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; }
.filters input, .filters select {
  font: inherit; min-height: 36px; padding: 6px 8px; border-radius: 6px;
  border: 1px solid var(--border-input); background: var(--surface); color: var(--text);
}
.pager { display: flex; gap: 16px; justify-content: flex-end; }
.headchips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.trail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 0 16px; }
.timeline { margin: 0; padding-left: 20px; }
.timeline li { padding: 6px 0; }
.timeline li.waiting { color: var(--text-3); }
@media (max-width: 639px) {
  .verdict { align-items: flex-start; padding: 14px 16px; gap: 12px; }
  .verdict-icon { width: 36px; height: 36px; }
  .verdict h2 { font-size: 17px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 12px; }
  .big { font-size: 22px; }
}
@media (max-width: 899px) {
  .trail { grid-template-columns: 1fr; }
  /* Table to cards: each row a card, each cell labelled. */
  .table.cards thead { display: none; }
  .table.cards, .table.cards tbody, .table.cards tfoot, .table.cards tr, .table.cards td { display: block; width: 100%; }
  .table.cards tr { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; padding: 8px 12px; background: var(--surface); }
  .table.cards td { border: 0; padding: 3px 0; text-align: left; }
  .table.cards td.num { text-align: left; }
  .table.cards td::before { content: attr(data-label); display: inline-block; min-width: 110px; color: var(--text-4); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
  .table.cards td.card-title::before { display: none; }
  .table.cards td.card-title { font-size: 15px; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 6px; }
}
