:root {
  /* Theme tokens - overridden per-page by base.html/base_focus.html from
     Settings > Color Theme (see db.THEME_PRESETS). These defaults are the
     original "Green Felt" values, kept here as the fallback so the app
     still looks right even if that override is ever missing. --on-felt-rgb
     is an R,G,B triplet (not a hex string) so rgba(var(--on-felt-rgb), x)
     works for translucent overlays like nav hover states. */
  --felt: #0e6e4f;
  --felt-dark: #094d38;
  --felt-light: #12885f;
  --on-felt-rgb: 255, 255, 255;

  /* Gold accent - fixed across every theme (poker chips don't change color
     with the felt). */
  --gold: #d99a1b;
  --gold-light: #fbead0;
  --gold-dark: #8a5a05;

  /* Semantic/status colors - fixed across every theme, never tied to the
     felt color, so an error message or a "danger" button stays recognizable
     no matter which theme is active. */
  --danger: #c0392b;
  --danger-dark: #922016;
  --danger-light: #fde3e1;
  --success: #166534;
  --success-light: #dcfce7;

  /* Identity colors - fixed across every theme. Same values as danger's red
     today, but a separate set of tokens: these mark "this player is a
     league member" vs. "this player is a guest" on Add Players/Checkout/
     Still In/Finished, which is a different meaning than "danger" even
     though it happens to share a color right now. */
  --identity-member: #1a6fd1;
  --identity-member-light: #dbeafe;
  --identity-guest: #c0392b;
  --identity-guest-dark: #922016;
  --identity-guest-light: #fde3e1;

  --cream: #fbf6ea;
  --card-bg: #ffffff;
  --ink: #26241c;
  --muted: #8a8072;
  --border: #ecdfc5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--cream);
  color: var(--ink);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  background: var(--felt);
  background-image: linear-gradient(135deg, var(--felt) 0%, var(--felt-dark) 100%);
  color: rgb(var(--on-felt-rgb));
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(9, 77, 56, 0.25);
}

.brand {
  color: var(--gold-light);
  font-weight: 800;
  text-decoration: none;
  font-size: 1.2rem;
  letter-spacing: 0.2px;
}
.brand::before { content: "♠ "; color: rgb(var(--on-felt-rgb)); }
.brand::after { content: " ♥"; color: var(--danger); }

.topnav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.topnav a {
  color: rgba(var(--on-felt-rgb), 0.92);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 8px 10px;
  border-radius: 8px;
}

.topnav a:hover { background: rgba(var(--on-felt-rgb), 0.15); }

.nav-avatar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(var(--on-felt-rgb), 0.15);
  margin-left: 4px;
  overflow: hidden;
}
.nav-avatar:hover { background: rgba(var(--on-felt-rgb), 0.28); }
.nav-avatar-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: rgb(var(--on-felt-rgb));
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* position:absolute + inset:0 (rather than width/height:100% on a flex
   child) guarantees a full-bleed fill of the circle regardless of the
   source photo's own aspect ratio - sidesteps any flex-item percentage-
   sizing edge cases the simpler width/height:100% version was exposed to. */
.nav-avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 2px 6px rgba(38, 36, 28, 0.05);
}

.card-muted { opacity: 0.55; }

h1 { font-size: 1.5rem; margin: 8px 0 16px; color: var(--felt-dark); font-weight: 800; }
h2 { font-size: 1.1rem; margin: 0 0 12px; color: var(--felt-dark); font-weight: 700; }

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 12px;
}

label.inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 12px;
}

input[type="text"], input[type="password"], input[type="number"],
input[type="date"], input[type="datetime-local"], input[type="file"], input[type="search"], select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 11px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
/* Money/percent amount fields (Entry & Pricing, Fund Allocations, Payout
   Places, Game Adjustments) - no spinner arrows, and script.js blurs the
   field on scroll so a stray mouse-wheel over it can't change the value. */
.amt-field {
  -moz-appearance: textfield;
}
.amt-field::-webkit-outer-spin-button,
.amt-field::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--felt);
  box-shadow: 0 0 0 3px rgba(14, 110, 79, 0.15);
}

