/* ═══════════════════════════════════════════════════════════════════════════
   DSS Sports - Design System v2
   Direction: minimal, flat. Hand-tuned, deliberate, no boilerplate.
   Layers: page → glass chrome → data (tabular, colored).

   Component DNA (adapted lightweight, dependency-free):
   · TiltCard / MagneticButton / CountUp / TextType  - reactbits
   · NumberTicker / scroll reveal                    - reactbits
   Motion: expressive cubic-bezier(0.22,1,0.36,1), 240-600ms, always GPU-safe
   (transform/opacity only). Fully gated behind prefers-reduced-motion.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── TYPE & TOKENS ────────────────────────────────────────────────────────── */
:root {
  /* Font stack: Space Grotesk for display/data, system for body. */
  --font-display: "Space Grotesk", "Inter", -apple-system, "Segoe UI", sans-serif;
  --font-body: -apple-system, "SF Pro Text", "Inter", "Segoe UI", sans-serif;

  /* House identities (muted earthy data colors - used as accents, avatar fills, chart bars) */
  --c-karnali:  #A16207;   /* ochre  */
  --c-koshi:    #5E7891;   /* steel  */
  --c-mahakali: #A5534B;   /* clay   */
  --c-mechi:    #7B843F;   /* olive  */

  /* Brand accent (monochrome - near-black on light, near-white on dark) */
  --brand:       #111113;
  --brand-soft:  rgba(17, 17, 19, 0.10);
  --brand-ring:  rgba(17, 17, 19, 0.35);
  --brand-shadow: rgba(17, 17, 19, 0.22);

  /* Motion */
  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in:     cubic-bezier(0.55, 0, 0.85, 0.36);
  --dur-fast:    160ms;
  --dur-base:    240ms;
  --dur-slow:    600ms;

  /* Radii */
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 9px;
  --r-pill: 999px;

  /* Light */
  --page:        #F7F7F8;
  --page-2:      #EFEFF1;
  --card:        rgba(255, 255, 255, 0.82);
  --card-solid:  #FFFFFF;
  --well:        rgba(20, 20, 24, 0.05);
  --well-2:      rgba(20, 20, 24, 0.08);
  --border:      rgba(20, 20, 24, 0.10);
  --border-2:    rgba(20, 20, 24, 0.16);
  --text:        #16161A;
  --muted:       #5B5B66;
  --text-tertiary: #8F8F99;
  --overlay:     rgba(20, 20, 24, 0.55);

  --nav-bg:      rgba(247, 247, 248, 0.72);

  --ok-bg:       #ECECEF;   --ok-text: #3F3F46;   --ok-border: #D8D8DE;
  --pend-bg:     #EDEDF0;   --pend-text: #5B5B66; --pend-border: #DADAE0;

  --shadow-s: 0 1px 2px rgba(18, 26, 34, 0.05), 0 2px 8px rgba(18, 26, 34, 0.04);
  --shadow-m: 0 8px 24px rgba(18, 26, 34, 0.09), 0 2px 6px rgba(18, 26, 34, 0.05);
  --shadow-l: 0 24px 64px rgba(18, 26, 34, 0.16);

  /* ── Legacy aliases (templates + app.js inline styles) ─────────────────── */
  --font: var(--font-body);
  --fw-regular: 400; --fw-medium: 590; --fw-bold: 700;
  --text-primary: var(--text);
  --text-secondary: var(--muted);
  --bg-base: var(--page);
  --bg-surface: var(--card-solid);
  --bg-surface-2: var(--well);
  --bg-surface-3: var(--well-2);
  --border-subtle: var(--border);
  --chrome-bg: var(--card-solid);
  --chrome-text: var(--text);
  --status-ok-bg: var(--ok-bg);
  --status-ok-text: var(--ok-text);
  --status-ok-border: var(--ok-border);
  --status-pending-bg: var(--pend-bg);
  --status-pending-text: var(--pend-text);
  --status-pending-border: var(--pend-border);
}

