/*
 * ╔══════════════════════════════════════════════════════════════╗
 * ║  RaceTeamOS Design System (RDS)  v1.0                       ║
 * ║  The single source of truth for every UI element.           ║
 * ║  Never hard-code colors, sizes, or spacing in page CSS.     ║
 * ║  Always reference a token from this file.                   ║
 * ╚══════════════════════════════════════════════════════════════╝
 */

/* ────────────────────────────────────────────────────────────────
   1. DESIGN TOKENS
   ──────────────────────────────────────────────────────────────── */
:root {

  /* ── Brand ──────────────────────────────────────────────────── */
  --rds-brand:            #C8F135;   /* Lime green — RaceTeamOS signature */
  --rds-brand-hover:      #d8ff3d;
  --rds-brand-dim:        rgba(200, 241, 53, 0.12);
  --rds-brand-border:     rgba(200, 241, 53, 0.25);

  /* ── Text ───────────────────────────────────────────────────── */
  --rds-text-primary:     #FFFFFF;   /* Page titles, key values, names */
  --rds-text-secondary:   #D1D5DB;   /* Body text — the readable default */
  --rds-text-muted:       #9CA3AF;   /* Labels, supporting copy */
  --rds-text-subtle:      #6B7280;   /* Section headers, metadata */
  --rds-text-disabled:    #4B5563;   /* Intentionally unavailable */
  --rds-text-accent:      #C8F135;   /* Brand highlights */
  --rds-text-inverse:     #0A0A0B;   /* Text on bright backgrounds */

  /* ── Status ─────────────────────────────────────────────────── */
  --rds-success:          #4ade80;
  --rds-success-dim:      rgba(74, 222, 128, 0.12);
  --rds-success-border:   rgba(74, 222, 128, 0.25);
  --rds-warning:          #fbbf24;
  --rds-warning-dim:      rgba(251, 191, 36, 0.12);
  --rds-warning-border:   rgba(251, 191, 36, 0.25);
  --rds-danger:           #f87171;
  --rds-danger-dim:       rgba(248, 113, 113, 0.12);
  --rds-danger-border:    rgba(248, 113, 113, 0.25);
  --rds-info:             #60a5fa;
  --rds-info-dim:         rgba(96, 165, 250, 0.12);
  --rds-info-border:      rgba(96, 165, 250, 0.25);

  /* ── Surfaces ───────────────────────────────────────────────── */
  --rds-bg:               #0A0A0B;   /* Page background */
  --rds-surface-1:        #111114;   /* Inset, inputs, stat cards */
  --rds-surface-2:        #1A1A1E;   /* Cards */
  --rds-surface-3:        #222228;   /* Elevated, hover states */
  --rds-border:           #2A2A30;   /* Subtle dividers */
  --rds-border-strong:    #3A3A42;   /* Visible separators */

  /* ── Typography ─────────────────────────────────────────────── */
  --rds-font-sans:        'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --rds-font-mono:        'Orbitron', monospace;

  --rds-text-2xs:   11px;
  --rds-text-xs:    13px;
  --rds-text-sm:    14px;
  --rds-text-base:  15px;
  --rds-text-md:    16px;
  --rds-text-lg:    18px;
  --rds-text-xl:    20px;
  --rds-text-2xl:   24px;
  --rds-text-3xl:   30px;
  --rds-text-hero:  42px;

  /* ── Spacing ────────────────────────────────────────────────── */
  --rds-space-1:   4px;
  --rds-space-2:   8px;
  --rds-space-3:  12px;
  --rds-space-4:  16px;
  --rds-space-5:  20px;
  --rds-space-6:  24px;
  --rds-space-8:  32px;
  --rds-space-10: 40px;

  /* ── Radius ─────────────────────────────────────────────────── */
  --rds-radius-sm:  5px;
  --rds-radius:     8px;
  --rds-radius-md: 10px;
  --rds-radius-lg: 14px;
  --rds-radius-xl: 20px;
  --rds-radius-full: 9999px;

  /* ── Transitions ────────────────────────────────────────────── */
  --rds-transition:       all 0.15s ease;
  --rds-transition-slow:  all 0.25s ease;

  /* ── Shadows ────────────────────────────────────────────────── */
  --rds-shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --rds-shadow:     0 4px 12px rgba(0,0,0,0.5);
  --rds-shadow-lg:  0 8px 24px rgba(0,0,0,0.6);
  --rds-shadow-glow: 0 0 20px rgba(200,241,53,0.15);

  /* ── Z-index scale ──────────────────────────────────────────── */
  --rds-z-base:    0;
  --rds-z-raised:  10;
  --rds-z-dropdown: 100;
  --rds-z-sticky:  200;
  --rds-z-modal:   500;
  --rds-z-toast:   900;
}


