:root {
  --ink: #f2f5f7;
  --muted: #aab4be;
  --line: #3a424a;
  --panel: #222b35;
  --input: #19232d;
  --wash: #1b2129;
  --hero: #19232d;
  --focus: #57d6e4;
  --match: #ee6772;
  --focus-pale: #9ee7ef;
  --shadow: 0 12px 36px rgba(5, 9, 13, 0.22);
}

* { box-sizing: border-box; }

html,
body { min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--wash);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.page-shell { min-height: 100vh; }

.hero {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(360px, 1.8fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 28px;
  min-height: 82px;
  padding: 11px max(18px, calc((100vw - 1760px) / 2));
  color: var(--ink);
  background: var(--hero);
  border-bottom: 1px solid var(--line);
}

.eyebrow,
.section-label,
.result-kicker {
  font-size: 0.64rem;
  font-weight: 750;
  letter-spacing: 0.13em;
}

.eyebrow {
  grid-column: 1;
  grid-row: 1;
  align-self: end;
  color: var(--focus-pale);
}

.hero h1 {
  grid-column: 1;
  grid-row: 2;
  align-self: start;
  margin: 1px 0 0;
  font-size: clamp(2rem, 2.4vw, 2.55rem);
  font-weight: 780;
  letter-spacing: -0.055em;
  line-height: 1;
}

.hero-copy {
  grid-column: 2;
  grid-row: 1 / span 2;
  max-width: 610px;
  margin: 0;
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.42;
}

.source-line {
  display: flex;
  grid-column: 3;
  grid-row: 1 / span 2;
  flex-wrap: wrap;
  justify-content: end;
  gap: 7px;
  margin: 0;
  color: var(--focus-pale);
  font-size: 0.7rem;
}

.build-id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

main {
  width: min(1760px, calc(100% - 24px));
  margin: 0 auto;
  padding: 9px 0 24px;
}

.control-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(340px, 460px)) minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  align-items: stretch;
  padding: 8px 0 0;
}

.selection-card {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
}

.selection-card-heading {
  display: flex;
  min-height: 18px;
  align-items: center;
  justify-content: space-between;
}

.selection-card .section-label { color: var(--focus); }

.selection-card .control {
  min-width: 0;
}

