:root {
  color-scheme: light dark;
  --border: rgba(127,127,127,0.35);
  --border-soft: rgba(127,127,127,0.2);
  --bg-card: rgba(127,127,127,0.06);
  --bg-card-hover: rgba(127,127,127,0.12);
  --accent: #2563eb;
  --accent-fg: #fff;
  --danger: #dc2626;
  --muted: rgba(127,127,127,0.9);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 0.5rem;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: Canvas;
  z-index: 10;
}
.topbar-title { font-weight: 700; font-size: 1.1rem; }
.topbar-nav { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.topbar-nav a {
  color: inherit;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.topbar-nav a:hover { background: var(--bg-card-hover); border-color: var(--border); }
.topbar-nav a.active { background: var(--accent); color: var(--accent-fg); }
/* "Log in" is a <button> (see buildLoginDropdown), not an <a> like the rest
   of the topbar -- the generic button/.btn styling (rectangular, always-
   bordered) made it stand out next to the Home/Admin/Log out pills. Copy
   .topbar-nav a's look explicitly (no "btn" class on the element itself, so
   there's no competing same-specificity rule to fight with) rather than
   relying on source order. */
.topbar-nav .login-trigger {
  color: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.topbar-nav .login-trigger:hover { background: var(--bg-card-hover); border-color: var(--border); }

/* Below ~480px, the title + three nav pills (one of which can carry a long
   email) no longer fit on one line. Rather than a hamburger for just three
   items, let the row wrap -- title on top, nav below -- and drop the emailed
   identity from "Log out (you@example.com)" down to just "Log out" (the
   `title` attribute on that link still surfaces the full identity on
   hover/long-press) so no single pill can blow out the width on its own. */
@media (max-width: 480px) {
  .topbar { justify-content: flex-start; padding: 0.75rem 1rem; }
  .topbar-nav { width: 100%; }
  /* Home/Admin stay grouped on the left; Log in/out gets pushed to the
     far right of its own row so it doesn't just blend into the pile. */
  #nav-auth-slot { margin-left: auto; }
  .topbar-user-name { display: none; }
}

/* Safety net for the smallest phones (below any of the 480/600px breakpoints
   above): nothing here targets that range specifically, so a wide table or
   other fixed-width content inside a .card can exceed the card's content
   width and spill past its border instead of scrolling. Force overflow
   handling on card content generally, matching the .table-scroll pattern
   already used for standings/roster tables. */
@media (max-width: 400px) {
  .card { overflow-x: auto; }
}

main#app {
  /* Trying the wider container site-wide (was 980px) -- easy to revert if
     public pages (standings, schedule, team) end up looking like narrow
     content floating in too much empty margin at this width. */
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ---- buttons ---- */
button, .btn {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 6px;
  padding: 0.5rem 0.9rem;
  color: inherit;
}
button:hover, .btn:hover { background: var(--bg-card-hover); }
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
}
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
button.danger.solid {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  font-weight: 600;
}
button.danger.solid:hover { filter: brightness(1.08); }
button.small { padding: 0.25rem 0.55rem; font-size: 0.8rem; }
button.link {
  border: none; background: none; color: var(--accent); padding: 0; text-decoration: underline;
}

/* ---- modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal {
  background: Canvas;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.4rem;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}
.modal-message { margin: 0 0 1.1rem 0; font-size: 0.95rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; }

/* ---- home screen ---- */
.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.home-header h1 { font-size: 1.3rem; margin: 0; }
.home-header-actions { display: flex; gap: 0.6rem; }
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
button:disabled:hover { background: var(--bg-card); }

.game-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.game-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  background: var(--bg-card);
}
.game-list-item:hover { background: var(--bg-card-hover); }
.game-list-item .meta { display: flex; flex-direction: column; gap: 0.15rem; }
.game-list-item .matchup { font-weight: 600; }
.game-list-item .sub { font-size: 0.82rem; color: var(--muted); }
.empty-state { color: var(--muted); padding: 2rem 0; text-align: center; }

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}
.badge.in_progress { background: rgba(217,119,6,0.18); color: #b45309; }
.badge.complete { background: rgba(22,163,74,0.18); color: #15803d; }
.badge.scheduled { background: rgba(37,99,235,0.18); color: #1d4ed8; }
/* Status-tag palette, spread across distinct hues for at-a-glance readability:
   green = done, red = happening now, blue = needs attention, orange = eye-catching/next up,
   gold = reserved for the one-per-table "Champion" tag. */
.badge.live { background: rgba(220,38,38,0.20); color: #b91c1c; animation: badge-live-pulse 1.8s ease-in-out infinite; }
@keyframes badge-live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
@media (prefers-reduced-motion: reduce) {
  .badge.live { animation: none; }
}
.badge.awaiting { background: rgba(37,99,235,0.18); color: #1d4ed8; }
.badge.upcoming { background: rgba(234,88,12,0.20); color: #c2410c; }
.badge.schedule { background: rgba(107,114,128,0.18); color: #4b5563; }
.badge.champion { background: rgba(202,138,4,0.18); color: #a16207; }
.badge.league-current { background: rgba(22,163,74,0.18); color: #15803d; }
.badge.league-upcoming { background: rgba(37,99,235,0.18); color: #1d4ed8; }
.badge.league-past { background: rgba(127,127,127,0.18); color: var(--muted); }

/* ---- game sheet ---- */
.sheet-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.3rem 1.5rem;
  margin-bottom: 1.1rem;
  background: var(--bg-card);
}
.card h2 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 0.85rem 0;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.7rem 1rem;
}

.oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

/* Google's brand guidelines specify a fixed white/grey button regardless of
   the surrounding page theme -- colors here are intentionally hardcoded
   rather than pulled from --accent/--bg-card. Selector is `.btn.google-btn`
   (two classes), not just `.google-btn`, so it reliably outranks
   `.topbar-nav a` (a class + tag selector) when this button sits inside the
   login dropdown -- otherwise that rule's `border: 1px solid transparent`
   and `color: inherit` would silently strip the brand border and text
   color right back out. */
.btn.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.btn.google-btn:hover { background: #f8f9fa; }

/* Same reasoning and `.btn.<x>-btn` specificity trick as google-btn above. */
.btn.microsoft-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: #fff;
  color: #5e5e5e;
  border: 1px solid #8c8c8c;
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.btn.microsoft-btn:hover { background: #f3f3f3; }

.btn.yahoo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: #6001d2;
  color: #fff;
  border: 1px solid #6001d2;
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.btn.yahoo-btn:hover { background: #4b01a6; }

/* Topbar "Log in" -- a dropdown in place, instead of navigating to #/login. */
.login-dropdown-wrap { position: relative; display: inline-block; }
.login-dropdown {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  background: Canvas;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  min-width: 220px;
  z-index: 20;
}
.login-dropdown .status-note { margin: 0; font-size: 0.8rem; }
.checkbox-list { display: flex; flex-direction: column; gap: 0.35rem; margin: 0.4rem 0 0.8rem; }
.checkbox-row { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; margin: 0.3rem 0; }
.field { display: flex; flex-direction: column; gap: 0.25rem; }
.field label { font-size: 0.75rem; color: var(--muted); }
.field input, .field select {
  font: inherit;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: Canvas;
  color: inherit;
}
.card textarea {
  font: inherit;
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: Canvas;
  color: inherit;
  resize: vertical;
}

.team-logo-preview { margin-top: 0.7rem; }
.team-logo-preview img {
  max-height: 5.5rem;
  max-width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  background: Canvas;
  padding: 0.3rem;
}
.team-page-heading { display: flex; align-items: center; gap: 0.7rem; }
.team-page-logo { height: 2.6rem; width: 2.6rem; object-fit: contain; border-radius: 6px; }

/* period selector */
.period-btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.period-btn {
  flex: 1 1 90px;
  padding: 0.6rem 0.5rem;
  font-weight: 600;
}
.period-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

/* score summary */
.score-summary table { width: 100%; border-collapse: collapse; }
.score-summary th, .score-summary td {
  text-align: center;
  padding: 0.4rem;
  border: 1px solid var(--border-soft);
}
.score-summary th:first-child, .score-summary td:first-child { text-align: left; }
.score-summary .total-row { font-weight: 700; }

/* entry tables */
table.entry-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.entry-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.3rem 0.4rem;
  border-bottom: 1px solid var(--border);
}
table.entry-table td {
  padding: 0.25rem 0.4rem;
  border-bottom: 1px solid var(--border-soft);
}
table.entry-table .col-actions {
  width: 2.4rem;
  text-align: center;
}
table.entry-table input, table.entry-table select {
  width: 100%;
  font: inherit;
  padding: 0.3rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: Canvas;
  color: inherit;
}
table.entry-table input[type="number"] { text-align: center; }
.time-cell { display: flex; gap: 0.3rem; align-items: center; }
.time-cell input { width: auto; flex: 1; min-width: 0; }
.time-cell button { flex-shrink: 0; }
.add-row-btn { margin-top: 0.6rem; }
.no-rows { color: var(--muted); font-size: 0.85rem; padding: 0.4rem 0; }
.table-scroll { overflow-x: auto; }
table.entry-table tr.standings-playoff-line td { border-bottom: 2px solid var(--accent); }
table.entry-table tr.clickable-row { cursor: pointer; }
table.entry-table tr.clickable-row:hover td { background: var(--bg-card-hover); }

/* Standings specifically (not entry-table generally -- roster/goal/penalty/
   admin-list tables stay dense on purpose) gets more generous sizing now
   that its card has real width to spend, rather than staying tuned for the
   old 340px-wide card. */
table.standings-table { font-size: 0.95rem; }
table.standings-table th { font-size: 0.76rem; padding: 0.5rem 0.6rem; }
table.standings-table td { padding: 0.55rem 0.6rem; }
table.standings-table th:not(:nth-child(2)),
table.standings-table td:not(:nth-child(2)) {
  text-align: center;
}

/* Desktop roster table: give each column a width that matches what it
   actually holds, instead of the browser spreading all ten evenly by
   content -- a one-character Captaincy dropdown doesn't need Email's room,
   and Email needs more than its even share. table-layout: fixed makes the
   <colgroup> below authoritative. Percentages sum to 100 -- paired with
   main#app.app-wide (more overall width on this screen specifically), this
   gives Email, USA Hockey #, and Waiver Expiry enough real pixels that their
   values stop clipping, rather than just shuffling the same too-small total
   between columns. Centering the short/dropdown columns (Captaincy,
   Position, Jersey #, Mil/LEO) reads cleaner than left-aligned once the
   columns are this uneven. */
table.roster-table { table-layout: fixed; }
table.roster-table col.col-first { width: 11%; }
table.roster-table col.col-last { width: 11%; }
table.roster-table col.col-email { width: 26%; }
table.roster-table col.col-captaincy { width: 6%; }
table.roster-table col.col-position { width: 6%; }
table.roster-table col.col-jersey { width: 5%; }
table.roster-table col.col-usah { width: 12%; }
table.roster-table col.col-waiver { width: 12%; }
table.roster-table col.col-mil { width: 6%; }
table.roster-table col.col-teammgr { width: 5%; }
table.roster-table col.col-action { width: 5%; }
table.roster-table td:nth-child(4) input,
table.roster-table td:nth-child(4) select,
table.roster-table td:nth-child(5) select,
table.roster-table td:nth-child(6) input,
table.roster-table td:nth-child(9) select {
  text-align: center;
}
table.roster-table td.roster-teammgr-cell { text-align: center; }
table.roster-table td:last-child { text-align: center; }

/* Roster editing (admin Rosters + a Team Manager's own team) has nine fields
   per player (ten for an Admin/League Manager, who also gets the Team
   Manager checkbox column) -- fine as a dense table on desktop, unusable as a horizontally-
   scrolling table on a phone (tiny inputs, losing track of which row/field
   you're on). Below 600px (matching the calendar breakpoint above), each
   <tr> becomes a stacked card instead: one full-width labeled field per
   line, no horizontal scroll. The td's data-label (set in buildTeamRosterEditor)
   becomes the visible label via ::before -- no separate mobile markup needed,
   same table/inputs, just redisplayed. */
@media (max-width: 600px) {
  table.roster-table thead { display: none; }
  table.roster-table, table.roster-table tbody, table.roster-table tr, table.roster-table td {
    display: block;
    width: 100%;
  }
  table.roster-table tr {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem 0.7rem;
    margin-bottom: 0.7rem;
  }
  table.roster-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-soft);
  }
  table.roster-table td:last-child { border-bottom: none; justify-content: flex-end; }
  table.roster-table td[data-label]::before {
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--muted);
    flex-shrink: 0;
  }
  table.roster-table td[data-label=""]::before { content: none; }
  table.roster-table input, table.roster-table select {
    width: auto;
    flex: 1 1 auto;
    max-width: 65%;
    text-align: right;
  }
  /* A checkbox shouldn't stretch to fill the row like a text input does. */
  table.roster-table input[type="checkbox"] {
    flex: 0 0 auto;
    max-width: none;
  }
  /* Bigger, easier-to-hit remove target now that it's not squeezed into a
     narrow last column. */
  table.roster-table td:last-child button { padding: 0.4rem 0.9rem; }
}

.back-link { color: var(--accent); text-decoration: none; font-size: 0.85rem; }
.back-link:hover { text-decoration: underline; }

.league-box-grid {
  display: grid;
  /* min(560px, 100%) for bigger cards on wide screens -- still collapses to
     100% on narrow phones instead of overflowing. auto-fit so cards stretch
     to fill a row instead of leaving reserved-but-empty tracks when there
     are fewer leagues than would fill one at the minimum width. */
  grid-template-columns: repeat(auto-fit, minmax(min(560px, 100%), 1fr));
  gap: 1rem;
  align-items: start;
}
.league-box-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}
.league-box-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: inherit;
  text-decoration: none;
}
.league-box-title:hover { color: var(--accent); }
.league-box-season { font-size: 0.8rem; color: var(--muted); }
.league-box-season-select {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: Canvas;
  color: inherit;
}

.next-game-block {
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  margin-top: 0.85rem;
  margin-bottom: 0.85rem;
}
.next-game-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.55rem; }
.next-game-date { font-weight: 700; font-size: 0.9rem; }
.next-game-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.92rem;
  padding: 0.3rem 0.4rem;
  border-radius: 4px;
}
.next-game-time { color: var(--accent); font-weight: 600; min-width: 4.5rem; flex-shrink: 0; }
/* Same slot/alignment as .next-game-time, but for a row that mixes a plain-text
   date with a colored time (see .time-part) rather than being time-only --
   no color of its own so the date portion stays default text color. */
.next-game-when { min-width: 4.5rem; flex-shrink: 0; }
/* The one shared "time is blue+bold" rule -- .next-game-time above applies it
   directly when a slot is time-only; anywhere date and time sit together
   (bracket-when, next-game-when), the time portion is wrapped in this instead
   so the date next to it stays plain/default-colored. */
.time-part { color: var(--accent); font-weight: 600; }
.next-game-row.clickable-row:hover { background: var(--bg-card-hover); }

/* Playoff bracket visual: two seed columns flanking the championship matchup, e.g.
   1 seed / vs / 4 seed  --  champ vs champ  --  2 seed / vs / 3 seed */
.bracket-grid {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-align: center;
  margin: 0.3rem 0;
  overflow-x: auto;
}
.bracket-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  flex: 1;
  min-width: 6.5rem;
  padding: 0.3rem 0.2rem;
  border-radius: 6px;
}
.bracket-column.clickable-row:hover { background: var(--bg-card-hover); }
.bracket-seed-name { font-weight: 600; font-size: 0.8rem; }
.bracket-seed-score { font-size: 0.72rem; color: var(--muted); }
.bracket-vs { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; margin: 0.15rem 0; }
/* Each game's own date/time -- top-14/top-23 often share a date but not
   always a time, and champ is a separate round, so this sits per-column/
   center rather than once for the whole bracket. Date is plain text (see
   .time-part above for why), time is blue+bold. */
.bracket-when {
  font-size: 0.65rem;
  margin-bottom: 0.2rem;
  line-height: 1.25;
}
/* "Championship" above the date in the middle slot -- only the champ box uses
   this today, but it's a generic slot label, not champ-specific by name. */
.bracket-slot-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.bracket-center {
  flex: 1.3;
  min-width: 8.5rem;
  font-weight: 600;
  font-size: 0.78rem;
  padding: 0.3rem;
  border-radius: 6px;
}
.bracket-center.clickable-row:hover { background: var(--bg-card-hover); }
/* Desktop shows the inline "Team A 3-1 Team B" line (bracket-center's own
   font-weight/size above styles it); the stacked seed-column-style variant
   stays hidden until the mobile breakpoint swaps which one's visible. */
.bracket-center-stacked { display: none; flex-direction: column; align-items: center; gap: 0.1rem; }
.winner { font-weight: 800; color: #15803d; }
.loser { color: var(--muted); }

/* Below 600px, three columns in a row no longer fits -- rather than a
   horizontal scrollbar, regroup into two columns: the Round 1 games (1v4,
   2v3) stacked on the left in DOM order, the championship alone on the
   right, vertically centered across both of their rows -- same grouping the
   desktop layout implies (champ flanked by its two seed games), just
   re-flowed for a narrow screen instead of shrunk to fit one row. The
   championship also swaps from its desktop inline line to the stacked
   variant, since that inline text doesn't fit a half-width column. */
@media (max-width: 600px) {
  .bracket-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem 0.5rem;
    overflow-x: visible;
  }
  .bracket-column:nth-child(1) { grid-column: 1; grid-row: 1; }
  .bracket-column:nth-child(3) { grid-column: 1; grid-row: 2; }
  .bracket-center { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .bracket-column, .bracket-center { min-width: 0; }
  .bracket-center-inline { display: none; }
  .bracket-center-stacked { display: flex; }
}

.schedule-days { display: flex; flex-direction: column; gap: 0.8rem; }
.schedule-day {
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  background: var(--bg-card);
}
.schedule-day-date { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.5rem; }
.schedule-day-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
}
.schedule-day-time { color: var(--accent); font-weight: 600; min-width: 5rem; flex-shrink: 0; }
/* .clickable-row also styles table rows (see table.entry-table above) --
   this half covers plain div rows like the schedule list. */
.clickable-row { cursor: pointer; }
.schedule-day-row.clickable-row:hover { background: var(--bg-card-hover); }

/* activity log */
.log-list { list-style: none; margin: 0; padding: 0; font-size: 0.85rem; }
.log-list li { padding: 0.4rem 0; border-bottom: 1px solid var(--border-soft); }
.log-list .log-time { color: var(--muted); font-size: 0.75rem; }

.status-note {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: -0.4rem;
  margin-bottom: 1rem;
}

/* ---- admin ---- */
.admin-tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
  padding-bottom: 0.6rem;
}
.admin-tab {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
}
.admin-tab:hover { background: var(--bg-card); color: inherit; }
.admin-tab.active { background: var(--accent); color: var(--accent-fg); }

.admin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}
.admin-stat-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  background: var(--bg-card);
  text-decoration: none;
  color: inherit;
}
.admin-stat-card:hover { background: var(--bg-card-hover); }
.admin-stat-value { font-size: 1.6rem; font-weight: 700; }
.admin-stat-label { font-size: 0.8rem; color: var(--muted); margin-top: 0.2rem; }