/* ────────────────────────────────────────────────────────────────
   2. BASE RESET & GLOBAL STYLES
   ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--rds-font-sans);
  background:  var(--rds-bg);
  color:       var(--rds-text-secondary);
  font-size:   var(--rds-text-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.font-mono { font-family: var(--rds-font-mono); }

/* Links */
a { color: inherit; }
a:hover { color: var(--rds-text-primary); }

/* Focus ring */
:focus-visible {
  outline: 2px solid var(--rds-brand);
  outline-offset: 2px;
  border-radius: var(--rds-radius-sm);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--rds-surface-1); }
::-webkit-scrollbar-thumb { background: var(--rds-border); border-radius: var(--rds-radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--rds-border-strong); }


/* ────────────────────────────────────────────────────────────────
   3. TYPOGRAPHY SYSTEM
   ──────────────────────────────────────────────────────────────── */

/* Hierarchy classes — use these instead of manual font-size/color combos */
.rds-display {
  font-family: var(--rds-font-mono);
  font-size:   var(--rds-text-hero);
  font-weight: 900;
  color:       var(--rds-text-accent);
  line-height: 1;
  letter-spacing: -0.02em;
}
.rds-page-title {
  font-family: var(--rds-font-mono);
  font-size:   var(--rds-text-xl);
  font-weight: 700;
  color:       var(--rds-text-primary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.rds-section-title {
  font-size:   var(--rds-text-lg);
  font-weight: 600;
  color:       var(--rds-text-primary);
  line-height: 1.3;
}
.rds-card-title {
  font-size:   var(--rds-text-md);
  font-weight: 600;
  color:       var(--rds-text-primary);
}
.rds-value {
  font-family: var(--rds-font-mono);
  font-size:   var(--rds-text-lg);
  font-weight: 700;
  color:       var(--rds-text-accent);
  line-height: 1;
}
.rds-value-white {
  font-family: var(--rds-font-mono);
  font-size:   var(--rds-text-lg);
  font-weight: 700;
  color:       var(--rds-text-primary);
  line-height: 1;
}
.rds-body   { font-size: var(--rds-text-base); color: var(--rds-text-secondary); }
.rds-small  { font-size: var(--rds-text-sm);   color: var(--rds-text-muted); }
.rds-meta   { font-size: var(--rds-text-xs);   color: var(--rds-text-subtle); }
.rds-caption { font-size: var(--rds-text-2xs); color: var(--rds-text-disabled); letter-spacing: 0.04em; }

/* Widget section label — replaces the inline 10px tracking-widest pattern */
.rds-label, .widget-label {
  display: block;
  font-size:      10px;
  font-weight:    700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color:          var(--rds-text-subtle);
  line-height:    1;
}
.rds-label-accent { color: var(--rds-text-accent); }

/* Nav section label */
.nav-section-label {
  display: block;
  font-size:      10px;
  font-weight:    700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color:          var(--rds-text-disabled);
  padding:        var(--rds-space-4) var(--rds-space-3) var(--rds-space-1);
}

/* Text utility aliases */
.t-primary   { color: var(--rds-text-primary)   !important; }
.t-secondary { color: var(--rds-text-secondary) !important; }
.t-muted     { color: var(--rds-text-muted)     !important; }
.t-subtle    { color: var(--rds-text-subtle)    !important; }
.t-accent    { color: var(--rds-text-accent)    !important; }
.t-success   { color: var(--rds-success)        !important; }
.t-warning   { color: var(--rds-warning)        !important; }
.t-danger    { color: var(--rds-danger)         !important; }
.t-info      { color: var(--rds-info)           !important; }
.t-disabled  { color: var(--rds-text-disabled)  !important; }


/* ────────────────────────────────────────────────────────────────
   4. CARD SYSTEM
   ──────────────────────────────────────────────────────────────── */
.card {
  background:    var(--rds-surface-2);
  border:        1px solid var(--rds-border);
  border-radius: var(--rds-radius-md);
  transition:    border-color var(--rds-transition);
}
.card:hover { border-color: var(--rds-border-strong); }
.card--interactive { cursor: pointer; }
.card--interactive:hover { border-color: var(--rds-brand-border); background: var(--rds-surface-3); }
.card--accent { border-color: var(--rds-brand-border); }
.card--success { border-color: var(--rds-success-border); }
.card--warning { border-color: var(--rds-warning-border); }
.card--danger  { border-color: var(--rds-danger-border); }

/* Card sub-components */
.card__header {
  display:     flex;
  align-items: center;
  justify-content: space-between;
  padding:     var(--rds-space-3) var(--rds-space-5);
  border-bottom: 1px solid var(--rds-border);
}
.card__body    { padding: var(--rds-space-5); }
.card__footer  {
  padding:    var(--rds-space-3) var(--rds-space-5);
  border-top: 1px solid var(--rds-border);
}
.card__accent-bar {
  height:     2px;
  background: linear-gradient(to right, var(--rds-brand), transparent);
  border-radius: var(--rds-radius-md) var(--rds-radius-md) 0 0;
}
.card__accent-bar--warning { background: linear-gradient(to right, var(--rds-warning), transparent); }
.card__accent-bar--success  { background: linear-gradient(to right, var(--rds-success), transparent); }
.card__accent-bar--danger   { background: linear-gradient(to right, var(--rds-danger), transparent); }
.card__accent-bar--info     { background: linear-gradient(to right, var(--rds-info), transparent); }

/* Stat card variant */
.stat-card {
  background:    var(--rds-surface-1);
  border-radius: var(--rds-radius);
  padding:       var(--rds-space-4);
}
.stat-num {
  font-family: var(--rds-font-mono);
  font-size:   1.85rem;
  font-weight: 700;
  color:       var(--rds-text-accent);
  line-height: 1;
}
.stat-label {
  font-size:      var(--rds-text-2xs);
  font-weight:    700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color:          var(--rds-text-muted);
  margin-top:     5px;
}

/* Inset surface (inside cards) */
.rds-inset {
  background:    var(--rds-surface-1);
  border:        1px solid var(--rds-border);
  border-radius: var(--rds-radius);
  padding:       var(--rds-space-3);
}


/* ────────────────────────────────────────────────────────────────
   5. BUTTON SYSTEM
   ──────────────────────────────────────────────────────────────── */
.btn {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  gap:             6px;
  padding:         9px 18px;
  border-radius:   var(--rds-radius);
  font-size:       var(--rds-text-sm);
  font-weight:     600;
  font-family:     var(--rds-font-sans);
  cursor:          pointer;
  transition:      var(--rds-transition);
  border:          none;
  text-decoration: none;
  white-space:     nowrap;
  letter-spacing:  0.01em;
  line-height:     1;
}
.btn:disabled { opacity: 0.45; pointer-events: none; }

/* Primary — brand lime */
.btn-primary { background: var(--rds-brand); color: var(--rds-text-inverse); }
.btn-primary:hover { background: var(--rds-brand-hover); color: var(--rds-text-inverse); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(200,241,53,0.3); }
.btn-primary:active { transform: none; }

/* Secondary — subtle surface */
.btn-secondary { background: var(--rds-surface-3); color: var(--rds-text-primary); border: 1px solid var(--rds-border); }
.btn-secondary:hover { border-color: var(--rds-border-strong); background: var(--rds-surface-3); }

/* Ghost — transparent */
.btn-ghost { background: transparent; color: var(--rds-text-muted); border: 1px solid var(--rds-border); }
.btn-ghost:hover { background: var(--rds-surface-2); color: var(--rds-text-primary); border-color: var(--rds-border-strong); }

/* Danger */
.btn-danger { background: var(--rds-danger-dim); color: var(--rds-danger); border: 1px solid var(--rds-danger-border); }
.btn-danger:hover { background: rgba(248,113,113,0.2); }

/* Link style */
.btn-link { background: none; border: none; color: var(--rds-text-accent); padding: 0; font-size: inherit; font-weight: 500; }
.btn-link:hover { color: var(--rds-text-primary); }

/* Size variants */
.btn-sm { padding: 6px 12px; font-size: var(--rds-text-xs); gap: 4px; }
.btn-lg { padding: 12px 24px; font-size: var(--rds-text-md); }

/* Icon button */
.btn-icon { padding: 8px; border-radius: var(--rds-radius); }
.btn-icon.btn-sm { padding: 6px; }


/* ────────────────────────────────────────────────────────────────
   6. BADGE / STATUS SYSTEM
   ──────────────────────────────────────────────────────────────── */
.badge {
  display:        inline-flex;
  align-items:    center;
  gap:            4px;
  padding:        3px 9px;
  border-radius:  var(--rds-radius-full);
  font-size:      var(--rds-text-2xs);
  font-weight:    700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space:    nowrap;
}

/* Semantic variants */
.badge-success  { background: var(--rds-success-dim);  color: var(--rds-success);  border: 1px solid var(--rds-success-border); }
.badge-warning  { background: var(--rds-warning-dim);  color: var(--rds-warning);  border: 1px solid var(--rds-warning-border); }
.badge-danger   { background: var(--rds-danger-dim);   color: var(--rds-danger);   border: 1px solid var(--rds-danger-border); }
.badge-info     { background: var(--rds-info-dim);     color: var(--rds-info);     border: 1px solid var(--rds-info-border); }
.badge-accent   { background: var(--rds-brand-dim);    color: var(--rds-text-accent); border: 1px solid var(--rds-brand-border); }

/* Neutral variants */
.badge-lime  { background: var(--rds-brand-dim); color: var(--rds-text-accent); }
.badge-gray  { background: rgba(255,255,255,0.08); color: var(--rds-text-muted); border: 1px solid var(--rds-border); }
.badge-green { background: var(--rds-success-dim);  color: var(--rds-success); }
.badge-red   { background: var(--rds-danger-dim);   color: var(--rds-danger); }
.badge-amber { background: var(--rds-warning-dim);  color: var(--rds-warning); }
.badge-blue  { background: var(--rds-info-dim);     color: var(--rds-info); }

/* Status dot */
.rds-status-dot {
  display:       inline-block;
  width:         8px; height: 8px;
  border-radius: var(--rds-radius-full);
  flex-shrink:   0;
}
.rds-status-dot--success  { background: var(--rds-success); }
.rds-status-dot--warning  { background: var(--rds-warning); }
.rds-status-dot--danger   { background: var(--rds-danger);  }
.rds-status-dot--muted    { background: var(--rds-text-disabled); }
.rds-status-dot--pulse    { animation: rdsPulse 2s infinite; }

@keyframes rdsPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}


/* ────────────────────────────────────────────────────────────────
   7. FORM SYSTEM
   ──────────────────────────────────────────────────────────────── */
.form-label {
  display:        block;
  font-size:      var(--rds-text-xs);
  font-weight:    600;
  color:          var(--rds-text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom:  var(--rds-space-1) + 2px;
}
.form-help {
  font-size: var(--rds-text-xs);
  color:     var(--rds-text-subtle);
  margin-top: 4px;
}
.form-error {
  font-size: var(--rds-text-xs);
  color:     var(--rds-danger);
  margin-top: 4px;
}

.form-input {
  width:          100%;
  background:     var(--rds-surface-1);
  border:         1px solid var(--rds-border);
  border-radius:  var(--rds-radius);
  padding:        9px 13px;
  color:          var(--rds-text-primary);
  font-size:      var(--rds-text-sm);
  font-family:    var(--rds-font-sans);
  outline:        none;
  transition:     border-color var(--rds-transition);
  line-height:    1.5;
}
.form-input:focus { border-color: var(--rds-brand); box-shadow: 0 0 0 3px rgba(200,241,53,0.08); }
.form-input:invalid:not(:placeholder-shown) { border-color: var(--rds-danger); }
.form-input::placeholder { color: var(--rds-text-disabled); }
.form-input:disabled { opacity: 0.5; cursor: not-allowed; }
select.form-input option { background: var(--rds-surface-2); color: var(--rds-text-primary); }
textarea.form-input { resize: vertical; min-height: 80px; }

/* Toggle switch */
.rds-toggle {
  position:      relative;
  display:       inline-flex;
  align-items:   center;
  width:  40px; height: 22px;
  background:    var(--rds-border);
  border-radius: var(--rds-radius-full);
  cursor:        pointer;
  transition:    background var(--rds-transition);
  flex-shrink:   0;
}
.rds-toggle.on { background: var(--rds-brand); }
.rds-toggle::after {
  content:       '';
  position:      absolute;
  left:          3px;
  width: 16px; height: 16px;
  border-radius: var(--rds-radius-full);
  background:    white;
  box-shadow:    var(--rds-shadow-sm);
  transition:    left var(--rds-transition);
}
.rds-toggle.on::after { left: 21px; }

/* Checkbox */
.rds-checkbox {
  width: 16px; height: 16px;
  border: 2px solid var(--rds-border);
  border-radius: var(--rds-radius-sm);
  background: var(--rds-surface-1);
  cursor: pointer;
  appearance: none;
  transition: var(--rds-transition);
  position: relative;
  flex-shrink: 0;
}
.rds-checkbox:checked {
  background:    var(--rds-brand);
  border-color:  var(--rds-brand);
}
.rds-checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: -2px; left: 1px;
  font-size: 11px;
  color: var(--rds-text-inverse);
  font-weight: 700;
}


/* ────────────────────────────────────────────────────────────────
   8. TABLE / LIST SYSTEM
   ──────────────────────────────────────────────────────────────── */
.table-row {
  display:       grid;
  align-items:   center;
  padding:       11px var(--rds-space-4);
  border-bottom: 1px solid var(--rds-surface-2);
  font-size:     var(--rds-text-sm);
  color:         var(--rds-text-secondary);
  transition:    background var(--rds-transition);
}
.table-row:hover { background: var(--rds-surface-1); }
.table-row:last-child { border-bottom: none; }
a.table-row, a.table-row:visited { color: var(--rds-text-secondary); text-decoration: none; }
a.table-row:hover { color: var(--rds-text-secondary); }

/* Table column header row */
.table-header {
  display:        grid;
  align-items:    center;
  padding:        8px var(--rds-space-4);
  border-bottom:  1px solid var(--rds-border);
  font-size:      10px;
  font-weight:    700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color:          var(--rds-text-subtle);
}


/* ────────────────────────────────────────────────────────────────
   9. ALERT SYSTEM
   ──────────────────────────────────────────────────────────────── */
.rds-alert {
  display:       flex;
  align-items:   flex-start;
  gap:           var(--rds-space-3);
  padding:       var(--rds-space-3) var(--rds-space-4);
  border-radius: var(--rds-radius);
  font-size:     var(--rds-text-sm);
  border:        1px solid transparent;
  line-height:   1.5;
}
.rds-alert__icon { flex-shrink: 0; font-size: var(--rds-text-md); line-height: 1; }
.rds-alert__body { flex: 1; }
.rds-alert__title { font-weight: 600; margin-bottom: 2px; }

.rds-alert--success { background: var(--rds-success-dim); border-color: var(--rds-success-border); color: var(--rds-success); }
.rds-alert--warning { background: var(--rds-warning-dim); border-color: var(--rds-warning-border); color: var(--rds-warning); }
.rds-alert--danger  { background: var(--rds-danger-dim);  border-color: var(--rds-danger-border);  color: var(--rds-danger);  }
.rds-alert--info    { background: var(--rds-info-dim);    border-color: var(--rds-info-border);    color: var(--rds-info);    }
.rds-alert--accent  { background: var(--rds-brand-dim);   border-color: var(--rds-brand-border);   color: var(--rds-text-accent); }

/* Flash messages (used in flash() helper output) */
.flash-success { background: var(--rds-success-dim); border: 1px solid var(--rds-success-border); color: var(--rds-success); padding: 12px 16px; border-radius: var(--rds-radius); font-size: var(--rds-text-sm); }
.flash-error   { background: var(--rds-danger-dim);  border: 1px solid var(--rds-danger-border);  color: var(--rds-danger);  padding: 12px 16px; border-radius: var(--rds-radius); font-size: var(--rds-text-sm); }


/* ────────────────────────────────────────────────────────────────
   10. EMPTY STATE SYSTEM
   ──────────────────────────────────────────────────────────────── */
.rds-empty {
  display:        flex;
  flex-direction: column;
  align-items:    center;
  justify-content: center;
  text-align:     center;
  padding:        var(--rds-space-10) var(--rds-space-6);
  gap:            var(--rds-space-2);
}
.rds-empty__icon  { font-size: 48px; line-height: 1; margin-bottom: var(--rds-space-2); }
.rds-empty__title { font-size: var(--rds-text-md); font-weight: 600; color: var(--rds-text-primary); }
.rds-empty__body  { font-size: var(--rds-text-sm); color: var(--rds-text-muted); max-width: 340px; line-height: 1.6; }
.rds-empty__actions { margin-top: var(--rds-space-4); display: flex; gap: var(--rds-space-2); flex-wrap: wrap; justify-content: center; }


/* ────────────────────────────────────────────────────────────────
   11. LOADING / SKELETON SYSTEM
   ──────────────────────────────────────────────────────────────── */
@keyframes rdsSkeleton {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.8; }
}

