:root {
  --teal: #2f6b6b;
  --teal-light: #3d8a8a;
  --teal-dim: rgba(47,107,107,0.10);
  --teal-dim2: rgba(47,107,107,0.18);
  --rust: #b36358;
  --rust-dim: rgba(179,99,88,0.12);
  --gold: #f5f036;
  --cream: #f5f0e6;
  --text: #1a1a18;
  --text2: #5a5a54;
  --text3: #8a8a82;
  --border: rgba(47,107,107,0.14);
  --border2: rgba(47,107,107,0.26);
  --radius: 10px;
  --font-head: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--cream); color: var(--text); font-family: var(--font-body); font-size: 14px; min-height: 100vh; line-height: 1.5; }


/* ─────────────────────────────────────────────────────────────────────────────
   SCREENS
───────────────────────────────────────────────────────────────────────────── */
.screen { display: none; }
.screen.active { display: block !important; }


/* ─────────────────────────────────────────────────────────────────────────────
   NAV
───────────────────────────────────────────────────────────────────────────── */
.nav { position: sticky; top: 0; z-index: 100; background: var(--teal); padding: 0 1.5rem; display: flex; align-items: center; gap: 1rem; height: 54px; box-shadow: 0 2px 8px rgba(47,107,107,0.3); }
.nav-logo { font-family: var(--font-head); font-weight: 900; font-size: 20px; color: var(--cream); margin-right: auto; letter-spacing: -0.01em; }
.nav-logo span { color: var(--gold); }
.nav-logo-club { font-size: 14px; font-weight: 600; letter-spacing: 0; color: var(--cream); opacity: 0.9; }
.nav-club-body { color: var(--cream); }
.nav-club-tail { color: var(--rust); }
.nav-back { display: flex; align-items: center; gap: 5px; background: none; border: none; color: rgba(245,240,230,0.75); cursor: pointer; font-family: var(--font-body); font-size: 13px; padding: 6px 10px; border-radius: var(--radius); transition: color 0.15s, background 0.15s; }
.nav-back:hover { color: var(--cream); background: rgba(255,255,255,0.12); }
.nav-back svg { width: 14px; height: 14px; }
.nav-badge { font-size: 12px; font-weight: 600; color: var(--gold); background: rgba(245,240,54,0.15); border: 1px solid rgba(245,240,54,0.3); border-radius: 20px; padding: 3px 10px; white-space: nowrap; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }


