/* =========================================================================
   ODDSLENS Design System
   ---------------------------------------------------------------------
   Two-layer token architecture:
     1. Primitives  — raw color ramps. Never referenced by components.
     2. Semantics   — role-based tokens. All components reference these.

   Rule: zero `!important` in this file except the one documented
   accessibility escape hatch below. If a future change needs to override
   something, change the semantic token's value here — never add a second
   :root block or a *third* over the top of that. (The old app had three,
   stacked with !important, and it's why this file exists.)
   ========================================================================= */

:root {
  /* ---- Primitives ---------------------------------------------------- */
  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  --blue-50:  #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;

  --green-50:  #ecfdf5;
  --green-100: #a7f3d0;
  --green-600: #059669;
  --green-700: #047857;

  --red-50:  #fef2f2;
  --red-100: #fecaca;
  --red-600: #dc2626;
  --red-700: #b91c1c;

  --amber-50:  #fffbeb;
  --amber-100: #fde68a;
  --amber-600: #d97706;
  --amber-700: #b45309;

  /* ---- Semantic tokens ------------------------------------------------ */
  --color-bg: var(--slate-50);
  --color-surface: #ffffff;
  --color-surface-muted: var(--slate-100);
  --color-border: var(--slate-200);
  --color-border-strong: var(--slate-300);
  --color-text: var(--slate-900);
  --color-text-muted: var(--slate-500);
  --color-text-subtle: var(--slate-400);

  --color-accent: var(--blue-600);
  --color-accent-hover: var(--blue-700);
  --color-accent-active: var(--blue-800);
  --color-accent-soft-bg: var(--blue-50);
  --color-accent-soft-border: var(--blue-200);
  --color-accent-text: var(--blue-700);

  --color-success: var(--green-600);
  --color-success-hover: var(--green-700);
  --color-success-soft-bg: var(--green-50);
  --color-success-soft-border: var(--green-100);

  --color-danger: var(--red-600);
  --color-danger-hover: var(--red-700);
  --color-danger-soft-bg: var(--red-50);
  --color-danger-soft-border: var(--red-100);

  --color-warning: var(--amber-600);
  --color-warning-hover: var(--amber-700);
  --color-warning-soft-bg: var(--amber-50);
  --color-warning-soft-border: var(--amber-100);

  --color-focus-ring: rgba(37, 99, 235, .35);
  --color-disabled-bg: var(--slate-100);
  --color-disabled-text: var(--slate-400);
  --color-disabled-border: var(--slate-200);

  --color-overlay: rgba(15, 23, 42, .44);

  /* ---- Spacing (4px base) --------------------------------------------- */
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* ---- Radius ----------------------------------------------------------*/
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 999px;

  /* ---- Elevation (soft, no hard drop-shadows) -------------------------- */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, .06);
  --shadow-lg: 0 20px 45px rgba(15, 23, 42, .10);
  --shadow-focus: 0 0 0 4px var(--color-focus-ring);

  /* ---- Typography -------------------------------------------------------*/
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --text-xs: .6875rem;
  --text-sm: .8125rem;
  --text-base: .9375rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.25rem;

  --transition-fast: 120ms ease;
  --transition-base: 180ms ease;
}

/* ===========================================================================
   Base / reset
   =========================================================================== */

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

html { -webkit-text-size-adjust: 100%; }

/* Global safety net against stray horizontal scroll on mobile -- any
   single element that's even a few px wider than the viewport (a badge,
   a long unbreakable string, a decorative element that isn't fully
   clipped by its own ancestor) makes the ENTIRE page scroll sideways,
   since the browser has no per-element opt-out once *something*
   overflows the document. Real, reported bug: the pricing page still
   had extra blank space to the right on mobile even after fixing the
   one known contributor (.lp-pricing's mobile grid-track sizing) --
   this catches that contributor and any other one, present or future,
   without needing to hunt down every possible source individually.
   overflow-x: hidden implicitly makes overflow-y: auto (CSS disallows
   mixing hidden/visible across axes) -- harmless here since body is
   already the page's natural vertical scroll container. */
html, body { overflow-x: hidden; }

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