/* Public box score header: team on each edge, date/time + status centered
   between them -- home left, visiting right, same order used everywhere
   else (matchupVsText, standings' home/visiting columns, etc). Below 600px
   there's no room for two team names plus a center column in one row, so it
   stacks: home, then date/status/round, then visiting -- still reads
   top-to-bottom the same way the desktop banner reads left-to-right. */
.matchup-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.4rem;
  margin: 0.85rem 0 1.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
}
.matchup-banner-team {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
/* Same DOM order (logo, then name+record) for both sides -- row-reverse on the
   away side flips it visually so the logo sits on the *outer* edge either way
   (far left for home, far right for away), not just wherever the DOM put it. */
.matchup-banner-away { flex-direction: row-reverse; }
.matchup-banner-logo { height: 3rem; width: 3rem; object-fit: contain; flex-shrink: 0; }
.matchup-banner-text { min-width: 0; }
.matchup-banner-home .matchup-banner-text { text-align: left; }
.matchup-banner-away .matchup-banner-text { text-align: right; }
.matchup-banner-team-name { font-size: 1.35rem; font-weight: 800; line-height: 1.2; }
.matchup-banner-record { font-size: 0.8rem; color: var(--muted); margin-top: 0.2rem; }
.matchup-banner-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
  text-align: center;
}
.matchup-banner-when { font-size: 0.95rem; font-weight: 600; white-space: nowrap; }
.matchup-banner-score { font-size: 1.9rem; font-weight: 800; line-height: 1; letter-spacing: 0.02em; }
.matchup-banner-round { font-size: 0.75rem; color: var(--muted); }
@media (max-width: 600px) {
  .matchup-banner { flex-direction: column; padding: 1rem; gap: 0.7rem; }
  .matchup-banner-team-name { font-size: 1.15rem; }
}

