/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: #f4f6f8;
  color: #1a1a2e;
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  background: #1a1a2e;
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

header h1 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.header-actions { display: flex; gap: 10px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary  { background: #2d6cf0; color: #fff; }
.btn-secondary{ background: #e2e8f0; color: #1a1a2e; }

/* ── Season info bar ─────────────────────────────────────────────────────── */
.season-bar {
  background: #1e293b;
  color: #cbd5e1;
  padding: 8px 24px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.season-bar-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.season-bar-link {
  color: #7dd3fc;
  text-decoration: none;
  font-weight: 500;
}
.season-bar-link:hover { text-decoration: underline; }

#season-bar-divisions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.div-pill {
  background: #334155;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  color: #94a3b8;
}
.div-pill strong { color: #e2e8f0; }

/* ── Banners ─────────────────────────────────────────────────────────────── */
.success-banner {
  background: #d1fae5;
  border-left: 4px solid #10b981;
  color: #065f46;
  padding: 10px 24px;
  font-weight: 500;
}
.success-banner.warn {
  background: #fff7ed;
  border-color: #f97316;
  color: #7c2d12;
}
.success-banner.error {
  background: #fee2e2;
  border-color: #ef4444;
  color: #7f1d1d;
}

.conflict-section {
  background: #fff8f1;
  border-left: 4px solid #f97316;
  padding: 14px 24px;
  margin: 0;
}
.conflict-section h2 {
  font-size: 1rem;
  color: #c2410c;
  margin-bottom: 10px;
}
.conflict-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.conflict-section-header h2 { margin-bottom: 0; }
.conflict-card {
  background: #fff;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 8px;
  line-height: 1.6;
}

.warning-section {
  background: #fffbeb;
  border-left: 4px solid #eab308;
  padding: 14px 24px;
  margin: 0;
}
.warning-section h2 {
  font-size: 1rem;
  color: #92400e;
  margin-bottom: 10px;
}
.warning-card {
  background: #fff;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 8px;
  line-height: 1.6;
}

/* ── Tabs ────────────────────────────────────────────────────────────────── */
#tabs-container {
  max-width: 1200px;
  margin: 16px auto 0;
  padding: 0 16px;
}

.admin-tabs-sep { width: 1px; height: 18px; background: #e2e8f0; margin: 0 8px; flex-shrink: 0; align-self: center; }
.admin-top-view-btn { background: none; border: 1px solid #e2e8f0; border-radius: 5px; padding: 4px 11px; font-size: 12px; font-weight: 600; color: #64748b; cursor: pointer; white-space: nowrap; margin: 4px 2px; align-self: center; }
.admin-top-view-btn:hover { color: #1a1a2e; border-color: #94a3b8; }
.admin-top-view-btn.active { background: #2d6cf0; color: #fff; border-color: #2d6cf0; }

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0;
  flex-wrap: wrap;
  align-items: center;
}

.tab-btn {
  background: none;
  border: 2px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 8px 18px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  position: relative;
  bottom: -2px;
  transition: color 0.1s, border-color 0.1s;
}
.tab-btn:hover { color: #1a1a2e; }
.tab-btn.active {
  color: #2d6cf0;
  border-color: #e2e8f0 #e2e8f0 #fff;
  background: #fff;
}

.game-count {
  margin-left: auto;
  font-size: 12px;
  color: #94a3b8;
}

/* ── Table ───────────────────────────────────────────────────────────────── */
#schedule-table-wrapper {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0 0 8px 8px;
  overflow-x: auto;
  margin-bottom: 24px;
}

#schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

#schedule-table th {
  background: #f8fafc;
  padding: 9px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

#schedule-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

#schedule-table tr:last-child td { border-bottom: none; }

#schedule-table tbody tr:hover { background: #f8fafc; }

.team-cell { font-weight: 500; }
.team-cell.home { color: #1d4ed8; }
.team-cell.away { color: #374151; }

.center { text-align: center; }

.address {
  color: #94a3b8;
  font-size: 12px;
  max-width: 200px;
}

/* Rematch rows */
.rematch-row td { background: #fefce8; }
.rematch-row:hover td { background: #fef9c3 !important; }

/* Cancelled (rained out) rows */
.cancelled-row td { background: #f8fafc; color: #94a3b8; text-decoration: line-through; }
.cancelled-row:hover td { background: #f1f5f9 !important; }
.cancelled-row td:last-child { text-decoration: none; }
.game-id-cell { color: #6b7280; font-size: 12px; font-weight: 600; white-space: nowrap; }

.no-games {
  text-align: center;
  padding: 32px;
  color: #94a3b8;
}

/* ── Loading ─────────────────────────────────────────────────────────────── */
.loading {
  text-align: center;
  padding: 20px;
  color: #64748b;
  font-style: italic;
}

/* ── View bar ────────────────────────────────────────────────────────────── */
.view-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-top: none;
  padding: 8px 12px;
  gap: 12px;
  flex-wrap: wrap;
}

.view-btns {
  display: flex;
  gap: 4px;
}

.view-btn {
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  padding: 5px 13px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.view-btn:hover { background: #f1f5f9; color: #1a1a2e; }
.view-btn.active { background: #2d6cf0; color: #fff; border-color: #2d6cf0; }

.view-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}
.view-controls label {
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 6px;
}
.view-controls select {
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-size: 12px;
  background: #fff;
}

/* ── View panels ─────────────────────────────────────────────────────────── */
.view-panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 16px;
  margin-bottom: 24px;
}

/* ── Teams view ──────────────────────────────────────────────────────────────
   Each card used to hold an 8-column table (#, Wk, Date, Day, Time, H/A,
   Opponent, Field) that refused to shrink below its content's natural width
   — a CSS Grid item's default min-width is `auto`, not 0, so the un-wrapping
   table forced the card itself wider than its grid track and bled into the
   next card instead of being clipped by the card's own overflow:hidden
   (Ted, 2026-08-14, screenshot showed the bleed directly). Fixed two ways:
   min-width:0 lets the card actually shrink to its track, and the content
   itself is now flex/wrap/ellipsis-friendly rows (the same pattern already
   proven to work at any width in the public viewer's team cards) instead of
   a rigid table, so nothing needs a table's full column width to read fine. */
#teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.team-card {
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  overflow: hidden;
  font-size: 12px;
  min-width: 0;
}

.team-card-header {
  background: #f8fafc;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid #e2e8f0;
}

.team-card-name {
  font-weight: 700;
  font-size: 13px;
  color: #1a1a2e;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-card-meta {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  flex-shrink: 0;
}

.team-card-game {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
}
.team-card-game:last-child { border-bottom: none; }
.team-card-game-main {
  display: flex;
  align-items: center;
  gap: 8px;
}
.team-card-game-opp {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: #1a1a2e;
}
.team-card-game-meta {
  margin-top: 2px;
  font-size: 11px;
  color: #64748b;
}
.team-card-game-field {
  margin-top: 1px;
  font-size: 11px;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.team-card-game.no-games { color: #94a3b8; font-style: italic; }

.ha-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}
.ha-badge.home { background: #dbeafe; color: #1d4ed8; }
.ha-badge.away { background: #f1f5f9; color: #475569; }

/* ── Matrix view ─────────────────────────────────────────────────────────── */
.matrix-scroll {
  overflow-x: auto;
}

.matrix-table {
  border-collapse: collapse;
  font-size: 11px;
  white-space: nowrap;
}

.matrix-table th, .matrix-table td {
  padding: 5px 8px;
  border: 1px solid #e2e8f0;
  text-align: center;
  vertical-align: middle;
}

.matrix-corner { background: #f8fafc; }

.matrix-col-head {
  background: #f8fafc;
  font-weight: 600;
  color: #475569;
  font-size: 10px;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.matrix-row-head {
  background: #f8fafc;
  font-weight: 600;
  color: #1a1a2e;
  text-align: left;
  white-space: nowrap;
}

.matrix-cell { min-width: 52px; }
.matrix-self { background: #f1f5f9; }
.matrix-zero { color: #cbd5e1; }

.matrix-count {
  font-weight: 700;
  font-size: 13px;
  display: block;
  line-height: 1.2;
}

.matrix-ha {
  font-size: 10px;
  color: #64748b;
}

/* intensity shading */
.matrix-i1 { background: #eff6ff; }
.matrix-i2 { background: #dbeafe; }
.matrix-i3 { background: #bfdbfe; }
.matrix-i4 { background: #93c5fd; color: #1e3a8a; }

/* ── Stats view ──────────────────────────────────────────────────────────── */
.stats-scroll { overflow-x: auto; }

.stats-table {
  border-collapse: collapse;
  font-size: 12px;
  width: 100%;
}

.stats-table th {
  background: #f8fafc;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  border-bottom: 2px solid #e2e8f0;
  text-align: center;
  white-space: nowrap;
}

.stats-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #f1f5f9;
  text-align: center;
}

.stats-table tr:last-child td { border-bottom: none; }
.stats-table tbody tr:hover td { background: #f8fafc; }

.stats-team-name { text-align: left; font-weight: 500; color: #1a1a2e; }
.stat-total { font-weight: 700; }
.stat-warn { background: #fff7ed !important; color: #c2410c; font-weight: 600; }
.stat-zero { color: #cbd5e1; }

.stats-note {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 8px;
}

/* ── Utilities ───────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Top nav ─────────────────────────────────────────────────────────────── */
#top-nav {
  background: #1e293b;
  padding: 0 24px;
  display: flex;
  gap: 2px;
}

.top-nav-btn {
  background: none;
  border: none;
  color: #94a3b8;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: color 0.1s, border-color 0.1s;
}
.top-nav-btn:hover { color: #e2e8f0; }
.top-nav-btn.active { color: #fff; border-bottom-color: #2d6cf0; }

/* ── Page section ────────────────────────────────────────────────────────── */
.page-section {
  max-width: 1200px;
  margin: 16px auto;
  padding: 0 16px;
}

/* ── Teams roster page ───────────────────────────────────────────────────── */
.teams-division-section {
  margin-bottom: 24px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.teams-division-header {
  background: #1e293b;
  color: #fff;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.teams-div-count {
  font-size: 11px;
  font-weight: 400;
  color: #94a3b8;
}

.teams-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.teams-table th {
  background: #f8fafc;
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.teams-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.teams-table tr:last-child td { border-bottom: none; }
.teams-table tbody tr:hover td { background: #f8fafc; }

.teams-table-name { font-weight: 600; color: #1a1a2e; }

.unconfirmed-row td { color: #94a3b8; }

.confirmed-badge {
  display: inline-block;
  background: #d1fae5;
  color: #065f46;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}

.unconfirmed-badge {
  display: inline-block;
  background: #fee2e2;
  color: #7f1d1d;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}

/* ── Game row interaction ─────────────────────────────────────────────────── */
.game-row { cursor: pointer; }
.game-row:hover td { background: #eff6ff !important; }

/* ── Edit Modal ──────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background: #fff;
  border-radius: 10px;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow-y: auto;
  margin: 16px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a2e;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #64748b;
  padding: 0 4px;
  line-height: 1;
}
.modal-close:hover { color: #1a1a2e; }

.modal-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.modal-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  flex: 1;
  min-width: 140px;
}

.modal-row label select,
.modal-row label input {
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  color: #1a1a2e;
}

.modal-row label select:focus,
.modal-row label input:focus {
  outline: 2px solid #2d6cf0;
  outline-offset: 1px;
}

/* ── Date suggest button & panel ─────────────────────────────────────────── */
.date-suggest-row { display: flex; gap: 6px; align-items: center; }
.date-suggest-row select { flex: 1; min-width: 0; }

.btn-suggest-dates {
  white-space: nowrap;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #94a3b8;
  border-radius: 6px;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
}
.btn-suggest-dates:hover { background: #e2e8f0; border-color: #64748b; }
.btn-suggest-dates:disabled { opacity: .5; cursor: default; }

.suggest-panel {
  margin: 0 20px 8px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  font-size: 12px;
  max-height: 260px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.suggest-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid #bfdbfe;
  font-weight: 600;
  color: #1e40af;
  flex-shrink: 0;
}
.suggest-panel-header span { font-size: 11px; }
.suggest-close-btn {
  background: none; border: none; font-size: 16px; line-height: 1;
  color: #64748b; cursor: pointer; padding: 0 2px;
}
.suggest-close-btn:hover { color: #1e293b; }
.suggest-slots { overflow-y: auto; flex: 1; }
.suggest-week-label {
  padding: 5px 12px 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #6b7280;
  background: #dbeafe;
  border-bottom: 1px solid #bfdbfe;
  position: sticky;
  top: 0;
}
.suggest-slot {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 7px 12px;
  border: none;
  border-bottom: 1px solid #dbeafe;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  color: #1e3a5f;
}
.suggest-slot:last-child { border-bottom: none; }
.suggest-slot:hover { background: #dbeafe; }
.suggest-slot.selected { background: #bfdbfe; box-shadow: inset 3px 0 0 #2563eb; }
.suggest-slot-date { font-weight: 600; white-space: nowrap; min-width: 110px; }
.suggest-field-free { color: #15803d; font-size: 11px; }
.suggest-field-busy { color: #92400e; font-size: 11px; }
.suggest-empty { padding: 12px; color: #6b7280; font-style: italic; margin: 0; }
.suggest-loading { padding: 12px; color: #6b7280; margin: 0; }

.edit-violations {
  margin: 0 20px;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 12px;
  color: #7f1d1d;
}

.edit-violations ul {
  margin: 6px 0 0 16px;
  padding: 0;
}

.edit-violations li { margin-bottom: 3px; }

.modal-footer {
  display: flex;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid #e2e8f0;
  justify-content: flex-end;
}

.btn-warn {
  background: #f97316;
  color: #fff;
  border: none;
}
.btn-danger {
  background: #dc2626;
  color: #fff;
  border: none;
}
.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}
.delete-confirm-panel {
  padding: 20px;
  display: flex;
  align-items: flex-start;
}
.delete-confirm-msg {
  font-size: 14px;
  color: #1e293b;
  line-height: 1.5;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 14px 16px;
  width: 100%;
}

/* ── Notify panel (shown in modal after successful save) ─────────────────── */
.notify-panel { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.notify-saved-banner { background: #dcfce7; border: 1px solid #86efac; border-radius: 6px; padding: 9px 14px; font-size: 13px; font-weight: 600; color: #166534; }
.notify-changes-list { display: flex; flex-direction: column; gap: 4px; }
.notify-change-row { font-size: 12px; color: #475569; display: flex; gap: 6px; align-items: baseline; }
.notify-change-field { font-weight: 700; color: #1e293b; min-width: 60px; }
.notify-change-from { color: #94a3b8; text-decoration: line-through; }
.notify-change-arrow { color: #94a3b8; }
.notify-change-to { color: #1d4ed8; font-weight: 600; }
.notify-team-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.notify-team-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px 12px; }
.notify-team-role { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; margin-bottom: 4px; }
.notify-team-name { font-size: 13px; font-weight: 700; color: #1e293b; margin-bottom: 6px; }
.notify-team-contact { font-size: 11px; color: #475569; display: flex; flex-direction: column; gap: 2px; }
.notify-team-contact a { color: #2d6cf0; text-decoration: none; }
.notify-team-contact a:hover { text-decoration: underline; }
.notify-no-contact { font-size: 12px; color: #94a3b8; font-style: italic; }
@media (max-width: 480px) { .notify-team-cards { grid-template-columns: 1fr; } }

/* ── Changes page ─────────────────────────────────────────────────────────── */
.changes-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
.changes-toolbar-title { font-size: 14px; font-weight: 700; color: #1e293b; }
.changes-empty { text-align: center; padding: 48px 24px; color: #94a3b8; font-size: 14px; }
.change-entry { border-bottom: 1px solid #f1f5f9; padding: 14px 20px; }
.change-entry:last-child { border-bottom: none; }
.change-entry-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.change-ts { font-size: 11px; color: #94a3b8; white-space: nowrap; }
.change-game-badge { font-size: 11px; font-weight: 700; background: #e0e7ff; color: #3730a3; border-radius: 4px; padding: 2px 7px; }
.change-div-badge { font-size: 11px; background: #f1f5f9; color: #475569; border-radius: 4px; padding: 2px 7px; }
.change-forced-badge { font-size: 10px; background: #fff7ed; color: #c2410c; border-radius: 4px; padding: 2px 6px; font-weight: 600; }
.change-fields { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.change-field-pill { font-size: 11px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 4px; padding: 3px 8px; color: #475569; }
.change-field-pill strong { color: #1e293b; }
.change-field-pill .pill-from { color: #94a3b8; text-decoration: line-through; }
.change-field-pill .pill-to { color: #1d4ed8; font-weight: 600; }
.change-teams { display: flex; gap: 12px; flex-wrap: wrap; }
.change-team-info { font-size: 11px; color: #64748b; }
.change-team-info strong { color: #1e293b; }
.change-team-info a { color: #2d6cf0; text-decoration: none; }
.change-team-info a:hover { text-decoration: underline; }
.change-resend { font-size: 11px; color: #2d6cf0; text-decoration: none; cursor: pointer; background: none; border: none; padding: 0; }
.change-resend:hover { text-decoration: underline; }
.change-entry-actions { display: flex; gap: 8px; margin-top: 6px; }

/* ── Season Editor ───────────────────────────────────────────────────────── */
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}
.editor-toolbar-title { font-size: 1rem; font-weight: 700; color: #1a1a2e; }

.editor-division-section { margin: 20px 24px; background: #fff; border-radius: 8px; border: 1px solid #e2e8f0; overflow: hidden; }
.editor-division-header { padding: 10px 16px; background: #f1f5f9; font-weight: 700; font-size: 13px; color: #1a1a2e; border-bottom: 1px solid #e2e8f0; }

.editor-team { border-bottom: 1px solid #f1f5f9; }
.editor-team:last-child { border-bottom: none; }

.editor-team-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}
.editor-team-row:hover { background: #f8fafc; }
.editor-team-row.open  { background: #f0f4ff; }

.editor-team-name  { font-weight: 600; flex: 2; min-width: 140px; }
.editor-team-coach { flex: 2; color: #475569; min-width: 120px; }
.editor-team-field { flex: 2; color: #64748b; font-size: 12px; min-width: 120px; }
.editor-chevron    { margin-left: auto; color: #94a3b8; font-size: 18px; transition: transform 0.15s; }
.editor-team-row.open .editor-chevron { transform: rotate(90deg); }

.editor-team-form { padding: 16px; background: #f8fafc; border-top: 1px solid #e2e8f0; }

.editor-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.editor-form-bottom { display: flex; gap: 16px; align-items: flex-start; }
.editor-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}
.editor-label input,
.editor-label select,
.editor-label textarea {
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  background: #fff;
  color: #1a1a2e;
  width: 100%;
}
.editor-label textarea { resize: vertical; font-family: monospace; }
.editor-hint { font-weight: 400; color: #94a3b8; }

.editor-label-wide { flex: 1; }

.editor-form-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  min-width: 160px;
}

.editor-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
}

.editor-form-actions { display: flex; gap: 8px; }

.editor-status { font-size: 12px; font-weight: 600; min-height: 16px; }
.editor-status.saved { color: #16a34a; }
.editor-status.error { color: #dc2626; }

/* ── Calendar View ───────────────────────────────────────────────────────── */
.cal-controls { padding: 12px 16px; display: flex; align-items: center; gap: 12px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.cal-controls label { font-size: 13px; font-weight: 600; color: #475569; display: flex; align-items: center; gap: 8px; }
.cal-controls select { font-size: 13px; padding: 5px 8px; border: 1px solid #cbd5e1; border-radius: 5px; background: #fff; }

#calendar-wrapper { padding: 16px 24px; display: flex; flex-direction: column; gap: 24px; }

.cal-month { }
.cal-month-label { font-size: 15px; font-weight: 700; color: #1a1a2e; margin-bottom: 8px; }

.cal-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal-table thead th {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  padding: 4px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cal-table td { vertical-align: top; padding: 0; border: 1px solid #e2e8f0; height: 80px; width: 14.28%; }
.cal-empty           { background: #f8fafc; }
.cal-day             { background: #fff; padding: 6px; }
.cal-has-game        { background: #eff6ff; border-color: #bfdbfe; }
.cal-blackout        { background: #fff1f2; border-color: #fecdd3; }
.cal-global-blackout { background: #fff7ed; border-color: #fed7aa; }
/* Game takes visual priority over blackout */
.cal-has-game.cal-blackout        { background: #eff6ff; border-color: #bfdbfe; }
.cal-has-game.cal-global-blackout { background: #eff6ff; border-color: #bfdbfe; }

.cal-day-num {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 4px;
}
.cal-has-game .cal-day-num        { color: #1d4ed8; }
.cal-blackout .cal-day-num        { color: #e11d48; }
.cal-global-blackout .cal-day-num { color: #ea580c; }

.cal-game {
  font-size: 11px;
  line-height: 1.4;
  margin-bottom: 3px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.cal-game.cal-rematch { border-left: 2px solid #f59e0b; padding-left: 3px; }
.cal-game.cal-forced  { border-left: 2px solid #b91c1c; padding-left: 3px; background: #fef2f2; }
.cal-opp  { font-weight: 600; color: #1a1a2e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-meta { color: #64748b; font-size: 10px; }

.cal-ha-label {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  display: inline-block;
  margin-bottom: 2px;
}
.cal-ha-label.home { background: #dbeafe; color: #1d4ed8; }
.cal-ha-label.away { background: #f3e8ff; color: #7e22ce; }

/* Calendar legend */
.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 0 4px;
  font-size: 12px;
  color: #475569;
}
.cal-legend-item { display: flex; align-items: center; gap: 6px; }
.cal-legend-swatch {
  width: 14px; height: 14px;
  border-radius: 3px;
  border: 1px solid #e2e8f0;
  display: inline-block;
}
.cal-swatch-game     { background: #eff6ff; border-color: #bfdbfe; }
.cal-swatch-blackout { background: #fff1f2; border-color: #fecdd3; }
.cal-swatch-rematch  { border-left: 3px solid #f59e0b; background: #fff; }
.cal-swatch-global   { background: #fff7ed; border-color: #fed7aa; }

/* ── Availability calendar (coach/director/admin) ────────────────────────── */
.av-label { display: block; font-size: 10px; color: #475569; margin-top: 2px; line-height: 1.2; }
td.cal-day.av-both, .cal-legend-swatch.av-both, .cal-legend-swatch.av-open   { background: #f0fdf4; border-color: #bbf7d0; }
td.cal-day.av-open                                                          { background: #f0fdf4; border-color: #bbf7d0; }
td.cal-day.av-home, .cal-legend-swatch.av-home                              { background: #eff6ff; border-color: #bfdbfe; }
td.cal-day.av-away, .cal-legend-swatch.av-away                              { background: #faf5ff; border-color: #e9d5ff; }
td.cal-day.av-none, .cal-legend-swatch.av-none,
td.cal-day.av-closed, .cal-legend-swatch.av-closed                          { background: #fff1f2; border-color: #fecdd3; }
td.cal-day.av-mixed, .cal-legend-swatch.av-mixed                            { background: #fffbeb; border-color: #fde68a; }
.av-both .cal-day-num, .av-open .cal-day-num   { color: #15803d; }
.av-home .cal-day-num                          { color: #1d4ed8; }
.av-away .cal-day-num                          { color: #7e22ce; }
.av-none .cal-day-num, .av-closed .cal-day-num { color: #e11d48; }
.av-mixed .cal-day-num                         { color: #b45309; }
.availability-controls { padding: 12px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: #f8fafc; border-bottom: 1px solid #e2e8f0; border-radius: 8px 8px 0 0; }
.availability-controls label { font-size: 13px; font-weight: 600; color: #475569; display: flex; align-items: center; gap: 8px; }
.availability-controls select { font-size: 13px; padding: 5px 8px; border: 1px solid #cbd5e1; border-radius: 5px; background: #fff; }
.av-cal-wrapper { padding: 16px; display: flex; flex-direction: column; gap: 24px; }

/* ── Division target games editor ────────────────────────────────────────── */
.editor-division-header { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.div-target-wrap { margin-left: auto; display: flex; align-items: center; gap: 6px; font-weight: 400; font-size: 12px; color: #64748b; }
.div-target-input { width: 52px; padding: 3px 6px; font-size: 12px; border: 1px solid #cbd5e1; border-radius: 4px; text-align: center; }
.div-target-hint { color: #94a3b8; }

/* ── Field editor ────────────────────────────────────────────────────────── */
.field-editor-form { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; margin: 0 0 16px; overflow: hidden; }
.field-form-inner { padding: 20px; }
.field-form-inner h3 { font-size: 15px; font-weight: 700; margin-bottom: 14px; color: #1e293b; }
.field-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.field-form-row label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: #374151; }
.field-form-row input { padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13px; }
.field-form-hint { font-weight: 400; color: #94a3b8; }
.field-form-actions { display: flex; gap: 8px; margin-top: 16px; }
.field-form-error { color: #dc2626; font-size: 12px; margin-top: 8px; padding: 6px 10px; background: #fef2f2; border-radius: 5px; }

.fields-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden; font-size: 13px; }
.fields-table th { background: #f8fafc; padding: 9px 12px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #64748b; border-bottom: 1px solid #e2e8f0; }
.fields-table td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.fields-table tr:last-child td { border-bottom: none; }
.fields-table tbody tr:hover { background: #f8fafc; }
.field-subfield-badge { display: inline-block; font-size: 10px; background: #ede9fe; color: #6d28d9; border-radius: 3px; padding: 1px 6px; margin-left: 6px; font-weight: 600; }
.field-used-badge { font-size: 10px; color: #94a3b8; background: #f1f5f9; border-radius: 3px; padding: 1px 6px; }
.map-link { font-size: 11px; color: #2563eb; text-decoration: none; margin-left: 6px; white-space: nowrap; }
.map-link:hover { text-decoration: underline; }
@media (max-width: 600px) { .field-form-row { grid-template-columns: 1fr; } }

/* ── Help modal ──────────────────────────────────────────────────────────── */
.help-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.help-modal { background: #fff; border-radius: 14px; max-width: 540px; width: 100%; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.help-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 14px; border-bottom: 1px solid #e2e8f0; }
.help-modal-header h2 { font-size: 17px; font-weight: 700; color: #1e293b; }
.help-modal-close { background: none; border: none; font-size: 22px; color: #94a3b8; cursor: pointer; line-height: 1; padding: 0 4px; }
.help-modal-close:hover { color: #374151; }
.help-modal-body { padding: 18px 20px 24px; }
.help-section { margin-bottom: 20px; }
.help-section:last-child { margin-bottom: 0; }
.help-section h3 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #64748b; margin-bottom: 10px; }
.help-item { display: flex; gap: 10px; margin-bottom: 10px; }
.help-icon { font-size: 20px; line-height: 1.3; flex-shrink: 0; }
.help-item-body { flex: 1; }
.help-item-body strong { display: block; font-size: 13px; color: #1e293b; margin-bottom: 2px; }
.help-item-body p { font-size: 12px; color: #64748b; line-height: 1.5; }
.help-btn { margin-left: 6px; background: none; border: 1px solid #cbd5e1; border-radius: 5px; padding: 2px 8px; font-size: 11px; color: #374151; cursor: pointer; vertical-align: middle; }
.help-btn:hover { background: #f1f5f9; }

/* ── Admin Fields view ───────────────────────────────────────────────────── */
.field-utilization { font-size: 12px; color: #64748b; margin-bottom: 12px; }
.field-utilization strong { color: #1e293b; }
.field-date-group { margin-bottom: 20px; }
.field-date-header { font-size: 13px; font-weight: 700; color: #1e293b; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 6px 6px 0 0; padding: 7px 12px; display: flex; justify-content: space-between; align-items: center; }
.field-date-header .fday-sat { color: #2d6cf0; }
.field-date-header .fday-wd  { color: #64748b; }
.field-date-count { font-size: 11px; font-weight: 500; color: #94a3b8; }
.field-games-table { width: 100%; border-collapse: collapse; font-size: 12px; background: #fff; border: 1px solid #e2e8f0; border-top: none; border-radius: 0 0 6px 6px; overflow: hidden; }
.field-games-table th { background: #f8fafc; padding: 6px 10px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #64748b; border-bottom: 1px solid #e2e8f0; }
.field-games-table td { padding: 7px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.field-games-table tr:last-child td { border-bottom: none; }
.field-games-table tbody tr:hover { background: #f8fafc; }
.field-div-badge { display: inline-block; background: #e0e7ff; color: #3730a3; font-size: 10px; font-weight: 700; border-radius: 3px; padding: 1px 5px; white-space: nowrap; }

/* ── Shared UI additions ──────────────────────────────────────────────────
   Classes replacing the inline styles that accumulated across the coach,
   director and admin pages, plus the mobile handling those pages lacked. */

/* Tables must scroll inside their own box on narrow screens rather than
   forcing the page sideways — coaches are usually on a phone. */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap > table { min-width: 460px; }

/* Games list, mobile: below ~640px a table with a Score column plus up to 5
   action buttons in its last cell has nowhere to put them — the actions
   column can't shrink below its buttons' natural width, so the row either
   scrolls horizontally or (with wrapping) balloons to 150-200px of mostly
   dead space per game. A card per game, stacked, with actions in a proper
   grid instead of a cramped table cell, is the fix — same pattern the
   public viewer already uses for its own games table. */
.mg-cards { display: none; flex-direction: column; gap: 10px; }
.mg-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.mg-card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12px; color: var(--ink-3); }
.mg-card-matchup { margin-top: 4px; font-size: 15px; font-weight: 600; color: var(--ink); }
.mg-card-matchup .mg-ha { font-weight: 400; color: var(--ink-3); font-size: 13px; }
.mg-card-badges { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.mg-card-actions { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mg-card-actions .btn { width: 100%; padding: 9px 8px; font-size: 13px; }
.mg-card-actions .btn-sm { padding: 9px 8px; font-size: 13px; }
@media (max-width: 640px) {
  .mg-table-wrap { display: none; }
  .mg-cards { display: flex; }
}

.page-wrap { max-width: 1000px; margin: 0 auto; padding: 24px; }
.page-wrap.narrow { max-width: 680px; }

.muted { color: #94a3b8; }
.empty-note { color: #94a3b8; padding: 24px; text-align: center; font-size: 14px; }
.danger-text { color: #dc2626; }
.section-gap { margin-top: 32px; }

/* Status pills, previously hand-rolled inline on every page. */
.pill { display: inline-block; border-radius: 4px; padding: 2px 8px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill-neutral { background: #f1f5f9; color: #475569; }
.pill-wait    { background: #fef3c7; color: #92400e; }
.pill-good    { background: #dcfce7; color: #166534; }
.pill-bad     { background: #fef2f2; color: #991b1b; }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Inline feedback, replacing alert() for anything that isn't destructive. */
.notice { border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-top: 10px; border: 1px solid transparent; }
.notice-good { background: #dcfce7; border-color: #86efac; color: #166534; }
.notice-warn { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.notice-bad  { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

/* Toast for transient confirmations. */
#toast-host { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 9999;
              display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #1a1a2e; color: #fff; padding: 11px 18px; border-radius: 8px; font-size: 14px;
         box-shadow: 0 6px 24px rgba(0,0,0,.22); max-width: 90vw; animation: toast-in .18s ease-out; }
.toast.good { background: #166534; } .toast.bad { background: #991b1b; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Slide-over panel — used for game history, which was previously an alert(). */
.panel-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 9998;
                 display: flex; justify-content: flex-end; }
.panel { background: #f8fafc; width: 100%; max-width: 520px; height: 100%; overflow-y: auto;
         box-shadow: -8px 0 30px rgba(0,0,0,.18); animation: panel-in .18s ease-out; }
@keyframes panel-in { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.panel-head { position: sticky; top: 0; background: #1a1a2e; color: #fff; padding: 16px 20px;
              display: flex; align-items: center; justify-content: space-between; }
.panel-head h2 { font-size: 1rem; font-weight: 700; }
.panel-close { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; line-height: 1; padding: 0 4px; }
.panel-body { padding: 18px 20px; }

/* Timeline for game history. */
.tl { list-style: none; position: relative; padding-left: 20px; }
.tl::before { content: ''; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: #e2e8f0; }
.tl li { position: relative; padding: 0 0 16px 6px; }
.tl li::before { content: ''; position: absolute; left: -19px; top: 4px; width: 10px; height: 10px;
                 border-radius: 50%; background: #cbd5e1; border: 2px solid #f8fafc; }
.tl li.is-agreed::before   { background: #16a34a; }
.tl li.is-escalated::before{ background: #dc2626; }
.tl li.is-proposed::before { background: #2d6cf0; }
.tl-when { font-size: 11px; color: #94a3b8; text-transform: uppercase; letter-spacing: .04em; }
.tl-what { font-size: 14px; color: #1a1a2e; margin-top: 2px; }
.tl-detail { font-size: 13px; color: #64748b; margin-top: 3px; font-style: italic; }

.live-box { background: #fffbeb; border: 1px solid #fcd34d; border-radius: 10px; padding: 12px 14px; margin-bottom: 18px; }
.live-box h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #92400e; margin-bottom: 6px; }
.live-box p { font-size: 14px; color: #1a1a2e; }
.live-box .due { font-size: 13px; color: #92400e; margin-top: 6px; }

/* Availability drill-down: keep the long date lists scannable. */
.av-group { border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; margin: 8px 0; overflow: hidden; }
.av-group > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; font-size: 14px; background: #f8fafc; list-style: none; }
.av-group > summary::-webkit-details-marker { display: none; }
.av-group > summary::before { content: '▸ '; color: #94a3b8; }
.av-group[open] > summary::before { content: '▾ '; }
.av-group[open] > summary { border-bottom: 1px solid #e2e8f0; }

.restriction-list { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0 0 4px; }
.restriction-row { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: #334155; padding: 3px 0; cursor: pointer; }
.restriction-row input[disabled] { cursor: not-allowed; }
.restriction-row:has(input[disabled]) { color: #94a3b8; }

@media (max-width: 720px) {
  header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .header-actions { flex-wrap: wrap; }
  .page-wrap { padding: 16px 12px; }
  #top-nav { overflow-x: auto; white-space: nowrap; }
  .changes-toolbar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .panel { max-width: 100%; }
}

/* ── Design tokens ───────────────────────────────────────────────────────────
   Added late: the same greys and blues had been hand-typed in dozens of places,
   which is why some panels drifted a shade off. Declared here so the existing
   literals can migrate over time without a risky sweeping find-replace. */
:root {
  --ink:        #1a1a2e;
  --ink-2:      #334155;
  --ink-3:      #64748b;
  --ink-4:      #94a3b8;
  --line:       #e2e8f0;
  --line-2:     #cbd5e1;
  --surface:    #ffffff;
  --surface-2:  #f8fafc;
  --bg:         #f4f6f8;
  --brand:      #2d6cf0;
  --brand-dark: #1d4ed8;
  --good:       #16a34a;
  --good-bg:    #f0fdf4;
  --warn:       #f59e0b;
  --warn-bg:    #fffbeb;
  --bad:        #dc2626;
  --bad-bg:     #fef2f2;
  --radius:     10px;
  --radius-sm:  6px;
  --shadow:     0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-md:  0 4px 12px rgba(16, 24, 40, .08);
  --focus:      0 0 0 3px rgba(45, 108, 240, .25);
}

/* ── Inputs ──────────────────────────────────────────────────────────────────
   Inputs previously had no consistent focus state, which on a form this long
   made it genuinely hard to tell where you were — especially when tabbing. */
input[type="text"], input[type="email"], input[type="tel"], input[type="number"],
input[type="date"], input[type="password"], select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:hover:not(:disabled), select:hover:not(:disabled) { border-color: var(--ink-4); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--focus);
}
input:disabled, select:disabled {
  background: var(--surface-2);
  color: var(--ink-4);
  cursor: not-allowed;
}
input::placeholder { color: var(--ink-4); }

/* Keyboard users get a visible focus ring on every interactive element. */
.btn:focus-visible, a:focus-visible, summary:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--radius-sm);
}

/* ── Field-level validation ─────────────────────────────────────────────────
   Errors sit under the input that caused them, rather than in a single box at
   the bottom of a form long enough to need scrolling. */
.field-err {
  display: block;
  margin-top: 5px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--bad);
  line-height: 1.45;
}
.field-err::before { content: "⚠ "; }

input.has-error, select.has-error {
  border-color: var(--bad);
  background: var(--bad-bg);
}
input.has-error:focus, select.has-error:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .2);
}

.field-form-ok {
  background: var(--good-bg);
  border: 1px solid var(--good);
  color: #166534;
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: 13px;
  margin-top: 12px;
  line-height: 1.5;
}

/* ── Button polish ───────────────────────────────────────────────────────── */
.btn { transition: background-color .15s, box-shadow .15s, transform .06s; }
.btn:hover:not(:disabled) { opacity: 1; box-shadow: var(--shadow); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:hover:not(:disabled)   { background: var(--brand-dark); }
.btn-secondary:hover:not(:disabled) { background: var(--line-2); }
.btn-danger  { background: var(--bad); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

/* Larger tap targets on touch devices — the 7px-padded buttons were under the
   44px minimum, which matters on the coach pages. */
@media (pointer: coarse) {
  .btn { padding: 11px 18px; min-height: 44px; }
  /* Row-action buttons (Edit/Delete) measured 30px on an iPhone — well under the
     44px guideline, and they sit in dense table rows where a mis-tap on Delete
     is the expensive mistake. */
  .btn-sm { padding: 9px 14px; min-height: 40px; }
  input, select { padding: 11px; font-size: 16px; } /* 16px stops iOS zooming on focus */
  .row-actions { gap: 8px; }
}

/* ── Cards and tables ────────────────────────────────────────────────────── */
.fields-table th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  z-index: 1;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-3);
}
.fields-table tbody tr { transition: background-color .12s; }
.fields-table tbody tr:hover { background: var(--surface-2); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* Advisory note — worth flagging, not worth blocking a save over. */
.field-note {
  display: block;
  margin-top: 5px;
  font-size: 12.5px;
  color: #92400e;
  line-height: 1.45;
}
.field-note::before { content: "· "; }

/* ── Change-request slot picker ──────────────────────────────────────────────
   The moment a coach picks a new time for a game. It was an inline-styled
   radio with no visible selected state, so on a phone it was genuinely unclear
   which option was chosen. */
.cr-slot {
  display: block;
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 15px;
  margin: 8px 0;
  cursor: pointer;
  font-size: 14.5px;
  line-height: 1.45;
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.cr-slot:hover { border-color: var(--ink-4); background: var(--surface); }
.cr-slot input[type="radio"] { margin-right: 11px; accent-color: var(--brand); }

/* :has() drives the selected state from the radio itself, so it stays correct
   without any JS bookkeeping. */
.cr-slot:has(input:checked) {
  border-color: var(--brand);
  background: #eff6ff;
  box-shadow: var(--focus);
  font-weight: 600;
}
.cr-slot:has(input:focus-visible) { box-shadow: var(--focus); }

/* Request Change modal's time-picker — same selected-state mechanism as
   .cr-slot, but as a wrapping grid of compact chips instead of full-width
   rows (a season's worth of half-hour slots reads better as a grid). */
.crm-time-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.crm-time-chip {
  display: inline-flex; align-items: center; justify-content: center;
  margin: 0; padding: 9px 16px; min-width: 72px; text-align: center;
}
.crm-time-chip input[type="radio"] { display: none; }


/* ── Typed confirmation ──────────────────────────────────────────────────────
   Seen on a phone, the prompt and the input label were saying the same thing
   twice and the label wrapped over three lines. The message carries the
   instruction; the input just takes the word. */
.confirm-msg { font-size: 14.5px; color: var(--ink-2); line-height: 1.55; }
.confirm-row { margin: 16px 0 12px; }
.confirm-row input {
  font-size: 16px;
  letter-spacing: .02em;
}
.confirm-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.confirm-actions .btn { flex: 1; justify-content: center; }
@media (min-width: 560px) {
  .confirm-actions { justify-content: flex-end; }
  .confirm-actions .btn { flex: 0 0 auto; }
}

/* ── Field coordinate lookup ──────────────────────────────────────────────────
   Coordinates were a raw paste-this-format field with an example in tiny grey
   text — no realistic path for someone who doesn't already know what a
   coordinate is. Geocoding the address they already typed removes the step;
   this styles what's left: the button, the result, and the manual fallback. */
.coords-row { display: flex; gap: 8px; }
.coords-row input { flex: 1; }
.coords-row .btn { flex: 0 0 auto; white-space: nowrap; }

.geocode-result {
  margin-top: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
}
.geocode-result.hidden { display: none; }
.geocode-result.good    { background: var(--good-bg); color: #166534; border: 1px solid #86efac; }
.geocode-result.bad     { background: var(--bad-bg);  color: #991b1b; border: 1px solid #fca5a5; }
.geocode-result.pending { background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--line); }
.geocode-result a { color: inherit; font-weight: 600; text-decoration: underline; }

.coords-manual {
  margin: 10px 0 0 20px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.7;
}
.coords-manual code {
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12.5px;
}

.field-map-wrap { margin: 10px 0; }
.field-map { height: 280px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
/* Leaflet's own CSS assumes it can size itself off visible ancestors — this
   guards against a squashed/zero-height map on a mobile layout before the
   first invalidateSize() call catches up. */
.field-map .leaflet-container { height: 100%; width: 100%; background: var(--surface-2); }

/* ── Verify banner ───────────────────────────────────────────────────────────
   Was inline-styled per page (two copies). Now shared, and holds a code-entry
   row that appears once a link/code has been sent — verifying without ever
   navigating away from whatever was being filled in. */
.verify-banner {
  background: var(--warn-bg);
  border-bottom: 1px solid var(--warn);
  color: #92400e;
  padding: 10px 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.verify-code-row { display: flex; align-items: center; gap: 8px; }
.verify-code-row.hidden { display: none; }
.verify-code-row input {
  width: 110px;
  padding: 6px 9px;
  font-size: 14px;
  letter-spacing: .06em;
  text-align: center;
}
