:root {
  --bg: #0b0e13;
  --surface: #141922;
  --surface-2: #1b212c;
  --surface-3: #232b38;
  --border: #262d3a;
  --text: #e7e9ee;
  --muted: #8791a1;
  --crimson: #b3182b;
  --crimson-dark: #8a1220;
  --crimson-light: #d64a5a;
  --crimson-bright: #ff2d2d;
  --green: #22a35a;
  --green-dark: #17753e;
  --green-soft: #12321f;
  --red-soft: #3a1418;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark; /* native scrollbars, checkboxes and pickers draw dark */
  --green-text: #5fd68e;
  --green-border: #245c3c;
  --red-text: #f0838c;
  --red-border: #6b2a30;
  --amber-text: #e0ab53;
  --amber-soft: #3a2d12;
  --amber-border: #5c4820;
  --gold-text: #f2c14e;
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* Light theme: chosen per viewer with the topbar toggle (theme.js sets data-theme). */
:root[data-theme="light"] {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --surface-3: #e3e8f0;
  --border: #d5dbe6;
  --text: #1b2230;
  --muted: #5f6b7d;
  --green-soft: #dff5e8;
  --green-text: #14783f;
  --green-border: #a9dcbf;
  --red-soft: #fde3e6;
  --red-text: #b3243a;
  --red-border: #f0b1ba;
  --amber-soft: #fdf0d5;
  --amber-text: #8a5a05;
  --amber-border: #ecd08e;
  --gold-text: #8a6500;
  --shadow-card: 0 6px 18px rgba(20, 30, 50, 0.08);
  color-scheme: light;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* ---------- Brand ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  height: 45px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.brand h1 {
  font-size: 1.15rem;
  margin: 0;
  white-space: nowrap;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.25;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--text);
}

.brand-name-accent { color: var(--crimson-light); }

/* theme.js reveals these once branding settings have loaded (see there). */
html:not(.brand-ready) .brand-team,
html:not(.brand-ready) .brand-logo { visibility: hidden; }

.logo-setting { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo-setting img { height: 45px; width: auto; }
.logo-setting input[type=file] { font-size: 0.85rem; color: var(--muted); border: none; background: transparent; padding: 0; }
.settings-form input[type=text] { width: 220px; }

.brand-tagline {
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
}

.brand-team {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- Public/admin top bar ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

/* Admin: full-bleed bar, contents centered via a 3-column grid. */
.topbar-grid {
  padding: 14px 24px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

.topbar-left { justify-self: start; min-width: 0; }
.topbar-center { justify-self: center; }
.topbar-right { justify-self: end; display: flex; align-items: center; gap: 16px; }

@media (max-width: 720px) {
  .topbar-grid {
    grid-template-columns: 1fr;
    row-gap: 12px;
  }
  .topbar-grid .topbar-left, .topbar-grid .topbar-center, .topbar-grid .topbar-right { justify-self: center; }
}

/* Public: contents constrained to the same width/padding as <main>, so the
   brand's left edge and the season picker's right edge line up with the
   KPI cards and table below rather than sitting flush with the viewport edge. */
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .topbar-inner { flex-direction: column; align-items: center; text-align: center; }
}

.topbar h1 { font-size: 1.15rem; margin: 0; white-space: nowrap; }

.sidebar-toggle-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.season-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.season-picker select {
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.topbar-link {
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: none;
  padding: 8px 4px;
}

.topbar-link:hover { color: var(--text); }

/* ---------- Admin app shell / sidebar ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand .brand-name { font-size: 1rem; }
.sidebar-brand .brand-tagline { white-space: normal; }

#tabs.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 12px;
}

.sidebar-nav .tab-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.92rem;
  text-align: left;
  font-family: inherit;
}

.sidebar-nav .tab-btn:hover { background: var(--surface-2); color: var(--text); }
.sidebar-nav .tab-btn.active {
  background: var(--crimson);
  color: #fff;
  font-weight: 600;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

@media (max-width: 900px) {
  .sidebar-toggle-btn { display: flex; }
  .sidebar {
    position: fixed;
    top: 0;
    left: -260px;
    height: 100vh;
    z-index: 60;
    transition: left 0.2s ease;
    box-shadow: 0 0 0 100vmax rgba(0,0,0,0);
  }
  .sidebar.open {
    left: 0;
    box-shadow: 0 0 0 100vmax rgba(0,0,0,0.5);
  }
}

/* ---------- View toggle (Performance / Match Results) ---------- */
.view-toggle {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 4px;
}

.view-toggle-btn {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  font-family: inherit;
}

.view-toggle-btn:hover { color: #fff; }
.view-toggle-btn { white-space: nowrap; }
@media (max-width: 520px) {
  .view-toggle { flex-wrap: wrap; }
  .view-toggle-btn { flex: 1 1 auto; }
}
.view-toggle-btn.active { background: var(--crimson); color: #fff; font-weight: 600; }

/* ---------- Awards & milestones ---------- */
.award-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}
.award-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 16px 18px;
}
.awards-notice { background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius-lg); padding: 16px 18px; color: var(--muted); margin-bottom: 18px; }
.award-icon { margin-right: 7px; font-size: 1rem; }
.feat-list div { font-size: 1rem; }
.award-title { color: var(--crimson-light); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.award-winners { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.award-value { font-size: 0.95rem; font-weight: 600; margin-top: 4px; }
.award-blurb { color: var(--muted); font-size: 0.78rem; margin-top: 6px; }
.milestone-list { list-style: none; padding: 0; margin: 0 0 8px; }
.milestone-list li { padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.milestone-list li:last-child { border-bottom: none; }
.milestone-list li span { color: var(--muted); margin-left: 6px; }

/* ---------- KPI cards ---------- */
.kpi-row-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

@media (max-width: 700px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 16px 18px;
}

.kpi-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
}

.kpi-sub {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 4px;
  min-height: 1em;
}

/* ---------- Form chips ---------- */
.form-chips {
  display: flex;
  gap: 4px;
}

.form-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--muted);
}

.form-chip.form-w { background: var(--green-soft); color: var(--green-text); }
.form-chip.form-l { background: var(--red-soft); color: var(--red-text); }
.form-chip.form-split { background: var(--surface-3); color: var(--muted); }

.result-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
}

.result-pill.result-won { background: var(--green-soft); color: var(--green-text); }
.result-pill.result-lost { background: var(--red-soft); color: var(--red-text); }
.result-pill.result-bye { background: var(--surface-3); color: var(--muted); }
.result-pill.result-upcoming { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--crimson-light); }
.result-pill.result-awaiting { background: var(--amber-soft); color: var(--amber-text); }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--bg);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-card);
}

