@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;600;700;800&family=Barlow:wght@400;500;600&family=Roboto+Mono:wght@400;600&display=swap');

/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --c-bg:        #f0f4fb;
  --c-surface:   #ffffff;
  --c-nav:       #0e2340;
  --c-navy:      #1a3760;
  --c-blue:      #1a56db;
  --c-blue-lt:   #dbeafe;
  --c-teal:      #0891b2;
  --c-orange:    #f05414;
  --c-orange-lt: #fff1ec;
  --c-text:      #0f172a;
  --c-muted:     #64748b;
  --c-border:    #d9e3f0;
  --c-gold:      #d97706;
  --c-gold-bg:   #fef3c7;
  --c-silver:    #64748b;
  --c-silver-bg: #f1f5f9;
  --c-bronze:    #b45309;
  --c-bronze-bg: #fef9ee;

  /* Province colours */
  --c-val: #c92a2a;
  --c-ali: #1864ab;
  --c-cas: #2b8a3e;

  --radius:  10px;
  --radius-lg: 16px;
  --shadow:  0 1px 3px rgba(0,0,0,.07), 0 4px 12px rgba(0,0,0,.05);
  --shadow-md: 0 2px 8px rgba(0,0,0,.1), 0 8px 24px rgba(0,0,0,.07);
  --transition: 150ms ease;
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Barlow', sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
}
a { color: var(--c-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }

/* ── Typography ─────────────────────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: .01em;
}
h1 { font-size: 2.4rem; }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.2rem; }

.mono {
  font-family: 'Roboto Mono', monospace;
  font-weight: 600;
  letter-spacing: -.02em;
}
.muted { color: var(--c-muted); font-size: .88rem; }
.small { font-size: .82rem; }

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.page {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* ── Navigation ─────────────────────────────────────────────────────────────── */
.site-nav {
  background: var(--c-nav);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,.25);
}
.nav-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 0;
}
.nav-logo {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  color: #fff;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-decoration: none;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-logo span {
  display: inline-block;
  background: var(--c-orange);
  color: #fff;
  border-radius: 4px;
  padding: 1px 7px;
  font-size: .8rem;
  letter-spacing: .06em;
  font-weight: 700;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 28px;
}
.nav-links a {
  color: rgba(255,255,255,.7);
  font-size: .9rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  transition: var(--transition);
  text-decoration: none;
}
.nav-links a:hover { color: #fff; background: rgba(255,255,255,.1); }
.nav-links a.active { color: #fff; background: rgba(255,255,255,.15); }

/* ── Page header ─────────────────────────────────────────────────────────────── */
.page-hero {
  background: linear-gradient(135deg, var(--c-navy) 0%, #1a4480 100%);
  padding: 32px 20px 28px;
  margin-bottom: 24px;
}
.page-hero-inner {
  max-width: 1160px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.page-hero h1 { color: #fff; font-size: 2.2rem; }
.page-hero .hero-sub { color: rgba(255,255,255,.65); font-size: .95rem; margin-top: 4px; }
.hero-back {
  color: rgba(255,255,255,.7);
  font-size: .88rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
  text-decoration: none;
  transition: var(--transition);
}
.hero-back:hover { color: #fff; text-decoration: none; }

/* ── Stat pills ─────────────────────────────────────────────────────────────── */
.stat-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.stat-pill {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  padding: 8px 18px;
  text-align: center;
  min-width: 88px;
}
.stat-pill .num {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.9rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}
.stat-pill .lbl {
  color: rgba(255,255,255,.6);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: 2px;
}

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-body { padding: 20px 24px; }
.card + .card { margin-top: 12px; }

/* ── Filters ────────────────────────────────────────────────────────────────── */
.filter-bar {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.filter-bar input, .filter-bar select {
  border: 1px solid var(--c-border);
  border-radius: 7px;
  padding: 7px 12px;
  font-family: 'Barlow', sans-serif;
  font-size: .9rem;
  color: var(--c-text);
  background: var(--c-bg);
  transition: var(--transition);
  outline: none;
}
.filter-bar input { flex: 1 1 180px; min-width: 140px; height: 36px; box-sizing: border-box; flex-shrink: 0; }
.filter-bar select { flex: 0 1 auto; min-width: 130px; }
.filter-bar input:focus, .filter-bar select:focus {
  border-color: var(--c-blue);
  background: #fff;
  box-shadow: 0 0 0 3px var(--c-blue-lt);
}
.filter-bar input::placeholder { color: var(--c-muted); }

/* sidebar filter variant */
.filter-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.filter-sidebar label {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--c-muted);
  margin-bottom: 2px;
  display: block;
}
.filter-sidebar input, .filter-sidebar select {
  width: 100%;
  border: 1px solid var(--c-border);
  border-radius: 7px;
  padding: 8px 11px;
  font-family: 'Barlow', sans-serif;
  font-size: .9rem;
  color: var(--c-text);
  background: var(--c-bg);
  outline: none;
  transition: var(--transition);
}
.filter-sidebar input:focus, .filter-sidebar select:focus {
  border-color: var(--c-blue);
  background: #fff;
  box-shadow: 0 0 0 3px var(--c-blue-lt);
}
.filter-group { margin-bottom: 4px; }

/* ── Meet cards grid ─────────────────────────────────────────────────────────── */
.meets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.meet-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition), transform var(--transition);
}
.meet-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.meet-card-accent {
  height: 4px;
  width: 100%;
}
.meet-card-body { padding: 16px 18px 18px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.meet-card-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.2;
  color: var(--c-text);
}
.meet-card-meta { color: var(--c-muted); font-size: .83rem; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.meet-card-meta .sep { color: var(--c-border); }
.meet-card-badges { display: flex; gap: 5px; flex-wrap: wrap; }
.meet-card-foot { margin-top: auto; padding-top: 10px; }

/* Province accent colours */
.accent-val { background: var(--c-val); }
.accent-ali { background: var(--c-ali); }
.accent-cas { background: var(--c-cas); }
.accent-other { background: var(--c-muted); }

/* ── Badges / tags ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: .75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-gray   { background: #f1f5f9; color: var(--c-muted); border-color: var(--c-border); }
.badge-blue   { background: var(--c-blue-lt); color: #1d4ed8; border-color: #bfdbfe; }
.badge-orange { background: var(--c-orange-lt); color: var(--c-orange); border-color: #fed7aa; }
.badge-green  { background: #dcfce7; color: #15803d; border-color: #86efac; }
.badge-red    { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }
.badge-val    { background: #ffe3e3; color: var(--c-val); border-color: #fca5a5; }
.badge-ali    { background: #dbeafe; color: var(--c-ali); border-color: #93c5fd; }
.badge-cas    { background: #dcfce7; color: var(--c-cas); border-color: #86efac; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Barlow', sans-serif;
  font-weight: 600;
  font-size: .88rem;
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--c-orange);
  color: #fff;
}
.btn-primary:hover { background: #d4490e; text-decoration: none; color: #fff; }
.btn-secondary {
  background: var(--c-surface);
  color: var(--c-text);
  border: 1px solid var(--c-border);
}
.btn-secondary:hover { background: var(--c-bg); text-decoration: none; border-color: #b0c4e0; }
.btn-ghost {
  background: transparent;
  color: var(--c-blue);
  padding: 6px 10px;
}
.btn-ghost:hover { background: var(--c-blue-lt); text-decoration: none; }
.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-block { width: 100%; justify-content: center; }

/* ── Tables ─────────────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
thead th {
  background: #f8faff;
  color: var(--c-muted);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
  position: static;
}
tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid #f0f4f8;
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8faff; }

/* Rank column */
.rank-cell {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  min-width: 44px;
  text-align: center;
}
.rank-1 { background: var(--c-gold-bg) !important; color: var(--c-gold); }
.rank-2 { background: var(--c-silver-bg) !important; color: var(--c-silver); }
.rank-3 { background: var(--c-bronze-bg) !important; color: var(--c-bronze); }
td.rank-1, td.rank-2, td.rank-3 { font-weight: 700; }

/* Time column */
.time-cell {
  font-family: 'Roboto Mono', monospace;
  font-weight: 600;
  font-size: .9rem;
  color: var(--c-navy);
  white-space: nowrap;
}

/* ── Podium ─────────────────────────────────────────────────────────────────── */
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  padding: 20px 16px 0;
}
.podium-place {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
  max-width: 200px;
}
.podium-block {
  width: 100%;
  border-radius: 8px 8px 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 10px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: rgba(255,255,255,.9);
}
.podium-1 .podium-block { height: 90px; background: linear-gradient(160deg, #f59e0b, #d97706); }
.podium-2 .podium-block { height: 68px; background: linear-gradient(160deg, #94a3b8, #64748b); }
.podium-3 .podium-block { height: 52px; background: linear-gradient(160deg, #d97706, #b45309); opacity: .85; }
.podium-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 2px;
  line-height: 1.2;
}
.podium-time {
  font-family: 'Roboto Mono', monospace;
  font-size: .88rem;
  font-weight: 600;
  color: var(--c-blue);
}
.podium-club { font-size: .75rem; color: var(--c-muted); }
.podium-info { padding: 10px 6px 4px; }

/* ── Event blocks (meet page) ────────────────────────────────────────────────── */
.event-block {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.event-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #f8faff;
  border-bottom: 1px solid var(--c-border);
  gap: 12px;
  cursor: pointer;
  user-select: none;
}
.event-block-head:hover { background: #f0f5ff; }
.event-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--c-text);
}
.event-meta { color: var(--c-muted); font-size: .82rem; margin-top: 1px; }
.event-block-body { padding: 0; }
.event-winner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-gold-bg);
}
.event-winner-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--c-gold);
  width: 28px;
  text-align: center;
}
.event-winner-name {
  font-weight: 600;
  font-size: .95rem;
}
.event-winner-time {
  font-family: 'Roboto Mono', monospace;
  font-weight: 600;
  font-size: .9rem;
  color: var(--c-navy);
  margin-left: auto;
}

/* ── Two-pane layout (search) ────────────────────────────────────────────────── */
.two-pane {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
  align-items: start;
}
.sidebar-panel {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 72px;
}
.sidebar-panel h2 {
  font-size: 1rem;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.main-panel {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.main-panel-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  background: #f8faff;
}
.main-panel-head h2 { font-size: 1.1rem; margin: 0; }
.mode-toggle {
  display: flex;
  gap: 4px;
  background: var(--c-border);
  padding: 3px;
  border-radius: 8px;
}
.mode-toggle a {
  padding: 4px 12px;
  border-radius: 5px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--c-muted);
  text-decoration: none;
  transition: var(--transition);
}
.mode-toggle a.active { background: #fff; color: var(--c-text); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

/* ── Swimmer profile ─────────────────────────────────────────────────────────── */
.athlete-card {
  background: linear-gradient(135deg, var(--c-navy), #1a4480);
  border-radius: var(--radius-lg);
  padding: 28px 28px 24px;
  color: #fff;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.athlete-card::before {
  content: '';
  position: absolute;
  right: -40px;
  top: -40px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
}
.athlete-card::after {
  content: '';
  position: absolute;
  right: 60px;
  bottom: -60px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,.03);
}
.athlete-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .01em;
}
.athlete-sub {
  color: rgba(255,255,255,.65);
  margin-top: 6px;
  font-size: .95rem;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.athlete-sub .dot { color: rgba(255,255,255,.3); }
.athlete-stats {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.athlete-stat {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px;
  padding: 8px 16px;
  text-align: center;
}
.athlete-stat .n {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1;
}
.athlete-stat .l {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: rgba(255,255,255,.55);
  margin-top: 2px;
}

/* ── Club cards ──────────────────────────────────────────────────────────────── */
.clubs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.club-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), transform var(--transition);
}
.club-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.club-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  margin-bottom: 8px;
}
.club-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 10px; }
.club-swimmers {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.club-swimmers a {
  font-size: .78rem;
  color: var(--c-blue);
  background: var(--c-blue-lt);
  border-radius: 20px;
  padding: 2px 8px;
  text-decoration: none;
  transition: var(--transition);
}
.club-swimmers a:hover { background: #bfdbfe; }
/* ── Club cards v2 ─────────────────────────────────────────────────────── */
.clubs-grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }

.club-card-full {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  cursor: default;
}

.club-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.club-rank {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .78rem;
  font-weight: 700;
  color: var(--c-muted);
  letter-spacing: .06em;
  margin-bottom: 2px;
}

.club-points {
  text-align: center;
  background: var(--c-blue-lt);
  border-radius: 8px;
  padding: 6px 12px;
  flex-shrink: 0;
}
.club-pts-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--c-blue);
  line-height: 1;
}
.club-pts-lbl {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--c-muted);
  letter-spacing: .06em;
}

