:root {
  --blue: #00205C;
  --blue-2: #0a326e;
  --blue-3: #163f7a;
  --red: #CE0E2D;
  --red-2: #a80b24;
  --gold: #FFC629;
  --gold-soft: #fff3c4;
  --ink: #0f1a2e;
  --muted: #5a6578;
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #e2e6ee;
  --surface: #eef1f6;
  --in: #0a6b3c;
  --out: #CE0E2D;
  --maybe: #9a6b00;
  --wait: #5a6578;
  --radius: 12px;
  --nav-h: 56px;
  --shadow: 0 1px 2px rgba(0, 32, 92, 0.04), 0 4px 12px rgba(0, 32, 92, 0.06);
  font-family: "Segoe UI", "Avenir Next", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: clip; }
body {
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}
body.guest { background: var(--blue); }

.shell {
  width: min(480px, 100%);
  margin: 0 auto;
  position: relative;
  background: transparent;
}
body.guest .shell {
  background: transparent;
  min-height: 100vh;
}

main {
  padding: 12px 14px calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
}
body.guest main { padding: 12px 14px 28px; }

/* One full-width bar. The title sits in normal flow underneath it. */
.top {
  background: var(--blue);
  color: white;
  width: 100%;
  margin: 0;
  position: relative;
  z-index: 20;
}
.top-inner {
  width: min(480px, 100%);
  margin: 0 auto;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
}
.top-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.top-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex: 0 0 auto;
  background: white;
  border-radius: 8px;
  padding: 2px;
}
.top-text { min-width: 0; }
.eyebrow {
  margin: 0;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
}
.eyebrow.light, .hero .eyebrow { color: var(--gold); }
.top-title {
  margin: 1px 0 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex: 0 0 auto;
}
.report-link {
  color: rgba(255, 255, 255, 0.88);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.role-chip {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 198, 41, 0.45);
  color: white;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 auto;
}
.report-shot {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 8px 0;
  border-radius: 8px;
  border: 1px solid var(--line);
}

h1 {
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0 0 6px;
}
h2 {
  font-size: 16px;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
p { line-height: 1.4; margin: 0 0 8px; }
.muted, .meta { color: var(--muted); }
.meta { margin: 2px 0; font-size: 14px; }
.when { font-weight: 700; margin: 0 0 2px; font-size: 15px; }
.kicker {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  font-weight: 800;
  color: var(--blue);
}
.section-title {
  margin: 16px 0 8px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 800;
}
.lede { color: rgba(255, 255, 255, 0.88); font-size: 15px; margin: 0; }

.hero {
  color: white;
  padding: calc(20px + env(safe-area-inset-top)) 2px 8px;
}
.hero h1 { font-size: 34px; margin-bottom: 6px; }
.hero-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  background: white;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 12px;
  display: block;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 8px 0;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.feature {
  border: 1.5px solid var(--blue);
  border-top: 3px solid var(--gold);
}
.login-card h2 { margin-bottom: 8px; }
.note { white-space: pre-wrap; }
.link-card {
  display: flex;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  color: inherit;
  min-height: 48px;
  padding: 10px 12px;
}
.link-card small { display: block; color: var(--muted); margin-top: 1px; font-size: 13px; }
.page-head, .row-actions, .person {
  display: flex;
  gap: 8px;
  align-items: center;
}
.page-head { justify-content: space-between; margin-bottom: 4px; }
.page-head h1 { margin: 0; }
.row-actions { flex-wrap: wrap; margin: 8px 0; }
.hero-person { align-items: flex-start; margin-bottom: 8px; }
.hero-person h1 { font-size: 24px; }

.jersey {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 10px;
  background: var(--blue);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
}
.jersey.lg { width: 56px; height: 56px; flex-basis: 56px; font-size: 22px; border-radius: 14px; }
.jersey.gold { background: var(--gold); color: var(--blue); }

.btn, button, .btn-ghost {
  appearance: none;
  border: 0;
  background: var(--blue);
  color: white;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
}
.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
}
.btn-block { width: 100%; }
.btn-ghost {
  background: white;
  color: var(--blue);
  border: 1.5px solid var(--blue);
}
.btn-accent { background: var(--red); }
.btn-danger { background: var(--red); margin-top: 6px; }
.btn-gold {
  background: var(--gold);
  color: var(--blue);
}
a { color: var(--blue-2); }