.login-card .brand { justify-content: center; margin-bottom: 4px; }
.login-card .brand h1 { font-size: 1.2rem; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; color: var(--muted); }
.login-card input {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: var(--surface-2);
  color: var(--text);
}
.login-card .hint { color: var(--crimson-light); text-align: center; margin: 0; }
.login-card .topbar-link { color: var(--muted); text-align: center; }
.login-card .topbar-link:hover { color: var(--text); }

main {
  max-width: 1100px;
  width: 100%;
  margin: 24px auto;
  padding: 0 16px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.panel-header h2 { margin: 0; font-size: 1.1rem; font-weight: 700; }

/* ---------- Cards / tables ---------- */
.table-scroll {
  overflow-x: auto;
  max-width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
}

.data-table th, .data-table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.data-table th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table.sortable th { cursor: pointer; user-select: none; }
.data-table.sortable th.no-sort { cursor: default; }
.data-table.sortable th:hover { color: var(--text); }
.data-table.sortable th.sorted::after { content: " ▾"; }
.data-table.sortable th.sorted.asc::after { content: " ▴"; }

.inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.inline-form input, .inline-form select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
}

button {
  background: var(--crimson);
  color: #fff;
  border: none;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  font-family: inherit;
}

button:hover { background: var(--crimson-dark); }

a#exportBtn {
  display: inline-block;
  background: var(--crimson);
  color: #fff;
  border: none;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  text-decoration: none;
}
a#exportBtn:hover { background: var(--crimson-dark); }
button.danger { background: #7c2530; }
button.danger:hover { background: #641c25; }
button.secondary { background: var(--surface-3); color: var(--text); }
button.secondary:hover { background: var(--surface-2); }

.card-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}

.card-form label { font-size: 0.85rem; display: flex; align-items: center; gap: 4px; color: var(--muted); }
.card-form input[type=text], .card-form input[type=date] {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
}

.hint { color: var(--muted); font-size: 0.82rem; margin-top: 8px; }

.weeks-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.week-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.week-chip:hover { border-color: var(--crimson); }
.week-chip.selected { background: var(--crimson); color: #fff; border-color: var(--crimson); }
.week-chip .del { opacity: 0.6; }
.week-chip .del:hover { opacity: 1; }

.week-entry-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px;
}

.week-entry-panel .table-scroll {
  border: none;
  box-shadow: none;
  background: transparent;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

select.singles-result, select.doubles-result {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font: inherit;
  font-weight: 600;
  min-width: 120px;
  background: var(--surface-2);
  color: var(--text);
}

select.result-none { background: var(--surface-2); color: var(--muted); font-weight: 400; }
select.result-won { background: var(--green-soft); color: var(--green-text); border-color: var(--green-border); }
select.result-lost { background: var(--red-soft); color: var(--red-text); border-color: var(--red-border); }

.week-details-form, .settings-form {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin: 0 0 16px;
}

.week-details-form label, .settings-form label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.78rem;
  color: var(--muted);
}

.week-details-form input, .week-details-form select, .settings-form input {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--surface-3);
  color: var(--text);
}

.week-details-form input[type=number] { width: 80px; }
.week-details-form input[type=text] { width: 160px; }
.settings-form input[type=number] { width: 90px; }
.settings-form input[type=color] {
  width: 56px;
  height: 34px;
  padding: 2px;
  cursor: pointer;
}
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
}

.settings-form .toggle-switch { flex-direction: row; font-size: 0.88rem; }

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.15s ease, background 0.15s ease;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--crimson);
  border-color: var(--crimson);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: #fff;
}

