/* ============================================================
   Hiropost — "Console"
   An OLED developer-terminal theme for a card-validation
   instrument. Flat surfaces, hairline borders, dense dashboard
   rhythm. All data is monospace. Boldness is spent in exactly
   one place: the emerald LIVE accent.
   ============================================================ */

/* ---------- tokens: dark (DEFAULT) ---------- */
:root {
  --ground: #0B0F17;
  --surface: #121823;
  --surface-2: #0E141E;

  --hair: rgba(255, 255, 255, .07);
  --hair-2: rgba(255, 255, 255, .12);
  --border: #1E2838;
  --border-2: #273246;

  --ink: #E8EDF4;
  --ink-2: #8B97A8;
  --ink-3: #5B6677;

  --ok: #22C55E;
  --bad: #F43F5E;
  --warn: #F59E0B;
  --ok-soft: rgba(34, 197, 94, .12);
  --bad-soft: rgba(244, 63, 94, .12);
  --warn-soft: rgba(245, 158, 11, .12);
  --ok-glow: rgba(34, 197, 94, .40);

  --accent: var(--ok);
  --scrim: rgba(4, 7, 12, .72);
  --card-shadow: 0 1px 0 rgba(255, 255, 255, .02), 0 12px 32px rgba(0, 0, 0, .40);
  --dlg-shadow: 0 24px 64px rgba(0, 0, 0, .60);

  /* radii — deliberately varied, tight/terminal */
  --r-surface: 12px;
  --r-control: 8px;
  --r-seg: 7px;
  --r-chip: 5px;

  --font-ui: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  /* legacy aliases referenced by inline styles in script.js */
  --muted: var(--ink-2);
  --green: var(--ok);
  --red: var(--bad);
  --amber: var(--warn);
  --fg: var(--ink);
}

/* ---------- tokens: light (clean bright inversion) ---------- */
body.light {
  --ground: #F6F7F9;
  --surface: #FFFFFF;
  --surface-2: #EEF1F5;

  --hair: rgba(16, 24, 40, .08);
  --hair-2: rgba(16, 24, 40, .16);
  --border: #D9DEE7;
  --border-2: #C2CAD6;

  --ink: #0E141E;
  --ink-2: #566070;
  --ink-3: #8A94A3;

  --ok: #16A34A;
  --bad: #E11D48;
  --warn: #B45309;
  --ok-soft: rgba(22, 163, 74, .10);
  --bad-soft: rgba(225, 29, 72, .10);
  --warn-soft: rgba(180, 83, 9, .12);
  --ok-glow: rgba(22, 163, 74, .28);

  --scrim: rgba(16, 24, 40, .34);
  --card-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 10px 28px rgba(16, 24, 40, .08);
  --dlg-shadow: 0 24px 64px rgba(16, 24, 40, .22);

  /* legacy aliases — must exist in light too */
  --muted: var(--ink-2);
  --green: var(--ok);
  --red: var(--bad);
  --amber: var(--warn);
  --fg: var(--ink);
}

/* ============================================================
   base + reset
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html, body { height: 100%; }
body {
  color: var(--ink);
  background: var(--ground);
  font: 400 14px/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; }
h1, h2, h3 { font-weight: 600; line-height: 1.3; letter-spacing: -.01em; }

/* all data is mono */
.meta, .session-pill, #cardList, .gate-sub, .ts, .status-chip, .card-text, .ms,
.item-resp, .item-detail, .stat-n, .stat-label, .status-count, #status,
.pool-proxy, .pool-count, .proxy-badge, .status-badge, .gate-tag,
#tokensTable .tok-value, #tokensTable .tok-left, #tokensTable .tok-ip,
#tokensTable .tok-sub, .new-token .nt-value, #cardTypeBadge, #binCheckResult,
#binInput, #quantityInput, #proxyStringModal, #loginToken, #genHours {
  font-family: var(--font-mono);
}

::selection { background: color-mix(in srgb, var(--ok) 26%, transparent); color: var(--ink); }
:focus-visible { outline: 2px solid var(--ok); outline-offset: 2px; border-radius: 4px; }

/* thin console scrollbars */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); background-clip: padding-box; }
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }

/* ============================================================
   utilities + JS feedback
   ============================================================ */
