/* Scoreboard — design notes
   Subject: a peer-to-peer team fundraiser (youth sports / school groups). The organizer checking
   in on their campaign is the audience. Hero borrows a stadium scoreboard + football field yard
   markers for the progress read — the one device that only makes sense for a fundraising "drive".
   Two deliberate registers: stadium energy above the fold (Anton display, night/turf/amber), a
   calm ledger register for Front Office (payouts) below — treasurer accounting, not hype.
*/

@font-face {
  font-family: 'Anton';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/anton.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/inter.woff2') format('woff2');
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/outfit.woff2') format('woff2');
}
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/rubik.woff2') format('woff2');
}

:root {
  --night: #0e2a1f;
  --night-deep: #081a13;
  --turf: #2f8f4e;
  --turf-bright: #3fa860;
  --turf-deep: #1f6b3a;
  --turf-stripe: #1b5f35;
  --chalk: #f5f7f1;
  --paper: #fafaf7;
  --surface: #ffffff;
  --ink: #12241c;
  --muted: #56655b;
  --faint: #8b968d;
  --border: #dde3d6;
  --border-soft: #e7ebe2;
  --amber: #ffb020;
  --amber-deep: #c97f00;
  --flag: #c8492f;
  --flag-bg: #fbe9e4;
  --turf-bg: #e6f3ea;

  --font-display: 'Anton', 'Arial Narrow', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  color-scheme: light;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--chalk);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}
img { max-width: 100%; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--turf-deep); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---- topbar --------------------------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 32px);
  padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; flex-shrink: 0; }
.brand__mark {
  width: 11px; height: 11px; border-radius: 2px;
  background: linear-gradient(135deg, var(--turf) 0%, var(--turf-deep) 100%);
  align-self: center;
}
.brand__name { font-family: var(--font-display); font-size: 19px; color: var(--ink); letter-spacing: 0.01em; }
.brand__product { font-size: 13px; color: var(--muted); }
.switcher { display: flex; gap: 8px; overflow-x: auto; flex: 1; min-width: 0; padding: 2px; scrollbar-width: thin; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font: 500 13px/1 var(--font-body); color: var(--ink);
  white-space: nowrap; cursor: pointer; flex-shrink: 0;
  transition: border-color 120ms ease, background 120ms ease;
}
.chip:hover { background: var(--chalk); }
.chip[aria-current="true"] {
  border-color: var(--chip-color, var(--turf));
  background: color-mix(in srgb, var(--chip-color, var(--turf)) 8%, var(--surface));
  font-weight: 600;
}
.chip__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--chip-color, var(--turf)); flex-shrink: 0; }

.modetoggle { display: flex; gap: 2px; background: var(--border-soft); border-radius: 9px; padding: 3px; flex-shrink: 0; }
.modetoggle button {
  border: none; background: transparent; font: 600 13px/1 var(--font-body); color: var(--muted);
  padding: 8px 14px; border-radius: 7px; cursor: pointer;
}
.modetoggle button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(18, 36, 28, 0.08); }

.loading, .error { padding: 64px clamp(16px, 4vw, 40px); color: var(--muted); }

/* ---- hero: the scoreboard -------------------------------------------------------------------- */
.hero {
  position: relative;
  background: linear-gradient(185deg, var(--night) 0%, var(--night-deep) 100%);
  color: #eaf2ec;
  padding: clamp(28px, 5vw, 48px) clamp(16px, 4vw, 40px) clamp(32px, 5vw, 52px);
  overflow: hidden;
  border-left: 5px solid var(--chip-color, var(--turf));
}
.hero::before, .hero::after {
  content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 176, 32, 0.16) 0%, transparent 70%);
  pointer-events: none;
}
.hero::before { top: -220px; right: -80px; }
.hero::after { bottom: -260px; left: 10%; background: radial-gradient(circle, rgba(63, 168, 96, 0.16) 0%, transparent 70%); }
.hero__inner { position: relative; max-width: 1040px; margin: 0 auto; }

.hero__top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 20px; flex-wrap: wrap; margin-bottom: clamp(22px, 4vw, 34px);
}
.hero__team-name {
  font-family: var(--font-display); font-size: clamp(26px, 4vw, 42px); line-height: 1.03;
  margin: 0; color: #fff; letter-spacing: 0.003em;
}
.hero__meta { margin: 6px 0 0; font-size: 14.5px; color: rgba(234, 242, 236, 0.68); }
.hero__meta strong { color: rgba(234, 242, 236, 0.92); font-weight: 600; }