[data-theme="dark"] {
  --page:        #09090B;
  --page-2:      #101013;
  --card:        rgba(18, 18, 20, 0.62);
  --card-solid:  #121214;
  --well:        rgba(255, 255, 255, 0.05);
  --well-2:      rgba(255, 255, 255, 0.08);
  --border:      rgba(255, 255, 255, 0.10);
  --border-2:    rgba(255, 255, 255, 0.17);
  --text:        #F4F4F5;
  --muted:       #A1A1AA;
  --text-tertiary: #71717A;
  --overlay:     rgba(3, 3, 5, 0.66);

  --nav-bg:      rgba(9, 9, 11, 0.62);

  --ok-bg:       #161618;   --ok-text: #B4B4BD;   --ok-border: #2A2A30;
  --pend-bg:     #161618;   --pend-text: #A1A1AA; --pend-border: #2A2A30;

  /* Brand accent on dark: near-white so text accents clear 4.5:1 */
  --brand:       #F4F4F5;
  --brand-soft:  rgba(255, 255, 255, 0.10);
  --brand-ring:  rgba(255, 255, 255, 0.45);
  --brand-shadow: rgba(0, 0, 0, 0.40);

  --shadow-s: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.22);
  --shadow-m: 0 10px 28px rgba(0, 0, 0, 0.38), 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-l: 0 28px 72px rgba(0, 0, 0, 0.5);

  /* ── Legacy aliases (templates + app.js inline styles) ─────────────────── */
  --font: var(--font-body);
  --fw-regular: 400; --fw-medium: 590; --fw-bold: 700;
  --text-primary: var(--text);
  --text-secondary: var(--muted);
  --bg-base: var(--page);
  --bg-surface: var(--card-solid);
  --bg-surface-2: var(--well);
  --bg-surface-3: var(--well-2);
  --border-subtle: var(--border);
  --chrome-bg: var(--card-solid);
  --chrome-text: var(--text);
  --status-ok-bg: var(--ok-bg);
  --status-ok-text: var(--ok-text);
  --status-ok-border: var(--ok-border);
  --status-pending-bg: var(--pend-bg);
  --status-pending-text: var(--pend-text);
  --status-pending-border: var(--pend-border);
}

/* ── RESET ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

html, body {
  background-color: var(--page);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 450;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  position: relative;
  overflow-x: hidden;
  /* reactbits DotPattern as global background (24px grid, 1px dot at cx=1 cy=0.5) */
  background-image: radial-gradient(circle at 1px 0.5px, color-mix(in srgb, var(--muted) 18%, transparent) 0.75px, transparent 1.25px);
  background-size: 24px 24px;
}

::selection { background: var(--brand-soft); color: var(--text); }

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

button { font-family: inherit; }

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

/* ── TYPOGRAPHY ───────────────────────────────────────────────────────────── */
h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 640;
  letter-spacing: -0.022em;
  color: var(--text);
  line-height: 1.08;
}

h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); letter-spacing: -0.03em; }
h2 { font-size: 1.22rem; }
h3 { font-size: 1.02rem; }

p { font-size: 0.875rem; color: var(--muted); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 640;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 10px;
}
.page-head { margin-bottom: 30px; }
.page-head .lead { margin-top: 8px; max-width: 56ch; }

.tabular, .num { font-variant-numeric: tabular-nums; }

/* ── GLASS CHROME / NAVBAR ────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: 60px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
          backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #0A0A0A;
  background: var(--brand);
  box-shadow: 0 4px 14px var(--brand-shadow);
}
[data-theme="light"] .brand-mark { color: #FFFFFF; }

.brand-name {
  font-family: var(--font-display);
  font-weight: 640;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.navbar-right { display: flex; align-items: center; gap: 8px; }

/* ── PRIMARY PAGE NAV (segmented, sliding thumb) ──────────────────────────── */
.segnav-wrap {
  display: flex;
  justify-content: center;
  margin: 26px 0 0;
}

.segnav {
  position: relative;
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border-radius: var(--r-pill);
  background: var(--well);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-s);
}

.seg-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  bottom: 4px;
  border-radius: var(--r-pill);
  background: var(--card-solid);
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow-s);
  transition: transform 340ms var(--ease-out), width 340ms var(--ease-out);
  z-index: 0;
}
[data-theme="light"] .seg-thumb { background: #FFFFFF; }

.segnav .tab-btn {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border: none;
  background: transparent;
  border-radius: var(--r-pill);
  color: var(--muted);
  font-family: var(--font-display);
  font-weight: 560;
  font-size: 0.83rem;
  letter-spacing: -0.005em;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--dur-base) var(--ease-out);
}
.segnav .tab-btn .icon { opacity: 0.75; }
.segnav .tab-btn:hover { color: var(--text); }
.segnav .tab-btn.active { color: var(--text); font-weight: 640; }
.segnav .tab-btn.active .icon { opacity: 1; color: var(--text); }

