/* ============================================================
   css/style.css — Main Design System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  color-scheme: light;

  --bg-primary:    #f8fafc;
  --bg-secondary:  #ffffff;
  --bg-card:       #ffffff;
  --bg-card-hover: rgba(15,23,42,0.04);
  --bg-elevated:   #ffffff;
  --border:        rgba(15,23,42,0.08);
  --border-hover:  rgba(15,23,42,0.15);
  --border-subtle: rgba(15,23,42,0.06);
  --text-primary:  #0f172a;
  --text-secondary:#475569;
  --text-muted:    #64748b;
  --text-on-accent:#ffffff;
  --nav-bg:        rgba(248,250,252,0.88);
  --overlay-bg:    rgba(15,23,42,0.45);
  --surface-subtle:rgba(15,23,42,0.04);
  --surface-hover: rgba(15,23,42,0.07);
  --shimmer-mid:   rgba(15,23,42,0.08);
  --row-border:    rgba(15,23,42,0.06);
  --ghost-bg:      rgba(15,23,42,0.05);
  --ghost-bg-hover:rgba(15,23,42,0.09);
  --tab-bg:        rgba(15,23,42,0.03);
  --tab-hover-bg:  rgba(15,23,42,0.07);
  --modal-choice-bg: rgba(15,23,42,0.02);
  --modal-choice-hover: rgba(15,23,42,0.05);
  --shadow-modal:  0 25px 50px -12px rgba(15,23,42,0.12);
  --purple:        #7c3aed;
  --purple-light:  #6d28d9;
  --purple-glow:   rgba(124,58,237,0.12);
  --emerald:       #10b981;
  --emerald-light: #059669;
  --emerald-glow:  rgba(16,185,129,0.12);
  --amber:         #d97706;
  --amber-glow:    rgba(245,158,11,0.12);
  --red:           #ef4444;
  --red-light:     #dc2626;
  --red-glow:      rgba(239,68,68,0.1);
  --gradient-brand:linear-gradient(135deg,#7c3aed 0%,#4f46e5 100%);
  --gradient-pro:  linear-gradient(135deg,#10b981 0%,#059669 100%);
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --nav-h: 60px;
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg-primary:    #0b0b12;
  --bg-secondary:  #161625;
  --bg-card:       #24213c;
  --bg-card-hover: #2d2847;
  --bg-elevated:   #2a2643;
  --border:        rgba(255,255,255,0.08);
  --border-hover:  rgba(255,255,255,0.15);
  --border-subtle: rgba(255,255,255,0.06);
  --text-primary:  #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #64748b;
  --text-on-accent:#ffffff;
  --nav-bg:        rgba(11,11,18,0.82);
  --overlay-bg:    rgba(0,0,0,0.65);
  --surface-subtle:rgba(255,255,255,0.04);
  --surface-hover: rgba(255,255,255,0.07);
  --shimmer-mid:   rgba(255,255,255,0.07);
  --row-border:    rgba(255,255,255,0.04);
  --ghost-bg:      rgba(255,255,255,0.07);
  --ghost-bg-hover:rgba(255,255,255,0.12);
  --tab-bg:        rgba(255,255,255,0.03);
  --tab-hover-bg:  rgba(255,255,255,0.07);
  --modal-choice-bg: rgba(255,255,255,0.02);
  --modal-choice-hover: rgba(255,255,255,0.05);
  --shadow-modal:  0 25px 50px -12px rgba(0,0,0,0.5);
  --purple-light:  #a78bfa;
  --purple-glow:   rgba(124,58,237,0.18);
  --emerald-light: #34d399;
  --emerald-glow:  rgba(16,185,129,0.15);
  --amber:         #f59e0b;
  --amber-glow:    rgba(245,158,11,0.15);
  --red-light:     #f87171;
  --red-glow:      rgba(239,68,68,0.15);
  --alert-error-text:   #fca5a5;
  --alert-success-text: #6ee7b7;
  --alert-info-text:    #c4b5fd;
  --alert-warning-text: #fcd34d;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background:
    linear-gradient(145deg, var(--bg-primary) 0%, rgba(124,58,237,.06) 45%, rgba(79,70,229,.04) 100%);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

[data-theme="dark"] body {
  background:
    linear-gradient(145deg, var(--bg-primary) 0%, rgba(124,58,237,.14) 45%, rgba(79,70,229,.08) 100%);
}

a { color: inherit; }

/* ── NAV ─────────────────────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--nav-h);
  display: flex; align-items: center; gap: 0; padding: 0 1.5rem;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-size: 15px; font-weight: 800;
  background: var(--gradient-brand);
  -webkit-background-clip: text; 
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none; white-space: nowrap; margin-right: 1.5rem;
}

.nav-links {
  display: flex; gap: 2px; list-style: none; flex: 1; align-items: center;
}

.nav-link {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 11px; border-radius: var(--radius-sm);
  color: var(--text-secondary); text-decoration: none;
  font-size: 13px; font-weight: 500;
  transition: color .18s, background .18s;
}
.nav-link:hover       { color: var(--text-primary); background: var(--bg-card-hover); }
.nav-link.active      { color: var(--purple-light); background: var(--purple-glow); }
.nav-link.nav-upgrade { color: var(--emerald-light) !important; }

.nav-right {
  display: flex; align-items: center; gap: 10px; margin-left: auto;
}

.pro-badge {
  font-size: 10px; font-weight: 700; padding: 3px 9px;
  border-radius: 20px; background: var(--gradient-pro); color: #fff;
  letter-spacing: .04em;
}

.nav-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gradient-brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}

.nav-username { font-size: 13px; color: var(--text-secondary); }

.btn-nav-logout {
  font-size: 12px; color: var(--text-muted); text-decoration: none;
  padding: 5px 10px; border-radius: var(--radius-sm);
  transition: color .18s, background .18s;
}
.btn-nav-logout:hover { color: var(--red); background: var(--red-glow); }

/* ── PAGE LAYOUT ─────────────────────────────────────────── */
.page-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1160px; margin: 0 auto;
  padding: calc(var(--nav-h) + 28px) 1.5rem 3rem;
}

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 1.75rem;
}
.page-title    { font-size: 22px; font-weight: 700; }
.page-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }
.page-actions  { display: flex; gap: 8px; align-items: center; }

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-modal);
}
.card + .card { margin-top: 1.25rem; }
.card-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-muted); margin-bottom: 1.25rem;
}

