/* ─── CSS Variables ─── */
:root[data-theme="dark"] {
  --bg:               #0d1b2a;
  --surface:          #1e2d40;
  --surface-2:        #2a3f58;
  --surface-3:        #324d6e;
  --accent-sand:      #f4a22d;
  --accent-sand-h:    #e8901f;
  --accent-sea:       #22d3ee;
  --accent-sea-h:     #06b6d4;
  --text:             #e8f4f8;
  --text-muted:       #7fa8c4;
  --border:           #2e4560;
  --danger:           #f87171;
  --danger-h:         #ef4444;
  --success:          #4ade80;
  --warning:          #fbbf24;
  --shadow:           0 4px 24px rgba(0,0,0,.4);
  --shadow-sm:        0 1px 6px rgba(0,0,0,.3);
}
:root[data-theme="light"] {
  --bg:               #f8f4ef;
  --surface:          #ffffff;
  --surface-2:        #f0ebe3;
  --surface-3:        #e4dbd0;
  --accent-sand:      #d4861a;
  --accent-sand-h:    #b8720f;
  --accent-sea:       #0891b2;
  --accent-sea-h:     #0e7490;
  --text:             #0d1b2a;
  --text-muted:       #5a7a95;
  --border:           #d9cfc4;
  --danger:           #dc2626;
  --danger-h:         #b91c1c;
  --success:          #16a34a;
  --warning:          #d97706;
  --shadow:           0 4px 24px rgba(0,0,0,.1);
  --shadow-sm:        0 1px 6px rgba(0,0,0,.06);
}

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'Manrope', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
img { display: block; max-width: 100%; }

