/* ═══════════════════════════════════════════════════════════════
   HCCSL — HAMILTON CLASSIC CO-ED SOFTBALL
   Design System v4 · Apple Human Interface Guidelines
   Aesthetic: iOS / macOS native — SF Pro, system colors,
   frosted glass, grouped inset layout, vibrancy
═══════════════════════════════════════════════════════════════ */

/* No external font import — SF Pro is native on Apple devices,
   falls back gracefully to system-ui on all other platforms */

/* ── DESIGN TOKENS ─────────────────────────────────────────── */
:root {
  /* System colors — mirrors Apple's named palette exactly */
  --sys-blue:       #007AFF;
  --sys-blue-dk:    #0062cc;
  --sys-blue-tint:  rgba(0,122,255,0.10);
  --sys-red:        #FF3B30;
  --sys-red-dk:     #d70015;
  --sys-red-tint:   rgba(255,59,48,0.10);
  --sys-green:      #34C759;
  --sys-green-dk:   #248a3d;
  --sys-green-tint: rgba(52,199,89,0.10);
  --sys-orange:     #FF9500;
  --sys-orange-tint:rgba(255,149,0,0.12);
  --sys-yellow:     #FFCC00;
  --sys-yellow-tint:rgba(255,204,0,0.15);
  --sys-teal:       #5AC8FA;
  --sys-indigo:     #5856D6;
  --sys-purple:     #AF52DE;

  /* Backgrounds — iOS grouped style */
  --bg:             #f2f2f7;   /* iOS primary grouped background */
  --bg-secondary:   #ffffff;   /* iOS secondary background */
  --bg-tertiary:    #f2f2f7;
  --bg-grouped:     #f2f2f7;
  --surface:        #ffffff;
  --surface2:       #f9f9fb;
  --surface3:       #f2f2f7;

  /* Label colors — exact iOS label hierarchy */
  --label:          #000000;
  --label-2:        rgba(60,60,67,0.60);  /* secondary label */
  --label-3:        rgba(60,60,67,0.30);  /* tertiary label */
  --label-4:        rgba(60,60,67,0.18);  /* quaternary label */
  --text:           #1c1c1e;
  --text2:          #3a3a3c;
  --text3:          #636366;
  --muted:          #8e8e93;
  --subtle:         #aeaeb2;
  --placeholder:    #c7c7cc;

  /* Separator colors */
  --sep:            rgba(60,60,67,0.29);   /* iOS non-opaque separator */
  --sep-opaque:     #c6c6c8;               /* opaque separator */
  --border:         rgba(60,60,67,0.18);
  --border2:        rgba(60,60,67,0.12);

  /* Brand accent — keep HCCSL navy for identity, map to system colors */
  --brand:          #1d2d50;   /* deep navy — header brand */
  --brand2:         #253560;
  --brand3:         #2e3f72;
  --gold:           #FFCC00;
  --gold-tint:      rgba(255,204,0,0.15);

  /* Shadows — Apple-style extremely subtle */
  --shadow-xs:  0 1px 0 rgba(0,0,0,0.04);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 1px rgba(0,0,0,0.04);
  --shadow:     0 2px 8px rgba(0,0,0,0.08), 0 0 1px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.10), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg:  0 12px 40px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);

  /* Border radius — iOS standard values */
  --r:      12px;   /* standard card radius */
  --r-sm:   10px;
  --r-xs:   8px;
  --r-pill: 999px;

  /* Typography — SF Pro system stack */
  --font:    -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display',
             'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-cd: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text',
             'Helvetica Neue', Helvetica, Arial, sans-serif;
  --mono:    ui-monospace, 'SF Mono', 'SFMono-Regular', Menlo, Monaco,
             'Cascadia Mono', 'Fira Code', Consolas, monospace;

  /* Spring timing — Apple motion DNA */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out:    cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
}

/* ── WATERMARK ── */
body::before {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 500px;
  height: 500px;
  background: url('logo.png') no-repeat center / contain;
  opacity: 0.045;
  pointer-events: none;
  z-index: 0;
}

