:root {
  --bg: #eef2ed;
  --surface: rgba(255, 255, 255, 0.98);
  --surface-strong: #ffffff;
  --surface-soft: #f7f9f6;
  --ink: #1f2937;
  --muted: #667085;
  --line: rgba(15, 23, 42, 0.11);
  --line-strong: rgba(15, 23, 42, 0.18);
  --navy: #12181d;
  --navy-soft: #202930;
  --accent: #679b41;
  --accent-strong: #4d7f2d;
  --accent-soft: rgba(103, 155, 65, 0.12);
  --sand: #d7dde0;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(103, 155, 65, 0.14), transparent 24%),
    radial-gradient(circle at top right, rgba(18, 24, 29, 0.1), transparent 30%),
    linear-gradient(180deg, #f6f8f4 0%, var(--bg) 45%, #eef1ec 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: 168px;
  background:
    linear-gradient(135deg, rgba(103, 155, 65, 0.16), transparent 42%),
    linear-gradient(180deg, #11171c 0%, #1a242b 100%);
  z-index: -1;
}

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 30px;
}

.auth-card h1 {
  margin: 0 0 10px;
  letter-spacing: -0.03em;
}

.auth-copy,
.auth-message {
  color: var(--muted);
}

.log-meta {
  margin: 10px 0 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.auth-form label {
  display: grid;
  gap: 6px;
}

.app-shell {
  width: min(1024px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 40px;
}

.hero,
.panel,
.event-modal::backdrop {
  border-radius: 20px;
}

.hero,
.panel,
.modal-shell {
  background: var(--surface);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 20px 22px;
  margin-bottom: 16px;
  background:
    linear-gradient(135deg, rgba(103, 155, 65, 0.22), transparent 40%),
    linear-gradient(180deg, #182126 0%, #0f1519 100%);
  border-color: rgba(255, 255, 255, 0.08);
}

body.mobile-tab-active .hero {
  display: none;
}

.hero h1,
.panel h2,
.status-tile h3,
.car-settings-card h3,
.log-card h3,
.rotation-card h3 {
  margin: 0;
  letter-spacing: -0.03em;
}

.hero h1 {
  color: #f8fafc;
  font-size: clamp(1.9rem, 3vw, 2.4rem);
}

.hero-copy {
  color: var(--muted);
  margin: 4px 0 0;
  max-width: 760px;
  font-size: 0.95rem;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.hero-pill,
.status-tile,
.car-settings-card,
.log-card,
.rotation-card {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

.status-tile.is-in-service {
  background: linear-gradient(180deg, #f1f3f4 0%, #e7eaed 100%);
  border-color: rgba(15, 23, 42, 0.16);
  box-shadow: none;
  opacity: 0.82;
  filter: grayscale(0.55);
}

.status-tile.is-in-service .car-number-badge {
  box-shadow: inset 0 0 0 999px rgba(91, 99, 106, 0.35);
}

.status-tile.is-retired {
  background: linear-gradient(180deg, #eceef0 0%, #d9dde1 100%);
  border-color: rgba(15, 23, 42, 0.18);
  box-shadow: none;
  opacity: 0.9;
  filter: grayscale(0.9);
}

.status-tile.is-retired .car-number-badge {
  box-shadow: inset 0 0 0 999px rgba(64, 72, 82, 0.52);
}

.status-flag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-flag-retired {
  background: rgba(64, 72, 82, 0.12);
  color: #48515b;
  border: 1px solid rgba(64, 72, 82, 0.16);
}

.hero-pill {
  min-width: 120px;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
}

.hero-pill span,
.status-list dt {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.hero-pill strong {
  font-size: 1rem;
  color: #ffffff;
}

.hero-pill span {
  color: rgba(248, 250, 252, 0.72);
}

.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  padding: 10px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(17, 23, 28, 0.98), rgba(27, 35, 41, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.tab-button,
button,
.ghost-button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.tab-button {
  background: rgba(255, 255, 255, 0.04);
  color: rgba(248, 250, 252, 0.86);
  border-color: rgba(255, 255, 255, 0.08);
}

.ghost-button {
  background: var(--surface-soft);
  color: var(--ink);
  border-color: rgba(15, 23, 42, 0.12);
}

button,
.tab-button.active {
  background: var(--accent);
  color: white;
  border-color: rgba(77, 127, 45, 0.3);
}

.tab-button:hover,
.ghost-button:hover,
button:hover {
  transform: translateY(-1px);
}

.tab-button:not(.active):hover {
  background: rgba(255, 255, 255, 0.09);
}

.ghost-button:hover {
  background: #edf3e8;
  border-color: rgba(103, 155, 65, 0.24);
}

button.is-saved {
  background: var(--accent-strong);
  color: white;
}

.small-button {
  padding: 9px 12px;
  background: #edf2e7;
  color: var(--ink);
  border-color: rgba(103, 155, 65, 0.18);
}

.tab-panel {
  display: none;
}

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

.tab-panel[data-panel="race-strategy"] {
  width: min(1560px, calc(100vw - 24px));
  margin-left: 50%;
  transform: translateX(-50%);
}

.tab-panel[data-panel="mobile"] {
  width: min(100%, 460px);
  margin: 0 auto;
}

.panel {
  padding: 22px;
  margin-bottom: 18px;
}

.panel-header,
.panel-subheader,
.tile-header,
.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

#end-race-button {
  background: #f7e5df;
  color: #912c16;
  border-color: rgba(145, 44, 22, 0.12);
}

#end-race-button:disabled {
  background: #eef1ec;
  color: #8d837c;
  cursor: default;
}

.overview-grid,
.car-settings-list,
.log-list,
.rotation-list {
  display: grid;
  gap: 14px;
}

.mobile-screen,
.mobile-stack {
  display: grid;
  gap: 14px;
}

.overview-chart-car-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.overview-chart-car-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  border-color: rgba(15, 23, 42, 0.12);
}

.overview-chart-car-button.active {
  background: var(--accent);
  color: #fff;
}

.overview-chart-car-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.overview-stint-chart-card {
  margin-top: 16px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
}

.overview-stint-chart-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.overview-stint-chart-meta strong {
  display: block;
  margin-top: 2px;
  font-size: 1rem;
}

.overview-stint-chart-kicker {
  display: block;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.overview-stint-chart-shell {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: end;
  min-height: 280px;
}

.overview-stint-chart-axis {
  display: grid;
  height: 100%;
  align-content: space-between;
  font-size: 0.78rem;
  color: var(--muted);
  padding-bottom: 24px;
}

.overview-stint-chart-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
  gap: 12px;
  align-items: end;
  min-height: 100%;
  padding: 8px 0 0;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.overview-stint-chart-column {
  display: grid;
  gap: 8px;
  align-content: end;
  justify-items: center;
  min-height: 232px;
  padding: 0 4px 0 8px;
}

.overview-stint-chart-value,
.overview-stint-chart-label {
  font-size: 0.78rem;
  color: var(--muted);
}

.overview-stint-chart-bar-wrap {
  width: 100%;
  height: 170px;
  display: flex;
  align-items: end;
}

.overview-stint-chart-bar {
  width: 100%;
  border-radius: 12px 12px 6px 6px;
  background: linear-gradient(180deg, rgba(103, 155, 65, 0.9), rgba(77, 127, 45, 1));
  min-height: 10px;
}

.mobile-panel {
  padding: 16px;
}

.mobile-quick-entry-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mobile-quick-entry-form label {
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
}

.mobile-quick-entry-form input,
.mobile-quick-entry-form select {
  min-height: 44px;
  border-radius: 12px;
}

.mobile-quick-entry-form button {
  min-height: 46px;
  grid-column: 1 / -1;
}

.mobile-card {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.mobile-rotation-item-ghost {
  background: #f3f5f4;
  border: 1px dashed rgba(15, 23, 42, 0.14);
}

.table-wrap {
  overflow-x: auto;
  margin-top: 16px;
}

.track-map-layout {
  display: grid;
  grid-template-columns: minmax(300px, 1.2fr) minmax(320px, 0.95fr);
  gap: 16px;
  align-items: start;
}

.track-map-reference-card,
.track-map-data-card {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
}

.track-map-art-shell {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(103, 155, 65, 0.18);
  background:
    radial-gradient(circle at top left, rgba(103, 155, 65, 0.15), transparent 34%),
    linear-gradient(180deg, #fbfcfa 0%, #eff3ed 100%);
  min-height: 360px;
  display: grid;
  place-items: center;
  padding: 18px;
}

.track-map-art {
  width: 100%;
  max-width: 620px;
  display: block;
  position: relative;
  z-index: 1;
}

.track-map-reference-copy {
  margin-top: 14px;
}

.track-map-reference-copy h3 {
  margin: 0 0 6px;
  letter-spacing: -0.03em;
}

.track-map-reference-copy p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.track-map-notes-card {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f5f8f3);
  display: grid;
  gap: 14px;
}

.track-map-note-group .eyebrow {
  margin-bottom: 6px;
}

.track-map-note-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: var(--ink);
}

.track-map-note-list li {
  line-height: 1.35;
}

.track-map-data-card {
  display: grid;
  gap: 0;
}

.track-map-table-wrap {
  margin-top: 0;
}

.track-map-table {
  min-width: 0;
  table-layout: fixed;
}

.track-control-table {
  min-width: 640px;
}

.track-control-table th,
.track-control-table td {
  vertical-align: middle;
}

.track-map-table th,
.track-map-table td {
  padding: 6px 8px;
  font-size: 0.84rem;
  text-align: right;
}

.track-map-table th:first-child,
.track-map-table td:first-child {
  width: 110px;
  white-space: nowrap;
  text-align: left;
}

.track-map-table input {
  width: 100%;
  min-width: 0;
  padding: 7px 8px;
  font-size: 0.84rem;
  border-radius: 10px;
  text-align: right;
}

.track-map-label-cell {
  font-weight: 700;
}

.track-map-static-value {
  display: inline-block;
  width: 100%;
  text-align: right;
  font-weight: 700;
}

.mobile-status-tile {
  padding: 14px;
}

.mobile-history-list,
.mobile-rotation-list {
  display: grid;
  gap: 10px;
}

.mobile-history-item,
.mobile-rotation-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: #faf8f3;
}

.mobile-history-live {
  background: #f7f5ef;
}

.mobile-history-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.mobile-history-head strong {
  font-size: 0.96rem;
}

.mobile-history-head span {
  color: var(--muted);
  font-weight: 700;
  text-align: right;
}

.mobile-history-item p,
.mobile-rotation-item p {
  margin: 0;
  color: var(--muted);
}

.car-log-section {
  display: grid;
  gap: 8px;
}

#car-log-tabs {
  margin-bottom: 16px;
}

.car-log-count {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.car-log-analytics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.car-log-stat {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f6faf2;
}

.car-log-stat h3 {
  margin: 0;
}

.car-log-stat p {
  margin: 6px 0 0;
}

.car-log-table {
  min-width: 0;
  table-layout: fixed;
}

.car-log-table th,
.car-log-table td {
  padding: 8px 6px;
}

.car-log-table th:nth-child(1),
.car-log-table th:nth-child(2),
.car-log-table td:nth-child(1),
.car-log-table td:nth-child(2) {
  width: 92px;
}

.car-log-table th:nth-child(3),
.car-log-table td:nth-child(3) {
  width: 66px;
}

.car-log-table th:nth-child(4),
.car-log-table td:nth-child(4) {
  width: 82px;
}

.car-log-table th:nth-child(5),
.car-log-table td:nth-child(5) {
  width: 128px;
}

.car-log-table th:nth-child(6),
.car-log-table td:nth-child(6) {
  width: 148px;
}

.car-log-table th:nth-child(7),
.car-log-table td:nth-child(7) {
  width: 104px;
}

.car-log-table .table-cell-input {
  min-width: 0;
  width: 100%;
  padding: 6px 8px;
  font-size: 0.85rem;
}

.car-log-table td:nth-child(3) .table-cell-input {
  padding-inline: 6px;
  text-align: center;
}

.car-log-live-row td {
  background: #f7f5ef;
}

.rotation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.log-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.rotation-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.rotation-modal-actions {
  margin-bottom: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  background: #f7faf5;
}

th,
td {
  border-bottom: 1px solid var(--line);
}

th,
td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: #f8faf7;
  vertical-align: bottom;
}

.table-cell-input {
  min-width: 140px;
  padding: 8px 10px;
}

.rotation-header-stack {
  display: grid;
  gap: 2px;
  min-width: 220px;
}

.rotation-header-stack small {
  color: var(--muted);
  font-size: 0.76rem;
}

.rotation-cell {
  min-width: 0;
}

.rotation-subhead {
  font-size: 0.66rem;
  letter-spacing: 0.04em;
}

.rotation-time-cell {
  min-width: 88px;
  width: 88px;
}

.rotation-length-cell {
  width: 70px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.rotation-driver-cell {
  width: 156px;
}

.rotation-time-input {
  width: 100%;
  min-width: 72px;
  padding: 4px 6px;
  font-size: 0.8rem;
  white-space: nowrap;
}

.rotation-table {
  min-width: 0;
}

.rotation-table th,
.rotation-table td {
  padding: 8px 6px;
}

.rotation-table .table-cell-input {
  min-width: 0;
  width: 100%;
  padding: 5px 7px;
  font-size: 0.84rem;
}

.rotation-table #rotation-table-head-row th:first-child,
.rotation-table #rotation-table-subhead-row th:first-child,
.rotation-table tbody td:first-child {
  width: 44px;
  min-width: 44px;
  text-align: center;
}

.rotation-cell-empty {
  color: var(--muted);
  text-align: center;
  font-style: italic;
}

td.rotation-cell-warning {
  background: #fff0b8;
}

td.rotation-cell-conflict {
  background: #f8c2be;
}

td.rotation-cell-fuel-risk {
  background: #ffd9c7;
  box-shadow: inset 0 0 0 1px rgba(202, 60, 37, 0.24);
}

.panel-nested {
  margin-top: 16px;
}

.chip-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.driver-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: #e7dfd2;
  border: 1px solid var(--line);
}

.driver-chip .ghost-button {
  padding: 4px 8px;
}

.race-strategy-layout {
  display: grid;
  gap: 16px;
}

.race-strategy-setup-summary {
  display: none !important;
}

.race-strategy-car-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.race-strategy-car-tab {
  min-width: 104px;
}

.race-strategy-car-tabs .tab-button {
  background: #edf2e8;
  color: var(--ink);
  border-color: rgba(15, 23, 42, 0.12);
}

.race-strategy-car-tabs .tab-button:hover {
  background: #e4ecdd;
}

.race-strategy-car-tabs .tab-button.active {
  background: var(--accent);
  color: #ffffff;
  border-color: rgba(77, 127, 45, 0.3);
}

.race-strategy-settings-grid {
  display: grid;
  gap: 16px;
}

.race-strategy-compare-table {
  display: grid;
  grid-template-columns: minmax(190px, 1.2fr) minmax(180px, 1fr);
  gap: 10px 12px;
  align-items: end;
}

.race-strategy-compare-header {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--navy);
}

.race-strategy-compare-label {
  font-weight: 700;
  color: var(--ink);
  align-self: center;
}

.race-strategy-compare-table label {
  gap: 0;
}

.race-strategy-results {
  display: grid;
  gap: 16px;
}

.race-strategy-stints {
  display: grid;
  gap: 16px;
}

.race-strategy-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.race-result-card,
.race-sensitivity-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: #fbfaf6;
  display: grid;
  gap: 8px;
}

.race-result-card span,
.race-sensitivity-card span,
.race-strategy-callout {
  color: var(--muted);
}

.race-result-card strong,
.race-sensitivity-card strong {
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}

.race-strategy-summary.is-ahead .race-result-card:last-child,
.race-sensitivity-card.is-ahead {
  background: #dff3d8;
  border-color: rgba(46, 125, 50, 0.28);
}

.race-strategy-summary.is-behind .race-result-card:last-child,
.race-sensitivity-card.is-behind {
  background: #f7d7d0;
  border-color: rgba(177, 60, 47, 0.3);
}

.race-sensitivity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.race-strategy-card table th,
.race-strategy-card table td {
  white-space: nowrap;
}

.race-strategy-summary-card {
  padding-bottom: 16px;
}

.race-strategy-setup-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 14px;
}

.strategy-summary-column {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfaf6;
  padding: 16px;
}

.strategy-summary-column h3 {
  margin: 0 0 12px;
}

.strategy-summary-column p {
  margin: 0 0 6px;
  color: var(--muted);
}

.race-strategy-stints thead tr:first-child th {
  background: #efe5d6;
  color: var(--navy);
  font-size: 0.72rem;
}

.race-strategy-stints thead tr:nth-child(2) th:nth-child(n + 5):nth-child(-n + 8) {
  background: #e0ebf3;
}

.race-strategy-stints thead tr:nth-child(2) th:nth-child(n + 9):nth-child(-n + 11) {
  background: #f5e3d7;
}

.race-strategy-stints select,
.race-strategy-stints input {
  min-width: 88px;
  padding: 7px 8px;
  font-size: 0.92rem;
}

.race-strategy-stints table th,
.race-strategy-stints table td {
  padding: 10px 8px;
}

@media (max-width: 980px) {
  .track-map-layout {
    grid-template-columns: 1fr;
  }

  .track-map-art-shell {
    min-height: 280px;
  }
}

.race-strategy-logged-row td {
  background: #f1f1ee;
}

.race-strategy-logged-row input,
.race-strategy-logged-row select,
.race-strategy-logged-row button {
  opacity: 0.75;
}

.race-strategy-debug-line {
  margin-top: 4px;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--muted);
  white-space: nowrap;
}

.race-strategy-warning-line {
  margin-top: 4px;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #b13c2f;
  white-space: nowrap;
}

.race-strategy-minute-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(56px, 1fr));
  gap: 8px;
  align-items: end;
}