.num-input { width: 80px; }

/* Conditionally-revealed content (see base.html's data-reveals script) - an
   indented, left-bordered block under whichever radio/checkbox it belongs
   to, same visual shape as GOV.UK Design System's conditional reveal. */
.conditional-reveal {
  margin: 4px 0 16px 12px;
  padding: 2px 0 2px 14px;
  border-left: 3px solid var(--border);
}
.conditional-reveal:last-child { margin-bottom: 12px; }

.add-player-panel {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(38, 36, 28, 0.12);
  max-height: 340px;
  overflow-y: auto;
}
.add-player-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.add-player-row { margin: 0; }
.add-player-fullrow { grid-column: 1 / -1; margin: 8px 0 0; }
.btn-player-pick {
  display: block;
  width: 100%;
  height: 100%;
  text-align: left;
  padding: 15px 16px;
  min-height: 48px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-top: 6px solid var(--gold);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(38, 36, 28, 0.12), 0 6px 14px rgba(38, 36, 28, 0.1);
  transition: transform 0.05s ease, box-shadow 0.05s ease;
}
.btn-player-pick:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(38, 36, 28, 0.12), 0 2px 6px rgba(38, 36, 28, 0.1);
  background: var(--gold-light);
}
.btn-player-pick-new { background: var(--gold-light); color: var(--gold-dark); margin-bottom: 6px; }
/* Same membership coloring as Mark Out/Still In/Finished - a player being
   picked to add is a league member or a guest, same data-league attribute.
   The "+ Add as new player" button never carries data-league, so it's
   untouched and keeps the plain gold border above. */
.btn-player-pick[data-league="1"] { border-top-color: var(--identity-member); }
.btn-player-pick[data-league="0"] { border-top-color: var(--identity-guest); }

/* Still In's inline "add a player" shortcut - a small round button next to
   the existing search box (not a full row of its own) that toggles
   #add-player-panel-inline, reusing the .add-player-panel/.btn-player-pick
   styles above rather than a second copy of them. */
.search-row { display: flex; align-items: center; gap: 8px; }
.search-row input[type="search"] { flex: 1; width: auto; margin-top: 0; }
.btn-add-player {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--felt);
  color: rgb(var(--on-felt-rgb));
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-add-player:hover { background: var(--felt-dark); }

