/* ============================================================
   Helios Tournament Management — Design System
   Mobile-first, Dark mode, WCAG 2.1, Color-coded statuses
   ============================================================ */

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

/* ── CSS Custom Properties (Light Theme) ─────────────────────── */
:root {
  /* Brand */
  --brand-primary:   #6366f1;
  --brand-secondary: #8b5cf6;
  --brand-accent:    #ec4899;
  --brand-gradient:  linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);

  /* Backgrounds */
  --bg-base:      #f8fafc;
  --bg-surface:   #ffffff;
  --bg-elevated:  #f1f5f9;
  --bg-overlay:   rgba(255,255,255,0.9);
  --bg-sidebar:   #1a1a2e;

  /* Text */
  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --text-inverse:   #f8fafc;

  /* Borders */
  --border:       #e2e8f0;
  --border-focus: #6366f1;

  /* Status Colors */
  --status-pending:   #f59e0b;
  --status-scheduled: #3b82f6;
  --status-live:      #10b981;
  --status-completed: #6366f1;
  --status-cancelled: #ef4444;
  --status-walkover:  #8b5cf6;

  /* Medal Colors */
  --medal-gold:   #f59e0b;
  --medal-silver: #94a3b8;
  --medal-bronze: #cd7f32;

  /* Semantic */
  --success: #10b981;
  --warning: #f59e0b;
  --error:   #ef4444;
  --info:    #3b82f6;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:  0 10px 40px rgba(0,0,0,.14);
  --shadow-xl:  0 20px 60px rgba(0,0,0,.18);
  --glow:       0 0 30px rgba(99,102,241,.30);

  /* Layout */
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Typography */
  --font-body:    'Inter', system-ui, sans-serif;
  --font-display: 'Outfit', 'Inter', sans-serif;

  /* Transitions */
  --transition-fast: .12s ease;
  --transition-base: .22s ease;
  --transition-slow: .4s cubic-bezier(.4,0,.2,1);
}

/* ── Dark Theme ──────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-base:      #0f0f1a;
  --bg-surface:   #1a1a2e;
  --bg-elevated:  #16213e;
  --bg-overlay:   rgba(26,26,46,0.95);
  --bg-sidebar:   #0d0d1a;

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;
  --text-inverse:   #0f172a;

  --border: #2d2d4e;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.40);
  --shadow-md: 0 4px 16px rgba(0,0,0,.50);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.60);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background var(--transition-slow), color var(--transition-base);
  overflow-x: hidden;
}

/* Focus visible for WCAG 2.1 */
:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 3px;
  border-radius: 4px;
}

a { color: var(--brand-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font-family: inherit; }

/* ── App Shell ───────────────────────────────────────────────── */
#app { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition-slow);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  padding: 24px 20px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.sidebar-logo-icon {
  width: 38px; height: 38px;
  background: var(--brand-gradient);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.sidebar-logo-text {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.4px;
}
.sidebar-logo-sub {
  font-size: 10px;
  color: rgba(255,255,255,.4);
  letter-spacing: .5px;
  text-transform: uppercase;
  display: block;
  margin-top: 1px;
}

.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-section { padding: 0 12px 4px; }
.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,.3);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 10px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: rgba(255,255,255,.60);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  margin: 1px 0;
  position: relative;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover {
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.90);
  text-decoration: none;
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(99,102,241,.3), rgba(139,92,246,.2));
  color: #fff;
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--brand-primary);
  border-radius: 0 2px 2px 0;
}
.nav-item-icon { font-size: 18px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--brand-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user-avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--brand-gradient);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 13px; font-weight: 600;
  color: rgba(255,255,255,.9);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 11px;
  color: rgba(255,255,255,.4);
}

/* ── Main Content ────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 90;
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.btn-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: all var(--transition-fast);
  position: relative;
}
.btn-icon:hover { background: var(--bg-elevated); color: var(--text-primary); }
.btn-icon .badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--error);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-surface);
}

.page-content { padding: 28px 24px; flex: 1; max-width: 1400px; }

/* ── Hamburger (mobile) ──────────────────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  background: none;
  border: none;
}
.hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--transition-base);
}

/* ── Sidebar Overlay (mobile) ─────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  transition: box-shadow var(--transition-fast);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Glass Card */
.card-glass {
  background: var(--bg-overlay);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius-lg);
}