/* Generic tab bar (admin subnav, non-thumb) */
.tab-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-weight: 560;
  font-size: 0.825rem;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out);
  margin-bottom: -1px;
}
.tab-bar .tab-btn:hover { color: var(--text); background: var(--well); }
.tab-bar .tab-btn.active {
  color: var(--text);
  font-weight: 640;
  box-shadow: inset 0 -2px 0 var(--brand);
}

/* ── MOBILE NAV ───────────────────────────────────────────────────────────── */
.nav-toggle { display: none; }

.mobile-nav {
  display: none;
  flex-direction: column;
  position: fixed;
  top: 54px;
  right: 12px;
  z-index: 70;
  min-width: 205px;
  padding: 6px;
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
          backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-m);
}
.mobile-nav:not(.hidden) { animation: nav-drop 300ms var(--ease-out) both; }

@keyframes nav-drop {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-family: var(--font-body);
  font-weight: 560;
  font-size: 0.85rem;
  transition: color var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out);
}
.mobile-nav-link:hover { color: var(--text); background: var(--well); }
.mobile-nav-link.active { color: var(--text); font-weight: 640; background: var(--well-2); }

/* ── BUTTONS ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border-radius: 10px;
  border: 1px solid var(--border-2);
  background: var(--card-solid);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 590;
  font-size: 0.8375rem;
  letter-spacing: -0.005em;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-s);
  transition: transform var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out),
              background-color var(--dur-base) var(--ease-out),
              opacity var(--dur-fast) ease;
}
.btn:hover { transform: translateY(-1px); border-color: var(--border-2); box-shadow: var(--shadow-m); }
.btn:active { transform: translateY(0) scale(0.98); }

.btn-primary {
  background: var(--brand);
  border-color: transparent;
  color: #0A0A0A;
  font-weight: 640;
  box-shadow: 0 6px 18px var(--brand-shadow);
}
[data-theme="light"] .btn-primary { color: #FFFFFF; }
.btn-primary:hover { box-shadow: 0 10px 26px var(--brand-shadow); border-color: transparent; }

.btn-secondary {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
  box-shadow: none;
}
.btn-secondary:hover {
  color: var(--text);
  background: var(--well);
  border-color: var(--border-2);
  box-shadow: none;
}

.btn-danger {
  background: transparent;
  color: #F87171;
  border-color: rgba(248, 113, 113, 0.35);
  box-shadow: none;
}
.btn-danger:hover { background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.55); }

.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: 10px; }

.btn[disabled], .btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-spinner {
  width: 13px;
  height: 13px;
  margin-right: 6px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── INPUTS ───────────────────────────────────────────────────────────────── */
input, select, textarea {
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card-solid);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.89rem;
  outline: none;
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
  appearance: none;
  -webkit-appearance: none;
}
select {
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2357606D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
textarea { height: auto; padding: 10px 12px; resize: vertical; }

input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--brand);
  vertical-align: middle;
  border-radius: 4px;
}
input[type="checkbox"]:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

label {
  font-family: var(--font-display);
  font-size: 0.66rem;
  font-weight: 640;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}

/* ── CARDS ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  -webkit-backdrop-filter: blur(12px);
          backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: var(--shadow-s);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

/* ── TILT (reactbits TiltCard) ────────────────────────────────────────────── */
.tilt {
  transform-style: preserve-3d;
  transform: perspective(900px) rotateX(var(--rx, 0)) rotateY(var(--ry, 0));
  transition: transform 200ms ease-out;
  will-change: transform;
}

/* ── FIXTURE / PODIUM / HOUSE CARDS ───────────────────────────────────────── */
.house-hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 16px;
}

/* Podium card = hero card. Data is tinted with --accent, never a hard border bar. */
.house-hero-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border-radius: var(--r-lg);
  background: var(--card);
  -webkit-backdrop-filter: blur(12px);
          backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-s);
  overflow: hidden;
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.house-hero-card:hover { box-shadow: var(--shadow-m); transform: translateY(-2px); border-color: var(--border-2); }
.tilt.house-hero-card:hover { transform: perspective(900px) rotateX(var(--rx, 0)) rotateY(var(--ry, 0)) translateY(-2px); }

.house-hero-card.is-leader {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent), var(--shadow-m);
}

.hero-medal {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-display);
  font-weight: 640;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: 3px 8px;
  border-radius: var(--r-pill);
}

.house-name {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 640;
  letter-spacing: -0.02em;
  color: var(--text);
}

.hero-sub { font-size: 0.72rem; color: var(--muted); margin-top: 2px; font-weight: 520; }