/* ─────────────────────────────────────────────────────────────────────────────
   BUTTONS
───────────────────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: 1.5px solid var(--border2); border-radius: var(--radius); background: transparent; color: var(--teal); font-family: var(--font-body); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.btn:hover { background: var(--teal-dim); border-color: var(--teal); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--teal); color: var(--cream); border-color: var(--teal); }
.btn-primary:hover { background: var(--teal-light); border-color: var(--teal-light); color: var(--cream); }
.btn-nav { background: rgba(255,255,255,0.12); color: var(--cream); border-color: rgba(255,255,255,0.22); font-size: 12px; padding: 5px 12px; }
.btn-nav:hover { background: rgba(255,255,255,0.22); color: var(--cream); border-color: rgba(255,255,255,0.38); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-ghost { border-color: transparent; color: var(--text2); }
.btn-ghost:hover { background: rgba(0,0,0,0.04); border-color: var(--border); color: var(--text); }
.btn-toggle { border-radius: 20px; font-size: 12px; padding: 5px 14px; }
.btn-toggle.active { background: var(--teal); color: var(--cream); border-color: var(--teal); }
.btn-danger { background: transparent; color: #a03030; border: 1px solid rgba(160,48,48,0.3); font-size: 12px; font-weight: 500; padding: 5px 10px; border-radius: 6px; cursor: pointer; transition: background 0.15s, color 0.15s; font-family: inherit; }
.btn-danger:hover { background: rgba(160,48,48,0.08); border-color: rgba(160,48,48,0.5); }


/* ─────────────────────────────────────────────────────────────────────────────
   INPUTS
───────────────────────────────────────────────────────────────────────────── */
input[type=text], input[type=password], input[type=date], select {
  background: #fff; border: 1.5px solid var(--border2); border-radius: var(--radius);
  color: var(--text); font-family: var(--font-body); font-size: 13px; padding: 9px 12px;
  width: 100%; transition: border-color 0.15s, box-shadow 0.15s; -webkit-appearance: none; appearance: none;
}
input:focus, select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-dim); }
select option { background: #fff; }
label { font-size: 11px; font-weight: 600; color: var(--text2); display: block; margin-bottom: 5px; letter-spacing: 0.06em; text-transform: uppercase; }

/* Team list picker */
.team-list-shell { border: 1.5px solid rgba(47,107,107,0.26); border-radius: 14px; overflow: hidden; background: linear-gradient(180deg, #ffffff 0%, #fbfbfb 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 4px 12px rgba(47,107,107,0.08); }
.team-list-select { min-height: 280px; padding: 4px; padding-right: 8px; border: none; border-radius: 0; background: transparent; font-size: 14px; line-height: 1.4; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: rgba(47,107,107,0.5) rgba(47,107,107,0.08); }
.team-list-select option { border-radius: 8px; padding: 6px 8px; margin: 0; }
.team-list-select option:checked { background: var(--teal); color: var(--cream); font-weight: 600; box-shadow: inset 0 0 0 999px var(--teal); -webkit-text-fill-color: var(--cream); }
.team-list-select option:checked:hover { background: var(--teal); box-shadow: inset 0 0 0 999px var(--teal); color: var(--cream); -webkit-text-fill-color: var(--cream); }
.team-list-select option:hover, .team-list-select option:focus { background: rgba(47,107,107,0.16); box-shadow: inset 0 0 0 999px rgba(47,107,107,0.16); color: var(--teal); -webkit-text-fill-color: var(--teal); }
.team-list-select::-webkit-scrollbar { width: 8px; }
.team-list-select::-webkit-scrollbar-track { background: rgba(47,107,107,0.06); border-radius: 999px; margin: 8px 2px; }
.team-list-select::-webkit-scrollbar-thumb { background: rgba(47,107,107,0.52); border-radius: 999px; border: 1px solid rgba(245,240,230,0.7); }
.team-list-select::-webkit-scrollbar-thumb:hover { background: rgba(47,107,107,0.68); }

/* League select */
.league-select option { background: #fff; color: var(--text); }
.league-select option:checked, .league-select option:hover, .league-select option:focus { background: rgba(47,107,107,0.16); color: var(--teal); }

/* PIN wrapper */
.pin-wrapper { position: relative; }
.pin-wrapper input { padding-right: 52px; }
.pin-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--text3); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; padding: 4px; }
.pin-toggle:hover { color: var(--teal); }


/* ─────────────────────────────────────────────────────────────────────────────
   CARDS
───────────────────────────────────────────────────────────────────────────── */
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: 0 1px 4px rgba(47,107,107,0.06); }
.card + .card { margin-top: 12px; }
.card-title { font-family: var(--font-head); font-size: 16px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.card-sub { font-size: 12px; color: var(--text2); margin-bottom: 1rem; }


/* ─────────────────────────────────────────────────────────────────────────────
   TAGS & SLOTS
───────────────────────────────────────────────────────────────────────────── */
.tag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.tag-green { background: rgba(47,107,107,0.1); color: var(--teal); border: 1px solid rgba(47,107,107,0.22); }
.tag-amber { background: var(--rust-dim); color: var(--rust); border: 1px solid rgba(179,99,88,0.22); }
.tag-gray { background: rgba(0,0,0,0.05); color: var(--text3); border: 1px solid rgba(0,0,0,0.08); }
.tag-me { background: var(--teal); color: var(--cream); border: 1px solid var(--teal); }
.tag-slot { display: inline-flex; align-items: center; background: rgba(47,107,107,0.08); color: var(--teal); border: 1px solid rgba(47,107,107,0.18); font-size: 11px; padding: 2px 7px; border-radius: 20px; font-weight: 500; margin: 2px; }
.tag-slot-gray { background: rgba(0,0,0,0.04); color: var(--text2); border: 1px solid rgba(0,0,0,0.1); }
.tag-slot-blocked { background: var(--rust-dim); color: var(--rust); border: 1px solid rgba(179,99,88,0.22); text-decoration: line-through; }
.tag-slot-shared { background: rgba(200,170,0,0.12); color: #7a6500; border: 1px solid rgba(200,170,0,0.45); font-weight: 600; }


/* ─────────────────────────────────────────────────────────────────────────────
   PILLS (availability editor)
───────────────────────────────────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 500; border: 1.5px solid var(--border2); cursor: pointer; margin: 3px; color: var(--text2); transition: all 0.18s; background: #fff; font-family: var(--font-body); }
.pill:hover { border-color: var(--teal); color: var(--teal); background: var(--teal-dim); }
.pill.active { background: var(--teal); color: #fff; border-color: var(--teal); box-shadow: 0 2px 8px rgba(47,107,107,0.25); }


/* ─────────────────────────────────────────────────────────────────────────────
   AVAILABILITY GRID
───────────────────────────────────────────────────────────────────────────── */
.avail-grid { width: 100%; border-collapse: fixed; table-layout: fixed; margin-top: 8px; }
.avail-grid th { font-size: 10px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: 0.06em; padding: 6px 2px; text-align: center; }
.avail-grid td { padding: 3px; text-align: center; }
.avail-grid col.label-col { width: 80px; }
.avail-grid col.day-col { width: auto; }
.avail-grid td:first-child { font-size: 10px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.03em; text-align: left; padding-right: 6px; word-break: break-all; line-height: 1.3; }
.avail-grid th:first-child { text-align: left; }
.slot-cell { height: 34px; width: 100%; border-radius: 8px; border: 1.5px solid var(--border2); background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.slot-cell:hover { border-color: var(--teal); background: var(--teal-dim); }
.slot-cell.active { background: var(--teal); border-color: var(--teal); box-shadow: 0 2px 6px rgba(47,107,107,0.3); }
.slot-cell.active::after { content: '✓'; font-size: 13px; color: #fff; }


/* ─────────────────────────────────────────────────────────────────────────────
   MISC UTILITIES
───────────────────────────────────────────────────────────────────────────── */
.error { color: #a03030; font-size: 12px; margin-top: 6px; font-weight: 500; }
.success-msg { color: var(--teal); font-size: 12px; font-weight: 500; display: none; }
.page { max-width: 880px; margin: 0 auto; padding: 2rem 1.5rem; }
.page-sm { max-width: 500px; margin: 0 auto; padding: 2rem 1.5rem; }
.section-title { font-family: var(--font-head); font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; color: var(--text); }
.divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(47,107,107,0.2); border-top-color: var(--teal); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }


/* ─────────────────────────────────────────────────────────────────────────────
   LOGIN WIZARD
───────────────────────────────────────────────────────────────────────────── */
.wizard-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; background: var(--cream); }
.wizard-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 2.5rem; width: 100%; max-width: 420px; box-shadow: 0 4px 24px rgba(47,107,107,0.1); }
.wizard-brand { font-family: var(--font-head); font-size: 44px; font-weight: 900; color: var(--teal); line-height: 1; margin-bottom: 2px; }
.wizard-brand-accent { color: var(--gold); }
.wizard-brand.club-name { font-size: 26px; line-height: 1.2; }
.wizard-brand span { color: var(--rust); }
.wizard-subtitle { font-family: var(--font-head); font-size: 15px; font-weight: 600; color: var(--text2); margin-bottom: 2rem; }
.wizard-step { display: none; }
.wizard-step.active { display: block; }
.step-label { font-size: 11px; font-weight: 600; color: var(--teal); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 1.25rem; }
.step-dots { display: flex; gap: 6px; margin-bottom: 2rem; }
.step-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border2); transition: background 0.2s; }
.step-dot.active { background: var(--teal); }
.step-dot.done { background: var(--teal-light); }
.btn-admin-link { background: none; border: none; color: var(--text3); font-size: 12px; font-family: inherit; cursor: pointer; padding: 4px 8px; text-decoration: underline; text-underline-offset: 2px; transition: color 0.15s; }
.btn-admin-link:hover { color: var(--text2); }


/* ─────────────────────────────────────────────────────────────────────────────
   TEAM CARDS (home screen)
───────────────────────────────────────────────────────────────────────────── */
.team-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px; overflow: hidden; box-shadow: 0 1px 6px rgba(47,107,107,0.07); }
.team-card.is-me { border-color: var(--teal); border-width: 1.5px; }
.team-card-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; gap: 8px; }
.team-card-body { padding: 12px 16px 14px; border-top: 1px solid var(--border); }
.avail-row { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; border-bottom: 1px solid rgba(47,107,107,0.06); }
.avail-row:last-child { border-bottom: none; }
.avail-day { font-size: 11px; font-weight: 600; color: var(--text2); min-width: 30px; text-transform: uppercase; letter-spacing: 0.05em; padding-top: 4px; }
.blocked-date-row { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; border-bottom: 1px solid rgba(47,107,107,0.06); font-size: 12px; }
.blocked-date-row:last-child { border-bottom: none; }


