/* =============================================
   MLA TOP TIMES — GLOBAL DESIGN SYSTEM
   ============================================= */

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

body {
  font-family: Arial, sans-serif;
  background: #f0f6ff;
  margin: 0;
  padding: 0 16px 40px;
  color: #003366;
}

/* ---- Header ---- */
header {
  background: #003366;
  padding: 16px 24px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 18px;
}
.header-logo {
  width: 52px;
  height: 58px;
  flex-shrink: 0;
}
.header-titles { display: flex; flex-direction: column; align-items: flex-start; }
.header-name {
  font-size: 20px;
  font-weight: 700;
  color: white;
  font-family: Arial, sans-serif;
  line-height: 1.15;
}
.header-sub {
  font-size: 11px;
  color: #93c5fd;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-top: 3px;
}
h2 {
  font-size: 17px;
  font-weight: 700;
  color: #003366;
  margin: 0 0 12px;
}

/* ---- Nav buttons ---- */
.nav-buttons {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}
button {
  background: transparent;
  color: #93c5fd;
  border: 1px solid rgba(147,197,253,.4);
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: background .15s, color .15s;
}
button:hover { background: rgba(147,197,253,.15); color: white; }
button.active {
  background: white;
  color: #003366;
  border-color: white;
  font-weight: 700;
}
button:disabled { opacity: 0.4; cursor: default; }

/* ---- Layout ---- */
#controls { max-width: 1100px; margin: 0 auto; }
#content  { max-width: 1100px; margin: 0 auto; }

/* ---- Cards ---- */
.card {
  background: white;
  padding: 16px 18px;
  border-radius: 12px;
  margin-bottom: 12px;
  border: 0.5px solid #d0ddf0;
}

