/* =============================================================================
   RAVEN UI, shared design-system stylesheet
   Extracted from driver-admin.html, driver-profile.html, driver-share.html,
   driver-results.html (2026-05-27).

   Token namespace: --bg, --bg2, --card, --card2, --fg, --dim, --faint,
   --rule, --rule2, --alpha, --green, --amber, --bravo, --ui, --mono.

   This sheet is additive. It does NOT modify existing pages. Pages may link
   this sheet alongside their own inline <style> blocks.
   ============================================================================= */


/* =============================================================================
   1. DESIGN TOKENS (CSS custom properties)
   ============================================================================= */

:root {
  /* -- Backgrounds -------------------------------------------------------- */
  --bg:    #000000;          /* page/body background                          */
  --bg2:   #0d0d0d;          /* subtle elevated surface (th, empty sections)  */
  --card:  #141414;          /* card / panel surface                          */
  --card2: #1a1a1a;          /* card inner / hover / input background         */

  /* -- Text --------------------------------------------------------------- */
  --fg:    #ffffff;          /* primary text                                  */
  --dim:   #cccccc;          /* secondary text (labels, descriptions)         */
  --faint: #777777;          /* tertiary / placeholder / disabled             */

  /* -- Rules / borders ---------------------------------------------------- */
  --rule:  #222222;          /* subtle divider (table rows)                   */
  --rule2: #2e2e2e;          /* stronger divider (card borders, form inputs)  */

  /* -- Brand accent ------------------------------------------------------- */
  --alpha: #ff4433;          /* Raven alpha red, primary CTA, topbar border  */

  /* -- Team colours ------------------------------------------------------- */
  --team-alpha: #ff4433;     /* Alpha kart, red                              */
  --team-bravo: #4d9fff;     /* Bravo kart, blue                             */
  --team-omega: #fbbf24;     /* Omega / third kart, amber                    */
  --team-mgmt:  #777777;     /* Management / unassigned, grey (== --faint)   */

  /* -- Status colours ----------------------------------------------------- */
  --green: #30d970;          /* success / paid / active / online              */
  --amber: #fbbf24;          /* warning / partial / FCY flag                  */
  --red:   #e53020;          /* error / danger / red flag (distinct from      */
                             /* --alpha which is brand; --red is severity)    */

  /* -- Typography --------------------------------------------------------- */
  --ui:   'Rajdhani', 'Segoe UI', system-ui, Arial, sans-serif;
  --mono: ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas, monospace;

  /* -- Spacing scale ------------------------------------------------------ */
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 12px;
  --sp-lg: 16px;
  --sp-xl: 24px;

  /* -- Radius scale ------------------------------------------------------- */
  --r-sm:  5px;   /* badge, small chips                                       */
  --r-md:  8px;   /* inputs, buttons, small cards                             */
  --r-lg:  10px;  /* cards, grid-wraps                                        */
  --r-xl:  14px;  /* modals, login card                                       */

  /* -- Transitions -------------------------------------------------------- */
  --t-fast: 0.15s;
  --t-norm: 0.25s;

  /* -- Breakpoints (for documentation, used in media queries below) ------ */
  /* --bp-mobile: 600px  -- small tweaks (padding, hide secondary elements)  */
  /* --bp-card:   720px  -- tables reflow to cards; 44px touch targets       */
}


/* =============================================================================
   2. BASE RESET
   ============================================================================= */

*, *::before, *::after {
  box-sizing: border-box;
}

.raven-page {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--ui);
  -webkit-text-size-adjust: 100%;
}


/* =============================================================================
   3. TOPBAR / HEADER   (.hdr)
   Sticky, full-width, 3px alpha-red bottom border.
   ============================================================================= */

.hdr {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: #000;
  border-bottom: 3px solid var(--alpha);
  position: sticky;
  top: 0;
  z-index: 100;
}

.hdr img {
  height: 36px;
  width: auto;
}

