/* ==========================================================================
   Wills Massive Pickem — Commissioner Mode (admin.css)
   Deliberately MODERN. The public site is proudly stuck in 2012; the back
   office is a clean, current control panel. The contrast is the joke.
   Self-contained, no webfonts (system stack), light + dark aware.

   Layout: an app shell — bottom tab-bar on phones (Android-first: Will admins
   from his phone), left rail on desktop. One panel visible at a time; a
   "This Week" dashboard surfaces the only two chores that ever really matter.
   ========================================================================== */

:root {
  --bg:        #f4f6fb;
  --card:      #ffffff;
  --ink:       #16202e;
  --ink-soft:  #5b6675;
  --muted:     #8a94a3;
  --border:    #e6e9f0;
  --border-strong: #d5dae3;
  --accent:    #5b5bd6;
  --accent-ink:#ffffff;
  --accent-hover: #4a4ac2;
  --accent-weak:  #eeeefb;
  --good:      #0f9d6b;
  --good-weak: #e3f6ee;
  --warn:      #c07d12;
  --warn-weak: #fbf0da;
  --danger:    #d64545;
  --danger-weak:#fbe7e7;
  --switch-off:#cbd2dd;
  --shadow:    0 1px 2px rgba(16,24,40,.04), 0 4px 16px rgba(16,24,40,.06);
  --shadow-lg: 0 -2px 24px rgba(16,24,40,.12);
  --radius:    14px;
  --radius-sm: 9px;
  --topbar-h:  56px;
  --nav-h:     62px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0e1015;
    --card:      #171b23;
    --ink:       #e7ebf2;
    --ink-soft:  #aab3c1;
    --muted:     #79828f;
    --border:    #262c37;
    --border-strong: #333b48;
    --accent:    #7c7cf0;
    --accent-ink:#0e1015;
    --accent-hover: #9090f5;
    --accent-weak:  #20233a;
    --good:      #35c88f;
    --good-weak: #16281f;
    --warn:      #e0a53c;
    --warn-weak: #2a2213;
    --danger:    #f0787a;
    --danger-weak:#2a1717;
    --switch-off:#3a424f;
    --shadow:    0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
    --shadow-lg: 0 -2px 28px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--card) 82%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.bolt {
  font-size: 18px;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 55%, transparent));
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; white-space: nowrap; }
.brand-sub {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-sub:empty { display: none; }

.who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); min-width: 0; }
.who-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 3px var(--good-weak);
  flex: 0 0 auto;
}
.who-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 44vw; }

/* ---------------------------------------------------------------- status line (toast) */

#status-line:empty { display: none; }
#status-line {
  position: fixed;
  top: calc(var(--topbar-h) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  width: min(560px, calc(100vw - 24px));
  border-radius: var(--radius-sm);
  padding: 11px 15px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
}
#status-line.status-error { background: var(--danger-weak); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent); }
#status-line.status-info  { background: var(--accent-weak); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); }

/* ---------------------------------------------------------------- cards / shared */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
}

/* ---------------------------------------------------------------- sign-in */

.signin-card { max-width: 440px; margin: 40px auto 0; }
.signin-title { margin: 0 0 4px; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.signin-sub { margin: 0 0 20px; color: var(--ink-soft); font-size: 14px; }
.signin-card label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.auth-message { margin: 12px 0 0; font-size: 13.5px; color: var(--accent); min-height: 1em; }

/* ---------------------------------------------------------------- gate */

.gate-card { display: flex; align-items: center; gap: 16px; max-width: 520px; margin: 40px auto 0; }
.gate-icon { font-size: 26px; }
.gate-title { margin: 0; font-size: 17px; font-weight: 700; }
.gate-sub { margin: 3px 0 0; color: var(--ink-soft); font-size: 14px; }

/* ---------------------------------------------------------------- inputs */

input[type="email"], input[type="text"], input[type="number"], .select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}
input[type="number"] { width: 96px; }
.select { width: auto; min-width: 74px; cursor: pointer; }

/* ---------------------------------------------------------------- buttons */

