/* ==========================================================================
   KatumbaPay design system
   --------------------------------------------------------------------------
   Tokens first, then primitives, then components. Spacing follows a 4px grid;
   type follows a 1.25 (major third) scale. Every colour pair used for text has
   been checked against WCAG AA at its intended size.
   ========================================================================== */

/* --- Tokens: light ---------------------------------------------------------- */

:root {
  /* Brand */
  --ink: #0b2a21;
  --ink-soft: #14392e;
  --accent: #0e7c5b;
  --accent-strong: #0a5c44;
  --accent-bright: #14b789;
  --gold: #b07d16;

  /* Surfaces & text */
  --bg: #f5f8f6;
  --surface: #ffffff;
  --surface-sunken: #fbfdfc;
  --surface-raised: #ffffff;
  --border: #dfe8e4;
  --border-strong: #c6d5ce;
  --text: #16241f;
  --text-muted: #55665f;
  --text-inverse: #ffffff;
  --on-dark: #e9f4ef;
  --on-dark-muted: #a8c4b9;

  /* Status */
  --success: #0e7c5b;
  --success-bg: #e6f4ee;
  --warning: #8a5a00;
  --warning-bg: #fdf3e2;
  --danger: #b3123c;
  --danger-bg: #fdf0f3;
  --info: #0f5f8a;
  --info-bg: #e8f3f9;

  /* Spacing — 4px grid */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;
  --sp-9: 96px;

  /* Type scale */
  --fs-xs: 0.75rem;    /* 12 */
  --fs-sm: 0.875rem;   /* 14 */
  --fs-base: 1rem;     /* 16 */
  --fs-md: 1.25rem;    /* 20 */
  --fs-lg: 1.5625rem;  /* 25 */
  --fs-xl: 1.9375rem;  /* 31 */
  --fs-2xl: 2.4375rem; /* 39 */
  --fs-3xl: 3.0625rem; /* 49 */

  /* Shape & depth */
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(11, 42, 33, 0.06);
  --shadow: 0 1px 2px rgba(11, 42, 33, 0.05), 0 8px 24px rgba(11, 42, 33, 0.06);
  --shadow-lg: 0 2px 6px rgba(11, 42, 33, 0.06), 0 24px 56px rgba(11, 42, 33, 0.10);

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Sora", "Inter", system-ui, sans-serif;

  --focus: 0 0 0 3px rgba(14, 124, 91, 0.35);
  color-scheme: light;
}

/* --- Tokens: dark ----------------------------------------------------------- */

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1613;
    --surface: #11221d;
    --surface-sunken: #0d1c18;
    --surface-raised: #163028;
    --border: #22403a;
    --border-strong: #2f5449;
    --text: #e6f1ec;
    --text-muted: #9db3aa;
    --accent: #2fbb8c;
    --accent-strong: #46d1a1;
    --ink: #06110e;

    --success: #46d1a1;
    --success-bg: #10312a;
    --warning: #e0aa4f;
    --warning-bg: #33260f;
    --danger: #ff8095;
    --danger-bg: #3a1520;
    --info: #6fc0e8;
    --info-bg: #102a38;

    --gold: #e0aa4f;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.45), 0 24px 56px rgba(0, 0, 0, 0.55);
    --focus: 0 0 0 3px rgba(70, 209, 161, 0.4);
    color-scheme: dark;
  }
}

/* --- Reset ------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.15;
  color: var(--text);
  letter-spacing: -0.02em;
  text-wrap: balance;
}

p { text-wrap: pretty; }

img, video, iframe, svg { max-width: 100%; }
img, video { height: auto; display: block; }

a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font: inherit; color: inherit; }

code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.85em;
  background: var(--success-bg);
  color: var(--accent-strong);
  padding: 2px 6px;
  border-radius: 6px;
}

/* Visible, consistent focus for every interactive element. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Layout ------------------------------------------------------------------ */

.container { width: min(1120px, 100% - var(--sp-6)); margin-inline: auto; }
.container--narrow { width: min(880px, 100% - var(--sp-6)); }

.section { padding: var(--sp-9) 0; }
.section--tight { padding: var(--sp-7) 0; }
.section--tint { background: var(--surface); border-block: 1px solid var(--border); }
.section__title { font-size: var(--fs-xl); margin-bottom: var(--sp-6); }
.section__lead { color: var(--text-muted); max-width: 60ch; margin-top: calc(var(--sp-3) * -1); margin-bottom: var(--sp-6); }

