/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red:      #e10600;
  --red-dim:  rgba(225,6,0,0.15);
  --bg:       #0f0f0f;
  --surface:  #1a1a1a;
  --surface2: #252525;
  --border:   #2a2a2a;
  --border2:  #333;
  --text:     #ffffff;
  --text2:    #aaaaaa;
  --text3:    #666666;
  --green:    #2ea043;
  --green-bg: #1a2e1a;
  --green-bd: #2ea043;
  --orange:   #ff8c00;
  --orange-bg:#2e1f00;
  --blue:     #3671C6;
  --blue-bg:  #1a1a2e;
  --blue-bd:  #3671C6;
  --gold:     #FFD700;
  --silver:   #C0C0C0;
  --bronze:   #CD7F32;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
ul { list-style: none; }

/* ─── Navbar ────────────────────────────────────────────────────────────────── */
.navbar {
  background: var(--surface);
  border-bottom: 3px solid var(--red);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.5px;
  color: var(--text);
}
.nav-icon { font-size: 24px; }
.year { color: var(--red); }
.nav-right { display: flex; align-items: center; gap: 16px; }
.nav-user { color: var(--text2); font-size: 14px; }
.nav-user strong { color: var(--text); }

/* ─── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  padding: 11px 24px;
  transition: opacity 0.15s, transform 0.1s;
  letter-spacing: 0.3px;
}
.btn:hover { opacity: 0.9; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary  { background: var(--red); color: #fff; }
.btn-ghost    { background: transparent; border: 1px solid var(--border2); color: var(--text2); }
.btn-ghost:hover { border-color: #555; color: var(--text); }
.btn-sm       { padding: 7px 16px; font-size: 13px; border-radius: 6px; }
.btn-full     { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ─── Flash Messages ────────────────────────────────────────────────────────── */
.flash-container {
  max-width: 500px;
  margin: 16px auto 0;
  padding: 0 24px;
}
.flash {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
}
.flash-success { background: var(--green-bg); border: 1px solid var(--green-bd); color: #4caf50; }
.flash-error   { background: #2e1a1a; border: 1px solid #e10600; color: #ff6b6b; }

/* ─── Auth ───────────────────────────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.auth-header {
  background: var(--red);
  padding: 32px 32px 24px;
  text-align: center;
}
.auth-icon  { font-size: 40px; margin-bottom: 8px; }
.auth-title { font-size: 22px; font-weight: 800; letter-spacing: 1px; color: #fff; }
.auth-sub   { color: rgba(255,255,255,0.75); font-size: 13px; margin-top: 4px; }

.auth-tabs {
  display: flex;
  background: #111;
}
.auth-tab {
  flex: 1;
  padding: 14px 0;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text3);
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.auth-tab.active {
  color: var(--red);
  border-bottom-color: var(--red);
  background: var(--surface);
}
.auth-tab:hover:not(.active) { color: var(--text2); }

.auth-body { padding: 28px 32px 32px; }

.form-group { margin-bottom: 12px; }
.form-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.form-input:focus { border-color: var(--red); }
.form-input::placeholder { color: var(--text3); }

.auth-switch {
  text-align: center;
  margin-top: 16px;
  color: var(--text3);
  font-size: 13px;
}
.auth-switch a { color: var(--red); font-weight: 600; }
.auth-switch a:hover { text-decoration: underline; }

.alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 14px;
  text-align: center;
}
.alert-error   { background: #2e1a1a; border: 1px solid var(--red); color: #ff6b6b; }
.alert-success { background: var(--green-bg); border: 1px solid var(--green-bd); color: #4caf50; }

/* ─── Page Wrap ─────────────────────────────────────────────────────────────── */
.page-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}
.page-header { margin-bottom: 32px; }
.page-header h2 { font-size: 24px; font-weight: 700; }
.page-header p  { color: var(--text3); font-size: 14px; margin-top: 4px; }

/* ─── Dashboard Race Grid ─────────────────────────────────────────────────────── */
.race-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}
.race-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.race-card:hover {
  border-color: var(--red);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px var(--red-dim);
}
.race-card.submitted { border-color: var(--red); }

