:root {
  --bg: #0a0b0d;
  --surface: #111318;
  --surface-2: #171a20;
  --surface-3: #1d2027;
  --line: #2b2f37;
  --line-soft: #20232a;
  --text: #f6f6f3;
  --muted: #b8bbc4;
  --muted-2: #9096a2;
  /* Readability floor for secondary grey copy used across current and future views. */
  --secondary-text-size: 13px;
  --secondary-text-compact: 12px;
  --red: #ff5c65;
  --cyan: #29d3c6;
  --amber: #f4bd4f;
  --blue: #64a7ff;
  --green: #70d686;
  --purple: #b996ff;
  --hard: #f0f0ed;
  --medium: #f1c846;
  --soft: #ef4f59;
  --intermediate: #42b96c;
  --wet: #4d91ff;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  padding: 0;
  margin: -1px;
  border: 0;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

html {
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

button,
select {
  font: inherit;
}

button,
select,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(210px, 250px) minmax(250px, 1fr) auto;
  align-items: center;
  gap: 22px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: #08090b;
}

.brand-lockup,
.event-lockup {
  min-width: 0;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-lockup img {
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  object-fit: cover;
  border: 1px solid #353841;
  border-radius: 4px;
}

.brand-name {
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  font-weight: 850;
  line-height: 1.1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-product {
  margin-top: 4px;
  color: var(--red);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.event-lockup {
  display: grid;
  grid-template-columns: auto minmax(0, auto);
  align-items: baseline;
  justify-content: start;
  column-gap: 10px;
}

.event-picker {
  position: relative;
  min-width: 0;
}

.event-picker select {
  max-width: min(290px, 30vw);
  padding: 0 20px 0 0;
  overflow: hidden;
  color: var(--text);
  border: 0;
  background: transparent;
  font-size: 15px;
  font-weight: 800;
  text-overflow: ellipsis;
  appearance: none;
  cursor: pointer;
}

.event-picker::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 3px;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  pointer-events: none;
}

.event-picker:has(select:disabled)::after {
  display: none;
}

.event-lockup strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-lockup span:last-child {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
}

.event-year {
  grid-row: 1 / span 2;
  color: var(--red);
  font-size: 11px;
  font-weight: 850;
}

.session-switcher {
  justify-self: end;
  display: grid;
  grid-template-columns: repeat(var(--session-count, 3), minmax(48px, auto));
  height: 40px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.session-switcher button,
.segmented button {
  min-width: 0;
  padding: 0 9px;
  color: var(--muted);
  border: 0;
  border-radius: 4px;
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.session-switcher button:hover,
.segmented button:hover {
  color: var(--text);
  background: var(--surface-3);
}

.session-switcher button[aria-selected="true"],
.segmented button[aria-pressed="true"] {
  color: #0b0c0e;
  background: var(--text);
}

.session-switcher button:disabled {
  position: relative;
  color: #666b76;
  background: #15171c;
  cursor: not-allowed;
  opacity: 0.72;
}

.session-switcher button:disabled:hover {
  color: #666b76;
  background: #15171c;
}

.session-pending {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 5px;
  height: 5px;
  border: 1px solid #7d828d;
  border-radius: 50%;
  background: transparent;
}

.session-label-compact {
  display: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 214px minmax(0, 1fr);
  min-height: calc(100vh - 72px);
}

.sidebar {
  position: sticky;
  top: 72px;
  align-self: start;
  height: calc(100vh - 72px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 17px 12px 14px;
  border-right: 1px solid var(--line);
  background: #0c0d10;
}

.mobile-view-picker {
  display: none;
}

.nav-group + .nav-group {
  margin-top: 18px;
}

.nav-group-label {
  padding: 0 9px 7px;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.nav-item {
  position: relative;
  width: 100%;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  color: var(--muted);
  border: 0;
  border-radius: 4px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  stroke-width: 1.8;
}

.nav-item:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav-item[aria-selected="true"] {
  color: var(--text);
  background: var(--surface-3);
}

.nav-item[aria-selected="true"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--red);
}

.nav-item[aria-selected="true"] svg {
  color: var(--red);
}

.workspace {
  min-width: 0;
  padding: 27px clamp(18px, 2.6vw, 42px) 22px;
}

.workspace-header {
  min-height: 72px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 30px;
  padding-bottom: 22px;
}

.view-heading {
  min-width: 0;
}

.eyebrow {
  color: var(--red);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font-size: 27px;
  line-height: 1.15;
}

.view-heading p {
  max-width: 700px;
  margin-bottom: 0;
  color: var(--muted);
}

.workspace-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.export-preset {
  width: 92px;
}

.export-preset select {
  width: 100%;
  height: 40px;
  padding: 0 8px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.driver-select {
  position: relative;
  width: 150px;
}

.driver-select span {
  position: absolute;
  left: 10px;
  top: 5px;
  z-index: 1;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  pointer-events: none;
}

.driver-select select {
  width: 100%;
  height: 44px;
  padding: 16px 28px 4px 9px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  appearance: none;
  cursor: pointer;
}

.driver-select::after {
  content: "";
  position: absolute;
  right: 11px;
  top: 18px;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  pointer-events: none;
}

.icon-button {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  cursor: pointer;
}

.icon-button:hover {
  color: var(--text);
  border-color: #484d59;
  background: var(--surface-2);
}

.icon-button:disabled {
  opacity: 0.38;
  cursor: default;
}

.icon-button svg {
  width: 17px;
  height: 17px;
}

#export-chart:not(:disabled) {
  color: var(--red);
  border-color: rgba(255, 92, 101, 0.55);
}

#export-chart:not(:disabled):hover {
  color: var(--text);
  border-color: var(--red);
}

#export-chart[aria-busy="true"] {
  color: var(--amber);
  border-color: rgba(244, 189, 79, 0.65);
  opacity: 1;
  cursor: wait;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 21px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.kpi {
  min-width: 0;
  padding: 15px 17px;
}

.kpi + .kpi {
  border-left: 1px solid var(--line);
}

.kpi-label {
  overflow: hidden;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 850;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.kpi-value {
  margin-top: 3px;
  overflow: hidden;
  color: var(--text);
  font-size: 19px;
  font-weight: 780;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kpi-detail {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view-toolbar {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
}

.toolbar-copy {
  color: var(--muted);
  font-size: var(--secondary-text-size);
}

.toolbar-copy strong {
  color: var(--text);
}

.toolbar-controls {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.toolbar-select {
  min-width: 176px;
  display: grid;
  gap: 3px;
}

.toolbar-select span {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.toolbar-select select {
  width: 100%;
  height: 34px;
  padding: 0 30px 0 10px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.segmented {
  height: 34px;
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(72px, auto);
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.segmented button {
  padding: 0 10px;
  font-size: 11px;
}

.view-root {
  min-height: 560px;
}

.view-loading {
  min-height: 420px;
  display: grid;
  grid-template-columns: 28px auto;
  place-content: center;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.view-loading > span {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
}

.view-loading strong,
.view-loading small {
  display: block;
}

.view-loading strong {
  color: var(--text);
  font-size: 15px;
}

.view-loading small {
  margin-top: 2px;
  font-size: 12px;
}

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

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 24px;
}

.analysis-grid.equal {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-section,
.detail-section,
.table-section,
.metric-section {
  min-width: 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.section-heading {
  min-height: 52px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px 10px;
  border-bottom: 1px solid var(--line-soft);
}

.section-heading h2,
.section-heading h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.3;
}

.section-heading p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: var(--secondary-text-size);
}

.export-status-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10000;
  max-width: min(520px, calc(100vw - 40px));
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  color: var(--text);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  border-radius: 4px;
  background: #15181e;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.42);
  font-size: 13px;
  font-weight: 750;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.export-status-message {
  min-width: 0;
}

.export-status-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.export-status-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  color: var(--text);
  border: 1px solid #434954;
  border-radius: 4px;
  background: #20242b;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.export-status-actions a:hover {
  border-color: #69717f;
  background: #282d35;
}

.export-status-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.export-status-toast.has-actions {
  pointer-events: auto;
}

.export-status-toast.success {
  border-left-color: var(--green);
}

.export-status-toast.warning {
  border-left-color: var(--amber);
}

.export-status-toast.error {
  border-left-color: var(--red);
}

.source-badge,
.status-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  padding: 3px 7px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.social-export-stage {
  position: fixed;
  top: 0;
  left: -100000px;
  z-index: -1;
  padding: 10px;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.social-export-content {
  margin: 0;
  border: 1px solid var(--line);
}

.social-export-stage .social-export-content .section-heading {
  min-height: 72px;
  padding: 17px 20px 14px;
}

.social-export-stage .social-export-content .section-heading h2 {
  font-size: 20px;
  line-height: 1.2;
}

.social-export-stage .social-export-content .section-heading p {
  margin-top: 4px;
  color: #c7cad2;
  font-size: 14px;
  line-height: 1.35;
}

.social-export-metadata {
  flex: 0 0 auto;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-left: auto;
}

.social-export-logo {
  width: 60px;
  height: 60px;
  display: block;
  object-fit: cover;
  border: 1px solid #343842;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.32);
}

.social-export-stage .source-badge,
.social-export-stage .status-badge {
  min-height: 26px;
  padding: 4px 8px;
  color: #bfc3cc;
  font-size: 10px;
}

.social-export-stage.social-export-h2h .h2h-axis-key {
  padding: 14px 20px;
  color: #c7cad2;
  font-size: 12px;
}

.social-export-stage.social-export-h2h .h2h-desktop-board {
  position: static !important;
  width: auto !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.social-export-stage.social-export-h2h .h2h-mobile-list {
  display: none !important;
}

.social-export-stage.social-export-h2h .h2h-chart-board {
  grid-template-columns: 288px minmax(520px, 1fr) 288px;
}

.social-export-stage.social-export-h2h .h2h-driver-rail {
  padding-top: 42px;
  padding-bottom: 54px;
}

.social-export-stage.social-export-h2h .h2h-rail-driver {
  gap: 9px;
  padding: 4px 14px;
}

.social-export-stage.social-export-h2h .h2h-rail-driver.left {
  grid-template-columns: 76px minmax(0, 1fr) 60px;
}

.social-export-stage.social-export-h2h .h2h-rail-driver.right {
  grid-template-columns: 60px minmax(0, 1fr) 76px;
}

.social-export-stage.social-export-h2h .driver-portrait.h2h {
  width: 60px;
  height: 60px;
  flex-basis: 60px;
}

.social-export-stage.social-export-h2h .h2h-driver-identity strong {
  font-size: 17px;
}

.social-export-stage.social-export-h2h .h2h-driver-identity span {
  margin-top: 3px;
  color: #d2d5dc;
  font-size: 13px;
}

.social-export-stage.social-export-h2h .h2h-driver-identity small {
  margin-top: 2px;
  color: #b8bdc7;
  font-size: 12px;
}

.social-export-stage.social-export-h2h .h2h-edge-score strong {
  font-size: 15px;
}

.social-export-stage.social-export-h2h .h2h-edge-score small {
  margin-top: 4px;
  color: #c7cad2;
  font-size: 12px;
  line-height: 1.2;
}

.status-badge.ready {
  color: var(--green);
  border-color: rgba(112, 214, 134, 0.35);
}

.status-badge.deleted {
  color: var(--red);
  border-color: rgba(255, 92, 101, 0.38);
}

.status-badge.untimed {
  color: var(--amber);
  border-color: rgba(244, 189, 79, 0.38);
}

.status-badge.quality {
  color: var(--blue);
  border-color: rgba(100, 167, 255, 0.38);
}

.status-badge.deferred {
  color: var(--amber);
  border-color: rgba(244, 189, 79, 0.38);
}

.chart {
  width: 100%;
  height: 560px;
}

.chart.medium {
  height: 430px;
}

.chart.compact {
  height: 300px;
}

.detail-list {
  margin: 0;
  padding: 2px 15px 12px;
}

.detail-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 47px;
  border-bottom: 1px solid var(--line-soft);
}

.detail-row:last-child {
  border-bottom: 0;
}

.detail-row dt,
.detail-row dd {
  margin: 0;
}

.detail-row dt {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
}

.detail-row dd {
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
  text-align: right;
}

.detail-row small {
  display: block;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 500;
}

.insight-stack {
  display: grid;
  gap: 1px;
  background: var(--line-soft);
}

.insight {
  min-height: 86px;
  padding: 14px 15px;
  background: var(--surface);
}

.insight-label {
  color: var(--red);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.insight strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
}

.insight p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line-soft);
}

.metric-card {
  min-width: 0;
  min-height: 96px;
  padding: 14px 15px;
  background: var(--surface);
}

.metric-card .label {
  display: block;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.metric-card .value {
  display: block;
  margin-top: 6px;
  overflow: hidden;
  font-size: 18px;
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card .detail {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.driver-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.driver-portrait {
  position: relative;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  overflow: hidden;
  border: 2px solid var(--driver-color, var(--muted));
  border-radius: 50%;
  background: var(--surface-2);
  box-shadow: 0 0 0 3px rgba(5, 6, 8, 0.58);
}

.driver-portrait.small {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
}

.driver-portrait.tiny {
  width: 31px;
  height: 31px;
  flex-basis: 31px;
  border-width: 1.5px;
  box-shadow: 0 0 0 2px rgba(5, 6, 8, 0.58);
}

.driver-portrait.distribution {
  width: 52px;
  height: 52px;
  flex-basis: 52px;
  border-width: 2px;
  box-shadow: 0 0 0 2px rgba(5, 6, 8, 0.58);
}

.driver-portrait.compare {
  width: 54px;
  height: 54px;
  flex-basis: 54px;
  border-width: 2px;
  box-shadow: 0 0 0 2px rgba(5, 6, 8, 0.62);
}

.driver-portrait.ledger {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
  border-width: 1.5px;
  box-shadow: 0 0 0 2px rgba(5, 6, 8, 0.5);
}

.driver-portrait.micro {
  width: 28px;
  height: 28px;
  flex-basis: 28px;
  border-width: 1.5px;
  box-shadow: none;
}

.driver-portrait.field {
  width: 52px;
  height: 52px;
  flex-basis: 52px;
  box-shadow: 0 0 0 3px rgba(5, 6, 8, 0.72), 0 5px 14px rgba(0, 0, 0, 0.34);
}

.driver-portrait img {
  width: 100%;
  height: auto;
  display: block;
  transform: translateY(-1px);
}

.h2h-layout {
  grid-template-columns: minmax(0, 1fr) minmax(350px, 420px);
}

.h2h-axis-key {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 1.4fr) minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 11px 18px;
  color: var(--muted);
  border-bottom: 1px solid var(--line-soft);
  font-size: var(--secondary-text-compact);
  font-weight: 850;
  text-transform: uppercase;
}

.h2h-axis-key strong {
  color: var(--text);
  text-align: center;
}

.h2h-axis-key span:last-child {
  text-align: right;
}

.h2h-board-section {
  overflow: hidden;
}

.h2h-mobile-list {
  display: none;
}

.h2h-board-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.h2h-chart-board {
  min-width: 1060px;
  display: grid;
  grid-template-columns: 260px minmax(500px, 1fr) 260px;
  background: var(--surface);
}

.h2h-chart {
  width: 100%;
  height: 100%;
}

.h2h-driver-rail {
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 42px 0 54px;
}

.h2h-driver-rail.left {
  border-right: 1px solid var(--line-soft);
}

.h2h-driver-rail.right {
  border-left: 1px solid var(--line-soft);
}

.h2h-rail-driver {
  min-height: 0;
  flex: 1 1 0;
  display: grid;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-bottom: 1px solid var(--line-soft);
}

.h2h-rail-driver:last-child {
  border-bottom: 0;
}

.h2h-rail-driver.left {
  grid-template-columns: 68px minmax(0, 1fr) 54px;
}

.h2h-rail-driver.right {
  grid-template-columns: 54px minmax(0, 1fr) 68px;
}

.driver-portrait.h2h {
  width: 52px;
  height: 52px;
  flex-basis: 52px;
  border-width: 2px;
  box-shadow: 0 0 0 2px rgba(5, 6, 8, 0.68);
}

.h2h-driver-identity,
.h2h-driver-identity strong,
.h2h-driver-identity span,
.h2h-driver-identity small,
.h2h-edge-score,
.h2h-edge-score strong,
.h2h-edge-score small {
  min-width: 0;
  display: block;
}

.h2h-rail-driver.left .h2h-driver-identity {
  text-align: right;
}

.h2h-driver-identity strong {
  color: var(--text);
  font-size: 15px;
  line-height: 1.05;
}

.h2h-driver-identity span {
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--secondary-text-size);
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.h2h-driver-identity small {
  overflow: hidden;
  margin-top: 1px;
  color: var(--muted-2);
  font-size: var(--secondary-text-compact);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.h2h-edge-score {
  color: var(--driver-color);
}

.h2h-rail-driver.right .h2h-edge-score {
  text-align: right;
}

.h2h-edge-score strong {
  font-size: 14px;
  line-height: 1.1;
}

.h2h-edge-score small {
  margin-top: 3px;
  color: var(--muted);
  font-size: var(--secondary-text-compact);
  font-weight: 750;
  line-height: 1.15;
}

.h2h-mobile-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.h2h-mobile-card > header {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line-soft);
}

.h2h-mobile-card > header strong {
  font-size: 13px;
}

.h2h-mobile-card > header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.h2h-mobile-matchup {
  min-height: 124px;
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) 84px;
  align-items: center;
  gap: 7px;
  padding: 10px 8px 9px;
}

.h2h-mobile-driver {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-direction: column;
  text-align: center;
}

.h2h-mobile-driver .driver-portrait.h2h {
  width: 58px;
  height: 58px;
  flex-basis: 58px;
  margin-bottom: 5px;
}

.h2h-mobile-driver strong,
.h2h-mobile-driver span {
  max-width: 84px;
  overflow: hidden;
  display: block;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.h2h-mobile-driver small {
  max-width: 84px;
  display: block;
}

.h2h-mobile-driver strong {
  color: var(--text);
  font-size: 15px;
  line-height: 1.05;
}

.h2h-mobile-driver span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.h2h-mobile-driver small {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
}

.h2h-mobile-result {
  min-width: 0;
  text-align: center;
}

.h2h-mobile-result > strong,
.h2h-mobile-result > span {
  display: block;
}

.h2h-mobile-result > strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.2;
}

.h2h-mobile-result > span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.h2h-mobile-winbar {
  height: 9px;
  overflow: hidden;
  display: flex;
  margin: 9px 0 3px;
  border: 1px solid #050608;
  border-radius: 4px;
  background: var(--surface-3);
}

.h2h-mobile-winbar i {
  min-width: 0;
  height: 100%;
  display: block;
}

.h2h-mobile-delta {
  padding: 0 12px 10px;
}

.h2h-mobile-event-track {
  position: relative;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}

.h2h-mobile-zero {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  border-left: 1px dashed var(--muted-2);
}

.h2h-mobile-event-dot,
.h2h-mobile-average {
  position: absolute;
  top: 50%;
  left: var(--point);
  display: block;
  transform: translate(-50%, -50%);
}

.h2h-mobile-event-dot {
  width: 9px;
  height: 9px;
  border: 1px solid #050608;
  border-radius: 50%;
  background: var(--point-color);
}

.h2h-mobile-average {
  width: 11px;
  height: 11px;
  z-index: 2;
  border: 2px solid #050608;
  background: var(--text);
  transform: translate(-50%, -50%) rotate(45deg);
}

.h2h-mobile-delta-labels {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.distribution-section {
  overflow: hidden;
}

.distribution-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.distribution-stage {
  width: 100%;
}

.distribution-chart {
  height: 570px;
}

.distribution-driver-strip {
  display: grid;
  grid-template-columns: repeat(var(--distribution-count), minmax(56px, 1fr));
  align-items: start;
  padding: 2px 22px 16px 64px;
}

.distribution-driver-strip > div {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 3px;
}

.distribution-driver-strip strong,
.distribution-driver-strip span {
  display: block;
  line-height: 1.1;
}

.distribution-driver-strip strong {
  font-size: var(--secondary-text-size);
}

.distribution-driver-strip span {
  color: var(--muted);
  font-size: var(--secondary-text-compact);
}

.distribution-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 9px 15px 13px;
  border-top: 1px solid var(--line-soft);
}

.distribution-key {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 9px 15px;
  color: var(--muted);
  font-size: var(--secondary-text-size);
  font-weight: 700;
}

.distribution-footer .distribution-key,
.distribution-footer .compound-key {
  padding: 0;
}

.distribution-key span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.distribution-key i {
  display: inline-block;
}

.distribution-key-violin {
  width: 14px;
  height: 8px;
  border: 1px solid var(--cyan);
  border-radius: 50%;
  background: rgba(41, 211, 198, 0.14);
}

.distribution-key-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
}

.distribution-key-median {
  width: 8px;
  height: 8px;
  transform: rotate(45deg);
  border: 1px solid #050608;
  background: var(--text);
}

.distribution-summary {
  margin-top: 22px;
}

.sector-distribution-stack {
  display: grid;
  gap: 22px;
}

.sector-stage {
  min-width: 760px;
}

.sector-distribution-chart {
  height: 400px;
}

.portrait-field {
  position: relative;
  height: 780px;
  overflow: hidden;
}

.portrait-field-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.portrait-field-axis-title {
  position: absolute;
  left: 15px;
  top: 50%;
  color: var(--muted-2);
  font-size: var(--secondary-text-compact);
  font-weight: 850;
  text-transform: uppercase;
  transform: translate(-45%, -50%) rotate(-90deg);
  transform-origin: center;
  white-space: nowrap;
}

.portrait-field-plot {
  position: absolute;
  inset: 35px 22px 38px 66px;
  border-left: 2px solid var(--red);
}

.portrait-field-gridline {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  border-top: 1px solid var(--line-soft);
}

.portrait-field-gridline.zero {
  border-top-color: var(--muted-2);
  border-top-style: dashed;
}

.portrait-field-gridline span {
  position: absolute;
  left: -47px;
  top: -8px;
  width: 39px;
  color: var(--muted);
  font-size: var(--secondary-text-compact);
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  text-align: right;
}

.portrait-field-marker {
  position: absolute;
  left: var(--field-left);
  top: var(--field-top);
  width: 88px;
  display: grid;
  justify-items: center;
  color: var(--text);
  text-align: center;
  transform: translate(-50%, -50%);
  z-index: 3;
}

.portrait-field-marker strong,
.portrait-field-marker small {
  display: block;
  max-width: 88px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portrait-field-marker strong {
  margin-top: 3px;
  font-size: var(--secondary-text-size);
  line-height: 1;
}

.portrait-field-marker small {
  margin-top: 2px;
  color: #c5c7ce;
  font-size: 11px;
  font-weight: 650;
}

.portrait-field.horizontal {
  width: 100%;
  min-width: 1120px;
  height: 650px;
}

.portrait-field.horizontal .driver-portrait.field {
  width: 70px;
  height: 70px;
  flex-basis: 70px;
  border-width: 2px;
}

.portrait-field.horizontal .portrait-field-marker {
  width: 102px;
}

.portrait-field.horizontal .portrait-field-marker strong,
.portrait-field.horizontal .portrait-field-marker small {
  max-width: 102px;
  overflow: visible;
  text-overflow: clip;
}

.portrait-field.horizontal .portrait-field-marker strong {
  margin-top: 5px;
  font-size: 15px;
  line-height: 1;
}

.portrait-field.horizontal .portrait-field-marker small {
  display: none;
}

.portrait-field.horizontal .portrait-field-axis-title {
  left: 50%;
  top: auto;
  bottom: 12px;
  transform: translateX(-50%);
}

.portrait-field.horizontal .portrait-field-plot {
  inset: 42px 66px 72px;
  border-left: 0;
  border-bottom: 2px solid var(--red);
}

.portrait-field.horizontal .portrait-field-gridline {
  left: var(--field-tick);
  right: auto;
  top: 0;
  bottom: 0;
  width: 1px;
  height: auto;
  border-top: 0;
  border-left: 1px solid var(--line-soft);
}

.portrait-field.horizontal .portrait-field-gridline.zero {
  border-top: 0;
  border-left-color: var(--muted-2);
  border-left-style: dashed;
}

.portrait-field.horizontal .portrait-field-gridline span {
  left: 50%;
  top: auto;
  bottom: -29px;
  width: auto;
  color: #c7cad2;
  font-size: var(--secondary-text-compact);
  transform: translateX(-50%);
}

.lap1-layout {
  grid-template-columns: minmax(0, 1fr) 300px;
}

.portrait-analysis-layout {
  grid-template-columns: minmax(0, 1fr);
}

.portrait-analysis-layout .detail-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 2px 14px 14px;
}

.portrait-analysis-layout .detail-row {
  min-height: 64px;
  padding: 10px 14px;
  border-right: 1px solid var(--line-soft);
}

.portrait-analysis-layout .detail-row:nth-child(3n) {
  border-right: 0;
}

.portrait-analysis-layout .detail-row dt {
  font-size: 12px;
}

.portrait-analysis-layout .detail-row dd {
  font-size: 13px;
}

.portrait-analysis-layout .detail-row small {
  margin-top: 3px;
  color: #b7bac3;
  font-size: 12px;
}

.lap1-ledger {
  padding: 3px 14px 9px;
}

.lap1-ledger-row {
  min-height: 48px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line-soft);
}

.lap1-ledger-row:last-child {
  border-bottom: 0;
}

.lap1-ledger-row strong,
.lap1-ledger-row span {
  display: block;
}

.lap1-ledger-row strong {
  font-size: var(--secondary-text-size);
}

.lap1-ledger-row span {
  color: var(--muted);
  font-size: var(--secondary-text-compact);
}

.lap1-ledger-row b {
  min-width: 23px;
  font-size: var(--secondary-text-size);
  text-align: right;
}

.lap1-ledger-row b.gain {
  color: var(--cyan);
}

.lap1-ledger-row b.loss {
  color: var(--red);
}

.lap1-ledger-row b.held {
  color: var(--muted);
}

.corner-lab-layout.delta-active {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
}

.corner-comparison-key {
  min-height: 82px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 60px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 7px 15px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-2);
}

.corner-comparison-key > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.corner-comparison-key > div.right {
  justify-content: flex-end;
  text-align: right;
}

.corner-comparison-key strong,
.corner-comparison-key small {
  display: block;
}

.corner-comparison-key strong {
  color: var(--compare-color, var(--text));
  font-size: 14px;
}

.corner-comparison-key small {
  color: #c6c9d1;
  font-size: 12px;
}

.corner-comparison-key .corner-comparison-zero {
  display: grid;
  justify-items: center;
  gap: 0;
  color: var(--muted);
}

.corner-delta-summary {
  min-height: 58px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line-soft);
}

.corner-delta-summary span {
  min-width: 0;
  display: grid;
  align-content: center;
  padding: 8px 10px;
  color: #d8dbe2;
  border-right: 1px solid var(--line-soft);
  font-size: 12px;
  font-weight: 650;
  text-align: center;
}

.corner-delta-summary span:last-child {
  border-right: 0;
}

.corner-delta-summary strong {
  display: block;
  color: var(--text);
  font-size: 18px;
}

.corner-delta-chart {
  height: 620px;
}

.lap1-summary-block {
  padding: 12px 15px 5px;
  border-bottom: 1px solid var(--line-soft);
}

.lap1-summary-block:last-child {
  border-bottom: 0;
}

.lap1-summary-block h3 {
  margin: 0 0 8px;
  color: var(--muted-2);
  font-size: 10px;
  text-transform: uppercase;
}

.lap1-highlight {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.lap1-highlight:last-child {
  border-bottom: 0;
}

.lap1-highlight div {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 8px;
}

.lap1-highlight strong,
.lap1-highlight span {
  display: block;
}

.lap1-highlight strong {
  font-size: 13px;
}

.lap1-highlight span {
  grid-column: 1;
  color: var(--muted);
  font-size: 11px;
}

.lap1-highlight b {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-size: 18px;
}

.lap1-highlight.gain b {
  color: var(--cyan);
}

.lap1-highlight.loss b {
  color: var(--red);
}

.lap1-summary-block.neutral p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.driver-color {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--driver-color, var(--muted));
}

.data-table-wrap {
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
  height: 42px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: right;
  white-space: nowrap;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--muted-2);
  background: var(--surface);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.data-table th:first-child,
.data-table td:first-child,
.data-table .align-left {
  text-align: left;
}

.data-table tbody tr:hover {
  background: var(--surface-2);
}

.coverage-ledger-wrap {
  max-height: 620px;
}

.coverage-ledger td:nth-child(1) {
  min-width: 190px;
}

.coverage-ledger td:nth-child(2) {
  min-width: 90px;
}

.coverage-ledger td:nth-child(3),
.coverage-ledger td:nth-child(4) {
  min-width: 150px;
}

.coverage-ledger td:nth-child(5) {
  min-width: 270px;
  white-space: normal;
}

.quality-definition {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 15px;
  color: var(--muted);
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-2);
  font-size: 12px;
}

.quality-definition svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  color: var(--cyan);
}

.quality-definition strong,
.quality-definition span {
  display: block;
}

.quality-definition strong {
  color: var(--text);
  font-size: 12px;
}

.quality-definition span {
  margin-top: 2px;
}

.quality-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.quality-table-wrap {
  max-height: 520px;
}

.quality-table {
  min-width: 920px;
}

.quality-table .quality-reason,
.quality-table .quality-gate {
  min-width: 210px;
  white-space: normal;
}

.quality-table .quality-gate {
  color: var(--muted);
  font-size: 12px;
}

.mobile-quality-context {
  display: none;
}

.position-cell {
  color: var(--muted);
  font-weight: 800;
}

.delta-positive {
  color: var(--green);
}

.delta-negative {
  color: var(--red);
}

.compound {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--secondary-text-compact);
  font-weight: 800;
}

.compound::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--compound-color, var(--muted));
}

.compound-key {
  display: flex;
  flex-wrap: wrap;
  gap: 13px;
  padding: 10px 15px 0;
  color: var(--muted);
}

.ideal-key {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 15px;
  padding: 10px 15px 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.ideal-key-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.ideal-key-bar {
  width: 18px;
  height: 8px;
  border-radius: 2px;
}

.ideal-key-bar.s1 {
  background: var(--red);
}

.ideal-key-bar.s2 {
  background: var(--cyan);
}

.ideal-key-bar.s3 {
  background: var(--amber);
}

.ideal-key-line {
  position: relative;
  width: 20px;
  height: 10px;
}

.ideal-key-line::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 0;
  width: 100%;
  border-top: 2px dashed var(--key-color);
}

.ideal-key-line::after {
  content: "";
  position: absolute;
  top: 0;
  left: 7px;
  width: 7px;
  height: 7px;
  border: 2px solid var(--key-color);
  border-radius: 50%;
  background: var(--surface);
}

.ideal-key-line.actual {
  --key-color: var(--green);
}

.ideal-key-line.ideal {
  --key-color: var(--text);
}

.empty-state {
  min-height: 420px;
  display: grid;
  place-items: center;
  padding: 40px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  text-align: center;
}

.empty-state svg {
  width: 28px;
  height: 28px;
  color: var(--muted-2);
}

.empty-state h2 {
  margin: 12px 0 5px;
  font-size: 16px;
}

.empty-state p {
  max-width: 440px;
  margin: 0;
  color: var(--muted);
}

.empty-state button {
  margin-top: 16px;
  height: 36px;
  padding: 0 14px;
  color: #0a0b0d;
  border: 0;
  border-radius: 4px;
  background: var(--text);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

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

.coverage-session {
  min-width: 0;
  padding: 16px;
  border-top: 2px solid var(--green);
  background: var(--surface);
}

.coverage-session h3 {
  margin-bottom: 12px;
  font-size: 14px;
}

.coverage-bar {
  height: 5px;
  margin: 7px 0 13px;
  overflow: hidden;
  background: var(--surface-3);
}

.coverage-bar span {
  display: block;
  height: 100%;
  background: var(--green);
}

.download-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 18px;
  background: var(--line-soft);
}

.download-link {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
}

.download-link:hover {
  background: var(--surface-2);
}

.download-link strong,
.download-link span {
  display: block;
}

.download-link strong {
  font-size: 12px;
}

.download-link span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.download-link svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--red);
}

