:root {
  --sidebar-w: 260px;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #1d4ed8;
  --primary: #3b82f6;
  --primary-dark: #1d4ed8;
  --accent: #f97316;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #06b6d4;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
  --shadow-lg: 0 4px 24px rgba(0,0,0,.12);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform .25s ease;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-brand {
  padding: 24px 20px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-decoration: none;
}
.sidebar-brand .brand-icon {
  width: 42px; height: 42px;
  background: #fff;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  padding: 4px;
}
.sidebar-brand .brand-icon img {
  width: 100%; height: 100%;
  object-fit: contain;
}
.sidebar-brand .brand-text {
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
}
.sidebar-brand .brand-sub {
  color: rgba(255,255,255,.45);
  font-size: 11px;
  font-weight: 400;
}

.sidebar-section {
  padding: 20px 12px 0;
}
.sidebar-label {
  color: rgba(255,255,255,.3);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 0 8px;
  margin-bottom: 6px;
}
.sidebar-nav { list-style: none; padding: 0; margin: 0 0 8px; }
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all .15s;
}
.sidebar-nav li a i { font-size: 16px; width: 20px; text-align: center; }
.sidebar-nav li a:hover {
  background: var(--sidebar-hover);
  color: #fff;
}
.sidebar-nav li a.active {
  background: var(--sidebar-active);
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,.7);
  font-size: 13px;
}
.sidebar-user .avatar {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-user .user-info { min-width: 0; }
.sidebar-user .user-name { color: #fff; font-weight: 600; font-size: 13px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user .user-role { color: rgba(255,255,255,.4); font-size: 11px; }

/* ── Main Layout ─────────────────────────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 900;
}
.topbar .page-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.topbar .topbar-actions { display: flex; align-items: center; gap: 8px; }

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text);
  cursor: pointer;
  padding: 4px 8px;
}

.main-content {
  padding: 28px 24px;
  flex: 1;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
}
.card-header h5 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
}

/* ── Stat Cards ──────────────────────────────────────────────────────────── */
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.blue   { background: #dbeafe; color: var(--primary); }
.stat-icon.green  { background: #dcfce7; color: var(--success); }
.stat-icon.orange { background: #ffedd5; color: var(--accent); }
.stat-icon.purple { background: #ede9fe; color: #8b5cf6; }
.stat-icon.red    { background: #fee2e2; color: var(--danger); }
.stat-icon.cyan   { background: #cffafe; color: var(--info); }

.stat-info .stat-value {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}
.stat-info .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 3px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  padding: 7px 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .15s;
}
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-danger  { background: var(--danger);  border-color: var(--danger);  color: #fff; }
.btn-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); background: transparent; }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table { margin-bottom: 0; }
.table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  border-top: none;
  border-bottom: 2px solid var(--border);
  padding: 10px 14px;
  background: #f8fafc;
  white-space: nowrap;
}
.table td {
  padding: 12px 14px;
  vertical-align: middle;
  font-size: 13.5px;
  color: var(--text);
  border-color: var(--border);
}
.table tbody tr:hover { background: #f8fafc; }
.table-borderless td, .table-borderless th { border: none; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
}

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
}
.form-control, .form-select {
  border-radius: 8px;
  border: 1.5px solid var(--border);
  font-size: 13.5px;
  padding: 8px 12px;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
textarea.form-control { resize: vertical; min-height: 80px; }
.input-group-text {
  border-radius: 8px 0 0 8px;
  border: 1.5px solid var(--border);
  background: #f8fafc;
  font-size: 13px;
  color: var(--text-muted);
}
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }

/* ── Page Header ─────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-header p {
  color: var(--text-muted);
  font-size: 13px;
  margin: 2px 0 0;
}

/* ── Alerts & Flash ──────────────────────────────────────────────────────── */
.flash-container { position: fixed; top: 72px; right: 20px; z-index: 9999; min-width: 300px; max-width: 420px; }
.alert {
  border-radius: 10px;
  border: none;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-success { background: #f0fdf4; color: #166534; }
.alert-danger   { background: #fef2f2; color: #991b1b; }
.alert-warning  { background: #fffbeb; color: #92400e; }
.alert-info     { background: #f0f9ff; color: #0c4a6e; }

/* ── Match Result Badges ─────────────────────────────────────────────────── */
.result-win  { background: #dcfce7; color: #166534; }
.result-draw { background: #fef9c3; color: #854d0e; }
.result-loss { background: #fee2e2; color: #991b1b; }

/* ── Medical Cert Status ─────────────────────────────────────────────────── */
.cert-valid    { background: #dcfce7; color: #166534; }
.cert-expiring { background: #fef9c3; color: #854d0e; }
.cert-expired  { background: #fee2e2; color: #991b1b; }
.cert-missing  { background: #f1f5f9; color: #64748b; }

/* ── Player Avatar ───────────────────────────────────────────────────────── */
.player-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

/* ── Finance ─────────────────────────────────────────────────────────────── */
.amount-income  { color: var(--success); font-weight: 700; }
.amount-expense { color: var(--danger);  font-weight: 700; }
.balance-positive { color: var(--success); }
.balance-negative { color: var(--danger); }

/* ── Empty State ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 48px; opacity: .3; display: block; margin-bottom: 12px; }
.empty-state h5 { font-size: 16px; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 13.5px; margin-bottom: 20px; }

/* ── Filter Bar ──────────────────────────────────────────────────────────── */
.filter-bar {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-bar .form-control,
.filter-bar .form-select { font-size: 13px; padding: 6px 10px; }
.filter-bar .form-control { max-width: 220px; }
.filter-bar .form-select { max-width: 180px; }

/* ── Calendar ────────────────────────────────────────────────────────────── */
#calendar { font-size: 13px; }
.fc-button { border-radius: 6px !important; font-size: 12px !important; font-weight: 600 !important; }
.fc-button-primary { background-color: var(--primary) !important; border-color: var(--primary) !important; }
.fc-button-primary:hover { background-color: var(--primary-dark) !important; }
.fc-toolbar-title { font-size: 16px !important; font-weight: 700 !important; }
.fc-event { border-radius: 4px !important; font-size: 11.5px !important; font-weight: 600 !important; }

/* ── Setup / Login ───────────────────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  padding: 20px;
}
.auth-card {
  background: #fff;
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.auth-logo {
  width: 64px; height: 64px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  margin: 0 auto 20px;
}
.auth-logo img {
  width: 100%; height: 100%;
  object-fit: contain;
}
.auth-card h2 { font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 6px; }
.auth-card .auth-subtitle { color: var(--text-muted); text-align: center; font-size: 13.5px; margin-bottom: 28px; }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.nav-tabs .nav-link {
  border-radius: 8px 8px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 16px;
  border: 1.5px solid transparent;
}
.nav-tabs .nav-link.active {
  color: var(--primary);
  border-color: var(--border) var(--border) #fff;
  background: #fff;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main-wrapper { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 999;
  }
  .sidebar-overlay.show { display: block; }
}

@media (max-width: 576px) {
  .main-content { padding: 16px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .form-control,
  .filter-bar .form-select { max-width: 100%; }
}

/* ── Utilities ───────────────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted) !important; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.rounded-lg { border-radius: var(--radius) !important; }
.gap-8 { gap: 8px; }
hr { border-color: var(--border); opacity: 1; }