label, legend {
  display: block;
  font-weight: 700;
  margin: 10px 0 4px;
  font-size: 14px;
}
input, select, textarea {
  width: 100%;
  min-height: 44px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  background: white;
  color: var(--ink);
}
textarea { min-height: 84px; resize: vertical; }
.invite-check { width: 22px; min-height: 22px; margin: 2px 0 0; flex: 0 0 auto; }
.invite-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.invite-row:last-child { border-bottom: 0; }
fieldset { border: 0; margin: 0; padding: 0; }
.stack > :first-child { margin-top: 0; }

.form-error {
  background: #fde8eb;
  color: #7a1020;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 6px 0;
}
.form-error p { margin: 2px 0; }
.flashes p {
  background: var(--gold-soft);
  color: var(--blue);
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
  margin: 0 0 8px;
  border: 1px solid #f0d98a;
}

/* Big availability counts */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 8px 0 4px;
}
.stat {
  background: var(--surface);
  border-radius: 10px;
  padding: 10px 6px;
  text-align: center;
  border: 1px solid var(--line);
}
.stat strong {
  display: block;
  font-size: 22px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.stat span {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}
.stat.in { background: #e8f6ee; border-color: #c5e6d1; }
.stat.in strong { color: var(--in); }
.stat.maybe { background: #fff8e6; border-color: #f0d98a; }
.stat.maybe strong { color: var(--maybe); }
.stat.out { background: #fde8eb; border-color: #f0c0c8; }
.stat.out strong { color: var(--out); }
.stat.wait { background: var(--surface); }
.stat.wait strong { color: var(--wait); }

.counts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  text-transform: none;
  background: var(--surface);
  color: var(--ink);
}
.pill.in { background: #e8f6ee; color: var(--in); }
.pill.out { background: #fde8eb; color: var(--out); }
.pill.maybe { background: #fff8e6; color: var(--maybe); }
.pill.wait { background: #eef1f6; color: var(--wait); }

.seg { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.seg label {
  margin: 0;
  min-height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1.5px solid var(--line);
  background: white;
  font-size: 14px;
}
.seg input { width: 16px; min-height: 16px; }
.seg-in:has(input:checked) { background: #e8f6ee; border-color: var(--in); }
.seg-maybe:has(input:checked) { background: #fff8e6; border-color: var(--maybe); }
.seg-out:has(input:checked) { background: #fde8eb; border-color: var(--out); }

.demo-list { display: grid; gap: 6px; }
.demo {
  width: 100%;
  background: var(--surface);
  color: var(--ink);
  display: grid;
  justify-items: start;
  text-align: left;
  padding: 10px 12px;
  min-height: 56px;
  border: 1px solid var(--line);
}
.demo:hover, .demo:focus { border-color: var(--gold); background: var(--gold-soft); }
.demo span { color: var(--muted); font-weight: 600; font-size: 13px; }

.plain { list-style: none; padding: 0; margin: 8px 0 0; }
.plain li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
}

/* Compact list rows (squad + availability) */
.list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0 0 10px;
  box-shadow: var(--shadow);
}
.list-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 800;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}
.list-group-head .pill { text-transform: none; letter-spacing: 0; }
.list-group + .list-group { margin-top: 10px; }
.list-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border-bottom: 1px solid var(--line);
  min-height: 44px;
}
.list-row:last-child { border-bottom: 0; }
.list-row-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.list-row-body {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  min-width: 0;
}
.list-row-text {
  flex: 1;
  min-width: 0;
}
.row-number {
  flex: 0 0 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}
.list-row-text strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-row-text small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-row .pill { flex: 0 0 auto; }
.list-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--red);
  min-height: 40px;
  min-width: 40px;
  padding: 0;
  margin: 0 6px 0 0;
  border-radius: 8px;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover, .icon-btn:focus { background: #fde8eb; }
.row-remove { margin: 0; display: flex; }

.av-form {
  padding: 0 12px 12px;
  border-top: 1px dashed var(--line);
  margin-top: 0;
}
.av-inline {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin: 0 0 10px;
  box-shadow: var(--shadow);
}
.av-inline h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.fixture-row {
  display: block;
  text-decoration: none;
  color: inherit;
}
.fixture-row .card { margin: 6px 0; padding: 12px; }
.fixture-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

details summary {
  min-height: 40px;
  display: flex;
  align-items: center;
  font-weight: 800;
  cursor: pointer;
}
pre {
  white-space: pre-wrap;
  font-family: ui-monospace, monospace;
  font-size: 13px;
  background: var(--bg);
  padding: 10px;
  border-radius: 8px;
}

.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(480px, 100%);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: white;
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 5;
  box-shadow: 0 -4px 16px rgba(0, 32, 92, 0.05);
}
.tabbar a {
  flex: 1;
  min-height: 44px;
  text-decoration: none;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-size: 11px;
  font-weight: 800;
}
.tabbar a.active { color: var(--blue); }
.tabbar a.active svg { color: var(--red); }
.tabbar svg { width: 20px; height: 20px; fill: currentColor; }

.inline-form select { margin-bottom: 6px; }

/* Match detail: compact touch-friendly availability controls. */
.match-detail-page main { padding-top: 6px; }
.match-detail-page .kicker { margin-bottom: 2px; }
.match-detail-page h1 { margin-bottom: 2px; }
.match-detail-page .when { margin-bottom: 1px; }
.match-detail-page .meta { margin: 1px 0 4px; }
.match-detail-page .note { margin: 5px 0; padding: 7px 10px; }
.match-detail-page .row-actions { gap: 4px; margin: 5px 0; }
.match-detail-page .availability-summary { margin: 5px 0; padding: 7px 9px; }
.match-detail-page .availability-summary h2 { margin-bottom: 1px; }
.match-detail-page .stat-row { gap: 4px; margin: 4px 0 2px; }
.match-detail-page .stat { padding: 6px 3px; border-radius: 8px; }
.match-detail-page .stat strong { font-size: 19px; }
.match-detail-page .stat span { margin-top: 2px; font-size: 9px; letter-spacing: 0; }
.match-detail-page .squad-count { margin: 2px 0 0 !important; font-size: 12px !important; }
.match-detail-page .section-title { margin: 8px 0 4px; }
.match-detail-page .list { margin-bottom: 5px; overflow: visible; }
.match-detail-page .list-group + .list-group { margin-top: 5px; }
.match-detail-page .list-group-head { padding: 5px 8px; }
.match-detail-page .list-row { min-height: 38px; gap: 4px; }
.match-detail-page .list-row-body { gap: 6px; padding: 4px 8px; }
.match-detail-page .row-number { flex-basis: 18px; font-size: 12px; }
.match-detail-page .list-row-text strong { font-size: 13px; }
.match-detail-page .list-row .pill { min-height: 22px; padding: 1px 6px; font-size: 11px; }
.match-detail-page .availability-menu { position: relative; flex: 0 0 auto; margin-right: 2px; }
.match-detail-page .availability-menu > summary { list-style: none; min-width: 30px; min-height: 30px; margin: 0; color: var(--blue); font-size: 20px; }
.match-detail-page .availability-menu > summary::-webkit-details-marker { display: none; }
.match-detail-page .availability-menu > summary:hover,
.match-detail-page .availability-menu > summary:focus { background: var(--surface); }
.match-detail-page .availability-options {
  position: absolute;
  z-index: 10;
  top: calc(100% - 2px);
  right: 0;
  min-width: 132px;
  padding: 4px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.match-detail-page .availability-choice-form { margin: 0; }
.match-detail-page .availability-choice {
  width: 100%;
  min-height: 30px;
  padding: 5px 8px;
  border-radius: 6px;
  justify-content: flex-start;
  background: white;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}
.match-detail-page .availability-choice:hover,
.match-detail-page .availability-choice:focus { background: var(--surface); }
.match-detail-page > form:last-child { margin-top: 5px; }