.race-card-accent {
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--border);
  transition: background 0.2s;
}
.race-card.submitted .race-card-accent,
.race-card:hover .race-card-accent { background: var(--red); }

.race-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  padding-left: 12px;
}
.race-round { color: var(--text3); font-size: 12px; font-weight: 700; }
.badge-group { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.badge {
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  padding: 2px 8px;
  border: 1px solid;
}
.badge-open         { background: var(--green-bg); border-color: var(--green-bd); color: #4caf50; }
.badge-closing_soon { background: var(--orange-bg); border-color: var(--orange); color: var(--orange); }
.badge-locked       { background: #222; border-color: #444; color: #666; }
.badge-completed    { background: var(--blue-bg); border-color: var(--blue-bd); color: var(--blue); }
.badge-scored       { background: var(--blue-bg); border-color: var(--blue-bd); color: var(--blue); }

.race-flag    { font-size: 28px; margin-bottom: 6px; padding-left: 12px; }
.race-name    { color: var(--text); font-size: 16px; font-weight: 700; padding-left: 12px; }
.race-circuit { color: var(--text3); font-size: 12px; margin-top: 2px; padding-left: 12px; }
.race-lock    { color: var(--text3); font-size: 12px; margin-top: 10px; padding-left: 12px; }
.race-cta     { font-size: 12px; font-weight: 600; margin-top: 10px; padding-left: 12px; }
.race-cta.submitted { color: #4caf50; }
.race-cta.open      { color: var(--red); }
.race-cta.scored    { color: var(--blue); }

/* ─── Predict Page ──────────────────────────────────────────────────────────── */
.predict-wrap { min-height: 100vh; }

.predict-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 64px;
  z-index: 50;
}
.predict-header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.predict-race-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  flex: 1;
  justify-content: center;
}
.predict-flag { font-size: 22px; }
.predict-actions { display: flex; align-items: center; gap: 8px; }
.locked-badge {
  background: var(--surface2);
  border-radius: 8px;
  padding: 8px 14px;
  color: var(--text3);
  font-size: 13px;
  font-weight: 600;
}

.predict-body {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
}

/* Score Card */
.score-card {
  background: var(--blue-bg);
  border: 1px solid var(--blue-bd);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.score-label { color: var(--blue); font-size: 12px; font-weight: 700; letter-spacing: 1px; }
.score-total { color: var(--text); font-size: 42px; font-weight: 800; margin-top: 2px; }
.score-unit  { font-size: 16px; color: var(--text3); font-weight: 400; }
.score-sections { display: flex; gap: 28px; flex-wrap: wrap; }
.score-section { text-align: center; }
.score-section-val  { color: var(--text); font-size: 22px; font-weight: 700; }
.score-section-name { color: var(--text3); font-size: 11px; margin-top: 2px; line-height: 1.3; }

/* Info Banner */
.info-banner {
  background: var(--green-bg);
  border: 1px solid var(--green-bd);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  color: #4caf50;
  font-size: 13px;
}

/* Tabs */
.tabs {
  display: flex;
  background: var(--surface);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 16px;
  gap: 4px;
}
.tab {
  flex: 1;
  padding: 10px 8px;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--text3);
  font-weight: 700;
  font-size: 12px;
  line-height: 1.4;
  transition: all 0.15s;
}
.tab span { display: block; font-weight: 400; opacity: 0.8; }
.tab.active { background: var(--red); color: #fff; }
.tab:hover:not(.active) { color: var(--text2); background: var(--surface2); }

/* Legend */
.legend {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 12px;
  flex-wrap: wrap;
}
.legend-item       { color: var(--text3); }
.legend-item.exact { color: #4caf50; }
.legend-item.near1 { color: var(--orange); }
.legend-item.near2 { color: #e1c700; }
.legend-item.miss  { color: #444; }

/* List panels */
.list-panel { display: none; }
.list-panel.active { display: block; }

/* Sort items */
.sortable-list { display: flex; flex-direction: column; gap: 4px; }

.sort-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  user-select: none;
  transition: border-color 0.1s, box-shadow 0.1s;
}
.sort-item:not([data-disabled="true"]):hover { border-color: var(--border2); }
.sort-item.sortable-ghost { opacity: 0.3; }
.sort-item.sortable-chosen { box-shadow: 0 4px 20px rgba(225,6,0,0.2); }

/* Accuracy colour states */
.sort-item.acc-exact { border-color: rgba(46,160,67,0.5); background: rgba(46,160,67,0.05); }
.sort-item.acc-near1 { border-color: rgba(255,140,0,0.4); background: rgba(255,140,0,0.05); }
.sort-item.acc-near2 { border-color: rgba(225,199,0,0.35); }

.sort-pos {
  width: 30px;
  height: 30px;
  background: #111;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.driver-color-bar {
  width: 4px;
  height: 30px;
  border-radius: 2px;
  flex-shrink: 0;
}
.sort-info { flex: 1; min-width: 0; }
.sort-name {
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sort-sub { color: var(--text3); font-size: 12px; }

.sort-accuracy {
  text-align: right;
  flex-shrink: 0;
  min-width: 50px;
  font-size: 12px;
  font-weight: 700;
}
.sort-accuracy .acc-pos  { color: var(--text3); }
.sort-accuracy .acc-diff { font-size: 11px; }
.acc-exact-text  { color: #4caf50; }
.acc-near1-text  { color: var(--orange); }
.acc-near2-text  { color: #e1c700; }

.sort-handle {
  color: var(--border2);
  font-size: 18px;
  flex-shrink: 0;
  cursor: grab;
  line-height: 1;
}
[data-disabled="true"] .sort-handle { display: none; cursor: default; }

/* ─── Save button feedback ──────────────────────────────────────────────────── */
#save-btn.saving  { opacity: 0.6; cursor: not-allowed; }
#save-btn.success { background: #2ea043; }

/* ─── Toast ─────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 1000;
  transition: opacity 0.3s;
}
.toast.hidden { opacity: 0; pointer-events: none; }
.toast.toast-success { border-color: #2ea043; color: #4caf50; }
.toast.toast-error   { border-color: var(--red);   color: #ff6b6b; }

/* ─── Back Link ─────────────────────────────────────────────────────────────── */
.back-link {
  color: var(--text3);
  font-size: 14px;
  transition: color 0.15s;
  white-space: nowrap;
}
.back-link:hover { color: var(--text); }

/* ─── Leaderboard ─────────────────────────────────────────────────────────────── */
.lb-header { margin-bottom: 28px; }
.lb-header h2 { font-size: 24px; font-weight: 700; }
.lb-header p  { color: var(--text3); font-size: 14px; margin-top: 4px; }

.lb-list { display: flex; flex-direction: column; gap: 12px; max-width: 800px; }

.lb-row {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 24px;
  transition: border-color 0.15s;
}
.lb-row.is-me { border-color: var(--red); }
.lb-row.top-1 { border-color: rgba(255,215,0,0.4); }
.lb-row.top-2 { border-color: rgba(192,192,192,0.3); }
.lb-row.top-3 { border-color: rgba(205,127,50,0.3); }

.lb-rank {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #111;
  border: 2px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: var(--text3);
  flex-shrink: 0;
}
.lb-rank.gold   { border-color: var(--gold);   color: var(--gold);   background: rgba(255,215,0,0.1); }
.lb-rank.silver { border-color: var(--silver); color: var(--silver); background: rgba(192,192,192,0.1); }
.lb-rank.bronze { border-color: var(--bronze); color: var(--bronze); background: rgba(205,127,50,0.1); }

.lb-user { flex: 1; }
.lb-username { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.you-tag {
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  padding: 2px 6px;
  letter-spacing: 0.5px;
}
.lb-breakdown { display: flex; gap: 14px; margin-top: 6px; flex-wrap: wrap; }
.lb-breakdown span { color: var(--text3); font-size: 12px; }
.lb-breakdown strong { color: var(--text2); }

.lb-score { font-size: 28px; font-weight: 800; flex-shrink: 0; color: var(--text); }
.lb-score.gold-text { color: var(--gold); }
.lb-pts { font-size: 13px; color: var(--text3); font-weight: 400; }

.empty-state { text-align: center; padding: 80px 0; color: var(--text3); }
.empty-icon  { font-size: 52px; margin-bottom: 16px; }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .predict-race-title { font-size: 13px; }
  .score-card { flex-direction: column; }
  .score-sections { gap: 16px; }
  .race-grid { grid-template-columns: 1fr; }
  .lb-breakdown { flex-direction: column; gap: 4px; }
  .tabs { gap: 2px; }
  .tab { font-size: 11px; padding: 8px 4px; }
}

/* ─── Nav Center Links ───────────────────────────────────────────────────────── */
.nav-center {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-link {
  padding: 6px 14px;
  color: var(--text3);
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  transition: all 0.15s;
}
.nav-link:hover { color: var(--text); background: var(--surface2); }

/* ─── Event Type Badges (inline) ─────────────────────────────────────────────── */
.event-type-badge {
  font-size: 11px;
  font-weight: 800;
  border-radius: 5px;
  padding: 3px 8px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.sprint-badge {
  background: rgba(130,60,200,0.2);
  border: 1px solid #823cc8;
  color: #b06de8;
}
.test-badge {
  background: rgba(60,160,200,0.15);
  border: 1px solid #3ca0c8;
  color: #5ac0e8;
}

/* ─── Card Type Badges ───────────────────────────────────────────────────────── */
.badge-type-sprint {
  background: rgba(130,60,200,0.2);
  border-color: #823cc8;
  color: #b06de8;
}
.badge-type-test {
  background: rgba(60,160,200,0.15);
  border-color: #3ca0c8;
  color: #5ac0e8;
}

/* ─── Card accent variants ───────────────────────────────────────────────────── */
.race-card.sprint-card:hover { box-shadow: 0 8px 32px rgba(130,60,200,0.2); }
.race-card.sprint-card:hover .race-card-accent,
.race-card.sprint-card.submitted .race-card-accent { background: #823cc8; }
.race-card-accent.accent-sprint { background: #823cc8; }
.race-card-accent.accent-test   { background: #3ca0c8; }

/* ─── Section Label ─────────────────────────────────────────────────────────── */
.section-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 12px;
  padding-left: 4px;
}

/* ─── Season Leaderboard ─────────────────────────────────────────────────────── */
.scored-events-summary {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text3);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.scored-event-chip {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
}

.season-table-wrap {
  overflow-x: auto;
  margin-top: 24px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.season-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.season-table thead {
  background: #111;
  border-bottom: 2px solid var(--red);
}
.season-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text3);
  white-space: nowrap;
}
.season-table th.col-total { color: var(--red); }
.season-table th.col-race  { text-align: center; max-width: 100px; }

.season-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.season-table tbody tr:last-child { border-bottom: none; }
.season-table tbody tr:hover { background: var(--surface2); }
.season-table tbody tr.row-me { background: rgba(225,6,0,0.05); }
.season-table tbody tr.row-gold   { background: rgba(255,215,0,0.05); }
.season-table tbody tr.row-silver { background: rgba(192,192,192,0.04); }
.season-table tbody tr.row-bronze { background: rgba(205,127,50,0.04); }

.season-table td {
  padding: 14px 16px;
  color: var(--text2);
}
.season-table td.col-rank  { width: 60px; }
.season-table td.col-total { font-size: 18px; font-weight: 700; color: var(--text); }
.season-table td.col-race  { text-align: center; color: var(--text2); font-weight: 600; }
.season-table td.no-pred   { color: var(--text3); }

.rank-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border2);
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  color: var(--text3);
}
.rank-circle.gold   { border-color: var(--gold);   color: var(--gold);   background: rgba(255,215,0,0.1); }
.rank-circle.silver { border-color: var(--silver); color: var(--silver); background: rgba(192,192,192,0.1); }
.rank-circle.bronze { border-color: var(--bronze); color: var(--bronze); background: rgba(205,127,50,0.1); }

.col-driver { font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.season-table td.col-driver { display: table-cell; }

.pts-label   { font-size: 12px; color: var(--text3); font-weight: 400; }
.no-pred-dash{ color: var(--text3); font-size: 18px; }

.race-short { display: block; font-size: 10px; font-weight: 500; color: var(--text3); margin-top: 2px; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-note { color: var(--text3); font-size: 12px; margin-top: 14px; }

/* ─── Predict header: sprint event in title ──────────────────────────────────── */
.predict-race-title { gap: 10px; }

/* ─── Groups List Page ──────────────────────────────────────────────────────── */
.groups-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 40px;
}

.group-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  text-decoration: none;
  transition: all 0.18s;
  position: relative;
  overflow: hidden;
}
.group-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0;
  width: 4px; height: 100%;
  background: var(--red);
  opacity: 0;
  transition: opacity 0.18s;
}
.group-card:hover {
  border-color: var(--red);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px var(--red-dim);
}
.group-card:hover::before { opacity: 1; }

.group-card-icon {
  font-size: 28px;
  flex-shrink: 0;
}
.group-card-body {
  flex: 1;
  min-width: 0;
}
.group-card-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.group-card-desc {
  font-size: 13px;
  color: var(--text3);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.group-card-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--text3);
}
.group-card-arrow {
  color: var(--text3);
  font-size: 18px;
  flex-shrink: 0;
  transition: transform 0.15s;
}
.group-card:hover .group-card-arrow { transform: translateX(4px); color: var(--red); }

/* ─── Create / Join Forms ────────────────────────────────────────────────────── */
.group-forms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 8px;
}
@media (max-width: 700px) {
  .group-forms { grid-template-columns: 1fr; }
}

.group-form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.group-form-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.create-header { background: rgba(225,6,0,0.08); border-bottom-color: rgba(225,6,0,0.2); }
.join-header   { background: rgba(54,113,198,0.08); border-bottom-color: rgba(54,113,198,0.2); }

.group-form-icon    { font-size: 26px; flex-shrink: 0; }
.group-form-title   { font-size: 16px; font-weight: 700; color: var(--text); }
.group-form-subtitle{ font-size: 12px; color: var(--text3); margin-top: 2px; }

.group-form-card form {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  margin-bottom: 5px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.optional { font-weight: 400; text-transform: none; letter-spacing: 0; }

.btn-join {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  padding: 11px 0;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-join:hover { opacity: 0.88; }

/* ─── Group Detail Page ──────────────────────────────────────────────────────── */
.group-detail-header {
  margin-bottom: 28px;
}
.group-detail-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.group-detail-name {
  font-size: 26px;
  font-weight: 800;
}
.group-detail-desc {
  color: var(--text3);
  font-size: 14px;
  margin-top: 4px;
}
.group-detail-meta {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text3);
  display: flex;
  gap: 16px;
}
.group-detail-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  flex-shrink: 0;
}

.invite-block {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  text-align: right;
}
.invite-label {
  color: var(--text3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.invite-name {
  color: var(--text2);
  margin-top: 3px;
}
.invite-name strong { color: var(--text); }

/* ─── Owner / tag labels ─────────────────────────────────────────────────────── */
.owner-tag {
  background: rgba(255,140,0,0.15);
  border: 1px solid rgba(255,140,0,0.4);
  color: var(--orange);
  font-size: 10px;
  font-weight: 700;
  border-radius: 4px;
  padding: 2px 6px;
  letter-spacing: 0.5px;
}

/* ─── Clickable scored event chip ────────────────────────────────────────────── */
.clickable-chip {
  text-decoration: none;
  transition: all 0.15s;
  display: inline-block;
}
.clickable-chip:hover {
  background: var(--surface);
  border-color: var(--red);
  color: var(--text);
}

/* ─── Race col link in table header ─────────────────────────────────────────── */
.race-col-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: color 0.15s;
}
.race-col-link:hover { color: var(--red); }

/* ─── Danger ghost button ───────────────────────────────────────────────────── */
.btn-danger {
  color: #ff6b6b;
  border-color: rgba(255,107,107,0.4);
}
.btn-danger:hover {
  border-color: #ff6b6b;
  color: #ff4444;
  background: rgba(255,100,100,0.08);
}