.is-hidden { display: none; }
.d-none { display: none !important; }
.text-muted, .form-text { color: var(--ink-3); }
.form-text { display: block; margin-top: 6px; font-size: 12px; }
#proxyConfigStatus { margin-top: 10px; }
#generatorMessage { margin-top: 16px; }
#cardTypeBadge, #binCheckResult { margin-top: 6px; font-size: 12.5px; }
#binCheckResult { color: var(--ink-2); }

/* ---------- auth / role visibility gating (behavior preserved) ---------- */
.shell { display: none; }
#authGate { display: none; }
#expiredOverlay { display: none; }
body.authed .shell { display: flex; }
body.unauth #authGate { display: grid; }
body.expired #expiredOverlay { display: grid; }

#viewNav { display: none; }
body.role-admin #viewNav { display: flex; }
.tab-solo { display: inline-flex; }
body.role-admin .tab-solo { display: none; }
.session-pill { display: none; }
body.role-user #sessionPill { display: inline-flex; }
#adminView { display: none; }
body.admin-view-active #checkerView { display: none; }
body.admin-view-active #adminView { display: flex; }
#settingsView { display: none; }
body.settings-view-active #checkerView { display: none; }
body.settings-view-active #settingsView { display: block; }

.pause-info { display: none; }
body.role-user .pause-info { display: none; }
.pause-btn { display: none; }
body.role-user .pause-btn { display: inline-flex; }
body.session-paused #startBtn { opacity: .45; pointer-events: none; }

/* ============================================================
   shell + header
   ============================================================ */
.shell { flex-direction: column; height: 100vh; height: 100dvh; }

.header {
  flex: none;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.header-inner { max-width: 1280px; margin: 0 auto; padding: 0 24px; width: 100%; }
.wordrow { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 16px; }

.wordmark { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; letter-spacing: -.02em; white-space: nowrap; color: var(--ink); }
.wordmark-logo { width: 24px; height: 24px; border-radius: 6px; }

.session-pill {
  align-items: center; gap: 8px; color: var(--ink-2); font-weight: 500; font-size: 12px;
  white-space: nowrap; padding: 4px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
}
.session-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok-glow); flex: none; }
.session-pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); }
.session-pill.warn::before { background: var(--warn); box-shadow: 0 0 8px color-mix(in srgb, var(--warn) 50%, transparent); }
.session-pill.crit { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.session-pill.crit::before { background: var(--bad); box-shadow: 0 0 8px color-mix(in srgb, var(--bad) 50%, transparent); }
.session-pill.paused { color: var(--warn); }
.session-pill.paused::before { background: var(--warn); box-shadow: none; animation: pausePulse 1.5s ease-in-out infinite; }
@keyframes pausePulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.pause-btn {
  align-items: center; justify-content: center; width: 30px; height: 30px;
  border-radius: var(--r-seg); border: 1px solid var(--border);
  background: var(--surface); color: var(--ink-2); font-size: 11px;
  transition: background-color .15s, color .15s, border-color .15s;
}
.pause-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--border-2); }
.pause-btn.is-paused { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.pause-btn.is-paused:hover { background: color-mix(in srgb, var(--warn) 22%, transparent); }

.tabbar { display: flex; align-items: center; gap: 4px; }
.tab-group { display: flex; gap: 4px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px;
  background: transparent; border: 1px solid transparent; border-radius: var(--r-control);
  color: var(--ink-2); font-weight: 500; font-size: 13px; white-space: nowrap;
  transition: color .15s, background-color .15s, border-color .15s;
}
.tab i { font-size: 12px; opacity: .85; }
.tab:hover { color: var(--ink); background: var(--surface); }
.tab.active { color: var(--ink); background: var(--surface); border-color: var(--border); font-weight: 600; }
.tab.active i { opacity: 1; }
.tab-spacer { flex: 1; }
.tab-theme, .tab-fullscreen { width: 34px; height: 34px; justify-content: center; padding: 0; }
.tab-theme i, .tab-fullscreen i { font-size: 13px; }

/* ============================================================
   main layout
   ============================================================ */
.main { flex: 1; min-height: 0; width: 100%; max-width: 1280px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; }
#checkerView { flex: 1; min-height: 0; display: grid; grid-template-columns: 360px 1fr; gap: 24px; }
.col { display: flex; flex-direction: column; min-height: 0; min-width: 0; }

.sect-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; gap: 12px; }
.sect-head h2 { font-size: 14px; font-weight: 600; letter-spacing: -.005em; }
.sect-head .meta { color: var(--ink-3); font-weight: 500; font-size: 12px; }

.surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-surface);
  box-shadow: var(--card-shadow);
}

/* ---------- queue column ---------- */
#cardList {
  width: 100%; flex: 1; min-height: 200px; resize: none;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-control);
  background: var(--surface-2); color: var(--ink);
  font-family: var(--font-mono); font-size: 13px; line-height: 1.7;
  transition: border-color .15s, box-shadow .15s;
}
#cardList::placeholder { color: var(--ink-3); font-family: var(--font-ui); }
#cardList:focus { outline: none; border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }

/* ---------- gate selector (compact chip grid) ---------- */
.gate { margin-top: 16px; }
.gate .sect-head { margin-bottom: 8px; }
.gate-label { font-size: 13px; color: var(--ink-2); }
.gate-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.gate-btn {
  display: grid; grid-template-columns: auto 1fr; align-items: center;
  column-gap: 10px; row-gap: 1px; padding: 9px 11px; text-align: left;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-control);
  color: var(--ink-2);
  transition: border-color .15s, background-color .15s, color .15s;
}
.gate-btn i { grid-row: 1 / 3; grid-column: 1; font-size: 15px; color: var(--ink-3); transition: color .15s; }
.gate-name { grid-column: 2; grid-row: 1; font-family: var(--font-ui); font-weight: 600; font-size: 13px; color: var(--ink); }
.gate-sub { grid-column: 2; grid-row: 2; font-size: 10.5px; color: var(--ink-3); letter-spacing: .01em; }
.gate-btn:hover { border-color: var(--border-2); background: var(--surface); }
.gate-btn.active, .gate-btn[aria-checked="true"] {
  background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 55%, transparent);
}
.gate-btn.active i, .gate-btn[aria-checked="true"] i { color: var(--ok); }
.gate-btn.active .gate-name, .gate-btn[aria-checked="true"] .gate-name { color: var(--ok); }
.gate-btn.active .gate-sub, .gate-btn[aria-checked="true"] .gate-sub { color: color-mix(in srgb, var(--ok) 70%, var(--ink-2)); }

.actions { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }

/* ============================================================
   buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px; border-radius: var(--r-control); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--ink);
  font-family: var(--font-ui); font-weight: 600; font-size: 13.5px; line-height: 1.2;
  transition: background-color .15s, color .15s, border-color .15s, box-shadow .15s, transform .12s;
}
.btn i { font-size: .9em; }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; transform: none; }

/* hero action — the one place boldness is spent */
.btn-primary, .btn-success {
  background: var(--ok); color: #05140B; border-color: transparent;
  font-weight: 700; letter-spacing: .01em;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ok) 50%, transparent), 0 6px 18px var(--ok-soft);
}
.btn-primary:hover, .btn-success:hover {
  background: color-mix(in srgb, var(--ok) 88%, white);
  box-shadow: 0 0 0 1px var(--ok), 0 8px 22px var(--ok-glow); transform: translateY(-1px);
}
.btn-primary:active, .btn-success:active { transform: translateY(0); }
body.light .btn-primary, body.light .btn-success { color: #FFFFFF; }

.btn-quiet, .btn-secondary, .btn-outline-light { background: var(--surface-2); color: var(--ink-2); border-color: var(--border); }
.btn-quiet:hover, .btn-secondary:hover, .btn-outline-light:hover { color: var(--ink); background: var(--surface); border-color: var(--border-2); }
.btn-outline-light.active { color: var(--ink); }

.btn-stop, .btn-danger, .btn-restart { color: var(--bad); background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn-stop:hover, .btn-danger:hover, .btn-restart:hover { background: var(--bad); color: #FFFFFF; border-color: transparent; box-shadow: 0 6px 18px color-mix(in srgb, var(--bad) 35%, transparent); }

.btn-sm { padding: 7px 11px; font-size: 12.5px; border-radius: var(--r-seg); }

/* ============================================================
   proxy + pool
   ============================================================ */
.proxy-section {
  margin-top: 12px; border: 1px solid var(--border); border-radius: var(--r-control);
  overflow: hidden; background: var(--surface);
}
.proxy-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px;
  background: transparent; border: none; color: var(--ink-2);
  font-family: var(--font-ui); font-size: 12px; font-weight: 600; letter-spacing: .02em;
  transition: color .15s, background-color .15s;
}
.proxy-toggle:hover { color: var(--ink); background: var(--surface-2); }
.proxy-toggle i:first-child { color: var(--ok); font-size: 12px; }
.proxy-chevron { margin-left: auto; font-size: 10px; transition: transform .2s; }
.proxy-section.open .proxy-chevron { transform: rotate(90deg); }
.proxy-body { display: none; padding: 12px; border-top: 1px solid var(--border); background: var(--surface-2); }
.proxy-section.open .proxy-body { display: block; }
.proxy-input-row { display: flex; gap: 8px; align-items: center; }
.proxy-input-row .form-control { flex: 1; font-size: 12px; padding: 8px 10px; }
.proxy-input-row .btn { padding: 8px 11px; font-size: 12px; white-space: nowrap; }
.proxy-status-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; min-height: 20px; flex-wrap: wrap; }
.proxy-hint { color: var(--ink-3); font-size: 11px; }

.proxy-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: var(--r-chip);
  font-family: var(--font-mono); font-size: 11px; font-weight: 600; line-height: 1.4;
  text-transform: uppercase; letter-spacing: .04em; border: 1px solid transparent;
}
.proxy-badge.live { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.proxy-badge.dead { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.proxy-badge.testing { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }

.pool-count {
  margin-left: 2px; display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px;
  background: var(--ok-soft); color: var(--ok); font-size: 11px; font-weight: 700;
  border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent);
}
#proxyPoolInput { min-height: 88px; resize: vertical; font-family: var(--font-mono); font-size: 12px; line-height: 1.6; }
.pool-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pool-list { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; max-height: 220px; overflow: auto; }
.pool-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: var(--r-seg); background: var(--surface);
  font-size: 12px;
}
.pool-proxy { color: var(--ink-2); word-break: break-all; font-size: 12px; }
.pool-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.pool-dot.live { background: var(--ok); box-shadow: 0 0 8px var(--ok-glow); }
.pool-dot.dead { background: var(--bad); }
.pool-dot.testing { background: var(--warn); animation: pausePulse 1.4s ease-in-out infinite; }
.pool-empty { padding: 14px; text-align: center; color: var(--ink-3); font-size: 12px; }

/* ============================================================
   results column — the centerpiece
   ============================================================ */
.results-top { flex: none; }

/* stat cluster — prominent counter cards */
.stat-cluster { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat-tab {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; text-align: left;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--border); border-radius: var(--r-control);
  transition: border-color .18s, background-color .15s, box-shadow .18s;
}
.stat-tab:hover { border-color: var(--border-2); border-left-color: var(--border-2); }
.stat-tab .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.stat-meta { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.stat-n { font-family: var(--font-mono); font-size: 22px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-label { font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); }

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

/* Live counter is the permanent visual anchor */
.stat-tab:has(.dot-ok) .stat-n { color: var(--ok); text-shadow: 0 0 10px var(--ok-glow); }

.stat-tab.active { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border-2); }
.stat-tab.active:has(.dot-ok) { border-color: color-mix(in srgb, var(--ok) 55%, transparent); border-left-color: var(--ok); }
.stat-tab.active:has(.dot-ok) .stat-label { color: var(--ok); }
.stat-tab.active:has(.dot-bad) { border-color: color-mix(in srgb, var(--bad) 50%, transparent); border-left-color: var(--bad); }
.stat-tab.active:has(.dot-bad) .stat-n, .stat-tab.active:has(.dot-bad) .stat-label { color: var(--bad); }
.stat-tab.active:has(.dot-warn) { border-color: color-mix(in srgb, var(--warn) 50%, transparent); border-left-color: var(--warn); }
.stat-tab.active:has(.dot-warn) .stat-n, .stat-tab.active:has(.dot-warn) .stat-label { color: var(--warn); }

/* run line — status + progress */
.run-line { margin-bottom: 14px; }
.status-text { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
#status {
  font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--ink);
  text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%;
}
.status-count { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.status-count b { font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.progress { height: 4px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
#progressBar {
  height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--ok) 70%, transparent), var(--ok));
  background-size: 200% 100%;
  box-shadow: 0 0 10px var(--ok-glow);
}