.btn {
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .12s, transform .04s, box-shadow .12s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  width: 100%;
  margin-top: 16px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 12px 16px;
  font-size: 15px;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-lock {
  background: var(--good);
  color: #fff;
  box-shadow: 0 1px 2px rgba(15,157,107,.35);
}
.btn-lock:hover:not(:disabled) { background: color-mix(in srgb, var(--good) 88%, #000); }

.btn-ai {
  background: var(--accent-weak); color: var(--accent); font-weight: 700;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn-ai:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 16%, var(--card)); }

.btn-ghost {
  background: var(--card); color: var(--ink-soft);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 6%, var(--card)); color: var(--ink); }

/* ============================================================ APP SHELL */

.panels {
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px);
}

/* one panel at a time */
.panel { display: none; }
.panel.is-active { display: block; animation: panel-in .18s ease; }
@keyframes panel-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .panel.is-active { animation: none; } }

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin: 4px 2px 18px;
}
.panel-title { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.panel-sub { margin: 4px 0 0; color: var(--ink-soft); font-size: 13.5px; max-width: 60ch; }

/* -------------------------------------------------- main nav (bottom bar) */

.mainnav {
  position: fixed;
  z-index: 30;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.navbtn {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  padding: 8px 2px 6px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .01em;
  transition: color .12s;
  -webkit-tap-highlight-color: transparent;
}
.navbtn svg { width: 24px; height: 24px; flex: 0 0 auto; }
.navbtn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.navbtn:hover { color: var(--ink-soft); }
.navbtn.is-active { color: var(--accent); }
.navbtn.is-active svg { filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 45%, transparent)); }
.navbtn:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent-weak); border-radius: 10px; }
.navbtn-label { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; }
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 800; line-height: 1;
}
.nav-badge[hidden] { display: none; }
/* League, Weird Stats + Bots live in the More sheet on phones; the desktop rail shows them. */
.navbtn[data-nav="league"],
.navbtn[data-nav="weird"],
.navbtn[data-nav="bots"],
.navbtn[data-nav="twist"],
.navbtn[data-nav="standings"],
.navbtn[data-nav="preview"] { display: none; }

/* -------------------------------------------------- This Week dashboard */

.home-actions { display: flex; flex-direction: column; gap: 12px; margin-bottom: 22px; }
.home-actions:empty { display: none; }

.action {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 16px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  transition: transform .04s, box-shadow .12s, border-color .12s;
}
.action:active { transform: translateY(1px); }
.action:hover { border-color: var(--border-strong); }
.action.is-static { cursor: default; }
.action.is-static:active { transform: none; }
.action-ic {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 11px;
  font-size: 20px;
}
.action-ic.ic-do   { background: var(--warn-weak);   color: var(--warn); }
.action-ic.ic-money{ background: var(--accent-weak); color: var(--accent); }
.action-ic.ic-ok   { background: var(--good-weak);   color: var(--good); }
.action-ic.ic-wait { background: var(--border);      color: var(--muted); }
.action-body { min-width: 0; flex: 1 1 auto; }
.action-title { display: block; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.action-sub { display: block; color: var(--ink-soft); font-size: 13px; margin-top: 1px; }
.action-chev { flex: 0 0 auto; color: var(--muted); font-size: 20px; }

.home-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hstat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 14px;
  box-shadow: var(--shadow);
}
.hstat-num { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hstat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 2px; }
.hstat-pill { display: inline-block; margin-top: 2px; }

/* -------------------------------------------------- week picker / lock bar */

.week-picker { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.week-picker label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }

.lock-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--warn-weak);
  border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 18px;
}
.lock-note { margin: 0; font-size: 12.5px; color: var(--warn); font-weight: 500; }

/* ---------------------------------------------------------------- setting row */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  margin-bottom: 18px;
  background: color-mix(in srgb, var(--accent) 4%, var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.setting-text { min-width: 0; }
.setting-label { font-weight: 700; font-size: 14px; }
.setting-desc { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; max-width: 62ch; }
.setting-row .select { flex: 0 0 auto; }
@media (max-width: 640px) {
  .setting-row { flex-direction: column; align-items: stretch; }
  .setting-row .select { width: 100%; }
}

/* ---------------------------------------------------------------- tables */

.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.col-toggle { width: 58px; }

/* slot tag */
.tv-slot-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--ink-soft);
  background: var(--accent-weak);
  border-radius: 6px;
  padding: 3px 7px;
}