.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: calc(var(--sp-4) * -4);
  z-index: 100;
  background: var(--accent);
  color: #fff;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: top 0.15s ease;
}
.skip-link:focus { top: var(--sp-4); text-decoration: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --- Brand -------------------------------------------------------------------- */

.brand { display: inline-flex; align-items: center; gap: var(--sp-2); }
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent-strong));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25);
  flex: none;
}
.brand__word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-md);
  color: var(--text);
  letter-spacing: -0.02em;
}
.brand__word em { font-style: normal; color: var(--accent); }

/* --- Navigation ---------------------------------------------------------------- */

.nav { padding: var(--sp-5) 0; position: relative; z-index: 20; }
.nav__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); }
.nav__links { display: flex; align-items: center; gap: var(--sp-6); font-size: var(--fs-sm); font-weight: 500; }
.nav__links a { color: var(--text); }
.nav__links a:hover { color: var(--accent-strong); }

.nav__cta {
  background: var(--accent);
  color: #fff !important;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-pill);
  font-weight: 600;
}
.nav__cta:hover { background: var(--accent-strong); text-decoration: none; }

.nav__toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: var(--sp-2);
  cursor: pointer;
  color: inherit;
  line-height: 0;
}
.nav__toggle svg { width: 22px; height: 22px; }
.nav__toggle .icon-close { display: none; }
.nav__toggle[aria-expanded="true"] .icon-open { display: none; }
.nav__toggle[aria-expanded="true"] .icon-close { display: block; }

/* Dark hero variant */
.nav--dark .brand__word { color: var(--on-dark); }
.nav--dark .nav__links a { color: var(--on-dark); }
.nav--dark .nav__links a:hover { color: #fff; }
.nav--dark .nav__cta { background: rgba(255, 255, 255, 0.14); }
.nav--dark .nav__cta:hover { background: rgba(255, 255, 255, 0.24); }
.nav--dark .nav__toggle { border-color: rgba(255, 255, 255, 0.35); color: var(--on-dark); }

.admin-user { color: var(--text-muted); font-size: var(--fs-sm); }

/* --- Hero ---------------------------------------------------------------------- */

.hero {
  background:
    radial-gradient(1100px 480px at 85% -10%, rgba(20, 183, 137, 0.26), transparent 60%),
    radial-gradient(700px 420px at -10% 110%, rgba(176, 125, 22, 0.12), transparent 55%),
    var(--ink);
  color: var(--on-dark);
  padding-bottom: var(--sp-9);
}
.hero__inner { padding-top: var(--sp-8); text-align: center; }
.hero h1 {
  color: #fff;
  font-size: clamp(var(--fs-2xl), 6vw, var(--fs-3xl));
  font-weight: 800;
  margin: var(--sp-4) 0 var(--sp-5);
}
.hero__sub {
  max-width: 62ch;
  margin: 0 auto var(--sp-6);
  font-size: var(--fs-md);
  color: var(--on-dark-muted);
}
.hero__actions { display: flex; gap: var(--sp-3); justify-content: center; flex-wrap: wrap; }

.eyebrow {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8fd6bd;
}
.eyebrow--ink { color: var(--accent-strong); }

.hero__stats {
  display: flex;
  justify-content: center;
  gap: clamp(var(--sp-6), 6vw, var(--sp-9));
  margin-top: var(--sp-8);
  flex-wrap: wrap;
}
.hero__stats dt {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.hero__stats dd { font-size: var(--fs-sm); color: var(--on-dark-muted); }

/* --- Buttons -------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-weight: 600;
  font-size: var(--fs-sm);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
  min-height: 44px; /* comfortable touch target */
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--lg { padding: var(--sp-4) var(--sp-6); font-size: var(--fs-base); }
.btn--block { width: 100%; }

.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-strong); }
.btn--primary:disabled { background: var(--border-strong); color: var(--text-muted); cursor: not-allowed; }