/* results surface */
.results { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.results-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.results-head-label { font-family: var(--font-ui); font-size: 12px; font-weight: 600; color: var(--ink-2); letter-spacing: .01em; }
.results-tools { margin-left: auto; display: flex; gap: 2px; }

.textbtn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; padding: 6px 9px; border-radius: var(--r-seg);
  color: var(--ink-2); font-family: var(--font-ui); font-weight: 500; font-size: 12.5px;
  transition: color .15s, background-color .15s;
}
.textbtn:hover { color: var(--ink); background: var(--surface-2); }
.textbtn.active { color: var(--ok); }

.results-pane { display: none; flex: 1; min-height: 0; overflow: auto; }
.results-pane.active { display: block; }
.list { min-height: 100%; }

/* ---------- console log rows ---------- */
.item {
  display: flex; flex-direction: column; gap: 3px;
  padding: 9px 14px 10px; border-bottom: 1px solid var(--hair);
  border-left: 3px solid transparent; cursor: pointer;
  transition: background-color .12s;
}
.item:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.item:hover { background: var(--surface-2); }
.item.approved { border-left-color: var(--ok); }
.item.declined { border-left-color: var(--bad); }
.item.error { border-left-color: var(--warn); }

.item-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.item-main .ts { color: var(--ink-3); font-size: 12px; font-weight: 400; flex: none; }
.item-main svg { width: 22px; height: 14px; border-radius: 2px; flex: none; }
.item-main .card-text { flex: 1; min-width: 0; color: var(--ink); font-size: 13.5px; font-weight: 500; letter-spacing: .01em; word-break: break-all; }
.item-main .ms { color: var(--ink-3); font-size: 12px; font-weight: 400; white-space: nowrap; flex: none; }

.status-chip {
  display: inline-flex; align-items: center; flex: none;
  padding: 2px 7px; border-radius: var(--r-chip);
  font-size: 10.5px; font-weight: 700; line-height: 1.5;
  text-transform: uppercase; letter-spacing: .06em; border: 1px solid transparent;
}
.status-chip.approved { color: var(--ok); background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.status-chip.declined { color: var(--bad); background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.status-chip.error { color: var(--warn); background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }

/* the full gate response — the important new line */
.item-resp {
  padding-left: 2px; color: var(--ink-2); font-size: 12px; line-height: 1.5;
  word-break: break-word; overflow-wrap: anywhere;
}
.resp-bin { color: var(--ink-3); }

.item-detail {
  display: none; margin-top: 2px; padding: 8px 10px; border-radius: var(--r-seg);
  background: var(--surface-2); border: 1px solid var(--hair);
  color: var(--ink-3); font-size: 11.5px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-all; cursor: text;
}

.list:empty::after { display: block; padding: 48px 18px; color: var(--ink-3); font-family: var(--font-ui); text-align: center; font-size: 13px; }
#approved-pane .list:empty::after { content: "LIVE cards will appear here."; }
#declined-pane .list:empty::after { content: "DEAD cards will appear here."; }
#error-pane .list:empty::after { content: "Cards that could not be checked will appear here."; }

/* ============================================================
   forms
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-label { display: block; color: var(--ink-2); font-size: 12.5px; font-weight: 500; margin-bottom: 6px; }
.form-control {
  display: block; width: 100%; padding: 10px 13px;
  background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--border); border-radius: var(--r-control);
  transition: border-color .15s, box-shadow .15s;
}
.form-control::placeholder { color: var(--ink-3); }
.form-control:focus { outline: none; border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
select.form-control {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
}
.control-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.checkbox-row { display: flex; align-items: center; gap: 10px; color: var(--ink); cursor: pointer; margin-bottom: 10px; font-size: 13px; }
.checkbox-row input { width: 16px; height: 16px; margin: 0; accent-color: var(--ok); }
.gate-checks { display: flex; flex-direction: column; gap: 2px; }
.gate-checks .checkbox-row { margin: 0 0 4px; font-size: 13px; }

.alert { border-radius: var(--r-seg); padding: 10px 13px; font-size: 13px; border: 1px solid transparent; }
.alert-danger { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.alert-success { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.alert-info { background: var(--surface-2); color: var(--ink-2); border-color: var(--border); }

.pw-wrap { position: relative; }
.pw-wrap .form-control { padding-right: 44px; }
.pw-toggle { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; background: none; color: var(--ink-3); border-radius: var(--r-seg); transition: color .15s, background-color .15s; }
.pw-toggle:hover { color: var(--ink); background: var(--surface-2); }

/* ============================================================
   dialog
   ============================================================ */
dialog.dlg {
  margin: auto; padding: 0; width: min(520px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border-2); border-radius: var(--r-surface); box-shadow: var(--dlg-shadow);
}
dialog.dlg::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 0; }
.dlg-title { font-size: 16px; font-weight: 600; }
.dlg-close { width: 34px; height: 34px; border: 0; background: none; color: var(--ink-3); font-size: 22px; line-height: 1; border-radius: var(--r-seg); margin-right: -6px; transition: color .15s, background-color .15s; }
.dlg-close:hover { color: var(--ink); background: var(--surface-2); }
.dlg-body { padding: 18px 22px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 22px 22px; }
.dlg-foot .btn { padding: 9px 16px; }

/* ============================================================
   settings + system control
   ============================================================ */
.settings-section { max-width: 540px; }
.admin-section { padding: 22px; }
.perf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-foot { margin-top: 18px; display: flex; justify-content: flex-end; }

/* solver config */
.solver-grid { display: flex; flex-direction: column; gap: 2px; }
.solver-grid .form-group { margin-bottom: 12px; }
.mono-input { font-family: 'JetBrains Mono', Consolas, monospace; font-size: 12px; letter-spacing: -.02em; }
.solver-actions { display: flex; gap: 10px; margin-bottom: 12px; }
.balance-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; padding: 12px; background: var(--surface-2); border: 1px solid var(--hair-2); border-radius: var(--r-seg); }
.balance-item { display: flex; align-items: center; gap: 10px; font-size: 13px; font-family: 'JetBrains Mono', Consolas, monospace; }
.balance-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.balance-dot.alive { background: var(--ok); box-shadow: 0 0 6px var(--ok-glow); }
.balance-dot.dead { background: var(--bad); }
.balance-name { color: var(--ink-2); min-width: 100px; }
.balance-val { color: var(--ink); }
.balance-val.err { color: var(--bad); }
.balance-spinner { color: var(--ink-3); font-size: 12px; }