h1, h2, h3, h4, p, figure { margin: 0; }

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

ul, ol { margin: 0; padding: 0; list-style: none; }

::selection { background: var(--color-accent-soft-border); }

.u-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.u-tabular {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

/* ===========================================================================
   App shell + brand bar
   =========================================================================== */

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

.app-content {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-16);
}

.brand-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}

.brand-bar-inner {
  position: relative;
  max-width: 1240px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.brand-identity { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }

.brand-logo { height: 30px; width: auto; }

.brand-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }

/* white-space:nowrap + align-self:flex-start stop this from ever being
   squeezed narrower than its own text by the flex row it sits in --
   brand-copy/brand-identity both use min-width:0 so *they* can shrink,
   but on the gradient-clipped dark-theme variant (landing.css) the
   gradient background paints only within this element's own box, so a
   squeezed box makes the overflowing letters invisible (background-clip:
   text with no fill behind them) rather than merely wrapping. */
.brand-name { font-size: var(--text-md); font-weight: 800; letter-spacing: -.01em; color: var(--color-text); white-space: nowrap; align-self: flex-start; }

.brand-tagline {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--color-text-subtle);
}

.brand-bar-link { color: inherit; font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; opacity: .85; }
.brand-bar-link:hover, .brand-bar-link.is-active { opacity: 1; text-decoration: underline; }
@media (max-width: 520px) { .brand-bar:has(.brand-bar-link) .brand-copy { display: none; } }
.brand-bar-end { margin-left: auto; display: flex; align-items: center; gap: var(--space-3); }

/* ===========================================================================
   App nav -- single hamburger menu, used identically on every surface
   (public/Users, Admin, Bettor) for BOTH mobile and desktop. Replaces the
   old split design (a row of bare icon buttons on dashboards + a separate
   text-link nav that only collapsed into its own hamburger under 720px on
   the public site) with one consistent pattern: a toggle button that
   always opens the same kind of panel, icon+label per row. Each page
   supplies its own rows via the nav_menu_items block in base.html --
   this file only owns the toggle/panel/item chrome, not the row list. ---
   =========================================================================== */

/* Deliberately NOT position:relative -- .app-nav-panel's left/right
   offsets (mobile) need to resolve against .brand-bar-inner's full
   width (which already has its own position:relative, below), not
   against this wrapper's own width. This wrapper is only as wide as
   the toggle button itself (flex:none), so if IT were the positioned
   ancestor, .app-nav-panel's "left: 16px; right: 16px" would be
   computed relative to that ~38px box instead of the header -- the
   panel would collapse to a sliver a few pixels wide instead of
   spanning the screen -- exactly what a user reported on their actual
   phone ("very tiny container, could not see any icon or label").
   Fix verified at real mobile widths (375px/390px) via a same-origin
   iframe test harness, since this environment's own window-resize
   tooling doesn't actually change the rendered viewport. */
.app-nav { flex: none; }

.app-nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--lp-border-strong, var(--color-border-strong));
  border-radius: var(--radius-md);
  background: var(--lp-card-bg, var(--color-surface));
  color: var(--lp-text, var(--color-text));
  flex: none;
  cursor: pointer;
  position: relative;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.app-nav-toggle:hover { background: var(--lp-card-bg-strong, var(--color-surface-muted)); border-color: var(--lp-cyan, var(--color-accent)); }

