:root {
  --ink: #2f293e;
  --muted: #7e768c;
  --line: #e9e4f0;
  --bg: #f5f3f8;
  --panel: #fff;
  --accent: #7156bf;
  --accent-dark: #563c9f;
  --danger: #ba4250;
  --success: #25865f;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: Inter, "Segoe UI", system-ui, sans-serif; color: var(--ink); background: var(--bg); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 18px; background: #2f293e; color: #fff; }
.admin-brand { display: flex; gap: 12px; align-items: center; color: #fff; text-decoration: none; margin-bottom: 30px; }
.admin-brand span:last-child { display: grid; gap: 2px; }
.admin-brand strong { font-size: 18px; }
.admin-brand small { color: #bdb3ce; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: linear-gradient(135deg, #9a7ee4, #684cb5); font-size: 22px; font-weight: 900; box-shadow: 0 10px 24px rgba(15,9,30,.28); }
.brand-mark.large { width: 66px; height: 66px; border-radius: 20px; margin: 0 auto 16px; font-size: 34px; }
.sidebar nav { display: grid; gap: 6px; }
.nav-item { width: 100%; border: 0; border-radius: 12px; padding: 12px 14px; text-align: left; color: #c8bfd6; background: transparent; font-weight: 700; }
.nav-item:hover, .nav-item.active { color: white; background: rgba(255,255,255,.1); }
.sidebar-bottom { margin-top: auto; display: grid; gap: 8px; }
.export-link, .logout-button { min-height: 42px; display: grid; place-items: center; border-radius: 11px; text-decoration: none; font-weight: 700; }
.export-link { color: #fff; background: rgba(255,255,255,.11); }
.logout-button { border: 0; color: #cfc7db; background: transparent; }
.content { min-width: 0; padding: 28px clamp(20px, 4vw, 52px) 50px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.topbar h1 { margin: 3px 0 0; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.04em; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .11em; font-size: 10px; font-weight: 900; }
.preview-link { padding: 10px 14px; border-radius: 11px; color: var(--accent-dark); background: #ece7f7; text-decoration: none; font-weight: 800; font-size: 13px; }
.section { display: grid; gap: 18px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.stat-card, .panel { border: 1px solid var(--line); border-radius: 20px; background: var(--panel); box-shadow: 0 9px 28px rgba(54,42,80,.05); }
.stat-card { min-height: 145px; padding: 20px; display: grid; align-content: center; gap: 6px; }
.stat-card span { color: var(--muted); font-weight: 700; font-size: 13px; }
.stat-card strong { font-size: 34px; letter-spacing: -.04em; }
.stat-card small { color: #9a93a4; }
.panel { padding: 22px; min-width: 0; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.panel-head h2 { margin: 4px 0 0; font-size: 23px; letter-spacing: -.03em; }
.text-button { border: 0; background: transparent; color: var(--accent); font-weight: 800; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 10px 9px; text-align: left; color: #938b9d; text-transform: uppercase; letter-spacing: .07em; font-size: 9px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 9px; border-bottom: 1px solid #f0edf3; vertical-align: top; }
.wide-table { min-width: 1100px; }
.status { display: inline-flex; padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 900; }
.status.finished { color: #247557; background: #e4f4ed; }
.status.rejected { color: #ac4050; background: #fcecef; }
.status.started { color: #81652f; background: #faf2dc; }
.status.scheduled { color: #6753a5; background: #eee9fb; }
.status.active { color: #247557; background: #e4f4ed; }
.status.deleted { color: #777; background: #eee; }
.action-danger { border: 0; background: #fcecef; color: #a83c4a; border-radius: 9px; padding: 7px 9px; font-size: 11px; font-weight: 800; }
.two-column { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 18px; align-items: start; }
.admin-form { display: grid; gap: 14px; }
.admin-form label { display: grid; gap: 7px; color: #665e73; font-size: 12px; font-weight: 800; }
.admin-form input, .admin-form textarea, .admin-form select { width: 100%; border: 1px solid #ddd7e5; border-radius: 12px; background: #fcfbfd; padding: 11px 12px; color: var(--ink); outline: none; }
.admin-form input:focus, .admin-form textarea:focus, .admin-form select:focus { border-color: #886dce; box-shadow: 0 0 0 4px rgba(113,86,191,.1); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.primary-admin { min-height: 46px; border: 0; border-radius: 12px; color: #fff; background: linear-gradient(135deg, #7e63c8, #5e43aa); font-weight: 900; box-shadow: 0 10px 24px rgba(91,64,164,.2); }
.primary-admin:disabled { opacity: .55; cursor: wait; }
.form-message { padding: 10px 12px; border-radius: 11px; color: var(--success); background: #e8f5ef; font-size: 12px; line-height: 1.4; }
.form-message.error { color: var(--danger); background: #fcecef; }
.tournament-list { display: grid; gap: 10px; }
.tournament-item { padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.tournament-item-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.tournament-item h3 { margin: 0 0 5px; font-size: 16px; }
.tournament-item p { margin: 7px 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.tournament-dates { color: #8c8497; font-size: 11px; }
.tournament-actions { display: flex; gap: 7px; margin-top: 10px; flex-wrap: wrap; }
.tournament-actions button { border: 0; border-radius: 9px; padding: 7px 9px; color: #5e49a4; background: #eee9f8; font-size: 11px; font-weight: 800; }
.settings-panel { max-width: 950px; }
.settings-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.full { grid-column: 1 / -1; }
.login-layer { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 50% 0%, #625083, #2f293e 60%); }
.login-card { width: min(100%, 410px); padding: 32px; border-radius: 22px; background: #fff; text-align: center; box-shadow: 0 30px 90px rgba(15,9,30,.4); }
.login-card h1 { margin: 6px 0 10px; font-size: 28px; letter-spacing: -.04em; }
.login-card p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.login-card label { display: grid; gap: 7px; margin: 18px 0 12px; text-align: left; color: #655d72; font-size: 12px; font-weight: 800; }
.login-card input { width: 100%; min-height: 48px; border: 1px solid #ddd6e7; border-radius: 12px; padding: 0 12px; }
code { padding: 2px 5px; border-radius: 5px; background: #f0edf5; }
.empty-note { padding: 30px; text-align: center; color: var(--muted); }
@media (max-width: 980px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 14px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
  .admin-brand { margin: 0; }
  .admin-brand small { display: none; }
  .sidebar nav { display: flex; overflow-x: auto; }
  .nav-item { white-space: nowrap; }
  .sidebar-bottom { margin: 0; display: flex; }
  .export-link, .logout-button { padding: 0 10px; }
  .content { padding: 22px 16px 40px; }
  .two-column { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .sidebar { grid-template-columns: 1fr; }
  .admin-brand { display: none; }
  .sidebar-bottom { display: none; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-grid { grid-template-columns: 1fr; }
  .topbar { align-items: flex-end; }
  .preview-link { font-size: 11px; }
}
@media (max-width: 440px) {
  .stats-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .panel { padding: 16px; }
}
.leaderboard-control { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.leaderboard-control h2 { margin: 4px 0 6px; font-size: 22px; }
.leaderboard-control p { margin: 0; color: var(--muted); font-size: 13px; }
.large-action { padding: 11px 14px; min-height: 44px; }
@media (max-width: 600px) { .leaderboard-control { align-items: stretch; flex-direction: column; } }