/* ── METRIC CARDS ────────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}

.compact-metrics .metric-card { padding: 0.75rem 1rem; border-color: var(--border-subtle); }
.compact-metrics .metric-label { font-size: 0.7rem; color: var(--text-muted); opacity: 0.8; }
.compact-metrics .metric-value { font-size: 1.15rem; margin-top: 0; }
.compact-metrics .metric-sub-value { font-size: 0.7rem; color: var(--text-secondary); }
.compact-metrics .metric-hint { font-size: 0.65rem; color: var(--text-muted); }
.compact-metrics hr { display: none; }
.metric-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  box-shadow: var(--shadow-modal);
  transition: border-color .2s;
}
.metric-card:hover { border-color: var(--border-hover); }
.metric-label {
  font-size: 11px; font-weight: 500; color: var(--text-muted);
  letter-spacing: .04em; margin-bottom: 6px;
}
.metric-value {
  font-size: 26px; font-weight: 700; color: var(--text-primary);
  line-height: 1.1;
}
.metric-value.green  { color: var(--emerald-light); }
.metric-value.purple { color: var(--purple-light); }
.metric-value.amber  { color: var(--amber); }
.metric-value.red    { color: var(--red-light); }
.metric-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.metric-sub-value {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.metric-sub-value .label { color: var(--text-muted); font-weight: 500; }
.metric-sub-value .val { color: var(--text-primary); }
.metric-sub-value .val.green  { color: var(--emerald-light); }
.metric-sub-value .val.amber  { color: var(--amber); }
.metric-sub-value .val.red    { color: var(--red-light); }
.metric-sub-value .val.purple { color: var(--purple-light); }

/* ── TABLES ──────────────────────────────────────────────── */
.table-wrapper { 
  overflow-x: auto; 
  max-height: 480px;
  overflow-y: auto;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 9px 12px;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
tbody tr {
  border-bottom: 1px solid var(--row-border);
  transition: background .15s;
}
tbody tr:hover        { background: var(--bg-card-hover); }
tbody tr:last-child   { border-bottom: none; }
tbody td { padding: 11px 12px; vertical-align: middle; }

.tr-broke  { background: rgba(239,68,68,0.06) !important; }
.tr-last   { background: rgba(245,158,11,0.05) !important; }
.tr-faded td { opacity: 0.28; }

/* ── BADGES ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px;
}
.badge-green  { background: var(--emerald-glow); color: var(--emerald-light); }
.badge-purple { background: var(--purple-glow);  color: var(--purple-light); }
.badge-amber  { background: var(--amber-glow);   color: var(--amber); }
.badge-red    { background: var(--red-glow);     color: var(--red-light); }
.badge-gray   { background: var(--surface-subtle); color: var(--text-secondary); }
.badge-pro    { background: var(--gradient-pro); color: #fff; }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  text-decoration: none; border: none; outline: none;
  transition: all .2s; white-space: nowrap;
}
.btn-primary { background: var(--gradient-brand); color: #fff; }
.btn-primary:hover { opacity: .88; transform: translateY(-1px); }
.btn-success { background: var(--gradient-pro);   color: #fff; }
.btn-success:hover { opacity: .88; }
.btn-ghost {
  background: var(--ghost-bg); color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--ghost-bg-hover); }
.btn-danger {
  background: var(--red-glow); color: var(--red-light);
  border: 1px solid rgba(239,68,68,0.25);
}
.btn-danger:hover { background: rgba(239,68,68,0.22); }
.btn-purple {
  background: var(--purple-glow); color: var(--purple-light);
  border: 1px solid rgba(124,58,237,0.25);
}
.btn-purple:hover { background: rgba(124,58,237,0.22); }
.btn-sm { padding: 5px 13px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }

/* ── ALERTS ──────────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: 1rem;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-error   { background: var(--red-glow);     border: 1px solid rgba(239,68,68,.3);  color: var(--alert-error-text, #b91c1c); }
.alert-success { background: var(--emerald-glow); border: 1px solid rgba(16,185,129,.3); color: var(--alert-success-text, #047857); }
.alert-info    { background: var(--purple-glow);  border: 1px solid rgba(124,58,237,.3); color: var(--alert-info-text, #5b21b6); }
.alert-warning { background: var(--amber-glow);   border: 1px solid rgba(245,158,11,.3); color: var(--alert-warning-text, #b45309); }

/* ── DIVIDERS & LAYOUT UTILS ─────────────────────────────── */
hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 1.25rem; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.text-muted { color: var(--text-muted); font-size: 13px; }
.text-green { color: var(--emerald-light) !important; }
.text-amber { color: var(--amber) !important; }
.text-purple { color: var(--purple-light) !important; }
.text-red { color: var(--red-light) !important; }
.d-none { display: none !important; }
.mb-2 { margin-bottom: 2rem; }

.builder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem;
  align-items: flex-end;
}