/* ── LAYOUT ── */
.main { max-width: 900px; margin: 0 auto; padding: 20px 16px 52px; position: relative; z-index: 1; }

/* ── HEADER — frosted glass iOS nav bar ── */
.header {
  background: rgba(29, 45, 80, 0.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  height: 56px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 200;
  border-bottom: 0.5px solid rgba(255,255,255,0.12);
}
.header-logo {
  width: 36px; height: 36px;
  border-radius: 8px;   /* iOS app icon style — squircle-ish */
  object-fit: cover;
  flex-shrink: 0;
  border: 0.5px solid rgba(255,255,255,0.20);
}
.header-text { flex: 1; min-width: 0; }
.header-title {
  font-family: var(--font-cd);
  font-size: 16px;
  font-weight: 700;        /* SF Pro 700 = Bold, Apple's heading weight */
  color: #ffffff;
  line-height: 1.2;
  letter-spacing: -0.3px; /* SF Pro optical kerning */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-sub {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255,255,255,0.40);
  margin-top: 1px;
  letter-spacing: 0;
}
.header-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  background: rgba(255,204,0,0.15);
  border: 0.5px solid rgba(255,204,0,0.30);
  border-radius: var(--r-pill);
  padding: 3px 10px;
  letter-spacing: 0.2px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* ── TAB BAR — iOS segmented / UITabBar style ── */
.tabs {
  background: rgba(242,242,247,0.95);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  position: sticky;
  top: 56px;
  z-index: 199;
  border-bottom: 0.5px solid var(--sep-opaque);
  padding: 8px 12px;
  gap: 4px;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  height: 34px;
  padding: 0 14px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--text3);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s var(--ease-out), color 0.15s var(--ease-out);
  flex-shrink: 0;
  letter-spacing: -0.1px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.tab:hover {
  background: rgba(0,0,0,0.06);
  color: var(--text);
}
.tab.active {
  background: var(--surface);
  color: var(--sys-blue);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10), 0 0 0 0.5px rgba(0,0,0,0.06);
}
.tab:active { transform: scale(0.96); }

/* ── LAYOUT ── */
.main {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}
.section { display: none; }
.section.active {
  display: block;
  animation: appleReveal 0.22s var(--ease-out) both;
}
@keyframes appleReveal {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── CARDS — iOS grouped inset sections ── */
.card {
  background: var(--surface);
  border-radius: var(--r);
  padding: 0;               /* use inner padding on children for hairline separators */
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  /* No explicit border — Apple cards rely on shadow + background contrast */
}

/* Card with a labeled section header — Apple "grouped table section" */
.card-title {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 0 16px 6px 16px;
  margin-top: 20px;
  margin-bottom: 0;
  display: block;
}

/* Fallback: card with padding (for settings/forms) */
.card.padded,
.card > *:first-child:not(.card-row):not(table):not(.st-wrap):not(.acc-wrap) {
  padding: 12px 14px;
}
/* Re-apply inner padding on card content that needs it */
.card > .card-inner { padding: 12px 14px; }
/* Compact form cards */
.card.compact,
.card.compact > *:first-child:not(.card-row):not(table):not(.st-wrap):not(.acc-wrap) {
  padding: 10px 12px;
}

/* ── INSET GROUPED LIST ROWS — iOS UITableView style ── */
.card-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--sep);
  background: var(--surface);
  font-size: 15px;
  transition: background 0.1s;
}
.card-row:last-child { border-bottom: none; }
.card-row:active { background: var(--surface2); }

/* ── BUTTONS — Apple system button styles ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;    /* Apple CTA weight */
  padding: 10px 20px;
  border-radius: var(--r-pill);  /* Fully rounded — iOS standard */
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s var(--ease-out);
  letter-spacing: -0.1px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.96); filter: brightness(0.92); }