.btn {
  display: inline-block;
  padding: 12px 20px;
  min-height: 44px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  background: var(--gold-light);
  color: var(--gold-dark);
  cursor: pointer;
  transition: transform 0.05s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary { background: var(--felt); color: rgb(var(--on-felt-rgb)); }
.btn-primary:hover { background: var(--felt-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-small { padding: 8px 14px; min-height: 36px; font-size: 0.9rem; }
.btn-tiny { padding: 5px 10px; min-height: 28px; font-size: 0.8rem; }
.btn-block { display: block; width: 100%; text-align: center; }

/* Unsaved-changes indicator - applied by the dirty-form-tracking script in
   base.html to a form's submit button once any field's value differs from
   how the page loaded. Gold signals "needs to be pushed"; back to the
   normal button color once saved/reloaded. */
.btn-dirty, .btn-dirty.btn-primary, .btn-dirty:hover, .btn-dirty.btn-primary:hover {
  background: var(--gold);
  color: #fff;
  box-shadow: 0 0 0 2px var(--gold-dark) inset;
}

.flash {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  font-weight: 600;
}
.flash-success { background: var(--success-light); color: var(--success); }
.flash-error { background: var(--danger-light); color: var(--danger-dark); }

.login-card { max-width: 360px; margin: 40px auto; text-align: center; }

.table-wrap { overflow-x: auto; }

table.standings {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.standings th {
  text-align: left;
  padding: 10px 8px;
  background: var(--gold-light);
  color: var(--gold-dark);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
table.standings th:first-child { border-radius: 8px 0 0 8px; }
table.standings th:last-child { border-radius: 0 8px 8px 0; }
table.standings td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.standings tbody tr:hover { background: #fdf9ef; }
table.standings th.sortable { cursor: pointer; user-select: none; }
table.standings th.sortable:hover { color: var(--felt-dark); }
table.standings th .sort-arrow { margin-left: 4px; font-size: 0.7rem; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}
.stat {
  background: var(--gold-light);
  border-radius: 12px;
  padding: 14px 12px;
  text-align: center;
}
.stat-value { display: block; font-size: 1.6rem; font-weight: 800; color: var(--felt-dark); }
.stat-value small { font-size: 1rem; font-weight: 400; color: var(--muted); }
.stat-label { display: block; font-size: 0.8rem; color: var(--gold-dark); margin-top: 4px; font-weight: 600; }

.muted { color: var(--muted); font-size: 0.85rem; }
/* Nested breakdown row under a .muted line (e.g. Final Numbers' per-tier
   Re-Entry/Add-On rows under the whole-game total) - double-indented so
   the tier rows read as children of the line above them, not another
   flat total. */
.muted-indent-2 { margin-left: 32px; margin-top: 2px; }

.player-row, .inline-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.grow { flex: 1; min-width: 120px; }

/* Wraps the username/password/login-method fields inside a .player-row so
   they can be shown/hidden as one unit (updatePlayerLoginFieldsVisibility)
   without disturbing the row's own flex layout. */
.player-login-fields { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Deactivate/Delete grouped together so .player-actions-row's
   space-between still only sees three slots (this group, View profile,
   Save). */
.player-actions-group { display: flex; align-items: center; gap: 8px; }

/* Manage Players: Save (player-row form) and Deactivate/Reactivate
   (inline-form form) are two separate <form>s, so their buttons live here
   instead - associated back to each form via the form="<id>" attribute -
   purely so they can share one visual row (Deactivate left, Save right)
   regardless of which <form> they actually submit. */
.player-actions-row { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }

/* Compact instead of stretching full-width like a text field - a date
   input's own native picker UI already has a wide enough minimum size
   without a width:100% rule making it wider still. The block name moved
   from an always-visible parenthetical into a hover tooltip (title attr)
   to shorten the label. */
.joined-league-field { flex: 0 0 auto; }
.joined-league-field input[type="date"] { width: auto; min-width: 0; max-width: 150px; }

.game-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: var(--ink);
}
.game-row:hover { border-color: var(--felt-light); }

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.badge-active { background: var(--success-light); color: var(--success); }
.badge-completed { background: #f1e9d2; color: var(--muted); }
.badge-guest { background: var(--gold-light); color: var(--gold-dark); margin-left: 6px; }

.entry-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.entry-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

.count-chip {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 2px solid transparent;
  cursor: pointer;
  line-height: 1.2;
}
.count-chip-all { background: #f1e9d2; color: var(--muted); }
.count-chip-league { background: var(--gold-light); color: var(--gold-dark); }
.count-chip-guest { background: var(--identity-guest-light); color: var(--identity-guest-dark); }
.count-chip-active { border-color: currentColor; }
.count-chip-static { cursor: default; }

.place-edit-form { display: flex; align-items: center; gap: 6px; }
.order-view, .place-view { display: flex; align-items: center; gap: 2px; }
.order-value, .place-value { font-weight: 700; color: var(--muted); min-width: 28px; }
.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  font-size: 0.95rem;
  color: var(--muted);
  min-height: auto;
}
.icon-btn:hover { color: var(--felt); }

@media (min-width: 640px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
}
.tab {
  padding: 10px 14px;
  text-decoration: none;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  margin-bottom: -2px;
}
.tab-active {
  color: var(--felt);
  border-bottom-color: var(--gold);
  font-weight: 700;
}

/* Mobile drill-down nav (Block Settings / Global Settings ONLY - see
   tabs-drilldown below, not the plain .tabs class every other tab strip in
   the app still uses, e.g. Help and Standings' 2-item tab bars) - below
   768px, the horizontal .tabs/.subtabs-current strip is replaced by a
   vertical, full-width, one-level-at-a-time list (category screen ->
   sub-item screen where one exists -> content screen, each with its own
   back link) instead of a swipeable strip. 768px matches this app's other
   breakpoint (the stats grid below) and is the same phone/tablet line
   Bootstrap and Tailwind both default to. At 768px and up none of this
   applies - the existing .tabs strip and its content render exactly as
   before. See docs/NOTES.md for why this exists. */
@media (max-width: 767px) {
  .tabs.tabs-drilldown { display: none; }
  .settings-content:not(.settings-content--active) { display: none; }
}

.mobile-nav-list { display: none; }
@media (max-width: 767px) {
  .mobile-nav-list {
    display: block;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 16px;
    background: var(--card-bg);
  }
}
.mobile-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border);
}
.mobile-nav-item:last-child { border-bottom: none; }
.mobile-nav-item .chev { color: var(--muted); font-weight: 400; }

/* Breadcrumb-style: .mobile-back-link is now always the first, linked
   segment inside a .mobile-page-title heading (e.g. "‹ Block Settings /
   Grace Period") rather than a separate row above it - the link names
   where "back" goes, the plain text after it names where you are, on one
   line. display:inline so it sits in the flow of the heading text instead
   of forcing its own line. */
.mobile-back-link { display: none; }
@media (max-width: 767px) {
  .mobile-back-link {
    display: inline;
    color: var(--felt);
    text-decoration: none;
  }
}

/* Utility: hide an element only on the mobile drill-down layout, e.g. a
   page-level link (Block Settings' "Back to Blocks") that would otherwise
   sit right next to a .mobile-page-title's back-link segment and read as
   a second, confusingly similar "back" affordance once drilled into a
   tab. Unaffected at 768px and up. */
@media (max-width: 767px) {
  .mobile-hide { display: none; }
}

/* Page-title for every mobile drill-down screen below the root chooser -
   sub-item choosers (e.g. "Final Tournament") and the content screens
   beneath them (e.g. "Fund Allocations / Allocations") alike, since the
   desktop .tabs-drilldown strip that would otherwise show this is hidden
   at this width. Leads with a .mobile-back-link (see above) as the
   clickable "go up one level" segment, followed by plain text naming the
   current screen - not a link, since tapping "here" shouldn't navigate
   anywhere. Only the top-level chooser skips this entirely; its own page
   `<h1>` already covers it. */
.mobile-page-title { display: none; }
@media (max-width: 767px) {
  .mobile-page-title {
    display: block;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--ink);
    margin: 0 0 10px;
  }
}

.site-footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.site-footer a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}
.site-footer a:hover { color: var(--felt); }

.big-buttons {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}
.big-button {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-radius: 18px;
  padding: 26px 24px;
  text-decoration: none;
  min-height: 88px;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(38, 36, 28, 0.1);
  transition: transform 0.08s ease;
}
.big-button:active { transform: scale(0.98); }
.big-button::after {
  position: absolute;
  right: 10px;
  top: -10px;
  font-size: 5rem;
  opacity: 0.18;
  line-height: 1;
}
.big-button-title { font-size: 1.35rem; font-weight: 800; position: relative; z-index: 1; }
.big-button-sub { font-size: 0.9rem; position: relative; z-index: 1; opacity: 0.85; }

.big-button-felt { background: var(--felt); color: rgb(var(--on-felt-rgb)); }
.big-button-felt::after { content: "♠"; color: rgb(var(--on-felt-rgb)); }
.big-button-gold { background: var(--gold); color: #4a3204; }
.big-button-gold::after { content: "♦"; color: #4a3204; }
.big-button-red { background: var(--danger); color: #fff; }
.big-button-red::after { content: "♥"; color: #fff; }

.active-game-section { margin-top: 4px; }
.active-game-banner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--identity-member);
  background-image: linear-gradient(135deg, #2f8bde 0%, var(--identity-member) 55%, #124f96 100%);
  border: 2px solid var(--identity-member-light);
  border-radius: 18px;
  padding: 18px 20px;
  text-decoration: none;
  color: #fff;
  box-shadow: 0 4px 10px rgba(38, 36, 28, 0.15);
  margin-bottom: 12px;
  transition: transform 0.08s ease;
}
.active-game-banner:active { transform: scale(0.98); }
.active-game-banner + .active-game-banner { margin-top: 12px; }
.live-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
  animation: live-pulse 1.6s infinite;
}
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}
.active-game-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.active-game-label { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--identity-member-light); }
.active-game-name { font-size: 1.15rem; font-weight: 800; }
.active-game-sub { font-size: 0.85rem; opacity: 0.85; }
.active-game-arrow { font-size: 1.3rem; opacity: 0.7; flex-shrink: 0; }

.player-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 4px;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid var(--border);
}
.player-list-row:last-child { border-bottom: none; }
.player-list-row:hover { background: #fdf9ef; }
.player-list-name { display: inline-flex; align-items: center; gap: 8px; }

/* Small avatar shown inline (Players directory list, nav icon uses its own
   sizing) - same idea as .profile-avatar/.profile-avatar-placeholder on My
   Profile, just sized for a list row instead of a page header. */
.avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold);
  flex-shrink: 0;
}
.avatar-sm-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--felt);
  color: var(--gold-light);
  font-size: 0.8rem;
  font-weight: 800;
}