/* Eyebrow label above the page title */
.hdr .t {
  font-size: 12px;
  letter-spacing: 4px;
  color: var(--faint);
  text-transform: uppercase;
}

/* Page / section title */
.hdr .s {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 1.5px;
  line-height: 1;
  margin-top: 2px;
}

.hdr-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

@media (max-width: 600px) {
  .hdr {
    padding: 10px 14px;
  }
  .hdr-manager {
    display: none;
  }
}


/* =============================================================================
   4. TAB BAR   (.tabs, .tab-btn)
   Sticky below the header. Always scrollable so tabs never wrap.
   Active tab uses alpha-red underline.
   ============================================================================= */

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--rule2);
  padding: 0 16px;
  background: #000;
  position: sticky;
  top: 67px;         /* header height: 14+36+14+3 border = ~67px */
  z-index: 90;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  color: var(--faint);
  font-family: var(--ui);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  padding: 14px 18px;
  white-space: nowrap;
  transition: color var(--t-fast), border-color var(--t-fast);
}

.tab-btn:hover {
  color: var(--dim);
}

.tab-btn.active {
  color: var(--alpha);
  border-bottom-color: var(--alpha);
}

.tab-pane {
  display: none;
  padding: 20px 16px 60px;
  max-width: 1200px;
  margin: 0 auto;
}

.tab-pane.active {
  display: block;
}

@media (max-width: 600px) {
  .tab-btn {
    padding: 12px 13px;
    font-size: 13px;
  }
  .tab-pane {
    padding: 14px 10px 50px;
  }
}


/* =============================================================================
   5. SECTION HEADING   (.sec-head)
   Flex row with left alpha-red bar on the h2.
   ============================================================================= */

.sec-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule2);
}

.sec-head h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1.5px;
  margin: 0;
  padding-left: 11px;
  border-left: 4px solid var(--alpha);
}

.sec-head .ml {
  margin-left: auto;
}


/* =============================================================================
   6. STAT TILES   (.stats-grid, .stat-tile)
   Responsive grid of metric tiles. Colour modifiers: .accent .green .amber
   ============================================================================= */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-tile {
  background: var(--card);
  border: 1px solid var(--rule2);
  border-radius: var(--r-lg);
  padding: 16px 14px;
  text-align: center;
}

.stat-tile .val {
  font-size: 26px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--fg);
  line-height: 1.1;
  word-break: break-all;
}

/* Smaller variant for longer values (e.g. lap times) */
.stat-tile .val-lg {
  font-size: 20px;
}

.stat-tile .lbl {
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 5px;
}

/* Colour modifiers */
.stat-tile.accent .val { color: var(--alpha); }
.stat-tile.green  .val { color: var(--green); }
.stat-tile.amber  .val { color: var(--amber); }

@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}


/* =============================================================================
   7. TEAM CHIPS   (.team-chip)
   Inline badge / pill identifying team membership.
   Per-team modifier classes: .chip-alpha .chip-bravo .chip-omega .chip-mgmt
   ============================================================================= */

.team-chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--r-sm);
  padding: 2px 8px;
  letter-spacing: 0.5px;
}