.fixture-filter-panel {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.fixture-filter-columns {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1rem 1.25rem;
  align-items: start;
}
@media (max-width: 768px) {
  .fixture-filter-columns { grid-template-columns: 1fr; }
}
.fixture-filter-col {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  min-width: 0;
}
.fixture-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.fixture-filter-head .form-label { margin: 0; }
.fixture-filter-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.fixture-filter-checklist,
.fixture-filter-chips {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
}
.fixture-filter-checklist-scroll {
  max-height: 10rem;
  overflow-y: auto;
  padding-right: 0.25rem;
}
.fixture-filter-tour-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}
.fixture-filter-group {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
  flex-shrink: 0;
}
.fixture-filter-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-subtle);
  transition: border-color 0.15s, background 0.15s;
}
.fixture-filter-check:hover {
  border-color: var(--text-muted);
}
.fixture-filter-check:has(input:checked) {
  border-color: var(--emerald);
  background: var(--emerald-glow);
  color: var(--emerald-light);
}
.fixture-filter-check input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.fixture-filter-placeholder {
  font-size: 0.875rem;
  margin: 0;
}
.table-actions { display: flex; gap: 6px; }
.table-actions .btn { 
  min-width: 32px; 
  width: 32px;
  justify-content: center; 
  height: 32px; 
  padding: 0; 
  border-width: 1px; 
  border-style: solid;
  border-radius: 8px;
}
.table-actions .btn-success { border-color: transparent; }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; line-height: 1; margin-bottom: 1rem; }
.empty-state-text { font-size: 14px; }
.empty-state-sub  { font-size: 12px; margin-top: 6px; }