.rds-skeleton {
  background:    var(--rds-surface-3);
  border-radius: var(--rds-radius-sm);
  animation:     rdsSkeleton 1.5s ease-in-out infinite;
}
.rds-skeleton-text  { height: 14px; width: 100%; margin-bottom: 8px; }
.rds-skeleton-title { height: 20px; width: 60%; margin-bottom: 12px; }
.rds-skeleton-circle { border-radius: var(--rds-radius-full); }

/* Loading spinner */
.rds-spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--rds-border);
  border-top-color: var(--rds-brand);
  border-radius: var(--rds-radius-full);
  animation: rdsSpinner 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes rdsSpinner { to { transform: rotate(360deg); } }


/* ────────────────────────────────────────────────────────────────
   12. NAVIGATION SYSTEM
   ──────────────────────────────────────────────────────────────── */
.sidebar-link {
  display:     flex;
  align-items: center;
  gap:         10px;
  padding:     8px 12px;
  border-radius: var(--rds-radius);
  font-size:   var(--rds-text-sm);
  font-weight: 500;
  color:       var(--rds-text-muted);
  text-decoration: none;
  transition:  var(--rds-transition);
  white-space: nowrap;
  overflow:    hidden;
}
.sidebar-link:hover { background: var(--rds-surface-2); color: var(--rds-text-primary); }
.sidebar-link.active { background: var(--rds-surface-2); color: var(--rds-text-accent); }
.sidebar-link svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.8; }
.sidebar-link:hover svg, .sidebar-link.active svg { opacity: 1; }