.clock {
  text-align: center; padding: 10px 18px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.14);
  flex-shrink: 0;
}
.clock__num { font-family: var(--font-display); font-size: 30px; color: var(--amber); line-height: 1; }
.clock__label { font-size: 12px; color: rgba(234, 242, 236, 0.68); margin-top: 3px; }
.clock--status .clock__num { font-size: 16px; font-family: var(--font-body); font-weight: 700; letter-spacing: 0.01em; }

.hero__score { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 46px; }
.hero__raised { font-family: var(--font-display); font-size: clamp(46px, 8.5vw, 92px); color: var(--amber); line-height: 0.92; }
.hero__goal { font-size: 16px; color: rgba(234, 242, 236, 0.78); }
.hero__goal b { color: #fff; font-weight: 700; }

.field { position: relative; padding-bottom: 22px; }
.field__track {
  position: relative; height: 32px; border-radius: 4px; overflow: hidden;
  background: repeating-linear-gradient(90deg, var(--turf-deep) 0 44px, var(--turf-stripe) 44px 88px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.field__fill {
  position: absolute; inset: 0; height: 100%;
  background: linear-gradient(90deg, var(--turf-bright) 0%, var(--turf) 100%);
  transition: width 500ms cubic-bezier(0.22, 1, 0.36, 1);
}
.field__tick {
  position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255, 255, 255, 0.28);
}
.field__marker {
  position: absolute; top: -30px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center;
  transition: left 500ms cubic-bezier(0.22, 1, 0.36, 1);
}
.field__marker-tag {
  font: 700 13px/1 var(--font-body); color: var(--night); background: var(--amber);
  padding: 3px 8px; border-radius: 5px; white-space: nowrap;
}
.field__marker-pin { width: 2px; height: 8px; background: var(--amber); }
.field__ends {
  display: flex; justify-content: space-between; margin-top: 8px;
  font-size: 11.5px; color: rgba(234, 242, 236, 0.55); text-transform: none;
}

/* ---- stats row -------------------------------------------------------------------------------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  max-width: 1040px; margin: 0 auto; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.stat { padding: 20px clamp(14px, 3vw, 28px); border-left: 1px solid var(--border-soft); }
.stat:first-child { border-left: none; }
.stat__num { font-family: var(--font-display); font-size: clamp(22px, 3vw, 30px); line-height: 1; }
.stat__label { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.stat__num--turf { color: var(--turf-deep); }
.stat__num--flag { color: var(--flag); }

/* ---- content ------------------------------------------------------------------------------- */
.content { max-width: 1040px; margin: 0 auto; padding: clamp(36px, 6vw, 56px) clamp(16px, 4vw, 40px) 20px; }
.section { margin-bottom: clamp(40px, 6vw, 60px); }
.section__head { margin-bottom: 18px; }
.section__title { font-family: var(--font-display); font-size: clamp(21px, 2.6vw, 26px); margin: 0 0 4px; color: var(--ink); }
.section__sub { font-size: 13.5px; color: var(--muted); margin: 0; }

.columns { display: grid; grid-template-columns: 1.35fr 1fr; gap: clamp(24px, 4vw, 44px); align-items: start; }
@media (max-width: 760px) { .columns { grid-template-columns: 1fr; } }

/* roster ----------------------------------------------------------------------------------------*/
.roster { border-top: 1px solid var(--border-soft); }
.roster__row {
  display: grid; grid-template-columns: 30px 1.1fr 1fr auto; align-items: center;
  gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--border-soft);
}
.roster__rank {
  font-family: var(--font-display); font-size: 14px; color: var(--surface);
  background: var(--chip-color, var(--turf-deep)); width: 24px; height: 24px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.roster__who { min-width: 0; }
.roster__name { font-weight: 600; font-size: 14.5px; }
.roster__role { font-size: 12.5px; color: var(--muted); }
.roster__bar-track { height: 6px; border-radius: 3px; background: var(--border-soft); overflow: hidden; }
.roster__bar-fill { height: 100%; background: var(--chip-color, var(--turf)); border-radius: 3px; }
.roster__amount { text-align: right; font-weight: 700; font-size: 14.5px; white-space: nowrap; }
.roster__donors { text-align: right; font-size: 12px; color: var(--muted); display: block; font-weight: 400; }

/* recent activity ---------------------------------------------------------------------------- */
.activity { border-top: 1px solid var(--border-soft); }
.activity__row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--border-soft); font-size: 14px;
}
.activity__who { font-weight: 600; }
.activity__tag {
  font-size: 11.5px; color: var(--turf-deep); background: var(--turf-bg);
  padding: 1px 7px; border-radius: 999px; margin-left: 7px; font-weight: 600; vertical-align: 1px;
}
.activity__date { color: var(--faint); font-size: 12.5px; display: block; margin-top: 1px; }
.activity__amount { font-weight: 700; white-space: nowrap; }