.system-control-note { color: var(--ink-3); font-size: 13px; margin-top: -2px; }
.system-control-foot { justify-content: flex-start; }
#restartStatus, #proxyTestResult { margin-top: 12px; }
#proxyTestResult { font-size: 13px; }

/* ============================================================
   login + expired overlay
   ============================================================ */
#authGate { position: fixed; inset: 0; background: var(--ground); place-items: center; z-index: 5000; padding: 24px; }
#loginCard {
  width: 100%; max-width: 400px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-surface);
  padding: 32px; box-shadow: var(--card-shadow);
}
.login-wordmark { margin-bottom: 8px; font-size: 20px; }
.login-sub { color: var(--ink-2); margin-bottom: 24px; font-size: 13.5px; }
.login-field { margin-bottom: 16px; }
.login-submit { width: 100%; margin-top: 8px; }
#loginError { margin-bottom: 14px; }

#expiredOverlay { position: fixed; inset: 0; background: var(--scrim); place-items: center; z-index: 6000; padding: 24px; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.overlay-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-surface); padding: 32px; box-shadow: var(--dlg-shadow); }
.overlay-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.overlay-text { color: var(--ink-2); margin-bottom: 24px; font-size: 13.5px; }

/* ============================================================
   admin — token data grid
   ============================================================ */
#adminView { overflow-y: auto; gap: 24px; }
body.admin-view-active #adminView { display: flex; flex-direction: column; }
.admin-gen { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.admin-field { min-width: 150px; }
.admin-field-grow { flex: 1; min-width: 220px; }
.admin-gen .btn { padding: 10px 18px; }

.new-token { margin-top: 18px; padding: 16px; background: var(--ok-soft); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); border-radius: var(--r-control); }
.new-token .nt-label { font-size: 12.5px; color: var(--ink-2); margin-bottom: 8px; }
.new-token .nt-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.new-token .nt-value { font-size: 16px; font-weight: 700; letter-spacing: .06em; color: var(--ink); }