/* Sub-section header inside a details panel that already has its own bold
   summary (e.g. Fund Breakdown's "Allocations"/"Game Adjustments"/"<Prize>
   reference split") - lighter than a plain <strong> so it reads as a label
   over a group of rows rather than another data row, which is what made
   Fund Breakdown feel cluttered when every section header was the same
   weight as the numbers underneath it. */
.fund-section-label {
  margin-top: 14px;
  margin-bottom: 2px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold-dark);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Fund Breakdown's individually-collapsible sub-sections (Total in/TD
   comp/Total out/Total remaining/reference split - see
   templates/partials/fund_breakdown.html). Lighter-weight nested cousin of
   .player-details/.player-summary below: no border box or shadow of its
   own (it already lives inside one - the outer Fund Breakdown panel), just
   a rule between sections and the same disclosure-triangle language, plus
   a running total on the right so a collapsed sub-section still shows its
   number without opening it. */
.fund-subsection {
  border-top: 1px solid var(--border);
  margin-top: 12px;
  padding-top: 2px;
}
.fund-subsection:first-of-type { border-top: none; margin-top: 0; padding-top: 0; }
.fund-subsection-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
}
.fund-subsection-summary::-webkit-details-marker { display: none; }
.fund-subsection-summary::before {
  content: "▸";
  color: var(--muted);
  transition: transform 0.1s ease;
  margin-right: 6px;
  flex-shrink: 0;
}
.fund-subsection[open] > .fund-subsection-summary::before { transform: rotate(90deg); }
.fund-subsection-summary .fund-section-label { margin: 0; flex: 1; }
.fund-subsection-total { font-weight: 700; color: var(--ink); white-space: nowrap; }
.fund-subsection-body { padding: 4px 0 6px; }