.workspace-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 28px;
  padding-top: 14px;
  color: var(--muted-2);
  border-top: 1px solid var(--line-soft);
  font-size: 11px;
}

.workspace-footer strong {
  color: var(--muted);
}

.definitions-dialog {
  width: min(720px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 40px));
  padding: 0;
  overflow: auto;
  color: var(--text);
  border: 1px solid #3b404a;
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.6);
}

.definitions-dialog::backdrop {
  background: rgba(3, 4, 6, 0.82);
  backdrop-filter: blur(3px);
}

.dialog-heading {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.dialog-heading h2 {
  margin: 2px 0 0;
  font-size: 22px;
}

.definitions-list {
  margin: 0;
}

.definition-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.4fr) minmax(0, 1fr);
  gap: 22px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line-soft);
}

.definition-row dt,
.definition-row dd {
  margin: 0;
}

.definition-row dt {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  text-transform: capitalize;
}

.definition-row dd {
  color: var(--muted);
  font-size: 13px;
}

.dialog-empty {
  padding: 18px 20px;
  color: var(--muted);
}

.freshness-panel {
  padding: 17px 20px 20px;
  background: #0d0f13;
}

.freshness-heading,
.freshness-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
}

.freshness-heading {
  padding-bottom: 9px;
  color: var(--muted);
  font-size: 12px;
}