.btn-primary {
  background: var(--sys-blue);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0,122,255,0.28);
}
.btn-primary:hover { background: var(--sys-blue-dk); }

.btn-danger {
  background: var(--sys-red);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(255,59,48,0.25);
}
.btn-danger:hover { background: var(--sys-red-dk); }

.btn-outline {
  background: var(--surface);
  color: var(--sys-blue);
  box-shadow: 0 0 0 1px rgba(0,122,255,0.35), var(--shadow-xs);
  font-weight: 500;
}
.btn-outline:hover {
  background: var(--sys-blue-tint);
  box-shadow: 0 0 0 1px rgba(0,122,255,0.55), var(--shadow-xs);
}

.btn-ghost {
  background: transparent;
  color: var(--sys-blue);
  font-weight: 500;
  padding: 8px 14px;
}
.btn-ghost:hover { background: var(--sys-blue-tint); }

.btn-sm  { font-size: 13px; padding: 7px 14px; }
.btn-xs  { font-size: 12px; padding: 5px 10px; border-radius: 8px; }

/* ── FORM ELEMENTS — iOS text field style ── */
.row { display: flex; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 140px; }

.field label {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

input[type="text"],
input[type="date"],
input[type="number"],
input[type="time"],
select,
select.sel {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 400;
  color: var(--text);
  background: var(--surface);
  border: 0.5px solid var(--sep-opaque);
  border-radius: var(--r-xs);
  padding: 6px 10px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
  height: 34px;
}
input[type="text"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
input[type="time"]:focus,
select:focus,
select.sel:focus {
  border-color: var(--sys-blue);
  box-shadow: 0 0 0 3px rgba(0,122,255,0.15);
  outline: none;
}
input::placeholder { color: var(--placeholder); }

/* ── SCORE INPUTS ── */
input.si {
  font-family: var(--mono) !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  color: var(--text) !important;
  background: var(--surface2) !important;
  border: 0.5px solid var(--sep-opaque) !important;
  border-radius: 8px !important;
  padding: 6px 4px !important;
  text-align: center !important;
  width: 54px !important;
  height: 36px !important;
  outline: none !important;
  transition: border-color 0.12s, box-shadow 0.12s !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}
input.si:focus {
  border-color: var(--sys-blue) !important;
  box-shadow: 0 0 0 3px rgba(0,122,255,0.15) !important;
  background: var(--surface) !important;
}

/* ── WX BUTTON ── */
.wx-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 0.5px solid var(--sep-opaque);
  background: var(--surface);
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, transform 0.1s;
  flex-shrink: 0;
}
.wx-btn:active { transform: scale(0.92); background: var(--surface2); }

/* ── CHIPS / FILTER PILLS ── */
.filter-bar {
  margin-bottom: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.filter-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip-filter {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  border: 0.5px solid var(--sep-opaque);
  background: var(--surface);
  color: var(--text2);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.chip-filter:hover { border-color: var(--sys-blue); color: var(--sys-blue); }
.chip-filter:active { transform: scale(0.95); }
.chip-filter.active {
  background: var(--sys-blue);
  border-color: var(--sys-blue);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0,122,255,0.25);
}

/* ── CHIP TAGS (team chips in admin) ── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 10px 5px 12px;
  border-radius: var(--r-pill);
  background: var(--sys-blue-tint);
  color: var(--sys-blue);
  border: 0.5px solid rgba(0,122,255,0.20);
}
.chip-del {
  background: none;
  border: none;
  color: var(--sys-blue);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0.55;
  transition: opacity 0.1s;
  font-family: var(--font);
}
.chip-del:hover { opacity: 1; }

/* ── EXPORT BAR ── */
.export-bar {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.export-bar.vis { display: flex; }
.export-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ── SEASON BANNER ── */
.season-banner {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand3) 100%);
  border-radius: var(--r);
  padding: 16px 18px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}
.season-banner-icon { font-size: 28px; flex-shrink: 0; }
.season-banner-title {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}
.season-banner-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  margin-top: 2px;
}

