/* PrintGuard — hand-written, no build step, no CDN.
 *
 * The Content-Security-Policy forbids inline styles, so everything is here.
 * Organised as: tokens, reset, primitives, layout, components, views,
 * kiosk, responsive. Nothing is nested more than two levels deep and there
 * are no utility-class chains — this file is read by whoever maintains the
 * product, not generated.
 *
 * Colour is defined once as tokens and never again. Dark mode redefines the
 * tokens, so a component written correctly is automatically correct in both.
 */

/* ========================================================================
   1. Tokens
   ======================================================================== */

:root {
  color-scheme: light;

  --accent: #2f6fed;
  --accent-hover: #2a62d4;
  --accent-soft: #eaf1fe;
  --accent-text: #ffffff;

  --bg: #f6f7f9;
  --bg-raised: #ffffff;
  --bg-sunken: #eef0f4;
  --bg-hover: #f0f2f6;
  --sidebar-bg: #14181f;
  --sidebar-text: #a8b2c1;
  --sidebar-active: #ffffff;

  --text: #171b22;
  --text-soft: #5b6675;
  --text-faint: #8a95a5;
  --border: #dfe3ea;
  --border-strong: #c6ccd8;

  --ok: #16794a;
  --ok-bg: #e6f5ed;
  --warn: #8a5a00;
  --warn-bg: #fdf3e0;
  --danger: #b32130;
  --danger-bg: #fdeced;
  --info: #1f5fa8;
  --info-bg: #e8f1fb;

  --radius: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  --shadow-1: 0 1px 2px rgba(16, 24, 40, 0.06),
              0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-2: 0 4px 12px rgba(16, 24, 40, 0.08),
              0 2px 4px rgba(16, 24, 40, 0.05);
  --shadow-3: 0 12px 32px rgba(16, 24, 40, 0.16);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;

  --sidebar-width: 232px;
  --topbar-height: 60px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
  :root:not([data-theme="light"]) {
    --accent-soft: #16233c;
    --accent-text: #ffffff;

    --bg: #0f1216;
    --bg-raised: #171b21;
    --bg-sunken: #12151a;
    --bg-hover: #1e232b;
    --sidebar-bg: #0b0e12;
    --sidebar-text: #8c97a8;
    --sidebar-active: #ffffff;

    --text: #e6e9ee;
    --text-soft: #a3adbb;
    --text-faint: #77828f;
    --border: #262c35;
    --border-strong: #39414d;

    --ok: #52c48a;
    --ok-bg: #10261c;
    --warn: #e0a53c;
    --warn-bg: #2a2113;
    --danger: #f07179;
    --danger-bg: #2c1518;
    --info: #6aa9ec;
    --info-bg: #10202f;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.45);
    --shadow-3: 0 12px 32px rgba(0, 0, 0, 0.6);
  }
}

[data-theme="dark"] {
  color-scheme: dark;
  --accent-soft: #16233c;
  --bg: #0f1216;
  --bg-raised: #171b21;
  --bg-sunken: #12151a;
  --bg-hover: #1e232b;
  --sidebar-bg: #0b0e12;
  --sidebar-text: #8c97a8;
  --text: #e6e9ee;
  --text-soft: #a3adbb;
  --text-faint: #77828f;
  --border: #262c35;
  --border-strong: #39414d;
  --ok: #52c48a;
  --ok-bg: #10261c;
  --warn: #e0a53c;
  --warn-bg: #2a2113;
  --danger: #f07179;
  --danger-bg: #2c1518;
  --info: #6aa9ec;
  --info-bg: #10202f;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.45);
  --shadow-3: 0 12px 32px rgba(0, 0, 0, 0.6);
}

/* ========================================================================
   2. Reset
   ======================================================================== */

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

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.3; }
h1 { font-size: 19px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 var(--space-3); }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.muted { color: var(--text-soft); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: var(--space-3); }
.row { display: flex; gap: var(--space-3); align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ========================================================================
   3. Primitives
   ======================================================================== */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2);
  padding: 7px 14px;
  font: inherit; font-weight: 500; font-size: 13px;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn:hover { background: var(--bg-hover); text-decoration: none; }
.btn:active { transform: translateY(0.5px); }
.btn[disabled], .btn.loading { opacity: 0.55; cursor: not-allowed; }