/* Stat Cards */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--brand-gradient);
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.stat-card:hover::before { opacity: 1; }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.purple { background: rgba(99,102,241,.12); }
.stat-icon.green  { background: rgba(16,185,129,.12); }
.stat-icon.amber  { background: rgba(245,158,11,.12); }
.stat-icon.pink   { background: rgba(236,72,153,.12); }
.stat-icon.blue   { background: rgba(59,130,246,.12); }
.stat-info { flex: 1; }
.stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.stat-change {
  font-size: 11px;
  font-weight: 600;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--error); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  justify-content: center;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99,102,241,.35);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(99,102,241,.50); }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-danger { background: var(--error); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline {
  background: transparent;
  color: var(--brand-primary);
  border: 1px solid var(--brand-primary);
}
.btn-outline:hover { background: rgba(99,102,241,.08); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text-primary); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: var(--radius-lg); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 7px;
}
.form-label .required { color: var(--error); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  transition: all var(--transition-fast);
  outline: none;
}
.form-control:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:disabled { background: var(--bg-elevated); cursor: not-allowed; opacity: .7; }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 5px; }
.form-error { font-size: 11px; color: var(--error); margin-top: 5px; }
.input-group { display: flex; gap: 0; }
.input-group .form-control { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.input-group .btn { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* Checkbox & Radio WCAG */
.form-check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 18px; height: 18px;
  accent-color: var(--brand-primary);
  cursor: pointer;
}

/* ── Status Badges ───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-pending   { background: rgba(245,158,11,.12);  color: var(--status-pending);   }
.badge-scheduled { background: rgba(59,130,246,.12);  color: var(--status-scheduled); }
.badge-live      {
  background: rgba(16,185,129,.12);
  color: var(--status-live);
  animation: pulse-live 2s ease-in-out infinite;
}
.badge-completed { background: rgba(99,102,241,.12);  color: var(--status-completed); }
.badge-cancelled { background: rgba(239,68,68,.12);   color: var(--status-cancelled); }
.badge-walkover  { background: rgba(139,92,246,.12);  color: var(--status-walkover);  }
.badge-draft     { background: rgba(100,116,139,.12); color: #64748b; }
.badge-published { background: rgba(16,185,129,.12);  color: var(--success); }
.badge-approved  { background: rgba(16,185,129,.12);  color: var(--success); }
.badge-rejected  { background: rgba(239,68,68,.12);   color: var(--error); }

@keyframes pulse-live {
  0%,100% { box-shadow: 0 0 0 0 rgba(16,185,129,.4); }
  50%      { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-primary);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-elevated); }

/* ── Avatar ──────────────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--brand-gradient);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
  object-fit: cover;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.avatar-xl { width: 80px; height: 80px; font-size: 28px; }

/* ── Match Card ──────────────────────────────────────────────── */
.match-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}
.match-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.match-card.live { border-color: var(--status-live); }
.match-card.live::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--status-live);
}
.match-players { flex: 1; }
.match-player-row {
  display: flex; align-items: center;
  gap: 10px; padding: 4px 0;
}
.match-player-name { font-size: 14px; font-weight: 600; flex: 1; }
.match-player-name.winner { color: var(--brand-primary); }
.match-score {
  font-size: 18px;
  font-weight: 800;
  font-family: var(--font-display);
  color: var(--text-primary);
  min-width: 32px;
  text-align: center;
}
.match-score.winner { color: var(--brand-primary); }
.match-vs {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.match-meta {
  text-align: right;
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.match-court { font-weight: 600; color: var(--text-secondary); }

/* ── Live Ticker ─────────────────────────────────────────────── */
.live-ticker {
  background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
  border-radius: var(--radius-xl);
  padding: 32px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.live-ticker::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 70% 50%, rgba(99,102,241,.2), transparent 60%);
}
.live-ticker-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(16,185,129,.2);
  color: #10b981;
  border: 1px solid rgba(16,185,129,.3);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
}
.live-dot {
  width: 7px; height: 7px;
  background: #10b981;
  border-radius: 50%;
  animation: blink 1s infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.2} }

