*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-width: 224px;
  --event-sidebar-width: 150px;
  --color-gold: #FAC775;
  --color-gold-text: #633806;
  --color-silver: #D3D1C7;
  --color-silver-text: #2C2C2A;
  --color-bronze: #F5C4B3;
  --color-bronze-text: #4A1B0C;
  --color-4th: #C0DD97;
  --color-4th-text: #27500A;
  --color-5th: #9FE1CB;
  --color-5th-text: #085041;
  --color-blue: #185FA5;
  --color-blue-light: #E6F1FB;
  --color-blue-text: #0C447C;
  --color-success: #1D9E75;
  --color-success-light: #E1F5EE;
  --radius-md: 8px;
  --radius-lg: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f4f0;
  color: #1a1a18;
  height: 100vh;
  overflow: hidden;
}

/* ------ APP SHELL ------ */
.app {
  display: flex;
  height: 100vh;
}

/* ------ SIDEBAR ------ */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: #fff;
  border-right: 0.5px solid rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 14px 12px 10px;
  border-bottom: 0.5px solid rgba(0,0,0,0.08);
}

.sidebar-title-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 500;
  color: #888;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex: 1;
}

.new-league-btn {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 0.5px solid rgba(0,0,0,0.15);
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.new-league-btn:hover { background: #f5f4f0; }

.gender-toggle {
  display: flex;
  background: #f5f4f0;
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
}
.gender-btn {
  flex: 1;
  padding: 5px 0;
  font-size: 12px;
  font-weight: 500;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: #888;
}
.gender-btn.active {
  background: #fff;
  color: #1a1a18;
  border: 0.5px solid rgba(0,0,0,0.1);
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.league-section { margin-bottom: 4px; }

.league-name-row {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #555;
  letter-spacing: 0.03em;
  cursor: pointer;
  gap: 6px;
}
.league-name-row:hover { background: #f5f4f0; }
.league-name-row.active { background: #E6F1FB; color: var(--color-blue-text); border-radius: 6px; margin: 0 6px; }
.league-name-row:hover .league-delete-btn { opacity: 1; }

.league-delete-btn {
  opacity: 0;
  background: none;
  border: none;
  font-size: 12px;
  color: #bbb;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  line-height: 1;
  flex-shrink: 0;
  transition: opacity 0.1s;
}
.league-delete-btn:hover { color: #E24B4A; background: #fcebeb; }

.league-chevron { font-size: 10px; color: #bbb; transition: transform 0.15s; }
.league-chevron.open { transform: rotate(90deg); }

.team-block { }

.team-row {
  display: flex;
  align-items: center;
  padding: 5px 12px 5px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #1a1a18;
  gap: 6px;
}
.team-row:hover { background: #f5f4f0; }
.team-row:hover .team-sync-btn { opacity: 1; }

.team-sync-btn {
  opacity: 0;
  margin-left: auto;
  font-size: 11px;
  color: #999;
  background: #f0efea;
  border: 0.5px solid rgba(0,0,0,0.1);
  border-radius: 5px;
  padding: 2px 6px;
  cursor: pointer;
  transition: opacity 0.1s;
  white-space: nowrap;
}
.team-sync-btn:hover { color: #333; }

.team-chevron { font-size: 9px; color: #ccc; }

.meets-list {
  padding-left: 16px;
  border-left: 1.5px solid #e8e7e2;
  margin-left: 24px;
}

.meet-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px;
  font-size: 12px;
  color: #777;
  cursor: pointer;
  border-radius: 6px;
  margin-right: 6px;
}
.meet-item:hover { background: #f5f4f0; color: #333; }
.meet-item.active { background: #E6F1FB; color: var(--color-blue-text); font-weight: 500; }

.meet-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ccc;
  flex-shrink: 0;
}
.meet-dot.done { background: var(--color-success); }
.meet-dot.active { background: var(--color-blue); }

.finals-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 16px;
  font-size: 12px;
  color: #777;
  cursor: pointer;
  border-radius: 6px;
  margin: 2px 6px 2px 10px;
  font-weight: 500;
}
.finals-row:hover { background: #f5f4f0; }
.finals-row.active { background: #E6F1FB; color: var(--color-blue-text); }

/* ------ MAIN PANEL ------ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f5f4f0;
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #aaa;
}
.empty-icon { font-size: 36px; }
.empty-title { font-size: 16px; font-weight: 500; color: #888; }
.empty-sub { font-size: 13px; color: #bbb; }

/* ------ TOP BAR ------ */
.topbar {
  padding: 10px 20px;
  background: #fff;
  border-bottom: 0.5px solid rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.topbar-left { display: flex; flex-direction: column; gap: 2px; }
.topbar-title { font-size: 14px; font-weight: 500; color: #1a1a18; }
.topbar-sub { font-size: 12px; color: #888; }

/* DUAL MEET SCOREBOARD */
.scoreboard-dual {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}
.score-team { text-align: center; }
.score-name { font-size: 11px; color: #888; }
.score-pts { font-size: 24px; font-weight: 500; color: #1a1a18; line-height: 1; }
.score-divider { font-size: 18px; color: #ddd; }

/* FINALS SCOREBOARD TABLE */
.scoreboard-finals {
  margin-left: auto;
}
.score-table {
  border-collapse: collapse;
  font-size: 12px;
}
.score-table td {
  padding: 2px 10px 2px 0;
  color: #888;
  white-space: nowrap;
}
.score-table td:last-child {
  font-weight: 500;
  color: #1a1a18;
  text-align: right;
  padding-right: 0;
}
.score-table tr.leader td { color: #1a1a18; }
.score-table tr.leader td:last-child { color: var(--color-blue); font-size: 14px; }

.winner-btn {
  padding: 5px 10px;
  font-size: 11px;
  border: 0.5px solid rgba(0,0,0,0.15);
  border-radius: var(--radius-md);
  background: transparent;
  color: #888;
  cursor: pointer;
  white-space: nowrap;
}
.winner-btn:hover { background: #f5f4f0; }
.winner-btn.winner-set { color: var(--color-success); border-color: var(--color-success); }

/* ------ CONTENT AREA ------ */
.content-area {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* EVENT SIDEBAR */
.event-sidebar {
  width: var(--event-sidebar-width);
  min-width: var(--event-sidebar-width);
  background: #fff;
  border-right: 0.5px solid rgba(0,0,0,0.08);
  overflow-y: auto;
  padding: 8px 0;
  flex-shrink: 0;
}

.event-item {
  padding: 7px 14px;
  font-size: 12px;
  color: #888;
  cursor: pointer;
  border-right: 2px solid transparent;
}
.event-item:hover { background: #f5f4f0; color: #333; }
.event-item.active {
  color: #1a1a18;
  font-weight: 500;
  border-right-color: #1a1a18;
  background: #f5f4f0;
}

/* ------ RACE PANEL ------ */
.race-panel {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.race-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.race-title { font-size: 16px; font-weight: 500; color: #1a1a18; }
.race-sub { font-size: 12px; color: #aaa; }

.race-header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.edit-athletes-btn {
  padding: 5px 12px;
  font-size: 12px;
  border: 0.5px solid rgba(0,0,0,0.15);
  border-radius: var(--radius-md);
  background: transparent;
  color: #888;
  cursor: pointer;
  white-space: nowrap;
}
.edit-athletes-btn:hover { background: #f5f4f0; color: #333; }

.sync-event-btn {
  padding: 5px 12px;
  font-size: 12px;
  border: 0.5px solid rgba(0,0,0,0.15);
  border-radius: var(--radius-md);
  background: transparent;
  color: #888;
  cursor: pointer;
}
.sync-event-btn:hover { background: #f5f4f0; }
.sync-event-btn.syncing { color: var(--color-blue); border-color: var(--color-blue); }

/* ------ ATHLETE CARDS ------ */
.athlete-card {
  background: #fff;
  border: 0.5px solid rgba(0,0,0,0.1);
  border-radius: var(--radius-md);
  padding: 7px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: grab;
  user-select: none;
  transition: box-shadow 0.1s, opacity 0.1s;
}
.athlete-card:hover { border-color: rgba(0,0,0,0.2); }
.athlete-card.dragging { opacity: 0.35; }
.athlete-card.drag-over { box-shadow: 0 -2px 0 var(--color-blue); }

.place-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
}
.place-1 { background: var(--color-gold); color: var(--color-gold-text); }
.place-2 { background: var(--color-silver); color: var(--color-silver-text); }
.place-3 { background: var(--color-bronze); color: var(--color-bronze-text); }
.place-4 { background: var(--color-4th); color: var(--color-4th-text); }
.place-5 { background: var(--color-5th); color: var(--color-5th-text); }
.place-n { background: #f0efea; color: #bbb; }

.athlete-info { flex: 1; min-width: 0; }
.athlete-name { font-size: 13px; font-weight: 500; color: #1a1a18; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.athlete-meta { font-size: 11px; color: #aaa; }

.team-chip {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
  border: 0.5px solid rgba(0,0,0,0.1);
  color: #888;
  white-space: nowrap;
  flex-shrink: 0;
}

.pr-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.pr-badge {
  font-size: 12px;
  font-weight: 500;
  color: #333;
  white-space: nowrap;
  min-width: 36px;
  text-align: right;
}

.edit-pr-btn {
  display: block;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  color: #ccc;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  flex-shrink: 0;
}
.edit-pr-btn:hover { color: #555; background: #f0efea; }

.pr-edit-input {
  width: 68px;
  padding: 1px 5px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  border: 1.5px solid var(--color-blue);
  border-radius: 4px;
  outline: none;
  color: #1a1a18;
  text-align: center;
  background: #fff;
}

.pts-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--color-blue-light);
  color: var(--color-blue-text);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 52px;
  text-align: center;
}
.pts-none {
  font-size: 11px;
  color: #ddd;
  min-width: 52px;
  text-align: center;
  flex-shrink: 0;
}

.drag-hint {
  font-size: 10px;
  color: #e0dfd9;
  text-align: center;
  padding: 1px 0;
  letter-spacing: 2px;
}

.no-athletes {
  padding: 24px;
  text-align: center;
  color: #bbb;
  font-size: 13px;
}

/* Configure prompt (finals, no athletes selected) */
.configure-prompt {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 48px 24px;
}
.configure-prompt-icon { font-size: 32px; opacity: 0.3; }
.configure-prompt-text { font-size: 14px; color: #888; text-align: center; }
.configure-athletes-btn {
  padding: 8px 22px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  background: var(--color-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
}
.configure-athletes-btn:hover { background: var(--color-blue-text); }

/* Finals athlete selector modal */
.finals-athlete-modal-box {
  width: 460px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
}
.finals-athlete-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.modal-footer {
  padding: 12px 16px;
  border-top: 0.5px solid rgba(0,0,0,0.08);
  display: flex;
  justify-content: flex-end;
}
.modal-footer .step-btn { margin-top: 0; }

/* Athlete selection rows */
.athlete-select-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 0.5px solid transparent;
  user-select: none;
}
.athlete-select-row:hover { background: #f5f4f0; }
.athlete-select-row.checked { background: var(--color-blue-light); border-color: rgba(24,95,165,0.2); }
.athlete-checkbox { width: 15px; height: 15px; flex-shrink: 0; cursor: pointer; accent-color: var(--color-blue); }
.athlete-select-info { flex: 1; min-width: 0; }
.athlete-select-name { font-size: 13px; font-weight: 500; color: #1a1a18; }
.athlete-select-meta { font-size: 11px; color: #aaa; }
.athlete-select-pr { font-size: 12px; font-weight: 500; color: #333; white-space: nowrap; flex-shrink: 0; }

/* ------ STANDINGS ------ */
.standings-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.standings-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.standings-topbar-title { font-size: 16px; font-weight: 500; }

.toggle-wrap {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #888;
}
.toggle {
  position: relative;
  width: 32px;
  height: 18px;
  cursor: pointer;
  display: inline-block;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 20px;
  transition: background 0.2s;
}
.toggle input:checked + .toggle-track { background: var(--color-blue); }
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  transition: left 0.2s;
  pointer-events: none;
}
.toggle input:checked ~ .toggle-thumb { left: 16px; }

.standings-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 0.5px solid rgba(0,0,0,0.08);
}
.standings-table th {
  font-size: 11px;
  font-weight: 500;
  color: #aaa;
  text-align: left;
  padding: 8px 14px;
  border-bottom: 0.5px solid rgba(0,0,0,0.08);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #fafaf8;
}
.standings-table th.center { text-align: center; }
.standings-table td {
  padding: 10px 14px;
  font-size: 13px;
  color: #1a1a18;
  border-bottom: 0.5px solid rgba(0,0,0,0.05);
  vertical-align: middle;
}
.standings-table td.center { text-align: center; }
.standings-table tbody tr:last-child td { border-bottom: none; }
.standings-table tbody tr:hover { background: #fafaf8; }

.rank-cell { font-size: 13px; font-weight: 500; color: #bbb; }
.team-name-cell { font-weight: 500; }
.record-cell { font-size: 12px; }
.wins { color: var(--color-success); font-weight: 500; }
.losses { color: #bbb; }

.pts-confirmed { color: #1a1a18; }
.pts-projected { color: var(--color-blue); font-size: 12px; display: block; }
.pts-dash { color: #ddd; }
.total-confirmed { font-weight: 500; }
.total-projected { font-weight: 500; color: var(--color-blue); }

.standings-legend {
  display: flex;
  gap: 16px;
  margin-top: 14px;
  font-size: 11px;
  color: #bbb;
  align-items: center;
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}

/* ------ MODAL ------ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.wizard-container {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

.wizard-header {
  padding: 16px 20px;
  border-bottom: 0.5px solid rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
}
.wizard-title { font-size: 15px; font-weight: 500; flex: 1; }
.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #bbb;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.modal-close:hover { color: #333; }

.wizard-body { padding: 20px; display: flex; flex-direction: column; gap: 20px; }

.wizard-step {
  background: #fff;
  border: 0.5px solid rgba(0,0,0,0.1);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.wizard-step.locked { opacity: 0.5; pointer-events: none; }

.step-header {
  padding: 14px 16px;
  border-bottom: 0.5px solid rgba(0,0,0,0.07);
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fafaf8;
}
.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
}
.step-num.active { background: var(--color-blue-light); color: var(--color-blue-text); }
.step-num.done { background: var(--color-success-light); color: var(--color-success); }
.step-num.upcoming { background: #f0efea; color: #bbb; }

.step-title { font-size: 13px; font-weight: 500; }
.step-sub { font-size: 11px; color: #aaa; margin-top: 1px; }

.step-body { padding: 16px; }

.field-label { font-size: 12px; color: #888; margin-bottom: 6px; }

input[type="text"] {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  border: 0.5px solid rgba(0,0,0,0.15);
  border-radius: var(--radius-md);
  background: #fff;
  color: #1a1a18;
  outline: none;
  font-family: inherit;
}
input[type="text"]:focus { border-color: var(--color-blue); }
input[type="text"]::placeholder { color: #ccc; }

.team-inputs { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.team-input-row { display: flex; align-items: center; gap: 8px; }
.team-num { font-size: 12px; color: #bbb; width: 14px; text-align: right; flex-shrink: 0; }
.team-input-wrap { position: relative; flex: 1; }
.team-input-wrap input { padding-right: 110px; }
.verify-badge {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  white-space: nowrap;
  font-weight: 500;
}
.verify-badge.verified { color: var(--color-success); }
.verify-badge.error { color: #E24B4A; }
.verify-badge.checking { color: #aaa; }

.verify-hint { font-size: 11px; color: #bbb; }

.step-btn {
  margin-top: 14px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  border: 0.5px solid rgba(0,0,0,0.15);
  border-radius: var(--radius-md);
  background: #fff;
  color: #333;
  cursor: pointer;
  font-family: inherit;
}
.step-btn:hover { background: #f5f4f0; }
.step-btn.primary { background: var(--color-blue); color: #fff; border-color: var(--color-blue); }
.step-btn.primary:hover { background: var(--color-blue-text); }
.step-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-row { display: flex; gap: 8px; margin-top: 14px; }

.confirm-league-name { font-size: 18px; font-weight: 500; margin-bottom: 12px; }
.confirm-teams { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.confirm-team-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 7px 10px;
  background: #f5f4f0;
  border-radius: var(--radius-md);
}
.confirm-check { color: var(--color-success); }
.confirm-team-id { margin-left: auto; font-size: 11px; color: #aaa; }

.confirm-note {
  font-size: 12px;
  color: #888;
  padding: 10px 12px;
  background: #f5f4f0;
  border-radius: var(--radius-md);
  border-left: 2px solid #ddd;
}

/* WINNER MODAL */
.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 340px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  overflow: hidden;
}
.modal-header {
  padding: 14px 16px;
  border-bottom: 0.5px solid rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
}
.modal-title { font-size: 14px; font-weight: 500; flex: 1; }
.modal-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; }

.winner-option {
  padding: 10px 14px;
  border: 0.5px solid rgba(0,0,0,0.1);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: #fff;
  text-align: left;
  font-family: inherit;
  color: #1a1a18;
}
.winner-option:hover { background: #f5f4f0; border-color: rgba(0,0,0,0.2); }
.winner-option.selected { background: var(--color-success-light); border-color: var(--color-success); color: var(--color-success); }

.clear-winner-btn {
  padding: 8px 14px;
  border: none;
  background: none;
  font-size: 12px;
  color: #aaa;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.clear-winner-btn:hover { color: #E24B4A; }

/* SCRAPE STATUS TOAST */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #1a1a18;
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  z-index: 200;
  max-width: 300px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--color-success); }
.toast.error { background: #A32D2D; }
/* ------ APP SWITCHER ------ */
.app-switcher { flex: 1; }

.app-switcher-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.app-switcher-btn:hover #appSwitcherLabel { color: #555; }

#appSwitcherLabel {
  font-size: 11px;
  font-weight: 500;
  color: #888;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.switcher-caret {
  font-size: 8px;
  color: #bbb;
  margin-top: 1px;
  transition: transform 0.15s;
}
.app-switcher-menu.open ~ * .switcher-caret,
.app-switcher-btn .switcher-caret { transform: none; }

/* Menu uses position:fixed so sidebar overflow:hidden doesn't clip it */
.app-switcher-menu {
  display: none;
  position: fixed;
  background: #fff;
  border: 0.5px solid rgba(0,0,0,0.14);
  border-radius: var(--radius-md);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  min-width: 180px;
  z-index: 500;
  overflow: hidden;
}
.app-switcher-menu.open { display: block; }

.app-switcher-item {
  padding: 10px 16px;
  font-size: 13px;
  color: #444;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.app-switcher-item:hover { background: #f5f4f0; }
.app-switcher-item.active { color: var(--color-blue-text); font-weight: 500; }

/* ------ MEET SCRAPER PANEL ------ */
.ms-panel {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  max-width: 700px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.ms-title {
  font-size: 16px;
  font-weight: 500;
  color: #1a1a18;
  margin-bottom: 6px;
}

.ms-desc {
  font-size: 13px;
  color: #888;
  line-height: 1.55;
  margin-bottom: 24px;
  max-width: 560px;
}

.ms-form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.ms-field { display: flex; flex-direction: column; gap: 5px; }

.ms-label {
  font-size: 11px;
  font-weight: 500;
  color: #aaa;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ms-input {
  padding: 7px 10px;
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  border: 0.5px solid rgba(0,0,0,0.18);
  border-radius: var(--radius-md);
  background: #fff;
  color: #1a1a18;
  outline: none;
  width: 170px;
}
.ms-input:focus { border-color: var(--color-blue); }
.ms-input::placeholder { color: #ccc; }

.ms-select {
  padding: 7px 10px;
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  border: 0.5px solid rgba(0,0,0,0.18);
  border-radius: var(--radius-md);
  background: #fff;
  color: #1a1a18;
  outline: none;
  cursor: pointer;
  width: 120px;
}
.ms-select:focus { border-color: var(--color-blue); }

.ms-section-label {
  font-size: 11px;
  font-weight: 500;
  color: #aaa;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.ms-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 10px;
}

/* Chips look like real toggle buttons */
.ms-chip {
  padding: 5px 13px;
  font-size: 12px;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #555;
  background: #fff;
  border: 1px solid #d0cfca;
  border-radius: 20px;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  line-height: 1.4;
}
.ms-chip:hover {
  border-color: var(--color-success);
  color: var(--color-success);
  background: var(--color-success-light);
}
.ms-chip.ms-chip-on {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #fff;
}
.ms-chip.ms-chip-on:hover {
  background: #178a63;
  border-color: #178a63;
  color: #fff;
}

.ms-chip-links {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 22px;
}
.ms-chip-link {
  font-size: 12px;
  color: #aaa;
  cursor: pointer;
}
.ms-chip-link:hover { color: var(--color-blue-text); text-decoration: underline; }
.ms-chip-link-sep { font-size: 12px; color: #ddd; }

.ms-actions { margin-bottom: 20px; }

.ms-run-btn {
  padding: 8px 22px;
  background: var(--color-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer;
  transition: background 0.15s;
}
.ms-run-btn:hover:not(:disabled) { background: var(--color-blue-text); }
.ms-run-btn:disabled { background: #ccc; cursor: not-allowed; }

.ms-progress-track {
  height: 6px;
  background: #e8e7e2;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 7px;
}
.ms-progress-fill {
  height: 100%;
  background: var(--color-blue);
  border-radius: 6px;
  width: 0%;
  transition: width 0.35s ease;
}
.ms-progress-msg {
  font-size: 12px;
  color: #888;
  margin-bottom: 16px;
}

.ms-download-btn {
  padding: 8px 22px;
  background: var(--color-success);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer;
  transition: background 0.15s;
}
.ms-download-btn:hover { background: #178a63; }

/* College Scraper — multi-team ID list */
#csTeamList { display: flex; flex-direction: column; gap: 7px; margin-bottom: 10px; }

.cs-team-row { display: flex; align-items: center; gap: 8px; }

.cs-remove-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 0.5px solid rgba(0,0,0,0.15);
  background: transparent;
  color: #bbb;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  flex-shrink: 0;
  font-family: inherit;
}
.cs-remove-btn:hover { color: #E24B4A; background: #fcebeb; border-color: #E24B4A; }

.cs-add-btn {
  font-size: 12px;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--color-blue-text);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-bottom: 22px;
  display: block;
}
.cs-add-btn:hover { text-decoration: underline; }

/* ============================================================
   MOBILE RESPONSIVE  (≤ 768px)
   Sidebar becomes a fixed slide-in drawer.
   ============================================================ */

/* Mobile topbar — hidden on desktop */
.mobile-topbar {
  display: none;
}

/* Sidebar overlay — hidden on desktop */
.sidebar-overlay {
  display: none;
}

@media (max-width: 768px) {

  /* ── App shell ── */
  .app {
    flex-direction: column;
  }

  /* ── Mobile topbar ── */
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 52px;
    padding: 0 16px;
    background: #fff;
    border-bottom: 0.5px solid rgba(0,0,0,0.08);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 50;
  }

  .mobile-topbar-title {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a18;
    flex: 1;
  }

  /* Hamburger button */
  .hamburger-btn {
    width: 32px;
    height: 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
  }
  .hamburger-btn span {
    display: block;
    height: 2px;
    background: #555;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
  }
  /* Animate to X when open */
  .sidebar.open ~ * .hamburger-btn span:nth-child(1),
  body.sidebar-open .hamburger-btn span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  body.sidebar-open .hamburger-btn span:nth-child(2) { opacity: 0; }
  body.sidebar-open .hamburger-btn span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* ── Sidebar becomes a fixed drawer ── */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    min-width: 0;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.14);
  }

  /* ── Overlay behind the drawer ── */
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .sidebar-overlay.visible {
    opacity: 1;
    pointer-events: all;
  }

  /* ── Main panel fills the screen ── */
  .main {
    flex: 1;
    min-height: 0;
  }

  /* ── Meet / College scraper panels need padding relief ── */
  .ms-panel {
    padding: 20px 18px;
  }

  /* ── Scoreboard on dual-meet topbar: stack vertically ── */
  .topbar {
    flex-wrap: wrap;
    gap: 10px;
  }
  .scoreboard-dual {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }

  /* ── Event sidebar takes less horizontal space ── */
  :root {
    --event-sidebar-width: 110px;
  }

  /* ── Wizard modal full-width on mobile ── */
  .wizard-container {
    width: 95vw;
  }

  /* ── Hide PR edit button on mobile (UI too cramped) ── */
  .edit-pr-btn { display: none !important; }

  /* ── Visibility Utilities (moved to top of block to avoid overrides) ── */
  .mobile-only { display: block !important; }
  .desktop-only { display: none !important; }

  /* ── Option 1: Horizontal Event Strip ── */
  .content-area {
    flex-direction: column;
  }

  .event-sidebar {
    width: 100% !important;
    min-width: 0 !important;
    height: auto;
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 0.5px solid rgba(0,0,0,0.08);
    padding: 0 10px;
    -webkit-overflow-scrolling: touch;
  }

  .event-item {
    white-space: nowrap;
    padding: 12px 15px;
    border-right: none;
    border-bottom: 2px solid transparent;
  }

  .event-item.active {
    border-right-color: transparent;
    border-bottom-color: var(--color-blue);
  }

  /* ── Condense Header ── */
  .topbar {
    padding: 8px 16px;
    justify-content: space-between;
    position: relative; /* Required for the absolute-positioned overlay */
  }

  .mobile-score-pill {
    display: none; /* Shown via JS if in dual meet */
    font-weight: 600;
    color: var(--color-blue);
    margin-left: 4px;
  }

  .standings-toggle-btn {
    background: #f5f4f0;
    border: 0.5px solid rgba(0,0,0,0.1);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
  }

  .mobile-standings-overlay {
    display: block !important;
    position: absolute;
    top: 52px;
    right: 16px;
    background: #fff;
    border: 0.5px solid rgba(0,0,0,0.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 12px;
    border-radius: var(--radius-md);
    z-index: 1000;
    min-width: 160px;
  }

  /* ── Fix Athlete Info Layout ── */
  .athlete-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    flex: 1;
    min-width: 0; /* Allows children to truncate/ellipsis */
  }

  .athlete-name {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
  }

  .athlete-meta {
    display: block;
    font-size: 10px;
    color: #999;
    white-space: nowrap; /* Prevents "Gr. 11" from splitting into two lines */
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ── Shrink Right-side elements to save space ── */
  .pr-badge {
    min-width: auto;
    font-size: 11px;
  }

  .pts-badge, .pts-none {
    min-width: 44px;
    font-size: 10px;
    padding: 2px 4px;
  }

}

.mobile-only { display: none; }