/* ────────────────────────────────────────────────────────────────
   13. TIRE DISPLAY
   ──────────────────────────────────────────────────────────────── */
.tire-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tire-cell {
  background:    var(--rds-surface-1);
  border:        1px solid var(--rds-border);
  border-radius: var(--rds-radius);
  padding:       8px 10px;
  text-align:    center;
}
.tire-pos { font-size: var(--rds-text-2xs); color: var(--rds-text-disabled); letter-spacing: .1em; text-transform: uppercase; }
.tire-val { font-family: var(--rds-font-mono); font-size: 16px; color: var(--rds-text-accent); font-weight: 700; margin-top: 2px; }


/* ────────────────────────────────────────────────────────────────
   14. PROGRESS BARS
   ──────────────────────────────────────────────────────────────── */
.rds-progress { height: 6px; background: var(--rds-border); border-radius: var(--rds-radius-full); overflow: hidden; }
.rds-progress__fill {
  height: 100%;
  border-radius: var(--rds-radius-full);
  background: var(--rds-brand);
  transition: width 0.4s ease;
}
.rds-progress__fill--success { background: var(--rds-success); }
.rds-progress__fill--warning { background: var(--rds-warning); }
.rds-progress__fill--danger  { background: var(--rds-danger); }
.rds-progress--sm { height: 4px; }
.rds-progress--lg { height: 8px; }