/* ── LAST RESULTS ── */
.last-results {
  background: var(--surface);
  border-radius: var(--r);
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.last-results-head {
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 0.5px solid var(--sep);
  background: var(--surface2);
}

/* ── TABLE CELLS FOR SCORES ── */
.g-si {
  padding: 8px 4px;
  white-space: nowrap;
}

td.g-sep {
  padding: 0 2px;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
}

/* ── EMPTY SLOT (unscored games) ── */
/* Only apply muted styling to rows that have TBD or no teams assigned */
tr.empty-slot:has(.g-home:empty) td,
tr.empty-slot:has(.g-away:empty) td,
tr.empty-slot td:empty {
  opacity: 0.6;
}

/* ── ACCORDION ── */
.acc-wrap {
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.acc-head {
  background: var(--brand);
  padding: 13px 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s;
  gap: 10px;
  -webkit-tap-highlight-color: transparent;
}
.acc-head:hover { background: var(--brand2); }
.acc-head:active { background: var(--brand3); }
.acc-title {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.2px;
  flex: 1;
}
.acc-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  font-weight: 500;
}
.acc-arr {
  color: rgba(255,255,255,0.35);
  font-size: 10px;
  flex-shrink: 0;
  transition: transform 0.2s var(--ease-out);
}
.acc-body, .accordion-body { display: none; }
.acc-body.open, .accordion-body.open { display: block; }

/* ── DAY / SLOT HEADERS ── */
.day-head {
  background: var(--surface2);
  padding: 6px 16px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  border-bottom: 0.5px solid var(--sep);
  display: flex;
  align-items: center;
  gap: 10px;
}
.day-head::after { content: ''; flex: 1; height: 0.5px; background: var(--sep); }

.slot-head {
  background: var(--surface);
  padding: 4px 16px;
  font-size: 10px;
  font-weight: 600;
  color: var(--subtle);
  font-family: var(--mono);
  letter-spacing: 0.3px;
  border-bottom: 0.5px solid var(--sep);
  display: flex;
  align-items: center;
  gap: 8px;
}
.slot-head::after { content: ''; flex: 1; height: 0.5px; background: var(--sep); }

/* ── GAME ROWS ── */
.game-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 0.5px solid var(--sep);
  background: var(--surface);
  font-size: 14px;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.game-row:hover { background: var(--surface2); }
.game-row:last-child { border-bottom: none; }

.game-row.co { background: rgba(52,199,89,0.04); }
.game-row.co:hover { background: rgba(52,199,89,0.08); }
.game-row.playoff { background: rgba(255,204,0,0.05); }
.game-row.playoff:hover { background: rgba(255,204,0,0.10); }

.game-row.open-slot {
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 8px,
    rgba(0,0,0,0.012) 8px,
    rgba(0,0,0,0.012) 16px
  );
  opacity: 0.55;
}
.game-row.open-slot:hover { background: var(--surface2); opacity: 1; }