.freshness-heading strong {
  color: var(--text);
  font-size: 14px;
}

.freshness-row {
  min-height: 40px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
}

.freshness-row time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.freshness-state {
  color: var(--green);
  font-weight: 750;
}

.freshness-state.fetching,
.freshness-state.reconciling,
.freshness-state.partial,
.freshness-state.stale {
  color: var(--amber);
}

.freshness-state.failed,
.freshness-state.held {
  color: var(--red);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 210px minmax(200px, 1fr) auto;
  }

  .workspace-header {
    flex-direction: column;
    gap: 16px;
  }

  .workspace-actions {
    width: 100%;
  }

  .driver-select {
    width: auto;
    flex: 1;
    max-width: 220px;
  }

  .analysis-grid,
  .analysis-grid.equal {
    grid-template-columns: minmax(0, 1fr);
  }

  .corner-lab-layout.delta-active {
    grid-template-columns: minmax(0, 1fr);
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .topbar {
    position: relative;
    grid-template-columns: minmax(170px, 1fr) auto;
    gap: 12px;
    padding: 9px 12px;
  }

  .event-lockup {
    display: none;
  }

  .session-switcher {
    min-width: 300px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 25;
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
    padding: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .analysis-nav {
    display: none;
  }

  .mobile-view-picker {
    width: 100%;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    color: var(--red);
  }

  .mobile-view-picker svg {
    width: 18px;
    height: 18px;
  }

  .mobile-view-picker select {
    width: 100%;
    height: 38px;
    padding: 0 34px 0 10px;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--surface-2);
    font-size: 13px;
    font-weight: 750;
  }

  .workspace {
    padding: 22px 14px 18px;
  }

  .kpi-strip {
    grid-template-columns: repeat(5, minmax(116px, 1fr));
    overflow-x: auto;
  }

  .kpi {
    min-width: 116px;
  }

  .coverage-grid,
  .download-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .chart {
    height: 500px;
  }
}