.hero-stats {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-2);
}

.stat-label {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 640;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-tertiary);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--accent);
}

.stat-value-sm {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 640;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.wl-good { color: var(--c-karnali); }
.wl-mid  { color: var(--muted); }
.wl-bad  { color: #F87171; }

/* ── FIXTURE CARDS ────────────────────────────────────────────────────────── */
.fixture-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 16px;
  border-radius: var(--r-lg);
  background: var(--card);
  -webkit-backdrop-filter: blur(12px);
          backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-s);
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.fixture-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-m); border-color: var(--border-2); }

.fixture-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fixture-matchup {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: var(--well);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.team-side { display: flex; align-items: center; gap: 9px; min-width: 0; }
.team-side.b { justify-content: flex-end; text-align: right; }

.team-bar {
  width: 3px;
  height: 32px;
  border-radius: 3px;
  background: var(--border-2);
  flex-shrink: 0;
}

.fixture-team {
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fixture-vs {
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 640;
  letter-spacing: 0.2em;
  color: var(--text-tertiary);
  background: var(--well-2);
  padding: 3px 8px;
  border-radius: var(--r-pill);
}

.fixture-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 12px;
  background: var(--well);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.score-label {
  font-family: var(--font-display);
  font-size: 0.58rem;
  font-weight: 640;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-tertiary);
}

.score-text {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text);
}

.fixture-unplayed { font-size: 0.75rem; color: var(--text-tertiary); text-align: center; padding: 10px; }

.section-heads {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.section-heads .icon-wrap {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--well);
  border: 1px solid var(--border);
  color: var(--muted);
}

.section-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 640;
  letter-spacing: -0.01em;
  color: var(--text);
}

.section-meta { font-size: 0.8rem; color: var(--muted); font-weight: 520; }

/* ── BADGES & CHIPS ───────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 21px;
  padding: 0 9px;
  border-radius: var(--r-pill);
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 640;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.badge.badge-status-completed { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-border); }
.badge.badge-status-scheduled { background: var(--pend-bg); color: var(--pend-text); border-color: var(--pend-border); }
.badge.badge-stage { background: var(--well); color: var(--muted); border-color: var(--border); }
[data-role-badge]::before { display: none; }

.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  height: 33px;
  padding: 0 15px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--card-solid);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 560;
  cursor: pointer;
  box-shadow: var(--shadow-s);
  transition: transform var(--dur-fast) var(--ease-out), color var(--dur-base) var(--ease-out),
              background-color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out);
}
.chip:hover { color: var(--text); border-color: var(--border-2); transform: translateY(-1px); }
.chip.active {
  color: #0A0A0A;
  background: var(--brand);
  border-color: transparent;
  box-shadow: 0 4px 14px var(--brand-shadow);
}
[data-theme="light"] .chip.active { color: #FFFFFF; }

/* ── TABLES ───────────────────────────────────────────────────────────────── */
.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--card);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  box-shadow: var(--shadow-s);
  position: relative;
  max-height: 620px;
}

table { width: 100%; border-collapse: collapse; font-size: 0.865rem; }

thead th {
  padding: 13px 16px;
  background: var(--well);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.63rem;
  font-weight: 640;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
  user-select: none;
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
}
thead th:first-child { border-top-left-radius: var(--r-lg); }
thead th:last-child { border-top-right-radius: var(--r-lg); }

thead th.th-sortable { cursor: pointer; transition: color var(--dur-base) ease, background-color var(--dur-base) ease; }
thead th.th-sortable:hover { color: var(--text); background: var(--well-2); }

.sort-indicator {
  display: inline-flex;
  align-items: center;
  margin-left: 5px;
  vertical-align: middle;
  color: var(--text-tertiary);
}
.sort-indicator.active { color: var(--text); }

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background-color var(--dur-base) ease; }
tbody tr:hover { background: var(--well); }

/* Animated entrance for table rows (staggered via --d) */
.trow { animation: row-in 480ms var(--ease-out) both; animation-delay: var(--d, 0ms); }
@keyframes row-in { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: none; } }

.rank-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--r-pill);
  font-family: var(--font-display);
  font-weight: 640;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 16px;
  background: var(--well);
  border-bottom: 1px solid var(--border);
}
.table-toolbar-left, .table-toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.table-search-input {
  max-width: 230px;
  height: 32px;
  font-size: 0.8rem;
  border-radius: var(--r-sm);
}
.table-filter-select { height: 32px; font-size: 0.8rem; border-radius: var(--r-sm); max-width: 160px; }