.btn--light { background: #fff; color: var(--ink); }
.btn--light:hover { background: #e6f2ed; }

.btn--ghost { background: transparent; color: var(--on-dark); border-color: rgba(255, 255, 255, 0.4); }
.btn--ghost:hover { border-color: #fff; background: rgba(255, 255, 255, 0.1); }

.btn--quiet {
  background: var(--success-bg);
  color: var(--accent-strong);
  min-height: 38px;
  padding: var(--sp-2) var(--sp-4);
}
.btn--quiet:hover { background: var(--border); }
.btn--quiet:disabled { opacity: 0.45; cursor: not-allowed; }

.btn--danger { background: var(--danger-bg); color: var(--danger); min-height: 38px; padding: var(--sp-2) var(--sp-4); }
.btn--danger:hover { background: var(--danger-bg); border-color: var(--danger); }

.link-quiet { color: var(--text-muted); font-size: var(--fs-sm); }
.link-quiet:hover { color: var(--accent-strong); }

/* --- Upload card ------------------------------------------------------------------ */

.upload-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-6);
  margin-top: calc(var(--sp-9) * -1.5);
  position: relative;
}
.upload-card__head h2 { font-size: var(--fs-lg); margin-bottom: var(--sp-1); }
.upload-card__head p { color: var(--text-muted); margin-bottom: var(--sp-5); }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  padding: var(--sp-7) var(--sp-5);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--accent); background: var(--success-bg); }
/* The file input stays focusable (visually-hidden, not display:none) so the
   dropzone is reachable and operable by keyboard. */
.dropzone:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.dropzone__icon { width: 34px; height: 34px; color: var(--accent); margin-bottom: var(--sp-1); }
.dropzone__title { font-weight: 600; color: var(--text); font-size: var(--fs-base); }
.dropzone__hint { font-size: var(--fs-sm); color: var(--text-muted); }
.dropzone__file {
  margin-top: var(--sp-3);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--accent-strong);
  background: var(--success-bg);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-pill);
  word-break: break-all;
}

.upload-card__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-4);
  margin-top: var(--sp-5);
  flex-wrap: wrap;
}
.upload-card__error {
  margin-top: var(--sp-4);
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid currentColor;
  border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-sm);
}
.upload-card__progress {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
  color: var(--accent-strong);
  font-weight: 500;
}

.spinner {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Steps -------------------------------------------------------------------------- */

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-5); }
.step { padding: var(--sp-5) 0; }
.step__num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  margin-bottom: var(--sp-4);
}
.step h3 { font-size: var(--fs-md); margin-bottom: var(--sp-2); }
.step p { color: var(--text-muted); font-size: var(--fs-sm); }

/* --- Compliance ---------------------------------------------------------------------- */

.compliance { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: var(--sp-8); align-items: center; }
.compliance__copy p { color: var(--text-muted); margin-bottom: var(--sp-5); max-width: 52ch; }

.checklist { list-style: none; display: grid; gap: var(--sp-3); }
.checklist li { padding-left: var(--sp-6); position: relative; font-weight: 500; }
.checklist li::before {
  content: "";
  position: absolute; left: 0; top: 5px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--success-bg);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}
.checklist li::after {
  content: "";
  position: absolute; left: 5px; top: 9px;
  width: 8px; height: 4px;
  border-left: 2px solid var(--accent-strong);
  border-bottom: 2px solid var(--accent-strong);
  transform: rotate(-45deg);
}