@media (max-width: 600px) {
  .topbar {
    min-height: 58px;
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .brand-lockup {
    display: flex;
  }

  .brand-lockup img {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .brand-lockup > div {
    display: none;
  }

  .session-switcher {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(var(--session-count, 3), minmax(0, 1fr));
  }

  .session-switcher button {
    padding: 0 3px;
    font-size: 10px;
  }

  .session-label-full {
    display: none;
  }

  .session-label-compact {
    display: inline;
  }

  .workspace-header {
    padding-bottom: 17px;
  }

  h1 {
    font-size: 23px;
  }

  .workspace-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px minmax(0, 1fr);
  }

  .export-preset {
    width: 100%;
  }

  .export-preset select {
    height: 38px;
  }

  .driver-select {
    width: 100%;
    max-width: none;
  }

  .icon-button {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .kpi {
    min-width: 0;
  }

  .kpi:nth-child(odd) {
    border-left: 0;
  }

  .kpi:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .kpi:last-child {
    grid-column: 1 / -1;
  }

  .kpi-value,
  .kpi-detail {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .kpi-value {
    font-size: 17px;
  }

  .view-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar-controls {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-select {
    width: 100%;
  }

  .segmented {
    width: 100%;
    overflow-x: auto;
  }

  .metric-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .distribution-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .portrait-field {
    height: 780px;
  }

  .portrait-field.horizontal {
    min-width: 1120px;
  }

  .portrait-field.horizontal .portrait-field-plot {
    inset: 38px 58px 70px;
  }

  .portrait-field-plot {
    inset: 34px 8px 38px 56px;
  }

  .portrait-field-gridline span {
    left: -42px;
    width: 34px;
  }

  .driver-portrait.field {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .portrait-field.horizontal .driver-portrait.field {
    width: 60px;
    height: 60px;
    flex-basis: 60px;
  }

  .portrait-field-marker {
    width: 62px;
  }

  .portrait-field.horizontal .portrait-field-marker {
    width: 96px;
  }

  .portrait-field-marker strong,
  .portrait-field-marker small {
    max-width: 62px;
  }

  .portrait-field:not(.horizontal) .portrait-field-marker small {
    display: none;
  }

  .portrait-field.horizontal .portrait-field-marker strong,
  .portrait-field.horizontal .portrait-field-marker small {
    max-width: 96px;
  }

  .portrait-field.horizontal .portrait-field-marker strong {
    font-size: 13px;
  }

  .portrait-field.horizontal .portrait-field-marker small {
    display: none;
  }

  .portrait-analysis-layout .detail-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .portrait-analysis-layout .detail-row,
  .portrait-analysis-layout .detail-row:nth-child(3n) {
    border-right: 0;
  }

  .corner-comparison-key {
    grid-template-columns: minmax(0, 1fr) 38px minmax(0, 1fr);
    padding-inline: 9px;
  }

  .corner-delta-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .corner-delta-summary span:nth-child(2) {
    border-right: 0;
  }

  .corner-delta-summary span:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line-soft);
  }

  .h2h-board-section {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .h2h-board-section > .section-heading {
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
  }

  .h2h-desktop-board {
    position: fixed;
    top: 0;
    left: -1200px;
    width: 1060px;
    visibility: hidden;
    pointer-events: none;
  }

  .h2h-mobile-list {
    display: grid;
    gap: 10px;
  }

  .driver-portrait.small {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

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

  .quality-table .quality-detail-col {
    display: none;
  }

  .quality-table th:nth-child(1),
  .quality-table td:nth-child(1) {
    width: 43%;
  }

  .quality-table th:nth-child(2),
  .quality-table td:nth-child(2) {
    width: 10%;
  }

  .quality-table th:nth-child(3),
  .quality-table td:nth-child(3) {
    width: 22%;
  }

  .quality-table th:nth-child(4),
  .quality-table td:nth-child(4) {
    width: 25%;
  }

  .quality-table th,
  .quality-table td {
    height: auto;
    padding: 9px 6px;
  }

  .quality-table .driver-chip {
    gap: 4px;
  }

  .quality-table .driver-chip small {
    display: none;
  }

  .mobile-quality-context {
    display: block;
    margin-top: 4px;
    overflow-wrap: anywhere;
    color: var(--muted-2);
    font-size: 10px;
    line-height: 1.3;
    text-transform: none;
    white-space: normal;
  }

  .chart,
  .chart.medium {
    height: 430px;
  }

  .chart.compact {
    height: 280px;
  }

  .workspace-footer {
    flex-direction: column;
    gap: 5px;
  }

  .definition-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
  }

  .freshness-heading,
  .freshness-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .freshness-row time {
    grid-column: 1 / -1;
    padding-bottom: 7px;
  }
}

@media (max-width: 360px) {
  .session-switcher button {
    font-size: 9px;
  }
}