/* ─── Layout ─── */
.app-root { display: contents; }  /* transparent wrapper — doesn't affect flex layout */
.layout { display: flex; min-height: 100vh; }
.main    { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.content { flex: 1; padding: 24px 28px; overflow-y: auto; }

/* ─── Sidebar ─── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.sidebar-logo {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent-sand), var(--accent-sea));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; color: #fff;
  flex-shrink: 0;
}
.logo-text       { font-size: 17px; font-weight: 800; letter-spacing: .02em; }
.logo-text span  { color: var(--accent-sand); }
.nav             { padding: 10px 0; flex: 1; }
.nav-section     {
  padding: 8px 16px 4px;
  font-size: 10px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted);
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px;
  font-size: 14px; font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
  position: relative;
}
.nav-item:hover           { color: var(--text); background: var(--surface-2); }
.nav-item.router-link-active,
.nav-item.active          { color: var(--accent-sand); background: var(--surface-2); font-weight: 600; }
.nav-item.router-link-active::before,
.nav-item.active::before  {
  content: '';
  position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px; background: var(--accent-sand); border-radius: 0 2px 2px 0;
}
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar-user {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
}
.user-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--accent-sand), var(--accent-sea));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.user-name  { font-weight: 600; }
.user-role  { color: var(--text-muted); font-size: 11px; }

/* ─── Topbar ─── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 54px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-shrink: 0;
}
.topbar-title   { font-size: 16px; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ─── Cards ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-header  { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.card-title   { font-size: 15px; font-weight: 700; }
.card-sub     { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ─── Stats grid ─── */
.stats-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.stat-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.stat-val   { font-size: 26px; font-weight: 800; margin-top: 4px; line-height: 1; }
.stat-meta  { font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.c-sand     { color: var(--accent-sand); }
.c-sea      { color: var(--accent-sea); }
.c-success  { color: var(--success); }
.c-danger   { color: var(--danger); }
.c-muted    { color: var(--text-muted); }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 8px; border: none;
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: linear-gradient(135deg, var(--accent-sand), var(--accent-sand-h)); color: #fff; }
.btn-primary:hover:not(:disabled) { opacity: .9; transform: translateY(-1px); }
.btn-sea      { background: var(--accent-sea); color: #0d1b2a; }
.btn-sea:hover:not(:disabled) { background: var(--accent-sea-h); transform: translateY(-1px); }
.btn-ghost    { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--accent-sand); }
.btn-accent-cta { background: var(--accent-sea); color: #0d1b2a; font-weight: 600; }
.btn-accent-cta:hover:not(:disabled) { background: var(--accent-sea-h); transform: translateY(-1px); }
.btn-danger   { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.btn-sm       { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-xs       { padding: 3px 8px;  font-size: 11px; border-radius: 5px; }

/* ─── Badges ─── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
}
.badge-success { background: color-mix(in srgb,var(--success) 15%,transparent); color: var(--success); }
.badge-sand    { background: color-mix(in srgb,var(--accent-sand) 15%,transparent); color: var(--accent-sand); }
.badge-sea     { background: color-mix(in srgb,var(--accent-sea) 15%,transparent); color: var(--accent-sea); }
.badge-muted   { background: var(--surface-2); color: var(--text-muted); }
.badge-danger  { background: color-mix(in srgb,var(--danger) 15%,transparent); color: var(--danger); }

/* ─── Table ─── */
.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  padding: 10px 14px;
  text-align: left; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
tbody td { padding: 10px 14px; vertical-align: middle; }
.score { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ─── Form inputs ─── */
.input, .select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px; font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
  width: 100%;
}
.input:focus, .select:focus { border-color: var(--accent-sea); }
.input::placeholder { color: var(--text-muted); }
.select option { background: var(--surface); color: var(--text); }

/* ─── Schedule grid ─── */
.schedule-grid { display: grid; gap: 8px; }
.sched-header {
  background: var(--surface-2); border-radius: 8px;
  padding: 7px 10px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted); text-align: center;
}
.sched-time {
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.match-cell {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px;
  transition: all .15s; cursor: pointer;
}
.match-cell:hover { border-color: var(--accent-sea); box-shadow: 0 0 0 1px var(--accent-sea); }
.match-cell.done  { border-color: color-mix(in srgb,var(--success) 35%,transparent); }
.match-cell.empty { background: transparent; border-color: transparent; cursor: default; }
.match-teams { font-size: 12px; font-weight: 600; }
.match-score { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 3px; }
.match-score .w   { color: var(--success); }
.match-score .l   { color: var(--danger); }
.match-score .sep { color: var(--text-muted); margin: 0 3px; font-weight: 400; }
.match-pend       { font-size: 16px; color: var(--text-muted); margin-top: 3px; }

/* ─── Tabs ─── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab  {
  padding: 9px 16px; font-size: 13px; font-weight: 600;
  color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: all .15s;
}
.tab:hover  { color: var(--text); }
.tab.active { color: var(--accent-sand); border-bottom-color: var(--accent-sand); }

/* ─── Theme toggle ─── */
.theme-toggle {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 20px; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  transition: all .15s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent-sea); }

/* ─── Misc helpers ─── */
.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.gap-16       { gap: 16px; }
.gap-20       { gap: 20px; }
.wrap         { flex-wrap: wrap; }
.grid-2       { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.mb-4         { margin-bottom: 4px; }
.mb-8         { margin-bottom: 8px; }
.mb-16        { margin-bottom: 16px; }
.mb-20        { margin-bottom: 20px; }
.mb-24        { margin-bottom: 24px; }
.mt-8         { margin-top: 8px; }
.mt-16        { margin-top: 16px; }
.w-full       { width: 100%; }
.text-sm      { font-size: 12px; }
.text-muted   { color: var(--text-muted); }
.fw-bold      { font-weight: 700; }
.fw-800       { font-weight: 800; }

/* ─── Loading / Empty ─── */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-sea);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted); font-size: 14px;
}
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }

/* ─── Alert / Toast ─── */
.alert {
  padding: 10px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 500; margin-bottom: 12px;
}
.alert-error   { background: color-mix(in srgb,var(--danger) 12%,transparent); color: var(--danger); border: 1px solid color-mix(in srgb,var(--danger) 30%,transparent); }
.alert-success { background: color-mix(in srgb,var(--success) 12%,transparent); color: var(--success); border: 1px solid color-mix(in srgb,var(--success) 30%,transparent); }

/* ─── Modal backdrop ─── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 24px; width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.modal-title  { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ─── Login page ─── */
.login-page {
  flex: 1;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 40px;
  width: 100%; max-width: 380px;
  text-align: center;
  box-shadow: var(--shadow);
}
.login-logo   { font-size: 42px; font-weight: 800; margin-bottom: 4px; }
.login-logo span { color: var(--accent-sand); }
.login-sub    { color: var(--text-muted); font-size: 14px; margin-bottom: 32px; }
.login-hint   { margin-top: 20px; font-size: 12px; color: var(--text-muted); }

/* ─── Participant pill (team formation) ─── */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 10px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.pill:hover { border-color: var(--accent-sand); color: var(--accent-sand); }
.pill.female { border-color: color-mix(in srgb,#f9a8d4 40%,transparent); }
.pill .remove { color: var(--text-muted); margin-left: 2px; }
.pill .remove:hover { color: var(--danger); }

.team-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px;
}
.team-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.team-label { font-size: 12px; font-weight: 700; color: var(--accent-sea); text-transform: uppercase; letter-spacing: .05em; }

/* ─── App layout (Vue SPA shell) ─── */
#app { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 50;
}
.sidebar-brand {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.brand-icon {
  background: linear-gradient(135deg, var(--accent-sand), var(--accent-sea));
  border-radius: 8px;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: #fff;
  flex-shrink: 0;
}
.brand-icon.lg { width: 56px; height: 56px; font-size: 20px; border-radius: 14px; }
.brand-text { font-size: 15px; font-weight: 700; }
.sidebar-nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.nav-section-label {
  padding: 14px 20px 4px;
  font-size: 10px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted);
}
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  flex-shrink: 0;
}
.user-info { display: flex; align-items: center; gap: 6px; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main-content {
  flex: 1;
  margin-left: 220px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 54px;
  padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 40;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }
.content-area { flex: 1; padding: 28px; }

/* ─── Page header pattern ─── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 12px; flex-wrap: wrap;
}
.page-header-left, .page-header-right { display: flex; align-items: center; gap: 10px; }

/* ─── Period toggle (Предстоящие / Прошедшие) ─── */
.period-toggle { display: flex; gap: 4px; }
.page-title { font-size: 18px; font-weight: 800; }

/* ─── View toggle (cards / table) ─── */
.view-toggle { display: flex; gap: 4px; }
.icon-btn { padding: 5px 9px !important; font-size: 14px; line-height: 1; }

/* ─── Data table (EventListView table view) ─── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th {
  padding: 9px 12px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.th-sortable {
  cursor: pointer;
  user-select: none;
  transition: background .12s, color .12s;
}
.th-sortable:hover { background: var(--surface-3) !important; color: var(--text); }
.sort-icon { color: var(--text-muted); font-size: 10px; margin-left: 4px; opacity: .7; }
.filter-row td {
  background: var(--surface);
  padding: 5px 8px;
  border-bottom: 2px solid var(--border);
}
.col-filter-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--text);
  outline: none;
  transition: border-color .12s;
}
.col-filter-input::placeholder { color: var(--text-muted); }
.col-filter-input:focus { border-color: var(--accent-sea); }
.data-row { border-bottom: 1px solid var(--border); transition: background .1s; }
.data-row:last-child { border-bottom: none; }
.data-row:hover { background: var(--surface-2); }
.data-row td { padding: 9px 12px; vertical-align: middle; }
.td-id    { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-muted); width: 54px; }
.td-date  { white-space: nowrap; width: 60px; }
.td-time  { white-space: nowrap; width: 54px; }
.td-desc  { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-sport { width: 1px; white-space: nowrap; text-align: center; padding-left: 4px; padding-right: 4px; }
.th-sport { width: 1px; white-space: nowrap; text-align: center; cursor: pointer; padding-left: 4px; padding-right: 4px; }
.sport-emoji { font-size: 1.2em; cursor: default; }
.td-participants { white-space: nowrap; font-variant-numeric: tabular-nums; }
.participant-confirmed { font-weight: 600; color: var(--accent-sea); }
.participant-confirmed.participant-full { color: var(--accent-sand); }
.participant-reserve { font-size: 0.85em; color: var(--text-muted); margin-left: 4px; }
.td-actions { white-space: nowrap; text-align: right; width: 120px; }
.action-icon-btn { min-width: 36px; min-height: 36px; font-size: 1.1em; display: inline-flex; align-items: center; justify-content: center; }
.table-footer {
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 10px 10px;
}

/* ─── Misc helpers missing from above ─── */
.btn-secondary {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--accent-sand); color: var(--accent-sand); }
.btn-icon { padding: 5px 8px; }
.btn-dashed {
  background: transparent;
  border: 2px dashed var(--border);
  color: var(--text-muted);
  width: 100%;
  padding: 12px;
  border-radius: 10px;
}
.btn-dashed:hover { border-color: var(--accent-sand); color: var(--accent-sand); }
.badge-accent { background: color-mix(in srgb,var(--accent-sand) 20%,transparent); color: var(--accent-sand); }
.badge-neutral { background: var(--surface-2); color: var(--text-muted); }
.alert-danger { background: color-mix(in srgb,var(--danger) 12%,transparent); color: var(--danger); border: 1px solid color-mix(in srgb,var(--danger) 30%,transparent); }
.alert-success { background: color-mix(in srgb,var(--success) 12%,transparent); color: var(--success); border: 1px solid color-mix(in srgb,var(--success) 30%,transparent); }
.flex-center { display: flex; align-items: center; justify-content: center; }
.py-8 { padding-top: 32px; padding-bottom: 32px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-accent-sand { color: var(--accent-sand); }
.text-accent-sea  { color: var(--accent-sea); }

/* ─── Events grid ─── */
.events-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.event-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.event-meta { display: flex; align-items: center; gap: 8px; }
.event-id { font-variant-numeric: tabular-nums; }
.event-title { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.event-card-tags   { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.tournament-tabs   { display: flex; gap: 6px; margin-bottom: 20px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.event-card-footer { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.event-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.empty-icon { font-size: 40px; margin-bottom: 10px; }

/* ─── Filter bar ─── */
.filter-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  margin-bottom: 20px;
}
.filter-select,
.filter-input {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px;
  padding: 6px 12px; font-size: 13px;
}
.filter-select { cursor: pointer; }
.filter-input { width: 130px; }
.filter-input::placeholder { color: var(--text-muted); }
.filter-select:focus,
.filter-input:focus { outline: none; border-color: var(--accent-sea); }

/* ─── Login page additions ─── */
.login-title { font-size: 22px; font-weight: 800; margin: 12px 0 4px; }
.login-subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }
.login-widget-wrap { min-height: 56px; display: flex; align-items: center; justify-content: center; }
.btn-login { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }
.login-waiting { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.login-poll-hint {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-muted); font-size: 13px;
}
.login-command-block {
  width: 100%;
  display: flex; flex-direction: column; gap: 6px;
}
.login-command-label { font-size: 11px; color: var(--text-muted); text-align: center; }
.login-command-row {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px;
}
.login-command {
  flex: 1; font-family: monospace; font-size: 13px;
  color: var(--accent-sea); user-select: all;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.spinner-sm {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-sea);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

/* ─── Team formation ─── */
.formation-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  align-items: start;
}
.pool-title { font-size: 14px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.participant-list { display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 260px); overflow-y: auto; }
.participant-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px;
  cursor: grab; transition: all .15s;
  user-select: none;
}
.participant-pill:active { cursor: grabbing; opacity: .8; }
.participant-pill:hover { border-color: var(--accent-sand); }
.participant-pill.in-team { background: var(--surface); }
.pill-name { flex: 1; font-size: 13px; font-weight: 600; }
.pill-rating { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.pill-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 0 2px; line-height: 1; }
.pill-remove:hover { color: var(--danger); }
.empty-pool { padding: 20px 0; text-align: center; }

.teams-area { display: flex; flex-direction: column; gap: 16px; }
.team-name-input {
  background: transparent; border: none; font-size: 14px; font-weight: 700;
  color: var(--text); flex: 1; outline: none; padding: 2px 4px;
  border-bottom: 1px solid transparent; transition: border-color .15s;
}
.team-name-input:focus { border-bottom-color: var(--accent-sea); }
.team-players { display: flex; flex-wrap: wrap; gap: 8px; min-height: 48px; padding: 8px 0 4px; }
.drop-hint {
  padding: 12px; text-align: center; width: 100%;
  border: 2px dashed var(--border); border-radius: 8px; color: var(--text-muted);
}
.add-team-btn { margin-top: 4px; }
.text-danger { color: var(--danger); }

/* ─── Schedule view ─── */
.rounds-list { display: flex; flex-direction: column; gap: 20px; }
.round-title { font-size: 14px; font-weight: 700; margin-bottom: 14px; color: var(--accent-sea); text-transform: uppercase; letter-spacing: .06em; }
.schedule-table { width: 100%; border-collapse: collapse; }
.schedule-table th {
  padding: 8px 12px; text-align: left;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted); background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.schedule-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.schedule-table tr:last-child td { border-bottom: none; }
.schedule-table tr.has-result { background: color-mix(in srgb,var(--success) 5%,transparent); }
.schedule-table tr:hover { background: var(--surface-2); }
.col-team { width: 35%; }
.col-score { width: 100px; text-align: center; }
.col-action { width: 80px; text-align: right; }
.court-cell { width: 60px; }
.team-cell { font-size: 13px; font-weight: 600; }
.team-a { text-align: right; }
.team-b { text-align: left; }
.score-cell { text-align: center; }
.score-display {
  font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums;
  cursor: pointer; color: var(--text-muted); transition: color .15s;
}
.score-display:hover { color: var(--accent-sea); }
.score-display.score-entered { color: var(--text); }
.score-edit { display: flex; align-items: center; gap: 4px; justify-content: center; }
.score-input { width: 52px; text-align: center; padding: 4px 6px; }
.score-sep { font-size: 16px; font-weight: 800; color: var(--text-muted); }
.action-cell { text-align: right; white-space: nowrap; }
.inline-controls { display: flex; align-items: center; gap: 6px; }
.courts-input { width: 56px; padding: 4px 8px; }
.input-sm { padding: 5px 10px; font-size: 13px; }

/* ─── Standings view ─── */
.league-title { font-size: 14px; font-weight: 700; margin-bottom: 14px; color: var(--accent-sea); text-transform: uppercase; letter-spacing: .06em; }
.standings-table { width: 100%; border-collapse: collapse; }
.standings-table th {
  padding: 8px 12px; text-align: left;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted); background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.standings-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.standings-table tr:last-child td { border-bottom: none; }
.standings-table tr:hover { background: var(--surface-2); }
.standings-table tr.place-1 td { background: color-mix(in srgb,var(--accent-sand) 8%,transparent); }
.standings-table tr.place-2 td { background: color-mix(in srgb,var(--text-muted) 6%,transparent); }
.standings-table tr.place-3 td { background: color-mix(in srgb,#cd7f32 6%,transparent); }
.col-place { width: 40px; text-align: center; }
.col-num { width: 56px; text-align: center; }
.place-cell { text-align: center; font-size: 18px; font-variant-numeric: tabular-nums; }
.team-name-cell { font-weight: 600; }
.num-cell { text-align: center; font-variant-numeric: tabular-nums; }
.points-cell { font-weight: 700; }

/* ─── Event detail page ─── */

/* Clickable cards / rows */
.clickable { cursor: pointer; }
.clickable:hover { box-shadow: 0 0 0 2px var(--accent-sea); }
.event-card.clickable:hover { border-color: var(--accent-sea); }

/* Page header */
.event-detail-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  margin-bottom: 20px;
}
.event-detail-header-left  { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.event-detail-header-right { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; flex-shrink: 0; }
.event-detail-title { display: flex; flex-direction: column; gap: 2px; }
.event-detail-title h2 { font-size: 17px; font-weight: 800; line-height: 1.2; }
.event-badges { display: flex; gap: 6px; flex-wrap: wrap; }

/* 3-column layout */
.event-detail-layout {
  display: grid;
  grid-template-columns: 300px minmax(200px, 380px) 300px;
  gap: 16px;
  align-items: start;
  min-height: 0;
}
@media (max-width: 1180px) {
  .event-detail-layout { grid-template-columns: 280px 1fr; }
  .detail-right { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .event-detail-layout { grid-template-columns: 1fr; }
}

/* Shared panel styles */
.detail-left, .detail-middle, .detail-right {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.detail-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted);
  background: var(--surface-2);
}

/* Left: info rows */
.detail-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.detail-section:last-child { border-bottom: none; }
.detail-section-title {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted); margin-bottom: 8px;
}
.detail-row {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 6px; font-size: 13px; line-height: 1.4;
}
.detail-row:last-child { margin-bottom: 0; }
.detail-label {
  flex-shrink: 0; width: 110px;
  font-size: 12px; color: var(--text-muted);
}
.detail-val { flex: 1; font-weight: 500; }
.detail-text { font-size: 13px; line-height: 1.5; color: var(--text); }
.detail-actions { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }

/* Edit form inside left panel */
.detail-edit-form { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 640px) {
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
}

/* Section titles in forms */
.form-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent-sea);
  margin: 24px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.form-section-title:first-child { margin-top: 0; }

/* Format card selector (radio as cards) */
.format-cards {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.format-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.format-card input[type="radio"] { display: none; }
.format-card:hover { border-color: var(--accent-sea); }
.format-card.active {
  border-color: var(--accent-sea);
  background: var(--surface-2);
}
.format-card-icon { font-size: 24px; }
.format-card-label { font-size: 13px; font-weight: 600; color: var(--text); }

/* Radio group (horizontal) */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}
.radio-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}

/* Chip/toggle group */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  padding: 6px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}
.chip:hover { border-color: var(--accent-sea); }
.chip.active {
  background: var(--accent-sea);
  color: #fff;
  border-color: var(--accent-sea);
}