.bands-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--sp-5);
}
.bands-card h3 { font-size: var(--fs-base); margin-bottom: var(--sp-4); }
.bands { width: 100%; border-collapse: collapse; }
.bands td { padding: var(--sp-3) var(--sp-1); border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.bands td:last-child { text-align: right; font-weight: 700; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.bands tr:last-child td { border-bottom: none; }
.bands__note { margin-top: var(--sp-4); font-size: var(--fs-xs); color: var(--text-muted); }

/* --- Sponsor band ---------------------------------------------------------------------- */

.section--sponsor { background: var(--ink); color: var(--on-dark); }
.sponsor-band { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-6); flex-wrap: wrap; }
.sponsor-band h2 { color: #fff; font-size: var(--fs-lg); margin-bottom: var(--sp-2); }
.sponsor-band p { color: var(--on-dark-muted); max-width: 58ch; }

/* --- Footer ------------------------------------------------------------------------------ */

.footer { background: var(--surface); border-top: 1px solid var(--border); padding: var(--sp-7) 0 var(--sp-5); margin-top: auto; }
.footer__inner { display: flex; justify-content: space-between; gap: var(--sp-6); flex-wrap: wrap; }
.footer__tag { color: var(--text-muted); font-size: var(--fs-sm); margin-top: var(--sp-3); }
.footer__links { display: grid; gap: var(--sp-2); font-size: var(--fs-sm); }
.footer__links a { color: var(--text); }
.footer__legal {
  margin-top: var(--sp-6);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* --- Results & lock ------------------------------------------------------------------------- */

.results-head { margin-bottom: var(--sp-6); }
.results-head h1 { font-size: var(--fs-xl); margin: var(--sp-2) 0 var(--sp-2); }
.results-meta { color: var(--text-muted); font-size: var(--fs-sm); }

.lock {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-6);
  text-align: center;
}
.lock__bar { height: 6px; border-radius: var(--radius-pill); background: var(--success-bg); overflow: hidden; margin-bottom: var(--sp-5); }
.lock__bar span { display: block; height: 100%; width: 0%; background: var(--accent); transition: width 0.3s linear; }
.lock__timer { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.lock__note { color: var(--text-muted); max-width: 52ch; margin: var(--sp-1) auto var(--sp-6); font-size: var(--fs-sm); }

.sponsor-card {
  background: linear-gradient(160deg, var(--surface-sunken), var(--success-bg));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-6);
  display: none;
  text-align: center;
}
.sponsor-card.is-active { display: block; animation: fadeUp 0.4s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.sponsor-card__badge {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: var(--sp-3);
}
.sponsor-card h2 { font-size: var(--fs-md); margin-bottom: var(--sp-2); }
.sponsor-card p { color: var(--text-muted); max-width: 56ch; margin: 0 auto; }
.sponsor-card__media { margin: 0 auto var(--sp-5); max-width: 560px; border-radius: var(--radius-sm); overflow: hidden; }
.sponsor-card__media iframe, .sponsor-card__media video { width: 100%; aspect-ratio: 16 / 9; border: 0; display: block; }
.sponsor-card__link { display: inline-block; margin-top: var(--sp-4); font-weight: 600; }
.sponsor-card__client { display: block; margin-top: var(--sp-4); font-size: var(--fs-xs); color: var(--text-muted); }

.results-body { margin-top: var(--sp-2); }
.results-actions { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-5); }
.results-actions__hint { color: var(--text-muted); font-size: var(--fs-sm); }

.banner-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-5); }
.banner {
  display: grid; gap: var(--sp-1);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--sp-4) var(--sp-5);
  color: var(--text);
}
.banner:hover { border-color: var(--accent); text-decoration: none; }
.banner strong { color: var(--text); }
.banner span:last-child { font-size: var(--fs-sm); color: var(--text-muted); }

.results-privacy { margin-top: var(--sp-5); font-size: var(--fs-sm); color: var(--text-muted); text-align: center; }

/* --- Tables ------------------------------------------------------------------------------------ */

.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
caption { text-align: left; padding: var(--sp-4) var(--sp-5) 0; color: var(--text-muted); font-size: var(--fs-sm); }
th, td { text-align: left; padding: var(--sp-3) var(--sp-4); font-size: var(--fs-sm); }
thead th {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-sunken); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
th.action, td.action { text-align: right; }
.cell-sub { font-size: var(--fs-xs); color: var(--text-muted); }
.net-cell { font-weight: 700; color: var(--accent-strong); }

.empty-cell { text-align: center; color: var(--text-muted); padding: var(--sp-7) var(--sp-4); }
.empty-cell p { margin-bottom: var(--sp-3); }

.skeleton {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--border) 25%, var(--surface-sunken) 37%, var(--border) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

.table-foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-4);
  border-top: 1px solid var(--border);
  background: var(--surface-sunken);
  font-size: var(--fs-sm);
  color: var(--text-muted);
  flex-wrap: wrap;
}
.pager { display: flex; gap: var(--sp-2); }

/* --- Tiles -------------------------------------------------------------------------------------- */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-7); }
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--sp-4) var(--sp-5);
  display: grid;
  gap: 2px;
}
.tile__value {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.tile__label { font-size: var(--fs-xs); color: var(--text-muted); }

/* --- Admin ---------------------------------------------------------------------------------------- */

.admin-title { font-size: var(--fs-xl); margin-bottom: var(--sp-5); }
.admin-section { margin-bottom: var(--sp-7); }
.admin-section__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  margin-bottom: var(--sp-4); flex-wrap: wrap;
}
.admin-section__head h2 { font-size: var(--fs-md); }

