/* SBTV Admin — dark, dense, plain.
   An operations tool used to move money and message every user. Its job is to
   make the target project and the consequence of a button obvious. */

:root {
  --bg: #0e0f11; --panel: #16181b; --panel-2: #1c1f23; --line: #26292e;
  --text: #e7e9ec; --muted: #8b9199; --dim: #5c636c;
  --accent: #ff470f; --ok: #2ea043; --bad: #e5534b; --warn: #d29922;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1 { font-size: 20px; margin: 0 0 6px; }
h2 { font-size: 14px; margin: 0; }
h3 { font-size: 15px; margin: 0 0 10px; }
.note { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.muted { color: var(--dim); font-size: 12.5px; }
.err { color: var(--bad); font-size: 12.5px; }
.pad { padding: 14px 2px; }
.nil { color: var(--dim); }
.tiny { font: 11px var(--mono); color: var(--muted); }
.when { font: 11.5px var(--mono); color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 360px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 14px; padding: 26px; }
.brand.big { font-size: 22px; margin-bottom: 4px; }
.login-error { color: var(--bad); font-size: 12.5px; min-height: 18px; margin: 2px 0 8px; }
.backend { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ── Shell ───────────────────────────────────────────────────────────────── */
.topbar { display: flex; align-items: center; gap: 14px; padding: 9px 16px;
  border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { font-weight: 800; }
.brand span { color: var(--accent); margin-left: 4px; }
.envpick { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px;
  color: var(--muted); font-size: 13px; }

/* The single most important widget on the page: which database am I editing. */
.envbar { display: flex; align-items: center; gap: 8px; font-size: 12px;
  padding: 4px 11px; border-radius: 7px; background: var(--panel-2);
  border: 1px solid var(--line); color: var(--muted); }
.envbar code { font: 11px var(--mono); color: var(--dim); }
.envbar.is-prod { background: #3a1c1a; border-color: var(--bad); color: #ffb4ae; }
.envbar.is-prod code { color: #ff9a91; }
.envbar-label { color: inherit; opacity: .75; }

.body { display: grid; grid-template-columns: 200px minmax(0, 1fr); height: calc(100vh - 51px); }
.nav { border-right: 1px solid var(--line); padding: 10px 8px; overflow-y: auto; background: var(--panel); }
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--dim); margin: 14px 12px 5px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0;
  color: var(--muted); padding: 7px 12px; border-radius: 8px; cursor: pointer; font: inherit; }
.nav-item .icon { flex: none; opacity: .8; }
.nav-item.active .icon { color: var(--accent); opacity: 1; }
.nav-item:focus-visible, .btn:focus-visible, .switch:focus-visible, .seg-item:focus-visible,
.th-sort:focus-visible, .linkish:focus-visible, .chip button:focus-visible, .lib-item:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--panel-2); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.view { padding: 18px; overflow-y: auto; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card { background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 12px; }
.card-actions { display: flex; gap: 8px; flex-shrink: 0; }

.field { display: block; margin-bottom: 10px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.input { width: 100%; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 8px; padding: 8px 11px; font: inherit; }
.input:focus { outline: none; border-color: var(--accent); }
.input.mono { font: 12px var(--mono); }
.input.sm { padding: 4px 8px; width: auto; }
textarea.input { resize: vertical; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.row.tight { margin: 0; }
.row .input { flex: 1; min-width: 160px; }
.hint { font-size: 11.5px; color: var(--dim); margin-bottom: 8px; }

.btn { background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 7px 13px; cursor: pointer; font: inherit; white-space: nowrap; }
.btn:hover { border-color: var(--dim); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
/* Destructive actions look destructive before they are pressed, not after. */
.btn.danger { background: #3a1c1a; border-color: var(--bad); color: #ffb4ae; font-weight: 600; }
.btn.ghost { background: none; color: var(--muted); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.danger-text { color: #ff8a80; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Stats ───────────────────────────────────────────────────────────────── */
.stat-grid { display: grid; gap: 12px; margin-bottom: 14px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.stat { position: relative; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px; min-width: 0; }
.stat.ok .stat-value { color: #56d364; }
.stat.warn { border-color: #4a3a15; background: #201c10; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat.warn .stat-value { color: #e3b341; }
.stat-label { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.stat-hint { font-size: 11px; color: var(--dim); margin-top: 2px; }
/* A tile that opens the rows behind its number. */
.stat.is-link { font: inherit; color: inherit; text-align: left; cursor: pointer; width: 100%;
  transition: border-color .15s, transform .15s; }
.stat.is-link:hover { border-color: var(--muted); }
.stat.is-link:active { transform: translateY(1px); }
.stat-go { position: absolute; top: 14px; right: 14px; color: var(--dim); opacity: 0; transition: opacity .15s; }
.stat.is-link:hover .stat-go, .stat.is-link:focus-visible .stat-go { opacity: 1; }
.stat.warn.is-link:hover { border-color: var(--warn); }
.stat.is-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.switch-grid { display: grid; gap: 2px 28px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.switch-groups { display: grid; gap: 18px 32px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.switch-group h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--dim);
  margin: 0 0 4px; font-weight: 700; }
.switch-group .switch-row:last-child { border-bottom: 0; }
.switch-row { display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.switch { border: 1px solid var(--line); background: var(--panel-2); color: var(--dim);
  border-radius: 20px; padding: 3px 12px; font: 700 10.5px/1.6 inherit; cursor: pointer;
  letter-spacing: .05em; }
.switch.on { background: #12321c; border-color: #1f6f34; color: #56d364; }
.switch { min-width: 48px; flex: none; }
.switch:disabled { opacity: .5; cursor: progress; }

/* ── Table ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px;
  padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.th-sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px; }
.th-sort:hover { color: var(--text); }
.sort-arrow { font-size: 9px; color: var(--dim); }
th.is-sorted { color: var(--text); }
th.is-sorted .sort-arrow { color: var(--accent); }
.table td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line);
  vertical-align: middle; max-width: 320px; }
.table tbody tr:hover { background: var(--panel-2); }
.thumb { height: 26px; width: auto; max-width: 60px; border-radius: 4px; object-fit: cover;
  background: var(--panel-2); }
.table-foot { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding-top: 10px; }

.pill { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; letter-spacing: .04em; }
.pill.ok { background: #12321c; color: #56d364; }
.pill.off { background: var(--panel-2); color: var(--dim); }
/* Review states: amber is "a person has to look", red is "held / refused". The
   palettes mirror .stat.warn and .btn.danger so the same colour means the same
   thing wherever it appears on the page. */
.pill.warn { background: #201c10; color: #e3b341; border: 1px solid #4a3a15; }
.pill.bad { background: #3a1c1a; color: #ffb4ae; border: 1px solid var(--bad); }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.65);
  display: grid; place-items: center; padding: 20px; z-index: 40; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px; width: 100%; max-width: 400px; }
.modal.wide { max-width: 560px; }
.modal.xwide { max-width: 860px; }
.modal h3 { font-size: 16px; }
.modal-body { max-height: 55vh; overflow-y: auto; margin-bottom: 8px; }
.modal-detail { color: var(--muted); font-size: 13px; white-space: pre-wrap; margin: 0 0 10px; }
.modal-target { font-size: 12px; color: var(--muted); margin: 0 0 14px; }
.modal-target code { font: 11.5px var(--mono); color: var(--accent); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Checkbox list — which leagues a sync covers. Two columns where there is room,
   so a dozen competitions stay one glance rather than one scroll. */
.checks { display: grid; gap: 2px; margin-top: 6px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.check { display: flex; align-items: baseline; gap: 8px; padding: 5px 7px;
  border-radius: 6px; font-size: 13px; cursor: pointer; }
.check:hover { background: var(--panel-2); }
.check input { accent-color: var(--accent); margin: 0; flex-shrink: 0; }
.check-note { color: var(--dim); font-size: 11px; margin-left: auto; }

/* What a command reported, verbatim. Pre-wrapped: the engine's replies are
   short lines that must not be re-flowed into a paragraph. */
.output { margin: 0; font: 12px/1.55 var(--mono); color: var(--text);
  white-space: pre-wrap; word-break: break-word; }

/* ── Upload ──────────────────────────────────────────────────────────────── */
.file { display: block; margin-bottom: 10px; color: var(--muted); font-size: 12.5px; }
.upload-out { display: flex; flex-direction: column; gap: 8px; }
.preview { max-width: 260px; max-height: 150px; border-radius: 8px;
  border: 1px solid var(--line); object-fit: contain; background: var(--panel-2); }
.preview.sm { max-height: 60px; margin-top: 6px; }
.sticky-save { position: sticky; bottom: 0; padding: 12px 0;
  background: linear-gradient(transparent, var(--bg) 35%); }

.two-col, .push-previews { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.push-preview { display: flex; flex-direction: column; gap: 5px; margin: 10px 0;
  padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.push-preview small { color: var(--dim); letter-spacing: .08em; }
.push-preview span { color: var(--muted); }

/* ── Toasts ──────────────────────────────────────────────────────────────── */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex;
  flex-direction: column; gap: 8px; z-index: 60; }
.toast { display: flex; align-items: flex-start; gap: 10px; background: var(--panel-2);
  border: 1px solid var(--line); color: var(--text); border-left: 3px solid var(--ok);
  border-radius: 8px; padding: 9px 10px 9px 14px; font-size: 12.5px; opacity: 1;
  transition: opacity .3s; max-width: 380px; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.toast-msg { flex: 1; white-space: pre-wrap; overflow-wrap: anywhere; }
.toast-x { background: none; border: 0; color: var(--dim); cursor: pointer; padding: 1px; line-height: 0; }
.toast-x:hover { color: var(--text); }
.toast.bad { border-left-color: var(--bad); }
.toast.out { opacity: 0; }

@media (max-width: 900px) {
  .body { grid-template-columns: 1fr; height: auto; }
  .nav { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-item { width: auto; white-space: nowrap; }
  .nav-group { display: none; }
  .two-col, .push-previews { grid-template-columns: 1fr; }
}

/* ── Image field (URL + upload + preview), used anywhere an image is edited ── */
.field .row.tight { margin: 0; }
.field .row.tight + .row.tight { margin-top: 6px; }
.field .row.tight .input { flex: 1; min-width: 0; }
.field .preview.sm { max-height: 54px; max-width: 160px; }
.field .preview[hidden] { display: none; }

/* One line under every field saying what it expects — an enum names its
   options, a boolean says "yes or no", a bare text/number field gets a guess
   from its column name. Never hidden by default: a field with no guidance is
   exactly where a bad value gets typed in. */
.field-hint { display: block; margin-top: 4px; color: var(--dim); font-size: 11px; line-height: 1.4; }

/* ── Player identity in fulfil/reject dialogs ───────────────────────────── */
.player-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin: 0 0 12px; }
.player-card.is-flagged { border-color: var(--warn); }
.player-card-head { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--dim); font-weight: 700; margin-bottom: 6px; }
.player-card dl { display: grid; grid-template-columns: 92px 1fr; gap: 4px 10px; margin: 0; font-size: 13px; }
.player-card dt { color: var(--muted); }
.player-card dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.player-card dd.mono { font-family: var(--mono); font-size: 12.5px; }
.player-card dd.dim { color: var(--dim); font-weight: 400; font-size: 11px; }
.player-card dd.nil { color: var(--dim); font-weight: 400; }
.player-card dd.warn { color: var(--warn); text-transform: capitalize; }

/* ── Giveaway draw ───────────────────────────────────────────────────────────
   One modal for the draw and the read-only result. The stage has a fixed
   height so switching tiers (wheel/reel/ticker) never resizes the modal
   mid-draw. Gold/silver/bronze only ever mean draw position 1/2/3. */
.gd-wrap { backdrop-filter: blur(3px); }
.modal.gd { max-width: 720px; padding: 0; overflow: hidden; max-height: calc(100vh - 40px);
  display: flex; flex-direction: column; box-shadow: 0 24px 80px rgba(0,0,0,.55); }
.gd > * { flex-shrink: 0; }

.gd-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #1b1d21, var(--panel)); }
.gd-head-top { display: flex; align-items: center; gap: 8px; }
.gd-eyebrow { font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; }
.gd-env { font: 700 10px/1 var(--mono); padding: 4px 6px; border-radius: 5px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.gd-env.is-prod { background: #3a1c1a; border-color: var(--bad); color: #ffb4ae; }
.gd-x { margin-left: auto; width: 30px; height: 30px; border-radius: 8px; border: 1px solid transparent;
  background: none; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.gd-x:hover { background: var(--panel-2); border-color: var(--line); color: var(--text); }
.gd-x:disabled { opacity: .3; cursor: not-allowed; }
.gd-title { font-size: 19px; margin: 6px 0 10px; letter-spacing: -.01em; }
.gd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.gd-chip { font-size: 12px; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.gd-chip b { color: var(--dim); font-weight: 600; margin-right: 2px; }

.gd-stage { position: relative; height: 290px; margin: 16px 22px 0; overflow: hidden;
  display: grid; place-items: center; border-radius: 14px; border: 1px solid var(--line);
  background:
    radial-gradient(ellipse 60% 70% at 50% 50%, rgba(255,71,15,.10), transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 120%, rgba(255,255,255,.04), transparent 60%),
    var(--panel-2);
  transition: height .45s cubic-bezier(.2,.8,.2,1); }
.gd-stage.compact { height: 150px; }
.gd-stage.compact.mini { height: 96px; }

.gd-msg, .gd-ready { display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center; padding: 0 24px; max-width: 100%; }
.gd-msg-title { font-size: 17px; font-weight: 700; }
.gd-msg-sub { color: var(--muted); font-size: 12.5px; max-width: 440px; }
.gd-msg.ok .gd-msg-title { color: #6fdd8b; }
.gd-msg.bad .gd-msg-title { color: #ff8a80; }
.gd-reason { margin: 8px 0 0; max-width: 520px; max-height: 90px; overflow: auto; text-align: left;
  font: 11.5px/1.5 var(--mono); color: #ffb4ae; background: #2a1514; border: 1px solid #5c2723;
  border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; }
.gd-spinner { width: 28px; height: 28px; border-radius: 50%; margin-bottom: 6px;
  border: 3px solid var(--line); border-top-color: var(--accent); animation: gd-rot .8s linear infinite; }
@keyframes gd-rot { to { transform: rotate(360deg); } }

.gd-stack { display: flex; margin-bottom: 8px; }
.gd-stack .gd-avatar { margin-left: -6px; box-shadow: 0 0 0 3px var(--panel-2); }
.gd-stack .gd-avatar:first-child { margin-left: 0; }
.gd-more { background: var(--panel) !important; color: var(--muted) !important; font-size: 11px; }

/* Avatar: initials on the account's own hue (set as --hue from JS). */
.gd-avatar { --hue: 20; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  display: inline-grid; place-items: center; font-weight: 700; font-size: 12px; line-height: 1; color: #fff;
  background: linear-gradient(135deg, hsl(var(--hue) 55% 46%), hsl(calc(var(--hue) + 40) 50% 30%)); }
.gd-avatar.lg { width: 42px; height: 42px; font-size: 14px; }
.gd-avatar.xl { width: 76px; height: 76px; font-size: 26px;
  box-shadow: 0 0 0 4px rgba(255,255,255,.08), 0 0 40px hsl(var(--hue) 70% 50% / .45); }

/* Progress: one step per winner. */
.gd-progress { display: flex; align-items: center; gap: 12px; margin: 12px 22px 0; min-height: 18px; }
.gd-progress:empty { display: none; }
.gd-steps { display: flex; gap: 5px; }
.gd-step { width: 22px; height: 5px; border-radius: 3px; background: var(--line); transition: background .3s; }
.gd-step.now { background: var(--warn); animation: gd-blink 1s ease-in-out infinite; }
.gd-step.done { background: var(--ok); animation: none; }
@keyframes gd-blink { 50% { opacity: .45; } }
.gd-progress-text { color: var(--muted); font-size: 12.5px; }

/* Winners board. */
.gd-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px 10px; margin: 6px 22px 0; padding-top: 10px; overflow-y: auto; max-height: 260px; }
.gd-board:empty { display: none; }
.gd-card { position: relative; display: flex; align-items: center; gap: 11px; padding: 15px 12px 11px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; }
.gd-card.revealed { animation: gd-pop .45s cubic-bezier(.2,1.4,.4,1); }
@keyframes gd-pop { from { transform: translateY(8px) scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
.gd-card-text { min-width: 0; flex: 1; }
.gd-card-name { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gd-card-meta { display: flex; align-items: center; gap: 7px; margin-top: 3px; }
.gd-card-id { font: 11px var(--mono); color: var(--dim); white-space: nowrap; }
.gd-place { position: absolute; top: -9px; left: 10px; font: 800 10px/1 var(--mono);
  padding: 4px 7px; box-shadow: 0 0 0 3px var(--panel); border-radius: 5px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); }
.gd-card.place-1 { border-color: #8a6d1f; background: linear-gradient(135deg, #2b2310, var(--panel-2) 60%); }
.gd-card.place-1 .gd-place { background: #d4a72c; border-color: #d4a72c; color: #1a1405; }
.gd-card.place-2 { border-color: #5d6670; background: linear-gradient(135deg, #22262b, var(--panel-2) 60%); }
.gd-card.place-2 .gd-place { background: #b8c2cc; border-color: #b8c2cc; color: #15181b; }
.gd-card.place-3 { border-color: #7a4a2a; background: linear-gradient(135deg, #2a1c13, var(--panel-2) 60%); }
.gd-card.place-3 .gd-place { background: #c4824f; border-color: #c4824f; color: #1c1009; }
.gd-pill { font-weight: 600; font-size: 10.5px; line-height: 1; padding: 4px 7px; border-radius: 999px; text-transform: capitalize;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted); }
.gd-pill.s-fulfilled, .gd-pill.s-settled { color: #6fdd8b; border-color: #1f6f34; background: #12321c; }
.gd-pill.s-pending { color: #e3b341; border-color: #6b5214; background: #2b2109; }

/* Proof: collapsed by default — it is for disputes, not for every draw. */
.gd-proof-slot:empty { display: none; }
.gd-proof { margin: 14px 22px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.gd-proof summary { cursor: pointer; padding: 10px 12px; font-size: 12.5px; font-weight: 600;
  display: flex; align-items: baseline; gap: 10px; list-style: none; }
.gd-proof summary::-webkit-details-marker { display: none; }
.gd-proof summary::before { content: '▸'; color: var(--dim); transition: transform .2s; }
.gd-proof[open] summary::before { transform: rotate(90deg); }
.gd-proof-hint { color: var(--dim); font-weight: 400; font-size: 11.5px; }
.gd-proof dl { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0;
  padding: 2px 12px 10px; font-size: 12.5px; }
.gd-proof dt { color: var(--dim); }
.gd-proof dd { margin: 0; min-width: 0; }
.gd-seed { display: flex; align-items: center; gap: 8px; }
.gd-seed code { font: 11.5px var(--mono); color: var(--text); overflow-wrap: anywhere; }
.gd-log { margin: 0 12px 12px; padding: 10px 12px; max-height: 150px; overflow: auto;
  font: 11.5px/1.5 var(--mono); color: var(--muted); white-space: pre-wrap;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }

.gd-foot { display: flex; align-items: center; gap: 12px; padding: 14px 22px; margin-top: 16px;
  border-top: 1px solid var(--line); background: #131518; }
.gd-target { font-size: 12px; color: var(--dim); }
.gd-target code { font: 11.5px var(--mono); color: var(--accent); }
.gd-actions { margin-left: auto; display: flex; gap: 8px; }
.gd-actions .btn { padding: 8px 16px; }

/* Spotlight reveal after each landing. */
.gd-reveal { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 8px; background: rgba(14,15,17,.82); z-index: 5; backdrop-filter: blur(2px);
  animation: gd-fade .35s ease-out; }
.gd-reveal .gd-avatar { animation: gd-pop .5s cubic-bezier(.2,1.5,.4,1); }
.gd-reveal-eyebrow { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.gd-reveal-name { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.gd-reveal-id { font: 12px var(--mono); color: var(--muted); }
@keyframes gd-fade { from { opacity: 0; } to { opacity: 1; } }

/* Confetti: positions and timings arrive as custom properties from JS. */
.gd-confetti { position: absolute; inset: 0; z-index: 6; pointer-events: none; overflow: hidden; }
.gd-confetti i { position: absolute; top: -12px; left: var(--x); width: 7px; height: 11px; border-radius: 2px;
  background: hsl(var(--hue) 85% 58%); opacity: 0;
  animation: gd-fall var(--dur) cubic-bezier(.2,.6,.4,1) var(--delay) forwards; }
@keyframes gd-fall {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  100% { opacity: 0; transform: translate(var(--drift), 320px) rotate(var(--spin)); } }

/* Participants list (reuses the draw modal shell). */
.gd-board.gd-pboard { display: flex; flex-direction: column; gap: 10px; max-height: 50vh; padding-top: 0; }
.gd-search { width: 100%; flex: none; }
.gd-plist { display: flex; flex-direction: column; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.gd-prow { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-top: 1px solid var(--line); }
.gd-prow:first-child { border-top: 0; }
.gd-prow.won { background: linear-gradient(90deg, #2b2310, transparent 70%); }
.gd-prow.is-flagged { background: linear-gradient(90deg, #2b2109, transparent 70%); }
.gd-pnum { width: 28px; flex: none; text-align: right; font: 11px var(--mono); color: var(--dim); }
.gd-ptext { flex: 1; min-width: 0; }
.gd-pname { font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.gd-pmeta { display: flex; gap: 12px; font: 11.5px var(--mono); color: var(--muted); margin-top: 1px; }
.gd-ptime { flex: none; font: 11px var(--mono); color: var(--dim); }
.gd-pwin { font: 800 10px/1 var(--mono); padding: 3px 6px; border-radius: 5px; background: #d4a72c; color: #1a1405; }
.gd-pstate { font: 700 10px/1 var(--mono); padding: 3px 6px; border-radius: 5px; color: var(--warn);
  border: 1px solid var(--warn); text-transform: capitalize; }
.gd-pempty { padding: 18px; text-align: center; }
@media (max-width: 640px) { .gd-ptime { display: none; } }


.gd-wheel-wrap { position: relative; width: 236px; height: 236px; }
.gd-wheel { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(var(--segments));
  box-shadow: 0 0 0 6px #23262b, 0 0 0 7px var(--line), 0 18px 40px rgba(0,0,0,.45);
  transform: rotate(0deg); }
.gd-wheel.spinning { transform: rotate(var(--turn)); transition: transform 4s cubic-bezier(.12,.8,.18,1); }
.gd-wheel-label { position: absolute; top: 50%; left: 50%; width: 80px; margin-top: -7px;
  transform-origin: 0 50%; transform: rotate(calc(var(--a) - 90deg)) translateX(32px);
  color: #fff; font-weight: 700; font-size: 10.5px; line-height: 14px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(0,0,0,.7); pointer-events: none; }
.gd-wheel-hub { position: absolute; top: 50%; left: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px;
  border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 11px; line-height: 1; letter-spacing: .05em;
  background: var(--panel); border: 2px solid var(--line); color: var(--accent); z-index: 1; }
.gd-wheel-pointer { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); z-index: 2;
  border-left: 11px solid transparent; border-right: 11px solid transparent; border-top: 20px solid var(--accent);
  filter: drop-shadow(0 0 6px rgba(255,71,15,.6)); }
.gd-wheel-wrap.landed .gd-wheel { box-shadow: 0 0 0 6px #23262b, 0 0 0 7px var(--accent), 0 0 46px rgba(255,71,15,.35); }

/* Tier 2 — the reel. Card width + gap must equal CARD in giveaway_draw.js. */
.gd-reel { position: absolute; inset: 0; }
.gd-reel::before, .gd-reel::after { content: ''; position: absolute; top: 0; bottom: 0; width: 22%; z-index: 2; pointer-events: none; }
.gd-reel::before { left: 0; background: linear-gradient(90deg, var(--panel-2), transparent); }
.gd-reel::after { right: 0; background: linear-gradient(270deg, var(--panel-2), transparent); }
.gd-reel-track { position: absolute; top: 50%; left: 0; display: flex; gap: 12px; margin-top: -55px;
  transform: translateX(0); will-change: transform; }
.gd-reel-track.spinning { transform: translateX(var(--x)); transition: transform 4s cubic-bezier(.08,.82,.17,1); }
.gd-reel-card { flex: 0 0 112px; height: 110px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 9px; padding: 0 8px; text-align: center; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); transition: transform .35s, border-color .35s, box-shadow .35s; }
.gd-reel-name { font-weight: 600; font-size: 12px; line-height: 1.25; max-width: 100%; overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.gd-reel-card.hit { transform: scale(1.1); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 34px rgba(255,71,15,.4); }
.gd-reel-pointer { position: absolute; top: 18px; bottom: 18px; left: 50%; width: 2px; margin-left: -1px; z-index: 3;
  background: var(--accent); box-shadow: 0 0 12px rgba(255,71,15,.8); border-radius: 2px; }
.gd-reel-pointer::before, .gd-reel-pointer::after { content: ''; position: absolute; left: 50%; transform: translateX(-50%);
  border-left: 8px solid transparent; border-right: 8px solid transparent; }
.gd-reel-pointer::before { top: -2px; border-top: 11px solid var(--accent); }
.gd-reel-pointer::after { bottom: -2px; border-bottom: 11px solid var(--accent); }

/* Tier 3 — the ticker. */
.gd-ticker-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.gd-ticker-count { color: var(--muted); font-size: 12px; letter-spacing: .02em; }
.gd-ticker { display: flex; align-items: center; gap: 14px; min-width: 300px; padding: 16px 22px;
  border-radius: 14px; background: var(--panel); border: 1px solid var(--line); transition: all .35s; }
.gd-ticker-name { font-weight: 800; font-size: 22px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.gd-ticker.landed { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 40px rgba(255,71,15,.35); transform: scale(1.04); }

@media (max-width: 640px) {
  .gd-stage { height: 250px; margin: 12px 14px 0; }
  .gd-head, .gd-foot { padding-left: 14px; padding-right: 14px; }
  .gd-board, .gd-proof, .gd-progress { margin-left: 14px; margin-right: 14px; }
  .gd-target { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .gd-wrap *, .gd-wrap *::before, .gd-wrap *::after { animation: none !important; transition: none !important; }
}

/* ── Economy charts ─────────────────────────────────────────────────────────
   Hand-rolled SVG rather than a charting library: the CSP is
   `default-src 'none'; script-src 'self'`, so a CDN script is blocked silently.
   See js/charts.js. */
.chart { width: 100%; height: auto; color: var(--muted); display: block;
  margin: 6px 0 2px; }
.chart-legend { display: flex; gap: 16px; color: var(--muted); font-size: 12px;
  margin-bottom: 4px; }
.chart-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px;
  margin-right: 6px; vertical-align: middle; }

/* One signed bar per reason, sharing a zero line down the middle — coin
   reaching players to the right, leaving them to the left. A pie cannot show
   that spin_debit removes coin while spin_prize adds it. */
.dbars { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 2px; }
.dbar { display: grid; grid-template-columns: 150px 1fr 110px; align-items: center;
  gap: 10px; }
.dbar-label { color: var(--muted); font: 12px var(--mono); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.dbar-track { position: relative; height: 16px; background: var(--panel-2);
  border-radius: 4px; overflow: hidden; }
/* The zero line is the message, so it is drawn even where a bar is absent. */
.dbar-track::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0;
  width: 1px; background: var(--line); }
.dbar-fill { position: absolute; top: 2px; bottom: 2px; border-radius: 3px; }
.dbar-value { font: 12px var(--mono); text-align: right; }
.dbar-value.pos { color: var(--ok); }
.dbar-value.neg { color: var(--warn); }

.sec { margin: 22px 0 2px; font-size: 14px; font-weight: 600; }
/* Modifiers only. `.row` is defined above (line ~78) and is used by every other
   screen — redefining the base here would silently drop its gap, wrap and
   margin across the whole dashboard. */
.row.between { justify-content: space-between; width: 100%; }

/* Shown when ledger_reconcile() reports a failure. The dashboard refuses to
   look healthy while the ledger disagrees with itself. */
.banner.warn { border: 1px solid var(--warn); background: rgba(210,153,34,.10);
  color: var(--text); border-radius: 10px; padding: 12px 14px; margin: 10px 0; }
.banner.warn ul { margin: 6px 0 0 18px; color: var(--muted); font-size: 12.5px; }
.banner.bad { border: 1px solid var(--bad); background: rgba(229,83,75,.10);
  border-radius: 10px; padding: 12px 14px; }
.banner.ok { border: 1px solid var(--ok); background: rgba(46,160,67,.10);
  border-radius: 10px; padding: 12px 14px; }
/* Review screen: findings are read as a list of evidence, not a grid. */
.finding-evidence { margin: 4px 0 0; font-size: 11px; color: var(--muted);
  white-space: pre-wrap; word-break: break-word; max-width: 420px; }
.review-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.review-head .stat { min-width: 140px; }
.who { display: inline-flex; flex-direction: column; line-height: 1.25; }
.who small { color: var(--dim); font-size: 11px; }

/* DIM feed: expandable mirror list under a match row */
.links { display: grid; gap: 4px; margin-top: 6px; }
.links code { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Production pass (2026-10-12) ────────────────────────────────────────────
   Page furniture, loading and empty states, busy buttons, forms, and the new
   screens (Predictions, top-up schedule, media library, economy insights). */

.icon { display: inline-block; vertical-align: middle; flex: none; }
.spacer { flex: 1; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.num.neg { color: var(--warn); }
.score { font: 600 13px var(--mono); letter-spacing: .02em; }

/* The prod environment carries a hairline of red along the top of every
   screen, so a screenshot or a glance says which database is on show. */
body.env-prod .topbar { box-shadow: inset 0 2px 0 var(--bad); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px;
  flex-wrap: wrap; margin: 2px 0 16px; }
.page-head h1 { font-size: 20px; margin: 0; letter-spacing: -.01em; }
.page-head .note { max-width: 760px; }
.page-head .card-actions { align-items: center; }
.group-title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim);
  margin: 18px 0 8px; font-weight: 700; }
.group-title:first-child { margin-top: 0; }

/* Busy: the button keeps its size, its label dims, a spinner sits on top. */
.btn.is-busy { position: relative; color: transparent !important; cursor: progress; opacity: 1; }
.btn.is-busy::after { content: ''; position: absolute; inset: 0; margin: auto; width: 13px; height: 13px;
  border-radius: 50%; border: 2px solid var(--muted); border-top-color: transparent;
  animation: spin .7s linear infinite; }
.btn.primary.is-busy::after, .btn.danger.is-busy::after { border-color: #fff; border-top-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Skeletons */
.skeleton { display: flex; flex-direction: column; gap: 9px; padding: 6px 0; }
.skeleton-row { height: 14px; border-radius: 6px;
  background: linear-gradient(90deg, var(--panel-2) 25%, #24282d 50%, var(--panel-2) 75%);
  background-size: 300% 100%; animation: shimmer 1.3s ease-in-out infinite; }
.skeleton-row:nth-child(3n) { width: 70%; }
.skeleton-row:nth-child(3n+2) { width: 88%; }
.skel-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.skel-tiles .skeleton-row { height: 84px; width: auto !important; border-radius: 12px; }
.skel-page .skeleton-row { height: 18px; }
.lib-skel { grid-column: 1 / -1; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.table-wrap.is-loading { opacity: .55; pointer-events: none; transition: opacity .15s; }

/* Empty states */
.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 30px 12px; color: var(--dim); }
.empty-title { color: var(--muted); font-weight: 600; font-size: 13.5px; }
.empty-detail { font-size: 12.5px; max-width: 420px; }
.empty .btn { margin-top: 6px; }

/* Table toolbar */
.table-tools { align-items: center; }
.search { position: relative; flex: 1; min-width: 200px; max-width: 420px; display: flex; align-items: center; }
.search .icon { position: absolute; left: 10px; color: var(--dim); pointer-events: none; }
.search .input { padding-left: 30px; }
.row.wrap { flex-wrap: wrap; }
.table.compact td, .table.compact th { padding-top: 5px; padding-bottom: 5px; }
.row-tools .btn + .btn { margin-left: 4px; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.linkish:hover .who > span:first-child, .linkish:hover > span { text-decoration: underline; text-decoration-color: var(--dim); }

/* Segmented tabs and chips */
.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 2px; gap: 2px; }
.seg-item { background: none; border: 0; color: var(--muted); font: inherit; font-size: 12.5px;
  padding: 5px 12px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.seg-item:hover { color: var(--text); }
.seg-item.active { background: var(--panel); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
div.seg { margin-bottom: 12px; }
.table-tools .seg { margin-bottom: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 2px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 999px; font-size: 12px; padding: 2px 4px 2px 10px; color: var(--text); }
.chip-body { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 1px 2px; }
.chip-x { background: none; border: 0; color: var(--dim); cursor: pointer; line-height: 0; padding: 3px; border-radius: 50%; }
.chip-x:hover { color: var(--text); background: var(--line); }
.chip.is-off { opacity: .55; text-decoration: line-through; text-decoration-color: var(--dim); }
.chip.is-live { border-color: #1f6f34; background: #12321c; color: #9be9a8; }

/* Forms */
.req { color: var(--accent); font-weight: 700; }
.form-legend { font-size: 11.5px; color: var(--dim); margin: 0 0 10px; }
.field.invalid .input { border-color: var(--bad); }
.field-error { display: block; margin-top: 4px; color: #ff8a80; font-size: 11.5px; }
.field-utc { display: block; margin-top: 4px; color: var(--muted); font: 11px var(--mono); }
.input[type=number] { font-variant-numeric: tabular-nums; }
.input[type=datetime-local], .input[type=date], .input[type=time] { color-scheme: dark; }
input[type=search]::-webkit-search-cancel-button { filter: invert(.6); }
select.input { cursor: pointer; }
.banner { border: 1px solid var(--line); background: var(--panel-2); border-radius: 10px;
  padding: 10px 14px; margin: 10px 0; font-size: 13px; color: var(--muted);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.banner.warn, .banner.bad, .banner.ok { display: block; }
.banner .table { margin-top: 8px; }

/* Top-up online card */
.status-badge { font: 800 12px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase;
  padding: 7px 12px; border-radius: 8px; }
.status-badge.ok { background: #12321c; color: #56d364; border: 1px solid #1f6f34; }
.status-badge.off { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.status-why { margin: -2px 0 14px; color: var(--text); font-size: 13.5px; }
.control-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-bottom: 16px; }
.control { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.control-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); font-weight: 700; margin-bottom: 7px; }
.sched-head { margin: 4px 0 8px; align-items: center; }
.sched-head h3 { margin: 0; font-size: 13.5px; }
.week { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.week-row { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 10px;
  padding: 8px 12px; border-top: 1px solid var(--line); min-height: 42px; }
.week-row:first-child { border-top: 0; }
.week-day { color: var(--muted); font-size: 13px; }

/* Media library */
.upload-box .note { margin: 0 0 10px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.lib-item { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 6px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer; color: inherit; font: inherit; text-align: left; }
.lib-item:hover { border-color: var(--muted); }
.lib-item img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 6px; background: #0b0c0e; }
.lib-meta { font: 10.5px var(--mono); color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-dup { position: absolute; top: 10px; left: 10px; }

/* Economy: distribution bars */
.hbars { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 6px; }
.hbar { display: grid; grid-template-columns: 90px 1fr 210px; gap: 10px; align-items: center; }
.hbar-label { font: 12px var(--mono); color: var(--muted); }
.hbar-track { height: 14px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: #60a5fa; border-radius: 4px; min-width: 2px; }
.hbar-value { font: 12px var(--mono); color: var(--muted); text-align: right; }
h4 { font-size: 13px; margin: 6px 0 6px; }

/* Phones: tables become stacked cards rather than a sideways scroll. */
@media (max-width: 720px) {
  .view { padding: 12px; }
  .topbar { flex-wrap: wrap; gap: 8px 12px; }
  .envbar code { display: none; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; }
  .table td { border: 0; padding: 3px 0; max-width: none; display: flex; gap: 10px; justify-content: space-between; }
  .table td[data-label]::before { content: attr(data-label); color: var(--dim); font-size: 11px; flex: none; }
  .table td.row-tools { justify-content: flex-end; padding-top: 6px; flex-wrap: wrap; }
  .table-wrap { margin: 0; padding: 0; }
  .hbar { grid-template-columns: 70px 1fr; }
  .hbar-value { grid-column: 1 / -1; text-align: left; }
  .week-row { grid-template-columns: 1fr; gap: 4px; }
  .page-head h1 { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton-row, .btn.is-busy::after { animation: none; }
}
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--accent); color: #fff;
  padding: 6px 12px; border-radius: 6px; }
.skip:focus { left: 8px; }
.view:focus { outline: none; }

/* Clickable cells: Chrome centres a button's content, so lay it out explicitly. */
.linkish { display: flex; justify-content: flex-start; width: 100%; }
.linkish .who { align-items: flex-start; text-align: left; }
/* The header's signed-in name sits beside Sign out, not above it — `.who` is
   also the two-line player cell, which is where the column layout belongs. */
.topbar .who { display: flex; flex-direction: row; align-items: center; gap: 12px; line-height: 1.5; }
.table th.num { text-align: right; }
@media (max-width: 720px) {
  .stat-grid, .skel-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 11px 12px; }
  .stat-value { font-size: 21px; }
  .page-head { align-items: flex-start; }
}

/* Navigation is made of links (so it opens in a new tab); they must look
   exactly like the buttons they replaced. */
a.nav-item, a.btn, a.stat, a.linkish { text-decoration: none; color: inherit; }
a.nav-item { color: var(--muted); }
a.nav-item:hover, a.nav-item.active { color: var(--text); }
a.btn { display: inline-flex; align-items: center; justify-content: center; }
a.btn.primary { color: #fff; }
a.btn.ghost { color: var(--muted); }
a.stat { display: block; }
.field-utc.bad { color: #ff8a80; }

/* ── Security screens (security.js) ──────────────────────────────────────── */
.pill.role-owner { background: rgba(255,71,15,.14); color: #ff8a5c; border: 1px solid rgba(255,71,15,.4); }
.pill.role-operator { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.pill.role-viewer { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.pill.role-automation { background: var(--panel-2); color: var(--dim); border: 1px dashed var(--line); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.setup-key { font: 15px var(--mono); letter-spacing: .06em; padding: 3px 8px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; user-select: all; }
.recovery-codes { font: 14px/1.8 var(--mono); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 14px; columns: 2; user-select: all; }
.small { font-size: 11.5px; }
tr.is-muted td { opacity: .55; }
.clip { display: inline-block; max-width: 360px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; vertical-align: bottom; }
.date-tools { gap: 6px; align-items: center; }
#step-code[hidden], #step-password[hidden] { display: none; }
#back-btn { margin-top: 6px; }

/* ── Analytics (analytics.js, charts.js) ─────────────────────────────────── */
.analytics-controls { gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.analytics-controls .seg { margin-bottom: 0; }
.viz-wrap { position: relative; }
.viz-wrap svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.viz-tip { position: absolute; top: 6px; z-index: 5; pointer-events: none; min-width: 140px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.35); font-size: 12px; }
.viz-tip-title { color: var(--muted); margin-bottom: 4px; }
.viz-tip-row { display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.viz-tip-row strong { color: var(--text); font-variant-numeric: tabular-nums; }
.viz-tip-row span { color: var(--muted); }
.viz-key, .chart-legend i.line-key { display: inline-block; width: 12px; height: 2px; border-radius: 1px; }
.viz-table { margin-top: 6px; font-size: 12px; color: var(--muted); }
.viz-table summary { cursor: pointer; width: max-content; }
.viz-table .table-wrap { max-height: 280px; overflow: auto; margin-top: 6px; }
.stat .spark { display: block; width: 96px; height: 26px; margin-top: 6px; }
.stat .info { color: var(--dim); font-size: 11px; }
.stat[title] { cursor: help; }
.meter { height: 6px; border-radius: 3px; background: rgba(57,135,229,.18); margin-top: 8px; overflow: hidden; }
.meter-fill { display: block; height: 100%; background: #3987e5; border-radius: 3px; }
.funnel .hbar { grid-template-columns: 150px 1fr 230px; }
.cohort td.cohort-cell { font-variant-numeric: tabular-nums; }
.caveats { color: var(--muted); font-size: 12.5px; margin: 6px 2px 18px; }
.caveats summary { cursor: pointer; width: max-content; }
.caveats ul { margin: 6px 0 0 18px; display: grid; gap: 4px; }
.card h4 { margin: 12px 0 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.page-head { margin-bottom: 10px; }
.input.num-input { width: 90px; flex: none; }
form.card { display: block; }

/* ── Phones and the installed app (2026-11-01) ───────────────────────────────
   Installed to a home screen the page runs edge to edge (viewport-fit=cover),
   so the notch and home indicator are kept clear with safe-area insets — they
   are 0 in a normal browser tab and on desktop, so nothing moves there. */
.menu-btn { display: none; padding: 6px 8px; line-height: 0; }
.nav-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 30; }
.nav-scrim[hidden] { display: none; }
.topbar { padding-top: max(9px, env(safe-area-inset-top));
  padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.toasts { bottom: max(16px, env(safe-area-inset-bottom)); }
.login-wrap { padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); }

/* Touch screens: iOS zooms the page into any field under 16px when it is
   tapped, and small buttons are hard to hit with a thumb. */
@media (pointer: coarse) {
  .input, .input.sm, .input.mono, select.input, textarea.input { font-size: 16px; }
  .btn { min-height: 36px; }
  .btn.sm { min-height: 32px; }
}

@media (max-width: 720px) {
  .menu-btn { display: inline-flex; margin-left: -6px; }
  .topbar { position: sticky; top: 0; z-index: 20; padding-bottom: 8px; }
  .body { display: block; height: auto; }
  /* The screen list becomes a drawer from the left. */
  .nav { position: fixed; top: 0; bottom: 0; left: 0; z-index: 35; display: block; width: min(290px, 84vw);
    border-right: 1px solid var(--line); border-bottom: 0; overflow-y: auto; overscroll-behavior: contain;
    padding: max(12px, env(safe-area-inset-top)) 8px max(12px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    transform: translateX(-105%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; }
  body.nav-open .nav { transform: none; visibility: visible; transition: transform .2s ease; }
  body.nav-open { overflow: hidden; }
  .nav-group { display: block; }
  .nav-item { width: 100%; padding: 11px 12px; white-space: normal; }
  .view { overflow: visible; padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right)); padding-bottom: max(16px, env(safe-area-inset-bottom)); }

  /* Dialogs sit at the bottom like a sheet, full width, buttons thumb-sized. */
  .modal-wrap { align-items: end; padding: 10px 8px max(10px, env(safe-area-inset-bottom)); overflow-y: auto; }
  .modal { padding: 16px; }
  .modal-body { max-height: 60dvh; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1 1 auto; }

  .toasts { left: 10px; right: 10px; }
  .toast { max-width: none; }
  .card { padding: 12px; }
  .card-head { flex-wrap: wrap; }
  .card-actions { flex-wrap: wrap; }
  .search { min-width: 0; max-width: none; flex-basis: 100%; }
  .row .input { min-width: 0; }
  .funnel .hbar { grid-template-columns: 1fr; }
  .clip, .links code { max-width: 62vw; }
  .recovery-codes { columns: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .nav { transition: none !important; }
}