.ticker-score-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}
.ticker-player { text-align: center; flex: 1; }
.ticker-player-name { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.ticker-player-score {
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 900;
  line-height: 1;
  color: #fff;
}
.ticker-divider { font-size: 28px; color: rgba(255,255,255,.3); font-weight: 300; }

/* Set scores row */
.set-scores { display: flex; gap: 8px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.set-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius-md);
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
}
.set-chip.won { background: rgba(99,102,241,.3); border-color: rgba(99,102,241,.5); }

/* ── Gantt/Schedule ───────────────────────────────────────────── */
.gantt-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.gantt-header {
  display: flex;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.gantt-court-col {
  width: 140px;
  flex-shrink: 0;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .7px;
  border-right: 1px solid var(--border);
}
.gantt-time-col {
  flex: 1;
  display: flex;
}
.gantt-time-slot {
  flex: 1;
  padding: 10px 8px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  border-right: 1px solid var(--border);
  white-space: nowrap;
}
.gantt-row {
  display: flex;
  border-bottom: 1px solid var(--border);
  min-height: 72px;
}
.gantt-row:last-child { border-bottom: none; }
.gantt-court-name {
  width: 140px;
  flex-shrink: 0;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
}
.gantt-blocks {
  flex: 1;
  position: relative;
  padding: 8px;
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}
.gantt-block {
  background: linear-gradient(135deg, rgba(99,102,241,.15), rgba(139,92,246,.10));
  border: 1px solid rgba(99,102,241,.3);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 11px;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-width: 90px;
}
.gantt-block:hover { background: rgba(99,102,241,.25); transform: scale(1.02); }
.gantt-block.live { border-color: var(--status-live); background: rgba(16,185,129,.12); }
.gantt-block.completed { opacity: .6; }
.gantt-block-time { font-weight: 700; color: var(--brand-primary); }
.gantt-block-match { color: var(--text-secondary); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }

/* ── Bracket ─────────────────────────────────────────────────── */
.bracket {
  overflow-x: auto;
  padding: 24px 0;
}
.bracket-rounds {
  display: flex;
  gap: 0;
  min-width: max-content;
}
.bracket-round {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  min-width: 200px;
  position: relative;
}
.bracket-round-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .7px;
  text-align: center;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.bracket-match {
  margin: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition-fast);
}
.bracket-match:hover { border-color: var(--brand-primary); box-shadow: var(--glow); }
.bracket-side {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  gap: 8px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.bracket-side:last-child { border-bottom: none; }
.bracket-side.winner {
  background: rgba(99,102,241,.08);
  color: var(--brand-primary);
  font-weight: 700;
}
.bracket-seed {
  font-size: 10px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border-radius: 3px;
  padding: 1px 5px;
  flex-shrink: 0;
}
.bracket-player { flex: 1; }
.bracket-score { font-weight: 700; font-size: 14px; }

/* ── Leaderboard ─────────────────────────────────────────────── */
.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}
.leaderboard-row:hover { background: var(--bg-elevated); }
.leaderboard-row.top-3 { background: rgba(99,102,241,.04); }
.leaderboard-pos {
  width: 32px;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  flex-shrink: 0;
}
.leaderboard-pos.gold   { color: var(--medal-gold); }
.leaderboard-pos.silver { color: var(--medal-silver); }
.leaderboard-pos.bronze { color: var(--medal-bronze); }
.leaderboard-info { flex: 1; }
.leaderboard-name { font-size: 14px; font-weight: 600; }
.leaderboard-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.leaderboard-stats {
  display: flex;
  gap: 16px;
  text-align: right;
}
.lb-stat-val { font-size: 15px; font-weight: 700; font-family: var(--font-display); }
.lb-stat-lbl { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }

/* ── Wizard ──────────────────────────────────────────────────── */
.wizard-steps {
  display: flex;
  align-items: center;
  margin-bottom: 32px;
  overflow-x: auto;
  gap: 0;
}
.wizard-step {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.wizard-step-circle {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border);
  background: var(--bg-surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}
.wizard-step.active .wizard-step-circle {
  background: var(--brand-gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(99,102,241,.4);
}
.wizard-step.done .wizard-step-circle {
  background: var(--success);
  border-color: transparent;
  color: #fff;
}
.wizard-step-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.wizard-step.active .wizard-step-label { color: var(--brand-primary); }
.wizard-step.done .wizard-step-label { color: var(--success); }
.wizard-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 8px;
  min-width: 24px;
}
.wizard-connector.done { background: var(--success); }

/* ── Availability Calendar ───────────────────────────────────── */
.avail-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.avail-day {
  border-radius: var(--radius-md);
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  border: 1.5px solid var(--border);
  transition: all var(--transition-fast);
  font-size: 12px;
  position: relative;
}
.avail-day:hover { border-color: var(--brand-primary); }
.avail-day.available { background: rgba(16,185,129,.06); border-color: rgba(16,185,129,.3); }
.avail-day.unavailable { background: rgba(239,68,68,.06); border-color: rgba(239,68,68,.2); }
.avail-day.has-match {
  background: rgba(99,102,241,.08);
  border-color: var(--brand-primary);
}
.avail-day-num { font-weight: 700; font-size: 14px; }
.avail-day-name { font-size: 9px; color: var(--text-muted); text-transform: uppercase; }
.avail-match-dot {
  width: 6px; height: 6px;
  background: var(--brand-primary);
  border-radius: 50%;
  margin: 4px auto 0;
}

/* ── Notification Panel ──────────────────────────────────────── */
.notif-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 380px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
}
.notif-panel.open { transform: translateX(0); }
.notif-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.notif-header h3 { font-size: 16px; font-weight: 700; }
.notif-list { overflow-y: auto; flex: 1; padding: 8px; }
.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
  margin-bottom: 4px;
}
.notif-item:hover { background: var(--bg-elevated); }
.notif-item.unread { background: rgba(99,102,241,.04); }
.notif-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}
.notif-dot.unread { background: var(--brand-primary); }
.notif-dot.read { background: transparent; border: 1px solid var(--border); }
.notif-icon { font-size: 24px; flex-shrink: 0; }
.notif-content { flex: 1; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.notif-body { font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.notif-time { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(.95) translateY(10px);
  transition: transform var(--transition-base);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-header {
  padding: 24px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}
.modal-close:hover { color: var(--error); border-color: var(--error); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border);
}

/* ── Toast Notifications ─────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 14px 18px;
  min-width: 300px;
  max-width: 400px;
  pointer-events: all;
  animation: toast-in .3s cubic-bezier(.34,1.56,.64,1);
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error   { border-left: 4px solid var(--error); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info    { border-left: 4px solid var(--info); }
.toast-icon { font-size: 20px; flex-shrink: 0; }
.toast-content { flex: 1; }
.toast-title { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.toast-msg { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(100%) scale(0.9); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
.toast-out { animation: toast-out .3s ease forwards; }
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(100%); }
}

/* ── QR Check-in ─────────────────────────────────────────────── */
.qr-container {
  text-align: center;
  padding: 32px;
}
.qr-code {
  display: inline-block;
  padding: 16px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin: 0 auto;
}
.qr-code img { width: 180px; height: 180px; image-rendering: pixelated; }
.qr-label { font-size: 13px; color: var(--text-muted); margin-top: 16px; }
.qr-name { font-size: 18px; font-weight: 700; margin-top: 8px; }

/* ── Auth Pages ──────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.auth-bg-orbs {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .15;
}
.orb-1 { width: 400px; height: 400px; background: #6366f1; top: -100px; right: -100px; }
.orb-2 { width: 300px; height: 300px; background: #ec4899; bottom: -80px; left: -80px; }
.orb-3 { width: 200px; height: 200px; background: #10b981; top: 40%; left: 30%; }

.auth-card {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
}
.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}
.auth-logo-icon {
  width: 56px; height: 56px;
  background: var(--brand-gradient);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  margin: 0 auto 12px;
  box-shadow: 0 8px 24px rgba(99,102,241,.35);
}
.auth-logo-text {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.5px;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.auth-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; text-align: center; }
.auth-subtitle { font-size: 13px; color: var(--text-muted); text-align: center; margin-bottom: 28px; }

/* ── Theme Toggle ────────────────────────────────────────────── */
.theme-toggle {
  width: 52px; height: 28px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  position: relative;
  transition: background var(--transition-base);
}
.theme-toggle.dark { background: var(--brand-primary); border-color: transparent; }
.theme-toggle-knob {
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: var(--radius-full);
  transition: transform var(--transition-base);
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
}
.theme-toggle.dark .theme-toggle-knob { transform: translateX(24px); }

/* ── Skeleton Loader ─────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-elevated) 25%,
    var(--border) 50%,
    var(--bg-elevated) 75%
  );
  background-size: 400% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}
@keyframes shimmer { from{background-position:100% 0} to{background-position:-100% 0} }
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 20px; width: 60%; margin-bottom: 12px; }
.skeleton-card { height: 100px; }

/* ── Offline Banner ──────────────────────────────────────────── */
#offline-banner {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  text-align: center;
  padding: 12px;
  font-weight: 600;
  font-size: 14px;
  z-index: 9999;
  gap: 10px;
  align-items: center;
  justify-content: center;
}
#offline-banner.visible { display: flex; }

/* ── Grid Utilities ──────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-stat { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ── Spacing & Flex ──────────────────────────────────────────── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.p-0   { padding: 0 !important; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }
.font-bold   { font-weight: 700; }
.w-full      { width: 100%; }
.flex-1      { flex: 1; }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Public Tournament Cards ─────────────────────────────────── */
.tournament-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--transition-fast);
  cursor: pointer;
}
.tournament-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: var(--brand-primary);
}
.tournament-card-banner {
  height: 120px;
  background: var(--brand-gradient);
  position: relative;
  overflow: hidden;
}
.tournament-card-banner img { width: 100%; height: 100%; object-fit: cover; }
.tournament-card-sport {
  position: absolute;
  top: 12px; left: 12px;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}