.btn.primary {
  color: var(--accent-text);
  background: var(--accent);
  border-color: var(--accent);
}
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn.danger-ghost { color: var(--danger); border-color: var(--border-strong); }
.btn.danger-ghost:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-soft); }
.btn.ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.big { padding: 14px 26px; font-size: 17px; border-radius: var(--radius-lg); }
.btn.block { width: 100%; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0;
  background: transparent; border: 0; border-radius: var(--radius);
  color: var(--text-soft); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

label {
  display: block;
  margin-bottom: var(--space-1);
  font-size: 12px; font-weight: 600;
  color: var(--text-soft);
}
label.inline {
  display: flex; align-items: center; gap: var(--space-2);
  margin-bottom: 0; font-weight: 500; font-size: 13px; color: var(--text);
  cursor: pointer;
}

input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="search"], input[type="time"],
input[type="url"], select, textarea {
  width: 100%;
  padding: 7px 10px;
  font: inherit; font-size: 13px;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type="checkbox"], input[type="radio"] {
  width: 16px; height: 16px; margin: 0;
  accent-color: var(--accent); flex: none;
}
input[disabled], select[disabled], textarea[disabled] {
  background: var(--bg-sunken); color: var(--text-faint); cursor: not-allowed;
}
textarea { min-height: 78px; resize: vertical; font-family: var(--mono); font-size: 12px; }
select { appearance: none; padding-right: 28px; }

.field { margin-bottom: var(--space-4); }
.field:last-child { margin-bottom: 0; }
.field .hint { margin: var(--space-1) 0 0; font-size: 12px; color: var(--text-faint); }
.field-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--space-4);
}

.form-error {
  margin: var(--space-3) 0 0;
  padding: var(--space-2) var(--space-3);
  font-size: 13px; color: var(--danger);
  background: var(--danger-bg);
  border-radius: var(--radius);
}
.form-error.big { font-size: 16px; padding: var(--space-3) var(--space-4); }

/* Badges and pills --------------------------------------------------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
  border-radius: var(--radius-pill);
  background: var(--bg-sunken); color: var(--text-soft);
  white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

.dot-status {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; background: var(--text-faint); flex: none;
}
.dot-status.ok { background: var(--ok); }
.dot-status.warn { background: var(--warn); }
.dot-status.fail { background: var(--danger); }

.pill {
  display: inline-block; min-width: 20px; padding: 1px 6px;
  font-size: 11px; font-weight: 700; text-align: center;
  color: var(--accent-text); background: var(--accent);
  border-radius: var(--radius-pill);
}

/* Cards and tables ---------------------------------------------------- */

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.card + .card { margin-top: var(--space-4); }
.card-head {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}
.card-head h2 { flex: 1; }
.card-body { padding: var(--space-5); }
.card-body.tight { padding: var(--space-3) var(--space-4); }
.card-foot {
  padding: var(--space-3) var(--space-5);
  background: var(--bg-sunken);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  position: sticky; top: 0; z-index: 1;
  padding: var(--space-2) var(--space-4);
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; text-align: left; color: var(--text-faint);
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--bg-hover); }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn + .btn { margin-left: var(--space-2); }

.empty {
  padding: var(--space-7) var(--space-5);
  text-align: center; color: var(--text-soft);
}
.empty h3 { margin-bottom: var(--space-2); color: var(--text); }

/* Stats --------------------------------------------------------------- */

.stats {
  display: grid; gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.stat {
  padding: var(--space-4) var(--space-5);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.stat .label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-faint);
}
.stat .value {
  margin-top: var(--space-2);
  font-size: 27px; font-weight: 650; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat .sub { margin-top: var(--space-1); font-size: 12px; color: var(--text-soft); }

/* Notices ------------------------------------------------------------- */

.notice {
  display: flex; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  font-size: 13px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-faint);
  border-radius: var(--radius);
  background: var(--bg-sunken);
}
.notice.ok { border-left-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.notice.warn { border-left-color: var(--warn); background: var(--warn-bg); color: var(--warn); }
.notice.danger { border-left-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.notice.info { border-left-color: var(--info); background: var(--info-bg); color: var(--info); }
.notice + .notice { margin-top: var(--space-2); }
.notice strong { font-weight: 650; }

/* Code blocks --------------------------------------------------------- */

.code {
  position: relative;
  padding: var(--space-3) var(--space-4);
  padding-right: 84px;
  font-family: var(--mono); font-size: 12px; line-height: 1.6;
  color: var(--text);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  white-space: pre;
}
.code .copy { position: absolute; top: 6px; right: 6px; }

/* ========================================================================
   4. Layout — console shell
   ======================================================================== */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  display: flex; flex-direction: column;
  width: var(--sidebar-width); flex: none;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-5) var(--space-5) var(--space-4);
  font-size: 15px; font-weight: 650; color: #fff;
}
.mark { width: 26px; height: 26px; flex: none; }
.mark path, .mark rect {
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linejoin: round; stroke-linecap: round;
}
.mark .dot { fill: var(--accent); stroke: none; }