.app-nav-toggle span {
  display: block;
  width: 17px;
  height: 2px;
  border-radius: var(--radius-full);
  background: currentColor;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

/* Toggle morphs into an "X" while the panel is open -- a small nicety
   that makes the open/close state unambiguous at a glance. */
.app-nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.app-nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.app-nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Summary dot shown on the collapsed toggle when at least one row inside
   has an unread badge (see common.js's syncNavToggleBadge) -- so
   something needing attention (e.g. automation alerts) is never hidden
   just because the menu happens to be closed. */
.app-nav-toggle-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--lp-magenta, #f472b6);
  border: 2px solid var(--lp-card-bg, var(--color-surface));
  display: none;
}

.app-nav-toggle-dot.is-visible { display: block; }

/* :not([hidden]), not the bare class -- see the long-standing note this
   replaces: [hidden] and a class selector have EQUAL specificity, and
   this stylesheet loads after the UA stylesheet's own low-priority
   "[hidden] { display: none }", so a bare ".app-nav-panel { display:
   flex }" would win the cascade and show the panel at all times
   regardless of what the toggle script sets. */
.app-nav-panel:not([hidden]) {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: var(--space-4);
  left: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-2);
  max-height: min(70vh, 560px);
  overflow-y: auto;
  overscroll-behavior: contain;
  /* --lp-* fallbacks (same pattern as .app-nav-toggle above) -- without
     these, this panel renders as a stark white card on the dark admin/
     bettor dashboards, which only ever redefine --lp-* tokens, never
     the plain --color-* ones these rules would otherwise fall back to
     (same bug .brand-mobile-menu used to need a separate .brand-bar-dark
     override block for -- this avoids needing one at all). */
  background: var(--lp-bg-raised, var(--color-surface));
  border: 1px solid var(--lp-border-strong, var(--color-border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 50;
}

.app-nav-section + .app-nav-section { margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--lp-border, var(--color-border)); }

.app-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 650;
  font-family: inherit;
  color: var(--lp-text, var(--color-text));
  text-decoration: none;
  text-align: left;
  width: 100%;
  background: transparent;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.app-nav-item:hover { background: var(--lp-card-bg-strong, var(--color-surface-muted)); }

.app-nav-item.is-active { background: var(--lp-card-bg-strong, var(--color-accent-soft-bg)); color: var(--lp-cyan, var(--color-accent-text)); }

.app-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: var(--radius-md);
  background: var(--lp-card-bg, var(--color-surface-muted));
  color: var(--lp-text-muted, var(--color-text-muted));
}

.app-nav-item:hover .app-nav-icon,
.app-nav-item.is-active .app-nav-icon { color: var(--lp-cyan, var(--color-accent-text)); }

.app-nav-icon svg { width: 18px; height: 18px; }

.app-nav-label { flex: 1 1 auto; min-width: 0; }

.app-nav-item .bell-badge { position: static; margin-left: auto; }

/* Dropdown on desktop (anchored, bounded width) -- the default rule
   above already gives a reasonable full-bar-width panel that works fine
   at any size, this just makes it feel like an intentional menu rather
   than a stretched banner once there's room for one. */
@media (min-width: 721px) {
  .app-nav-panel:not([hidden]) { left: auto; width: 320px; }
}

/* ===========================================================================
   Status dot / live indicator
   =========================================================================== */

.status-dot {
  --dot-color: var(--slate-400);
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--dot-color);
  flex: none;
  transition: background var(--transition-base), box-shadow var(--transition-base);
}

.status-dot.is-live {
  --dot-color: var(--color-success);
  box-shadow: 0 0 0 4px var(--color-success-soft-bg);
}

.status-dot.is-error {
  --dot-color: var(--color-danger);
  box-shadow: 0 0 0 4px var(--color-danger-soft-bg);
}

.status-dot.is-warning {
  --dot-color: var(--color-warning);
  box-shadow: 0 0 0 4px var(--color-warning-soft-bg);
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 36px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  box-shadow: var(--shadow-xs);
  font-size: var(--text-sm);
  font-weight: 650;
  color: var(--color-text-muted);
  flex: none;
}

/* ===========================================================================
   Layout helpers
   =========================================================================== */

.section-space { margin-top: var(--space-8); }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--color-accent-text);
}

.page-title { font-size: var(--text-2xl); font-weight: 800; letter-spacing: -.02em; color: var(--color-text); }

.page-subtitle { margin-top: var(--space-1); font-size: var(--text-sm); color: var(--color-text-muted); }

.grid { display: grid; gap: var(--space-5); }

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1050px) {
  .grid-2 { grid-template-columns: 1fr; }
  /* Stat-tile grids only (grid-3/grid-4 is never used for wide,
     complex cards -- always short uniform tiles), so 2-up still reads
     fine well before the point a 1-column full collapse is needed. */
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .app-content { padding: var(--space-6) var(--space-4) var(--space-12); }
  .brand-bar-inner { padding: var(--space-3) var(--space-4); flex-wrap: wrap; row-gap: var(--space-2); }
  /* Tagline + status label text are the two biggest, safest-to-drop
     space hogs in the header row -- without this, squeezing the brand
     name (see .brand-name above) forced the tagline to wrap into 3-4
     cramped lines that visually collided with the status indicator. */
  .brand-tagline { display: none; }
  .status-indicator span:not(.status-dot) { display: none; }
}