.race-strategy-minute-grid label {
  display: grid;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--muted);
  justify-items: center;
  text-align: center;
}

.race-strategy-minute-grid label span {
  font-weight: 700;
  letter-spacing: 0.04em;
}

.race-strategy-minute-grid input {
  min-width: 0;
  width: 100%;
}

.race-strategy-compact-input {
  min-width: 0 !important;
  width: 52px !important;
  padding: 7px 6px !important;
  text-align: center;
}

.race-strategy-lap-input {
  min-width: 0 !important;
  width: 72px !important;
  padding: 7px 6px !important;
  text-align: center;
}

.race-strategy-inline-button {
  width: auto;
  min-width: 0;
  padding-inline: 10px;
}

.race-strategy-lap-flow {
  display: flex;
  align-items: center;
  gap: 8px;
}

.race-strategy-lap-arrow {
  color: var(--muted);
  font-weight: 700;
}

.race-strategy-lap-end {
  font-size: 1.08rem;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.race-strategy-badge {
  margin-top: 6px;
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: #efe5d6;
  color: var(--navy);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.overview-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.car-settings-list {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.status-list {
  margin: 14px 0 0;
  display: grid;
  gap: 12px;
}

.status-list dd {
  margin: 6px 0 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.window-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.window-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  color: white;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.window-badge.is-open {
  background: #2f8f46;
}

.window-badge.is-closed {
  background: #ba3c30;
}

.window-badge.is-retired {
  background: #7b858f;
}

.car-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.car-title-stack {
  display: grid;
  gap: 2px;
}

.car-color-label {
  margin: 0;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.color-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.car-number-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 16px;
  color: white;
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: inset 0 -6px 12px rgba(0, 0, 0, 0.16);
}

.settings-grid,
.event-form,
.rotation-form,
.car-settings-card {
  display: grid;
  gap: 12px;
}

.settings-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  align-items: end;
}

.event-form,
.rotation-form {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: end;
}

.compact-form {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.compact-form label {
  gap: 4px;
  font-size: 0.95rem;
}

.compact-form input,
.compact-form select,
.compact-form textarea {
  padding: 10px 12px;
}

.compact-form button {
  padding: 10px 14px;
  align-self: end;
}

.manual-entry-board {
  display: grid;
  gap: 14px;
}

.manual-entry-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) auto minmax(240px, 0.9fr);
  gap: 16px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(247, 250, 245, 0.98), rgba(255, 255, 255, 1)),
    white;
}

.manual-entry-row-copy {
  display: grid;
  gap: 6px;
}

.manual-entry-row-copy h3 {
  margin: 0;
  letter-spacing: -0.02em;
}

.manual-entry-copy {
  margin: 0;
  color: var(--muted);
}

.manual-entry-row-actions,
.manual-entry-button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.manual-entry-row-actions button,
.manual-entry-button-group button {
  min-width: 140px;
}

.manual-entry-form {
  display: grid;
  gap: 14px;
}

.manual-entry-fields {
  display: grid;
  gap: 12px;
}

.manual-entry-fields-single {
  grid-template-columns: 1fr;
}

.manual-entry-fields-tight {
  grid-template-columns: 1fr;
}

.manual-entry-fields label {
  gap: 5px;
}

.manual-checkbox {
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.manual-entry-form input,
.manual-entry-form select {
  background: #ffffff;
}

.modal-entry-form {
  margin-top: 12px;
}

.manual-entry-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.manual-entry-actions button {
  min-width: 170px;
}

.manual-entry-status {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f6faf2;
}

.manual-entry-status-compact {
  min-height: 100%;
  align-content: center;
}

.manual-entry-status h3,
.manual-entry-status p {
  margin: 0;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  color: #344054;
}

input,
select,
textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: white;
  color: var(--ink);
  padding: 12px 14px;
  font: inherit;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.02);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(103, 155, 65, 0.22);
  outline-offset: 1px;
  border-color: rgba(103, 155, 65, 0.55);
}