.toggle-switch input:focus-visible + .toggle-slider {
  outline: 2px solid var(--crimson-light);
  outline-offset: 2px;
}

.week-entry-panel input[type=number] {
  width: 56px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
}

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.78rem;
  background: var(--green-soft);
  color: var(--green-text);
}

.pill.sub { background: var(--amber-soft); color: var(--amber-text); }
.pill.ex { background: var(--red-soft); color: var(--red-text); }

#playersBody input[type=text],
#seasonsBody input[type=text] {
  width: 100%;
  min-width: 90px;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font: inherit;
  color: inherit;
}

#playersBody input[type=text]:hover,
#playersBody input[type=text]:focus,
#seasonsBody input[type=text]:hover,
#seasonsBody input[type=text]:focus {
  border-color: var(--border);
  background: var(--surface-2);
}

#playersBody input[type=checkbox] { width: 16px; height: 16px; }
#playersBody td:nth-child(5) input { min-width: 220px; }

td.actions { white-space: nowrap; }
td.actions button { padding: 4px 9px; font-size: 0.8rem; margin-right: 4px; }

/* ---------- Styled selects (roster) ---------- */
/* Native <select> (so keyboard/mobile behaviour stays intact) with the browser chrome
   replaced. The tone-* classes tint it by its current value, like the result pills. */
select.pill-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 7px 32px 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--surface-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238791a1' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 11px 7px;
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

select.pill-select:hover { border-color: var(--crimson); }
select.pill-select option { background: var(--surface-2); color: var(--text); font-weight: 500; }

select.pill-select.tone-captain {
  background-color: color-mix(in srgb, var(--crimson) 26%, var(--surface-2));
  border-color: color-mix(in srgb, var(--crimson) 60%, var(--border));
  color: var(--text);
}
select.pill-select.tone-vicecaptain { background-color: var(--amber-soft); border-color: var(--amber-border); color: var(--amber-text); }
select.pill-select.tone-regular { background-color: var(--green-soft); border-color: var(--green-border); color: var(--green-text); }
select.pill-select.tone-sub { background-color: var(--amber-soft); border-color: var(--amber-border); color: var(--amber-text); }

/* ---------- Date pickers ---------- */
/* The page-level color-scheme makes the browser draw the calendar icon and popup
   calendar to match the current theme instead of as a white system widget. */
input[type=date] {
  font: inherit;
  font-size: 0.86rem;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.12s ease;
}

input[type=date]:hover { border-color: var(--crimson); }
input[type=date]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.65; }
input[type=date]:hover::-webkit-calendar-picker-indicator { opacity: 1; }
#playersBody input[type=date] { min-width: 140px; }

/* ---------- Theme toggle ---------- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.theme-toggle:hover { background: var(--surface-2); color: var(--text); }
.theme-toggle svg { width: 18px; height: 18px; }

/* ---------- Footer / version ---------- */
.site-footer {
  max-width: 1100px;
  margin: 40px auto 24px;
  padding: 16px 16px 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 16px;
  font-size: 0.78rem;
  color: var(--muted);
}

.site-footer a { color: var(--muted); text-decoration: underline; }
.site-footer a:hover { color: var(--text); }

.sidebar-version {
  margin-top: auto;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--muted);
}

/* ---------- Player profile ---------- */
.player-link { color: var(--text); text-decoration: none; font-weight: 600; }
.player-link:hover { color: var(--crimson-light); text-decoration: underline; }

.player-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.player-header h1 { margin: 0; font-size: 1.5rem; font-weight: 800; }

.badge-shelf { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.badge { display: inline-flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 13px 6px 10px; font-size: 0.85rem; font-weight: 600; cursor: default; }
.badge-icon { font-size: 1.05rem; }
.badge-count { background: var(--crimson); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 0.75rem; font-weight: 700; }

/* Seasons table: compact enough that every column, including the awards buttons, fits a laptop screen. */
#tab-seasons .data-table th, #seasonsBody td { padding-left: 9px; padding-right: 9px; }
#seasonsBody input[type=text] { min-width: 110px; }
#seasonsBody input[type=date] { width: 138px; }
#seasonsBody td.awards-cell { white-space: normal; min-width: 150px; }
#seasonsBody td.awards-cell button { margin: 2px 4px 2px 0; }
.partner-note { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
select.pair-select:disabled { opacity: 0.45; cursor: not-allowed; }
.pair-warnings { color: var(--amber-text); }
.pair-warnings div { margin-top: 4px; }
.kpi-position { color: var(--text); font-weight: 600; margin-top: 4px; }
.kpi-position.kpi-champions { color: var(--gold-text); font-weight: 800; letter-spacing: 0.05em; }
.badge.badge-gold { border-color: var(--gold-text); color: var(--gold-text); }
.league-line { color: var(--muted); font-size: 0.9rem; margin: -6px 0 14px; }

.player-badges { display: flex; gap: 6px; flex-wrap: wrap; }

::selection { background: var(--crimson); color: #fff; }

input:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--crimson-light);
  outline-offset: 1px;
}
