
/* ===== Auction Room Page-level Overrides (from auction_room.html) ===== */
/* Auction room page only - prevents body scrolling inside auction room layout */
body.auction-room { margin: 0; padding: 0; overflow: hidden; height: 100vh; display: flex; flex-direction: column; }

/* Bought players per team in budgets panel */
.budget-team-section { border-bottom: 1px solid var(--border, #333); }
.budget-team-section:last-child { border-bottom: none; }
.budget-item { cursor: pointer; transition: background 0.15s; }
.budget-item:hover { background: rgba(255,255,255,0.04); }
.expand-arrow { font-size: 0.7rem; color: var(--text-muted); transition: transform 0.2s; }
.bought-players-list {
  background: rgba(0,0,0,0.15);
  padding: 4px 0;
}
.bought-player-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  font-size: 0.75rem;
  color: var(--text);
}
.bought-player-name { flex: 1; }
.bought-player-price { color: var(--text-muted); font-variant-numeric: tabular-nums; }
/* ============================================================
   FPL T20 WC 2026 — Master Stylesheet
   All styles consolidated from index.html, auction_room.html
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
  --primary: #1a365d;
  --primary-light: #2b6cb0;
  --primary-gradient: linear-gradient(135deg, #1a365d 0%, #2b6cb0 50%, #4299e1 100%);
  --gold: #f6ad55;
  --silver: #a0aec0;
  --bronze: #dd6b20;
  --warning: #c05621;
  --success: #38a169;
  --success-light: #c6f6d5;
  --danger: #e53e3e;
  --danger-light: #fed7d7;
  --bg: #f7fafc;
  --card-bg: #ffffff;
  --text: #2d3748;
  --text-muted: #718096;
  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

html, body {
  overflow-x: hidden;
}

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ---------- Header ---------- */
header {
  background: var(--primary-gradient);
  color: #fff;
  padding: 20px 24px 0;
  position: relative;
  overflow: visible;
  z-index: 100;
}
header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
header h1 {
  margin: 0 0 8px 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 12px;
}
header h1::before { content: '🏏'; font-size: 32px; }

.header-logo-link { display: flex; align-items: center; text-decoration: none; }
.header-logo { height: 216px; width: auto; object-fit: contain; }

.header-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.header-left { display: flex; align-items: center; gap: 12px; }
.header-controls { display: flex; align-items: center; gap: 16px; }

/* ---------- User Menu ---------- */
.user-info { color: rgba(255,255,255,0.8); font-size: 0.9rem; }
.user-menu { position: relative; }
.menu-trigger {
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  color: white; padding: 8px 10px; border-radius: 6px; cursor: pointer;
  font-size: 1rem; line-height: 1; transition: all 0.2s;
}
.menu-trigger:hover { background: rgba(255,255,255,0.2); }
.menu-dropdown {
  display: none; position: absolute; top: 100%; right: 0; margin-top: 4px;
  background: #1e293b; border: 1px solid rgba(255,255,255,0.2); border-radius: 6px;
  min-width: 180px; z-index: 1000; box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.menu-dropdown.show { display: block; }
.menu-item {
  display: block; padding: 10px 14px; color: white; text-decoration: none;
  font-size: 0.9rem; cursor: pointer; border: none; background: none;
  width: 100%; text-align: left; transition: background 0.2s;
}
.menu-item:hover { background: rgba(255,255,255,0.1); }
.menu-divider { height: 1px; background: rgba(255,255,255,0.1); margin: 4px 0; }

/* ---------- Hamburger Button (hidden on desktop) ---------- */
.hamburger-btn {
  display: none; /* shown only on mobile via media query */
  flex-direction: column; justify-content: center; align-items: center;
  gap: 5px; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px; padding: 8px 9px; cursor: pointer; transition: background 0.2s;
}
.hamburger-btn:hover { background: rgba(255,255,255,0.2); }
.hamburger-btn span {
  display: block; width: 20px; height: 2px; background: #fff; border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Nav Tabs ---------- */
nav.tabs { display: flex; gap: 4px; margin-top: 16px; flex-wrap: wrap; }
.tab-btn {
  background: rgba(255,255,255,0.1); border: none; color: rgba(255,255,255,0.8);
  padding: 12px 20px; cursor: pointer; font-size: 14px; font-weight: 500;
  transition: all 0.3s ease; border-radius: 8px 8px 0 0; position: relative;
  white-space: nowrap;
}
.tab-btn:hover { background: rgba(255,255,255,0.2); color: #fff; }
.tab-btn.active { background: var(--bg); color: var(--primary); }
#back-to-tournament-btn { background: rgba(255,255,255,0.05); border-left: 2px solid var(--primary); border-radius: 0; font-size: 13px; padding: 12px 16px; }

/* ---------- Main Content ---------- */
main { padding: 24px; max-width: 1400px; margin: 0 auto; width: 100%; position: relative; overflow-x: hidden; }
.tab-content { display: none; animation: fadeIn 0.3s ease; }
.tab-content.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

footer {
  padding: 20px 24px; color: var(--text-muted); border-top: 1px solid var(--border);
  text-align: center; font-size: 14px;
}

/* ---------- Section Headings ---------- */
h2 {
  font-size: 24px; font-weight: 700; color: var(--primary); margin: 0 0 20px 0;
  display: flex; align-items: center; gap: 10px;
}
h2::before {
  content: ''; width: 4px; height: 24px; background: var(--primary-gradient);
  border-radius: 2px; flex-shrink: 0;
}

/* ---------- Modal Overlays ---------- */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6); z-index: 2000; justify-content: center; align-items: center;
}
.modal-overlay.show { display: flex; }
.modal-content {
  background: #1e293b; padding: 24px; border-radius: 12px; width: 90%; max-width: 400px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.modal-content h3 { margin-bottom: 16px; color: white; }
.modal-content input {
  width: 100%; padding: 10px; margin-bottom: 12px; border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.2); background: #0d1117; color: white; font-size: 1rem;
}
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.modal-btn { padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 0.9rem; border: none; }
.modal-btn.primary { background: #2563eb; color: white; }
.modal-btn.secondary { background: rgba(255,255,255,0.1); color: white; }

/* Page Modal (for in-page modals) */
.page-modal {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5); z-index: 1000; justify-content: center; align-items: center;
}
.page-modal.active { display: flex; }
.page-modal .pm-content {
  background: var(--card-bg); border-radius: 12px; padding: 24px;
  min-width: min(420px, 90vw); max-width: 90%; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.page-modal .pm-content h3 { margin: 0 0 20px 0; color: var(--primary); }

/* ---------- Shared Utility Classes ---------- */
.btn {
  padding: 10px 20px; border: none; border-radius: 8px; cursor: pointer;
  font-weight: 600; font-size: 0.9rem; transition: transform 0.1s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary-gradient); color: white; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: #e53e3e; color: white; }
.btn-danger:hover { background: #c53030; }
.btn-success { background: var(--success); color: white; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state h3 { color: var(--text); margin-bottom: 8px; }
.inner-container { max-width: 1200px; margin: 24px auto; padding: 0; }
.content-card { background: var(--card-bg); border-radius: 12px; padding: 24px; box-shadow: var(--shadow); margin-bottom: 24px; }
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.top-bar h2 { margin: 0; }

/* ---------- Form Controls ---------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; color: var(--text-muted); font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: 1rem; box-sizing: border-box;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary-light);
}
.form-group small { color: var(--text-muted); font-size: 0.75rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }

/* ---------- Alert ---------- */
.alert { padding: 16px; border-radius: 8px; margin-bottom: 20px; }
.alert-success { background: rgba(16,185,129,0.1); color: var(--success); border: 1px solid var(--success); }
.alert-error { background: rgba(239,68,68,0.1); color: var(--danger); border: 1px solid var(--danger); }

/* ---------- Status Badges ---------- */
.status-badge {
  display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 0.75rem;
  font-weight: 600; text-transform: uppercase; margin-top: 8px;
}
.status-pending { background: rgba(113,128,150,0.15); color: var(--text-muted); }
.status-active { background: rgba(56,161,105,0.15); color: var(--success); }
.status-paused { background: rgba(246,173,85,0.2); color: var(--warning); }
.status-completed { background: rgba(43,108,176,0.15); color: var(--primary-light); }

/* ---------- Table Scroll ---------- */
.table-scroll-wrapper {
  overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px;
}
.table-scroll-wrapper::-webkit-scrollbar { height: 6px; }
.table-scroll-wrapper::-webkit-scrollbar-track { background: var(--border); border-radius: 3px; }
.table-scroll-wrapper::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }


/* ===========================================================
   TOURNAMENT SELECTOR (Landing Page)
   =========================================================== */
.tournament-selector {
  max-width: 1000px; margin: 0 auto; padding: 40px 0;
}
.tournament-selector h2 { justify-content: center; font-size: 28px; margin-bottom: 32px; }
.tournament-selector h2::before { display: none; }
.tournament-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px;
}
.tournament-select-card {
  background: var(--card-bg); border: 2px solid var(--border); border-radius: 12px;
  padding: 0; overflow: hidden; cursor: pointer; transition: all 0.3s ease;
  box-shadow: var(--shadow);
}
.tournament-select-card:hover {
  border-color: var(--primary-light); transform: translateY(-4px); box-shadow: var(--shadow-lg);
}
.tournament-select-card.active {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.2);
}
.tournament-select-card .card-img {
  width: 100%; height: 160px; object-fit: cover; background: var(--primary-gradient);
  display: flex; align-items: center; justify-content: center; font-size: 3rem; color: white;
}
.tournament-select-card .card-img img {
  width: 100%; height: 100%; object-fit: cover;
}
.tournament-select-card .card-body { padding: 20px; }
.tournament-select-card .card-body h3 { margin: 0 0 8px; color: var(--primary); font-size: 1.15rem; }
.tournament-select-card .card-body .tmeta { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 4px; }

.tournament-settings { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.setting-toggle { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--text-muted); cursor: pointer; }
.setting-toggle input[type="checkbox"] { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }

/* Toggle row with Start/Stop buttons */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.82rem; color: var(--text-muted); }
.toggle-btn { padding: 4px 14px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text-muted); font-size: 0.78rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.toggle-btn:hover { border-color: var(--primary); color: var(--primary); }
.toggle-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.toggle-btn.active:hover { background: #c0392b; border-color: #c0392b; color: #fff; }
.phase-badge { font-size: 0.78rem; font-weight: 600; color: var(--success); }
.phase-badge.completed { color: var(--success); }

/* Status badge variants for computed status */
.status-badge.status-upcoming { background: var(--border); color: #4a5568; }
.status-badge.status-auction-pending { background: #fefcbf; color: #975a16; }
.status-badge.status-auction-live { background: #fed7d7; color: #9b2c2c; }
.status-badge.status-trading-open { background: #c6f6d5; color: #276749; }
.status-badge.status-trading-closed { background: var(--border); color: #4a5568; }
.status-badge.status-started { background: #bee3f8; color: #2a4365; }
.status-badge.status-completed { background: #c6f6d5; color: #276749; }

/* Auction players section on home */
.auction-players-section { margin: 24px 0; }
.auction-players-section h3 { margin-bottom: 12px; }
.auction-teams-grid { display: flex; flex-direction: column; gap: 8px; }
.team-auction-detail { background: var(--card-bg); border-radius: 8px; border: 1px solid var(--border); overflow: hidden; }
.team-auction-detail summary { padding: 12px 16px; cursor: pointer; font-size: 0.95rem; }
.team-auction-detail summary:hover { background: var(--bg); }
.team-auction-detail .table-scroll-wrapper { padding: 0 16px 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.team-auction-detail .players-table { min-width: 560px; }
.team-auction-detail.unsold { opacity: 0.7; }

/* Auto-filled fields (readonly appearance) */
.auto-filled { background: var(--bg) !important; opacity: 0.8; pointer-events: none; }


/* ===========================================================
   STANDINGS TABLE
   =========================================================== */
.standings-table { margin: 24px 0; background: var(--card-bg); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.standings-table table { width: 100%; border-collapse: collapse; }
.standings-table th {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff; padding: 14px 16px; text-align: left; font-weight: 600; font-size: 13px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.standings-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.standings-table tr:last-child td { border-bottom: none; }
.standings-table tr:hover { background: var(--bg); }
.standings-table tr.rank-1 td:first-child,
.standings-table tr.rank-2 td:first-child,
.standings-table tr.rank-3 td:first-child { position: relative; padding-left: 32px; }
.standings-table tr.rank-1 td:first-child::before { content: '🥇'; position: absolute; left: 8px; top: 50%; transform: translateY(-50%); }
.standings-table tr.rank-2 td:first-child::before { content: '🥈'; position: absolute; left: 8px; top: 50%; transform: translateY(-50%); }
.standings-table tr.rank-3 td:first-child::before { content: '🥉'; position: absolute; left: 8px; top: 50%; transform: translateY(-50%); }
.standings-table tr.rank-1 { background: linear-gradient(90deg, rgba(246,173,85,0.15) 0%, transparent 100%); }
.standings-table tr.rank-2 { background: linear-gradient(90deg, rgba(160,174,192,0.15) 0%, transparent 100%); }
.standings-table tr.rank-3 { background: linear-gradient(90deg, rgba(221,107,32,0.1) 0%, transparent 100%); }
.standings-table tr.valid td:nth-child(4) { color: var(--success); font-weight: 600; }
.standings-table tr.invalid td:nth-child(4) { color: var(--danger); font-weight: 600; }
.standings-table tr.invalid { background: var(--danger-light) !important; }


/* ===========================================================
   AWARDS GRID
   =========================================================== */
.awards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin: 24px 0; }
.award-card {
  background: var(--card-bg); padding: 24px; border-radius: 12px; box-shadow: var(--shadow);
  transition: all 0.3s ease; position: relative; overflow: hidden;
}
.award-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--primary-gradient); }
.award-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.award-card.winner::before { background: linear-gradient(90deg, #f6ad55, #ed8936); }
.award-card.second::before { background: linear-gradient(90deg, #a0aec0, #718096); }
.award-card.third::before { background: linear-gradient(90deg, #dd6b20, #c05621); }
.award-card.mvp::before { background: linear-gradient(90deg, #9f7aea, #805ad5); }
.award-card.batter::before { background: linear-gradient(90deg, #48bb78, #38a169); }
.award-card.bowler::before { background: linear-gradient(90deg, #4299e1, #3182ce); }
.award-card h3 { margin: 0 0 12px 0; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.award-card .icon { font-size: 28px; margin-bottom: 8px; }
.award-card .value { margin: 0; font-size: 18px; font-weight: 700; color: var(--text); line-height: 1.3; }
.award-card .cash { margin: 10px 0 0; font-size: 14px; color: var(--success); font-weight: 600; display: flex; align-items: center; gap: 4px; }
.award-card .cash::before { content: '💰'; }


/* ===========================================================
   TEAM DETAIL
   =========================================================== */
.team-detail-box { background: var(--card-bg); padding: 24px; border-radius: 12px; box-shadow: var(--shadow); }
.team-detail-box h3 { margin: 0 0 16px 0; font-size: 20px; color: var(--primary); }
.team-detail-box p { margin: 8px 0; font-size: 15px; }
#team-select {
  padding: 12px 16px; font-size: 15px; border: 2px solid var(--border); border-radius: 8px;
  background: var(--card-bg); min-width: 280px; cursor: pointer; transition: border-color 0.2s;
}
#team-select:focus { outline: none; border-color: var(--primary-light); }
.nations-breakdown { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 16px; }
.nation-tag {
  background: linear-gradient(135deg, #ebf4ff 0%, #e2e8f0 100%); padding: 4px 10px;
  border-radius: 20px; font-size: 12px; font-weight: 500; color: var(--primary); white-space: nowrap;
}


/* ===========================================================
   PLAYERS TABLE
   =========================================================== */
.players-table { width: 100%; border-collapse: collapse; margin-top: 16px; border-radius: 8px; overflow: hidden; }
.players-table th { background: var(--primary); color: #fff; padding: 12px 14px; text-align: left; font-weight: 600; font-size: 13px; }
.players-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.players-table tr:last-child td { border-bottom: none; }
.players-table tr:nth-child(even) { background: var(--bg); }
.players-table tr:hover { background: #edf2f7; }
.player-name-cell:hover { text-decoration: underline; }


/* ===========================================================
   BEST XI SECTION
   =========================================================== */
.bestxi-section, .awards-section, .teams-section, .scoring-section, .matches-section, .analytics-section, .replacements-section { max-width: 1200px; }
.rules-info {
  background: linear-gradient(135deg, #ebf4ff 0%, #e9d8fd 100%); padding: 20px;
  border-radius: 12px; border-left: 4px solid var(--primary-light); margin-bottom: 24px;
}
.rules-info h4 { margin: 0 0 12px 0; color: var(--primary); font-size: 16px; }
.rules-info ul { margin: 0; padding-left: 20px; }
.rules-info li { margin: 8px 0; font-size: 14px; color: var(--text); }

.bestxi-box {
  background: var(--card-bg); padding: 24px; border-radius: 12px; box-shadow: var(--shadow);
  border-left: 4px solid var(--success); margin-top: 24px;
}
.bestxi-box h3 { margin: 0 0 16px 0; color: var(--success); font-size: 20px; display: flex; align-items: center; gap: 8px; }
.bestxi-box h3::before { content: '✅'; }
.bestxi-box .highlight { font-size: 28px; font-weight: 800; color: var(--success); background: var(--success-light); padding: 4px 12px; border-radius: 6px; }
.bestxi-box.error { border-left-color: var(--danger); }
.bestxi-box.error h3 { color: var(--danger); }
.bestxi-box.error h3::before { content: '❌'; }
.bestxi-box .error-msg { color: var(--danger); }
.bestxi-table th { background: var(--success) !important; }
.bestxi-details { margin-top: 24px; }
.team-bestxi-detail { background: var(--card-bg); border-radius: 12px; margin: 12px 0; box-shadow: var(--shadow); overflow: hidden; }
.team-bestxi-detail summary {
  padding: 16px 20px; cursor: pointer; background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
  font-weight: 600; display: flex; align-items: center; gap: 8px; transition: background 0.2s;
}
.team-bestxi-detail summary:hover { background: var(--border); }
.team-bestxi-detail summary::before { content: '📋'; }
.team-bestxi-detail[open] summary { border-bottom: 1px solid var(--border); }
.team-bestxi-detail .detail-content { padding: 16px 20px; }
.team-bestxi-detail .detail-content .table-scroll-wrapper { margin: 0; padding: 0; }
.team-bestxi-detail .players-table { margin: 0; width: 100%; min-width: 400px; }


/* ===========================================================
   SCORING & IMPORT
   =========================================================== */
.scoring-info { background: var(--card-bg); padding: 24px; border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 24px; }
.scoring-info h3 { margin: 0 0 16px 0; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.scoring-info h3::before { content: '📊'; }
.scoring-info ul { margin: 12px 0; padding-left: 24px; }
.scoring-info li { margin: 8px 0; }
.scoring-info a { color: var(--primary-light); text-decoration: none; font-weight: 500; }
.scoring-info a:hover { text-decoration: underline; }

.auto-refresh-section {
  background: linear-gradient(135deg, #f0fff4 0%, #c6f6d5 100%); padding: 24px;
  border-radius: 12px; border-left: 4px solid var(--success); margin-bottom: 24px;
}
.auto-refresh-section h3 { margin: 0 0 16px 0; color: var(--success); display: flex; align-items: center; gap: 8px; }
.auto-refresh-section h3::before { content: '🔄'; }
.auto-refresh-section p { margin: 8px 0; font-size: 14px; }

#manual-refresh-btn {
  padding: 12px 24px; background: var(--success); color: #fff; border: none; border-radius: 8px;
  cursor: pointer; font-size: 15px; font-weight: 600; margin: 12px 0; transition: all 0.2s;
}
#manual-refresh-btn:hover { background: #2f855a; transform: translateY(-2px); }
#manual-refresh-btn:disabled { background: #a0aec0; cursor: not-allowed; transform: none; }

.awards-section {
  background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%); padding: 24px;
  border-radius: 12px; border-left: 4px solid #fc8181; margin-bottom: 24px;
}
.awards-section .top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.awards-section .top-bar h3 { margin: 0; color: #c53030; display: flex; align-items: center; gap: 8px; }
.awards-section .top-bar h3::before { content: '🏆'; }
.awards-controls { display: flex; gap: 8px; }
.awards-description { margin: 12px 0 20px 0; font-size: 14px; color: var(--text-muted); }
.awards-table { width: 100%; border-collapse: collapse; min-width: 800px; }
.awards-table thead { background: #c53030; color: white; }
.awards-table th { padding: 12px 10px; text-align: left; font-weight: 600; border-bottom: 2px solid #9b2c2c; }
.awards-table td { padding: 10px; border-bottom: 1px solid #feb2b2; }
.awards-table tbody tr:hover { background: rgba(252, 129, 129, 0.1); }
.awards-table .award-name-input, .awards-table .award-category-select, .awards-table .award-prize-input,
.awards-table .award-icon-input { padding: 6px 10px; border: 1px solid #feb2b2; border-radius: 6px; font-size: 14px; }
.awards-table .award-rules-input { padding: 6px 10px; border: 1px solid #feb2b2; border-radius: 6px; font-size: 13px; font-family: inherit; }
.awards-table .award-name-input:focus, .awards-table .award-category-select:focus, 
.awards-table .award-prize-input:focus, .awards-table .award-icon-input:focus, .awards-table .award-rules-input:focus {
  outline: none; border-color: #fc8181; box-shadow: 0 0 0 2px rgba(252, 129, 129, 0.1);
}

#awards-status { margin: 16px 0; padding: 12px; border-radius: 8px; font-size: 14px; }

#refresh-status { margin: 16px 0; padding: 12px; border-radius: 8px; font-size: 14px; }
.status-success { background: var(--success-light); color: #276749; }
.status-error { background: var(--danger-light); color: #c53030; }


/* ===========================================================
   MATCH HISTORY
   =========================================================== */
.db-stats {
  background: var(--card-bg); padding: 12px 20px; border-radius: 8px; margin-bottom: 20px;
  font-size: 14px; color: var(--text-muted); display: inline-block; box-shadow: var(--shadow);
}
.db-stats strong { color: var(--primary); }
.match-controls { display: flex; gap: 12px; margin-bottom: 24px; }
#player-search {
  flex: 1; max-width: 300px; padding: 12px 16px; border: 2px solid var(--border);
  border-radius: 8px; font-size: 15px; transition: border-color 0.2s;
}
#player-search:focus { outline: none; border-color: var(--primary); }
#player-search-btn {
  padding: 12px 24px; background: var(--primary-light); color: #fff; border: none;
  border-radius: 8px; cursor: pointer; font-weight: 600; transition: all 0.2s;
}
#player-search-btn:hover { background: var(--primary); }

/* Matches List Layout */
.matches-list-table { margin-bottom: 24px; }
.ml-header, .ml-row {
  display: grid;
  grid-template-columns: 60px 110px 1fr 180px;
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
}
.ml-header {
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: 8px 8px 0 0;
  border-bottom: 2px solid var(--border);
}
.ml-row {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.ml-row:hover { background: var(--bg); }
.ml-row:last-child { border-radius: 0 0 8px 8px; }
.ml-col-id { font-weight: 600; color: var(--primary); text-align: center; }
.ml-col-date { font-size: 0.875rem; color: var(--text-muted); }
.ml-col-teams { font-weight: 600; color: var(--text); }
.ml-col-venue { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.no-data { text-align: center; padding: 40px; color: var(--text-muted); font-style: italic; }
.match-detail-box, .player-history-box { background: var(--card-bg); border-radius: 12px; padding: 24px; box-shadow: var(--shadow); margin-bottom: 24px; }
.match-detail-box h3, .player-history-box h3 { margin: 0 0 16px 0; color: var(--primary); font-size: 18px; }
.top-performers { margin: 16px 0; padding: 16px; background: linear-gradient(135deg, #fef5e7 0%, #fefcbf 100%); border-radius: 8px; }
.top-performers h4 { margin: 0 0 12px 0; font-size: 14px; color: var(--warning); }
.performers-list { display: flex; flex-wrap: wrap; gap: 12px; }
.performer { background: #fff; padding: 6px 12px; border-radius: 20px; font-size: 14px; box-shadow: 0 2px 4px rgba(0,0,0,0.08); }
.match-stats-table td:nth-child(3) { font-weight: 600; color: var(--primary); }
.player-totals { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; padding: 16px; background: linear-gradient(135deg, #e9f5ff 0%, #d1e8ff 100%); border-radius: 8px; }
.total-stat { font-size: 14px; color: var(--text-muted); }
.total-stat strong { color: var(--primary); }
.close-history-btn { float: right; padding: 6px 12px; background: var(--danger); color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 600; transition: background 0.2s; }
.close-history-btn:hover { background: #c53030; }


/* ===========================================================
   ANALYTICS
   =========================================================== */
/* KPI Bar */
.analytics-kpi-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--card-bg);
  padding: 20px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  text-align: center;
  border-top: 3px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi-card.kpi-highlight { border-top-color: var(--success); }
.kpi-card.kpi-accent { border-top-color: var(--primary); }
.kpi-value { font-size: 1.4rem; font-weight: 700; color: var(--text); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* Rows & Card Variants */
.analytics-row { display: flex; gap: 24px; margin-bottom: 24px; }
.analytics-card { background: var(--card-bg); padding: 24px; border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.analytics-card-wide { flex: 1; min-width: 0; }
.analytics-card-half { flex: 1; min-width: 0; }
.analytics-card h3, .full-width-card h3 { margin: 0 0 16px 0; color: var(--primary); font-size: 18px; }
.subtitle { color: var(--text-muted); font-size: 13px; margin-top: -12px; margin-bottom: 16px; }
.full-width-card { background: var(--card-bg); padding: 24px; border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 24px; overflow: hidden; }

/* Chart containers */
.chart-container-inner { position: relative; min-height: 350px; max-height: 400px; }
.chart-container-inner canvas { max-height: 380px; }

/* Team Leaderboard */
.leaderboard-list { display: flex; flex-direction: column; gap: 10px; }
.lb-row { display: grid; grid-template-columns: 40px 1fr 80px; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.lb-row:last-child { border-bottom: none; }
.lb-rank { font-size: 1.1rem; text-align: center; }
.lb-name { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-bar-wrap { background: var(--bg); border-radius: 4px; height: 22px; overflow: hidden; }
.lb-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-light)); border-radius: 4px; transition: width 0.6s ease; }
.lb-pts { font-weight: 700; color: var(--primary); text-align: right; }
.lb-roles { display: none; }
.role-tag { font-size: 0.7rem; background: var(--bg); padding: 2px 6px; border-radius: 10px; color: var(--text-muted); }

/* Top Performers */
.top-performers-list { list-style: none; padding: 0; margin: 0; counter-reset: tp; }
.top-performers-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  counter-increment: tp;
}
.top-performers-list li:last-child { border-bottom: none; }
.top-performers-list li::before {
  content: counter(tp);
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--bg); color: var(--text-muted);
  font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
}
.tp-name { font-weight: 600; color: var(--text); flex: 1; }
.tp-team { font-size: 0.75rem; color: var(--text-muted); width: 80px; }
.tp-secondary { font-size: 0.8rem; color: var(--text-muted); width: 100px; text-align: right; }
.tp-pts { color: var(--primary); min-width: 60px; text-align: right; }

/* Form Lists */
.stat-list { list-style: none; padding: 0; margin: 0; }
.stat-list li { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.stat-list li:last-child { border-bottom: none; }
.stat-info { display: flex; flex-direction: column; }
.p-name { font-weight: 600; color: var(--text); }
.p-team { font-size: 12px; color: var(--text-muted); }
.stat-value { text-align: right; font-size: 14px; }
.form-sub { font-size: 11px; color: var(--text-muted); }
.trend { font-size: 16px; margin-right: 4px; }

/* Match Impact */
.impact-grid { display: flex; flex-direction: column; gap: 8px; }
.impact-card { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--bg); border-radius: 8px; }
.impact-rank { font-size: 1rem; font-weight: 700; color: var(--text-muted); min-width: 28px; text-align: center; }
.impact-info { flex: 1; min-width: 0; }
.impact-player { font-weight: 600; color: var(--text); }
.impact-match { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.impact-stats { font-size: 0.8rem; color: var(--text-muted); min-width: 120px; text-align: right; }
.impact-pts { font-weight: 700; color: var(--primary); min-width: 60px; text-align: right; }

/* Player Comparison */
.comparison-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.comparison-controls select { flex: 1; min-width: 180px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); }
.vs-badge { font-weight: 700; color: var(--text-muted); font-size: 0.9rem; }
.compare-table { display: flex; flex-direction: column; gap: 2px; }
.compare-header, .compare-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; padding: 8px 12px; }
.compare-header { font-weight: 700; color: var(--primary); background: var(--bg); border-radius: 8px 8px 0 0; }
.compare-row { border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.compare-row:last-child { border-bottom: none; }
.compare-label { color: var(--text-muted); font-weight: 500; }
.compare-win { color: var(--success); font-weight: 700; }

/* Table Controls */
.table-controls { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
#stats-search { padding: 10px 16px; border: 1px solid var(--border); border-radius: 6px; flex: 1; min-width: 180px; max-width: 300px; background: var(--bg); color: var(--text); }
#stats-role-filter { padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); }
th.sortable { cursor: pointer; user-select: none; position: relative; padding-right: 24px; }
th.sortable:hover { background: var(--bg); }
th.sortable::after { content: '↕'; position: absolute; right: 8px; color: #a0aec0; font-size: 12px; }
th.sorted-asc::after { content: '↑'; color: var(--primary); }
th.sorted-desc::after { content: '↓'; color: var(--primary); }

/* Role Badges */
.role-badge { display: inline-block; padding: 3px 8px; border-radius: 12px; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.role-batsman { background: #ebf8ff; color: #2b6cb0; }
.role-bowler { background: #fef5e7; color: #c05621; }
.role-allrounder { background: #f0fff4; color: #276749; }
.role-wicketkeeper { background: #faf5ff; color: #6b46c1; }


/* ===========================================================
   AUCTION TAB
   =========================================================== */
.auctions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.auction-item {
  background: var(--bg); border: 2px solid var(--border); border-radius: 12px; padding: 20px;
  transition: border-color 0.2s, box-shadow 0.2s; display: flex; align-items: flex-start; gap: 12px;
}
.auction-item:hover { border-color: var(--primary-light); box-shadow: var(--shadow); }
.auction-item h3 { margin: 0 0 8px 0; color: var(--primary); font-size: 1.1rem; }
.auction-item .meta { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 4px; }
.rules-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.rule-item { background: var(--bg); padding: 16px; border-radius: 8px; text-align: center; }
.rule-item strong { color: var(--primary); display: block; margin-bottom: 4px; }
.rule-item span { color: var(--text); font-size: 1.25rem; font-weight: 600; }
.categories-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.category-pill { background: var(--bg); padding: 8px 16px; border-radius: 20px; font-size: 0.875rem; }
.category-pill strong { margin-right: 4px; }
.rules-list { margin: 0; padding-left: 20px; color: var(--text-muted); columns: 2; column-gap: 24px; }
.rules-list li { margin-bottom: 6px; break-inside: avoid; }


/* ===========================================================
   ADMIN TAB
   =========================================================== */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card-bg); border-radius: 12px; padding: 24px; text-align: center; box-shadow: var(--shadow); transition: transform 0.2s, box-shadow 0.2s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card .value { font-size: 2.5rem; font-weight: 700; color: var(--primary); }
.stat-card .label { color: var(--text-muted); font-size: 0.875rem; margin-top: 4px; }
.users-table { width: 100%; border-collapse: collapse; }
.users-table th, .users-table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border); }
.users-table th { color: var(--text-muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; background: var(--bg); }
.users-table tbody tr:hover { background: var(--bg); }
.role-admin { background: rgba(229,62,62,0.15); color: var(--danger); }
.role-auctioneer { background: rgba(246,173,85,0.2); color: var(--warning); }
.role-team_handler { background: rgba(56,161,105,0.15); color: var(--success); }
.role-viewer { background: rgba(113,128,150,0.15); color: var(--text-muted); }
.action-btn { padding: 6px 12px; border: none; border-radius: 6px; cursor: pointer; font-size: 0.875rem; font-weight: 500; margin-right: 4px; transition: transform 0.1s; }
.action-btn:hover { transform: translateY(-1px); }
.btn-edit { background: var(--primary-light); color: white; }
.btn-delete { background: var(--danger); color: white; }

/* Site settings toggle (admin) */
.setting-label {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  padding: 16px; background: var(--bg); border-radius: 8px;
}
.setting-label input[type="checkbox"] { width: 20px; height: 20px; cursor: pointer; }


/* ===========================================================
   TRADING TAB
   =========================================================== */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 20px; }
.notification-badge { background: var(--danger); color: white; border-radius: 50%; padding: 2px 8px; font-size: 0.75rem; margin-left: 8px; }
.offer-card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 12px; }
.offer-card.pending { border-left: 3px solid var(--gold); }
.offer-card.accepted { border-left: 3px solid var(--success); }
.offer-card.declined { border-left: 3px solid var(--danger); }
.offer-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.offer-status { padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }
.offer-details { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; margin: 12px 0; }
.offer-details .arrow { font-size: 1.5rem; color: var(--text-muted); }
.player-chip { background: var(--card-bg); border: 1px solid var(--border); padding: 8px 12px; border-radius: 6px; text-align: center; }
.player-chip .name { font-weight: 600; }
.player-chip .meta-info { font-size: 0.8rem; color: var(--text-muted); }
.offer-actions { display: flex; gap: 8px; margin-top: 12px; }
.config-panel { background: rgba(37,99,235,0.1); border: 1px solid var(--primary); border-radius: 8px; padding: 16px; margin-bottom: 20px; }
.config-panel h3 { color: var(--primary-light); margin-bottom: 12px; }
.config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.trading-inactive { text-align: center; padding: 48px; color: var(--text-muted); }
.trading-inactive h3 { color: var(--text); margin-bottom: 12px; }
.notification-item { padding: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.notification-item.unread { background: rgba(37,99,235,0.1); border-color: var(--primary); }
.notification-time { font-size: 0.75rem; color: var(--text-muted); }


/* ===========================================================
   TOURNAMENTS TAB & WIZARD
   =========================================================== */
.tournaments-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin-bottom: 24px; }
.tournament-card-item {
  background: var(--card-bg); border-radius: 12px; padding: 20px; box-shadow: var(--shadow);
  border: 2px solid var(--border); transition: all 0.2s; cursor: pointer;
}
.tournament-card-item:hover { border-color: var(--primary-light); }
.tournament-card-item h3 { margin: 0 0 8px; color: var(--primary); }
.tournament-card-item .tmeta { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 4px; }
.tournament-card-item .timg { width: 100%; max-height: 120px; object-fit: cover; border-radius: 8px; margin-bottom: 12px; }

/* Wizard Progress */
.wizard-progress { display: flex; justify-content: space-between; margin-bottom: 32px; position: relative; }
.wizard-progress::before { content: ''; position: absolute; top: 20px; left: 40px; right: 40px; height: 4px; background: var(--border); z-index: 0; }
.wiz-step { display: flex; flex-direction: column; align-items: center; z-index: 1; flex: 1; cursor: pointer; }
.wiz-step .step-num {
  width: 40px; height: 40px; border-radius: 50%; background: var(--card-bg);
  border: 3px solid var(--border); display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--text-muted); margin-bottom: 8px; transition: all 0.3s;
}
.wiz-step.active .step-num { background: var(--primary); border-color: var(--primary); color: white; }
.wiz-step.completed .step-num { background: var(--success); border-color: var(--success); color: white; }
.wiz-step .step-label { font-size: 0.85rem; color: var(--text-muted); text-align: center; }
.wiz-step.active .step-label { color: var(--text); font-weight: 600; }
.wizard-card { background: var(--card-bg); border-radius: 16px; padding: 32px; box-shadow: var(--shadow); }
.wizard-card h2 { margin: 0 0 8px 0; font-size: 1.5rem; }
.wizard-card .subtitle { color: var(--text-muted); margin-bottom: 24px; }
.wizard-nav { display: flex; justify-content: space-between; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); }
.wiz-step-content { display: none; }
.wiz-step-content.active { display: block; }
.rule-section { background: var(--bg); border-radius: 12px; padding: 20px; margin-bottom: 20px; }
.rule-section h3 { margin: 0 0 16px 0; display: flex; align-items: center; gap: 8px; }
.toggle-container { display: flex; align-items: center; gap: 12px; padding: 16px; background: var(--bg); border-radius: 8px; margin-bottom: 20px; }
.toggle-switch { position: relative; width: 52px; height: 28px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--text-muted); border-radius: 28px; transition: 0.3s; }
.toggle-slider::before { content: ''; position: absolute; height: 22px; width: 22px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s; }
.toggle-switch input:checked + .toggle-slider { background: var(--success); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(24px); }
.summary-card { background: var(--bg); border-radius: 12px; padding: 20px; margin-bottom: 20px; }
.summary-card h3 { margin: 0 0 16px 0; color: var(--primary); }
.summary-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.summary-row:last-child { border-bottom: none; }
.summary-label { color: var(--text-muted); }
.summary-value { font-weight: 600; }
.json-preview { max-height: 200px; overflow-y: auto; font-family: monospace; font-size: 0.85rem; background: var(--card-bg); padding: 12px; border-radius: 8px; white-space: pre-wrap; }
.file-upload { border: 2px dashed var(--border); border-radius: 12px; padding: 24px; text-align: center; cursor: pointer; transition: all 0.2s; position: relative; margin-bottom: 16px; }
.file-upload:hover { border-color: var(--primary); background: rgba(99,102,241,0.05); }
.file-upload input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-upload.success { border-color: var(--success); background: rgba(16,185,129,0.1); }
.image-upload { border: 2px dashed var(--border); border-radius: 12px; padding: 32px; text-align: center; cursor: pointer; transition: all 0.2s; position: relative; }
.image-upload:hover { border-color: var(--primary); background: rgba(99,102,241,0.05); }
.image-upload input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.image-upload .preview { max-width: 200px; max-height: 200px; border-radius: 8px; margin: 0 auto; }


/* ===========================================================
   REPLACEMENTS TAB
   =========================================================== */
.section-subtitle { color: var(--text-muted); margin-top: -8px; margin-bottom: 24px; }
.replacement-form-card { margin-bottom: 24px; }
.replacement-form-card .btn { margin-top: 8px; }

/* Legacy replacement form styles (kept for backward compat) */
.replacement-form, .replacements-list {
  background: var(--card-bg); border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 2rem; padding: 0; overflow: hidden;
}
.replacement-form h3, .replacements-list h3 { margin: 0; color: var(--text); background: var(--bg); padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); font-size: 1.1em; }
.replacement-form .form-grid { padding: 2rem 2rem 1rem 2rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.submit-btn {
  background: var(--primary-light); color: white; border: none; padding: 0.75rem 1.5rem;
  border-radius: 6px; font-size: 1rem; cursor: pointer; margin: 0 2rem 2rem 2rem; transition: background 0.2s; display: inline-block;
}
.submit-btn:hover { background: var(--primary); }

/* Replacement history table */
.replacements-table { width: 100%; }
.replacements-table .swap-arrow { color: var(--text-muted); font-weight: bold; text-align: center; }
.replacement-row.status-approved { border-left: 3px solid var(--success); }
.replacement-row.status-rejected { border-left: 3px solid var(--danger); opacity: 0.7; }
.replacement-row.status-pending { border-left: 3px solid #f0ad4e; background: rgba(240,173,78,0.05); }
.replacement-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.replacement-status-badge {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px;
  text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap;
}
.replacement-status-badge.status-approved { background: rgba(40,167,69,0.15); color: var(--success); }
.replacement-status-badge.status-rejected { background: rgba(220,53,69,0.15); color: var(--danger); }
.replacement-status-badge.status-pending { background: rgba(240,173,78,0.2); color: #c88a00; }
.review-info { font-size: 12px; color: var(--text-muted); font-style: italic; }
.replacement-actions { display: flex; gap: 8px; }
.btn-sm { font-size: 12px; padding: 4px 12px; border-radius: 6px; border: none; cursor: pointer; font-weight: 600; }
.btn-approve { background: var(--success); color: #fff; }
.btn-approve:hover { opacity: 0.85; }
.btn-reject { background: var(--danger); color: #fff; }
.btn-reject:hover { opacity: 0.85; }
.message.success { background: rgba(40,167,69,0.1); color: var(--success); padding: 10px 14px; border-radius: 8px; font-weight: 500; margin-bottom: 16px; }
.message.error { background: rgba(220,53,69,0.1); color: var(--danger); padding: 10px 14px; border-radius: 8px; font-weight: 500; margin-bottom: 16px; }
.message.info { background: rgba(240,173,78,0.15); color: #c88a00; padding: 10px 14px; border-radius: 8px; font-weight: 500; margin-bottom: 16px; }
.replacement-date { font-weight: 600; color: var(--text); font-size: 14px; white-space: nowrap; }
.replacement-team { color: var(--text-muted); font-size: 14px; }
.replacement-swap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.player-out { color: var(--danger); text-decoration: line-through; }
.swap-arrow { color: var(--text-muted); font-weight: bold; }
.player-in { color: var(--success); font-weight: 500; }
.replacement-reason { color: var(--text-muted); font-size: 13px; }

/* Player tooltip on hover */
.player-tooltip-wrap { cursor: pointer; border-bottom: 1px dashed currentColor; }
.player-tooltip {
  display: none;
  position: fixed;
  z-index: 10000;
  background: var(--card-bg, #1e1e2e);
  color: var(--text, #e0e0e0);
  border: 1px solid var(--border, #333);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.6;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  pointer-events: none;
  text-decoration: none;
}
.player-tooltip.visible { display: block; }
.player-tooltip strong { font-size: 14px; }

.muted-text { color: var(--text-muted); padding: 16px 0; }


/* ===========================================================
   LOADING
   =========================================================== */
.loading { display: flex; align-items: center; justify-content: center; padding: 40px; color: var(--text-muted); }
.loading::after {
  content: ''; width: 24px; height: 24px; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin-left: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* ===========================================================
   AUCTION ROOM (standalone page)
   =========================================================== */
.auction-room-header {
  background: var(--primary-gradient); color: #fff; padding: 12px 24px;
  display: flex; justify-content: space-between; align-items: center; flex-shrink: 0;
  flex-wrap: wrap; gap: 8px;
}
.auction-header-top {
  display: flex; align-items: center; gap: 16px;
}
.auction-header-bottom {
  display: flex; align-items: center; gap: 16px;
}
.auction-room-header h1 { margin: 0; font-size: 1.25rem; font-weight: 700; display: flex; align-items: center; gap: 12px; }
.auction-room-header h1::before { display: none; }

.back-btn {
  color: white; text-decoration: none; padding: 6px 12px; border-radius: 6px;
  background: rgba(255,255,255,0.15); font-size: 0.9rem; transition: background 0.2s; cursor: pointer;
  border: none;
}
.back-btn:hover { background: rgba(255,255,255,0.25); }
.back-btn:active { background: rgba(255,255,255,0.35); transform: scale(0.98); }

.status-pill {
  padding: 6px 14px; border-radius: 20px; font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; background: rgba(255,255,255,0.2);
}
.status-pill.status-active { background: rgba(56,161,105,0.8); color: #fff; }
.status-pill.status-paused { background: rgba(246,173,85,0.9); color: #333; }
.status-pill.status-completed { background: rgba(43,108,176,0.8); color: #fff; }

.auction-room-content { display: flex; flex: 1; overflow: hidden; background: var(--bg); }

/* Left panel - Player queue */
.left-panel { width: 280px; background: var(--card-bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.panel-header { padding: 16px; border-bottom: 1px solid var(--border); font-weight: 600; display: flex; justify-content: space-between; align-items: center; color: var(--primary); }
.panel-header .count { font-size: 0.75rem; background: var(--primary); color: white; padding: 4px 10px; border-radius: 12px; }
.player-queue { flex: 1; overflow-y: auto; padding: 8px; }
.queue-item { padding: 12px; background: var(--bg); border-radius: 8px; margin-bottom: 8px; cursor: pointer; border: 2px solid transparent; transition: all 0.2s; }
.queue-item:hover { border-color: var(--border); }
.queue-item.current { border-color: var(--primary-light); background: rgba(43,108,176,0.08); }
.queue-item .player-name { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.queue-item .player-meta { font-size: 0.75rem; color: var(--text-muted); }
.category-badge { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 0.625rem; font-weight: 700; text-transform: uppercase; margin-right: 4px; color: white; }
.cat-MARQUEE { background: var(--danger); }
.cat-LIST_A { background: var(--gold); color: #333; }
.cat-LIST_B { background: var(--success); }
.cat-UNCAP { background: var(--text-muted); }
.cat-batsman { background: #2b6cb0; }
.cat-bowler { background: #6b46c1; }
.cat-all-rounder { background: #2c7a7b; }
.cat-wicket-keeper { background: #c05621; }

/* Center panel */
.center-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.auctioneer-panel { padding: 12px 20px; background: rgba(229,62,62,0.08); border-bottom: 1px solid rgba(229,62,62,0.2); flex-shrink: 0; }
.auctioneer-panel h4 { margin: 0 0 10px 0; color: var(--danger); font-size: 0.875rem; }
.auctioneer-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.auctioneer-controls button { padding: 8px 14px; font-size: 0.875rem; font-weight: 500; border: none; border-radius: 6px; cursor: pointer; transition: transform 0.1s; }
.auctioneer-controls button:hover { transform: translateY(-1px); }
.btn-start { background: var(--success); color: white; }
.btn-pause { background: var(--gold); color: #333; }
.btn-randomize { background: var(--text-muted); color: white; }
.btn-import { background: var(--primary-light); color: white; }

.current-player-display { padding: 32px; text-align: center; background: var(--card-bg); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.no-player { color: var(--text-muted); padding: 24px; }
.no-player h3 { color: var(--text); margin-bottom: 8px; }
.current-player-card { max-width: 600px; margin: 0 auto; }
.current-player-card .player-name { font-size: 2rem; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.current-player-card .player-details { font-size: 1rem; color: var(--text-muted); margin-bottom: 16px; }
.bid-display { display: flex; justify-content: center; gap: 20px; margin: 20px 0; flex-wrap: wrap; }
.bid-box { background: var(--bg); border: 2px solid var(--border); border-radius: 12px; padding: 16px 28px; min-width: 140px; }
.bid-box.current-bid { border-color: var(--primary-light); background: rgba(43,108,176,0.08); }
.bid-box .label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.bid-box .amount { font-size: 1.75rem; font-weight: 700; color: var(--primary); }
.bid-box .bidder { font-size: 0.875rem; color: var(--success); margin-top: 4px; font-weight: 500; }
.bidding-controls { display: flex; justify-content: center; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.bid-btn { padding: 12px 28px; font-size: 1rem; font-weight: 600; border: none; border-radius: 8px; cursor: pointer; transition: transform 0.1s, box-shadow 0.2s; }
.bid-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow); }
.bid-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.bid-btn.bid { background: var(--primary-gradient); color: white; }
.bid-btn.sell { background: var(--success); color: white; }
.bid-btn.pass { background: var(--danger); color: white; }

/* Chat / Messages */
.messages-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--card-bg); }
.messages-header { padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600; color: var(--primary); font-size: 0.9rem; }
.messages-list { flex: 1; overflow-y: auto; padding: 12px 16px; }
.auction-msg, .message { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.auction-msg:last-child, .message:last-child { border-bottom: none; }
.auction-msg .sender, .message .sender { font-weight: 600; color: var(--primary); margin-right: 6px; }
.auction-msg .text, .message .text { color: var(--text); }
.auction-msg .time, .message .time { font-size: 0.75rem; color: var(--text-muted); margin-left: 8px; }
.auction-msg.system, .message.system { background: rgba(246,173,85,0.1); padding: 10px 12px; border-radius: 6px; border: none; margin-bottom: 8px; }
.auction-msg.system .text, .message.system .text { color: var(--warning); }
.auction-msg.sold, .message.sold { background: rgba(56,161,105,0.1); padding: 10px 12px; border-radius: 6px; border: none; margin-bottom: 8px; }
.auction-msg.sold .text, .message.sold .text { color: var(--success); font-weight: 600; }
.auction-msg.bid, .message.bid { background: rgba(43,108,176,0.05); padding: 10px 12px; border-radius: 6px; border: none; margin-bottom: 8px; }
.message-input-area { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; background: var(--bg); }
.message-input-area input {
  flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card-bg); color: var(--text); font-size: 0.9rem;
}
.message-input-area input:focus { outline: none; border-color: var(--primary-light); }
.message-input-area button { padding: 10px 20px; background: var(--primary); color: white; border: none; border-radius: 8px; cursor: pointer; font-weight: 500; }

/* Right panel - Team Budgets */
.right-panel { width: 280px; background: var(--card-bg); border-left: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.budgets-list { flex: 1; overflow-y: auto; padding: 8px; }
.budget-item { padding: 12px; background: var(--bg); border-radius: 8px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.budget-item .team-name { font-weight: 600; color: var(--text); }
.budget-item .budget-value { font-weight: 700; color: var(--primary); font-size: 1.1rem; }
.budget-item .player-count { font-size: 0.75rem; color: var(--text-muted); }

/* Rules Modal in auction room */
.rules-modal-overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.7); z-index: 2000; justify-content: center; align-items: center;
}
.rules-modal-overlay.show { display: flex; }
.rules-modal-box {
  background: var(--card-bg); padding: 24px; border-radius: 12px; max-width: 800px;
  max-height: 80vh; overflow-y: auto; margin: 20px; width: 90%;
}


/* ===========================================================
   RESPONSIVE — TABLET (max-width: 1024px)
   =========================================================== */
@media (max-width: 1024px) {
  .awards-grid { grid-template-columns: repeat(3, 1fr); }
  .left-panel, .right-panel { width: 240px; }
}

/* ===========================================================
   RESPONSIVE — MOBILE (max-width: 768px)
   =========================================================== */
@media (max-width: 768px) {
  header { padding: 12px 12px 0; }
  header h1 { font-size: 18px; flex-wrap: wrap; }
  header h1::before { font-size: 22px; }
  .header-logo { height: 100px; }
  .header-top { margin-bottom: 8px; }
  .header-left { gap: 0; }

  /* --- Hamburger & toggle menu --- */
  .hamburger-btn { display: flex; }
  nav.tabs {
    display: none; flex-direction: column; gap: 4px;
    margin: 0; padding: 12px;
    background: linear-gradient(180deg, rgba(26,54,93,0.98) 0%, rgba(43,108,176,0.98) 100%);
    border-radius: 0 0 12px 12px;
    position: fixed; left: 0; right: 0; z-index: 9999;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    max-height: 70vh; overflow-y: auto;
  }
  nav.tabs.open { display: flex; }
  header { position: relative; }
  .tab-btn {
    padding: 12px 16px; font-size: 14px; white-space: nowrap;
    min-height: 44px; border-radius: 8px;
    text-align: left; width: 100%;
  }
  .tab-btn.active {
    background: rgba(255,255,255,0.95); color: var(--primary); font-weight: 700;
  }

  main { padding: 14px; }
  h2 { font-size: 19px; margin-bottom: 16px; }
  .awards-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .award-card { padding: 14px; }
  .award-card .icon { font-size: 22px; }
  .award-card .value { font-size: 15px; }

  /* --- Tables: scrollable with proper containment --- */
  .standings-table, .team-detail-box { border-radius: 8px; overflow: hidden; }
  .standings-table .table-scroll-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0; padding: 0; }
  .standings-table table { width: 100%; min-width: 480px; }
  .standings-table th, .standings-table td { padding: 10px 12px; font-size: 13px; white-space: nowrap; }
  .players-table { min-width: 480px; }
  #analytics-table { min-width: 720px; }
  .players-table th, .players-table td { padding: 10px 12px; font-size: 13px; white-space: nowrap; }
  .table-scroll-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px 4px; position: relative; }

  #team-select { width: 100%; min-width: auto; font-size: 16px; /* prevents iOS zoom */ }
  .rules-info { padding: 14px; }
  .rules-info li { font-size: 13px; }
  .bestxi-box { padding: 14px; }
  .bestxi-box .highlight { font-size: 22px; }
  .team-bestxi-detail summary { padding: 14px 16px; font-size: 14px; min-height: 44px; }

  .scoring-info, .auto-refresh-section { padding: 14px; }
  #manual-refresh-btn, #csv-upload-btn { width: 100%; padding: 14px 20px; min-height: 48px; font-size: 15px; }

  /* --- Match List: 3-col on tablet, hide venue --- */
  .ml-header, .ml-row { grid-template-columns: 50px 90px 1fr; gap: 8px; padding: 10px 12px; min-height: 44px; }
  .ml-col-venue { display: none; }
  .match-stats-table { min-width: 600px; }
  .analytics-row { flex-direction: column; }
  .analytics-kpi-bar { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .lb-row { grid-template-columns: 32px 1fr 60px; gap: 8px; }
  .comparison-controls { flex-direction: column; }
  .comparison-controls select { min-width: 100%; font-size: 16px; }

  .form-row { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .rules-list { columns: 1; }

  /* --- Tournament cards --- */
  .tournament-cards { grid-template-columns: 1fr 1fr; gap: 12px; }
  .tournament-select-card .card-body { padding: 14px; }
  .tournament-select-card .card-body h3 { font-size: 1rem; }

  .wizard-progress { flex-wrap: wrap; gap: 16px; }
  .wizard-progress::before { display: none; }
  .wiz-step { flex: 0 0 calc(50% - 8px); }

  .replacement-history-item { grid-template-columns: 1fr; gap: 8px; }
  .form-row input, .form-row select { max-width: 100%; }

  /* Auction room mobile */
  .auction-room-header { flex-direction: column; align-items: stretch; padding: 10px 16px; gap: 6px; }
  .auction-header-top { justify-content: space-between; gap: 10px; width: 100%; }
  .auction-header-bottom { justify-content: space-between; width: 100%; }
  .auction-room-header h1 { font-size: 1.1rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
  .auction-room-header .header-controls { gap: 12px; flex-shrink: 0; }
  .auction-room-content { flex-direction: column; overflow-y: auto; }
  .left-panel { display: none !important; }
  .role-auctioneer .messages-area { display: none !important; }
  .role-auctioneer .center-panel { flex: none; overflow: visible; }
  .right-panel { width: 100%; max-height: 250px; border-right: none; border-left: none; overflow-y: auto; }
  .role-auctioneer .right-panel { max-height: none; flex: 1; }
  .right-panel { border-top: 1px solid var(--border); }
  .current-player-display { padding: 20px; }
  .current-player-card .player-name { font-size: 1.5rem; }
  .bid-display { gap: 12px; }
  .bid-box { padding: 12px 16px; min-width: 100px; }
  .bid-box .amount { font-size: 1.25rem; }
}

/* ===========================================================
   RESPONSIVE — SMALL PHONE (max-width: 480px)
   =========================================================== */
@media (max-width: 480px) {
  header { padding: 8px 10px 0; }
  header h1 { font-size: 15px; gap: 6px; }
  header h1::before { font-size: 18px; }
  .header-logo { height: 72px; }
  .header-top { margin-bottom: 6px; }
  .header-left { gap: 0; }
  .user-info { font-size: 0.8rem; }

  /* Tabs: inherit from 768px toggle menu, just adjust sizes */
  .tab-btn {
    padding: 10px 14px; font-size: 13px; min-height: 40px;
  }

  main { padding: 10px; }
  h2 { font-size: 17px; gap: 8px; margin-bottom: 12px; }
  h2::before { width: 3px; height: 18px; }

  /* --- Awards: single column, horizontal card layout --- */
  .awards-grid { grid-template-columns: 1fr; gap: 8px; }
  .award-card {
    padding: 12px 14px; display: flex; flex-direction: row; align-items: center; gap: 12px;
  }
  .award-card::before { height: 3px; }
  .award-card .icon { font-size: 24px; margin-bottom: 0; flex-shrink: 0; }
  .award-card .content { flex: 1; min-width: 0; }
  .award-card h3 { margin-bottom: 2px; font-size: 11px; }
  .award-card .value { font-size: 14px; word-break: break-word; }
  .award-card .cash { margin-top: 4px; font-size: 12px; }

  /* --- Tables: full-width scroll, compact cells --- */
  .standings-table { margin: 12px 0; border-radius: 8px; }
  .table-scroll-wrapper { margin: 0 -6px; padding: 0 6px 6px; }
  .team-detail-box { padding: 14px; }
  .standings-table table { min-width: 420px; }
  .standings-table th { padding: 8px 10px; font-size: 11px; letter-spacing: 0.3px; }
  .standings-table td { padding: 10px 10px; font-size: 13px; }
  .players-table { min-width: 400px; }
  #analytics-table { min-width: 680px; }
  .players-table th { padding: 8px 10px; font-size: 11px; }
  .players-table td { padding: 10px 10px; font-size: 13px; }
  .standings-table tr.rank-1 td:first-child,
  .standings-table tr.rank-2 td:first-child,
  .standings-table tr.rank-3 td:first-child { padding-left: 28px; }
  .standings-table tr.rank-1 td:first-child::before,
  .standings-table tr.rank-2 td:first-child::before,
  .standings-table tr.rank-3 td:first-child::before { left: 6px; font-size: 14px; }

  /* --- Team detail --- */
  .team-detail-box h3 { font-size: 17px; }
  .team-detail-box p { font-size: 13px; }
  .rules-info { padding: 12px; margin-bottom: 14px; }
  .rules-info h4 { font-size: 13px; }
  .rules-info ul { padding-left: 16px; }
  .rules-info li { font-size: 12px; margin: 5px 0; }
  .bestxi-box { padding: 12px; margin-top: 14px; }
  .bestxi-box h3 { font-size: 15px; }
  .bestxi-box .highlight { font-size: 20px; padding: 3px 10px; }
  .team-bestxi-detail { margin: 8px 0; border-radius: 10px; }
  .team-bestxi-detail summary { padding: 12px 14px; font-size: 13px; flex-wrap: wrap; min-height: 44px; }
  .team-bestxi-detail .detail-content { padding: 10px; }
  .team-bestxi-detail .players-table { min-width: 380px; }
  .nation-tag { padding: 3px 8px; font-size: 11px; }
  .nations-breakdown { gap: 4px; margin: 6px 0 10px; }

  /* --- Scoring / refresh --- */
  .scoring-info, .auto-refresh-section { padding: 12px; margin-bottom: 14px; }
  .scoring-info h3, .auto-refresh-section h3 { font-size: 14px; }
  .scoring-info p, .auto-refresh-section p { font-size: 12px; }
  .scoring-info ul { padding-left: 16px; }
  .scoring-info li { font-size: 12px; }
  #manual-refresh-btn, #csv-upload-btn { font-size: 14px; padding: 12px 18px; min-height: 44px; }
  #csv-file { padding: 10px; font-size: 13px; }

  /* --- Match list: compact, touch-friendly rows --- */
  .match-controls { flex-direction: column; gap: 8px; }
  #player-search { max-width: none; font-size: 16px; padding: 12px; }
  #player-search-btn { width: 100%; min-height: 44px; }
  .ml-header, .ml-row { grid-template-columns: 36px 72px 1fr; font-size: 0.82rem; padding: 10px 10px; min-height: 44px; }
  .ml-col-venue { display: none; }
  .ml-col-id { font-size: 0.8rem; }
  .ml-col-date { font-size: 0.78rem; }
  .match-detail-box, .player-history-box { padding: 14px; margin-bottom: 14px; }
  .top-performers { padding: 10px; }
  .performers-list { gap: 6px; }
  .performer { font-size: 11px; padding: 4px 10px; }
  .player-totals { padding: 10px; gap: 8px; }
  .total-stat { font-size: 12px; }
  .close-history-btn { float: none; display: block; margin-bottom: 10px; width: auto; min-height: 36px; }

  /* --- Analytics --- */
  .analytics-kpi-bar { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-card { padding: 14px 10px; }
  .kpi-value { font-size: 1.15rem; }
  .kpi-label { font-size: 0.65rem; }
  .lb-row { grid-template-columns: 28px 1fr 50px; gap: 6px; font-size: 0.82rem; }
  .tp-name { font-size: 0.85rem; }
  .tp-team { width: 60px; font-size: 0.7rem; }
  .tp-secondary { width: 70px; font-size: 0.75rem; }
  .chart-container-inner { min-height: 250px; max-height: 300px; }
  .impact-card { padding: 8px 12px; gap: 8px; }
  .impact-stats { min-width: 80px; font-size: 0.75rem; }

  footer { padding: 14px; font-size: 11px; }
  .loading { padding: 20px; font-size: 13px; }

  /* --- Tournament cards --- */
  .tournament-cards { grid-template-columns: 1fr; gap: 12px; }
  .tournament-select-card .card-img { height: 100px; }
  .tournament-select-card .card-body { padding: 12px; }
  .tournament-select-card .card-body h3 { font-size: 0.95rem; }
  .tournament-selector { padding: 20px 0; }
  .tournament-selector h2 { font-size: 22px; margin-bottom: 20px; }
  .wizard-card { padding: 16px; }
  .wizard-card h2 { font-size: 1.2rem; }
  .wiz-step .step-num { width: 32px; height: 32px; font-size: 0.8rem; }
  .wiz-step .step-label { font-size: 0.75rem; }

  /* --- Admin / users table --- */
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 16px; }
  .stat-card .value { font-size: 1.8rem; }
  .users-table th, .users-table td { padding: 8px 6px; font-size: 0.8rem; }
  .action-btn { padding: 5px 8px; font-size: 0.75rem; }

  /* --- Trading --- */
  .offer-details { grid-template-columns: 1fr; gap: 8px; text-align: center; }
  .offer-details .arrow { transform: rotate(90deg); }
  .config-grid { grid-template-columns: 1fr; }

  /* Auction room small phone */
  .auction-room-header { padding: 8px 12px; gap: 6px; }
  .auction-room-header h1 { font-size: 0.95rem; }
  .auction-room-header .back-btn { padding: 4px 10px; font-size: 0.8rem; }
  .auction-room-header .header-controls { font-size: 0.8rem; }
  .auction-header-bottom .status-pill { font-size: 0.75rem; }
  .bid-btn { padding: 10px 16px; font-size: 0.9rem; min-height: 44px; }
}

/* ===== Scoring Rules Table ===== */
.scoring-rules-section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
}

.scoring-rules-section .top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 12px;
}

.scoring-rules-section .top-bar h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--primary, #1a365d);
}

.rules-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.scoring-rules-description {
  color: var(--text-muted);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.scoring-rules-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  font-size: 0.9rem;
}

.scoring-rules-table th,
.scoring-rules-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.scoring-rules-table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--text);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.scoring-rules-table tbody tr:hover {
  background: var(--bg);
}

.scoring-rules-table .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--primary-light, #2b6cb0);
  color: #fff;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
}

.scoring-rules-table input[type="text"],
.scoring-rules-table input[type="number"] {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
}

.scoring-rules-table input[type="text"]:focus,
.scoring-rules-table input[type="number"]:focus,
.scoring-rules-table select:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(43, 108, 176, 0.15);
}

.scoring-rules-table select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  min-width: 140px;
}

.scoring-rules-table .condition-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.scoring-rules-table .condition-cell select.rule-vari {
  min-width: 160px;
}

.scoring-rules-table .condition-cell select.rule-equa {
  min-width: 70px;
}

.scoring-rules-table .condition-cell input.rule-comp {
  width: 80px;
}

.scoring-rules-table .points-cell {
  white-space: nowrap;
}

.scoring-rules-table .points-cell input {
  width: 70px;
  text-align: center;
}

.scoring-rules-table .rule-txt {
  width: 100%;
  max-width: 200px;
}

.scoring-rules-table .btn-sm {
  padding: 4px 8px;
  font-size: 0.8rem;
  border-radius: 4px;
  background: var(--danger-light, #fed7d7);
  color: var(--danger, #e53e3e);
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.scoring-rules-table .btn-sm:hover {
  background: var(--danger);
  color: #fff;
}

@media (max-width: 768px) {
  .scoring-rules-section { padding: 14px; }
  .scoring-rules-table { font-size: 0.8rem; }
  .scoring-rules-table th,
  .scoring-rules-table td { padding: 8px 6px; }
  .scoring-rules-table .condition-cell { flex-direction: column; align-items: flex-start; }
  .scoring-rules-table .condition-cell select,
  .scoring-rules-table .condition-cell input { min-width: unset; width: 100%; }
  .rules-controls { flex-wrap: wrap; }
}

/* ===== Multi-player trade checkbox lists ===== */
.player-checkbox-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px;
  background: var(--bg-card);
}
.player-checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.player-checkbox-item:hover {
  background: var(--bg-hover, rgba(255,255,255,0.05));
}
.player-checkbox-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.player-checkbox-item span {
  font-size: 0.9rem;
}

/* Multi-player trade offer display */
.offer-details.trade-multi {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.trade-side {
  flex: 1;
  min-width: 120px;
}
.trade-side-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.player-chip.compact {
  padding: 4px 8px;
  margin-bottom: 4px;
  font-size: 0.85rem;
}
.player-chip.compact .name {
  font-size: 0.85rem;
}
.player-chip.compact .meta-info {
  font-size: 0.7rem;
}

/* ===== Auction & Trading Rules cards ===== */
.auction-rules-section {
  margin-top: 2rem;
}
.auction-rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}
.rules-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 20px;
}
.rules-card h4 {
  margin: 0 0 12px 0;
  font-size: 1rem;
  font-weight: 600;
}
.rules-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.rules-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rules-field.full-width {
  grid-column: 1 / -1;
}
.rules-field label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  font-weight: 600;
}
.rules-field .rules-value {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
}
.rules-field .rules-value.pre-block {
  font-family: inherit;
  white-space: pre-line;
  font-size: 0.88rem;
  font-weight: 400;
  line-height: 1.5;
  background: var(--bg, rgba(255,255,255,0.03));
  padding: 8px 10px;
  border-radius: 6px;
  margin: 0;
}
.rules-field input,
.rules-field select,
.rules-field textarea {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-input, var(--bg-card));
  color: var(--text-primary);
  font-size: 0.9rem;
}
.rules-field textarea {
  resize: vertical;
}
@media (max-width: 600px) {
  .auction-rules-grid {
    grid-template-columns: 1fr;
  }
  .rules-card-body {
    grid-template-columns: 1fr;
  }
}