:root {
  /* Wildcats logo palette */
  --brand-teal: #006070;
  --brand-teal-bright: #008a9e;
  --brand-teal-soft: #4da8b8;
  --brand-teal-dim: rgba(0, 96, 112, 0.22);
  --brand-white: #f5f8f9;
  --brand-black: #050607;

  --ink: #eef2f3;
  --muted: #8fa3a8;
  --line: #2a3538;
  --paper: #050607;
  --card: #111618;
  --card-raised: #171c1f;
  --surface-hover: #1c2326;
  --surface-subtle: #141a1c;
  --heading: #f5f8f9;
  --backdrop: rgba(0, 0, 0, 0.72);

  --accent: var(--brand-teal);
  --accent-soft: var(--brand-teal-bright);
  --accent-hover: #00a4bc;
  --good: #34d399;
  --bad: #f87171;
  --warn: #fbbf24;
  --hit: var(--brand-teal-soft);
  --budget: var(--brand-teal-bright);
  --admin: #5ec4d4;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  --radius: 12px;
  --input-bg: #0a0e10;
  --link: #5ec4d4;
  --link-hover: #8edce8;
  color-scheme: dark;
}

html[data-theme="light"] {
  --ink: #1a2224;
  --muted: #5c6f74;
  --line: #c5d3d7;
  --paper: #eef3f4;
  --card: #ffffff;
  --card-raised: #f5f8f9;
  --surface-hover: #e4ecee;
  --surface-subtle: #f0f5f6;
  --heading: #1a2224;
  --backdrop: rgba(5, 6, 7, 0.45);
  --brand-teal-dim: rgba(0, 96, 112, 0.1);
  --shadow: 0 12px 32px rgba(0, 48, 56, 0.1);
  --input-bg: #ffffff;
  --link: #006070;
  --link-hover: #008a9e;
  --good: #059669;
  --bad: #dc2626;
  --warn: #d97706;
  color-scheme: light;
}

html[data-theme="light"] .auth-wrap {
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(0, 138, 158, 0.18), transparent),
    linear-gradient(165deg, #eef3f4 0%, #f8fbfb 50%, #e8f0f2 100%);
}

html[data-theme="light"] .msg.err {
  color: #b91c1c;
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.25);
}

html[data-theme="light"] .msg.ok {
  color: #047857;
  background: rgba(5, 150, 105, 0.08);
  border-color: rgba(5, 150, 105, 0.25);
}

html[data-theme="light"] .panel {
  box-shadow: 0 1px 2px rgba(0, 48, 56, 0.06);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.45;
}
a { color: var(--link); }
a:hover { color: var(--link-hover); }

.site-header {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  background: var(--card);
  border-bottom: 3px solid var(--brand-teal);
  box-shadow: 0 1px 0 rgba(0, 96, 112, 0.25);
}
.site-header .brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.site-header .brand-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex-shrink: 0;
}
.site-header .brand h1 { margin: 0; font-size: 22px; letter-spacing: -0.02em; color: var(--heading); }
.site-header .brand p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.auth-card .brand-logo {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: contain;
  margin: 0 auto 14px;
}
.site-header .actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}
.site-header .actions form { margin: 0; }

.shell { max-width: 980px; margin: 0 auto; padding: 22px 20px 48px; }
.shell-wide { max-width: 1100px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 650;
  border: 1px solid var(--brand-teal);
  border-radius: 8px;
  padding: 8px 14px;
  background: var(--brand-teal);
  color: var(--brand-white);
  cursor: pointer;
  text-decoration: none;
}
.btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--brand-white);
}
.btn.secondary {
  background: var(--card-raised);
  color: var(--ink);
  border-color: var(--line);
}
.btn.secondary:hover {
  background: var(--surface-hover);
  color: var(--ink);
  border-color: var(--brand-teal-soft);
}
.btn.danger {
  background: rgba(248, 113, 113, 0.08);
  color: var(--bad);
  border-color: rgba(248, 113, 113, 0.35);
}
.btn.danger:hover {
  background: rgba(248, 113, 113, 0.16);
  color: #fca5a5;
}
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