textarea {
  resize: vertical;
}

.checkbox-row {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.event-modal {
  width: min(480px, calc(100% - 24px));
  border: 0;
  padding: 0;
  background: transparent;
}

.event-modal::backdrop {
  background: rgba(14, 19, 24, 0.3);
}

.modal-shell {
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(247, 250, 245, 0.98), rgba(255, 255, 255, 1)),
    white;
}

.modal-shell .ghost-button {
  background: #edf2e8;
  color: var(--ink);
  border-color: rgba(15, 23, 42, 0.14);
}

.modal-shell .ghost-button:hover {
  background: #e4ecdd;
  border-color: rgba(103, 155, 65, 0.22);
}

.modal-shell .manual-entry-actions button:not(.ghost-button),
.modal-shell .rotation-actions button:not(.ghost-button) {
  box-shadow: 0 6px 16px rgba(103, 155, 65, 0.16);
}

#rotation-modal {
  width: min(960px, calc(100% - 24px));
}

#rotation-modal .modal-shell {
  max-height: min(80vh, 760px);
  overflow-y: auto;
}

#race-strategy-lap-modal {
  width: min(820px, calc(100% - 24px));
}

#race-strategy-settings-modal {
  width: min(1240px, calc(100% - 24px));
}

.race-lap-modal-grid {
  display: grid;
  gap: 16px;
}

.modal-copy,
.app-status,
.empty-state,
.log-card p,
.rotation-card p {
  color: var(--muted);
}

th,
td {
  border-color: var(--line);
}

thead th {
  color: #cfd6f7;
}

tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

.app-status {
  margin: 0;
  text-align: right;
  color: rgba(248, 250, 252, 0.76);
}

@media (max-width: 720px) {
  .hero,
  .settings-grid,
  .event-form,
  .rotation-form {
    grid-template-columns: 1fr;
  }

  .tab-panel[data-panel="race-strategy"] {
    width: 100%;
    margin-left: 0;
    transform: none;
  }

  .race-strategy-setup-summary {
    grid-template-columns: 1fr;
  }

  .race-strategy-compare-table {
    grid-template-columns: 1fr;
  }

  .race-strategy-compare-header:first-child {
    display: none;
  }

  .app-shell {
    width: min(100% - 16px, 1560px);
  }

  .panel {
    padding: 16px;
  }

  .manual-entry-actions button {
    width: 100%;
  }

  .settings-actions button {
    width: 100%;
  }

  .manual-entry-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .manual-entry-row-actions {
    width: 100%;
  }

  .manual-entry-row-actions button {
    flex: 1 1 180px;
  }
}