/* ── PAGINATION ───────────────────────────────────────────────────────────── */
.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: var(--well);
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
}

.pagination-nav { display: flex; align-items: center; gap: 6px; }

.pagination-btn {
  height: 28px;
  padding: 0 12px;
  font-size: 0.76rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--card-solid);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-base) var(--ease-out);
}
.pagination-btn:hover:not(:disabled) { background: var(--well-2); }
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.page-size-select { height: 28px; border-radius: var(--r-sm); font-size: 0.76rem; }

/* INLINE SCORE EDIT */
.inline-score-wrap { display: inline-flex; align-items: center; gap: 6px; }
.inline-score-input {
  width: 46px;
  height: 30px;
  text-align: center;
  font-weight: 620;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  border-radius: var(--r-sm);
}
.inline-save-btn {
  height: 30px;
  padding: 0 11px;
  font-size: 0.76rem;
  font-weight: 620;
  border-radius: var(--r-sm);
  background: var(--brand);
  color: #0A0A0A;
  border: none;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.inline-save-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px var(--brand-shadow); }
[data-theme="light"] .inline-save-btn { color: #FFFFFF; }

/* BULK ACTIONS */
.bulk-actions-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: color-mix(in srgb, var(--c-mechi) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--c-mechi) 35%, transparent);
  border-radius: var(--r-md);
  font-size: 0.82rem;
  color: var(--c-mechi);
  margin-bottom: 12px;
  animation: row-in 360ms var(--ease-out) both;
}

/* ── SECTION HEADERS (page level) ─────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ── FILTER PANEL (standings page) ────────────────────────────────────────── */
.filter-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 24px;
  padding: 18px;
  background: var(--card);
  -webkit-backdrop-filter: blur(12px);
          backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-s);
}
.filter-panel .field { flex: 1; min-width: 230px; }

/* ── MODALS ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--overlay);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
  animation: overlay-in 220ms ease-out both;
}
.modal-overlay.hidden { display: none; }

@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
  background: var(--card);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
          backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  padding: 26px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-l);
  animation: modal-in 340ms var(--ease-out) both;
}
.modal-content-wide { max-width: 760px; }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.modal-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--well);
  color: var(--muted);
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  transition: color var(--dur-fast) ease, background-color var(--dur-base) ease, transform var(--dur-fast) var(--ease-out);
}
.modal-close:hover { color: var(--text); background: var(--well-2); transform: rotate(90deg); }

/* ── SKELETONS ────────────────────────────────────────────────────────────── */
.sk { position: relative; overflow: hidden; }
.sk::after {
  content: "";
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  transform: translateX(-100%);
  animation: sk-shimmer 1.6s var(--ease-out) infinite;
  pointer-events: none;
}
@keyframes sk-shimmer { to { transform: translateX(100%); } }

.skeleton-box, .skeleton-table-row, .skeleton-card, .skeleton-hero-card, .sk-bar, .sk-circle {
  background-color: var(--well-2);
}
.skeleton-box { border-radius: 8px; }
.sk-bar { border-radius: 5px; }
.sk-circle { border-radius: 50%; }

.skeleton-hero-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-s);
}

.skeleton-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-s);
}

.skeleton-table {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--card);
  overflow: hidden;
  box-shadow: var(--shadow-s);
}
.skeleton-table-header {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: var(--well);
  border-bottom: 1px solid var(--border);
}
.skeleton-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.skeleton-row:last-child { border-bottom: none; }

/* ── EMPTY / ERROR STATES ─────────────────────────────────────────────────── */
.state-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 52px 24px;
  text-align: center;
  gap: 10px;
}
.state-empty-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  background: var(--well);
  border: 1px solid var(--border);
  color: var(--text-tertiary);
}
.state-empty-title { font-family: var(--font-display); font-size: 0.95rem; font-weight: 640; color: var(--text); }
.state-empty-desc { font-size: 0.82rem; color: var(--text-tertiary); }