/* ---- Filters / form controls ---- */
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
select, input[type="text"] {
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid #aac;
  width: 100%;
  font-size: 13px;
  font-family: inherit;
  color: #003366;
  background: white;
}
select:focus, input[type="text"]:focus {
  outline: 2px solid #93c5fd;
  border-color: #93c5fd;
}
label.small { font-size: 11px; color: #666; display: block; margin-bottom: 3px; }

/* ---- Result rows (dashboard / search) ---- */
.top3-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  border: 0.5px solid #e0e8f0;
  transition: background .12s;
}
.top3-entry:hover { background: #f0f6ff; }
.top3-entry:nth-child(even) { background: #f6f9ff; }
.top3-entry:nth-child(even):hover { background: #eef4ff; }

.time { font-size: 1.3em; font-weight: 700; color: #003366; }
.small { font-size: 0.82em; color: #556; }

/* ---- Section headers (search grouped results) ---- */
.section-header {
  margin-top: 14px;
  padding: 8px 0 6px;
  border-top: 1px solid #dde8f5;
}
.section-header-title { font-size: 14px; font-weight: 700; color: #003366; }
.section-subtitle { font-size: 12px; color: #667; margin-top: 2px; }

/* ---- Record board table ---- */
.table-header {
  font-weight: 700;
  font-size: 13px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  background: #e8f0ff;
  padding: 10px 12px;
  border-radius: 8px 8px 0 0;
  position: sticky;
  top: 0;
  z-index: 5;
}
.row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 9px 12px;
  font-size: 13px;
  border-bottom: 0.5px solid #e0e8f0;
}
.row:nth-child(even) { background: #f6f9ff; }
.row:last-child { border-bottom: none; }
.clickable { text-decoration: underline; cursor: pointer; color: #1d4ed8; }

/* ---- Details / analytics panels ---- */
.details-panel {
  margin: 2px 8px 8px 12px;
  padding: 10px 12px;
  background: #eef4ff;
  border-left: 3px solid #1e3a8a;
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  color: #223;
}
.details-panel strong { font-weight: 700; }

.split-analytics {
  margin-top: 6px;
  padding: 8px 10px;
  background: #ddeaff;
  border-radius: 6px;
  font-size: 12px;
}
.split-analytics-inner div { margin-bottom: 2px; }

button.split-toggle {
  margin-top: 4px;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid #93c5fd;
  background: transparent;
  color: #1e40af;
  cursor: pointer;
}
button.split-toggle:hover { background: #dbeafe; }

.progression-panel {
  margin-top: 6px;
  padding: 8px 10px;
  background: #eef4ff;
  border-radius: 6px;
  font-size: 12px;
}
.progression-list { margin: 6px 0 0 0; padding-left: 16px; }
.progression-list li { margin-bottom: 2px; }

button.progression-toggle {
  margin-top: 4px;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid #5eead4;
  background: transparent;
  color: #0f766e;
  cursor: pointer;
}
button.progression-toggle:hover { background: #ccfbf1; }
.progression-analytics { margin-top: 4px; }

/* ---- Back button (shared) ---- */
.back-btn {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid #93c5fd;
  background: #eff6ff;
  color: #1e40af;
  font-size: 12px;
  cursor: pointer;
  margin-bottom: 10px;
  display: inline-block;
}
.back-btn:hover { background: #dbeafe; }

/* ---- Swimmer link ---- */
.swimmer-link {
  color: #1e40af;
  cursor: pointer;
  text-decoration: underline;
  font-weight: 700;
}
.swimmer-link:hover { color: #172554; }

/* ---- Percentile ranking (kept from original) ---- */
.percentile-ranking {
  margin-top: 8px;
  padding: 8px 10px;
  background: #f0f4ff;
  border-radius: 6px;
  border: 1px solid #c7d2fe;
}
.percentile-title { font-weight: 700; font-size: 13px; margin-bottom: 6px; color: #1e3a8a; }
.percentile-cohort { font-weight: 400; color: #6b7280; font-size: 12px; }
.percentile-bars { display: flex; flex-direction: column; gap: 4px; }
.percentile-row { display: grid; grid-template-columns: 120px 1fr 48px; align-items: center; gap: 8px; }
.percentile-label { font-size: 12px; color: #374151; white-space: nowrap; }
.percentile-bar-track { height: 12px; background: #e5e7eb; border-radius: 6px; overflow: hidden; }
.percentile-bar-fill { height: 100%; border-radius: 6px; transition: width 0.3s ease; min-width: 2px; }
.percentile-value { font-size: 12px; font-weight: 700; color: #1f2937; text-align: right; }
.percentile-legend { font-size: 11px; color: #9ca3af; margin-top: 4px; }

/* ---- Misc ---- */
.toggle { margin-top: 10px; text-align: center; }
.toggle label { cursor: pointer; }


/* =============================================
   SWIMMER PROFILE PAGE
   ============================================= */

.swimmer-wide-container #content { max-width: 1100px !important; width: 100% !important; }

/* Hero card */
.sp-hero { padding: 16px 20px; }
.sp-hero-inner { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.sp-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: #dbeafe; color: #1d4ed8;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; flex-shrink: 0;
}
.sp-hero-info { flex: 1; min-width: 180px; }
.sp-name { font-size: 18px; font-weight: 700; color: #003366; }
.sp-sub { font-size: 13px; color: #555; margin-top: 3px; }
.sp-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.sp-badge {
  font-size: 11px; padding: 2px 9px; border-radius: 999px;
  border: 1px solid #ccd; color: #555; background: #f6f9ff;
}
.sp-badge-blue { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.sp-stats { display: flex; gap: 20px; margin-left: auto; text-align: center; flex-shrink: 0; flex-wrap: wrap; }
.sp-stat-n { font-size: 22px; font-weight: 700; color: #003366; }
.sp-stat-event { font-size: 15px; }
.sp-stat-l { font-size: 11px; color: #666; margin-top: 2px; }
.sp-stat-divider { border-left: 1px solid #dde8f5; padding-left: 20px; }

/* Filter bar (stroke tabs + age group) */
.sp-filter-bar { margin-bottom: 12px; display: flex; flex-direction: column; gap: 8px; }
.sp-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.sp-age-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sp-age-label { font-size: 12px; color: #666; white-space: nowrap; }
.sp-tab {
  padding: 5px 13px; border-radius: 999px;
  border: 1px solid #aac; font-size: 13px; cursor: pointer;
  background: transparent; color: #555; font-family: inherit; transition: all .12s;
}
.sp-tab:hover { background: #e8f0ff; }
.sp-tab-active { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; font-weight: 700; }

/* Event cards */
.sp-event-card { padding: 0; overflow: hidden; margin-bottom: 10px; }
.sp-event-head {
  display: flex; align-items: center; padding: 14px 18px; gap: 12px;
  cursor: pointer; user-select: none; transition: background .12s;
}
.sp-event-head:hover { background: #f0f6ff; }
.sp-event-title { font-size: 15px; font-weight: 700; color: #003366; }
.sp-event-meta { font-size: 12px; color: #666; margin-top: 3px; }
.sp-best-time { font-size: 22px; font-weight: 700; color: #003366; margin-left: auto; white-space: nowrap; text-align: right; }
.sp-best-time span { display: block; font-size: 11px; font-weight: 400; color: #888; margin-top: 2px; }
.sp-chevron { font-size: 11px; color: #aaa; margin-left: 8px; }

/* Swim rows */
.sp-swims { border-top: 0.5px solid #e0e8f0; }
.sp-swim-row {
  display: flex; align-items: center; padding: 8px 18px; gap: 12px;
  border-bottom: 0.5px solid #eef2ff; font-size: 13px;
}
.sp-swim-row:last-child { border-bottom: none; }
.sp-swim-row:nth-child(even) { background: #f6f9ff; }
.sp-pb-indicator { width: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.sp-pb-dot { width: 8px; height: 8px; border-radius: 50%; background: #16a34a; display: block; }
.sp-swim-date { color: #666; min-width: 90px; font-size: 12px; }
.sp-swim-meet { color: #555; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.sp-bar-wrap { flex: 1; max-width: 120px; }
.sp-bar-track { height: 5px; background: #e8f0ff; border-radius: 3px; overflow: hidden; border: 0.5px solid #d0ddf0; }
.sp-bar-fill { height: 100%; border-radius: 3px; background: #1d4ed8; }
.sp-swim-time { font-size: 14px; font-weight: 700; color: #003366; min-width: 60px; text-align: right; }

/* Team comparison panel */
.sp-comparison {
  padding: 12px 18px;
  background: #f6f9ff;
  border-top: 0.5px solid #e0e8f0;
}
.sp-comparison-title { font-size: 12px; color: #555; margin-bottom: 8px; }
.sp-comparison-title strong { color: #1d4ed8; font-weight: 700; }
.sp-comparison-bar-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sp-comparison-bar-track { flex: 1; height: 8px; background: #dde8f5; border-radius: 4px; overflow: hidden; }
.sp-comparison-bar-fill { height: 100%; border-radius: 4px; background: #1d4ed8; transition: width .4s; }
.sp-comparison-pct { font-size: 12px; color: #1d4ed8; font-weight: 700; white-space: nowrap; }
.sp-comparison-list { display: flex; flex-direction: column; gap: 3px; }
.sp-comparison-row {
  display: grid; grid-template-columns: 24px 1fr 70px 70px;
  align-items: center; padding: 4px 8px;
  font-size: 12px; border-radius: 6px; gap: 6px;
}
.sp-comparison-row:nth-child(odd) { background: #eef4ff; }
.sp-comparison-me {
  background: #dbeafe !important;
  font-weight: 700;
  border: 0.5px solid #93c5fd;
}
.sp-comparison-rank { color: #888; font-size: 11px; text-align: right; }
.sp-comparison-name { color: #003366; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-comparison-pts { color: #1d4ed8; font-weight: 700; text-align: right; }
.sp-comparison-time { color: #556; text-align: right; }
.sp-comparison-more { font-size: 11px; color: #888; text-align: center; padding-top: 4px; }

/* Expand analytics button */
.sp-expand-btn {
  display: flex; align-items: center; gap: 6px; width: 100%;
  padding: 8px 18px; font-size: 12px; color: #555;
  background: transparent; border: none; border-top: 0.5px solid #e0e8f0;
  cursor: pointer; text-align: left; font-family: inherit;
}
.sp-expand-btn:hover { background: #f0f6ff; color: #003366; }
.sp-expand-chevron { font-size: 10px; }

/* Analytics panel */
.sp-analytics-panel {
  padding: 14px 18px; background: #f6f9ff;
  border-top: 0.5px solid #e0e8f0; font-size: 13px;
}
.sp-analytics-section { margin-bottom: 14px; }
.sp-analytics-section:last-child { margin-bottom: 0; }
.sp-analytics-sub { font-size: 11px; color: #888; font-weight: 400; }
.sp-split-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sp-split-chip {
  padding: 3px 10px; background: white; border: 1px solid #ccd;
  border-radius: 999px; font-size: 12px; color: #003366;
}


/* =============================================
   CUT BADGES
   ============================================= */
.cut-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  letter-spacing: 0.03em;
  vertical-align: middle;
}
.sp-cut-badge-wrap { display: flex; align-items: center; margin-left: 8px; }

/* =============================================
   PERSONAL RECORDS SUMMARY CARD
   ============================================= */
.sp-pr-card { padding: 14px 18px; }
.sp-pr-title { font-size: 14px; font-weight: 700; color: #003366; }
.pr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.pr-cell {
  background: #f6f9ff;
  border: 0.5px solid #d0ddf0;
  border-radius: 8px;
  padding: 8px 10px;
}
.pr-event { font-size: 12px; font-weight: 700; color: #003366; }
.pr-age { font-size: 10px; color: #888; margin-bottom: 2px; }
.pr-time { font-size: 16px; font-weight: 700; color: #003366; }
.pr-meta { display: flex; gap: 4px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.pr-pts { font-size: 10px; color: #1d4ed8; font-weight: 700; }

/* =============================================
   DEPTH CHART
   ============================================= */
.depth-section {
  padding: 10px 0;
  border-bottom: 0.5px solid #e0e8f0;
}
.depth-section:last-child { border-bottom: none; }
.depth-header {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 6px;
}
.depth-event { font-size: 14px; font-weight: 700; color: #003366; min-width: 120px; }
.depth-total { font-size: 12px; color: #888; }
.depth-cuts-inline { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.depth-cut-ref { font-size: 11px; font-weight: 700; }
.depth-bar {
  display: flex; height: 24px; border-radius: 6px; overflow: hidden;
  border: 0.5px solid #e0e8f0; margin-bottom: 4px;
}
.depth-bar-seg {
  display: flex; align-items: center; justify-content: center;
  min-width: 1px; transition: width .3s;
}
.depth-legend { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.depth-legend-item {
  font-size: 11px; font-weight: 700; padding: 1px 7px;
  border-radius: 999px;
}
.depth-list { margin-top: 6px; }
.depth-list-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0; border-bottom: 0.5px solid #f0f4ff; font-size: 13px;
}
.depth-list-row:last-child { border-bottom: none; }
.depth-rank { color: #aaa; font-size: 11px; min-width: 18px; text-align: right; }
.depth-name { flex: 1; }
.depth-time { font-weight: 700; color: #003366; }

/* =============================================
   COACH VIEW
   ============================================= */
.coach-header-row {
  display: grid;
  grid-template-columns: 2fr 1fr 60px 2fr 80px;
  gap: 8px;
  padding: 8px 12px;
  background: #e8f0ff;
  border-radius: 8px 8px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: #003366;
  margin-bottom: 2px;
}
.coach-row {
  display: grid;
  grid-template-columns: 2fr 1fr 60px 2fr 80px;
  gap: 8px;
  padding: 8px 12px;
  font-size: 13px;
  border-bottom: 0.5px solid #eef2ff;
  align-items: center;
}
.coach-row:nth-child(even) { background: #f6f9ff; }
.coach-row:last-child { border-bottom: none; }
.coach-col-name { font-weight: 700; }
.coach-col-age { color: #666; font-size: 12px; }
.coach-col-events { color: #888; font-size: 12px; text-align: center; }
.coach-col-top { font-size: 12px; color: #334; }
.coach-col-cut { text-align: center; }

/* =============================================
   PRINT STYLES (coach view)
   ============================================= */
@media print {
  header, #controls, .back-btn, .nav-buttons { display: none !important; }
  body { background: white; padding: 0; color: black; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .coach-row, .coach-header-row { break-inside: avoid; }
  a { color: black; text-decoration: none; }
}

/* =============================================
   DEPTH CHART — EXPAND PANEL
   ============================================= */
.depth-bar-seg { transition: opacity .15s, outline .1s; }
.depth-bar-seg:hover { opacity: .82; }
.depth-bar-seg.depth-active { outline: 2px solid #003366; outline-offset: -2px; opacity: 1; }

.depth-legend-item { transition: box-shadow .12s; user-select: none; }
.depth-legend-item:hover { box-shadow: 0 0 0 2px #003366; }
.depth-legend-item.depth-active { box-shadow: 0 0 0 2px #003366; font-weight: 700; }

.depth-expand-panel {
  margin-top: 8px;
  border-radius: 8px;
  border: 0.5px solid #d0ddf0;
  background: white;
  overflow: hidden;
}
.depth-expand-header {
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  background: #f6f9ff;
  border-bottom: 0.5px solid #e0e8f0;
}
.depth-expand-list { padding: 4px 0; }
.depth-expand-row {
  display: grid;
  grid-template-columns: 24px 1fr 64px 64px 60px 1fr;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13px;
  border-bottom: 0.5px solid #f0f4ff;
  transition: background .1s;
}
.depth-expand-row:last-child { border-bottom: none; }
.depth-expand-row:hover { background: #f6f9ff; }
.depth-expand-rank { color: #bbb; font-size: 11px; text-align: right; }
.depth-expand-name { font-weight: 700; color: #003366; }
.depth-expand-age  { font-size: 11px; color: #888; }
.depth-expand-time { font-weight: 700; color: #003366; text-align: right; }
.depth-expand-pts  { font-size: 11px; color: #1d4ed8; font-weight: 700; text-align: right; }
.depth-expand-meet { color: #888; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =============================================
   INSIGHTS PAGE
   ============================================= */
.ins-sub {
  font-size: 12px;
  font-weight: 400;
  color: #666;
  margin-left: 6px;
}
.ins-content h3 {
  font-size: 14px;
  font-weight: 700;
  color: #1d4ed8;
  margin: 14px 0 6px;
  padding-top: 12px;
  border-top: 0.5px solid #e0e8f0;
}
.ins-content h3:first-of-type { padding-top: 0; border-top: none; margin-top: 8px; }
.ins-section { margin-top: 2px; }
.ins-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
}
.ins-row {
  display: grid;
  grid-template-columns: 28px 1.4fr 1.6fr 80px;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  font-size: 13px;
  border-radius: 6px;
  background: #f6f9ff;
  transition: background .1s;
}
.ins-row:hover { background: #e8f0ff; }
.ins-row-wide {
  grid-template-columns: 28px 1.2fr 1.6fr 80px 1fr;
}
.ins-rank {
  font-size: 11px;
  color: #aaa;
  text-align: right;
  font-weight: 700;
}
.ins-name {
  font-weight: 700;
  color: #003366;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ins-event {
  color: #556;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ins-pts, .ins-delta {
  color: #1d4ed8;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}
.ins-sub2 {
  color: #888;
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
}

/* =============================================
   MOBILE RESPONSIVE (< 720px)
   ============================================= */
@media (max-width: 720px) {
  body { padding: 0 8px 24px; }

  /* Header: logo next to text, tighter padding */
  header { padding: 12px 12px 10px; gap: 8px; margin-bottom: 10px; }
  .header-brand { gap: 12px; }
  .header-logo { width: 44px; height: 50px; }
  .header-name { font-size: 16px; }
  .header-sub { font-size: 10px; }

  /* Nav: smaller chips, allow wrapping */
  .nav-buttons { gap: 4px; }
  button { padding: 6px 11px; font-size: 12px; }

  /* Cards: less padding */
  .card { padding: 12px 14px; margin-bottom: 10px; }
  h2 { font-size: 15px; margin-bottom: 10px; }

  /* Filters: stack vertically on small screens */
  .filters { grid-template-columns: 1fr 1fr; gap: 6px; }

  /* Dashboard rows: stack */
  .top3-entry {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .time { font-size: 1.1em; }

  /* Record board table: scroll horizontally */
  .table-header, .row {
    font-size: 12px;
    padding: 8px;
  }

  /* Swimmer profile: stack hero */
  .sp-hero-inner { flex-direction: column; align-items: flex-start; gap: 12px; }
  .sp-stats {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
    gap: 12px;
  }
  .sp-stat-divider { border-left: none; padding-left: 0; }
  .sp-stat-event { font-size: 13px; }

  /* Swimmer event cards: stack header + best time */
  .sp-event-head {
    flex-wrap: wrap;
    padding: 12px 14px;
  }
  .sp-best-time {
    font-size: 18px;
    margin-left: auto;
  }

  /* Swim rows: tighter, hide meet column if cramped */
  .sp-swim-row {
    padding: 7px 14px;
    gap: 8px;
    font-size: 12px;
  }
  .sp-swim-date { min-width: 70px; font-size: 11px; }
  .sp-swim-meet { font-size: 11px; }
  .sp-bar-wrap { max-width: 70px; }
  .sp-swim-time { min-width: 50px; font-size: 13px; }

  /* Team comparison: smaller columns */
  .sp-comparison-row {
    grid-template-columns: 20px 1fr 50px 50px;
    font-size: 11px;
    gap: 4px;
  }

  /* Depth chart: smaller text, tighter */
  .depth-header { gap: 6px; }
  .depth-event { font-size: 13px; min-width: 90px; }
  .depth-total { font-size: 11px; }
  .depth-cut-ref { font-size: 10px; }
  .depth-bar { height: 20px; }

  /* Depth expand rows: collapse wide grid */
  .depth-expand-row {
    grid-template-columns: 20px 1.2fr 50px 60px 50px;
    font-size: 11px;
    gap: 4px;
  }
  .depth-expand-meet { display: none; }
  .depth-expand-age { font-size: 10px; }

  /* Insights: simpler grid on mobile */
  .ins-row {
    grid-template-columns: 24px 1fr 70px;
    gap: 6px;
    font-size: 12px;
    padding: 6px 8px;
  }
  .ins-row > .ins-event { grid-column: 2; grid-row: 2; font-size: 10px; }
  .ins-row-wide {
    grid-template-columns: 24px 1fr 70px;
  }
  .ins-row-wide > .ins-sub2 { display: none; }
  .ins-content h3 { font-size: 13px; }

  /* Filter/tab pills: smaller */
  .sp-tab { padding: 4px 10px; font-size: 12px; }
  .sp-age-label { font-size: 11px; }
  .sp-badges { gap: 4px; }
  .sp-badge { font-size: 10px; padding: 2px 7px; }

  /* Analytics panels: less horizontal padding */
  .sp-analytics-panel { padding: 12px 14px; font-size: 12px; }
  .details-panel { margin-left: 8px; padding: 8px 10px; font-size: 12px; }

  /* Progression chart: full width */
  .progression-panel .prog-row {
    flex-direction: column !important;
  }
  .prog-metrics-col {
    padding-left: 0 !important;
    border-left: none !important;
    border-top: 1px solid #eee;
    padding-top: 12px !important;
    margin-top: 8px;
  }
}

/* Very narrow phones */
@media (max-width: 420px) {
  .header-name { font-size: 14px; }
  .header-sub { display: none; }
  .sp-stats { gap: 6px; }
  .sp-stat-n { font-size: 18px; }
  .filters { grid-template-columns: 1fr; }
  button { padding: 5px 9px; font-size: 11px; }
  .sp-swim-meet { display: none; }
  .sp-bar-wrap { max-width: 50px; }
}

/* =============================================
   MEETS PAGE
   ============================================= */

/* Seasonality chart */
.season-chart {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
  margin-top: 14px;
  align-items: end;
  height: 180px;
}
.season-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  position: relative;
}
.season-bar-stack {
  width: 100%;
  max-width: 44px;
  flex: 1;
  background: #f0f6ff;
  border-radius: 4px 4px 0 0;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.season-bar-swims {
  width: 100%;
  background: #bfdbfe;
  border-top: 1px solid #93c5fd;
  position: absolute;
  bottom: 0;
  left: 0;
}
.season-bar-pbs {
  width: 100%;
  background: #1d4ed8;
  border-top: 1px solid #1e3a8a;
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: 2;
}
.season-month {
  font-size: 11px;
  color: #555;
  margin-top: 6px;
  font-weight: 700;
}
.season-pct {
  font-size: 10px;
  color: #1d4ed8;
  font-weight: 700;
  margin-top: 1px;
}

.season-legend {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 0.5px solid #e0e8f0;
  font-size: 12px;
  color: #556;
}
.season-legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: middle;
}

/* Meet rankings list */
.meets-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
}
.meets-row {
  display: grid;
  grid-template-columns: 32px 2.2fr 60px 60px 64px 64px 40px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 6px;
  background: #f6f9ff;
}
.meets-header-row {
  background: #e8f0ff;
  font-weight: 700;
  color: #003366;
  font-size: 12px;
  padding: 6px 10px;
}
.meets-row:not(.meets-header-row):hover { background: #e8f0ff; }
.meets-rank {
  font-size: 11px;
  color: #aaa;
  font-weight: 700;
  text-align: right;
}
.meets-header-row .meets-rank { color: #003366; }
.meets-name {
  color: #003366;
  font-weight: 700;
  overflow: hidden;
}
.meets-sub {
  font-weight: 400;
  color: #888;
  font-size: 11px;
  margin-top: 2px;
}
.meets-stat {
  text-align: right;
  color: #334;
}

/* Mobile adjustments for meets page */
@media (max-width: 720px) {
  .season-chart { height: 140px; gap: 2px; }
  .season-month { font-size: 10px; margin-top: 4px; }
  .season-pct { font-size: 9px; }

  .meets-row {
    grid-template-columns: 26px 1.8fr 50px 50px 52px;
    gap: 6px;
    font-size: 11px;
    padding: 6px 8px;
  }
  /* Hide avg-pts and years columns on mobile to fit */
  .meets-row > span:nth-child(6),
  .meets-row > span:nth-child(7) {
    display: none;
  }
  .meets-sub { font-size: 10px; }
}
