/* Application shell layout */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.synthetic-banner {
  background: var(--surface-banner);
  border-bottom: 1px solid var(--border-hairline);
  padding: var(--space-2) var(--space-5);
  font-size: 13px;
  color: var(--ink-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
  justify-content: center;
}

.synthetic-banner strong {
  color: var(--ink-primary);
}

.app-header {
  padding: var(--space-4) var(--space-5) 0;
  border-bottom: 1px solid var(--border-hairline);
  background: var(--surface-page);
}

.app-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: var(--space-3);
}

.app-title .app-title-sub {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-muted);
  margin-top: 2px;
}

.tab-nav {
  display: flex;
  gap: var(--space-1);
  overflow-x: auto;
  padding-bottom: 0;
}

.tab {
  display: inline-block;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  color: var(--ink-secondary);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
  border-bottom: none;
}

.tab[aria-current="page"] {
  color: var(--ink-primary);
  background: var(--surface-card);
  border-color: var(--border-hairline);
}

.app-main {
  flex: 1;
  padding: var(--space-5);
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}

.view-header {
  margin-bottom: var(--space-5);
}

.view-title {
  font-size: 22px;
  font-weight: 700;
}

.view-subtitle {
  margin-top: var(--space-1);
  color: var(--ink-secondary);
  font-size: 14px;
}

.section {
  margin-bottom: var(--space-6);
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: var(--space-3);
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-3);
}

.stat-tile-value {
  font-size: 24px;
  font-weight: 700;
  margin-top: var(--space-1);
}

.stat-tile-label {
  font-size: 12.5px;
  color: var(--ink-secondary);
  display: flex;
  align-items: center;
}

.stat-tile-sub {
  margin-top: var(--space-1);
  font-size: 12px;
  color: var(--ink-muted);
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-3);
}

.market-card-title {
  font-size: 15px;
  font-weight: 700;
}

.market-card-model {
  margin-top: var(--space-1);
  font-size: 13px;
  color: var(--ink-secondary);
}

.market-card-meta {
  margin-top: var(--space-3);
  font-size: 12.5px;
  color: var(--ink-muted);
}

.confidence-row {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.timeline-strip {
  display: flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-hairline);
  font-size: 11.5px;
}

.timeline-seg {
  padding: var(--space-2) var(--space-1);
  text-align: center;
  color: var(--ink-secondary);
  border-right: 1px solid var(--border-hairline);
  background: var(--surface-card);
}

.timeline-seg:last-child {
  border-right: none;
}

.alert-group-list {
  display: grid;
  gap: var(--space-3);
}

.rule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-hairline);
}

.rule-row:last-child {
  border-bottom: none;
}

.rule-name {
  font-size: 13.5px;
  color: var(--ink-primary);
}

.date-picker {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  font-size: 13px;
}

.date-picker-label {
  color: var(--ink-secondary);
  font-weight: 600;
  white-space: nowrap;
}

.date-picker-input {
  font: inherit;
  padding: 4px 8px;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  color: var(--ink-primary);
}

.drill-in-button {
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent-ink);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.drill-in-button:hover {
  background: var(--surface-page);
}

/* Actual-vs-expected comparison. Neutral ink tones only -- this is
   informational context, not a severity/status judgment, so it must never
   borrow the review/elevated/exception/data-quality color language. */
.expected-actual {
  margin-top: var(--space-3);
}

.expected-actual-label {
  font-size: 12.5px;
  color: var(--ink-secondary);
  margin-bottom: 4px;
}

.expected-actual-track {
  display: grid;
  gap: 3px;
}

.expected-actual-expected,
.expected-actual-actual {
  height: 8px;
  border-radius: 4px;
  background: var(--ink-muted);
}

.expected-actual-actual {
  background: var(--ink-secondary);
}

.vehicle-picker {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
}

.vehicle-picker-label {
  color: var(--ink-secondary);
  font-weight: 600;
  white-space: nowrap;
}

.vehicle-picker-select {
  font: inherit;
  padding: 4px 8px;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  color: var(--ink-primary);
  max-width: 100%;
}

.alert-filters {
  display: flex;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  flex-wrap: wrap;
  font-size: 13px;
}