/* Age group blocks inside club card */
.club-age-groups { display: flex; flex-direction: column; gap: 8px; }

.ag-block { }

.ag-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--c-muted);
  margin-bottom: 4px;
}

.ag-swimmers {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.ag-swimmer {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: .76rem;
  color: var(--c-blue);
  background: var(--c-blue-lt);
  border-radius: 4px;
  padding: 2px 6px;
  text-decoration: none;
  transition: background 120ms;
}
.ag-swimmer:hover { background: #bfdbfe; }

.ag-name { }

.ag-more {
  font-size: .72rem;
  color: var(--c-muted);
  padding: 2px 4px;
}

/* Rank badges on swimmers */
.rank-badge {
  font-size: .65rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  line-height: 1;
}
.rank-gold   { background: #fef3c7; color: #d97706; }
.rank-silver { background: #f1f5f9; color: #475569; }
.rank-bronze { background: #fef9ee; color: #b45309; }
.rank-plain  { background: #f0f4fb; color: #64748b; }


/* ── Section heading ─────────────────────────────────────────────────────────── */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}
.section-head h2 { margin: 0; }

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--c-muted);
  font-size: .95rem;
}
.empty-icon { font-size: 2.5rem; margin-bottom: 10px; opacity: .4; }

/* ── Loading ─────────────────────────────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 20px;
  color: var(--c-muted);
  font-size: .95rem;
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--c-border);
  border-top-color: var(--c-blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error ───────────────────────────────────────────────────────────────────── */
.error-card {
  background: #fff5f5;
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  padding: 20px 24px;
  color: #b91c1c;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.25rem; }

  .page { padding: 0 14px 48px; }

  .nav-links { display: none; }
  .nav-inner { height: 50px; }

  .page-hero { padding: 20px 14px 18px; }
  .page-hero h1 { font-size: 1.7rem; }

  .stat-pill .num { font-size: 1.5rem; }
  .stat-pill { padding: 6px 14px; min-width: 70px; }

  .filter-bar { padding: 10px 14px; gap: 8px; }
  .filter-bar input, .filter-bar select { font-size: .85rem; }

  .meets-grid { grid-template-columns: 1fr; gap: 10px; }

  .two-pane { grid-template-columns: 1fr; }
  .sidebar-panel { position: static; }

  .podium { gap: 6px; }
  .podium-1 .podium-block { height: 68px; }
  .podium-2 .podium-block { height: 50px; }
  .podium-3 .podium-block { height: 38px; }

  .athlete-name { font-size: 2rem; }

  .clubs-grid { grid-template-columns: 1fr; }

  table { font-size: .82rem; }
  thead th { padding: 8px 10px; }
  tbody td { padding: 8px 10px; }
}

@media (max-width: 480px) {
  .stat-row { gap: 8px; }
  .stat-pill { padding: 6px 10px; min-width: 60px; }
  .stat-pill .num { font-size: 1.3rem; }
  .page-hero-inner { flex-direction: column; gap: 12px; }
  .athlete-stats { gap: 6px; }
}

.ag-hidden { display: none; }

/* ── New app.js additions ────────────────────────────────────────────────── */

/* Layout */
.main-nav { background:var(--c-navy); color:#fff; padding:0 1rem; height:52px;
  display:flex; align-items:center; position:sticky; top:0; z-index:100;
  box-shadow:0 2px 8px rgba(0,0,0,.2); }
.main-content { min-height:calc(100vh - 52px); }
.nav-inner { display:flex; align-items:center; gap:1rem; width:100%; max-width:1280px; margin:0 auto; }
.nav-links { display:flex; gap:.25rem; margin-left:auto; }
.nav-links a { color:rgba(255,255,255,.75); padding:.35rem .75rem; border-radius:6px;
  font-size:.88rem; font-weight:600; text-decoration:none; transition:all 120ms; }
.nav-links a:hover, .nav-links a.active { background:rgba(255,255,255,.15); color:#fff; }

/* Loading */
.loading-state { text-align:center; padding:3rem; color:var(--c-muted); }
.spinner { display:inline-block; width:28px; height:28px; border:3px solid var(--c-border);
  border-top-color:var(--c-blue); border-radius:50%; animation:spin .7s linear infinite; margin-bottom:.5rem; }
@keyframes spin { to { transform:rotate(360deg); } }

/* Table */
.table-responsive { overflow-x:auto; border-radius:var(--c-radius,8px); }
.data-table { width:100%; border-collapse:collapse; font-size:.85rem; background:#fff;
  box-shadow:0 1px 3px rgba(0,0,0,.06); }
.data-table thead th { background:var(--c-navy); color:#fff; padding:.55rem .9rem;
  font-size:.75rem; font-weight:700; text-transform:uppercase; letter-spacing:.05em;
  text-align:left; white-space:nowrap;  }
.data-table tbody tr { border-bottom:1px solid var(--c-border); }
.data-table tbody tr:hover { background:#f7faff; }
.data-table td { padding:.5rem .9rem; vertical-align:middle; }
.row-pb { background:#fffbeb !important; }

/* Misc */
.back-link { font-size:.82rem; color:rgba(255,255,255,.7); text-decoration:none;
  display:inline-block; margin-bottom:.5rem; }
.back-link:hover { color:#fff; }
.badge-accent { background:#e85d04; color:#fff; font-weight:700; font-size:.72rem;
  padding:.2rem .55rem; border-radius:5px; }
.empty-state { text-align:center; padding:2.5rem; color:var(--c-muted); font-style:italic; }
.main-content .page { max-width:1200px; margin:0 auto; padding:1.25rem 1rem; }

/* Swimmer hero */
.swimmer-hero { background:var(--c-navy); color:#fff; padding:1.5rem 0 1rem; }
.swimmer-hero-inner { display:flex; justify-content:space-between; align-items:flex-start; gap:1rem; flex-wrap:wrap; }
.swimmer-info h1 { color:#fff; font-size:2rem; }
.swimmer-info .hero-sub { color:rgba(255,255,255,.7); }
.swimmer-hero .stat-pill { background:rgba(255,255,255,.12); border-color:transparent; }
.swimmer-hero .stat-pill .num { color:#fff; }
.swimmer-hero .stat-pill .lbl { color:rgba(255,255,255,.6); }
.swimmer-hero .back-link { color:rgba(255,255,255,.6); }

/* Swimmers list (search) */
.swimmers-list { display:flex; flex-direction:column; gap:.35rem; }
.swimmer-row { display:flex; align-items:center; gap:.75rem; padding:.6rem .9rem;
  background:var(--c-surface,#fff); border-radius:8px; box-shadow:0 1px 3px rgba(0,0,0,.06);
  text-decoration:none; color:var(--c-text); flex-wrap:wrap;
  border:1.5px solid transparent; transition:border-color 120ms; }
.swimmer-row:hover { border-color:var(--c-blue); }
.swimmer-name { font-weight:700; flex:1; min-width:150px; }

/* Event podium (meet page) */
.event-podium { display:grid; grid-template-columns:repeat(3,1fr); gap:.5rem; margin-bottom:.75rem; }
.ep-item { background:#fff; border-radius:8px; padding:.75rem; text-align:center;
  box-shadow:0 1px 3px rgba(0,0,0,.07); border:1.5px solid var(--c-border); }
.ep-1 { border-color:#d97706; background:#fffbeb; }
.ep-2 { border-color:#94a3b8; }
.ep-3 { border-color:#b45309; background:#fef9ee; }
.ep-rank { font-size:1.2rem; }
.ep-name { font-weight:700; font-size:.82rem; display:block; margin:.25rem 0; color:var(--c-blue); text-decoration:none; }
.ep-name:hover { text-decoration:underline; }
.ep-club { font-size:.73rem; }
.ep-time { font-family:'Roboto Mono',monospace; font-weight:700; font-size:.9rem; margin-top:.25rem; }
.event-block-title { font-size:.95rem; font-weight:700; padding:.4rem 0 .5rem;
  border-bottom:2px solid var(--c-border); margin-bottom:.6rem;
  display:flex; align-items:center; gap:.5rem; flex-wrap:wrap; }

/* Course badges */
.course-badge { font-size:.7rem; font-weight:700; padding:.15rem .45rem; border-radius:4px; }
.lcm { background:#fff1ec; color:#c2410c; }
.scm { background:#eff6ff; color:#1d4ed8; }

/* Clubs btn */
.btn { display:inline-block; padding:.4rem .85rem; border-radius:7px;
  font-size:.82rem; font-weight:600; cursor:pointer; text-decoration:none;
  transition:all 120ms; font-family:inherit; }
.btn-sm { padding:.3rem .65rem; font-size:.78rem; }
.btn { background:var(--c-blue); color:#fff; border:none; }
.btn:hover { background:#1440b0; }

/* Mobile nav */
@media(max-width:640px){
  .nav-links { gap:.1rem; }
  .nav-links a { font-size:.78rem; padding:.3rem .5rem; }
  .nav-logo strong { font-size:1rem; }
  .badge-accent { display:none; }
  .event-podium { grid-template-columns:1fr; }
  .swimmer-hero-inner { flex-direction:column; }
  .data-table { font-size:.78rem; }
  .data-table thead th, .data-table td { padding:.4rem .6rem; }
}

/* Tiny text */
.tiny { font-size:.7rem; }
.gm { color:#1a56db; font-weight:700; font-size:.78rem; }
.gf { color:#9333ea; font-weight:700; font-size:.78rem; }

/* ── Podium (responsive) ──────────────────────────────────────────────────── */
/* Podium — classic stepped design */
.podium {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 20px 16px 0;
  margin-bottom: 1.25rem;
  align-items: flex-end;
}
.podium-place {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
  max-width: 200px;
}
.podium-block {
  width: 100%;
  border-radius: 8px 8px 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 10px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: rgba(255,255,255,.9);
}
.podium-1 .podium-block { height: 90px; background: linear-gradient(160deg, #f59e0b, #d97706); }
.podium-2 .podium-block { height: 68px; background: linear-gradient(160deg, #94a3b8, #64748b); }
.podium-3 .podium-block { height: 52px; background: linear-gradient(160deg, #d97706, #b45309); opacity: .85; }
.podium-info { padding: 10px 6px 4px; }
.podium-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 2px;
  line-height: 1.2;
  color: inherit;
  text-decoration: none;
  display: block;
}
.podium-name:hover { text-decoration: underline; }
.podium-time {
  font-family: 'Roboto Mono', monospace;
  font-size: .88rem;
  font-weight: 600;
  color: var(--c-blue);
}
.podium-club { font-size: .75rem; color: var(--c-muted); }
@media(max-width: 480px){
  .podium { gap: 6px; padding: 12px 8px 0; }
  .podium-1 .podium-block { height: 70px; }
  .podium-2 .podium-block { height: 54px; }
  .podium-3 .podium-block { height: 40px; }
}

/* ── Table (no sticky header causing overlap) ─────────────────────────────── */
.table-responsive { overflow-x: auto; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.07); }
thead th { position: static !important; z-index: auto !important; }
.table-responsive .data-table thead th { position: static !important; top: auto !important; }

/* ── Swimmer layout: sidebar grid → stack on mobile ───────────────────────── */
/* Consolidated 2026-09-27 - this rule (plus the "Nav: hide Home" rule below)
   used to be declared 3-4x scattered across this file, all with the same
   selector and (mostly) the same values re-asserting each other. Harmless
   while every copy agreed, but it's exactly the kind of silent-override
   duplication that caused the nav-badge overflow bug on 2026-08-13 - a
   future edit to just ONE copy would silently diverge from the others
   instead of erroring. The breakpoint had also drifted (768px here vs
   700px in 3 of the 4 old copies): consolidating on 768px is a small,
   deliberate widening, not a behavior cut - it extends the sidebar-reorder
   and radar-chart-sizing rules (previously only <=700px) across the full
   701-768px gap they were silently missing before. */
.swimmer-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.25rem;
  align-items: start;
}
/* Grid items default to min-width:auto, which lets a wide child (the PB/
   history tables, 6-8 columns) force the track itself wider than intended
   instead of respecting it - so .table-wrap's own overflow-x:auto never
   gets a chance to engage, and the whole page (nav included) ends up
   wider than the viewport on mobile. min-width:0 lets the track actually
   shrink to fit, so the table's own scroll container takes over instead. */
.swimmer-layout > div { min-width: 0; }
@media (max-width: 768px) {
  .swimmer-layout {
    grid-template-columns: 1fr;
  }
  /* Move sidebar (radar + details) above PBs table on mobile */
  .swimmer-layout > div:last-child {
    order: -1;
  }
  /* Radar chart: centre and constrain width */
  .swimmer-layout > div:last-child svg {
    max-width: 100%;
    height: auto;
  }
}

/* ── Hero back link ───────────────────────────────────────────────────────── */
.hero-back { color: rgba(255,255,255,.65); font-size:.82rem; text-decoration:none; display:inline-block; margin-bottom:.5rem; }
.hero-back:hover { color: #fff; }

/* ── Filter bar labels ────────────────────────────────────────────────────── */
.filter-group { display:flex; flex-direction:column; gap:.2rem; }
.filter-group label { font-size:.68rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:#64748b; }
/* .filter-bar input's flex-basis:180px sizes WIDTH in a row-flex parent, but
   .filter-group is column-direction, so that same basis sizes HEIGHT instead
   (and overrides any explicit height, per how flex-basis works) - reset it. */
.filter-group input { flex: 0 0 auto; height: 36px; width: 100%; }
@media(max-width:640px){
  .filter-bar { flex-direction:column; }
  .filter-group { width:100%; }
  .filter-group select, .filter-group input { width:100%; height: 38px; box-sizing: border-box; flex-shrink: 0; }
}

/* ── Nav: hide "Home" text link on mobile, keep search icon tidy ─────────── */
@media (max-width: 600px) {
  .nav-link-home {
    display: none;
  }

  .nav-search-icon {
    opacity: .8;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 2px;
  }

  .nav-links {
    gap: .75rem;
  }

  .nav-inner {
    padding: 0 .75rem;
  }
}
/* Logo ("🇪🇸 Spain Swimming" + "Youth Rankings" badge) plus the nav links
   still don't fit together below ~400px even with Home hidden above -
   confirmed live, nav-links' right edge sat ~51px past the viewport edge
   on a 375px device. Drop the badge there; the wordmark alone is enough
   to identify the page and frees up the room the links need. */
@media (max-width: 400px) {
  .nav-logo .badge { display: none; }
}

/* ── Club detail: top-performer tables, side by side → stack on mobile ───── */
.club-top-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.club-top-grid > div { min-width: 0; }
@media (max-width: 700px) {
  .club-top-grid { grid-template-columns: 1fr; }
}

/* ── Horizontal scroll for wide tables on mobile ─────────────────────────── */
.table-scroll-x {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-scroll-x::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 32px; height: 100%;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.9));
  pointer-events: none;
  transition: opacity .2s;
}
.table-scroll-x.scrolled-end::after { opacity: 0; }


/* ── Qualifying standards badges ─────────────────────────────────────────── */
.std-badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  font-family: 'Roboto Mono', monospace;
}
.std-q  { background: #dcfce7; color: #166534; }   /* green — qualified */
.std-x  { background: #fef2f2; color: #991b1b; }   /* red — not yet */
.std-n  { background: #f1f5f9; color: #94a3b8; }   /* grey — no standard */

/* ── Rivals / Favourites watchlist ─────────────────────────────────────────── */
.watch-btn {
  font-size: .78rem; padding: .25rem .65rem; border-radius: 6px;
  border: 1.5px solid var(--c-border); background: #fff; cursor: pointer;
  font-family: inherit; color: #374151; transition: all var(--transition);
}
.watch-btn:hover { border-color: var(--c-blue); color: var(--c-blue); }
.watch-btn.on { background: var(--c-navy); color: #fff; border-color: var(--c-navy); }
.watch-btn.on.rival { background: var(--c-orange); border-color: var(--c-orange); }
.swimmer-hero .watch-btn { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.45); }
.swimmer-hero .watch-btn.on { background: #fff; color: var(--c-navy); }
.swimmer-hero .watch-btn.on.rival { background: var(--c-orange); color: #fff; border-color: var(--c-orange); }
.nav-count { display: inline-block; min-width: 1.2em; margin-left: .35em; padding: 0 .35em;
  border-radius: 999px; background: var(--c-orange); color: #fff; font-size: .7rem; line-height: 1.5; text-align: center; }
.nav-count:empty { display: none; }
.gap-fast { color: #15803d; font-weight: 600; }
.gap-slow { color: #b91c1c; }
.ov-row:hover { background: var(--c-blue-lt); }
