/* Quarter Midget Pit Companion — High-Contrast Motorsport UI */

:root {
  --bg: #090b0f;
  --surface: #121722;
  --surface-2: #182030;
  --border: #253044;
  --border-hi: #384966;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.16);
  --cyan: #22d3ee;
  --cyan-dim: rgba(34, 211, 238, 0.14);
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.15);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --nav-h: 64px;
  --header-h: 56px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  min-height: 100dvh;
  max-width: 100vw;
  overflow-x: clip;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

/* Prevent iOS Safari auto-zoom on focus (iOS zooms any input/select/textarea < 16px) */
input, select, textarea {
  font-size: 16px;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

/* Header (respects iPhone Dynamic Island / safe-area-inset-top in PWA & Safari) */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  background: rgba(9, 11, 15, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: env(safe-area-inset-top, 0px) 12px 0;
}

.brand-car-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.brand-mark {
  background: var(--amber);
  color: #090b0f;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 4px 7px;
  border-radius: 6px;
  flex-shrink: 0;
}
@media (max-width: 440px) {
  .brand-mark { display: none; }
}

.car-select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-weight: 700;
  font-size: 16px;
  max-width: 240px;
  min-width: 0;
  width: 100%;
  outline: none;
}

.header-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.status-pill {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.status-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-pill.ok {
  border-color: rgba(34, 197, 94, 0.5);
  background: var(--green-dim);
  color: #86efac;
}
.status-pill.ok .dot { background: var(--green); }

.status-pill.warn {
  border-color: rgba(245, 158, 11, 0.55);
  background: var(--amber-dim);
  color: #fcd34d;
}
.status-pill.warn .dot { background: var(--amber); }

.status-pill.info {
  border-color: rgba(34, 211, 238, 0.55);
  background: var(--cyan-dim);
  color: #67e8f9;
}
.status-pill.info .dot { background: var(--cyan); }

/* Main Content */
.app-main {
  max-width: 920px;
  margin: 0 auto;
  padding: 10px 12px calc(var(--nav-h) + 14px + env(safe-area-inset-bottom, 0px));
}
body.has-netlify-badge .app-main {
  padding-bottom: calc(var(--nav-h) + max(56px, calc(26px + env(safe-area-inset-bottom, 0px))));
}

.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

/* Cards & Grids */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}

.card-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border-hi);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.06s ease, background 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #06131a;
}
.btn-amber {
  background: var(--amber);
  border-color: var(--amber);
  color: #090b0f;
}
.btn-green {
  background: var(--green);
  border-color: var(--green);
  color: #051b0c;
}
.btn-danger {
  background: var(--red-dim);
  border-color: rgba(239, 68, 68, 0.55);
  color: #fca5a5;
}
.btn-sm {
  padding: 5px 9px;
  font-size: 12px;
}

/* Scales Tab (Compact Zero-Scroll Pit Layout) */
.scales-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.scales-toolbar .btn {
  flex: 1 1 auto;
  min-width: 78px;
  padding: 8px 9px;
  font-size: 12px;
}

.demo-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--amber-dim);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 10px;
  font-size: 12px;
  color: #fde68a;
}
.demo-bar input[type="range"] {
  flex: 1;
  accent-color: var(--amber);
}

.chassis-stage {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: auto auto;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 10px;
}

.corner-card {
  background: var(--surface);
  border: 2px solid var(--border-hi);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.corner-card.online {
  border-color: rgba(34, 211, 238, 0.45);
}
.corner-card.offline {
  opacity: 0.72;
}

.corner-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.corner-label {
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--cyan);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pad-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #475569;
}
.corner-card.online .pad-dot {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.pad-batt {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.corner-weight {
  font-size: clamp(30px, 8.5vw, 44px);
  font-weight: 900;
  line-height: 1.05;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.corner-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.corner-pct {
  font-size: 15px;
  font-weight: 800;
  color: var(--amber);
}

/* Telemetry Grid */
.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (min-width: 640px) {
  .telemetry-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.telem-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
}

.telem-tile.highlight-amber {
  border-color: rgba(245, 158, 11, 0.55);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.09), var(--surface));
}

.telem-tile.highlight-cyan {
  border-color: rgba(34, 211, 238, 0.45);
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.08), var(--surface));
}

.telem-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.telem-val {
  font-size: 22px;
  font-weight: 900;
  color: #ffffff;
  margin-top: 2px;
}

.telem-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.delta-good { color: #86efac; font-weight: 700; }
.delta-warn { color: #fcd34d; font-weight: 700; }
.delta-bad  { color: #fca5a5; font-weight: 700; }

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
@media (min-width: 600px) {
  .form-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.field.full { grid-column: 1 / -1; }

.field label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.field input,
.field select,
.field textarea {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 16px;
  font-family: inherit;
  line-height: 1.25;
  outline: none;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}

/* Fix iOS Safari oversized intrinsic width/height on native <input type="date"> */
.field input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  min-height: 38px;
  height: 38px;
  padding: 6px 8px;
  text-align: left;
}
.field select {
  min-height: 38px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--cyan);
}

.wx-banner {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-top: 8px;
}
@media (min-width: 600px) {
  .wx-banner { grid-template-columns: repeat(4, 1fr); }
}

.wx-stat span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}
.wx-stat strong {
  font-size: 16px;
  color: var(--cyan);
}

.auto-calc-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--amber);
  font-weight: 700;
}