/* ===========================================================================
   Card
   =========================================================================== */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
}

.card-interactive { transition: box-shadow var(--transition-base), border-color var(--transition-base), transform var(--transition-base); }

.card-interactive:hover {
  border-color: var(--color-accent-soft-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

@media (max-width: 640px) {
  .card-header { flex-wrap: wrap; }
}

.card-title { font-size: var(--text-lg); font-weight: 750; color: var(--color-text); letter-spacing: -.01em; }

.card-description { margin-top: var(--space-1); font-size: var(--text-sm); color: var(--color-text-muted); }

.card-body-flush { margin: calc(var(--space-6) * -1); margin-top: 0; }

/* ---- Stat tile -------------------------------------------------------- */

.stat-tile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.stat-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--color-text-subtle);
}

.stat-value { font-size: var(--text-3xl); font-weight: 850; color: var(--color-text); line-height: 1.1; }

.stat-delta { font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted); }

.stat-delta.is-positive { color: var(--color-success); }

.stat-delta.is-negative { color: var(--color-danger); }

/* ===========================================================================
   Badge / pill
   =========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-neutral { background: var(--color-surface-muted); border-color: var(--color-border); color: var(--color-text-muted); }

.badge-accent { background: var(--color-accent-soft-bg); border-color: var(--color-accent-soft-border); color: var(--color-accent-text); }

.badge-success { background: var(--color-success-soft-bg); border-color: var(--color-success-soft-border); color: var(--color-success-hover); }

.badge-danger { background: var(--color-danger-soft-bg); border-color: var(--color-danger-soft-border); color: var(--color-danger-hover); }

.badge-warning { background: var(--color-warning-soft-bg); border-color: var(--color-warning-soft-border); color: var(--color-warning-hover); }

/* Every other badge is short, fixed vocabulary (LIVE/a country name/a
   sport name), where nowrap is correct. The "Pair: X + Y" badge is the
   one exception -- its text is an admin-named bookmaker pair (can
   include a " - Basketball" sport suffix for region-grouped pairs),
   genuinely unbounded in length. Without this, that text ignored its
   own card's width entirely and rendered outside the card on a narrow
   phone screen instead of wrapping. */
.badge-wrap { white-space: normal; text-align: center; }

/* ===========================================================================
   Table
   =========================================================================== */

.table-wrap { overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius-lg); }

table.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--text-sm); }

.data-table thead th {
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-text-subtle);
  background: var(--color-surface-muted);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.data-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover { background: var(--color-accent-soft-bg); }

.data-table .num { text-align: right; }

/* ===========================================================================
   Forms
   =========================================================================== */

.field { display: grid; gap: var(--space-2); }

.field-full { grid-column: 1 / -1; }

.field-label { font-size: var(--text-sm); font-weight: 650; color: var(--color-text); }

.field-help { font-size: var(--text-xs); color: var(--color-text-muted); }

.field-error { font-size: var(--text-xs); color: var(--color-danger); font-weight: 600; }

.input, .select, textarea.input {
  height: 40px;
  width: 100%;
  padding: 0 var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  color: var(--color-text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

textarea.input { height: auto; padding: var(--space-3); min-height: 88px; resize: vertical; }

.input::placeholder { color: var(--color-text-subtle); }

.input:hover, .select:hover { border-color: var(--color-text-subtle); }

.input:focus-visible, .select:focus-visible, textarea.input:focus-visible {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: var(--shadow-focus);
}

.input:disabled, .select:disabled {
  background: var(--color-disabled-bg);
  color: var(--color-disabled-text);
  border-color: var(--color-disabled-border);
  cursor: not-allowed;
}

.input.has-error, .select.has-error { border-color: var(--color-danger); }

.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2364748b' stroke-width='1.5' fill='none' fill-rule='evenodd' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right var(--space-3) center; padding-right: var(--space-8); }

.checkbox-row { display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-6); }

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.checkbox input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--color-accent);
}