.state-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
  gap: 12px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, #F87171 7%, var(--card));
}
.state-error-title { font-family: var(--font-display); font-size: 0.95rem; font-weight: 620; color: #F87171; }

/* ── TOASTS ───────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 74px;
  right: 20px;
  z-index: 110;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 370px;
  width: 100%;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 15px;
  background: var(--card);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
          backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-m);
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.45;
  animation: toast-in 380ms var(--ease-out) both;
  transition: opacity var(--dur-base) ease, transform var(--dur-base) var(--ease-out);
}
.toast-closing { opacity: 0; transform: translateY(-6px) scale(0.97); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-14px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.toast-icon {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  flex-shrink: 0;
}
.toast-success .toast-icon { color: var(--c-karnali); }
.toast-error .toast-icon   { color: #F87171; }
.toast-info .toast-icon    { color: var(--muted); }

.toast-success { border-left: 3px solid var(--c-karnali); }
.toast-error   { border-left: 3px solid #F87171; }
.toast-info    { border-left: 3px solid var(--muted); }

.toast-content { flex: 1; min-width: 0; }
.toast-title { font-family: var(--font-display); font-weight: 640; font-size: 0.85rem; margin-bottom: 2px; }
.toast-message { font-size: 0.8rem; color: var(--muted); word-break: break-word; }

.toast-close {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 17px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  transition: color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}
.toast-close:hover { color: var(--text); transform: scale(1.15); }

/* ── GLOBAL BUSY ──────────────────────────────────────────────────────────── */
.global-busy {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--overlay);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
}
.global-busy.hidden { display: none; }
.global-busy-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-2);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.global-busy-label {
  font-family: var(--font-display);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 560;
}

/* ── FOOTER ───────────────────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 30px 16px 40px;
  font-size: 0.78rem;
  color: var(--text-tertiary);
  min-height: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-top: 1px solid var(--border);
  margin-top: 48px;
}
.footer-type {
  display: inline-block;
  min-height: 1.2em;
  white-space: pre-wrap;
  max-width: min(92vw, 640px);
  overflow-wrap: break-word;
}
.type-caret {
  display: inline-block;
  width: 1px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background-color: var(--text);
  animation: caret-blink 1s steps(1) infinite;
}
@keyframes caret-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

/* ── PAGE CONTAINER ───────────────────────────────────────────────────────── */
.page-container {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 34px 24px 10px;
}

/* ── ADMIN ────────────────────────────────────────────────────────────────── */
.admin-section {
  background: var(--card);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-s);
}
.admin-section-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--well);
}
.dot-indicator {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--border);
}

/* ── ICONS ────────────────────────────────────────────────────────────────── */
.icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  vertical-align: middle;
}

/* ── REVEAL ON SCROLL (reactbits AnimatedList - scale(0.7)+fade entrance) ─── */
.reveal {
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 700ms var(--ease-out) var(--d, 0ms),
              transform 700ms var(--ease-out) var(--d, 0ms);
  will-change: opacity, transform;
}
.reveal.is-in { opacity: 1; transform: none; }

/* ── MISC ─────────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.fade-in { animation: fade-up 480ms var(--ease-out) both; }
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ── SCROLLBAR ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--well-2);
  border-radius: var(--r-pill);
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--border-2); background-clip: content-box; }
* { scrollbar-width: thin; scrollbar-color: var(--well-2) transparent; }

/* ── RESPONSIVE ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .page-container { padding: 22px 16px 6px; max-width: 100%; }
  .navbar { padding: 0 12px; height: 54px; }
  .brand-name { font-size: 0.88rem; }
  h1 { font-size: 1.72rem; }

  .segnav-wrap { display: none; overflow-x: auto; }
  #mainNav { display: none; }
  .segnav { max-width: 100%; overflow-x: auto; }
  .nav-toggle { display: inline-flex; }
  .mobile-nav { display: flex; }

  .house-hero-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .card-grid { grid-template-columns: 1fr; gap: 12px; }
  .stat-value { font-size: 1.6rem; }

  .table-toolbar { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 12px; }
  .table-toolbar-left, .table-toolbar-right { width: 100%; justify-content: space-between; }
  .table-search-input, .table-filter-select { max-width: none; flex: 1; }

  .pagination-bar { flex-direction: column; align-items: stretch; gap: 8px; text-align: center; }
  .pagination-nav { justify-content: center; }

  .modal-content { padding: 20px; border-radius: var(--r-md); }
  .toast-container { top: 60px; right: 12px; left: 12px; max-width: none; }

  .filter-panel .field { min-width: 170px; }
}

@media (max-width: 480px) {
  .page-container { padding: 18px 12px 4px; }
  .navbar { padding: 0 10px; }
  .brand { flex: 1; min-width: 0; }
  .brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #authBtnText { display: none; }
  #authBtn { width: 38px; padding: 0; }

  .house-hero-grid { grid-template-columns: 1fr; }
  .fixture-team { font-size: 0.8rem; }
  .table-wrap { max-height: 500px; }
  table { font-size: 0.8rem; }
  thead th, tbody td { padding: 10px 11px; }
}

/* ── MOTION REDUCTION ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

/* ── SEARCH OVERLAY ──────────────────────────────────────────────────────── */
.search-overlay-content {
  background: var(--card);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
          backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 680px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: var(--shadow-l);
  animation: modal-in 340ms var(--ease-out) both;
}