/* status pills */
.pill {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .03em;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
}
.pill-locked { background: var(--good-weak); color: var(--good); }
.pill-draft  { background: var(--warn-weak); color: var(--warn); }
.pill-none   { background: var(--border); color: var(--muted); }

/* toggle switches — admin.js renders bare checkboxes; upgraded in CSS only */
.panels input[type="checkbox"],
.sheet input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 46px; height: 27px;
  border-radius: 999px;
  background: var(--switch-off);
  position: relative;
  cursor: pointer;
  transition: background .16s;
  vertical-align: middle;
  flex: 0 0 auto;
}
.panels input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 23px; height: 23px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.35);
  transition: left .16s;
}
.panels input[type="checkbox"]:checked { background: var(--accent); }
.panels input[type="checkbox"]:checked::after { left: 21px; }
.panels input[type="checkbox"]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-weak); }

/* saved flash */
.saved-flash {
  margin-left: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--good);
}

.muted-text { color: var(--ink-soft); font-size: 13px; }
.line-status-cell { white-space: nowrap; }

/* ---------------------------------------------------------------- ledger summary */

.ledger-summary:empty { display: none; }
.ledger-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 26px;
  padding: 16px 18px;
  margin-bottom: 18px;
  background: color-mix(in srgb, var(--accent) 5%, var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-num { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pot-bar-wrap { flex: 1 1 180px; min-width: 160px; }
.pot-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.pot-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--good)));
  transition: width .3s ease;
}
.pot-bar-caption { margin-top: 6px; font-size: 12px; color: var(--ink-soft); }

/* ============================================================ Bounties panel */

.subhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 4px 2px; }
.subhead-standalone { margin-top: 26px; }
.subhead-title { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.subhead-count { font-size: 12.5px; font-weight: 700; color: var(--danger); }
.subhead-note { margin: 2px 2px 12px; font-size: 12.5px; color: var(--ink-soft); max-width: 62ch; }

/* review queue — engine-flagged candidates awaiting a human yes/no */
.bounty-review { margin-bottom: 26px; }
.review-list { display: flex; flex-direction: column; gap: 12px; }
.review-item {
  border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--border));
  background: color-mix(in srgb, var(--warn) 6%, var(--card));
  border-radius: var(--radius);
  padding: 15px 16px;
  box-shadow: var(--shadow);
}
.review-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.review-who { font-weight: 700; font-size: 15px; }
.review-bounty { color: var(--ink-soft); font-size: 13px; margin-top: 1px; }
.review-prize { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--good); }
.review-evidence {
  margin: 11px 0 13px;
  padding: 9px 11px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--ink-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-x: auto;
}
.review-actions { display: flex; gap: 10px; }
.btn-confirm { background: var(--good); color: #fff; flex: 1 1 auto; }
.btn-confirm:hover:not(:disabled) { background: color-mix(in srgb, var(--good) 88%, #000); }
.btn-reject {
  background: var(--card); color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border));
}
.btn-reject:hover:not(:disabled) { background: var(--danger-weak); }

/* create form */
.bounty-card { margin-bottom: 8px; }
/* start-aligned: fields carry hint text under the control, so bottom-aligning
   the row would push the inputs out of line with each other. */
.bounty-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.field textarea {
  font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 9px 11px; resize: vertical;
}
.field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.field input[type="number"] { width: 100%; }
.field .select { width: 100%; }
.field-actions { grid-column: 1 / -1; }
.bounty-create-btn { width: auto; margin-top: 0; }
.bounty-form-note { grid-column: 1 / -1; margin: 0; font-size: 12px; color: var(--muted); }
.field-hint { margin: 0; font-size: 11.5px; font-weight: 500; color: var(--muted); text-transform: none; letter-spacing: 0; }

/* Will admins from a phone: every control in this form is a thumb target. */
.bounty-form input[type="text"],
.bounty-form input[type="number"],
.bounty-form .select,
.bounty-form .btn { min-height: 44px; }

/* rule picker — live knobs, the sentence players will read, calibration */
.rule-detail { gap: 10px; }
.rule-blurb { margin: 0; font-size: 13.5px; color: var(--ink); }
.rule-scope { margin: 0; font-size: 12px; color: var(--muted); }
.rule-knobs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 2px;
}
.knob { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.knob-label {
  font-size: 12px; font-weight: 600; color: var(--ink-soft);
  text-transform: none; letter-spacing: 0;
}
.knob-input { width: 100%; min-height: 44px; }
.rule-howto {
  margin: 2px 0 0;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--accent-weak);
  color: var(--accent);
  font-size: 13.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.rule-howto strong { font-weight: 700; }
.rule-howto-none { background: var(--bg); color: var(--ink-soft); }

.calibrate-row { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.calibrate-btn { min-height: 44px; }
.calibrate-out {
  width: 100%;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 12px 14px;
}
.calibrate-season {
  margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted);
}
.calibrate-verdict { margin: 4px 0 0; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.calibrate-samples { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.calibrate-sample { font-size: 12.5px; color: var(--ink-soft); overflow-wrap: anywhere; }
.calibrate-more { margin: 8px 0 0; font-size: 12px; color: var(--muted); }

/* status toggle inside the editor */
.active-row { display: flex; align-items: center; gap: 10px; }
.active-label { font-size: 13px; color: var(--ink-soft); }

/* AI bot config fields */
.field label .muted-text { text-transform: none; letter-spacing: 0; font-weight: 500; }
#bot-ai-fields { gap: 4px; }
.bot-sources { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 4px 0 2px; }
#bot-ai-fields .src-check {
  display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500;
  text-transform: none; letter-spacing: 0; color: var(--ink); cursor: pointer;
}
#bot-ai-fields .src-check input { margin: 0; flex: 0 0 auto; }
.bot-ai-row { display: flex; gap: 14px; margin-top: 12px; }
.bot-ai-row > div { display: flex; flex-direction: column; gap: 6px; min-width: 190px; }
.bot-ai-persona-label { margin-top: 12px; }
#bot-ai-fields .textarea {
  font: inherit; color: var(--ink); background: var(--card); width: 100%;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 9px 11px; resize: vertical; margin-top: 6px;
}
#bot-ai-fields .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.bot-ai-hint { margin-top: 8px; color: var(--muted); font-weight: 500; }

/* active bounties list */
.bounty-list { display: flex; flex-direction: column; gap: 10px; }
.bounty-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
}
.bounty-item.is-archived { opacity: .55; }
.bounty-main { flex: 1 1 auto; min-width: 0; }
.bounty-name { font-weight: 700; font-size: 15px; }
.bounty-meta { font-size: 12.5px; color: var(--ink-soft); margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.bounty-badge { display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 2px 7px; border-radius: 999px; }
.badge-mode { background: var(--accent-weak); color: var(--accent); }
.badge-auto { background: var(--good-weak); color: var(--good); }
.badge-manual { background: var(--border); color: var(--muted); }
.bounty-prize-tag { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bounty-winners { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.bounty-side { flex: 0 0 auto; display: flex; align-items: center; gap: 14px; }
.bounty-archive-wrap { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bounty-archive-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.btn-edit { min-height: 44px; padding: 10px 18px; }

/* inline editor — same field set as "New bounty", pre-filled */
.bounty-edit-card {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.bounty-edit-title { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.edit-note { margin: 0; font-size: 12.5px; color: var(--ink-soft); }
.edit-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.edit-actions .btn { min-height: 44px; }
.edit-actions .btn-primary { width: auto; margin-top: 0; flex: 1 1 auto; }
.btn-danger {
  background: var(--card); color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border));
  margin-left: auto;
}
.btn-danger:hover:not(:disabled) { background: var(--danger-weak); }
.edit-warning {
  margin: 0; padding: 11px 13px; border-radius: var(--radius-sm);
  background: var(--danger-weak); color: var(--danger);
  font-size: 13px; line-height: 1.45;
}
.edit-warning[hidden] { display: none; }

/* ============================================================ Weird Stats panel */

.findings-filter { display: flex; align-items: baseline; gap: 14px; margin: 0 2px 14px; }
.finding-count { font-size: 15px; font-weight: 700; color: var(--warn); }
.finding-count-sub { font-size: 13px; color: var(--ink-soft); }

.findings-list { display: flex; flex-direction: column; gap: 12px; }

.finding-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px 16px;
}
.finding-card.is-live { border-color: color-mix(in srgb, var(--good) 40%, var(--border)); }
.finding-card.is-shortlisted { border-color: var(--border-strong); }
.finding-card.is-broken { border-left: 3px solid var(--warn); }

/* Engine health strip — two plain facts and a button, not a dev console. */
.engine-strip {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 2px 14px; padding: 10px 13px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
}
.engine-line { font-size: 13px; color: var(--ink-soft); flex: 1 1 auto; min-width: 0; }
.engine-line.is-stale { color: var(--warn); font-weight: 600; }
.engine-run { font-size: 12.5px; padding: 6px 12px; margin-bottom: 0; flex: 0 0 auto; }

.findings-zone-title { font-size: 16px; font-weight: 700; margin: 4px 2px 2px; letter-spacing: -0.01em; }
.findings-zone-sub { font-size: 13px; color: var(--muted); margin: 0 2px 13px; line-height: 1.45; }

.findings-rest { margin-top: 20px; }
.findings-toggle {
  width: 100%; text-align: left; font-size: 13.5px; font-weight: 600;
  background: var(--card); color: var(--ink-soft); border: 1px solid var(--border);
  margin-bottom: 12px;
}
.findings-toggle::before { content: "\25B8"; display: inline-block; margin-right: 8px; transition: transform .15s; }
.findings-toggle[aria-expanded="true"]::before { transform: rotate(90deg); }

.finding-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.finding-tier {
  display: inline-block; font-size: 10.5px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .04em; padding: 3px 9px; border-radius: 999px;
}
.tier-certified_weird { background: var(--warn-weak); color: var(--warn); }
.tier-significant { background: var(--accent-weak); color: var(--accent); }
.tier-fun_fact { background: var(--bg); color: var(--ink-soft); border: 1px solid var(--border); }

/* What KIND of stat this is — the engine writes eleven flavours now, so the
   card has to say whether this is a streak, the herd, a team or a habit. */
.finding-kind {
  display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; padding: 3px 9px; border-radius: 999px;
  background: var(--bg); color: var(--muted); border: 1px solid var(--border);
}

/* How the fact MOVED since the engine last saw it. A broken streak is the best
   headline the system produces, so it gets the loudest chip on the card. */
.finding-delta {
  display: inline-block; font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; padding: 3px 8px; border-radius: 999px;
}
.delta-broken { background: var(--warn); color: #fff; }
.delta-new { background: var(--accent); color: #fff; }
.delta-strengthened { background: var(--good-weak, var(--accent-weak)); color: var(--good); }
.delta-weakened { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.finding-live { font-size: 11.5px; font-weight: 700; color: var(--good); display: inline-flex; align-items: center; gap: 5px; }
.finding-live::before { content: "\25CF"; font-size: 9px; }

.finding-headline { font-size: 15.5px; font-weight: 600; line-height: 1.35; letter-spacing: -0.01em; }
.finding-meta { margin-top: 6px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.finding-actions { display: flex; gap: 8px; margin-top: 13px; flex-wrap: wrap; align-items: center; }
.fbtn { font-size: 13px; padding: 7px 13px; margin-bottom: 0; }
.fbtn-pub { background: var(--good); color: #fff; }
.fbtn-pub:hover:not(:disabled) { background: color-mix(in srgb, var(--good) 88%, #000); }
.fbtn-unpub { background: var(--card); color: var(--ink-soft); border: 1px solid var(--border-strong); }
.fbtn-unpub:hover:not(:disabled) { background: var(--bg); }
.fbtn-copy { background: var(--accent-weak); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.fbtn-copy:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 14%, var(--card)); }
.fbtn-dismiss { background: var(--card); color: var(--muted); border: 1px solid var(--border); margin-left: auto; }
.fbtn-dismiss:hover:not(:disabled) { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); }

/* ============================================================ Weekly Recap composer */

.recap-blocks { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.recap-block-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px;
}
.recap-block-card.is-off { opacity: .5; }
.recap-block-head { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.recap-block-heading { font-weight: 700; font-size: 15px; }
.recap-prose {
  width: 100%; margin-top: 10px; font: inherit; color: var(--ink);
  background: var(--card); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 9px 11px; resize: vertical;
}
.recap-prose:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.recap-alts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.recap-alts-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.recap-alt-btn {
  font: inherit; font-size: 12.5px; padding: 4px 9px; margin: 0;
  background: var(--accent-weak); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: 999px; cursor: pointer;
}
.recap-alt-btn:hover { background: color-mix(in srgb, var(--accent) 14%, var(--card)); }
.recap-block-hint { margin-top: 8px; font-size: 12px; }
.recap-actions { display: flex; align-items: center; gap: 10px; margin: 6px 0 8px; flex-wrap: wrap; }
.recap-actions .bounty-create-btn { width: auto; margin: 0; }
.recap-voice-hint { margin: 0 0 14px; font-size: 12.5px; line-height: 1.45; }
.recap-send-row { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; flex-wrap: wrap; }
.recap-send-hint { flex: 1 1 220px; font-size: 12px; line-height: 1.45; }
.preview-tabs { display: inline-flex; gap: 4px; }
.preview-tab {
  font: inherit; font-size: 13px; font-weight: 600; padding: 6px 12px;
  border: 1px solid var(--border); background: var(--card); color: var(--ink-soft);
  border-radius: var(--radius-sm); cursor: pointer; margin: 0;
}
.preview-tab.is-active { background: var(--accent-weak); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.recap-preview-frame {
  width: 100%; height: 520px; border: 1px solid var(--border);
  border-radius: var(--radius); background: #ffffff;
}

/* ============================================================ More sheet */

.sheet-scrim {
  position: fixed; inset: 0; z-index: 45;
  background: rgba(8,11,18,.42);
  backdrop-filter: blur(1px);
  animation: fade-in .16s ease;
}
.sheet {
  position: fixed; z-index: 46;
  left: 0; right: 0; bottom: 0;
  background: var(--card);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
  animation: sheet-up .22s cubic-bezier(.22,.61,.36,1);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .sheet, .sheet-scrim { animation: none; } }

.sheet-grip { width: 38px; height: 4px; border-radius: 999px; background: var(--border-strong); margin: 6px auto 4px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sheet-title { font-weight: 700; font-size: 15px; }
.sheet-close { background: none; border: none; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.sheet-close:hover { color: var(--ink); background: var(--bg); }
.sheet-body { display: flex; flex-direction: column; gap: 4px; padding-bottom: 8px; }
.sheet-signed { margin: 2px 0 10px; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-link {
  display: flex; flex-direction: column; align-items: flex-start;
  width: 100%; text-align: left;
  padding: 14px 4px; border: none; border-top: 1px solid var(--border);
  background: none; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer;
}
.sheet-link:hover { text-decoration: none; color: var(--accent); }
.sheet-link-sub { font-size: 12px; font-weight: 500; color: var(--muted); font-style: italic; }
.sheet-link-btn { color: var(--danger); }
.sheet-link-btn:hover { color: var(--danger); }
.sheet-soon { margin: 14px 0 0; font-size: 12.5px; color: var(--muted); border-top: 1px dashed var(--border); padding-top: 14px; }

/* ============================================================ MOBILE table reflow
   On phones the wide chore tables become stacked cards — thumb-friendly rows
   with the header inline as a label. admin.js sets td[data-label] for each cell. */
@media (max-width: 640px) {
  .panel-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .week-picker { justify-content: flex-start; }
  /* email + sign-out live in the More sheet on phones; keep the topbar for the
     brand and leave just a "signed in" dot so "Commissioner Mode" never clips. */
  .who-email { display: none; }

  .bounty-form { grid-template-columns: 1fr; }
  .bounty-item { flex-wrap: wrap; }
  .bounty-item .bounty-main { flex: 1 1 140px; }
  /* toggle on the left, Edit on the right, both full thumb width */
  .bounty-side { width: 100%; justify-content: space-between; }
  .bounty-edit-card { padding: 14px; }
  .edit-actions .btn-primary { flex: 1 1 100%; }
  .btn-danger { margin-left: auto; }

  .reflow thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .reflow, .reflow tbody, .reflow tr, .reflow td { display: block; width: 100%; }
  .reflow tr {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    padding: 4px 14px;
    background: var(--card);
  }
  .reflow tr:hover { background: var(--card); }
  .reflow td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
  }
  .reflow tr td:last-child { border-bottom: none; }
  .reflow td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
  }
  .reflow td.cell-empty { display: none; }
  .reflow input[type="number"], .reflow input[type="text"], .reflow select { max-width: 60%; }
  .reflow input[type="text"] { width: 60%; }
}

/* ============================================================ DESKTOP: left rail */
@media (min-width: 860px) {
  #admin-shell {
    display: grid;
    grid-template-columns: 216px minmax(0, 1fr);
    gap: 26px;
    max-width: 1120px;
    margin: 0 auto;
    padding: 26px 24px 40px;
  }
  .mainnav {
    position: sticky;
    top: calc(var(--topbar-h) + 26px);
    height: auto;
    flex-direction: column;
    gap: 4px;
    padding: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-top: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    align-self: start;
  }
  .navbtn {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 11px 13px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
  }
  .navbtn svg { width: 20px; height: 20px; }
  .navbtn.is-active { color: var(--accent); background: var(--accent-weak); }
  .navbtn.is-active svg { filter: none; }
  /* "More" is only useful as a mobile sheet; the desktop rail shows these directly */
  .navbtn[data-nav="more"] { display: none; }
  .navbtn[data-nav="league"],
  .navbtn[data-nav="weird"],
  .navbtn[data-nav="bots"],
  .navbtn[data-nav="twist"],
  .navbtn[data-nav="standings"],
  .navbtn[data-nav="preview"] { display: flex; }
  .panels { max-width: none; margin: 0; padding: 0; }
  .panel-title { font-size: 22px; }
}

/* ============================================================ Twist / Standings / Preview / How-to-win */

/* Attribute of the Week (twist) */
.twist-card { margin-top: 14px; }
.twist-current {
  font-weight: 700; font-size: 15px; margin: 2px 0 10px; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.twist-current.twist-none { color: var(--muted); font-weight: 500; }
.twist-search {
  font: inherit; width: 100%; color: var(--ink); background: var(--card);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 12px;
}
.twist-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.twist-results {
  margin-top: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); max-height: 320px; overflow-y: auto; box-shadow: var(--shadow);
}
.twist-result {
  display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left;
  padding: 9px 12px; background: none; border: none; border-bottom: 1px solid var(--border);
  cursor: pointer; font: inherit;
}
.twist-result:last-child { border-bottom: none; }
.twist-result:hover { background: color-mix(in srgb, var(--accent) 7%, var(--card)); }
.twist-result-name { font-weight: 600; font-size: 14px; color: var(--ink); }
.twist-result-def { font-size: 12px; color: var(--muted); }
.twist-result-empty { padding: 10px 12px; color: var(--muted); font-size: 13px; }
.twist-hint { margin-top: 10px; }

/* Standings */
.std-rank { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-soft); width: 42px; }
.col-rank { width: 42px; }
.std-badge {
  display: inline-block; margin-left: 8px; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .03em; padding: 2px 7px; border-radius: 999px;
}
.std-bot { background: var(--accent-weak); color: var(--accent); }
.std-paid { background: var(--good-weak); color: var(--good); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Site Preview */
.preview-site-frame {
  width: 100%; height: 640px; border: 1px solid var(--border);
  border-radius: var(--radius); background: #fff;
}
.preview-recap-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }

/* Bounty "How to win" (admin list) */
.bounty-desc-line { font-size: 13px; color: var(--ink-soft); margin-top: 3px; }
.bounty-howto-line { font-size: 12.5px; color: var(--accent); margin-top: 3px; }
.bounty-howto-line strong { font-weight: 700; }