/* ────────────────────────────────────────────────────────────────
   15. MOTION & TRANSITIONS
   ──────────────────────────────────────────────────────────────── */
/* Subtle card lift on hover */
.rds-lift {
  transition: transform var(--rds-transition), box-shadow var(--rds-transition);
}
.rds-lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--rds-shadow);
}

/* Fade in for newly mounted elements */
@keyframes rdsFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.rds-fade-in { animation: rdsFadeIn 0.2s ease forwards; }

/* Slide in from right (modals, panels) */
@keyframes rdsSlideIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.rds-slide-in { animation: rdsSlideIn 0.2s ease forwards; }


/* ────────────────────────────────────────────────────────────────
   16. MOBILE-FIRST RESPONSIVE
   ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root {
    --rds-text-base: 15px;
    --rds-text-sm:   14px;
  }

  /* Sidebar mobile */
  #sidebar {
    display:  none;
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index:  var(--rds-z-modal);
    width:    240px;
  }
  #sidebar.open { display: flex; }
  #mobile-overlay {
    display:    none;
    position:   fixed;
    inset:      0;
    background: rgba(0,0,0,0.65);
    z-index:    calc(var(--rds-z-modal) - 10);
  }
  #mobile-overlay.open { display: block; }
  #main-content { margin-left: 0 !important; }

  /* Larger touch targets on mobile */
  .btn { min-height: 42px; }
  .sidebar-link { padding: 10px 12px; }
  .table-row { padding: 12px var(--rds-space-3); }
}

/* Minimum touch target size */
.rds-touch-target {
  min-width:  44px;
  min-height: 44px;
  display:    flex;
  align-items: center;
  justify-content: center;
}