.game-id {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--subtle);
  min-width: 42px;
  flex-shrink: 0;
}
.game-time {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  min-width: 50px;
  flex-shrink: 0;
}
.game-diamond {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--sys-blue-tint);
  color: var(--sys-blue);
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0;
}
.game-teams {
  flex: 1;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

/* ── SCORE ROWS ── */
.score-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--sep);
  background: var(--surface);
  font-size: 14px;
  flex-wrap: wrap;
  transition: background 0.1s;
}
.score-row:hover { background: var(--surface2); }
.score-row:last-child { border-bottom: none; }
.score-row.co { background: rgba(52,199,89,0.04); }
.score-id {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--subtle);
  min-width: 42px;
  flex-shrink: 0;
}
.score-teams {
  flex: 1;
  font-weight: 500;
  color: var(--text);
  min-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.score-dm {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.score-inputs {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

/* ── STANDINGS TABLE ── */
.st-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.st {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--surface);
}
.st thead {
  background: var(--brand);
}
.st th {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.50);
  padding: 10px 10px;
  text-align: center;
  white-space: nowrap;
}
.st th:first-child { text-align: left; padding-left: 16px; }
.st th:nth-child(2) { text-align: left; }
.st td {
  padding: 11px 10px;
  text-align: center;
  border-bottom: 0.5px solid var(--sep);
  color: var(--text2);
  vertical-align: middle;
  white-space: nowrap;
  font-size: 13px;
}
.st td:first-child { text-align: center; padding-left: 14px; }
.st td:nth-child(2) { text-align: left; font-weight: 600; color: var(--text); }
.st tr:last-child td { border-bottom: none; }
.st tbody tr:hover td { background: var(--surface2); }
.st td.pts {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--sys-blue);
}
.st td.rank {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--subtle);
}
.st td.mono {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 12px;
}
.sb-prog {
  display: inline-block;
  height: 3px;
  background: var(--surface3);
  border-radius: var(--r-pill);
  overflow: hidden;
  width: 36px;
  margin-left: 5px;
  vertical-align: middle;
}
.sb-fill {
  height: 100%;
  background: var(--sys-blue);
  border-radius: var(--r-pill);
}

/* ── GAME TABLE (.gt — playoffs) ── */
.gt { width: 100%; border-collapse: collapse; table-layout: fixed; background: var(--surface); }
.gt td {
  padding: 10px 8px;
  border-bottom: 0.5px solid var(--sep);
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  line-height: 1.3;
  color: var(--text2);
}
.gt tr:last-child td { border-bottom: none; }
.gt tr:hover td { background: var(--surface2); }
.gt tr.g-late td { background: rgba(90,200,250,0.05); }
.gt tr.g-late:hover td { background: rgba(90,200,250,0.10); }
.gt tr.wx-row td { background: rgba(255,149,0,0.05) !important; }
.gt td.g-num   { width: 56px; padding-left: 8px; padding-right: 4px; font-family: var(--mono); font-size: 10px; color: var(--text2); font-weight: 700; }
.gt td.g-time  { width: 56px; font-family: var(--mono); font-size: 11px; color: var(--muted); font-weight: 500; }
.gt td.g-home  { font-weight: 600; color: var(--text); }
.gt td.g-away  { font-weight: 600; color: var(--text); }
.gt td.g-vs    { width: 22px; text-align: center; color: var(--subtle); font-size: 11px; }
.gt td.g-sep   { width: 12px; text-align: center; color: var(--subtle); font-size: 11px; }
.gt td.g-dm    { width: 52px; }
.gt td.g-sc    { width: 40px; text-align: center; font-family: var(--mono); font-weight: 700; font-size: 14px; color: var(--sys-blue); padding-right: 8px; }
.gt td.g-si    { width: 60px; padding: 4px 2px; }
.gt td.g-wx    { width: 36px; text-align: center; }
.gt td.scored  { color: var(--sys-green); }
.gt .gnum { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--text2); }

/* ── METRIC CARDS ── */
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.metric-card {
  background: var(--surface);
  border-radius: var(--r);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.metric-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}