.nav { flex: 1; padding: 0 var(--space-3) var(--space-4); }
.nav-group {
  margin: var(--space-4) var(--space-3) var(--space-1);
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: #5d6675;
}
.nav-item {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 7px var(--space-3);
  font-size: 13px; color: var(--sidebar-text);
  border-radius: var(--radius);
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(255, 255, 255, 0.1); color: var(--sidebar-active); font-weight: 600; }
.nav-item .pill { margin-left: auto; }
.nav-item.subtle { font-size: 12px; }

.sidebar-foot {
  padding: var(--space-3) var(--space-3) var(--space-5);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.sidebar-foot .muted { padding: var(--space-2) var(--space-3) 0; color: #5d6675; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: var(--space-4);
  height: var(--topbar-height); flex: none;
  padding: 0 var(--space-5);
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { flex: 1; min-width: 0; }
.topbar-actions { display: flex; gap: var(--space-2); }
.menu-toggle { display: none; }
.bars, .bars::before, .bars::after {
  display: block; width: 16px; height: 2px;
  background: currentColor; border-radius: 2px;
}
.bars { position: relative; }
.bars::before, .bars::after { content: ""; position: absolute; left: 0; }
.bars::before { top: -5px; }
.bars::after { top: 5px; }

.account { position: relative; }
.account-btn {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 4px 8px 4px 4px;
  font: inherit; font-size: 13px; color: var(--text);
  background: transparent; border: 1px solid transparent;
  border-radius: var(--radius-pill); cursor: pointer;
}
.account-btn:hover { background: var(--bg-hover); }
.avatar {
  display: flex; align-items: center; justify-content: center;
  width: 27px; height: 27px; flex: none;
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
  color: var(--accent-text); background: var(--accent);
  border-radius: 50%;
}
.menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 30;
  min-width: 190px; padding: var(--space-1);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-3);
}
.menu a, .menu button {
  display: block; width: 100%; padding: 7px var(--space-3);
  font: inherit; font-size: 13px; text-align: left; color: var(--text);
  background: none; border: 0; border-radius: 5px; cursor: pointer;
}
.menu a:hover, .menu button:hover { background: var(--bg-hover); text-decoration: none; }

.view { flex: 1; padding: var(--space-5); max-width: 1240px; width: 100%; }
.view:focus { outline: none; }
.view-intro { margin-bottom: var(--space-5); max-width: 70ch; }

/* Boot / spinner ------------------------------------------------------ */

.boot {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: var(--space-4);
  min-height: 100vh;
}
.spinner {
  width: 26px; height: 26px;
  border: 2.5px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
  * { transition-duration: 0.01ms !important; }
}

/* ========================================================================
   5. Auth pages
   ======================================================================== */

.auth {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: var(--space-5);
  min-height: 100vh; padding: var(--space-5);
}
.auth-card {
  width: 100%; max-width: 380px;
  padding: var(--space-6);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
}
.auth-card.narrow { max-width: 440px; text-align: center; }
.auth-brand {
  display: flex; align-items: center; gap: var(--space-3);
  margin-bottom: var(--space-6);
  color: var(--text);
}
.auth-brand h1 { font-size: 20px; }
.auth-brand .mark { width: 34px; height: 34px; }
.auth-card .field, .auth-card label { margin-top: var(--space-3); }
.auth-card input { margin-bottom: var(--space-2); }
.auth-card .btn.block { margin-top: var(--space-5); }
.auth-note, .auth-support { margin-top: var(--space-4); font-size: 12px; text-align: center; }
.auth-footer { font-size: 12px; }
.status-code {
  margin: 0 0 var(--space-2);
  font-size: 40px; font-weight: 700; line-height: 1;
  color: var(--text-faint);
}
.auth-card.narrow .btn { margin-top: var(--space-5); }