/* ---- Toggle switch (instant-action binary state, no Save step) ------- */

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.switch-track {
  flex: none;
  width: 40px;
  height: 22px;
  border-radius: var(--radius-full);
  background: var(--color-border-strong);
  transition: background var(--transition-base);
  position: relative;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base);
}

.switch input:checked + .switch-track { background: var(--color-success); }

.switch input:checked + .switch-track::after { transform: translateX(18px); }

.switch input:focus-visible + .switch-track { box-shadow: var(--shadow-focus); }

.switch input:disabled + .switch-track { opacity: .5; cursor: not-allowed; }

.switch-label { font-size: var(--text-sm); font-weight: 650; color: var(--color-text); }

.switch-caption { font-size: var(--text-xs); color: var(--color-text-muted); }

/* ===========================================================================
   Buttons
   =========================================================================== */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 40px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: var(--text-sm);
  font-weight: 650;
  white-space: nowrap;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.button:active { transform: translateY(1px); }

.button:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.button-sm { height: 32px; padding: 0 var(--space-4); font-size: var(--text-xs); }

.button-lg { height: 48px; padding: 0 var(--space-6); font-size: var(--text-md); }

.button-primary { background: var(--color-accent); color: #fff; box-shadow: var(--shadow-xs); }

.button-primary:hover:not(:disabled) { background: var(--color-accent-hover); }

.button-secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border-strong); }

.button-secondary:hover:not(:disabled) { background: var(--color-surface-muted); }

.button-ghost { background: transparent; color: var(--color-text-muted); }

.button-ghost:hover:not(:disabled) { background: var(--color-surface-muted); color: var(--color-text); }

.button-danger { background: var(--color-danger); color: #fff; }

.button-danger:hover:not(:disabled) { background: var(--color-danger-hover); }

.button-block { width: 100%; }

.button-group { display: flex; gap: var(--space-3); flex-wrap: wrap; }

/* ===========================================================================
   Modal
   =========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: 100;
}

.modal-overlay.is-open { display: flex; }

.modal-panel {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-height: 88vh;
  /* dvh tracks the browser's actual visible area (shrinks with an open
     on-screen keyboard or a shown address bar); plain vh is keyed to the
     larger static/layout viewport instead. When vh overstates the real
     height, this flex child (centered by .modal-overlay below) ends up
     taller than its container and overflows equally top+bottom with no
     scroll affordance on the overlay -- pushing .modal-header off the
     top of the screen, unreachable. Redeclaring with dvh after the vh
     fallback lets browsers that support it correct the value; others
     silently keep the vh line above. */
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

/* A modal-header's second child is sometimes a cluster of controls
   (Refresh/Regions/+Add Scraper/a mode <select>, always ending in the
   close button) rather than just the lone close button -- on a title
   long enough to compete with that cluster for space (neither side has
   a flex-wrap), the row simply doesn't fit on a narrow phone. Giving it
   this class lets .modal-header's own mobile flex-wrap (below) drop it
   to its own full-width row instead of clipping. */
.modal-header-actions { display: flex; align-items: center; gap: var(--space-3); flex-shrink: 0; }

@media (max-width: 640px) {
  /* flex-start + generous top padding instead of centering: a
     vertically-centered modal re-centers against whatever height the
     browser currently reports, which on mobile moves around (keyboard
     open/closed, address bar shown/hidden) -- anchoring to the top
     keeps .modal-header in a stable, always-reachable position instead
     of chasing a moving centerpoint. */
  .modal-overlay { align-items: flex-start; padding: var(--space-8) var(--space-4); }
  .modal-header { flex-wrap: wrap; padding: var(--space-4); }
  .modal-header-actions { width: 100%; flex-wrap: wrap; justify-content: flex-end; }
  .modal-body { padding: var(--space-4); }
  .modal-footer { padding: var(--space-4); flex-wrap: wrap; }
}

/* flex: 1 1 auto -- without this, a flex item's default flex-basis (auto)
   lets it grow to its content's full natural height instead of being
   constrained to the space .modal-panel actually has, so overflow-y:auto
   below never gets a chance to engage and .modal-panel's own
   overflow:hidden clips content instead of scrolling to it. */
.settings-form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden; }