.tier-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.checkbox-tier {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  min-height: 36px;
  cursor: pointer;
  margin: 0;
}
.checkbox-tier input { width: 18px; height: 18px; }
/* Selected-state highlight, checkbox or radio alike - was purely the bare
   input's own checked look before. Used by every .checkbox-tier group
   (Fund Allocations Applies To, TD Comp tiers). Degrades harmlessly on a
   browser without :has() support - just no highlight, the input itself
   still shows checked/unchecked. */
.checkbox-tier:has(input:checked) { border-color: var(--felt); background: #eafff4; }

/* Payout Brackets' Min/Max row (Fund Allocations > Payout Places, when
   "Scale payout places by attendance" is on) - two num-inputs side by
   side, wrapping to stacked on narrow screens same as every other flex
   row in this app. */
.range-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.range-row label { flex: 1; min-width: 100px; }
.bracket-places { color: var(--muted); font-weight: 600; font-size: 0.85rem; }

/* Payout Places' "Fixed table / Scale by player count / Scale by Prize
   Pool total" picker (Fund Allocations > Payout Places) - a single
   3-option choice, not a checkbox that reveals a second control. Each
   option is a full-width tappable row (not a small radio dot alone) with
   its own one-line explanation, so the choice is self-explanatory without
   a separate paragraph of help text above it. Reuses the same
   selected-state highlight idea as .checkbox-tier above, just stacked
   instead of inline since each option carries a hint line underneath its
   label. */
.mode-options { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 12px; }
.mode-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}
.mode-option input { width: 18px; height: 18px; margin-top: 2px; flex-shrink: 0; }
.mode-option:has(input:checked) { border-color: var(--felt); background: #eafff4; }
.mode-option-label { font-weight: 700; }
.mode-option-hint { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }

/* Fixed-width variant of table.standings for the Permissions grid - unlike
   the standings table, the Capability column holds a wrapping label +
   description rather than a single short value, so it can't use
   white-space: nowrap (that's what stretched this table past the page
   width the first time around, forcing a horizontal scroll that separated
   the checkboxes from their row). table-layout: fixed plus explicit column
   widths cap every column at a share of the table's own width instead of
   its content's width, so the description wraps and the whole table stays
   within the page - same three-column side-by-side layout, just readable. */
table.permissions {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  table-layout: fixed;
}
table.permissions th {
  text-align: left;
  padding: 10px 8px;
  background: var(--gold-light);
  color: var(--gold-dark);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
table.permissions th:first-child { border-radius: 8px 0 0 8px; width: 56%; }
table.permissions th:last-child { border-radius: 0 8px 8px 0; }
table.permissions th:nth-child(2), table.permissions th:nth-child(3) { width: 22%; text-align: center; }
table.permissions td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  white-space: normal;
}
table.permissions td:nth-child(2), table.permissions td:nth-child(3) { text-align: center; }
table.permissions td input[type="checkbox"] { width: 18px; height: 18px; margin: 0; }
table.permissions tbody tr:hover { background: #fdf9ef; }

/* Settings > Player Logins > Profile fields - same visual language as
   table.permissions, four columns instead of three. */
table.profile-fields {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  table-layout: fixed;
}
table.profile-fields th {
  text-align: left;
  padding: 10px 8px;
  background: var(--gold-light);
  color: var(--gold-dark);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
table.profile-fields th:first-child { border-radius: 8px 0 0 8px; width: 32%; }
table.profile-fields th:last-child { border-radius: 0 8px 8px 0; }
table.profile-fields th:nth-child(2) { width: 16%; text-align: center; }
table.profile-fields th:nth-child(3) { width: 36%; }
table.profile-fields th:nth-child(4) { width: 16%; text-align: center; }
table.profile-fields td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.profile-fields td:nth-child(2), table.profile-fields td:nth-child(4) { text-align: center; }
table.profile-fields td input[type="checkbox"] { width: 18px; height: 18px; margin: 0; }
table.profile-fields td select { width: 100%; margin-top: 0; padding: 6px 8px; font-size: 0.85rem; }
table.profile-fields tbody tr:hover { background: #fdf9ef; }

.still-in-picker-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
}
.still-in-picker-row:last-child { border-bottom: none; }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.btn-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}
.btn-step:active { background: var(--gold-light); }
.step-value { display: inline-block; min-width: 20px; text-align: center; font-weight: 700; }

.page-body { white-space: pre-wrap; }

textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 10px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
}

/* ---------- search / toolbar / collapsible rows ---------- */

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar input[type="search"] { flex: 1; min-width: 160px; margin-top: 0; }
.toolbar select { width: auto; margin-top: 0; }

.player-details {
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
  background: var(--card-bg);
  overflow: hidden;
}
.player-details[open] { box-shadow: 0 2px 6px rgba(38, 36, 28, 0.08); }
.player-summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
}
.player-summary::-webkit-details-marker { display: none; }
.player-summary::after {
  content: "▸";
  color: var(--muted);
  transition: transform 0.1s ease;
  margin-left: auto;
}
.player-details[open] .player-summary::after { transform: rotate(90deg); }

