/* ============================================================
   Runsense — Colors & Type
   Design system version: 1.3.0 · 2026-04-28
   Single source of truth for visual foundations.
   ------------------------------------------------------------
   Philosophy: Quiet mastery over loud optimization.
   Warm neutrals, restrained palette, generous whitespace.
   ------------------------------------------------------------
   Authoritative copy lives in the runsense repo at
   `design-system/colors_and_type.css`. This file is the single
   source of tokens — never hardcode hex, font-family, spacing,
   or radius values elsewhere. See CHANGELOG.md for revisions.
   ============================================================ */

/* ---------- Self-hosted fonts ----------
   Files live in /fonts/ at the project root. These are the Google Fonts
   variable-font .woff2 files, served locally so the design system has
   no network dependency. Weights 400 / 500 / 600 are pulled from each
   variable font via font-weight descriptors.

   Source:
     - Inter           SIL Open Font License — https://rsms.me/inter/
     - Source Serif 4  SIL Open Font License — fonts.google.com/specimen/Source+Serif+4
     - JetBrains Mono  SIL Open Font License — fonts.google.com/specimen/JetBrains+Mono
*/
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('fonts/inter.woff2') format('woff2');
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  font-optical-sizing: auto;
  src: url('fonts/source-serif-4.woff2') format('woff2');
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: italic;
  font-weight: 400 500;
  font-display: swap;
  font-optical-sizing: auto;
  src: url('fonts/source-serif-4-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('fonts/jetbrains-mono.woff2') format('woff2');
}