.control label {
  display: block;
  margin: 0 0 3px 2px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.reset-button {
  margin: 0;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.reset-button:hover {
  border-color: var(--focus);
  color: var(--focus);
}

.Select-control,
.dash-dropdown .Select-control {
  min-height: 34px;
  height: 34px;
  border-color: var(--line) !important;
  border-radius: 7px !important;
  color: var(--ink) !important;
  background: var(--input) !important;
  box-shadow: none !important;
}

.Select-value,
.Select-placeholder,
.Select-input { line-height: 32px !important; }

.Select-value-label,
.Select-placeholder,
.Select-input > input { color: var(--ink) !important; }

.Select-arrow { border-top-color: var(--muted) !important; }

.Select-menu-outer {
  border-color: var(--line) !important;
  color: var(--ink) !important;
  background: var(--panel) !important;
}

.VirtualizedSelectOption { background: var(--panel); }
.VirtualizedSelectFocusedOption { background: var(--line); }

button.dash-dropdown {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--input);
}

button.dash-dropdown:hover,
button.dash-dropdown[aria-expanded="true"] { border-color: var(--focus); }

.dash-dropdown-placeholder { color: var(--muted) !important; }
button.dash-dropdown:disabled { opacity: 0.64; }

.dash-dropdown-content {
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.control .dash-dropdown-content { max-height: 360px; }

.control .dash-dropdown-options {
  max-height: 308px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--muted) var(--input);
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.control .dash-dropdown-options::-webkit-scrollbar { width: 8px; }
.control .dash-dropdown-options::-webkit-scrollbar-track { background: var(--input); }
.control .dash-dropdown-options::-webkit-scrollbar-thumb {
  border: 2px solid var(--input);
  border-radius: 999px;
  background: var(--muted);
}

.dash-dropdown-search-container {
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: var(--input);
}

.dash-dropdown-search { color: var(--ink); background: var(--input); }
.dash-dropdown-search::placeholder { color: var(--muted); }
.dash-dropdown-option { color: var(--ink); background: var(--panel); }
.dash-dropdown-option:hover { background: var(--line); }
.dash-dropdown-option[aria-selected="true"] { color: var(--focus); }

.result-intro {
  display: block;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
}

.match-summary-card {
  grid-column: 2;
  width: 100%;
}

.result-intro > div { min-width: 0; }
.result-kicker { color: var(--match); }

.result-intro h2 {
  margin: 1px 0 0;
  overflow: hidden;
  font-size: clamp(1.05rem, 1.4vw, 1.35rem);
  letter-spacing: -0.035em;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-note {
  max-width: 650px;
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.summary-metrics {
  gap: 5px;
  margin-top: 7px;
}

.summary-metrics .metric-card {
  padding: 5px 6px;
  border-radius: 6px;
  background: var(--input);
  box-shadow: none;
}

.summary-metrics .metric-label { font-size: 0.55rem; }
.summary-metrics .metric-value { font-size: 0.82rem; }
.summary-metrics .metric-percentile { font-size: 0.53rem; }

.metric-card,
.chart-card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 5px 18px rgba(5, 9, 13, 0.16);
}

.metric-card {
  min-width: 0;
  padding: 8px 10px;
  border-radius: 9px;
}

.metric-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-value {
  margin-top: 1px;
  font-size: 1rem;
  font-weight: 760;
  letter-spacing: -0.03em;
}

.metric-percentile {
  color: var(--focus);
  font-size: 0.62rem;
}

.report-heading {
  display: flex;
  align-items: baseline;
  gap: 9px;
  max-width: none;
  margin-top: 20px;
  min-height: 20px;
  padding: 3px;
}

.report-heading .section-label { color: var(--focus); }

.report-heading h2 {
  margin: 0;
  font-size: 0.86rem;
  letter-spacing: -0.025em;
  line-height: 1;
}

.report-heading p {
  display: none;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(290px, 1fr);
  gap: 9px;
  min-height: 0;
}

.dashboard-card {
  position: relative;
  min-width: 0;
  min-height: 0;
  margin: 0;
  border-radius: 10px;
  overflow: hidden;
}

.dashboard-graph,
.dashboard-graph .js-plotly-plot,
.dashboard-graph .plot-container,
.dashboard-graph .svg-container {
  width: 100% !important;
  height: 100% !important;
}

.expand-button {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 8;
  display: grid;
  width: 27px;
  height: 27px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(25, 35, 45, 0.9);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.78;
}

.expandable-card:hover .expand-button,
.expand-button:focus-visible {
  border-color: var(--focus);
  color: var(--focus);
  opacity: 1;
}

.section-label { color: var(--muted); }

footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 14px;
  padding: 14px 3px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.45;
}

footer p { margin: 0; }
.modebar-btn path { fill: var(--muted) !important; }
.modebar-btn:hover path { fill: var(--focus) !important; }
.expandable-card:not(.is-expanded) .modebar { display: none !important; }

body.chart-expanded { overflow: hidden !important; }

body.chart-expanded::before {
  position: fixed;
  z-index: 999;
  inset: 0;
  background: rgba(10, 15, 20, 0.78);
  backdrop-filter: blur(4px);
  content: "";
}

.expandable-card.is-expanded {
  position: fixed;
  z-index: 1000;
  inset: 16px;
  width: auto;
  height: auto;
  margin: 0;
  border-color: var(--focus);
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(3, 7, 10, 0.58);
}

.expandable-card.is-expanded .expand-button {
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  color: var(--ink);
  opacity: 1;
}

.expandable-card.is-expanded .modebar { right: 46px !important; }

@media (min-width: 1680px) and (min-height: 860px) {
  html,
  body,
  #react-entry-point,
  #_dash-app-content {
    height: 100%;
    overflow: hidden;
  }

  .page-shell {
    display: grid;
    grid-template-rows: 82px minmax(0, 1fr);
    height: 100dvh;
    min-height: 0;
  }

  main {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 0;
    height: 100%;
    min-height: 0;
    padding-bottom: 9px;
    overflow: hidden;
  }

  .dashboard-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    grid-auto-rows: unset;
  }

  footer { display: none; }
}

@media (max-width: 1099px) {
  .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr auto;
    padding: 12px 18px;
  }

  .hero-copy { display: none; }
  .source-line { grid-column: 2; }
  .control-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .match-summary-card { grid-column: auto; }
  .report-heading p { display: none; }
}

@media (max-width: 820px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 580px) {
  main { width: min(100% - 16px, 1760px); }
  .hero { grid-template-columns: 1fr; }
  .source-line { display: none; }
  .control-panel { grid-template-columns: 1fr; }
  .match-summary-card { grid-column: auto; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .report-heading { flex-wrap: wrap; }
  footer { grid-template-columns: 1fr; }
}