.modal-body { padding: var(--space-6); overflow-y: auto; flex: 1 1 auto; min-height: 0; }

.modal-footer {
  padding: var(--space-5) var(--space-6);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  flex: none;
}

.modal-close:hover { background: var(--color-surface-muted); color: var(--color-text); }

/* ===========================================================================
   Alert banner
   =========================================================================== */

.alert {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  border: 1px solid;
  font-size: var(--text-sm);
}

/* Same gotcha already worked around for .app-nav-panel above (see
   its own comment): a class selector's own `display` declaration beats
   the browser's low-priority `[hidden] { display: none }` UA style, so
   an .alert given the `hidden` attribute (e.g. a toggled consent panel)
   renders visible anyway unless this is stated explicitly. */
.alert[hidden] { display: none; }

.alert-title { font-weight: 700; margin-bottom: 2px; }

.alert-danger { background: var(--color-danger-soft-bg); border-color: var(--color-danger-soft-border); color: var(--color-danger-hover); }

.alert-success { background: var(--color-success-soft-bg); border-color: var(--color-success-soft-border); color: var(--color-success-hover); }

.alert-warning { background: var(--color-warning-soft-bg); border-color: var(--color-warning-soft-border); color: var(--color-warning-hover); }

.alert-accent { background: var(--color-accent-soft-bg); border-color: var(--color-accent-soft-border); color: var(--color-accent-text); }

/* ===========================================================================
   Pop-up alerts (pushToast in opportunity-cards.js), redesigned 2026-11-29:
   a card with a coloured edge, icon, bold title, wrapping text, optional
   "What to do" line and a close button that is always in the top-right
   corner -- long match ids / error codes used to widen the old one past
   the screen, pushing its close button out of sight.
   =========================================================================== */

.ol-toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
  width: min(400px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 2px;
}
.ol-toast-stack:empty { display: none; }

.ol-toast-clear {
  align-self: flex-end;
  background: var(--color-surface);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.ol-toast-clear:hover { color: var(--color-text); border-color: var(--color-border-strong); }

.ol-toast {
  --toast-tone: var(--color-accent);
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px 40px 12px 12px;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--toast-tone);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  line-height: 1.45;
  flex-shrink: 0;
  animation: ol-toast-in 0.18s ease-out;
}
.ol-toast-danger { --toast-tone: var(--color-danger); }
.ol-toast-warning { --toast-tone: var(--color-warning); }
.ol-toast-success { --toast-tone: var(--color-success); }
.ol-toast-accent { --toast-tone: var(--color-accent); }

.ol-toast-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  background: var(--toast-tone);
}
.ol-toast-body { min-width: 0; }
.ol-toast-title { font-weight: 700; font-size: 13.5px; margin: 0 0 2px; }
.ol-toast-text,
.ol-toast-action {
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.ol-toast-text { color: var(--color-text-muted); }
.ol-toast-title + .ol-toast-text { margin-top: 1px; }
.ol-toast:not(:has(.ol-toast-title)) .ol-toast-text { color: var(--color-text); }
.ol-toast-action {
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-muted);
  color: var(--color-text);
  font-weight: 600;
}
.ol-toast-action::before { content: "What to do: "; color: var(--toast-tone); }

.ol-toast-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.ol-toast-close:hover,
.ol-toast-close:focus-visible { background: var(--color-surface-muted); color: var(--color-text); }

@keyframes ol-toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ol-toast { animation: none; }
}
@media (max-width: 480px) {
  .ol-toast-stack { right: 8px; left: 8px; bottom: 8px; width: auto; }
}

/* Dark dashboards (.dashboard-page: bettor, admin) -- the pop-ups sit
   outside that wrapper, and its see-through surfaces would show the page
   through them, so they get their own SOLID dark palette. */