/* Single-row section: same boxed footprint as a collapsed .player-details
   header, for a section that's just one link - no body to expand into,
   so no <details>/<summary> at all. The "?" opens a small popup with the
   explanation text instead of a permanently-visible paragraph. */
.section-row {
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
  background: var(--card-bg);
  box-shadow: 0 2px 6px rgba(38, 36, 28, 0.08);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}
.section-row-link {
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  flex: 1;
}
.section-row-link:hover { color: var(--felt-dark); }
.info-btn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--cream);
  color: var(--muted);
  font-weight: 800;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.info-btn:hover { background: var(--gold-light); color: var(--gold-dark); border-color: var(--gold); }
.info-popup {
  position: absolute;
  top: calc(100% + 6px);
  right: 16px;
  max-width: 260px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.85rem;
  color: var(--muted);
  box-shadow: 0 6px 18px rgba(38, 36, 28, 0.15);
  z-index: 5;
}
.info-popup[hidden] { display: none; }
.player-summary-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.player-summary-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.player-details-body { padding: 0 16px 16px; border-top: 1px solid var(--border); padding-top: 14px; }

.badge-td { background: #dbeafe; color: #1e40af; }
.badge-admin { background: #ede9fe; color: #5b21b6; }
.badge-inactive { background: #f1e9d2; color: var(--muted); }

code {
  background: var(--gold-light);
  color: var(--gold-dark);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.help-section p, .help-section li { font-size: 0.92rem; line-height: 1.5; }
.help-section table.standings td, .help-section table.standings th { white-space: normal; }

.help-group-title {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold-dark);
  margin: 22px 0 10px;
}
.help-group-title:first-of-type { margin-top: 4px; }

.help-summary-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.help-summary-hint {
  display: block;
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: normal;
}

.help-body p { margin: 0 0 12px; }
.help-body ul { margin: 0 0 12px; padding-left: 20px; }
.help-body li { margin-bottom: 6px; }
.help-body p:last-child, .help-body ul:last-child { margin-bottom: 0; }
.help-body li:last-child { margin-bottom: 0; }

/* Full-screen focus mode: add-players and table-checkout screens.
   Minimal chrome on purpose - no topnav/footer clutter while doing rapid,
   repeated taps during a live game. */
.focus-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--felt);
  background-image: linear-gradient(135deg, var(--felt) 0%, var(--felt-dark) 100%);
  color: rgb(var(--on-felt-rgb));
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(9, 77, 56, 0.25);
}
.focus-title { font-weight: 800; color: var(--gold-light); font-size: 1.05rem; }
.focus-back {
  color: rgb(var(--on-felt-rgb));
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 12px;
  border: 1px solid rgba(var(--on-felt-rgb), 0.5);
  border-radius: 8px;
  white-space: nowrap;
}
.focus-back:active { background: rgba(var(--on-felt-rgb), 0.15); }
.focus-main { padding-top: 20px; }

/* Table / self-checkout screen - full-bleed felt table, big chunky buttons,
   meant to be fun and obvious for a player (not just a TD) to use unassisted. */
.checkout-body {
  background: var(--felt);
  background-image: radial-gradient(circle at 50% -10%, var(--felt-light) 0%, var(--felt) 45%, var(--felt-dark) 100%);
  min-height: 100vh;
}
.checkout-body .muted { color: rgba(var(--on-felt-rgb), 0.8); }

.checkout-hero { text-align: center; margin-bottom: 14px; }
.checkout-heading { color: var(--gold-light); font-size: 1.4rem; margin: 4px 0 6px; }
.checkout-sub { margin: 0; font-weight: 600; }

.checkout-search {
  font-size: 1.1rem;
  padding: 14px 16px;
  border-radius: 14px;
  border: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.checkout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.checkout-tile { margin: 0; }

.checkout-btn {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 68px;
  padding: 16px 10px;
  font-size: 1.05rem;
  font-weight: 800;
  text-align: center;
  border: none;
  border-top: 6px solid var(--gold);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2), 0 6px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.05s ease, box-shadow 0.05s ease;
}
.checkout-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 2px 6px rgba(0, 0, 0, 0.2);
}
/* Border color signals membership, not position: league members get
   --identity-member, guests get --identity-guest - both fixed regardless of
   the active Color Theme. Driven by the data-league attribute set per
   tile, same flag the League/Guest filter chips use. Same treatment on
   the game-detail page's Still In cards (left border - a wide horizontal
   row, not a grid tile) and Finished table rows (left border on the
   first cell, since border-collapse means a <tr> itself can't carry a
   visible border), scoped to those sections' own lists so Standings and
   Players (which also use data-league) are unaffected. */