/* Conditional field entrance */
.conditional-field {
  animation: fadeSlideIn .2s ease-out;
}
@keyframes fadeSlideIn {
  from { opacity: 0; max-height: 0; margin: 0; padding: 0; overflow: hidden; }
  to   { opacity: 1; max-height: 200px; }
}

/* ─── Transactions ─── */
.transactions-filters {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 12px 0; margin-bottom: 8px;
}
.transactions-table-wrap { overflow-x: auto; }
.transactions-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.transactions-table th {
  text-align: left; padding: 8px 12px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
.transactions-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.transactions-table tbody tr:hover { background: var(--surface-2); }
.tx-amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.amount-positive { color: #2D9F6F; }
.amount-negative { color: var(--danger); }

.badge-tx-pending { background: #E8891C22; color: #E8891C; }
.badge-tx-completed { background: #2D9F6F22; color: #2D9F6F; }
.badge-tx-failed { background: #D6454522; color: #D64545; }
.badge-tx-cancelled { background: #8B8B8B22; color: #8B8B8B; }

.btn-xs { font-size: 11px; padding: 2px 8px; }

/* Confirm dialog */
.confirm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.confirm-dialog {
  background: var(--surface); border-radius: 12px;
  padding: 24px; min-width: 300px; box-shadow: var(--shadow);
}
.confirm-dialog p { margin-bottom: 16px; font-size: 15px; }
.confirm-actions { display: flex; gap: 8px; justify-content: flex-end; }

.input-sm { padding: 4px 8px; font-size: 13px; }
.select-sm { padding: 4px 8px; font-size: 13px; }

/* ─── Rating ─── */
.rating-filters { display: flex; gap: 8px; padding: 12px 0; }
.rating-table-wrap { overflow-x: auto; }
.rating-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.rating-table th {
  text-align: left; padding: 8px 12px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
.rating-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.rating-row { cursor: pointer; transition: background .1s; }
.rating-row:hover { background: var(--surface-2); }
.rank-cell { font-weight: 700; color: var(--text-muted); }
.rating-value { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.rating-player-name { font-weight: 600; }

/* ─── Drawer ─── */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 100; display: flex; justify-content: flex-end;
}
.drawer-panel {
  width: 400px; max-width: 100%; height: 100%;
  background: var(--surface); overflow-y: auto;
  box-shadow: -4px 0 24px rgba(0,0,0,.3);
  animation: slideInRight .2s ease-out;
}
@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
@media (max-width: 480px) {
  .drawer-panel { width: 100%; }
}
.drawer-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 20px; border-bottom: 1px solid var(--border);
}
.drawer-title { font-size: 18px; font-weight: 700; }

/* History list inside drawer */
.history-list { padding: 8px 0; }
.history-item {
  display: grid;
  grid-template-columns: 60px 1fr auto auto;
  gap: 8px; align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.history-date { color: var(--text-muted); font-size: 12px; }
.history-main { min-width: 0; }
.history-reason { font-weight: 600; }
.history-rating { text-align: right; white-space: nowrap; }
.history-new-rating { font-weight: 700; }
.history-delta {
  font-weight: 700; font-variant-numeric: tabular-nums;
  min-width: 50px; text-align: right;
}
.delta-positive { color: #2D9F6F; }
.delta-negative { color: var(--danger); }
.form-actions { display: flex; gap: 8px; margin-top: 4px; }

/* Participant list */
.participant-list { max-height: 600px; overflow-y: auto; }
.participant-list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .1s;
  font-size: 13px;
}
.participant-list-item:last-child { border-bottom: none; }
.participant-list-item:hover { background: var(--surface-2); }
.participant-list-item.active { background: color-mix(in srgb,var(--accent-sea) 10%,transparent); border-left: 3px solid var(--accent-sea); }
.participant-list-item.is-cancelled { opacity: .5; }
.participant-status-icon { font-size: 15px; flex-shrink: 0; width: 20px; text-align: center; }
.participant-main { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.participant-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.participant-name.guest-name { font-style: italic; opacity: .8; }
.participant-payment { flex-shrink: 0; }

/* Status dots */
.participant-status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--text-muted);
}
.dot-confirmed { background: #2D9F6F; }
.dot-pending_payment { background: #E8891C; }
.dot-reserve { background: #3B82C4; }
.dot-cancelled { background: #8B8B8B; }

/* Inline status select */
.status-select {
  font-size: 11px; padding: 2px 6px; border-radius: 4px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; flex-shrink: 0;
}
.status-confirmed { color: #2D9F6F; border-color: #2D9F6F; }
.status-pending_payment { color: #E8891C; border-color: #E8891C; }
.status-reserve { color: #3B82C4; border-color: #3B82C4; }
.status-cancelled { color: #8B8B8B; border-color: #8B8B8B; }

/* Action bar */
.participant-actions-bar {
  display: flex; gap: 8px; padding: 8px 16px;
  border-bottom: 1px solid var(--border);
}

/* Add participant panel */
.add-participant-panel {
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.add-guest-row { display: flex; gap: 8px; }
.add-guest-row .input { flex: 1; }

/* Delete icon button */
.btn-icon { background: none; border: none; cursor: pointer; padding: 4px; font-size: 14px; opacity: 0; transition: opacity .15s; }
.participant-list-item:hover .btn-icon { opacity: .5; }
.btn-icon:hover { opacity: 1 !important; }
.btn-icon-danger:hover { color: var(--danger); }

/* Right: participant detail */
.detail-right-empty {
  padding: 60px 20px; text-align: center;
  color: var(--text-muted); font-size: 13px;
}
.participant-detail { padding: 14px 16px; }
.participant-detail-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.pd-row {
  display: flex; flex-direction: column; gap: 2px;
  margin-bottom: 10px; font-size: 13px;
}
.pd-label {
  font-size: 10px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .07em;
}
.participant-gender { font-size: 10px; color: var(--text-muted); margin-left: 3px; }
.participant-badge-confirmed      { background: color-mix(in srgb,var(--success) 15%,transparent); color: var(--success); }
.participant-badge-pending_payment { background: color-mix(in srgb,var(--warning) 15%,transparent); color: var(--warning); }
.participant-badge-reserve        { background: color-mix(in srgb,var(--accent-sea) 15%,transparent); color: var(--accent-sea); }
.participant-badge-cancelled      { background: color-mix(in srgb,var(--danger) 12%,transparent); color: var(--danger); }

/* ─── Portal page (public landing) ─── */
.portal-page {
  flex: 1;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px 60px;
}
.portal-hero {
  text-align: center;
  padding: 80px 20px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.portal-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.portal-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.portal-subtitle {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 460px;
  line-height: 1.5;
}
.btn-lg {
  padding: 12px 28px;
  font-size: 15px;
  border-radius: 10px;
}
.portal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 640px;
  margin-bottom: 40px;
}
.portal-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}
.stat-number {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  color: var(--accent-sand);
  margin-bottom: 6px;
}
.portal-upcoming {
  width: 100%;
  max-width: 840px;
}
.portal-section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
}
.portal-events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.portal-event-card {
  padding: 16px;
}
.portal-event-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.portal-event-emoji {
  font-size: 18px;
}
.portal-event-date {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}
.portal-event-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.4;
}
.portal-event-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
@media (max-width: 520px) {
  .portal-stats { grid-template-columns: 1fr; }
  .portal-hero { padding-top: 48px; }
  .portal-title { font-size: 24px; }
}

/* ─── Event create page ─── */
.view-event-create {
  max-width: 600px;
}
.create-form-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

/* ─── Event statistics page ─── */
.event-stats-page { max-width: 1100px; }
.page-heading { font-size: 18px; font-weight: 800; margin-bottom: 20px; }

.stats-filter-bar {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end;
  padding: 16px; margin-bottom: 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
}
.filter-label input[type="checkbox"] { margin: 0; }
.filter-row-inline { display: flex; align-items: center; gap: 6px; }
.filter-sep { color: var(--text-muted); font-size: 13px; }
.period-btns { display: flex; gap: 4px; }
.select-sm { padding: 5px 10px; font-size: 13px; }
.stats-loading { text-align: center; color: var(--text-muted); padding: 60px 0; }

/* Summary cards grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; text-align: center;
}
.stat-val {
  font-size: 22px; font-weight: 800; line-height: 1.1;
  color: var(--accent-sand); margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: 11px; color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
}

/* Stats section */
.stats-section {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px; margin-bottom: 20px;
}
.stats-section-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted); margin-bottom: 14px;
}
.stats-empty { text-align: center; color: var(--text-muted); padding: 40px; font-size: 14px; }

/* Top locations */
.locations-list { display: flex; flex-direction: column; gap: 6px; }
.location-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.location-rank { width: 20px; color: var(--text-muted); font-weight: 600; text-align: right; flex-shrink: 0; }
.location-name { width: 140px; flex-shrink: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.location-bar-bg {
  flex: 1; height: 14px; background: var(--surface-2);
  border-radius: 4px; overflow: hidden; min-width: 60px;
}
.location-bar-fill {
  display: block; height: 100%;
  background: var(--accent-sand); border-radius: 4px;
  transition: width .3s;
}
.location-count { width: 36px; text-align: right; font-weight: 700; color: var(--accent-sand); font-variant-numeric: tabular-nums; flex-shrink: 0; }

/* Chart */
.chart-legend { display: flex; gap: 16px; margin-bottom: 12px; font-size: 12px; color: var(--text-muted); }
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; }
.dot-events { background: var(--accent-sand); }
.dot-participants { background: var(--accent-sea); }

.chart-container { overflow-x: auto; padding-bottom: 4px; }
.chart-bars { display: flex; gap: 4px; align-items: flex-end; min-height: 190px; }
.chart-bar-group { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.chart-bar-pair { display: flex; gap: 2px; align-items: flex-end; height: 168px; }
.chart-bar {
  width: 16px; border-radius: 3px 3px 0 0;
  min-height: 2px; transition: height .3s;
  position: relative;
}
.bar-events { background: var(--accent-sand); }
.bar-participants { background: var(--accent-sea); }
.bar-val {
  position: absolute; top: -16px; left: 50%; transform: translateX(-50%);
  font-size: 9px; font-weight: 700; white-space: nowrap;
  color: var(--text-muted);
}
.chart-label {
  font-size: 10px; color: var(--text-muted); margin-top: 4px;
  white-space: nowrap; text-align: center;
}

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-filter-bar { flex-direction: column; align-items: stretch; }
  .location-name { width: 100px; }
}