.tournament-card-body { padding: 16px 20px 20px; }
.tournament-card-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.tournament-card-meta { font-size: 12px; color: var(--text-muted); }
.tournament-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 56px; margin-bottom: 16px; opacity: .5; }
.empty-state-title { font-size: 18px; font-weight: 700; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state-text  { font-size: 14px; margin-bottom: 24px; }

/* ── Settings ────────────────────────────────────────────────── */
.settings-section { margin-bottom: 32px; }
.settings-section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.settings-row:last-child { border-bottom: none; }
.settings-row-info { flex: 1; }
.settings-row-label { font-size: 14px; font-weight: 600; }
.settings-row-desc { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ── Scroll bar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── WCAG: Skip Link ─────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -40px; left: 0;
  background: var(--brand-primary);
  color: #fff;
  padding: 8px 16px;
  border-radius: 0 0 var(--radius-md) 0;
  z-index: 9999;
  font-size: 13px;
  font-weight: 600;
  transition: top .2s;
}
.skip-link:focus { top: 0; }

/* ── Mobile Responsive ───────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-stat { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 260px; }

  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-xl); }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; }
  .hamburger { display: flex; }
  .page-content { padding: 16px; }

  .grid-2, .grid-3, .grid-4, .grid-stat { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .ticker-player-score { font-size: 44px; }
  .auth-card { padding: 28px 20px; }
  .live-ticker { padding: 20px; }
  .ticker-score-block { gap: 12px; }
  .notif-panel { width: 100%; }
  .modal { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .wizard-steps { flex-wrap: nowrap; }
  .avail-calendar { grid-template-columns: repeat(7, 1fr); }
}

@media (max-width: 480px) {
  .topbar { padding: 0 16px; gap: 10px; }
  .topbar-title { font-size: 15px; }
  .match-card { flex-direction: column; align-items: flex-start; }
  .match-meta { text-align: left; }
  .leaderboard-stats { gap: 10px; }
  #toast-container { right: 12px; left: 12px; bottom: 80px; }
  .toast { min-width: unset; max-width: 100%; }
  .btn-lg { padding: 12px 20px; font-size: 14px; }
}

/* ── Print ───────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, #toast-container, .btn, .nav-item { display: none !important; }
  .main-content { margin-left: 0; }
  .page-content { padding: 0; }
  body { background: #fff; color: #000; }
}

/* ── Animations ──────────────────────────────────────────────── */
.fade-in {
  animation: fade-in .4s ease;
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.slide-in-right {
  animation: slide-in-right .3s ease;
}
@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── High Contrast / WCAG ─────────────────────────────────────── */
@media (prefers-contrast: high) {
  :root {
    --border: #000;
    --text-muted: #333;
  }
  [data-theme="dark"] {
    --border: #fff;
    --text-muted: #ccc;
  }
  .badge { border: 1px solid currentColor; }
}

/* ── Reduced Motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