.checkout-tile[data-league="1"] .checkout-btn { border-top-color: var(--identity-member); }
.checkout-tile[data-league="0"] .checkout-btn { border-top-color: var(--identity-guest); }
#still-in-list .entry-row[data-league="1"], #finished-list .entry-row[data-league="1"] { border-left: 4px solid var(--identity-member); }
#still-in-list .entry-row[data-league="0"], #finished-list .entry-row[data-league="0"] { border-left: 4px solid var(--identity-guest); }
#finished-list tr[data-league="1"] td:first-child { border-left: 4px solid var(--identity-member); }
#finished-list tr[data-league="0"] td:first-child { border-left: 4px solid var(--identity-guest); }

/* The All/League/Guests filter chips use the app-wide gold/red count-chip
   colors everywhere else (Standings) - scoped override here only, so
   Checkout/Still In/Finished/Add Players' League/Guests chips match their
   own row/tile colors instead. */
#checkout-filter-toolbar .count-chip-league,
#still-in-filter-toolbar .count-chip-league,
#finished-filter-toolbar .count-chip-league,
#add-players-toolbar .count-chip-league { background: var(--identity-member-light); color: var(--identity-member); }
#checkout-filter-toolbar .count-chip-guest,
#still-in-filter-toolbar .count-chip-guest,
#finished-filter-toolbar .count-chip-guest,
#add-players-toolbar .count-chip-guest { background: var(--identity-guest-light); color: var(--identity-guest-dark); }