.reveal summary { list-style: none; display: inline-flex; }
.reveal summary::-webkit-details-marker { display: none; }
.panel-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--sp-5);
  margin-top: var(--sp-3);
  display: grid;
  gap: var(--sp-4);
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--sp-4); }
.form-grid__wide { grid-column: 1 / -1; }

label { display: grid; gap: var(--sp-1); font-size: var(--fs-sm); font-weight: 500; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"],
input[type="number"], input[type="datetime-local"], select, textarea {
  padding: var(--sp-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--text);
  min-height: 44px;
  width: 100%;
}
textarea { min-height: 72px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus);
}
.field-hint { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 400; }

.check { display: flex; gap: var(--sp-2); align-items: center; font-size: var(--fs-sm); color: var(--text-muted); font-weight: 400; }
.check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
.row-actions { display: inline-flex; gap: var(--sp-2); justify-content: flex-end; flex-wrap: wrap; }

.pill { display: inline-block; font-size: var(--fs-xs); font-weight: 600; padding: var(--sp-1) var(--sp-3); border-radius: var(--radius-pill); }
.pill--on { background: var(--success-bg); color: var(--accent-strong); }
.pill--off { background: var(--border); color: var(--text-muted); }

/* --- Messages -------------------------------------------------------------------------------------- */

.notice, .error {
  border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-sm);
  font-weight: 500;
  display: flex;
  gap: var(--sp-2);
  align-items: flex-start;
}
.notice { background: var(--success-bg); color: var(--accent-strong); border: 1px solid var(--accent); }
.error { background: var(--danger-bg); color: var(--danger); border: 1px solid currentColor; }
.notice--float { margin-bottom: var(--sp-5); }

/* --- Auth --------------------------------------------------------------------------------------------- */

.page-auth {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: var(--sp-6);
  background: radial-gradient(800px 400px at 80% -10%, rgba(20, 183, 137, 0.14), transparent 60%), var(--bg);
  padding: var(--sp-7) var(--sp-5);
}
.brand--auth { justify-self: center; }
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-6);
  width: min(400px, 92vw);
  display: grid;
  gap: var(--sp-4);
}
.auth-card h1 { font-size: var(--fs-md); }
.auth-card__back { text-align: center; }

/* --- Prose & empty states ------------------------------------------------------------------------------- */

.prose h1 { font-size: var(--fs-2xl); margin: var(--sp-2) 0 var(--sp-5); }
.prose h2 { font-size: var(--fs-md); margin: var(--sp-6) 0 var(--sp-2); }
.prose p, .prose li { color: var(--text-muted); max-width: 68ch; }
.prose p { margin-bottom: var(--sp-4); }
.prose ul { margin: 0 0 var(--sp-4) var(--sp-5); display: grid; gap: var(--sp-2); }

.empty-state { text-align: center; padding: var(--sp-8) 0; }
.empty-state__code {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: 800;
  color: var(--accent);
  opacity: 0.25;
  line-height: 1;
  margin-bottom: var(--sp-4);
}
.empty-state h1 { font-size: var(--fs-xl); margin-bottom: var(--sp-3); }
.empty-state p { color: var(--text-muted); margin-bottom: var(--sp-6); max-width: 52ch; margin-inline: auto; }

/* --- Responsive ------------------------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .steps { grid-template-columns: 1fr; gap: var(--sp-2); }
  .compliance { grid-template-columns: 1fr; gap: var(--sp-6); }
  .upload-card { margin-top: calc(var(--sp-8) * -1); padding: var(--sp-5); }
  .section { padding: var(--sp-8) 0; }
}

@media (max-width: 720px) {
  .nav__toggle { display: inline-flex; }
  .nav__links {
    display: none;
    position: absolute;
    top: calc(100% + var(--sp-2));
    right: 0;
    left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: var(--sp-2);
    font-size: var(--fs-base);
  }
  .nav__links.is-open { display: flex; }
  .nav__links a {
    color: var(--text);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius-sm);
  }
  .nav__links a:hover { background: var(--surface-sunken); }
  .nav__cta { text-align: center; margin-top: var(--sp-1); }
  .nav__links form { padding: var(--sp-2); }

  .hero__inner { padding-top: var(--sp-6); }
  .hero__stats { gap: var(--sp-5); }
  .section { padding: var(--sp-7) 0; }
  .upload-card__foot { flex-direction: column-reverse; align-items: stretch; }
  .upload-card__foot .btn { width: 100%; }
  .upload-card__foot .link-quiet { text-align: center; }
  .results-actions .btn { width: 100%; }
  .table-foot { justify-content: center; }
  .footer__inner { flex-direction: column; gap: var(--sp-5); }
}

@media print {
  .nav, .footer, .lock, .banner-row, .pager, .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .table-card { box-shadow: none; border: 1px solid #999; }
}

/* --- Launch-readiness additions (2026-10) ----------------------------------------------------------- */