.metric-value {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--sys-blue);
  line-height: 1.1;
  letter-spacing: -0.5px;
}
.metric-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── EDIT TAB ── */
.edit-row { border-bottom: 1px solid var(--border); background: var(--surface); transition: background 0.1s; border-left-width: 3px; border-left-style: solid; }
.edit-row:hover { background: var(--surface2); }
.edit-row.late { background: #f5f7ff; }
.edit-row.open-slot { display: flex; align-items: center; gap: 6px; padding: 6px 14px; background: repeating-linear-gradient(45deg, transparent, transparent 6px, rgba(13,27,46,0.018) 6px, rgba(13,27,46,0.018) 12px); }
.edit-row.open-slot:hover { background: var(--surface2); }
.edit-row-meta { display: flex; align-items: center; gap: 8px; padding: 5px 14px 3px; }
.edit-row-controls { display: flex; align-items: center; gap: 6px; padding: 3px 14px 6px; flex-wrap: nowrap; overflow-x: auto; }
.edit-row-controls select { flex-shrink: 0; font-family: var(--font); font-size: 12px; font-weight: 500; background: var(--surface2); color: var(--text); border: 1.5px solid var(--border); border-radius: var(--r-xs); padding: 3px 6px; outline: none; width: auto; }
.edit-row-controls select:focus { border-color: var(--blue); }
.edit-row-controls .sel { width: auto !important; }

/* ── ADMIN SUBTABS ── */
.admin-subtabs {
  display: flex;
  background: var(--surface2);
  border-radius: var(--r);
  padding: 3px;
  margin-bottom: 14px;
  gap: 2px;
  box-shadow: 0 0 0 0.5px var(--sep-opaque);
}
.admin-subtab {
  flex: 1;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--text3);
  background: transparent;
  border: none;
  border-radius: 9px;
  padding: 7px 10px;
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.admin-subtab:active { transform: scale(0.96); }
.admin-subtab.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.10), 0 0 0 0.5px rgba(0,0,0,0.05);
}
.admin-panel { display: none; }
.admin-panel.active { display: block; }

/* ── PLAYOFFS ── */
.ply-seed-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.ply-seed-card {
  background: var(--surface);
  border-radius: var(--r);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  font-size: 14px;
}
.ply-seed-rank {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 3px;
}
.ply-seed-team {
  font-weight: 600;
  color: var(--text);
  font-size: 15px;
}

/* ── CHAMPIONS ── */
.champ-lb-row {
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--sep);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background 0.1s;
}
.champ-lb-row:last-child { border-bottom: none; }
.champ-lb-row.is-current { background: var(--sys-blue-tint); }
.champ-lb-row:hover { background: var(--surface2); }
.champ-lb-rank {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--subtle);
  width: 26px;
  flex-shrink: 0;
}
.champ-lb-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.champ-summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* ── STATS TABLE (.st2) ── */
.st2 { width: 100%; border-collapse: collapse; font-size: 12px; background: var(--surface); }
.st2 th {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 8px 10px;
  text-align: center;
  border-bottom: 0.5px solid var(--sep);
  white-space: nowrap;
  background: var(--surface2);
}
.st2 th:first-child { text-align: left; }
.st2 td {
  padding: 9px 10px;
  text-align: center;
  border-bottom: 0.5px solid var(--sep);
  color: var(--text2);
  vertical-align: middle;
  white-space: nowrap;
}
.st2 td:first-child, .st2 .row-label { text-align: left; font-weight: 500; color: var(--text); }
.st2 tr:last-child td { border-bottom: none; }
.st2 tbody tr:hover td { background: var(--surface2); }
.st2 .num { font-family: var(--mono); font-size: 12px; }
.st2 .num-dim { font-family: var(--mono); font-size: 12px; color: var(--subtle); }
.st2-dcol-head {
  font-size: 10px !important;
  font-weight: 600 !important;
  color: var(--muted) !important;
  text-align: center;
}
.mat-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.h2h-co-head {
  background: rgba(52,199,89,0.07);
  font-size: 10px;
  font-weight: 600;
  color: var(--sys-green-dk);
  text-align: center;
  border-bottom: 0.5px solid var(--sep);
}
.co-row td { background: rgba(52,199,89,0.03); }

/* ── NOTICE / ALERT BANNERS ── */
.notice {
  background: var(--surface2);
  border-radius: var(--r-xs);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--muted);
  border: 0.5px solid var(--sep);
}

/* ── TEAM LIST ── */
.team-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; min-height: 28px; }

/* ── EMPTY STATE ── */
.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--subtle);
  font-size: 15px;
  font-weight: 400;
}
.empty::before {
  content: '';
  display: block;
  width: 40px;
  height: 40px;
  background: var(--surface3);
  border-radius: 50%;
  margin: 0 auto 12px;
}