.admin-toolbar {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 1rem 0;
}
.admin-toolbar input {
  flex: 1 1 220px;
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: Canvas;
  color: inherit;
}
.admin-toolbar select {
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: Canvas;
  color: inherit;
}

.admin-league-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
.admin-league-name {
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 0.3rem 0.4rem;
  background: transparent;
  color: inherit;
  flex: 1 1 auto;
}
.admin-league-name:hover, .admin-league-name:focus {
  border-color: var(--border);
  background: Canvas;
}

.admin-team-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.admin-team-list li { display: flex; align-items: center; gap: 0.5rem; }
.section-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  display: block;
  margin: 0.9rem 0 0.4rem;
}
.section-label:first-child { margin-top: 0; }

.daygroup-preview {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
}
.daygroup-preview-week {
  flex: 1 1 240px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  background: Canvas;
}
.daygroup-preview-date { font-weight: 700; font-size: 0.85rem; margin-bottom: 0.3rem; }
.daygroup-preview-block-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent);
  margin-top: 0.5rem;
}
.daygroup-preview-block-label:first-of-type { margin-top: 0; }
.daygroup-preview-row {
  display: flex;
  gap: 0.5rem;
  font-size: 0.82rem;
  padding: 0.08rem 0;
}
.daygroup-preview-time { color: var(--muted); min-width: 4.4rem; }

