:root {
  --ink: #182a40; --muted: #617187; --line: #dfe6ef; --paper: #f3f6fa;
  --accent: #145c86; --teal: #11766a; --red: #b54845; --amber: #996315;
  --shadow: 0 3px 16px rgba(34, 55, 83, .035); --radius: 14px;
  font-family: "Segoe UI", Inter, Arial, sans-serif; color: var(--ink); background: var(--paper);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.45; }
button, input, select { font: inherit; }
button, select, a { -webkit-tap-highlight-color: transparent; }
button, select { color: var(--ink); }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
a { color: var(--accent); }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 3px solid #6ba7d8; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 30px; line-height: 1.15; font-weight: 650; letter-spacing: -.8px; }
h2 { font-size: 19px; font-weight: 650; letter-spacing: -.3px; }
h3 { font-size: 13px; margin: 20px 0 12px; }
.page { max-width: 1540px; padding: 32px 28px 20px; margin: auto; }
.page-header, .brand, .header-note, .toolbar, .connection-row, .section-heading, .progress-panel, .legend, .image-controls, .heatmap-legend { display: flex; align-items: center; }
.page-header { justify-content: space-between; margin-bottom: 25px; gap: 20px; }
.brand { gap: 14px; }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: #173d59; color: white; font-size: 26px; font-weight: 700; }
.eyebrow { font-size: 10px; letter-spacing: 1.15px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
.header-note { gap: 12px; color: var(--muted); font-size: 12px; }
.tag { font-size: 11px; border: 1px solid #cddbe9; background: #edf4fa; color: #31536e; padding: 5px 10px; border-radius: 20px; font-weight: 650; white-space: nowrap; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; min-width: 0; }
.toolbar { gap: 15px; padding: 15px 18px; flex-wrap: wrap; }
.session-control { flex: 1; min-width: 250px; display: grid; gap: 4px; font-size: 11px; font-weight: 650; color: var(--muted); }
select { border: 1px solid #ced9e5; background: #fff; border-radius: 7px; min-height: 36px; padding: 6px 28px 6px 10px; max-width: 100%; font-size: 13px; }
.session-control select { width: 100%; font-weight: 500; }
.button { border: 1px solid #ccd8e5; border-radius: 8px; padding: 9px 13px; background: white; font-weight: 600; font-size: 12px; white-space: nowrap; }
.button:hover:not(:disabled) { background: #eef4fa; }
.button.primary { background: var(--accent); color: white; border-color: var(--accent); }
.button.primary:hover:not(:disabled) { background: #104a6b; }
.refresh-toggle { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); white-space: nowrap; }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.status { font-size: 11px; padding: 4px 9px; border-radius: 6px; font-weight: 650; white-space: nowrap; }
.status.accepted { background: #e5f3ef; color: #186654; }
.status.rejected, .status.failed { background: #faeae9; color: #973c38; }
.status.pending { background: #fff3dc; color: #8f611a; }
.status.neutral { background: #edf1f6; color: #516379; }
.connection-row { gap: 8px; font-size: 11px; min-height: 37px; color: var(--muted); flex-wrap: wrap; }
.connection-dot { width: 7px; height: 7px; background: #aab6c5; border-radius: 50%; flex: 0 0 auto; }
.connection-dot.live { background: #239283; box-shadow: 0 0 0 3px #e1f1ed; }
.connection-dot.error { background: var(--red); }
.connection-dot.paused { background: #bc8b35; }
#updated-label { margin-left: auto; }
.muted, .subtle { color: var(--muted); }
.subtle { font-size: 11px; }
.alerts { display: grid; gap: 7px; margin: 4px 0 16px; }
.alert { border: 1px solid #ead6b4; border-left: 3px solid #c48d35; padding: 10px 13px; border-radius: 7px; background: #fffbf2; color: #735525; font-size: 12px; overflow-wrap: anywhere; }
.alert.error { border-color: #e5bfbf; border-left-color: var(--red); background: #fff5f4; color: #913d38; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric { padding: 18px 20px; display: flex; flex-direction: column; min-height: 150px; }
.metric strong { font-size: 32px; letter-spacing: -1px; font-variant-numeric: tabular-nums; font-weight: 650; line-height: 1.3; }
.metric > p:not(.eyebrow) { margin-top: 4px; color: var(--muted); font-size: 11px; }
.metric-foot { display: block; padding-top: 10px; margin-top: auto; font-size: 11px; color: #445d77; }
.positive { color: var(--teal); }
.negative { color: var(--red); }
.progress-panel { margin-top: 14px; gap: 30px; padding: 18px 22px; flex-wrap: wrap; }
.progress-main { flex: 1; min-width: 240px; }
.progress-main > div { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; margin-bottom: 8px; flex-wrap: wrap; }
progress { appearance: none; width: 100%; height: 6px; border: 0; display: block; border-radius: 10px; overflow: hidden; background: #e8edf3; }
progress::-webkit-progress-bar { background: #e8edf3; }
progress::-webkit-progress-value { background: #3b819f; border-radius: 10px; }
progress::-moz-progress-bar { background: #3b819f; border-radius: 10px; }
.counts { display: flex; gap: 24px; margin: 0; }
.counts div { min-width: 47px; }
dt { color: var(--muted); font-size: 11px; }
dd { margin: 3px 0 0; font-variant-numeric: tabular-nums; }
.counts dd { font-size: 21px; font-weight: 600; }
.image-overview { margin-top: 20px; }
.section-heading { justify-content: space-between; gap: 15px; margin-bottom: 15px; flex-wrap: wrap; }
.representative-images { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.image-card { background: #f8fafc; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; text-align: left; padding: 0; width: 100%; }
button.image-card:hover { border-color: #79a4c1; box-shadow: 0 0 0 2px #e6f0f7; }
.image-card.active { border-color: var(--accent); }
.image-card-body { padding: 10px 13px; }
.image-card-body, .thumbnail, .axis-controls label, .section-heading > div { min-width: 0; }
.image-card-title { font-size: 12px; font-weight: 650; display: flex; justify-content: space-between; gap: 10px; }
.image-card-detail { font-size: 11px; color: var(--muted); margin-top: 4px; }
.thumbnail { height: 160px; display: grid; place-items: center; background: #f4f7fa; overflow: hidden; }
.thumbnail img { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumbnail, .selected-image { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.thumbnail img, .selected-image img { min-width: 0; min-height: 0; max-width: 100%; max-height: 100%; }
.thumbnail > *, .selected-image > * { grid-area: 1 / 1; }
.image-loading { z-index: 1; color: #718399; font-size: 12px; padding: 16px; text-align: center; }
.loading-image { opacity: 0; }
.small-note { color: var(--muted); font-size: 11px; line-height: 1.6; margin-top: 12px; }
.main-grid { display: grid; grid-template-columns: minmax(0, 1.22fr) minmax(0, 1fr); gap: 20px; margin-top: 20px; align-items: start; }
.compact-control { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 11px; }
.compact-control select { font-size: 11px; min-height: 32px; }
.legend { gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 10px; margin-bottom: 5px; }
.legend > span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { border-radius: 50%; width: 7px; height: 7px; display: inline-block; }
.legend-dot.accepted { background: var(--teal); }
.legend-dot.pending { background: white; border: 1.5px solid #8a99ad; }
.legend-cross { display: inline-block; width: 9px; height: 9px; position: relative; }
.legend-cross::before, .legend-cross::after { position: absolute; content: ""; width: 10px; height: 1.5px; top: 4px; background: var(--red); transform: rotate(45deg); }
.legend-cross::after { transform: rotate(-45deg); }
.legend-diamond { width: 7px; height: 7px; border: 1.5px solid #1c304a; transform: rotate(45deg); }
.chart { min-height: 295px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
svg text { font-family: "Segoe UI", Arial, sans-serif; }
.chart-axis { fill: var(--muted); font-size: 10px; }
.chart-label { fill: #3e526a; font-size: 11px; }
.chart-grid { stroke: #e9eef4; stroke-width: 1; }
.chart-marker { cursor: pointer; }
.repeat-error-bar { stroke: #203d59; stroke-width: 1.6; fill: none; pointer-events: none; }
.chart-marker:focus-visible { outline: none; filter: drop-shadow(0 0 3px #2377a6); }
.selected-ring { fill: none; stroke: #153e5b; stroke-width: 2; }
.status-band { fill: #f6f8fb; }
.empty { color: #8290a3; padding: 25px; text-align: center; font-size: 12px; }
.chart > .empty { min-height: 275px; display: grid; place-items: center; }
.image-controls { justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.segmented { display: inline-flex; padding: 3px; border-radius: 7px; background: #edf2f7; }
.segmented button { border: 0; padding: 5px 10px; border-radius: 5px; font-size: 11px; background: transparent; color: var(--muted); }
.segmented button[aria-pressed=true] { background: white; color: var(--ink); box-shadow: 0 1px 3px #d0d9e2; }
.text-link { font-size: 11px; font-weight: 600; text-decoration: none; }
.selected-image { min-height: 230px; height: 280px; background: #f6f8fb; border: 1px solid #e6ecf2; border-radius: 8px; display: grid; place-items: center; overflow: hidden; }
.selected-image img { width: 100%; height: 100%; object-fit: contain; display: block; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; margin: 16px 0 0; }
.detail-grid dd { font-size: 12px; overflow-wrap: anywhere; }
.fit-failures { padding: 10px 12px; background: #fff3f1; border: 1px solid #efcfca; border-radius: 7px; margin-top: 12px; color: #994b42; font-size: 11px; }
.fit-failures ul { margin: 6px 0 0; padding-left: 18px; }
.file-label { font-size: 10px; color: var(--muted); overflow-wrap: anywhere; margin-top: 12px; }
.axis-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 10px; }
.axis-controls label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.axis-controls select { min-width: 0; width: 100%; }
.table-scroll { overflow: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: 12px; }
th { font-size: 10px; letter-spacing: .3px; font-weight: 650; color: var(--muted); background: #f8fafc; position: sticky; top: 0; z-index: 1; }
th, td { border-bottom: 1px solid #e9eef4; padding: 10px 9px; vertical-align: middle; }
td { font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.active { background: #edf5fb; }
.variable-table { max-height: 360px; margin-top: 12px; }
.variable-table th { white-space: nowrap; }
.variable-table td:first-child { font-weight: 550; }
.out-of-range { color: var(--red); background: #fff3f2; }
.source-note { display: block; color: var(--muted); font-size: 9px; margin-top: 3px; font-weight: 400; max-width: 220px; overflow-wrap: anywhere; }
.details { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 13px; }
.details summary { cursor: pointer; color: #41617c; font-size: 12px; font-weight: 600; }
.heatmap-panel, .shot-list { margin-top: 20px; }
.best-panel, .parameter-plots, .learner-panel { margin-top: 20px; }
.candidate-actions, .picker-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.candidate-table { max-height: none; overflow: visible; margin-top: 12px; }
.candidate-table table { table-layout: fixed; }
.candidate-table th:first-child { width: 46%; }
.candidate-table th:nth-child(2) { width: 34%; }
.candidate-table th, .candidate-table td { overflow-wrap: anywhere; }
.parameter-picker { margin: 15px 0 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; }
.parameter-picker legend { color: #41617c; font-size: 12px; font-weight: 600; padding: 0 6px; }
.parameter-picker .picker-actions { margin: 0 0 10px; }
.parameter-options { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.parameter-option { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; cursor: pointer; }
.parameter-swatch { display: inline-block; width: 16px; height: 3px; flex: 0 0 auto; }
.plot-pair, .landscape-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.plot-pair > div, .landscape-grid > div { min-width: 0; }
.landscape-grid { margin-top: 14px; }
.landscape-grid h3 { margin-bottom: 5px; }
.landscape-card { border: 1px solid var(--line); border-radius: 9px; padding: 0 12px 12px; }
.model-band { fill-opacity: .12; }
.chart-series { fill: none; stroke-width: 1.8; }
.chart .chart-tooltip { fill: #314e69; }
.heatmap-legend { gap: 8px; color: var(--muted); font-size: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.heatmap-legend .muted { margin-left: 12px; }
.heatmap-gradient { width: 100px; height: 7px; border-radius: 4px; background: linear-gradient(90deg, #edf3fb, #255c9d); }
.heatmap-scroll { max-height: 420px; overflow: auto; border-top: 1px solid #edf1f5; }
.heatmap-scroll svg { display: block; min-width: 720px; width: 100%; height: auto; }
.shot-table { max-height: 410px; }
.shot-table td { white-space: nowrap; }
.shot-table td:last-child { font-size: 10px; }
.shot-link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 650; text-align: left; }
footer { margin-top: 22px; color: #7a8899; font-size: 10px; line-height: 1.7; text-align: center; }
.skip-link { position: absolute; top: -60px; left: 20px; background: white; padding: 10px; z-index: 10; }
.skip-link:focus { top: 10px; }
@media (max-width: 1150px) {
  .page { padding: 24px 18px; }
  .header-note > span:last-child { display: none; }
  .counts { gap: 18px; }
  .main-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
  .panel { padding: 18px; }
  .metric strong { font-size: 28px; }
  .thumbnail { height: 135px; }
}
@media (max-width: 860px) {
  .plot-pair, .landscape-grid { grid-template-columns: 1fr; gap: 8px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main-grid { grid-template-columns: 1fr; }
  .history-panel { order: 0; }.selected-panel { order: 1; }.variables-panel { order: 2; }.scatter-panel { order: 3; }
  .selected-image { height: 330px; }
  .counts { justify-content: space-between; width: 100%; }
  .progress-panel { gap: 16px; }
  .toolbar .session-control { flex-basis: calc(100% - 130px); }
}
@media (max-width: 540px) {
  .page { padding: 20px 12px; }
  h1 { font-size: 25px; }h2 { font-size: 17px; }
  .brand-mark { width: 40px; height: 40px; font-size: 23px; }
  .brand { gap: 10px; }.eyebrow { font-size: 9px; }
  .header-note { display: none; }
  .toolbar { gap: 10px; }.session-control { min-width: 180px; }
  .toolbar .status { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
  .toolbar .button { flex: 1; }
  .refresh-toggle { flex-basis: 100%; }
  .metrics { gap: 10px; }.metric { padding: 15px; min-height: 145px; }
  .metric strong { font-size: 28px; }
  .representative-images { grid-template-columns: 1fr; gap: 10px; }
  .image-card { display: grid; grid-template-columns: 42% 1fr; align-items: center; }
  .thumbnail { height: 110px; }.image-card-title { display: block; }
  .image-card-title .status { display: inline-block; margin-top: 5px; }
  .selected-image { height: 250px; }
  .counts { gap: 8px; }.counts dt { font-size: 9px; }.counts dd { font-size: 19px; }
  .heatmap-legend .muted { width: 100%; margin-left: 0; }
  #updated-label { margin-left: 15px; width: 100%; }
  .panel { padding: 15px; }
  .chart { overflow-x: auto; min-height: 290px; }
  .chart svg { min-width: 650px; }
}