:root {
  /* ---------- CORE PALETTE (from brand-guide.md §6) ---------- */
  --rs-bg:         #F6F5F2;  /* Warm off-white — canonical background */
  --rs-text:       #22201C;  /* Warmed near-black */
  --rs-primary:    #2D5E4E;  /* Deep forest green */
  --rs-secondary:  #D6A77A;  /* Muted clay / sand */

  /* ---------- RGB CHANNEL BRIDGE (v1.2.0) ----------
     For use with Tailwind's <alpha-value> pattern so opacity modifiers
     (e.g. text-brand-text/85, bg-brand-primary/10) work when colors
     are driven by CSS custom properties.
     Usage: color: rgb(var(--rs-primary-rgb) / 0.1)
     Tailwind config: 'brand-primary': 'rgb(var(--rs-primary-rgb) / <alpha-value>)' */
  --rs-primary-rgb:   45, 94, 78;     /* #2D5E4E */
  --rs-text-rgb:      34, 32, 28;     /* #22201C */
  --rs-secondary-rgb: 214, 167, 122;  /* #D6A77A */
  --rs-bg-rgb:        246, 245, 242;  /* #F6F5F2 */

  /* ---------- EXTENDED NEUTRALS (derived from core) ---------- */
  --rs-bg-raised:  #FFFFFF;  /* Cards, elevated surfaces — use sparingly */
  --rs-bg-sunken:  #EFEDE8;  /* SMS bubbles, subtle wells */
  --rs-bg-warmer:  #EDEAE3;  /* One shade deeper than sunken */

  --rs-ink-1:      #22201C;  /* Primary text */
  --rs-ink-2:      rgba(34, 32, 28, 0.85);  /* Body text */
  --rs-ink-3:      rgba(34, 32, 28, 0.60);  /* Secondary / meta */
  --rs-ink-4:      rgba(34, 32, 28, 0.30);  /* Dividers, placeholders */
  --rs-ink-5:      rgba(34, 32, 28, 0.10);  /* Hairlines, wells */
  --rs-ink-6:      rgba(34, 32, 28, 0.05);  /* Subtle tints */

  /* ---------- PRIMARY ACCENT SCALE (forest green) ---------- */
  --rs-primary-ink:    #1B3E34;  /* Deeper forest — for small text on bg */
  --rs-primary:        #2D5E4E;  /* Canonical */
  --rs-primary-hover:  #26503F;  /* Pressed/hover */
  --rs-primary-tint:   rgba(45, 94, 78, 0.10);   /* Subtle fill */
  --rs-primary-wash:   rgba(45, 94, 78, 0.04);   /* Barely-there */

  /* ---------- SECONDARY ACCENT (clay / sand) ---------- */
  --rs-secondary:       #D6A77A;
  --rs-secondary-ink:   #8A5F32;  /* For small text legibility on warm bg */
  --rs-secondary-tint:  rgba(214, 167, 122, 0.15);

  /* ---------- SEMANTIC ---------- */
  --rs-success:    #2D5E4E;   /* Same as primary — quiet confirmation */
  --rs-warning:    #B8874A;   /* Deeper clay */
  --rs-danger:     #8B2E2A;   /* Muted brick, never neon */
  --rs-danger-bg:  #F5E9E8;

  /* Strava brand color (partner — use only on Strava buttons) */
  --rs-strava:     #FC5200;

  /* ---------- TYPOGRAPHY ----------
     A restrained three-family system, all serving the brand's "quiet
     mastery" voice. Inter is the workhorse. Source Serif 4 is the
     editorial voice — reserved for the rare moments when the product
     speaks like a coach talking, not a dashboard reporting. JetBrains
     Mono is for anything numeric, code-adjacent, or data-shaped.

       Inter            — UI, body, headings, the wordmark
       Source Serif 4   — editorial pullquotes, hero sub-copy, the
                          "why today" rationale in coaching messages
       JetBrains Mono   — pace, distance, HR zones, timestamps, tokens
  */
  --rs-font-sans:     'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --rs-font-serif:    'Source Serif 4', ui-serif, Georgia, 'Times New Roman', serif;
  --rs-font-mono:     'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --rs-font-numeric:  'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Wordmark: THE identity. Non-negotiable attributes. */
  --rs-wordmark-tracking: 0.2em;
  --rs-wordmark-weight:   500;

  /* Weights — kept narrow on purpose. No bold; semibold is the
     heaviest weight the brand ever uses. */
  --rs-weight-regular:  400;
  --rs-weight-medium:   500;
  --rs-weight-semibold: 600;

  /* Type scale — tight, restrained. No giant display type. */
  --rs-size-xs:    12px;   /* meta, legal */
  --rs-size-sm:    14px;   /* small body, captions */
  --rs-size-base:  16px;   /* body */
  --rs-size-md:    18px;   /* lead body */
  --rs-size-lg:    20px;   /* h3 / section labels */
  --rs-size-xl:    24px;   /* h2 */
  --rs-size-2xl:   32px;   /* h1 — site hero */
  --rs-size-3xl:   44px;   /* maximal display; use rarely */

  --rs-lh-tight:   1.2;
  --rs-lh-snug:    1.35;
  --rs-lh-normal:  1.55;
  --rs-lh-relaxed: 1.7;   /* Sensei via space — default for body */

  /* ---------- SPACING (4px base grid) ---------- */
  --rs-space-1:   4px;
  --rs-space-2:   8px;
  --rs-space-3:   12px;
  --rs-space-4:   16px;
  --rs-space-5:   20px;
  --rs-space-6:   24px;
  --rs-space-8:   32px;
  --rs-space-10:  40px;
  --rs-space-12:  48px;
  --rs-space-16:  64px;
  --rs-space-20:  80px;   /* Section padding — "generous spacing between sections" */
  --rs-space-24:  96px;
  --rs-space-28:  112px;  /* Marketing hero */

  /* ---------- RADIUS ---------- */
  --rs-radius-sm:   4px;   /* Pills, small buttons */
  --rs-radius-md:   6px;   /* Default: buttons, banners */
  --rs-radius-lg:   8px;   /* Cards */
  --rs-radius-xl:   12px;  /* Large panels */
  --rs-radius-full: 9999px;

  /* ---------- SHADOWS (quiet, never dramatic) ---------- */
  --rs-shadow-xs: 0 1px 0 rgba(34, 32, 28, 0.04);
  --rs-shadow-sm: 0 1px 2px rgba(34, 32, 28, 0.06), 0 1px 0 rgba(34, 32, 28, 0.03);
  --rs-shadow-md: 0 2px 8px rgba(34, 32, 28, 0.06), 0 1px 2px rgba(34, 32, 28, 0.04);
  --rs-shadow-lg: 0 8px 24px rgba(34, 32, 28, 0.08), 0 2px 4px rgba(34, 32, 28, 0.04);

  /* Borders */
  --rs-border:        1px solid var(--rs-ink-5);
  --rs-border-strong: 1px solid var(--rs-ink-4);

  /* Content width — matches marketing site */
  --rs-content-max: 720px;
  --rs-content-wide: 960px;

  /* Motion — calm, never bouncy */
  --rs-ease:          cubic-bezier(0.2, 0, 0, 1);
  --rs-duration-fast: 120ms;
  --rs-duration:      200ms;
  --rs-duration-slow: 320ms;

  /* SMS conversation cadence — the rhythm at which the coach "texts."
     Unhurried by design. Use these tokens for any simulated-thread
     surface (hero, onboarding demo, investor deck). Never guess
     per-surface; conversations should feel like the same person. */
  --rs-sms-gap:            800ms;  /* beat between bubbles in a thread */
  --rs-sms-pause-short:    400ms;  /* quick reply, same thought */
  --rs-sms-pause-medium:  1200ms;  /* natural response time */
  --rs-sms-pause-long:    2200ms;  /* coach is "considering" */
  --rs-sms-typing-cadence:1200ms;  /* full cycle of the three-dot loop */
  --rs-sms-thread-gap:    6000ms;  /* hold at end of script before next */
  --rs-sms-fade:           450ms;  /* bubble enter / thread swap */
}