.chip-alpha { background: #3a0a07; color: var(--team-alpha); }
.chip-bravo { background: #0a1a3a; color: var(--team-bravo); }
.chip-omega { background: #1a1a00; color: var(--team-omega); }
.chip-mgmt  { background: #1a1a1a; color: var(--team-mgmt); }

/* Status chips (reuse the same shape) */
.chip-active   { background: #0a2010; color: var(--green); }
.chip-inactive { background: #1a1a1a; color: var(--faint); }
.chip-admin    { background: #2a0f0c; color: #ff9988; }
.chip-manager  { background: #0a2010; color: var(--green); }

/* Legacy class aliases (used in existing pages as .badge-*) */
.badge-alpha   { background: #3a0a07; color: var(--team-alpha); }
.badge-bravo   { background: #0a1a3a; color: var(--team-bravo); }
.badge-omega   { background: #1a1a00; color: var(--team-omega); }
.badge-mgmt    { background: #1a1a1a; color: var(--faint); }
.badge-active  { background: #0a2010; color: var(--green); }
.badge-inactive{ background: #1a1a1a; color: var(--faint); }
.badge-admin   { background: #2a0f0c; color: #ff9988; }
.badge-manager { background: #0a2010; color: var(--green); }

.badge,
.team-chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--r-sm);
  padding: 2px 8px;
  letter-spacing: 0.5px;
}


/* =============================================================================
   8. CARDS   (.card)
   Generic content card with border and radius. Used for stat panels,
   info sections, race history entries.
   ============================================================================= */

.card {
  background: var(--card);
  border: 1px solid var(--rule2);
  border-radius: var(--r-xl);
  padding: 24px;
  margin-bottom: 24px;
}

/* Smaller card variant */
.card-sm {
  border-radius: var(--r-lg);
  padding: 18px 20px;
  margin-bottom: 14px;
}

/* Card header row inside a card */
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}


/* =============================================================================
   9. RACE CARD   (.race-card)
   Specific card pattern for race history entries.
   ============================================================================= */

.race-card {
  background: var(--card);
  border: 1px solid var(--rule2);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  margin-bottom: 14px;
}

.race-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.race-card-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.race-card-date {
  font-size: 13px;
  color: var(--faint);
  font-family: var(--mono);
}

.race-card-pos {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--alpha);
  background: #1a0505;
  border: 1px solid #3a1010;
  border-radius: 6px;
  padding: 2px 12px;
}

.race-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.race-stat {
  flex: 1 1 90px;
}

.race-stat .rs-val {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--fg);
}

.race-stat .rs-lbl {
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 2px;
}


/* =============================================================================
   10. HERO BLOCK   (.hero)
   Full-width driver hero: photo + name + meta on the profile page.
   ============================================================================= */

.hero {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--rule2);
  border-radius: var(--r-xl);
  padding: 24px;
  margin-bottom: 24px;
}

.hero-photo {
  width: 140px;
  height: 140px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--card2);
  border: 2px solid var(--rule2);
}

.hero-photo-placeholder {
  width: 140px;
  height: 140px;
  border-radius: 12px;
  flex-shrink: 0;
  background: var(--card2);
  border: 2px solid var(--rule2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
  font-size: 48px;
}

.hero-info {
  flex: 1 1 200px;
  min-width: 0;
}

.hero-name {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 1px;
  margin: 0 0 4px;
  line-height: 1.1;
}

.hero-display {
  font-size: 16px;
  color: var(--faint);
  margin: 0 0 12px;
  letter-spacing: 0.5px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.hero-role {
  color: var(--dim);
  font-size: 14px;
  font-weight: 600;
}

.race-num {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--alpha);
  background: #1a0505;
  border: 1px solid #3a1010;
  border-radius: 6px;
  padding: 2px 10px;
  line-height: 1.3;
}

@media (max-width: 600px) {
  .hero {
    padding: 16px;
    gap: 16px;
  }
  .hero-photo,
  .hero-photo-placeholder {
    width: 100px;
    height: 100px;
  }
  .hero-name {
    font-size: 22px;
  }
}


/* =============================================================================
   11. INFO GRID   (.info-grid, .info-item)
   Responsive key/value grid used on profile pages (personal, kit sections).
   ============================================================================= */

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  background: var(--card);
  border: 1px solid var(--rule2);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 24px;
}

.info-item .info-label {
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.info-item .info-value {
  font-size: 15px;
  color: var(--fg);
  font-weight: 600;
  word-break: break-word;
}

.info-item .info-value.empty {
  color: var(--faint);
  font-style: italic;
  font-weight: 400;
}

@media (max-width: 600px) {
  .info-grid {
    grid-template-columns: 1fr 1fr;
  }
}


/* =============================================================================
   12. BUTTONS   (.btn, .btn-sm, .btn-ghost, .btn-danger, .btn-icon)

   Touch targets:
     .btn       -- primary CTA, 11px top/bottom padding (44px+ with text)
     .btn-sm    -- compact, e.g. section actions
     .btn-ghost -- secondary / outline
     .btn-danger-- destructive action (transparent, red border)
     .btn-icon  -- icon-only, no border; 44x44 min on mobile
   ============================================================================= */

.btn {
  background: var(--alpha);
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  padding: 11px 20px;
  font-family: var(--ui);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.8px;
  cursor: pointer;
  transition: opacity var(--t-fast);
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn:hover:not(:disabled) {
  opacity: 0.88;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 13px;
}

.btn-ghost {
  background: transparent;
  color: var(--dim);
  border: 1px solid var(--rule2);
  border-radius: var(--r-md);
  padding: 9px 16px;
  font-family: var(--ui);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast);
}

.btn-ghost:hover {
  border-color: var(--faint);
  color: var(--fg);
}

.btn-danger {
  background: transparent;
  color: #ff6655;
  border: 1px solid #662222;
  border-radius: var(--r-md);
  padding: 7px 13px;
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast);
}

.btn-danger:hover {
  background: #2a0a0a;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--faint);
  padding: 4px 6px;
  font-size: 16px;
  border-radius: var(--r-sm);
  transition: color var(--t-fast), background var(--t-fast);
}

.btn-icon:hover {
  color: var(--fg);
  background: var(--rule2);
}

/* 44x44 minimum touch targets on mobile (WCAG 2.5.5) */
@media (max-width: 720px) {
  .btn-icon {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    padding: 0;
  }
}


/* =============================================================================
   13. FORMS   (.field, .form-row, inputs, select, textarea, .check-row)
   ============================================================================= */

.field {
  margin: 0 0 16px;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  color: var(--dim);
}

input[type=text],
input[type=email],
input[type=password],
input[type=date],
input[type=number],
textarea,
select {
  width: 100%;
  background: var(--card2);
  color: var(--fg);
  border: 1px solid var(--rule2);
  border-radius: var(--r-md);
  padding: 11px 13px;
  font-family: var(--ui);
  font-size: 15px;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--alpha);
}

input[type=checkbox] {
  width: auto;
  margin-right: 8px;
  accent-color: var(--alpha);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  cursor: pointer;
}

/* Multi-column form row */
.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.form-row .field {
  flex: 1 1 160px;
}

/* Prevent iOS auto-zoom on focus (font-size must be >= 16px) */
@media (max-width: 720px) {
  input[type=text],
  input[type=email],
  input[type=password],
  input[type=date],
  input[type=number],
  textarea,
  select {
    font-size: 16px;
  }

  .form-row .field {
    flex: 1 1 100%;
  }
}


/* =============================================================================
   14. MODAL   (.modal-bg, .modal, .modal-footer)
   Full-screen dark overlay with centred content panel.
   Open state: .modal-bg.open
   ============================================================================= */

.modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.modal-bg.open {
  display: flex;
}

.modal {
  background: var(--card);
  border: 1px solid var(--rule2);
  border-radius: var(--r-xl);
  padding: 28px 24px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  margin: 0 0 20px;
}

.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .modal {
    padding: 22px 16px;
  }
}


/* =============================================================================
   15. TABLES   (.tbl-wrap, table, th, td)
   Standard data table with hover rows.
   ============================================================================= */

.tbl-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  background: var(--bg2);
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 10px 12px;
  border-bottom: 2px solid var(--rule2);
  text-align: left;
  white-space: nowrap;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--card2);
}


/* =============================================================================
   16. TABLE -> CARD REFLOW AT 720px
   The 720px breakpoint is the Raven convention for table-to-card transitions.

   Usage: mark <table> cells with data-label="Col header".
   The CSS shows those labels as ::before pseudo-headings in card layout.

   To activate for a specific table, add the class .reflow-720 to the <table>
   element. (Or scope per table-id as driver-admin.html does.)

   Example HTML:
     <table class="reflow-720">
       <thead><tr><th>Name</th><th>Team</th><th>Actions</th></tr></thead>
       <tbody>
         <tr>
           <td data-label="Name">Jane</td>
           <td data-label="Team">Alpha</td>
           <td class="cell-actions-mob">...buttons...</td>
         </tr>
       </tbody>
     </table>
   ============================================================================= */

@media (max-width: 720px) {
  table.reflow-720 thead {
    display: none;
  }

  table.reflow-720,
  table.reflow-720 tbody,
  table.reflow-720 tr,
  table.reflow-720 td {
    display: block;
    width: 100%;
  }

  table.reflow-720 tr {
    background: var(--card);
    border: 1px solid var(--rule2);
    border-radius: var(--r-lg);
    margin-bottom: 12px;
    padding: 12px 14px;
  }

  /* Remove hover background so the card stays clean */
  table.reflow-720 tr:hover td {
    background: transparent;
  }

  table.reflow-720 td {
    padding: 5px 0;
    border: none;
    font-size: 14px;
  }

  /* data-label pseudo-headings */
  table.reflow-720 td[data-label]::before {
    content: attr(data-label) ": ";
    color: var(--faint);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    display: inline;
  }

  /* Actions cell: full-width row of tap targets */
  table.reflow-720 td.cell-actions-mob {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--rule);
  }

  table.reflow-720 td.cell-actions-mob::before {
    display: none;
  }

  /* Primary action in the actions cell: full-width prominent button */
  table.reflow-720 td.cell-actions-mob .mob-primary-action {
    flex: 1 1 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--alpha);
    color: #fff;
    text-decoration: none;
    border-radius: var(--r-md);
    padding: 12px 16px;
    font-family: var(--ui);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
    min-height: 44px;
    border: none;
    cursor: pointer;
  }

  table.reflow-720 td.cell-actions-mob .mob-primary-action:hover {
    opacity: 0.88;
  }
}


/* =============================================================================
   17. TOAST NOTIFICATION   (#toast or .toast)
   Fixed bottom-center, slides up when .show is added.
   .ok = green success  .err = red error
   ============================================================================= */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--card);
  border: 1px solid var(--rule2);
  border-radius: var(--r-lg);
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  z-index: 9999;
  transition: transform var(--t-norm) ease;
  min-width: 200px;
  text-align: center;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.ok  { border-color: #30d97066; color: var(--green); }
.toast.err { border-color: #ff443366; color: #ff9988; }


/* =============================================================================
   18. INLINE ERROR   (.err-msg)
   Block-level error below a form field or form section.
   ============================================================================= */

.err-msg {
  background: #2a0f0c;
  border: 1px solid #662222;
  color: #ffb3a8;
  border-radius: var(--r-md);
  padding: 9px 14px;
  font-size: 13.5px;
  margin: 8px 0;
  display: none;
}

.err-msg.show {
  display: block;
}


/* =============================================================================
   19. SPINNER   (.spinner)
   Centred loading indicator.
   ============================================================================= */

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--rule2);
  border-top-color: var(--alpha);
  border-radius: 50%;
  animation: raven-spin 0.7s linear infinite;
  margin: 40px auto;
  display: block;
}

@keyframes raven-spin {
  to { transform: rotate(360deg); }
}


/* =============================================================================
   20. TOTALS BAR   (.totals-bar, .tot)
   Summary row of large metric values (payments overview).
   ============================================================================= */

.totals-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0 0 20px;
  background: var(--card);
  border: 1px solid var(--rule2);
  border-radius: var(--r-lg);
  padding: 16px 18px;
}

.totals-bar .tot {
  flex: 1 1 120px;
}

.totals-bar .tot .lbl {
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.totals-bar .tot .val {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--mono);
}

.tot-collected   .val { color: var(--green); }
.tot-outstanding .val { color: var(--alpha); }
.tot-expected    .val { color: var(--dim); }


/* =============================================================================
   21. PAYMENT STATUS COLOURS
   Used in table cells to show paid / partial / unpaid states.
   ============================================================================= */

.cell-paid    { color: var(--green); font-weight: 700; }
.cell-partial { color: var(--amber); font-weight: 600; }
.cell-none    { color: var(--faint); }
.cell-na      { color: #333; font-style: italic; }


/* =============================================================================
   22. EMPTY STATE   (.empty, .empty-state)
   Centred placeholder text when a list or section has no content.
   ============================================================================= */

.empty {
  color: var(--faint);
  font-size: 14px;
  font-style: italic;
  padding: 24px 0;
  text-align: center;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--faint);
  font-size: 15px;
  font-style: italic;
}


/* =============================================================================
   23. BACK LINK   (.back-link)
   Navigation link used at the top of sub-pages (e.g. driver profile).
   ============================================================================= */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--faint);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-decoration: none;
  margin-bottom: 24px;
  transition: color var(--t-fast);
}