.search-overlay-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.search-overlay-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.search-overlay-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--well);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: color var(--dur-fast) ease, background-color var(--dur-base) ease;
}
.search-overlay-close:hover { color: var(--text); background: var(--well-2); }

.search-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  min-width: 22px;
  padding: 0 5px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--well);
  color: var(--text-tertiary);
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 640;
  flex-shrink: 0;
}

.search-overlay-results {
  max-height: calc(80vh - 60px);
  overflow-y: auto;
  padding: 12px;
}

.search-overlay-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 16px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.82rem;
}

.search-overlay-hint-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.search-hint-tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--well);
  color: var(--text-tertiary);
  font-size: 0.7rem;
  font-weight: 560;
}

.search-overlay-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 16px;
  color: var(--text-tertiary);
  font-size: 0.82rem;
}

.search-overlay-category {
  margin-bottom: 8px;
}

.search-overlay-cat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 640;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.search-overlay-cat-count {
  background: var(--well-2);
  border-radius: var(--r-pill);
  padding: 1px 7px;
  font-size: 0.58rem;
}

.search-overlay-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--text);
  text-decoration: none;
  transition: background-color var(--dur-fast) ease;
}
.search-overlay-item:hover { background: var(--well); }

.search-overlay-item-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.search-overlay-item-sub {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.search-overlay-no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 36px 16px;
  text-align: center;
}

.search-overlay-no-results svg {
  color: var(--text-tertiary);
  opacity: 0.5;
}

.search-overlay-no-results p {
  font-size: 0.85rem;
  color: var(--text-tertiary);
}

.search-overlay-no-results strong {
  color: var(--text);
  font-weight: 600;
}

.search-overlay-view-all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--border);
  color: var(--brand);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color var(--dur-fast) ease;
}
.search-overlay-view-all:hover { background: var(--well); }

/* Search results - replica grid + tables (matches fixtures/standings components) */
.search-overlay-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.search-overlay-table { max-height: none; }
.search-overlay-table thead th { padding: 9px 12px; }
.search-overlay-table tbody td { padding: 9px 12px; }
.search-overlay-table table { font-size: 0.82rem; }

.search-overlay-houses { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.search-overlay-houses .house-hero-card { padding: 16px; gap: 12px; }
.search-overlay-houses .stat-value { font-size: 1.5rem; }

.search-overlay-sports { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }

.search-sport-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-lg);
  background: var(--card);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-s);
  text-decoration: none;
  color: inherit;
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.search-sport-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-m); border-color: var(--border-2); }

.search-sport-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.search-row-link { cursor: pointer; }

.search-category-body { display: flex; flex-direction: column; gap: 26px; }
.search-page-table { margin-top: 14px; }

.search-results-list { display: flex; flex-direction: column; gap: 34px; }
.search-results-list > .search-category { margin-bottom: 0; }

/* Compact fixture card inside search overlay */
.search-match-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--well);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.search-match-card:hover { border-color: var(--border-2); box-shadow: var(--shadow-s); }

.search-match-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-match-matchup {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.search-match-team {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-match-team.right {
  justify-content: flex-end;
  text-align: right;
}

.search-match-vs {
  font-family: var(--font-display);
  font-size: 0.55rem;
  font-weight: 640;
  letter-spacing: 0.18em;
  color: var(--text-tertiary);
  background: var(--well-2);
  padding: 2px 6px;
  border-radius: var(--r-pill);
}

.search-match-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin-top: 2px;
}

.search-match-score-num {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.search-match-score-dash {
  color: var(--text-tertiary);
  font-size: 0.8rem;
}

.search-match-detail {
  font-size: 0.68rem;
  color: var(--text-tertiary);
}

/* Compact squad row inside search overlay */
.search-squad-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--well);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.search-squad-row:hover { border-color: var(--border-2); box-shadow: var(--shadow-s); }

.search-squad-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.search-squad-dot {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  flex-shrink: 0;
}

.search-squad-name {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 620;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-squad-meta {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.search-squad-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  flex-shrink: 0;
}

.search-squad-stat { font-variant-numeric: tabular-nums; }
.search-squad-stat.w { color: var(--c-karnali); }
.search-squad-stat.d { color: var(--text-tertiary); }
.search-squad-stat.l { color: #F87171; }
.search-squad-stat.pts { color: var(--accent); font-weight: 700; }

/* Compact house row inside search overlay */
.search-house-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--well);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.search-house-row:hover { border-color: var(--border-2); box-shadow: var(--shadow-s); }

.search-house-color {
  width: 10px;
  height: 36px;
  border-radius: 4px;
  flex-shrink: 0;
}

.search-house-info {
  flex: 1;
  min-width: 0;
}

.search-house-name {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 640;
  color: var(--text);
}

.search-house-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.search-house-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  flex-shrink: 0;
}

/* Compact player row inside search overlay */
.search-player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--well);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.search-player-row:hover { border-color: var(--border-2); box-shadow: var(--shadow-s); }