/* ============================================================
   Semantic typography — use these classes directly
   ============================================================ */

/* Editorial — reserved. The coach's voice, the rationale, the
   "why today is easy" card. Never headlines, never UI chrome. */
.rs-editorial {
  font-family: var(--rs-font-serif);
  font-size: var(--rs-size-md);
  line-height: var(--rs-lh-relaxed);
  color: var(--rs-ink-1);
  font-weight: var(--rs-weight-regular);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
.rs-editorial em {
  font-style: italic;
  color: var(--rs-ink-1);
}

/* Numeric — pace, distance, splits, timestamps. Tabular figures
   so columns of numbers line up. */
.rs-numeric {
  font-family: var(--rs-font-numeric);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: 0;
}

.rs-body,
.rs-prose {
  font-family: var(--rs-font-sans);
  font-size: var(--rs-size-base);
  line-height: var(--rs-lh-relaxed);
  color: var(--rs-ink-2);
  font-weight: var(--rs-weight-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.rs-h1 {
  font-family: var(--rs-font-sans);
  font-size: var(--rs-size-2xl);
  line-height: var(--rs-lh-tight);
  letter-spacing: -0.015em;
  font-weight: var(--rs-weight-semibold);
  color: var(--rs-ink-1);
}

.rs-h2 {
  font-family: var(--rs-font-sans);
  font-size: var(--rs-size-xl);
  line-height: var(--rs-lh-snug);
  letter-spacing: -0.01em;
  font-weight: var(--rs-weight-semibold);
  color: var(--rs-ink-1);
}

.rs-h3 {
  font-family: var(--rs-font-sans);
  font-size: var(--rs-size-lg);
  line-height: var(--rs-lh-snug);
  font-weight: var(--rs-weight-semibold);
  color: var(--rs-ink-1);
}

.rs-label {
  font-family: var(--rs-font-sans);
  font-size: var(--rs-size-sm);
  font-weight: var(--rs-weight-medium);
  color: var(--rs-ink-1);
  letter-spacing: 0;
}

.rs-eyebrow {
  font-family: var(--rs-font-sans);
  font-size: var(--rs-size-xs);
  font-weight: var(--rs-weight-medium);
  color: var(--rs-ink-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.rs-meta {
  font-family: var(--rs-font-sans);
  font-size: var(--rs-size-sm);
  color: var(--rs-ink-3);
}

.rs-wordmark {
  font-family: var(--rs-font-sans);
  font-weight: var(--rs-wordmark-weight);
  letter-spacing: var(--rs-wordmark-tracking);
  color: var(--rs-ink-1);
  text-transform: lowercase;
  font-style: normal;
}

/* SMS — the canonical brand voice surface */
.rs-sms {
  font-family: var(--rs-font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--rs-ink-1);
  background: var(--rs-bg-sunken);
  padding: var(--rs-space-4) var(--rs-space-5);
  border-radius: var(--rs-radius-lg);
  max-width: 520px;
}

/* ============================================================
   In-product component classes (added in v1.3.0)
   ------------------------------------------------------------
   These compose the existing tokens into the patterns every
   signed-in surface actually needs (cards, buttons, inputs,
   tabs, badges, etc.). Marketing surfaces compose tokens
   directly; in-product surfaces use these classes so the
   visual language stays consistent without each route
   reinventing the wheel. The Tailwind CDN dependency is
   removed in this release — anything below is the entire
   styling surface for /athlete, /checkout, /login, /signup.
   ============================================================ */

/* Global reset — every element uses border-box so width: 100% + padding +
   border doesn't overflow its container. Replaces the equivalent rule
   from Tailwind's preflight, which the in-product surface no longer loads. */
*,
::before,
::after { box-sizing: border-box; }

/* Form-element normalize — inherit fonts/colors from the page so native
   <input>, <select>, <button>, <textarea> stop falling back to OS defaults
   (Times-style serif on Safari, system fonts at the wrong size, etc.).
   Mirrors the relevant subset of Tailwind preflight. */
button,
input,
optgroup,
select,
textarea {
  font-family: inherit;
  font-feature-settings: inherit;
  font-size: 100%;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  color: inherit;
  margin: 0;
  padding: 0;
}
button {
  background: transparent;
  border: none;
  cursor: pointer;
}

html.rs-html { overflow-y: scroll; }

.rs-page {
  min-height: 100vh;
  background: var(--rs-bg);
  color: var(--rs-ink-1);
  font-family: var(--rs-font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: var(--rs-lh-relaxed);
}

.rs-shell {
  max-width: 480px;
  margin: 0 auto;
  padding-left: var(--rs-space-5);
  padding-right: var(--rs-space-5);
}
.rs-shell-narrow { max-width: 400px; }
.rs-shell-wide   { max-width: 520px; }
.rs-shell-lg     { max-width: 32rem; }

.rs-shell-header {
  padding-top: var(--rs-space-8);
  padding-bottom: var(--rs-space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rs-section {
  padding-top: var(--rs-space-12);
  padding-bottom: var(--rs-space-12);
}

/* ---------- Cards ---------- */
.rs-card {
  background: var(--rs-bg-raised);
  border: 1px solid var(--rs-ink-5);
  border-radius: var(--rs-radius-lg);
  padding: var(--rs-space-5);
}

.rs-danger-card {
  background: var(--rs-bg-raised);
  border: 1px solid var(--rs-danger-bg);
  border-radius: var(--rs-radius-lg);
  padding: var(--rs-space-5);
}

/* ---------- Buttons ---------- */
.rs-btn {
  display: inline-block;
  font-family: var(--rs-font-sans);
  font-size: var(--rs-size-sm);
  font-weight: var(--rs-weight-medium);
  line-height: 1.4;
  border-radius: var(--rs-radius-md);
  padding: 10px 16px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition:
    background var(--rs-duration-fast) var(--rs-ease),
    color var(--rs-duration-fast) var(--rs-ease),
    border-color var(--rs-duration-fast) var(--rs-ease),
    opacity var(--rs-duration-fast) var(--rs-ease);
}
.rs-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--rs-bg), 0 0 0 4px var(--rs-primary);
}
.rs-btn:disabled,
.rs-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.rs-btn-primary {
  background: var(--rs-primary);
  color: #fff;
}
.rs-btn-primary:hover:not(:disabled) { background: var(--rs-primary-hover); }

.rs-btn-outline {
  background: transparent;
  color: var(--rs-ink-1);
  border-color: var(--rs-ink-4);
}
.rs-btn-outline:hover:not(:disabled) { background: var(--rs-ink-6); }

.rs-btn-danger {
  background: var(--rs-danger);
  color: #fff;
}
.rs-btn-danger:hover:not(:disabled) { background: #732420; }

.rs-btn-ghost {
  background: transparent;
  color: var(--rs-primary);
  padding: 6px 8px;
}
.rs-btn-ghost:hover:not(:disabled) { background: var(--rs-primary-tint); }

.rs-btn-block { display: block; width: 100%; text-align: center; }

.rs-btn-lg {
  padding: 12px 20px;
  font-weight: var(--rs-weight-semibold);
}

.rs-btn-sm {
  font-size: var(--rs-size-xs);
  padding: 6px 12px;
}

/* Strava button focus ring (partner button — uses Strava orange) */
.rs-btn-strava {
  display: inline-block;
  border-radius: var(--rs-radius-md);
  transition: opacity var(--rs-duration-fast) var(--rs-ease);
}
.rs-btn-strava:hover { opacity: 0.9; }
.rs-btn-strava:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--rs-bg), 0 0 0 4px rgba(252, 82, 0, 0.5);
}

/* "or" divider with horizontal rule and centered label */
.rs-divider-or {
  position: relative;
  text-align: center;
  margin-top: var(--rs-space-8);
  margin-bottom: var(--rs-space-8);
}
.rs-divider-or::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--rs-ink-5);
}
.rs-divider-or > span {
  position: relative;
  display: inline-block;
  background: var(--rs-bg);
  padding: 0 var(--rs-space-3);
  font-size: var(--rs-size-xs);
  color: var(--rs-ink-3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ---------- Form fields ---------- */
.rs-input,
.rs-textarea,
.rs-select {
  display: block;
  width: 100%;
  font-family: var(--rs-font-sans);
  font-size: var(--rs-size-sm);
  line-height: 1.4;
  color: var(--rs-ink-1);
  background: var(--rs-bg-raised);
  border: 1px solid var(--rs-ink-4);
  border-radius: var(--rs-radius-md);
  padding: 10px 12px;
  -webkit-appearance: none;
  appearance: none;
  transition:
    border-color var(--rs-duration-fast) var(--rs-ease),
    box-shadow var(--rs-duration-fast) var(--rs-ease);
}
.rs-input::placeholder,
.rs-textarea::placeholder {
  color: var(--rs-ink-4);
}
.rs-input:focus,
.rs-textarea:focus,
.rs-select:focus {
  outline: none;
  border-color: var(--rs-primary);
  box-shadow: 0 0 0 3px var(--rs-primary-tint);
}
.rs-textarea { font-family: var(--rs-font-sans); }
.rs-input-readonly {
  background: var(--rs-bg);
  color: var(--rs-ink-3);
}
.rs-input-mono {
  font-family: var(--rs-font-mono);
  font-size: var(--rs-size-xs);
}
.rs-input-center {
  text-align: center;
  font-size: var(--rs-size-md);
  letter-spacing: 0.3em;
}

/* Checkbox / radio (native, accent-tinted) */
.rs-checkbox,
.rs-radio {
  width: 16px;
  height: 16px;
  accent-color: var(--rs-primary);
}

.rs-field-label {
  display: block;
  font-size: var(--rs-size-sm);
  font-weight: var(--rs-weight-medium);
  color: var(--rs-ink-1);
  margin-bottom: 4px;
}
.rs-field-hint {
  margin-top: 4px;
  font-size: var(--rs-size-xs);
  color: var(--rs-ink-3);
}
.rs-field-error {
  margin-top: 4px;
  font-size: var(--rs-size-sm);
  color: var(--rs-danger);
}
.rs-fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}
.rs-legend {
  display: block;
  font-size: var(--rs-size-sm);
  font-weight: var(--rs-weight-medium);
  color: var(--rs-ink-1);
  margin-bottom: var(--rs-space-2);
  padding: 0;
}

/* Choice cards — radio group rendered as bordered selectables.
   Markup: <label class="rs-choice"><input type="radio">…<span class="rs-choice-card">Email</span></label>. */
.rs-choice-row {
  display: flex;
  gap: var(--rs-space-3);
}
.rs-choice {
  flex: 1;
  cursor: pointer;
  position: relative;
}
.rs-choice input[type="radio"] {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.rs-choice-card {
  display: block;
  border: 1px solid var(--rs-ink-5);
  background: var(--rs-bg-raised);
  border-radius: var(--rs-radius-md);
  padding: 10px 12px;
  text-align: center;
  font-size: var(--rs-size-sm);
  color: var(--rs-ink-1);
  transition:
    border-color var(--rs-duration-fast) var(--rs-ease),
    box-shadow var(--rs-duration-fast) var(--rs-ease);
}
.rs-choice input[type="radio"]:checked + .rs-choice-card {
  border-color: var(--rs-primary);
  box-shadow: 0 0 0 2px var(--rs-primary-tint);
}

/* Goal-checkbox row layout helper */
.rs-check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

/* SMS-consent block (long policy text + checkbox) */
.rs-consent {
  display: flex;
  align-items: flex-start;
  gap: var(--rs-space-2);
  cursor: pointer;
}
.rs-consent input { margin-top: 4px; }
.rs-consent-text {
  font-size: var(--rs-size-xs);
  color: var(--rs-ink-2);
  line-height: var(--rs-lh-relaxed);
}

/* ---------- Tabs ---------- */
.rs-tabs {
  display: flex;
  border-bottom: 1px solid var(--rs-ink-5);
  margin-bottom: var(--rs-space-8);
}
.rs-tab {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px var(--rs-space-4);
  font-family: var(--rs-font-sans);
  font-size: var(--rs-size-sm);
  font-weight: var(--rs-weight-medium);
  color: var(--rs-ink-3);
  cursor: pointer;
  white-space: nowrap;
  transition:
    color var(--rs-duration-fast) var(--rs-ease),
    border-color var(--rs-duration-fast) var(--rs-ease);
}
.rs-tab:hover { color: var(--rs-ink-2); }
.rs-tab[aria-selected="true"] {
  color: var(--rs-ink-1);
  border-bottom-color: var(--rs-primary);
}

/* ---------- Badges (status pills) ---------- */
.rs-badge {
  display: inline-block;
  padding: 2px 10px;
  font-size: var(--rs-size-xs);
  font-weight: var(--rs-weight-medium);
  border-radius: var(--rs-radius-full);
  border: 1px solid transparent;
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: none;
}
.rs-badge-success {
  color: var(--rs-primary-ink);
  background: var(--rs-primary-tint);
  border-color: rgba(45, 94, 78, 0.20);
}
.rs-badge-warning {
  color: #6E4719;
  background: var(--rs-secondary-tint);
  border-color: rgba(214, 167, 122, 0.30);
}
.rs-badge-neutral {
  color: var(--rs-ink-2);
  background: var(--rs-bg-sunken);
  border-color: var(--rs-ink-5);
}
.rs-badge-info {
  color: var(--rs-ink-2);
  background: var(--rs-secondary-tint);
  border-color: rgba(214, 167, 122, 0.30);
}

/* ---------- Flash / inline alerts ---------- */
.rs-flash {
  display: block;
  padding: var(--rs-space-3);
  border-radius: var(--rs-radius-md);
  font-size: var(--rs-size-sm);
  border: 1px solid transparent;
  margin-bottom: var(--rs-space-6);
}
.rs-flash-success {
  background: var(--rs-primary-tint);
  border-color: rgba(45, 94, 78, 0.20);
  color: var(--rs-primary-ink);
}
.rs-flash-error {
  background: var(--rs-danger-bg);
  border-color: rgba(139, 46, 42, 0.30);
  color: var(--rs-danger);
}

/* ---------- Dividers ---------- */
.rs-divider {
  border: 0;
  border-top: 1px solid var(--rs-ink-5);
  margin: 0;
}

/* ---------- Links ---------- */
.rs-link {
  color: var(--rs-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.rs-link:hover { color: var(--rs-primary-hover); }

.rs-link-quiet {
  color: var(--rs-ink-3);
  text-decoration: none;
}
.rs-link-quiet:hover { color: var(--rs-ink-1); }

.rs-link-plain { color: inherit; text-decoration: none; }

.rs-link-danger {
  color: var(--rs-danger);
  text-decoration: none;
}
.rs-link-danger:hover { text-decoration: underline; }

/* Wordmark used as a link in headers */
.rs-wordmark-link {
  font-family: var(--rs-font-sans);
  font-weight: var(--rs-wordmark-weight);
  letter-spacing: var(--rs-wordmark-tracking);
  color: var(--rs-ink-1);
  text-transform: lowercase;
  text-decoration: none;
  font-size: var(--rs-size-sm);
}

/* "Inline button styled as link" — the `cancel instead` and edit/delete
   actions inside cards. Visually a link, semantically a <button>. */
.rs-linkbtn {
  background: transparent;
  border: 0;
  padding: 0;
  font-family: var(--rs-font-sans);
  font-size: inherit;
  color: var(--rs-primary);
  font-weight: var(--rs-weight-medium);
  cursor: pointer;
  text-decoration: none;
}
.rs-linkbtn:hover { text-decoration: underline; }
.rs-linkbtn-danger {
  color: var(--rs-danger);
}
.rs-linkbtn-quiet {
  color: var(--rs-ink-3);
  font-weight: var(--rs-weight-regular);
}
.rs-linkbtn-quiet:hover { color: var(--rs-ink-1); }

/* ---------- Tooltip (hover help icons) ---------- */
.rs-tooltip-host {
  position: relative;
  display: inline-block;
  cursor: help;
}
.rs-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 6px;
  padding: 4px 8px;
  background: var(--rs-ink-1);
  color: #fff;
  font-size: var(--rs-size-xs);
  border-radius: var(--rs-radius-sm);
  white-space: nowrap;
  visibility: hidden;
  pointer-events: none;
}
.rs-tooltip-host:hover .rs-tooltip,
.rs-tooltip-host:focus-within .rs-tooltip {
  visibility: visible;
}
.rs-tooltip-icon {
  width: 14px;
  height: 14px;
  color: var(--rs-ink-4);
  vertical-align: middle;
}

/* ---------- Race-row card (dynamic in raceManagementScript) ---------- */
.rs-race-entry {
  border: 1px solid var(--rs-ink-5);
  border-radius: var(--rs-radius-lg);
  padding: var(--rs-space-4);
}
.rs-race-entry > * + * { margin-top: var(--rs-space-3); }

/* ---------- Plan-selector cards (checkout pricing) ---------- */
.rs-plan-card {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--rs-space-4);
  background: var(--rs-bg-raised);
  border: 2px solid var(--rs-ink-5);
  border-radius: var(--rs-radius-lg);
  cursor: pointer;
  transition: border-color var(--rs-duration) var(--rs-ease);
  font-family: var(--rs-font-sans);
  color: var(--rs-ink-1);
}
.rs-plan-card:hover {
  border-color: var(--rs-primary-tint);
}
.rs-plan-card-selected {
  border-color: var(--rs-primary);
  padding-top: calc(var(--rs-space-4) + 4px);
}
.rs-plan-badge {
  position: absolute;
  top: -12px;
  right: var(--rs-space-4);
  background: var(--rs-primary);
  color: #fff;
  font-size: var(--rs-size-xs);
  font-weight: var(--rs-weight-medium);
  padding: 2px 10px;
  border-radius: var(--rs-radius-full);
}

/* ============================================================
   Token-keyed utility class layer (added in v1.3.0)
   ------------------------------------------------------------
   Surgical to actual usage in src/routes/. Not a complete
   utility framework — only the primitives the inventory found.
   Spacing utilities are keyed to --rs-space-* where the step
   exists; non-canonical half-steps use literal px values.
   ============================================================ */

/* Display */
.rs-block { display: block; }
.rs-inline-block { display: inline-block; }
.rs-inline { display: inline; }
.rs-inline-flex { display: inline-flex; }
.rs-flex { display: flex; }
.rs-grid { display: grid; }
.rs-hidden { display: none !important; }
.rs-contents { display: contents; }

/* Flex children */
.rs-flex-1 { flex: 1 1 0%; }
.rs-shrink-0 { flex-shrink: 0; }

/* Flex alignment */
.rs-items-start { align-items: flex-start; }
.rs-items-center { align-items: center; }
.rs-items-baseline { align-items: baseline; }
.rs-justify-between { justify-content: space-between; }
.rs-justify-center { justify-content: center; }

/* Gap */
.rs-gap-2 { gap: var(--rs-space-2); }
.rs-gap-2-5 { gap: 10px; }
.rs-gap-3 { gap: var(--rs-space-3); }
.rs-gap-4 { gap: var(--rs-space-4); }
.rs-gap-x-6 { column-gap: var(--rs-space-6); }
.rs-gap-y-2 { row-gap: var(--rs-space-2); }

/* Vertical stack helpers (margin-top on every sibling after the first) */
.rs-stack-1 > * + * { margin-top: var(--rs-space-1); }
.rs-stack-2 > * + * { margin-top: var(--rs-space-2); }
.rs-stack-3 > * + * { margin-top: var(--rs-space-3); }
.rs-stack-4 > * + * { margin-top: var(--rs-space-4); }
.rs-stack-5 > * + * { margin-top: var(--rs-space-5); }
.rs-stack-6 > * + * { margin-top: var(--rs-space-6); }

/* Grid templates */
.rs-grid-2col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rs-grid-auto-1fr { grid-template-columns: auto 1fr; }

/* Width / Height */
.rs-w-full { width: 100%; }
.rs-w-3-5 { width: 14px; }
.rs-w-4 { width: 16px; }
.rs-w-5 { width: 20px; }
.rs-h-3-5 { height: 14px; }
.rs-h-4 { height: 16px; }
.rs-h-5 { height: 20px; }
.rs-min-h-screen { min-height: 100vh; }

/* Margin */
.rs-mx-auto { margin-left: auto; margin-right: auto; }
.rs-mt-1 { margin-top: var(--rs-space-1); }
.rs-mt-2 { margin-top: var(--rs-space-2); }
.rs-mt-3 { margin-top: var(--rs-space-3); }
.rs-mt-4 { margin-top: var(--rs-space-4); }
.rs-mt-6 { margin-top: var(--rs-space-6); }
.rs-mb-1 { margin-bottom: var(--rs-space-1); }
.rs-mb-1-5 { margin-bottom: 6px; }
.rs-mb-2 { margin-bottom: var(--rs-space-2); }
.rs-mb-3 { margin-bottom: var(--rs-space-3); }
.rs-mb-4 { margin-bottom: var(--rs-space-4); }
.rs-mb-6 { margin-bottom: var(--rs-space-6); }
.rs-mb-8 { margin-bottom: var(--rs-space-8); }
.rs-my-8 { margin-top: var(--rs-space-8); margin-bottom: var(--rs-space-8); }
.rs-ml-half { margin-left: 2px; }

/* Padding */
.rs-p-3 { padding: var(--rs-space-3); }
.rs-p-4 { padding: var(--rs-space-4); }
.rs-p-5 { padding: var(--rs-space-5); }
.rs-px-3 { padding-left: var(--rs-space-3); padding-right: var(--rs-space-3); }
.rs-px-5 { padding-left: var(--rs-space-5); padding-right: var(--rs-space-5); }
.rs-py-1 { padding-top: var(--rs-space-1); padding-bottom: var(--rs-space-1); }
.rs-py-3 { padding-top: var(--rs-space-3); padding-bottom: var(--rs-space-3); }
.rs-py-8 { padding-top: var(--rs-space-8); padding-bottom: var(--rs-space-8); }
.rs-py-10 { padding-top: var(--rs-space-10); padding-bottom: var(--rs-space-10); }
.rs-py-12 { padding-top: var(--rs-space-12); padding-bottom: var(--rs-space-12); }
.rs-py-24 { padding-top: var(--rs-space-24); padding-bottom: var(--rs-space-24); }
.rs-pt-3 { padding-top: var(--rs-space-3); }
.rs-pt-4 { padding-top: var(--rs-space-4); }
.rs-pt-5 { padding-top: var(--rs-space-5); }
.rs-pt-8 { padding-top: var(--rs-space-8); }
.rs-pb-4 { padding-bottom: var(--rs-space-4); }
.rs-pb-16 { padding-bottom: var(--rs-space-16); }
.rs-pr-3 { padding-right: var(--rs-space-3); }

/* Position */
.rs-relative { position: relative; }
.rs-absolute { position: absolute; }
.rs-inset-0 { inset: 0; }

/* Borders */
.rs-border { border: 1px solid var(--rs-ink-5); }
.rs-border-t { border-top: 1px solid var(--rs-ink-5); }
.rs-border-b { border-bottom: 1px solid var(--rs-ink-5); }
.rs-divide-y > * + * { border-top: 1px solid var(--rs-ink-5); }

/* Rounding */
.rs-rounded-md { border-radius: var(--rs-radius-md); }
.rs-rounded-lg { border-radius: var(--rs-radius-lg); }
.rs-rounded-full { border-radius: var(--rs-radius-full); }

/* Text alignment / transform */
.rs-text-center { text-align: center; }
.rs-text-left { text-align: left; }
.rs-uppercase { text-transform: uppercase; }
.rs-tabular-nums { font-variant-numeric: tabular-nums; }

/* Type-size utilities (use sparingly — prefer .rs-h1/.rs-h2/.rs-eyebrow/.rs-body/.rs-meta semantic classes) */
.rs-text-xs { font-size: var(--rs-size-xs); }
.rs-text-sm { font-size: var(--rs-size-sm); }
.rs-text-lg { font-size: var(--rs-size-lg); }
.rs-text-2xl { font-size: var(--rs-size-2xl); }
.rs-leading-relaxed { line-height: var(--rs-lh-relaxed); }
.rs-leading-snug { line-height: var(--rs-lh-snug); }
.rs-tracking-tight { letter-spacing: -0.015em; }

/* Colors (semantic ink tiers — the 6-step canonical scale) */
.rs-text-ink-1 { color: var(--rs-ink-1); }
.rs-text-ink-2 { color: var(--rs-ink-2); }
.rs-text-ink-3 { color: var(--rs-ink-3); }
.rs-text-ink-4 { color: var(--rs-ink-4); }
.rs-text-primary { color: var(--rs-primary); }
.rs-text-danger { color: var(--rs-danger); }
.rs-text-warning { color: var(--rs-warning); }
.rs-text-white { color: #fff; }

.rs-bg-raised { background: var(--rs-bg-raised); }
.rs-bg-sunken { background: var(--rs-bg-sunken); }

/* Font */
.rs-font-sans { font-family: var(--rs-font-sans); }
.rs-font-mono { font-family: var(--rs-font-mono); }
.rs-font-medium { font-weight: var(--rs-weight-medium); }
.rs-font-semibold { font-weight: var(--rs-weight-semibold); }

/* Cursor */
.rs-cursor-pointer { cursor: pointer; }
.rs-cursor-help { cursor: help; }

/* Whitespace / overflow / selection */
.rs-whitespace-nowrap { white-space: nowrap; }
.rs-overflow-y-scroll { overflow-y: scroll; }
.rs-select-all { user-select: all; -webkit-user-select: all; }
.rs-align-middle { vertical-align: middle; }

/* Accessibility */
.rs-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Animation */
@keyframes rs-spin { to { transform: rotate(360deg); } }
.rs-animate-spin { animation: rs-spin 1s linear infinite; }