.table-wrap { overflow-x: auto; }
#tokensTable { width: 100%; border-collapse: collapse; font-size: 13px; }
#tokensTable th { text-align: left; color: var(--ink-3); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
#tokensTable td { padding: 11px 12px; border-bottom: 1px solid var(--hair); vertical-align: middle; }
#tokensTable tr:last-child td { border-bottom: 0; }
#tokensTable tbody tr { transition: background-color .12s; }
#tokensTable tbody tr:hover { background: var(--surface-2); }
#tokensTable .tok-value { letter-spacing: .04em; }
#tokensTable .tok-sub { display: block; color: var(--ink-3); font-size: 11px; white-space: nowrap; }
#tokensTable .col-actions, #tokensTable td.col-actions { text-align: right; }
#tokensTable .row-actions { display: inline-flex; gap: 4px; }
#tokensTable .row-actions .btn { border-color: transparent; background: transparent; padding: 6px 9px; }
#tokensTable .row-actions .btn:hover { background: var(--surface-2); }

.status-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.status-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-unused { color: var(--ink-3); }
.status-active { color: var(--ok); }
.status-expired { color: var(--bad); }
.status-paused { color: var(--warn); }
.status-revoked { color: var(--warn); }
.gate-tag { display: inline-block; padding: 2px 8px; margin: 1px 2px 1px 0; border-radius: var(--r-chip); background: var(--surface-2); color: var(--ink-2); font-size: 11px; border: 1px solid var(--border); }
.admin-empty { color: var(--ink-3); padding: 24px; text-align: center; }

/* ============================================================
   toast + motion
   ============================================================ */
.duplicate-alert {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px);
  display: flex; align-items: center; gap: 10px; padding: 11px 16px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--border-2); border-radius: var(--r-control);
  box-shadow: var(--dlg-shadow); opacity: 0; z-index: 7000; pointer-events: none; font-size: 13px;
}
.duplicate-alert i { color: var(--warn); }
.duplicate-alert.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes value-pop { 0% { transform: scale(1.22); opacity: .5; } 100% { transform: scale(1); opacity: 1; } }
.value-pop { display: inline-block; }

@media (prefers-reduced-motion: no-preference) {
  #progressBar { transition: width .3s ease-out; animation: shimmer 2s linear infinite; }
  .duplicate-alert { transition: opacity .2s, transform .2s; }
  .value-pop { animation: value-pop .3s cubic-bezier(.34, 1.56, .64, 1); }
}
@keyframes shimmer { 0% { background-position: 0% 0; } 100% { background-position: 200% 0; } }
@media (prefers-reduced-motion: reduce) {
  #progressBar, .session-pill.paused::before, .pool-dot.testing { animation: none; }
  * { transition: none !important; }
}

/* ============================================================
   responsive
   ============================================================ */
@media (max-width: 1024px) {
  #checkerView { grid-template-columns: 320px 1fr; gap: 20px; }
}
@media (max-width: 860px) {
  .header-inner { padding: 0 16px; }
  .tabbar { overflow-x: auto; scrollbar-width: none; }
  .tabbar::-webkit-scrollbar { display: none; }
  .main { padding: 16px; overflow: auto; display: block; }
  #checkerView { display: block; }
  .col-queue { margin-bottom: 20px; }
  #cardList { min-height: 150px; flex: none; }
  .results { min-height: 440px; }
  .results-pane { max-height: 60vh; }
}
@media (max-width: 560px) {
  .wordrow { height: 52px; gap: 10px; }
  .wordmark { font-size: 16px; }
  .tab-fullscreen { display: none; }
  .stat-cluster { gap: 8px; }
  .stat-tab { flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 11px; }
  .stat-n { font-size: 19px; }
  .btn-row { flex-wrap: wrap; }
  .btn-row .btn { flex: 1 1 calc(50% - 4px); }
  .control-row { grid-template-columns: 1fr; }
  .perf-grid { grid-template-columns: 1fr; }
  #status { max-width: 50%; }
  .results-tools { margin-left: 0; width: 100%; justify-content: flex-end; }
  #loginCard, .overlay-card { padding: 24px; }
  .admin-section { padding: 16px; }
  .pool-actions .btn { flex: 1 1 100%; }
}