.calendar-month-label { font-weight: 700; min-width: 160px; text-align: center; }

.calendar-grid {
  display: grid;
  /* minmax(0, 1fr), not minmax(Npx, 1fr) — columns must be able to shrink below any fixed
     floor so 7 of them always fit the viewport width, phones included. A fixed-px minimum
     here is what caused the calendar to overflow off the side of the screen on mobile. */
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--border-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.calendar-weekday {
  background: var(--bg-card);
  padding: 0.4rem;
  text-align: center;
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-cell {
  background: Canvas;
  min-height: 90px;
  padding: 0.35rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.calendar-cell.empty { background: var(--bg-card); }
.calendar-cell.blackout { background: rgba(220, 38, 38, 0.08); }
.calendar-daynum { font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.calendar-blackout-label {
  font-size: 0.62rem;
  color: var(--danger);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.calendar-chip {
  font-size: 0.68rem;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-chip.scheduled { background: rgba(37, 99, 235, 0.18); color: #1d4ed8; }
.calendar-chip.in_progress { background: rgba(217, 119, 6, 0.18); color: #b45309; }
.calendar-chip.complete { background: rgba(22, 163, 74, 0.18); color: #15803d; }

@media (max-width: 600px) {
  .calendar-cell { min-height: 56px; padding: 0.2rem; gap: 0.1rem; }
  .calendar-weekday { padding: 0.25rem 0.1rem; font-size: 0.6rem; }
  .calendar-daynum { font-size: 0.68rem; }
  .calendar-chip { font-size: 0.58rem; padding: 0.1rem 0.2rem; }
  .calendar-blackout-label { font-size: 0.52rem; }
}

.admin-team-list input, .admin-team-list select {
  flex: 1 1 auto;
  font: inherit;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: Canvas;
  color: inherit;
}