[hidden] { display: none !important; }

.upload-card__error ul { margin: var(--sp-2) 0 0 var(--sp-5); display: grid; gap: var(--sp-1); }
.upload-card__privacy { margin-top: var(--sp-4); font-size: var(--fs-xs); color: var(--text-muted); }

.pass-field { margin-top: var(--sp-4); font-size: var(--fs-sm); }
.pass-field summary { cursor: pointer; color: var(--accent-strong); font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.pass-field label { margin-top: var(--sp-2); }
.pass-field input { text-transform: uppercase; letter-spacing: 0.06em; }

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--sp-5); margin-top: var(--sp-6); }
.plan {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
.plan--featured { border-color: var(--accent); box-shadow: var(--shadow); }
.plan h3 { font-size: var(--fs-md); }
.plan__price { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 700; color: var(--accent-strong); }
.plan__how { font-size: var(--fs-sm); color: var(--text-muted); }
.plan__actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: auto; }
.plan > .btn { align-self: flex-start; margin-top: auto; }

.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-5); }
.summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--sp-4) var(--sp-5);
  display: grid;
  gap: 2px;
}
.summary--accent { background: var(--success-bg); border-color: var(--accent); }
.summary__label { font-size: var(--fs-sm); color: var(--text-muted); }
.summary__value { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 700; font-variant-numeric: tabular-nums; }
.summary__hint { font-size: var(--fs-xs); color: var(--text-muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
  margin-bottom: var(--sp-5);
}
.remit h3 { font-size: var(--fs-md); margin-bottom: var(--sp-1); }
.remit__due { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: var(--sp-3); }
.remit__table tbody th { font-weight: 700; text-align: left; border-bottom: 1px solid var(--border); }
.remit__table tbody tr:last-child th { border-bottom: none; }

.download-bar { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.download-bar__hint { font-size: var(--fs-sm); color: var(--text-muted); margin: var(--sp-2) 0 var(--sp-6); }
.results-subhead { font-size: var(--fs-md); margin: var(--sp-6) 0 var(--sp-3); }

.code-reveal {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: var(--fs-xl);
  letter-spacing: 0.08em;
  background: var(--success-bg);
  border: 1px dashed var(--accent);
  border-radius: var(--radius-sm);
  padding: var(--sp-4);
  text-align: center;
  margin: var(--sp-4) 0;
  user-select: all;
  overflow-wrap: anywhere;
}
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--sp-5); }
.settings-grid .panel-form { margin-top: 0; }
.panel-form h3 { font-size: var(--fs-md); margin-bottom: var(--sp-3); }
.panel-form .btn { margin-top: var(--sp-3); }
.panel-form p { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: var(--sp-3); }

@media (max-width: 720px) {
  .download-bar .btn { width: 100%; }
  .summary-grid { grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
  .summary { padding: var(--sp-3); }
  .summary__value { font-size: var(--fs-md); }
  /* Keep the employee table readable on a phone: name, gross, PAYE, net pay, download. */
  .results-table th:nth-child(2), .results-table td:nth-child(2),
  .results-table th:nth-child(5), .results-table td:nth-child(5),
  .results-table th:nth-child(6), .results-table td:nth-child(6),
  .results-table th:nth-child(7), .results-table td:nth-child(7) { display: none; }
  .results-table th, .results-table td { padding: var(--sp-2) var(--sp-2); }
  /* Remittances on a phone: who to pay and how much. Shares are in the schedule document. */
  .remit__table th:nth-child(2), .remit__table td:nth-child(2),
  .remit__table th:nth-child(3), .remit__table td:nth-child(3),
  .remit__table th:nth-child(4), .remit__table td:nth-child(4) { display: none; }
  .plan { padding: var(--sp-5); }
}