.back-link:hover {
  color: var(--dim);
}


/* =============================================================================
   24. PAGE WRAPPER   (.page)
   Centered content with standard padding and bottom breathing room.
   ============================================================================= */

.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

@media (max-width: 600px) {
  .page {
    padding: 14px 10px 60px;
  }
}


/* =============================================================================
   25. GRID WRAP   (.grid-wrap)
   Scrollable container for wide tabular grids (payments matrix).
   ============================================================================= */

.grid-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--rule2);
  border-radius: var(--r-lg);
}

.grid-table {
  border-collapse: collapse;
  font-size: 13px;
}

.grid-table th,
.grid-table td {
  border: 1px solid var(--rule);
  padding: 8px 10px;
  white-space: nowrap;
}

.grid-table th {
  background: var(--bg2);
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Sticky first-column driver name */
.grid-table .col-driver {
  position: sticky;
  left: 0;
  z-index: 5;
  background: var(--bg2);
  min-width: 130px;
}

.grid-table td.col-driver {
  background: var(--card);
  font-weight: 600;
  font-size: 13.5px;
}

.grid-table tr:hover td.col-driver {
  background: var(--card2);
}

.totals-row td {
  background: var(--bg2);
  font-weight: 700;
  font-size: 13.5px;
  border-top: 2px solid var(--rule2);
}

.team-row td {
  background: #111;
  font-weight: 700;
  color: var(--faint);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
}


/* =============================================================================
   26. LOGIN CARD   (.login-card)
   Standalone auth screen card, max-width 380px, centered.
   ============================================================================= */

.login-card {
  background: var(--card);
  border: 1px solid var(--rule2);
  border-radius: var(--r-xl);
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
}

.login-card h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1.5px;
  margin: 0 0 6px;
}

.login-card .sub {
  color: var(--faint);
  font-size: 13.5px;
  margin: 0 0 24px;
}


/* =============================================================================
   27. TOGGLE BUTTON   (.toggle-visible)
   Small pill-shaped toggle used on installment chips to show/hide columns.
   ============================================================================= */

.toggle-visible {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 11px;
  color: var(--faint);
  border: 1px solid var(--rule2);
  border-radius: var(--r-sm);
  padding: 3px 8px;
  font-family: var(--mono);
  transition: all var(--t-fast);
  background: none;
}

.toggle-visible:hover {
  border-color: var(--faint);
  color: var(--dim);
}

.toggle-visible.vis {
  color: var(--green);
  border-color: #30d97055;
}


/* =============================================================================
   28. FONT REFERENCE
   Loaded from Google Fonts by each page:
     <link href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700&display=swap" rel="stylesheet">

   Weights used: 500 (body), 600 (labels/tab-btn), 700 (headings/btn/hero-name)
   ============================================================================= */