/* Sub-tabs (Reference) */
.subtab-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.subtab-btn {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 13px;
  padding: 9px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.subtab-btn.active {
  background: var(--amber-dim);
  border-color: var(--amber);
  color: #fde68a;
}

.subpanel { display: none; }
.subpanel.active { display: block; }

/* Tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data-table th,
table.data-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  white-space: nowrap;
}
table.data-table th {
  background: var(--surface-2);
  color: var(--cyan);
  font-weight: 800;
  position: sticky;
  top: 0;
}
table.data-table td.active-cell {
  background: var(--amber-dim);
  color: #fde68a;
  font-weight: 900;
}

/* Tuning Cards */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.chip.active {
  background: var(--cyan-dim);
  border-color: var(--cyan);
  color: #a5f3fc;
}

.tuning-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.tuning-item h4 {
  margin: 0 0 6px;
  font-size: 15px;
  color: var(--amber);
}
.tuning-item ul {
  margin: 4px 0 6px 18px;
  padding: 0;
}
.tuning-item li {
  margin-bottom: 4px;
  font-size: 13px;
}

/* Board Members & Log History Lists */
.list-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 8px;
}

.list-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

/* Gate Code Mask */
.gate-code-box {
  display: flex;
  align-items: center;
  gap: 8px;
}
.gate-code-display {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: var(--amber);
  background: var(--bg);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  flex: 1;
}

/* AI Crew Chief Chat */
.memory-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}
.memory-pill {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--cyan);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.memory-cat {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--cyan);
  display: block;
}

.chat-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 44dvh;
  min-height: 180px;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.chat-bubble {
  max-width: 90%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.chat-bubble.user {
  align-self: flex-end;
  background: var(--cyan-dim);
  border: 1px solid rgba(34, 211, 238, 0.4);
  color: #ecfeff;
}
.chat-bubble.model {
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--border-hi);
  color: var(--text);
}

.chat-input-row {
  display: flex;
  gap: 8px;
  width: 100%;
  align-items: stretch;
}
.chat-input-row input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 16px;
}
.chat-input-row .btn {
  flex-shrink: 0;
}

.memory-suggest-bar {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-hi);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Bottom Navigation (compact & edge-to-edge on Cloudflare; reserves badge strip only on netlify.app) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 5px 0 calc(4px + env(safe-area-inset-bottom, 0px));
  background: rgba(12, 16, 24, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  z-index: 50;
}
body.has-netlify-badge .bottom-nav {
  padding: 6px 0 max(48px, calc(18px + env(safe-area-inset-bottom, 0px)));
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 2px;
}

.nav-btn .nav-icon {
  font-size: 18px;
  line-height: 1;
}

.nav-btn.active {
  color: var(--amber);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 14px;
}
.modal-backdrop.open {
  display: flex;
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  max-width: 440px;
  width: 100%;
  padding: 16px;
}

/* Toast */
.toast {
  position: fixed;
  top: calc(66px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  border: 1px solid var(--cyan);
  color: #f8fafc;
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  z-index: 120;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  max-width: 92vw;
  text-align: center;
}
.toast.show { opacity: 1; }

.muted { color: var(--text-muted); font-size: 12px; }
.hidden { display: none !important; }

/* Header Garage Icon Button */
.icon-btn {
  background: var(--surface);
  border: 1px solid var(--border-hi);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
}
.icon-btn.active {
  border-color: var(--amber);
  background: var(--amber-dim);
  color: var(--amber);
}

/* Tire Temps Visual Sheet & Rapid Keypad */
.probe-live-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg);
  border: 2px solid var(--amber);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 10px;
}
.probe-active-step {
  font-size: 17px;
  font-weight: 900;
  color: var(--amber);
}
.probe-live-readout {
  font-size: 28px;
  font-weight: 900;
  color: var(--cyan);
  white-space: nowrap;
}
#keypadBufferDisplay {
  white-space: nowrap;
  flex-shrink: 0;
}

.tire-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.tire-card {
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  padding: 8px;
}
.tire-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--cyan);
}
.tire-spots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}
.tire-spots.quick-only {
  grid-template-columns: 1fr;
}

.spot-btn {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: 6px 4px;
  text-align: center;
  cursor: pointer;
  color: var(--text);
}
.spot-btn .spot-lbl {
  display: block;
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
}
.spot-btn .spot-val {
  display: block;
  font-size: 18px;
  font-weight: 900;
  margin-top: 2px;
}
.spot-btn.active-spot {
  border-color: var(--amber);
  background: var(--amber-dim);
}
.spot-btn.filled {
  border-color: rgba(34, 197, 94, 0.55);
}