/* league / benchmark --------------------------------------------------------------------------- */
.league { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: clamp(20px, 4vw, 30px); }
.league__headline { font-family: var(--font-display); font-size: clamp(24px, 3.4vw, 32px); margin: 0 0 4px; line-height: 1.15; }
.league__headline b { color: var(--turf-deep); }
.league__sub { font-size: 13.5px; color: var(--muted); margin: 0 0 22px; }
.deciles { position: relative; height: 10px; border-radius: 5px; background: var(--border-soft); margin-bottom: 8px; }
.deciles__seg { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--surface); }
.deciles__you {
  position: absolute; top: -7px; width: 3px; height: 24px; border-radius: 2px;
  background: var(--ink); transform: translateX(-50%);
}
.deciles__you::after {
  content: attr(data-label); position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  font: 700 11px/1 var(--font-body); white-space: nowrap; color: var(--ink);
}
.deciles__labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); }

/* front office — calm ledger register, deliberately different from the sections above ---------- */
.frontoffice { background: var(--paper); border: 1px solid var(--border); border-radius: 10px; padding: clamp(20px, 4vw, 30px); }
.frontoffice__head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px; margin-bottom: 18px; }
.frontoffice__title { font-family: var(--font-body); font-weight: 700; font-size: 17px; margin: 0 0 3px; }
.frontoffice__sub { font-size: 13px; color: var(--muted); margin: 0; }
.frontoffice__totals { display: flex; gap: 24px; text-align: right; }
.frontoffice__totals div span { display: block; font-size: 11.5px; color: var(--muted); }
.frontoffice__totals div b { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }

table.ledger { width: 100%; border-collapse: collapse; font-size: 14px; }
table.ledger th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted);
  padding: 0 10px 8px; border-bottom: 1px solid var(--border);
}
table.ledger th.num, table.ledger td.num { text-align: right; }
table.ledger td { padding: 11px 10px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.ledger tr:last-child td { border-bottom: none; }
.ledger__desc { color: var(--muted); font-size: 12.5px; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill--paid { background: var(--turf-bg); color: var(--turf-deep); }
.pill--processing { background: #fdf1dc; color: var(--amber-deep); }
.pill--scheduled { background: var(--border-soft); color: var(--muted); }

/* ============================================================================================
   Sales Arena — Rally's own MDM leaderboard. A deliberately different persona and register from
   Campaigns above: internal, competitive, KPI-dense. Different palette (blue/violet/gold vs.
   night/turf/amber), different type (Outfit/Rubik vs. Anton/Inter), light throughout — no stadium
   night panel. Namespaced under .sales so the two views never bleed into each other.
   ============================================================================================ */
.sales {
  --sap: #2563eb; --sap-deep: #1d4ed8; --sav: #7c3aed; --saa: #f59e0b; --saa-deep: #b45309;
  --sa-bg: #f8fafc; --sa-surface: #ffffff; --sa-text: #1e293b; --sa-muted: #64748b;
  --sa-border: #e2e8f0; --sa-gold: #c9a227; --sa-silver: #94a3b8; --sa-bronze: #b45309;
  --sa-up: #16a34a; --sa-down: #dc2626;
  font-family: 'Rubik', var(--font-body);
  background: var(--sa-bg);
}
.sales h1, .sales h2, .sales .sa-num { font-family: 'Outfit', var(--font-display); }

.sa-hero {
  display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(20px, 4vw, 40px); align-items: center;
  max-width: 1040px; margin: 0 auto; padding: clamp(32px, 5vw, 48px) clamp(16px, 4vw, 40px) clamp(24px, 4vw, 36px);
  border-bottom: 1px solid var(--sa-border);
}
.sa-hero__label { font-size: 13px; color: var(--sa-muted); font-weight: 500; margin-bottom: 6px; }
.sa-hero__num { font-size: clamp(38px, 6vw, 60px); font-weight: 700; color: var(--sap-deep); line-height: 1; }
.sa-hero__sub { margin-top: 10px; font-size: 14.5px; color: var(--sa-muted); }
.sa-hero__sub b { color: var(--sa-text); font-weight: 600; }
.sa-hero__sub .sa-pct { color: var(--saa-deep); font-weight: 700; }
.sa-ring-wrap { display: flex; align-items: center; justify-content: center; gap: 22px; }
.sa-ring text { font-family: 'Outfit', sans-serif; font-weight: 700; fill: var(--sa-text); }
.sa-spark { display: block; }

.sa-content { max-width: 1040px; margin: 0 auto; padding: clamp(28px, 5vw, 44px) clamp(16px, 4vw, 40px) 20px; }
.sa-section { margin-bottom: clamp(36px, 5vw, 52px); }
.sa-section__head { margin-bottom: 16px; }
.sa-section__head h2 { font-size: clamp(19px, 2.4vw, 23px); font-weight: 700; margin: 0 0 3px; color: var(--sa-text); }
.sa-section__head p { font-size: 13px; color: var(--sa-muted); margin: 0; }

.sa-board { border-top: 1px solid var(--sa-border); }
.sa-row {
  display: grid; grid-template-columns: 34px 1.2fr 1fr auto auto 104px; align-items: center;
  gap: 14px; padding: 10px 8px; border-bottom: 1px solid var(--sa-border); border-radius: 6px;
}
.sa-row--medal { background: #fffbeb; }
.sa-row__rank {
  width: 26px; height: 26px; border-radius: 50%; background: var(--sa-border); color: var(--sa-text);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12.5px;
}
.sa-row__rank--1 { background: var(--sa-gold); color: #fff; }
.sa-row__rank--2 { background: var(--sa-silver); color: #fff; }
.sa-row__rank--3 { background: var(--sa-bronze); color: #fff; }
.sa-row__name { font-weight: 600; font-size: 14.5px; color: var(--sa-text); }
.sa-row__region { font-size: 12px; color: var(--sa-muted); }
.sa-row__quota-track { height: 7px; border-radius: 4px; background: var(--sa-border); overflow: hidden; }
.sa-row__quota-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--sap) 0%, var(--sav) 100%); }
.sa-row__quota-fill.is-over { background: linear-gradient(90deg, var(--saa) 0%, var(--saa-deep) 100%); }
.sa-row__stats { text-align: right; white-space: nowrap; }
.sa-row__pct { font-weight: 700; font-size: 14px; color: var(--sa-text); }
.sa-row__orgs { display: block; font-size: 11.5px; color: var(--sa-muted); }
.sa-trend { display: flex; align-items: center; gap: 6px; justify-content: flex-end; min-width: 74px; }
.sa-trend__arrow { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; }
.sa-trend--up .sa-trend__arrow { border-bottom: 7px solid var(--sa-up); }
.sa-trend--down .sa-trend__arrow { border-top: 7px solid var(--sa-down); }
.sa-trend--flat .sa-trend__arrow { border: none; width: 8px; height: 2px; background: var(--sa-muted); }
.sa-streak { font-size: 11px; color: var(--saa-deep); background: #fef3c7; padding: 2px 7px; border-radius: 999px; font-weight: 600; white-space: nowrap; }

.sa-regions { border-top: 1px solid var(--sa-border); }
.sa-region-row { padding: 12px 0; border-bottom: 1px solid var(--sa-border); }
.sa-region-row__head { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 7px; }
.sa-region-row__name { font-weight: 600; color: var(--sa-text); }
.sa-region-row__rdm { color: var(--sa-muted); }
.sa-region-row__value { font-weight: 700; color: var(--sa-text); font-variant-numeric: tabular-nums; }
.sa-region-row__track { height: 10px; border-radius: 5px; background: var(--sa-border); overflow: hidden; }
.sa-region-row__fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--sap) 0%, var(--sav) 100%); }

.sa-spotlight {
  background: linear-gradient(160deg, #eef2ff 0%, #f8fafc 60%); border: 1px solid var(--sa-border);
  border-radius: 12px; padding: 22px 24px; display: flex; align-items: center; gap: 18px;
}
.sa-spotlight__avatar {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--sap) 0%, var(--sav) 100%); color: #fff;
  display: flex; align-items: center; justify-content: center; font-family: 'Outfit', sans-serif;
  font-weight: 700; font-size: 18px;
}
.sa-spotlight__name { font-weight: 700; font-size: 16px; color: var(--sa-text); }
.sa-spotlight__line { font-size: 13.5px; color: var(--sa-muted); margin-top: 2px; }

@media (max-width: 700px) {
  .sa-hero { grid-template-columns: 1fr; }
  .sa-row { grid-template-columns: 26px 1fr auto; }
  .sa-row__quota-track, .sa-trend, .sa-streak { display: none; }
}

/* footer ----------------------------------------------------------------------------------------*/
.foot { max-width: 1040px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 48px; }
.foot p { font-size: 12.5px; color: var(--faint); line-height: 1.6; max-width: 62ch; }

/* ---- responsive ---------------------------------------------------------------------------- */
@media (max-width: 620px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-left: 1px solid var(--border-soft); }
  .stat:nth-child(odd) { border-left: none; }
  .roster__row { grid-template-columns: 26px 1fr auto; }
  .roster__bar-track { display: none; }
  .hero__top { flex-direction: column; }
}