/* ─────────────────────────────────────────────────────────────────────────────
   BLOCKED DATES
───────────────────────────────────────────────────────────────────────────── */
.block-item { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 8px; background: var(--cream); }
.block-remove { background: none; border: none; color: var(--text3); cursor: pointer; margin-left: auto; font-size: 18px; line-height: 1; padding: 0 4px; transition: color 0.15s; flex-shrink: 0; }
.block-remove:hover { color: #a03030; }


/* ─────────────────────────────────────────────────────────────────────────────
   ACCORDION (edit availability screen)
───────────────────────────────────────────────────────────────────────────── */
.accordion-item { background: white; border-radius: 14px; border: 1px solid var(--border); margin-bottom: 12px; overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,0.02); }
.accordion-header { width: 100%; padding: 16px 20px; border: none; display: flex; justify-content: space-between; align-items: center; cursor: pointer; background: transparent; text-align: left; }
.header-edit { background: #f0f7f7 !important; }
.header-unavailable { background: #fffcf0 !important; }
.header-settings { background: #f9f9f9 !important; }
.accordion-title { font-size: 15px; font-weight: 700; color: var(--text); margin: 0; }
.accordion-content { display: none; padding: 20px; }
.accordion-content.open { display: block; }
.accordion-header.active .chevron { transform: rotate(180deg); }
.chevron { font-size: 12px; color: var(--text2); transition: transform 0.25s ease; flex-shrink: 0; }


/* ─────────────────────────────────────────────────────────────────────────────
   SUMMARY CARD (edit screen)
───────────────────────────────────────────────────────────────────────────── */
.summary-card { background: white; border-radius: 14px; padding: 18px 20px; border: 1px solid var(--border); margin-bottom: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.03); }
.summary-label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text2); letter-spacing: 0.05em; margin-bottom: 12px; display: block; }