.alert-filters label {
  color: var(--ink-secondary);
  font-weight: 600;
  white-space: nowrap;
}

.alert-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.disposition-badge {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-muted);
  border: 1px solid var(--border-hairline);
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}

/* Milestone 6: real interactive toggle (button, not the Milestone 1 stub's
   inert span) -- keyboard-operable by default since it's a <button>. */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border-hairline);
  border-radius: 999px;
  background: var(--surface-card);
  color: var(--ink-secondary);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.toggle-switch[aria-checked="true"] {
  background: var(--surface-page);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.threshold-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.threshold-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-secondary);
}

.threshold-number-input {
  font: inherit;
  width: 72px;
  padding: 4px 6px;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  color: var(--ink-primary);
}

.threshold-error {
  font-size: 11px;
  color: var(--status-review);
  min-height: 1em;
}

.market-override-details {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-hairline);
}

.market-override-details summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.event-list {
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius);
  overflow: hidden;
}

.event-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-hairline);
  font-size: 13px;
  background: var(--surface-card);
  align-items: baseline;
}

.event-row:last-child {
  border-bottom: none;
}

.event-time {
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
  font-size: 12px;
  min-width: 90px;
}

.event-label {
  flex: 1;
  color: var(--ink-primary);
}

.event-duration {
  color: var(--ink-secondary);
  font-size: 12px;
  white-space: nowrap;
}

/* Driver Day timeline bar: decorative and aria-hidden -- the adjacent
   event-list is the accessible content. Status color used only as a thin
   4px accent stripe, never a full-cell fill, per the established rule
   that status hues never sit under/behind readable content. */
.timeline-bar-wrap {
  overflow-x: auto;
  margin-bottom: var(--space-3);
}

.timeline-strip {
  min-width: 600px;
}

.timeline-seg {
  position: relative;
  height: 28px;
}

.timeline-seg--review::after,
.timeline-seg--data-quality::after,
.timeline-seg--exception::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
}

.timeline-seg--review::after {
  background: var(--status-review);
}

.timeline-seg--data-quality::after {
  background: var(--status-dataquality);
}

.timeline-seg--exception::after {
  background: var(--status-exception);
}

/* Route map: schematic only, synthetic coordinates. Neutral ink/accent
   tones -- this is a diagram of evidence, not a severity indicator. */
.route-map-caption {
  font-size: 12.5px;
  color: var(--ink-secondary);
  font-style: italic;
  margin-bottom: var(--space-2);
}

.route-map-svg-wrap {
  max-width: 480px;
  width: 100%;
  margin: 0 auto var(--space-3);
}

.route-map-svg {
  width: 100%;
  height: auto;
  display: block;
}

.route-map-path {
  fill: none;
  stroke: var(--ink-muted);
  stroke-width: 3;
}

.route-map-marker {
  fill: var(--accent);
  stroke: var(--surface-card);
  stroke-width: 2;
}

.route-map-stops-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-secondary);
  margin-bottom: var(--space-2);
}

.route-map-stops-list {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--ink-primary);
}

/* Data-quality evidence that belongs to a different driver's day --
   deliberately not link-styled, since it is not a same-page jump target. */
.evidence-nonlocal {
  color: var(--ink-muted);
  font-style: italic;
}

.assumptions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.assumptions-table th,
.assumptions-table td {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-hairline);
  vertical-align: top;
}

.assumptions-table th {
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

@media (min-width: 720px) {
  .app-header,
  .app-main {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }
}

@media (max-width: 520px) {
  .synthetic-banner {
    text-align: left;
    justify-content: flex-start;
  }
  .app-main {
    padding: var(--space-4);
  }
  .date-picker {
    flex-wrap: wrap;
  }
  .date-picker-input {
    width: 100%;
  }
  .rule-row {
    flex-wrap: wrap;
    gap: var(--space-2);
  }
  .vehicle-picker {
    flex-wrap: wrap;
  }
  .vehicle-picker-select {
    width: 100%;
  }
  .event-time {
    min-width: 0;
  }
  .alert-filters select {
    width: 100%;
  }
  .alert-card-footer {
    flex-wrap: wrap;
  }
}
