/* Navioa admin portal — dense, table-first. Light/dark via prefers-color-scheme. */
:root {
  --bg: #f6f8f5; --panel: #ffffff; --text: #18211a; --muted: #617060; --border: #dce4d6;
  --accent: #1f9c63; --ok-bg: #e2f5ea; --ok: #176b44; --warn-bg: #fff3d6; --warn: #8a5a00;
  --bad-bg: #fde4e1; --bad: #a3271b; --row-hover: #f0f5ee;
  font: 13px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111612; --panel: #182019; --text: #e6ede5; --muted: #95a593; --border: #2c3a2d;
    --ok-bg: #18382a; --ok: #7fdcaa; --warn-bg: #3a3014; --warn: #f0c564; --bad-bg: #3d1d19; --bad: #f19a8f; --row-hover: #1e2a20; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
code { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
h1 { font-size: 18px; margin: 0 0 12px; display: flex; gap: 8px; align-items: center; }
h2 { font-size: 14px; margin: 18px 0 8px; }
.muted { color: var(--muted); }
.error { color: var(--bad); }
[hidden] { display: none !important; }

/* Sign-in gate: brand-dark panel to match the logo, in both colour schemes. */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; color: #e6ede5;
  background: radial-gradient(ellipse 70% 55% at 50% 0%, rgba(61,214,140,.16), transparent 70%), #141a13; }
.gate-card { width: 100%; max-width: 380px; text-align: center; padding: 36px 28px 26px; background: #1e271d;
  border: 1px solid rgba(255,255,255,.08); border-radius: 18px; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.gate-logo { display: block; margin: 0 auto 18px; border-radius: 18px; box-shadow: 0 0 0 1px rgba(125,232,180,.18), 0 10px 30px rgba(61,214,140,.15); }
.gate-title { justify-content: center; font-size: 24px; letter-spacing: -.02em; margin: 0 0 6px; }
.gate-chip { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #7de8b4;
  background: rgba(61,214,140,.1); border: 1px solid rgba(125,232,180,.3); border-radius: 999px; padding: 2px 8px; }
.gate-lede { margin: 0 0 24px; color: #95a593; font-size: 14px; }
.gate-google { font: inherit; font-size: 14px; font-weight: 600; width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 11px 16px; border-radius: 10px; border: 1px solid #dadce0; background: #fff; color: #1f1f1f; cursor: pointer; transition: box-shadow .15s, transform .15s; }
.gate-google:hover { box-shadow: 0 4px 14px rgba(61,214,140,.25); transform: translateY(-1px); }
.gate-google:focus-visible { outline: 2px solid #3dd68c; outline-offset: 2px; }
.gate-error { margin: 12px 0 0; color: #f19a8f; }
.gate-error:empty { margin: 0; }
.gate-note { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 11.5px; color: #7f8f7d; }
.shell { display: grid; grid-template-columns: 200px 1fr; min-height: 100vh; }
aside { background: var(--panel); border-right: 1px solid var(--border); padding: 14px 10px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 700; font-size: 15px; padding: 0 6px; display: flex; align-items: center; gap: 8px; }
.brand img { border-radius: 6px; }
.brand span { margin-left: -4px; }
.brand span { color: var(--muted); font-weight: 500; }
nav { display: flex; flex-direction: column; gap: 2px; }
nav a { padding: 6px 8px; border-radius: 6px; color: var(--text); text-decoration: none; }
nav a:hover { background: var(--row-hover); }
nav a.active { background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.who { margin-top: auto; display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); padding: 0 6px; word-break: break-all; }
main { padding: 16px 20px; min-width: 0; }

.btn { font: inherit; padding: 5px 10px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; }
.btn.small { padding: 2px 8px; font-size: 12px; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.danger { background: var(--bad); border-color: var(--bad); }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 5px 7px; }
textarea { width: 100%; font-family: ui-monospace, Menlo, monospace; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 6px 0; }
.stack { display: flex; flex-direction: column; gap: 10px; max-width: 760px; }
.stack label { display: flex; flex-direction: column; gap: 4px; }
/* Field help: a muted line under each control; select hints follow the chosen option. */
.hint { display: block; color: var(--muted); font-size: 11.5px; font-weight: 400; line-height: 1.4; max-width: 360px; }
.hint:empty { display: none; }
.hint.choice { color: var(--text); border-left: 2px solid var(--accent); padding-left: 7px; }
.stack > label > .hint { max-width: 760px; }
.row label { display: flex; flex-direction: column; gap: 4px; }
.row label.grow, .row.fields label { flex: 1; min-width: 200px; }
.row:has(.hint) { align-items: flex-start; }
.row:has(.hint) > .btn { margin-top: 23px; }

.table-bar { display: flex; gap: 10px; align-items: center; margin: 8px 0; }
.table-search { width: 280px; }
.count { color: var(--muted); font-size: 12px; margin-right: auto; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); }
table.grid { border-collapse: collapse; width: 100%; white-space: nowrap; }
.grid th, .grid td { padding: 5px 9px; border-bottom: 1px solid var(--border); text-align: left; }
.grid th { position: sticky; top: 0; background: var(--panel); font-weight: 600; font-size: 12px; color: var(--muted); cursor: pointer; user-select: none; }
.grid th[data-sorted="asc"]::after { content: " ▲"; }
.grid th[data-sorted="desc"]::after { content: " ▼"; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.grid.clickable tbody tr { cursor: pointer; }
.grid tbody tr:hover { background: var(--row-hover); }
.grid .empty { text-align: center; color: var(--muted); padding: 16px; }

.pill { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--row-hover); color: var(--muted); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0 0 12px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin: 12px 0; }
.panel h2 { margin-top: 0; }
.log { list-style: none; margin: 0; padding: 0; }
.log li { padding: 4px 0; border-bottom: 1px solid var(--border); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.tile span { color: var(--muted); font-size: 12px; }
.tile strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.tile.ok strong { color: var(--ok); } .tile.warn strong { color: var(--warn); } .tile.bad strong { color: var(--bad); }

/* Activation labels: 3 per row on screen and on paper. */
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin-top: 10px; }
.label { display: flex; gap: 10px; align-items: center; border: 1px dashed var(--border); border-radius: 6px; padding: 8px; background: #fff; color: #000; }
.label .qr { width: 84px; height: 84px; flex: none; }
.label .qr svg { width: 100%; height: 100%; }
.label .code { font: 600 15px ui-monospace, Menlo, monospace; letter-spacing: 1px; }
.card .card-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card .code { font-size: 17px; }
.card ol { margin: 2px 0; padding-left: 16px; font-size: 10.5px; line-height: 1.35; }
.card small { font-size: 9.5px; color: #555; }

@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  aside { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  nav { flex-direction: row; flex-wrap: wrap; }
  .who { margin: 0; }
  main { padding: 12px 16px; }
  .table-search { width: 100%; }
}
@media print {
  aside, .table-bar, form, h1, p, .panel > h2, #print-labels, #download-print-file, .panel > p { display: none !important; }
  .shell { display: block; } main { padding: 0; } .panel { border: 0; padding: 0; margin: 0; }
  .labels { grid-template-columns: repeat(3, 1fr); gap: 4mm; }
  .label { break-inside: avoid; border: 1px dashed #999; }
}
.new-code { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; max-width: 360px; }