input, select, textarea {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: var(--input-bg);
  color: var(--ink);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand-teal-soft);
  outline-offset: 0;
  border-color: var(--brand-teal-soft);
}
label.field-label {
  display: block;
  font-weight: 650;
  font-size: 12px;
  margin: 10px 0 5px;
  color: var(--heading);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.module-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.module-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--brand-teal);
  color: inherit;
}
.module-card h2 { margin: 0 0 8px; font-size: 18px; color: var(--heading); }
.module-card p { margin: 0; color: var(--muted); font-size: 13px; }
.module-card.tryouts { border-top: 4px solid var(--brand-teal-soft); }
.module-card.budget { border-top: 4px solid var(--brand-teal-bright); }
.module-card.admin { border-top: 4px solid var(--admin); }
.module-card.is-locked {
  opacity: 0.62;
  cursor: not-allowed;
  filter: grayscale(0.35);
  box-shadow: none;
}
.module-card.is-locked:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--line);
}
.module-card-lock {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.module-card-lock a { font-weight: 600; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.panel h2 { margin: 0 0 14px; font-size: 16px; color: var(--heading); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 16px;
}
.form-actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.msg {
  padding: 11px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 13px;
}
.msg.err { background: rgba(248, 113, 113, 0.12); color: #fca5a5; border: 1px solid rgba(248, 113, 113, 0.35); }
.msg.ok { background: rgba(52, 211, 153, 0.12); color: #6ee7b7; border: 1px solid rgba(52, 211, 153, 0.35); }
.msg.info { background: var(--brand-teal-dim); color: var(--brand-teal-soft); border: 1px solid rgba(0, 138, 158, 0.45); }

table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
table.data th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
}
table.data td.num, table.data th.num { text-align: right; white-space: nowrap; }

th.sortable-th {
  cursor: pointer;
  user-select: none;
}
th.sortable-th:hover {
  color: var(--brand-teal-soft, var(--link));
}
th.sort-asc::after,
th.sort-desc::after {
  font-size: 9px;
  opacity: 0.75;
}
th.sort-asc::after { content: " ▲"; }
th.sort-desc::after { content: " ▼"; }

.tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
}
.tag.admin { background: rgba(94, 196, 212, 0.18); color: var(--admin); }
.tag.treasurer { background: var(--brand-teal-dim); color: var(--brand-teal-soft); }
.tag.tryouts { background: rgba(77, 168, 184, 0.18); color: var(--brand-teal-soft); }
.tag.budget { background: rgba(0, 138, 158, 0.22); color: var(--brand-teal-bright); }
.tag.viewer { background: var(--surface-subtle); color: var(--muted); }
.tag.inactive { background: rgba(248, 113, 113, 0.15); color: var(--bad); }
.tag.warn { background: rgba(251, 191, 36, 0.15); color: var(--warn); }

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(0, 96, 112, 0.35), transparent),
    linear-gradient(165deg, #050607 0%, #0a1012 50%, #050607 100%);
}
.auth-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0 0 6px; font-size: 24px; color: var(--heading); }
.auth-card .lead { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.auth-card .foot { margin-top: 16px; font-size: 13px; color: var(--muted); text-align: center; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
}
.kpi .label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 650;
}
.kpi .value { font-size: 24px; font-weight: 700; margin-top: 6px; color: var(--heading); }
.kpi .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }

.tag.expense { background: rgba(251, 191, 36, 0.15); color: var(--warn); }
.tag.fee_revenue { background: var(--brand-teal-dim); color: var(--brand-teal-soft); }
.tag.fundraising_revenue { background: rgba(52, 211, 153, 0.15); color: var(--good); }
.tag.sponsorship_revenue { background: rgba(94, 196, 212, 0.15); color: var(--admin); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  width: min(480px, 100%);
  padding: 20px;
  box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 14px; font-size: 17px; color: var(--heading); }

.app-dialog-backdrop { z-index: 200; }
.app-dialog-message {
  margin: 0 0 16px;
  color: var(--text);
  line-height: 1.45;
  font-size: 14px;
}
.app-dialog-field-wrap { margin-bottom: 16px; }
.app-dialog-field-wrap .field-label { display: block; margin-bottom: 6px; }
.app-dialog-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.app-dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.app-dialog-actions .btn.danger {
  background: var(--bad, #dc2626);
  border-color: transparent;
  color: #fff;
}

.hidden { display: none !important; }
.readonly .hide-readonly { display: none !important; }

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -2px;
  padding: 0 2px 2px;
}
.table-wrap > table.data { min-width: 520px; }

@media (max-width: 640px) {
  body { font-size: 15px; }

  .shell,
  .shell-wide {
    padding: 14px 12px 36px;
  }

  .site-header {
    padding: 12px 14px;
    gap: 12px;
    align-items: stretch;
  }
  .site-header .brand h1 { font-size: 18px; line-height: 1.2; }
  .site-header .brand p { font-size: 12px; }
  .site-header .brand-row { gap: 10px; }
  .site-header .brand-logo { width: 44px; height: 44px; }
  .site-header .actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
  }
  .site-header .actions .field-label {
    grid-column: 1 / -1;
    margin: 0;
  }
  .site-header .actions #season-select,
  .site-header .actions .season-select {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }
  .site-header .actions .btn { min-height: 40px; }

  .panel {
    padding: 14px;
    margin-bottom: 14px;
    border-radius: 10px;
  }
  .panel h2 { font-size: 15px; margin-bottom: 12px; }

  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .kpi { padding: 12px 14px; }
  .kpi .value { font-size: 22px; }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .form-actions .btn { width: 100%; min-height: 44px; }

  .btn {
    min-height: 40px;
    padding: 10px 14px;
  }
  .btn.sm { min-height: 36px; padding: 8px 12px; }

  input,
  select,
  textarea {
    padding: 11px 12px;
    font-size: 16px;
  }

  table.data { font-size: 13px; }
  table.data th,
  table.data td {
    padding: 10px 8px;
  }

  .card-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .module-card { padding: 18px; }

  .modal {
    max-height: calc(100vh - 32px);
    overflow-y: auto;
  }
}