.ol-dark {
  --color-surface: #141733;
  --color-surface-muted: #1d2145;
  --color-border: rgba(255, 255, 255, .14);
  --color-border-strong: rgba(255, 255, 255, .24);
  --color-text: #f5f5ff;
  --color-text-muted: #b4b4d6;
  --color-accent: #22d3ee;
  --color-success: #a3e635;
  --color-danger: #f472b6;
  --color-danger-soft-bg: rgba(244, 114, 182, .14);
  --color-warning: #fbbf24;
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, .45);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, .55);
  color-scheme: dark;
}
.ol-dark .ol-toast-icon { color: #05060f; }

/* ===========================================================================
   Bet now: split-view modal (shared by the admin dashboard and the
   public index page's live board)
   =========================================================================== */

.bet-now-sections {
  display: grid;
  /* min(280px, 100%) -- same narrow-viewport overflow fix as
     .live-opportunity-grid in main.css. */
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: var(--space-4);
}

.bet-now-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  background: var(--color-surface-muted);
}

.bet-now-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.bet-now-target {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-accent-soft-bg);
  border: 1px solid var(--color-accent-soft-border);
}

.bet-now-target-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-1) 0;
}

.bet-now-target-row + .bet-now-target-row {
  border-top: 1px solid var(--color-accent-soft-border);
}

.bet-now-target-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.bet-now-target-value {
  font-size: var(--text-md);
  font-weight: 800;
  color: var(--color-accent-text);
  text-align: right;
}

.bet-now-target-tip {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-accent-soft-border);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ===========================================================================
   Filter chip / tab
   =========================================================================== */

.chip-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: 32px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.chip:hover { background: var(--color-surface-muted); }

.chip.is-selected { background: var(--color-accent-soft-bg); border-color: var(--color-accent-soft-border); color: var(--color-accent-text); }

/* ===========================================================================
   Empty state
   =========================================================================== */

.empty {
  padding: var(--space-8) var(--space-5);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
  text-align: center;
}

.empty-title { margin: 0 0 var(--space-1); font-weight: 700; color: var(--color-text); }

.empty-text { margin: 0; font-size: var(--text-sm); color: var(--color-text-muted); }

/* ===========================================================================
   Misc utilities
   =========================================================================== */

.text-muted { color: var(--color-text-muted); }

.text-subtle { color: var(--color-text-subtle); }

.text-success { color: var(--color-success); }

.text-danger { color: var(--color-danger); }

.text-sm { font-size: var(--text-sm); }

.text-xs { font-size: var(--text-xs); }

.divider { height: 1px; background: var(--color-border); border: none; margin: var(--space-5) 0; }

.stack { display: flex; flex-direction: column; gap: var(--space-4); }

/* Opportunity-card badge column (status/sport/region/pair/unverified,
   see opportunity-cards.js) -- min-width:0 is required for a flex
   item's children to ever shrink/wrap below their own content size at
   all (the flex default is min-width:auto, which otherwise lets a long
   badge force this column wider than the card has room for, regardless
   of max-width). Capped at half the card on desktop, where it sits
   side-by-side with the team-info column in an unwrapped .row-between;
   once that row wraps to stacked (<=640px, see .row-between's own
   mobile rule), this column becomes its own full-width block below the
   team info, so the cap relaxes to the full card width there too. */
.opportunity-card-badges { min-width: 0; max-width: 50%; }

@media (max-width: 640px) {
  .opportunity-card-badges { max-width: 100%; }
}

.row { display: flex; align-items: center; gap: var(--space-3); }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }

.scroll-x { overflow-x: auto; }

/* .row/.row-between are the most-reused layout primitive across every
   dashboard (label+value, title+button, stat+badge...) and neither
   wraps by default -- fine on desktop, but on a narrow phone two
   same-row items that don't both fit (e.g. a long alert title next to
   an "Auto-Fill" button, or a settings label next to its input+Save
   button) were being silently clipped rather than wrapped, since
   html/body sets overflow-x:hidden globally (see its own comment) to
   stop the page itself from gaining a horizontal scrollbar. Wrapping
   only changes anything once content genuinely doesn't fit -- a row
   that already fits on one line renders identically. */
@media (max-width: 640px) {
  .row, .row-between { flex-wrap: wrap; }
}