/* ── TOAST ───────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  max-width: 340px; pointer-events: none;
}

/* ── PRICING CARDS ───────────────────────────────────────── */
.pricing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.pricing-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 2rem;
  display: flex; flex-direction: column; gap: 1rem;
}
.pricing-card.featured { border-color: var(--purple); box-shadow: 0 0 30px var(--purple-glow); }
.pricing-name   { font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.pricing-price  { font-size: 42px; font-weight: 800; line-height: 1; }
.pricing-price span { font-size: 18px; font-weight: 500; color: var(--text-secondary); }
.pricing-features { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.pricing-features li {
  font-size: 13px; color: var(--text-secondary);
  display: flex; align-items: center; gap: 8px;
}
.pricing-features li::before { content: '✓'; color: var(--emerald-light); font-weight: 700; }
.pricing-features li.no::before { content: '✗'; color: var(--text-muted); }
.pricing-features li.no { color: var(--text-muted); text-decoration: line-through; }

/* ── MODALS ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--overlay-bg); backdrop-filter: blur(8px);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 1.5rem; opacity: 0; pointer-events: none;
  transition: opacity .3s;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal-card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 100%; max-width: 440px;
  padding: 2rem; transform: translateY(20px); transition: transform .3s;
  box-shadow: var(--shadow-modal);
}
.modal-overlay.active .modal-card { transform: translateY(0); }

.modal-header { margin-bottom: 1.25rem; }
.modal-title  { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.modal-body   { font-size: 14px; color: var(--text-secondary); margin-bottom: 1.75rem; }
.modal-footer { display: flex; gap: 10px; justify-content: center; }

.modal-choice-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 1.25rem;
}
.modal-choice {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; cursor: pointer; text-align: center; transition: all .2s;
  background: var(--modal-choice-bg);
}
.modal-choice:hover { border-color: var(--border-hover); background: var(--modal-choice-hover); }
.modal-choice.active { border-color: var(--purple); background: var(--purple-glow); }
.modal-choice-title { font-size: 14px; font-weight: 700; display: block; }
.modal-choice-sub   { font-size: 11px; color: var(--text-muted); }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4, .pricing-grid { grid-template-columns: 1fr; }
  .nav-links { display: flex; gap: 0; }
  .nav-link { padding: 6px 8px; font-size: 11px; }
  .nav-link span { display: none; } /* Hide icons if present to save space */
  .nav-right { gap: 5px; }
  .pro-badge { font-size: 9px; padding: 2px 7px; }
  .page-wrapper { padding-left: 1rem; padding-right: 1rem; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  
  /* Compact tables on mobile */
  .table-wrapper table { font-size: 11px; }
  .table-wrapper th, .table-wrapper td { padding: 8px 6px; }
  .table-wrapper strong { font-weight: 700; }
  .table-wrapper .badge { padding: 2px 6px; font-size: 10px; }
  .table-wrapper .form-control { font-size: 11px; height: 28px !important; }
  .hide-mobile { display: none !important; }
}
@media (max-width: 420px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .table-wrapper th, .table-wrapper td { padding: 6px 3px !important; font-size: 10px; }
  .table-wrapper table { font-size: 10px; }
  .table-actions .btn { min-width: 45px !important; padding: 0 4px !important; font-size: 9px !important; }
}
.p-0 { padding: 0 !important; }
.p-4 { padding: 1.25rem !important; }
.pt-2 { padding-top: 0.5rem !important; }

/* Tabs Component */
.tabs-header {
  display: flex;
  background: var(--tab-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 0.5rem;
}
.tab-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  background: var(--tab-bg);
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  font-family: inherit;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  margin: 0.5rem 0.25rem;
}

.tab-btn:hover { color: var(--text-primary); background: var(--tab-hover-bg); }

.tab-btn.active {
  color: var(--text-on-accent);
  background: var(--gradient-brand);
  box-shadow: 0 4px 12px var(--purple-glow);
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* Tennis module */
.fixtures-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  align-items: stretch;
}
.fixtures-grid > .card + .card { margin-top: 0; }
.fixture-card {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.fixture-card .analyse-btn { margin-top: auto; }
.fixtures-pagination-wrap:empty { display: none; }
.fixtures-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem 1.5rem;
  margin-bottom: 1rem;
}
.fixtures-search-group {
  flex: 1 1 280px;
  max-width: 420px;
  margin-bottom: 0;
}
.fixtures-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.15rem;
}
.fixtures-refresh-stale {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  margin: 0;
}
.fixtures-refresh-stale input {
  margin: 0;
}
.fixtures-confidence-group {
  max-width: 180px;
  margin-bottom: 0;
}
.bulk-tab-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.bulk-scope-summary {
  margin: 0;
  flex: 1 1 220px;
  font-size: 0.9rem;
  line-height: 1.4;
}
.bulk-tab-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}
.bulk-progress {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
}
.bulk-progress-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.bulk-progress-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.bulk-progress-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--border, rgba(128, 128, 128, 0.25));
  overflow: hidden;
}
.bulk-progress-track-lg {
  height: 10px;
  margin-top: 0.35rem;
}
.bulk-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--primary, #2563eb);
  transition: width 0.2s ease;
}
.bulk-modal-message {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  line-height: 1.45;
}
.bulk-modal-hint {
  margin: 0;
  font-size: 0.875rem;
}
.bulk-modal-progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
}
.bulk-modal-progress-pct {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.bulk-results {
  margin-bottom: 1.25rem;
}
.bulk-results-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.bulk-results-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}
.bulk-results-table th:last-child,
.bulk-results-table td:last-child {
  text-align: right;
  white-space: nowrap;
}
.bulk-results-table td {
  vertical-align: middle;
}
.bulk-status-pending { color: var(--text-secondary); }
.bulk-status-running { color: var(--text-secondary); }
.bulk-status-ok { color: var(--success, #1a7f4c); }
.bulk-status-skip { color: var(--warning, #b45309); }
.bulk-status-error { color: var(--danger, #b91c1c); }
.bulk-status-saved { color: var(--success, #1a7f4c); }
.pagination-per-page-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}
.pagination-per-page-label {
  color: var(--text-secondary);
  white-space: nowrap;
}
.pagination-per-page {
  width: auto;
  min-width: 5rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.875rem;
  height: auto;
}
#predictions-pagination:empty { display: none; }
.fixture-card.skeleton-card .fixture-header { margin-bottom: 0.25rem; }
.fixture-card.skeleton-card .skeleton-title { margin: 0.5rem 0 0.35rem; }
.fixture-card.skeleton-card .skeleton-text { margin-bottom: 0.35rem; }
.fixture-title { font-size: 1rem; margin: 0.5rem 0; }
.fixture-players {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}
.fixture-vs {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9em;
}
.player-with-flag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.country-flag {
  font-size: 1.1em;
  line-height: 1;
}
.fixture-meta { font-size: 0.85rem; margin: 0; }
.fixture-header { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.modal-card-lg { max-width: min(960px, 96vw); width: 95%; }
#match-detail-modal .modal-body,
#prediction-detail-modal .modal-body {
  overflow-x: auto;
  overflow-y: auto;
  max-height: min(72vh, 780px);
}
.factor-breakdown summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}
.factor-breakdown-scroll {
  overflow-x: auto;
  overflow-y: visible;
  max-height: none;
  -webkit-overflow-scrolling: touch;
}
.source-status-panel summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.source-status-list {
  list-style: none;
  padding: 0.5rem 0 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  font-size: 0.85rem;
}
.source-status-detail {
  font-size: 0.8rem;
}
.factor-table {
  width: 100%;
  min-width: 720px;
  table-layout: fixed;
}
.factor-table th,
.factor-table td {
  vertical-align: top;
}
.factor-table th:nth-child(1),
.factor-table td:nth-child(1) { width: 16%; }
.factor-table th:nth-child(2),
.factor-table td:nth-child(2) { width: 14%; }
.factor-table th:nth-child(3),
.factor-table td:nth-child(3) { width: 10%; }
.factor-table th:nth-child(4),
.factor-table td:nth-child(4) {
  width: 60%;
  word-break: break-word;
  white-space: normal;
  font-size: 0.8rem;
  line-height: 1.35;
}
.glossary-tooltip {
  position: fixed;
  z-index: 9999;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  max-width: 280px;
  display: none;
  pointer-events: none;
}
.pred-attach { font-size: 0.75rem; }
.pred-attach-acca .pred-attach-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.25rem;
}
.pred-legs {
  list-style: none;
  margin: 0;
  padding: 0;
}
.pred-leg {
  margin: 0.15rem 0;
  line-height: 1.3;
}
.odds-source { display: block; font-size: 0.7rem; }
.rec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  grid-auto-rows: 1fr;
  gap: 1rem;
  align-items: stretch;
}
.rec-grid > .rec-card {
  margin-bottom: 0;
  align-self: stretch;
}
.rec-grid > .rec-card + .rec-card {
  margin-top: 0;
}
.rec-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--border);
}
.rec-header {
  display: grid;
  grid-template-rows: auto auto;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  min-height: 3.5rem;
}
.rec-header-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: flex-start;
}
.rec-header-primary {
  min-height: 1.4rem;
}
.rec-header-meta {
  min-height: 1.4rem;
}
.rec-header-spacer {
  display: inline-block;
  min-width: 0.01px;
}
.rec-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.5rem;
}
.rec-selection,
.rec-rationale,
.rec-factors {
  margin: 0;
}
.rec-selection {
  min-height: 3rem;
}
.rec-rationale {
  flex: 1;
  min-height: 4.5rem;
}
.rec-factors {
  font-size: 0.8rem;
  min-height: 2.6rem;
}
.rec-card .add-rollover-btn {
  margin-top: 0.75rem;
}
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.pagination-summary {
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.pagination-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.pagination-controls .pagination-btn.active {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: 0 2px 8px var(--purple-glow);
}
.pagination-ellipsis {
  align-self: center;
  padding: 0 0.25rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}
@media (max-width: 360px) {
  .fixtures-grid { grid-template-columns: 1fr; }
  .modal-card-lg { width: 100%; margin: 0.5rem; }
  .pagination { flex-direction: column; align-items: stretch; }
  .pagination-controls { justify-content: center; }
}

/* ── THEME TOGGLE ────────────────────────────────────────── */
.theme-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
  flex-shrink: 0;
}
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: inline-flex; }

.theme-toggle-guest {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 250;
}

/* ── PAGE UTILITIES ──────────────────────────────────────── */
.page-header-center { text-align: center; display: block; }
.auth-submit { width: 100%; justify-content: center; margin-top: 10px; }
.settings-card { padding: 0; overflow: hidden; }
.settings-card-nav { padding: 1rem 1.5rem 0; }
.settings-card-body { padding: 0 1.5rem 1.5rem; }
.settings-hint { font-size: 0.85rem; margin-top: 0.35rem; }
.upgrade-pro-card { max-width: 600px; margin: 2rem auto; text-align: center; }
.upgrade-badge { font-size: 13px; padding: 6px 12px; }
.upgrade-pricing-grid { max-width: 900px; margin: 0 auto; }
.pricing-card-header { display: flex; justify-content: space-between; }
.pricing-name-pro { color: var(--purple-light); }
.upgrade-pay-btn { margin-top: auto; justify-content: center; padding: 12px; }
.upgrade-powered-by { text-align: center; font-size: 11px; }

.card {
  box-shadow: 0 1px 3px rgba(15,23,42,0.06);
}
[data-theme="dark"] .card {
  box-shadow: none;
}