.search-player-name {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 620;
  color: var(--text);
}

.search-player-detail {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* Compact sport row inside search overlay */
.search-sport-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--well);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.search-sport-row:hover { border-color: var(--border-2); box-shadow: var(--shadow-s); }

.search-sport-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.search-sport-name {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 620;
  color: var(--text);
}

.search-sport-type {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-transform: capitalize;
}

/* ── SEARCH PAGE ─────────────────────────────────────────────────────────── */
.search-bar-large {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--card);
  -webkit-backdrop-filter: blur(12px);
          backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-s);
}

.search-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px 24px;
  text-align: center;
  gap: 12px;
}

.search-empty-icon {
  color: var(--text-tertiary);
  opacity: 0.35;
}

.search-empty-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 640;
  color: var(--text);
}

.search-empty-desc {
  max-width: 40ch;
  font-size: 0.88rem;
  color: var(--text-tertiary);
}

.search-no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  gap: 12px;
}

.search-no-results-icon {
  color: var(--text-tertiary);
  opacity: 0.3;
}

.search-no-results-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 640;
  color: var(--text);
}

.search-no-results-desc {
  font-size: 0.88rem;
  color: var(--text-tertiary);
  max-width: 42ch;
}

.search-no-results-desc strong {
  color: var(--text);
  font-weight: 600;
}

.search-no-results-tips {
  margin-top: 8px;
  padding: 16px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-align: left;
  max-width: 360px;
  width: 100%;
}

.search-no-results-tips p {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.search-no-results-tips ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.search-no-results-tips li {
  position: relative;
  padding-left: 16px;
  font-size: 0.82rem;
  color: var(--text-tertiary);
  line-height: 1.8;
}

.search-no-results-tips li::before {
  content: "\2022";
  position: absolute;
  left: 0;
  color: var(--text-tertiary);
}

.search-results-count {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin-bottom: 16px;
  font-weight: 560;
}

.search-category {
  margin-bottom: 24px;
}

.search-category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.search-category-title {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 640;
  color: var(--text);
}

.search-category-count {
  font-size: 0.68rem;
  color: var(--text-tertiary);
  background: var(--well-2);
  border-radius: var(--r-pill);
  padding: 1px 7px;
  font-weight: 600;
}

.search-category-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-category-items .search-match-card {
  text-decoration: none;
  color: inherit;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--card);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.search-result-item:hover { transform: translateY(-1px); box-shadow: var(--shadow-m); border-color: var(--border-2); }

.search-result-content { min-width: 0; flex: 1; }

.search-result-title {
  font-family: var(--font-display);
  font-weight: 620;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-subtitle {
  font-size: 0.76rem;
  color: var(--text-tertiary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── ERROR PAGES ─────────────────────────────────────────────────────────── */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
  gap: 8px;
}

.error-page-icon {
  width: 100px;
  height: 100px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  background: var(--well);
  border: 1px solid var(--border);
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.error-page-icon-forbidden { color: #F59E0B; background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.2); }
.error-page-icon-server { color: #F87171; background: rgba(248, 113, 113, 0.08); border-color: rgba(248, 113, 113, 0.2); }

.error-page-code {
  font-family: var(--font-display);
  font-size: 4rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
  margin: 4px 0;
}

.error-page-code-forbidden { color: #F59E0B; }
.error-page-code-server { color: #F87171; }

.error-page-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 640;
  color: var(--text);
  margin: 4px 0;
}

.error-page-desc {
  max-width: 42ch;
  font-size: 0.88rem;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

.error-page-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}