/* ─────────────────────────────────────────────────────────────────────────────
   ADMIN - NAV & PAGE
───────────────────────────────────────────────────────────────────────────── */
.nav-badge-admin { background: var(--teal); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 10px; border-radius: 999px; letter-spacing: 0.04em; text-transform: uppercase; }
.admin-page-title { font-family: var(--font-head); font-size: 1.4rem; font-weight: 700; color: var(--text); margin-bottom: 1.5rem; }
.admin-league-active-dot { color: #22c55e; font-size: 10px; margin-left: 2px; }


/* ─────────────────────────────────────────────────────────────────────────────
   ADMIN - BOX GRID
───────────────────────────────────────────────────────────────────────────── */
.admin-box-row { display: contents; }
#admin-teams-list { columns: 2; column-gap: 12px; }
#admin-teams-list .admin-box-card { break-inside: avoid; margin-bottom: 12px; display: block; }
@media (max-width: 640px) { #admin-teams-list { columns: 1; } }

.admin-box-card { border-radius: 10px; border: 1px solid var(--border); overflow: hidden; display: flex; flex-direction: column; }
.admin-box-card-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; cursor: pointer; user-select: none; gap: 8px; }
.admin-box-card-header:hover { opacity: 0.85; }
.admin-box-card-title { font-size: 13px; font-weight: 700; letter-spacing: 0.02em; }
.admin-box-card-count { font-size: 11px; color: var(--text3); }
.admin-box-chevron { font-size: 10px; color: var(--text3); }
.admin-box-card-body { padding: 0 12px 8px; }
.admin-box-card-body.collapsed { display: none; }


/* ─────────────────────────────────────────────────────────────────────────────
   ADMIN - TEAM ROWS
───────────────────────────────────────────────────────────────────────────── */
.admin-team-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.admin-team-row:last-child { border-bottom: none; }
.admin-team-info { display: flex; align-items: baseline; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.admin-team-name { font-size: 13px; font-weight: 600; color: var(--text); }
.admin-team-players { font-size: 11px; color: var(--text3); }
.admin-team-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.admin-reset-pin-form { margin-top: 8px; padding: 10px; background: rgba(0,0,0,0.03); border-radius: 8px; border: 1px solid var(--border); }

.admin-box-select { font-size: 12px; font-family: inherit; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text); cursor: pointer; min-width: 68px; }
.admin-box-select:focus { outline: 2px solid var(--teal); outline-offset: 1px; }


/* ─────────────────────────────────────────────────────────────────────────────
   ADMIN - SEASONS
───────────────────────────────────────────────────────────────────────────── */
.admin-season-type-group { margin-bottom: 1.25rem; }
.admin-season-type-header { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text3); padding: 4px 0 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.admin-season-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.admin-season-row.active-season { border-color: var(--teal); background: rgba(47,107,107,0.04); }
.admin-season-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-season-name { font-size: 13px; font-weight: 500; color: var(--text); }
.admin-season-badge { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--teal); background: rgba(47,107,107,0.1); padding: 2px 7px; border-radius: 999px; }
.admin-season-draft { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text3); background: rgba(0,0,0,0.05); padding: 2px 7px; border-radius: 999px; }


/* ─────────────────────────────────────────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .page { padding: 1.25rem 1rem; }
  .nav { padding: 0 1rem; }
  .wizard-card { padding: 1.75rem; }
  .wizard-brand { font-size: 36px; }
  .pill { font-size: 11px; padding: 5px 11px; }
  .slot-cell { height: 30px; }
  .avail-grid th { font-size: 9px; }
  .avail-grid td:first-child { font-size: 9px; }
}