/* ========================================================================
   6. Toasts and modal
   ======================================================================== */

.toasts {
  position: fixed; bottom: var(--space-5); right: var(--space-5); z-index: 100;
  display: flex; flex-direction: column; gap: var(--space-2);
  max-width: 380px;
}
.toast {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  font-size: 13px;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow-3);
  animation: toast-in 0.18s ease-out;
}
.toast.ok { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast .close {
  margin-left: auto; padding: 0 2px;
  background: none; border: 0; color: var(--text-faint);
  font-size: 16px; line-height: 1; cursor: pointer;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.modal-backdrop {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: flex-start; justify-content: center;
  padding: var(--space-6) var(--space-4);
  background: rgba(10, 13, 18, 0.5);
  overflow-y: auto;
}
.modal {
  width: 100%; max-width: 560px;
  background: var(--bg-raised);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  animation: modal-in 0.16s ease-out;
}
.modal.wide { max-width: 860px; }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.99); }
  to { opacity: 1; transform: none; }
}
.modal-head {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { flex: 1; }
.modal-body { padding: var(--space-5); max-height: 68vh; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
}

/* ========================================================================
   7. Views
   ======================================================================== */

.section-title {
  margin: var(--space-6) 0 var(--space-3);
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-faint);
}
.section-title:first-child { margin-top: 0; }

.filters {
  display: flex; flex-wrap: wrap; gap: var(--space-2);
  align-items: center; margin-bottom: var(--space-4);
}
.filters input, .filters select { width: auto; min-width: 150px; }

.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  font-size: 12px; font-weight: 500;
  background: var(--bg-sunken); color: var(--text-soft);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  cursor: pointer;
}
.chip.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: var(--space-2) var(--space-4); font-size: 13px; }
.kv dt { color: var(--text-soft); }
.kv dd { margin: 0; word-break: break-word; }

.checks { display: flex; flex-direction: column; gap: var(--space-2); }
.check {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.check .name { font-weight: 600; min-width: 150px; }
.check .msg { color: var(--text-soft); }

.rule-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--space-4);
}
.rule-box {
  padding: var(--space-4);
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-sunken);
}
.rule-box h3 { margin-bottom: var(--space-3); }

.platform-tabs { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-bottom: var(--space-4); }
.platform-tab {
  padding: 6px 14px; font-size: 13px; font-weight: 500;
  color: var(--text-soft); background: transparent;
  border: 1px solid transparent; border-radius: var(--radius-pill);
  cursor: pointer;
}
.platform-tab:hover { background: var(--bg-hover); }
.platform-tab.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

.steps { margin: 0 0 var(--space-4); padding-left: 20px; }
.steps li { margin-bottom: var(--space-2); }