.keypad-wrap {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.key-btn {
  background: var(--surface-2);
  border: 1px solid var(--border-hi);
  color: var(--text);
  font-size: 19px;
  font-weight: 800;
  padding: 12px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.key-btn:active { transform: scale(0.96); background: var(--cyan-dim); }
.key-btn.key-action { font-size: 13px; background: var(--amber); color: #090b0f; border-color: var(--amber); }

.insight-pill {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.insight-pill.warn { border-left: 3px solid var(--amber); color: #fde68a; }
.insight-pill.ok   { border-left: 3px solid var(--green); color: #bbf7d0; }
.insight-pill.info { border-left: 3px solid var(--cyan);  color: #cffafe; }

/* Cheat Sheet Table */
.phase-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-muted);
  margin-right: 2px;
}
.phase-badge.on { background: var(--cyan-dim); color: #67e8f9; }

/* Inline table edit inputs (Chassis/Shocks) */
.table-edit-input,
.table-edit-textarea {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--amber);
  border-radius: 6px;
  padding: 5px 7px;
  font-size: 16px;
  font-family: inherit;
  outline: none;
}
.table-edit-textarea {
  min-width: 170px;
  min-height: 48px;
  resize: vertical;
}
.table-edit-input {
  min-width: 90px;
  text-align: center;
  font-weight: 700;
}
.card-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Collapsible card header toggle */
.collapsible-toggle {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-align: left;
}
.collapsible-caret {
  display: inline-block;
  width: 14px;
  color: var(--amber);
  font-size: 14px;
  line-height: 1;
}

/* Setup Log Weight Telemetry Strip + Prominent Orange Cross % Box */
.weight-stat-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 10px 0 12px;
}
@media (min-width: 600px) {
  .weight-stat-strip {
    grid-template-columns: repeat(4, 1fr);
  }
}
.weight-stat-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.weight-stat-box span {
  display: block;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.weight-stat-box strong {
  display: block;
  font-size: 18px;
  font-weight: 900;
  color: var(--text);
  margin-top: 2px;
}
.weight-stat-box.cross-highlight {
  border: 2px solid var(--amber);
  background: var(--amber-dim);
}
.weight-stat-box.cross-highlight span,
.weight-stat-box.cross-highlight strong {
  color: var(--amber);
}
.sub-section-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--cyan);
  margin: 4px 0 6px;
}

/* Top-Down Rice Chassis Dimensional Graphic (Setup Log) */
.chassis-diagram-wrap {
  position: relative;
  width: 100%;
  max-width: 680px;
  margin: 6px auto 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
}

.diagram-grid {
  display: grid;
  grid-template-columns: 122px 1fr 148px;
  gap: 8px;
  align-items: stretch;
}

@media (max-width: 560px) {
  .diagram-grid {
    grid-template-columns: 92px 1fr 122px;
    gap: 5px;
  }
}

.diag-col {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  height: 100%;
}

.diag-mid-center {
  align-self: center;
}

.diag-pair-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  align-items: end;
}

.diag-tight-stack {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-self: end;
}

.diag-top-row,
.diag-bot-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  align-items: end;
  margin-bottom: 8px;
}
.diag-bot-row {
  margin-bottom: 0;
  margin-top: 8px;
}

.dim-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.dim-box label {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cyan);
  line-height: 1.15;
}
.dim-box.accent label {
  color: var(--amber);
}
.dim-box input {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-hi);
  border-radius: 6px;
  padding: 4px 2px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  outline: none;
}
.dim-box.accent input {
  border-color: rgba(245, 158, 11, 0.7);
}
.dim-box input:focus {
  border-color: var(--cyan);
}

.chassis-svg-box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.chassis-svg-box svg {
  width: 100%;
  max-width: 240px;
  height: auto;
  display: block;
}

/* 4-Corner Setup Cards with Sub-Tabs (Tires / Suspension / Chassis) */
.corner-setup-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
@media (min-width: 680px) {
  .corner-setup-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.corner-setup-card {
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  padding: 10px;
}

.corner-setup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}
.corner-setup-title {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: var(--amber);
  text-transform: uppercase;
}
.corner-mini-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 999px;
}

.corner-subtabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 8px;
}
.csub-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 6px 4px;
  border-radius: 6px;
  cursor: pointer;
}
.csub-btn.active {
  background: var(--cyan-dim);
  border-color: var(--cyan);
  color: #a5f3fc;
}

.csub-pane { display: none; }
.csub-pane.active { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }

/* Axle Mode 3-Way Toggle (Locked / Unlocked / Ratchet) */
.axle-mode-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.axle-btn {
  background: var(--bg);
  border: 1px solid var(--border-hi);
  color: var(--text-muted);
  font-weight: 800;
  font-size: 12px;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.axle-btn.active {
  background: var(--amber-dim);
  border-color: var(--amber);
  color: #fde68a;
}