/* ── MISC / HELPERS ── */
.highlight-card {
  background: var(--surface);
  border-radius: var(--r);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.stat-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* ── SUNSET BADGES ── */
.sunset-safe   { font-size: 10px; background: rgba(52,199,89,0.12); color: var(--sys-green-dk); padding: 1px 6px; border-radius: var(--r-pill); font-weight: 600; }
.sunset-warn   { font-size: 10px; background: rgba(255,149,0,0.12); color: var(--sys-orange); padding: 1px 6px; border-radius: var(--r-pill); font-weight: 600; }
.sunset-danger { font-size: 10px; background: rgba(255,59,48,0.12); color: var(--sys-red); padding: 1px 6px; border-radius: var(--r-pill); font-weight: 600; }

/* ── TOAST — Apple-style bottom notification ── */
/* persistence.js controls opacity + translateY via inline styles;
   we handle centering via left/transform-x and the rest of aesthetics */
#_toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  /* JS sets transform: translateY(N) — we prefix translateX(-50%) via JS override below */
  background: rgba(30,30,32,0.88);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  color: #fff;
  padding: 11px 20px;
  border-radius: var(--r-pill);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.1px;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.22s var(--ease-out), transform 0.22s var(--ease-out);
  pointer-events: none;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0,0,0,0.30), 0 1px 4px rgba(0,0,0,0.15);
  white-space: nowrap;
  transform: translateX(-50%) translateY(12px);
}

/* ── CARD SECTION WRAPPERS with section label (Apple grouped style) ── */
.section-label {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 18px 4px 6px;
  display: block;
}

/* ── MOBILE ── */
@media (max-width: 600px) {
  .main { padding: 12px 12px 48px; }
  .header { height: 52px; padding: 0 14px; gap: 10px; }
  .header-title { font-size: 15px; }
  .header-sub, .header-badge { display: none; }
  .header-logo { width: 32px; height: 32px; }
  .tabs { top: 52px; padding: 6px 10px; }
  .tab { height: 32px; padding: 0 11px; font-size: 12.5px; gap: 4px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-value { font-size: 22px; }
  .field { min-width: 110px; }
  .st th, .st td { padding: 8px 6px; font-size: 11.5px; }
  .acc-head { padding: 11px 14px; }
  .acc-title { font-size: 14px; }
  .day-head { padding: 5px 12px; font-size: 10px; }
  .slot-head { padding: 4px 12px; }
  .game-row { padding: 10px 12px; gap: 7px; }
  .score-row { padding: 9px 12px; gap: 7px; }
  .gt td { padding: 8px 4px; font-size: 12px; }
  .gt td.g-num { width: 44px; padding-left: 4px; font-size: 9px; }
  .gt td.g-time { width: 44px; }
  .gt td.g-dm { display: none; }
  .gt td.g-sc { width: 36px; padding-right: 4px; }
  .gt td.g-si { width: 52px; padding: 3px 1px; }
  .gt td.g-wx { width: 30px; }
  input.si { width: 46px !important; height: 32px !important; font-size: 13px !important; padding: 4px 2px !important; }
  .wx-btn { width: 28px; height: 28px; }
  .chip-filter { padding: 5px 12px; font-size: 12.5px; }
  .ply-seed-grid { grid-template-columns: 1fr; }
  .champ-summary-grid { grid-template-columns: 1fr 1fr; }
  .stat-grid-2, .stat-grid-3 { grid-template-columns: 1fr 1fr; }
  .row { flex-direction: column; }
  .edit-row { padding: 8px 12px; }
  .edit-row.open-slot { flex-wrap: wrap; gap: 4px; padding: 8px 12px; }
  .admin-subtabs { border-radius: var(--r-sm); }
}
@media (max-width: 420px) {
  .header-title { font-size: 14px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .gt td.g-num { display: none; }
  .stat-grid-3 { grid-template-columns: 1fr 1fr; }
  .champ-summary-grid { grid-template-columns: 1fr; }
  .tabs { gap: 2px; }
}   