@media (max-width: 380px) {
  .site-header .actions {
    grid-template-columns: 1fr;
  }
  .site-header .actions .btn {
    width: 100%;
  }
}

.pw-policy-root {
  margin: 0 0 16px;
}
.pw-strength-wrap {
  margin-bottom: 10px;
}
.pw-strength-track {
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin-bottom: 6px;
}
.pw-strength-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  transition: width 0.15s ease, background 0.15s ease;
  background: var(--bad);
}
.pw-strength-bar[data-level="1"] { background: #f97316; }
.pw-strength-bar[data-level="2"] { background: var(--warn); }
.pw-strength-bar[data-level="3"] { background: var(--good); }
.pw-strength-bar[data-level="4"] { background: #059669; }
.pw-strength-label {
  font-size: 12px;
  color: var(--muted);
}
.pw-checks {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
}
.pw-check {
  position: relative;
  padding-left: 22px;
  margin: 6px 0;
  color: var(--muted);
}
.pw-check::before {
  content: "○";
  position: absolute;
  left: 0;
  color: var(--muted);
}
.pw-check.met {
  color: var(--ink);
}
.pw-check.met::before {
  content: "✓";
  color: var(--good);
  font-weight: 700;
}

/* Light / dark theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
  margin-right: 4px;
}
.team-bar-actions .theme-toggle,
.site-header .actions .theme-toggle {
  flex-shrink: 0;
}
.theme-toggle-icon {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--muted);
}
html[data-theme="light"] .theme-toggle-icon-sun,
html[data-theme="dark"] .theme-toggle-icon-moon {
  color: var(--heading);
}
.theme-toggle-track {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.theme-toggle input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}
.theme-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brand-teal-bright);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s ease;
  pointer-events: none;
}
.theme-toggle input:checked ~ .theme-toggle-thumb {
  transform: translateX(20px);
}
html[data-theme="light"] .theme-toggle-track {
  background: var(--card-raised);
}
.auth-theme-row {
  display: flex;
  justify-content: flex-end;
  margin: -8px 0 12px;
}
.print-bar .theme-toggle,
.tryouts-form-toolbar .theme-toggle {
  margin-left: auto;
}

html[data-theme="light"] .team-select,
html[data-theme="light"] .tryouts-chrome .team-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%231a2224' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
}

html[data-theme="light"] .tryouts-app thead th {
  background: var(--surface-subtle);
  color: var(--heading);
}

html[data-theme="light"] .tryouts-app thead .g-id {
  background: var(--line);
  color: var(--heading);
}

@media print {
  .theme-toggle,
  .auth-theme-row {
    display: none !important;
  }
}

/* Shared new-season modal (Budget + Tryouts) */
.tryouts-season-modal {
  width: min(540px, 94vw);
  max-height: min(90vh, 720px);
  overflow: auto;
  padding: 0;
  border-radius: 12px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
}

.tryouts-season-modal-head {
  padding: 22px 24px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}

.tryouts-season-modal-head h3 {
  margin: 0 0 6px;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.tryouts-season-modal-lead {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.tryouts-season-modal-form {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tryouts-season-modal-years {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 480px) {
  .tryouts-season-modal-years {
    grid-template-columns: 1fr;
  }
}

.tryouts-season-modal-field .field-label {
  margin: 0 0 6px;
}

.tryouts-season-modal-field input,
.tryouts-season-modal-field select {
  width: 100%;
  box-sizing: border-box;
}

.tryouts-season-copy-panel {
  margin: 0;
  padding: 0;
  border: none;
  min-inline-size: 0;
}

.tryouts-season-copy-panel[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

.tryouts-season-copy-panel legend {
  padding: 0;
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.tryouts-season-copy-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.tryouts-season-copy-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-subtle, rgba(255, 255, 255, 0.03));
}

.tryouts-season-copy-list li {
  border-bottom: 1px solid var(--line);
}

.tryouts-season-copy-list li:last-child {
  border-bottom: none;
}

.tryouts-season-copy-highlight {
  background: rgba(77, 168, 184, 0.08);
}

.tryouts-season-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  margin: 0;
  width: 100%;
  box-sizing: border-box;
}

.tryouts-season-check:hover {
  background: rgba(255, 255, 255, 0.03);
}

.tryouts-season-copy-highlight .tryouts-season-check:hover {
  background: rgba(77, 168, 184, 0.12);
}

.tryouts-season-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin: 2px 0 0;
  padding: 0;
  flex-shrink: 0;
  accent-color: var(--brand-teal-bright, #4da8b8);
  cursor: pointer;
}

.tryouts-season-check-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  line-height: 1.35;
  min-width: 0;
}

.tryouts-season-check-text strong {
  font-weight: 650;
  color: var(--heading);
}

.tryouts-season-check-text .muted-inline {
  font-size: 12px;
}

.tryouts-season-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}

.tryouts-season-modal-actions .btn.primary {
  min-width: 140px;
}