/* Full-screen confirm takeover - this is a one-way action, so it should be
   impossible to miss or mistake for part of the grid. */
.checkout-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 77, 56, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
}
.checkout-confirm-box {
  background: #fff;
  border-radius: 20px;
  padding: 40px 28px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.checkout-confirm-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 10px;
}
.checkout-confirm-name {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--felt-dark);
  margin: 0 0 28px;
  line-height: 1.15;
  word-break: break-word;
}
.checkout-confirm-actions { display: flex; flex-direction: column; gap: 12px; }
.checkout-confirm-actions .btn {
  min-height: 58px;
  font-size: 1.2rem;
  font-weight: 800;
  border-radius: 14px;
}

/* Player Logins / Profiles - avatar shown on My Profile and a player's public page. */
.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--gold);
  margin: 0 0 16px;
  display: block;
}

/* My Profile header: identity card (avatar + name + role) above the
   editable sections - see docs/NOTES.md Player Logins for the rest of
   the profile page shape. */
.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 18px;
  margin-bottom: 16px;
  box-shadow: 0 2px 6px rgba(38, 36, 28, 0.05);
}
.profile-header h1 { margin: 12px 0 8px; }

.avatar-upload { position: relative; display: inline-block; }
.avatar-upload .profile-avatar { margin: 0; }
.profile-avatar-placeholder {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 3px solid var(--gold);
  background: var(--felt);
  color: var(--gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 800;
}
.avatar-edit-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gold);
  color: #4a3204;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  border: 2px solid var(--card-bg);
}
.badge-player { background: #f1e9d2; color: var(--muted); }