.qr { width: 168px; height: 168px; padding: var(--space-3); background: #fff; border-radius: var(--radius); }
.qr svg { width: 100%; height: 100%; }

.progress {
  height: 6px; overflow: hidden;
  background: var(--bg-sunken); border-radius: var(--radius-pill);
}
.progress span { display: block; height: 100%; background: var(--accent); }
.progress.over span { background: var(--danger); }

/* ========================================================================
   8. Portal
   ======================================================================== */

.portal { min-height: 100vh; display: flex; flex-direction: column; }
.portal-head {
  display: flex; align-items: center; gap: var(--space-5);
  padding: 0 var(--space-5); height: var(--topbar-height); flex: none;
  background: var(--bg-raised); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.portal-brand {
  display: flex; align-items: center; gap: var(--space-2);
  font-weight: 650; color: var(--text);
}
.portal-brand .mark { width: 24px; height: 24px; }
.tabs { display: flex; gap: var(--space-1); flex: 1; overflow-x: auto; }
.tab {
  padding: 6px 12px; font-size: 13px; font-weight: 500;
  color: var(--text-soft); border-radius: var(--radius); white-space: nowrap;
}
.tab:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.tab.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.portal-account { display: flex; align-items: center; gap: var(--space-3); }
.account-name { font-size: 13px; font-weight: 500; }
.portal-body { flex: 1; width: 100%; max-width: 900px; margin: 0 auto; padding: var(--space-5); }

.job-card {
  display: flex; gap: var(--space-4); align-items: center;
  padding: var(--space-4);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.job-card + .job-card { margin-top: var(--space-2); }
.job-card .meta { font-size: 12px; color: var(--text-soft); }
.job-card .title { font-weight: 600; }

.dropzone {
  padding: var(--space-7) var(--space-5);
  text-align: center; color: var(--text-soft);
  border: 2px dashed var(--border-strong); border-radius: var(--radius-lg);
  background: var(--bg-sunken);
  cursor: pointer;
}
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone strong { display: block; margin-bottom: var(--space-1); color: var(--text); }

/* ========================================================================
   9. Kiosk / release terminal
   ======================================================================== */

.kiosk {
  display: flex; flex-direction: column;
  min-height: 100vh; background: var(--bg);
}
.kiosk-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-5) var(--space-6);
}
.kiosk-head h1 { font-size: 22px; }
.kiosk-step { flex: 1; display: flex; align-items: center; justify-content: center; padding: var(--space-5); }
.kiosk-panel {
  width: 100%; max-width: 470px;
  padding: var(--space-6);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
}
.kiosk-panel.wide { max-width: 720px; }
.kiosk-panel.centred { text-align: center; }
.kiosk-panel h2 { font-size: 26px; margin-bottom: var(--space-2); }
.kiosk-form { margin-top: var(--space-5); }
.kiosk-input {
  padding: 14px 16px; font-size: 20px; text-align: center;
  letter-spacing: 0.12em;
}
.kiosk-form label { font-size: 13px; margin-top: var(--space-4); }
.kiosk-or {
  position: relative; margin: var(--space-5) 0; text-align: center;
}
.kiosk-or::before {
  content: ""; position: absolute; top: 50%; left: 0; right: 0;
  border-top: 1px solid var(--border);
}
.kiosk-or span {
  position: relative; padding: 0 var(--space-3);
  background: var(--bg-raised); color: var(--text-faint); font-size: 12px;
}

.kiosk-jobs { list-style: none; margin: var(--space-5) 0; padding: 0; }
.kiosk-jobs li {
  display: flex; gap: var(--space-4); align-items: center;
  padding: var(--space-4);
  border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer;
}
.kiosk-jobs li + li { margin-top: var(--space-2); }
.kiosk-jobs li.on { border-color: var(--accent); background: var(--accent-soft); }
.kiosk-jobs input[type="checkbox"] { width: 22px; height: 22px; }
.kiosk-jobs .title { font-size: 17px; font-weight: 600; }
.kiosk-jobs .meta { font-size: 13px; color: var(--text-soft); }
.kiosk-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.kiosk-actions .btn { flex: 1 1 180px; }

.tick {
  width: 62px; height: 62px; margin: 0 auto var(--space-4);
  border-radius: 50%; background: var(--ok-bg);
  position: relative;
}
.tick::after {
  content: ""; position: absolute; left: 22px; top: 14px;
  width: 15px; height: 28px;
  border: solid var(--ok); border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

/* ========================================================================
   10. Responsive
   ======================================================================== */

@media (max-width: 900px) {
  .sidebar {
    position: fixed; z-index: 40; left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    box-shadow: var(--shadow-3);
  }
  .sidebar.open { transform: none; }
  .menu-toggle { display: inline-flex; }
  .view { padding: var(--space-4); }
  .topbar { padding: 0 var(--space-4); gap: var(--space-3); }
  .account-name { display: none; }
}

@media (max-width: 620px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat .value { font-size: 22px; }
  .card-body { padding: var(--space-4); }
  .modal-backdrop { padding: 0; }
  .modal { max-width: none; border-radius: 0; min-height: 100vh; }
  .modal-body { max-height: none; }
  .portal-head { flex-wrap: wrap; height: auto; padding: var(--space-3) var(--space-4); }
  .tabs { order: 3; width: 100%; padding-bottom: var(--space-2); }
  .kiosk-panel { padding: var(--space-5); }
  .kiosk-panel h2 { font-size: 21px; }
}

@media print {
  .sidebar, .topbar, .toasts, .filters, td.actions { display: none !important; }
  .view { padding: 0; }
  .card { border: 0; box-shadow: none; }
}
