/* Both views keep the linked plots together; Full workspace also exposes inputs. */
.page-heading{flex-wrap:wrap;gap:14px}
.workspace-views{display:flex;align-items:center;gap:14px}
.view-switch{display:flex;border:1px solid var(--line);border-radius:6px;padding:4px;background:#1d211e}
.view-switch button{border:0;border-radius:3px;padding:8px 12px;background:none;color:var(--muted);font-size:13px;white-space:nowrap}
.view-switch .active{background:#3a4430;color:var(--accent)}
.linked-charts{min-width:0}
.setup-comparison{display:flex;justify-content:space-between;align-items:center;gap:14px;padding:8px;margin-bottom:6px}
.setup-tabs{display:flex;gap:7px;min-width:0;flex:1}
.setup-tab{display:flex;align-items:center;gap:8px;min-width:0;max-width:270px;border:1px solid transparent;border-radius:5px;background:transparent;padding:8px 11px;text-align:left;font-size:13px;color:var(--muted)}
.setup-tab b{display:grid;place-items:center;width:23px;height:23px;flex-shrink:0;background:#303a25;color:#d4ef72;border-radius:4px}
#setupB b{background:#243744;color:#7dc9ff}
.setup-tab span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.setup-tab.active{border-color:#718149;background:#2b3423;color:var(--text)}
#setupB.active{border-color:#598ba7;background:#24313a}
.comparison-actions{display:flex;gap:7px;flex-shrink:0}
.comparison-actions .button,.setup-tabs>.button{font-size:12px}
#overlaySetups.active{background:#d4ef72;color:#243018;border-color:#d4ef72}
.setup-context{font-size:12px;color:var(--muted);margin:0 2px 12px;line-height:1.4}
.force-setup-legend{display:flex;gap:18px;color:#b4bfab;font-size:11px;margin:0 0 6px}
.force-setup-legend span{display:flex;gap:6px;align-items:center}
.setup-line{width:23px;border-top:2px solid #b4bfab}
.setup-line.dashed{border-top-style:dashed}
.sandbox-legend{flex-wrap:wrap}
.sandbox-legend i{border-top-width:2px;border-top-style:solid;flex-shrink:0}
.sandbox-legend .original-key{border-top-style:dotted}
.compact-charts{--compare-plot-height:clamp(155px,calc(100dvh - 560px),350px)}
.compact-charts .topbar{min-height:62px;padding:12px 24px}
.compact-charts main{padding:16px 24px 0;max-width:1920px}
.compact-charts .page-heading{margin-bottom:14px;gap:14px}
.compact-charts .page-heading>.eyebrow,.compact-charts .page-heading>div>.eyebrow{display:none}
.compact-charts h1{font-size:27px}
.compare-mode .workspace{display:block}
.compare-mode .setup{display:none}
.compact-charts .dyno-strip{padding:10px 16px;min-height:58px;gap:10px;flex-wrap:nowrap}
.compact-charts .dyno-strip{display:none}
.compact-charts .dyno-strip strong{font-size:14px;overflow-wrap:anywhere}
.compact-charts .dyno-strip .eyebrow{display:none}
.compact-charts .dyno-icon{display:none}
.compact-charts .dyno-strip .muted{margin-top:3px}
.compact-charts .dyno-strip .badge{margin-left:0}
.compact-charts .metrics{padding:13px 4px 15px;gap:18px}
.compact-charts .metrics strong{font-size:28px}
.compact-charts .metrics span{margin-bottom:3px;font-size:12px}
.compact-charts .metrics small{display:none}
.compact-charts .linked-charts{display:grid;grid-template-columns:1fr 1fr;gap:16px;align-items:stretch}
.compact-charts .linked-charts>.panel{min-width:0;padding:16px 16px 0;margin:0}
.compact-charts .chart-heading{gap:10px;min-height:40px}
.compact-charts .chart-heading h2{font-size:25px}
.compact-charts .chart-heading .eyebrow{display:none}
.compact-charts .chart-heading select{max-width:165px;font-size:12px;padding:8px 23px 8px 9px}
.compact-charts .sandbox-toolbar{margin-top:10px;min-height:24px;gap:8px}
.compact-charts .sandbox-legend{font-size:11px;gap:12px}
.compact-charts .sandbox-status{font-size:10px;text-align:right}
.compact-charts .sandbox-status{display:none}
.compact-charts #sandboxHelp{font-size:11px;line-height:1.35;margin:5px 0 8px}
.compact-charts #dynoChartWrap{height:var(--compare-plot-height)}
.compact-charts #dynoChart{height:100%;width:100%}
.compact-charts .sandbox-controls{gap:10px;padding-top:10px;grid-template-columns:1.2fr 1fr 1fr}
.compact-charts .sandbox-selection strong{font-size:22px}
.compact-charts .sandbox-selection .micro{font-size:10px;margin-bottom:2px}
.compact-charts .sandbox-selection small{font-size:10px}
.compact-charts .sandbox-controls .field{font-size:11px;gap:5px}
.compact-charts .sandbox-controls input,.compact-charts .sandbox-controls select{padding:8px;font-size:12px}
.compact-charts .sandbox-actions{padding:10px 0;gap:8px;flex-wrap:wrap}
.compact-charts .sandbox-actions>.micro{font-size:10px}
.compact-charts .sandbox-actions>div{margin-left:auto;gap:6px}
.compact-charts .sandbox-actions .button{padding:7px 9px;font-size:12px}
.compact-charts .sandbox-note,.compact-charts .chart-note{display:none}
.compact-charts .legend{margin:10px 0 8px;gap:8px 14px;min-height:24px}
.compact-charts .legend button{font-size:11px;gap:6px}
.compact-charts .legend i{width:16px}
.compact-charts .chart-wrap{height:calc(var(--compare-plot-height) + 74px);min-height:0;max-height:none}
.compact-charts .chart-wrap svg{height:100%;max-height:none}
.compact-charts .chart-footer{padding:7px 0 12px;font-size:10px;line-height:1.4;gap:8px}
.compact-charts .bottom-grid{margin-top:18px}
.compact-charts .footer{padding-top:18px}
@media (min-width:700px) and (max-width:1050px){
  .setup-comparison{gap:6px;flex-wrap:wrap}
  .setup-tabs{width:100%}
  .setup-tab{flex:1;max-width:none}
  .comparison-actions{width:100%;justify-content:flex-end}
  .compact-charts .metrics{padding:8px 4px 10px}
  .compact-charts{--compare-plot-height:clamp(145px,calc(100dvh - 615px),310px)}
  .compact-charts .sandbox-legend{gap:6px 10px;min-height:30px}
  .compact-charts .sandbox-controls{grid-template-columns:1fr 1fr}
  .compact-charts .sandbox-selection{grid-column:1/-1;display:flex;align-items:baseline;gap:6px 10px;flex-wrap:wrap}
  .compact-charts .sandbox-selection .micro{margin:0}
  .compact-charts .sandbox-selection small{margin-left:auto}
  .compact-charts .sandbox-actions>.micro{display:none}
  .compact-charts .sandbox-controls .field{gap:3px}
  .compact-charts .sandbox-toolbar{align-items:flex-start}
  .compact-charts .sandbox-legend{gap:8px;font-size:10px}
  .compact-charts .sandbox-legend i{width:16px}
}
@media (max-width:850px){
  .workspace-views{gap:8px}
  .view-switch button{padding:7px 9px;font-size:12px}
  .compact-charts .topbar{padding:10px 16px}
  .compact-charts main{padding:12px 16px 0}
  .compact-charts h1{font-size:24px}
  .compact-charts .linked-charts{gap:12px}
  .compact-charts .linked-charts>.panel{padding:12px 12px 0}
  .compact-charts .chart-heading h2{font-size:23px}
  .compact-charts .chart-heading select{max-width:145px;font-size:11px}
}
@media (max-width:699px){
  .setup-comparison{flex-wrap:wrap;gap:8px}
  .setup-tabs{width:100%}
  .setup-tab{flex:1;max-width:none;padding:6px}
  .comparison-actions{width:100%;flex-wrap:wrap}
  .comparison-actions .button{flex:1;padding:8px 6px;font-size:11px}
  .setup-context{font-size:11px}
  .page-heading{flex-wrap:wrap;gap:14px}
  .workspace-views{width:100%;justify-content:space-between}
  .compact-charts{--compare-plot-height:210px}
  .compact-charts .linked-charts{grid-template-columns:1fr}
  .compact-charts .dyno-strip{flex-wrap:wrap}
  .compact-charts .dyno-strip>div:not(.dyno-icon){flex:1 1 180px}
  .compact-charts .chart-wrap{height:260px}
  .compact-charts .sandbox-controls{grid-template-columns:1fr 1fr}
  .compact-charts .sandbox-selection{grid-column:1/-1;display:flex;gap:6px 10px;align-items:baseline;flex-wrap:wrap}
  .compact-charts .sandbox-selection small{margin-left:auto}
}

/* Full workspace shares the compact plots and gives the inputs their own space. */
body:not(.compare-mode) .workspace{display:grid;grid-template-columns:250px minmax(0,1fr);gap:0 16px;align-items:start}
body:not(.compare-mode) .results{display:contents}
body:not(.compare-mode) #comparisonError{grid-column:2;grid-row:1;margin:0 0 10px}
body:not(.compare-mode) .metrics{grid-column:2;grid-row:2;padding-top:0}
body:not(.compare-mode) .linked-charts{grid-column:2;grid-row:3}
body:not(.compare-mode) .bottom-grid{grid-column:2;grid-row:4}
body:not(.compare-mode) main>.dyno-strip{display:flex;margin-top:16px;margin-left:266px}
body:not(.compare-mode) main>.bottom-grid{margin-left:266px}
body:not(.compare-mode) .setup{grid-column:1;grid-row:1/5;position:sticky;top:12px;max-height:calc(100dvh - 235px);overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding:14px}
body:not(.compare-mode) .setup h2{font-size:22px}
body:not(.compare-mode) .setup .section-number{display:none}
body:not(.compare-mode) .setup .panel-title{margin-bottom:12px}
body:not(.compare-mode) .setup .lookup-trigger{padding:9px;margin-bottom:12px}
body:not(.compare-mode) .setup .lookup-trigger strong{font-size:13px}
body:not(.compare-mode) .setup .lookup-trigger small{font-size:11px}
body:not(.compare-mode) .setup .field{gap:5px;font-size:12px}
body:not(.compare-mode) .setup input{padding:8px;font-size:13px}
body:not(.compare-mode) .setup .source-note{font-size:11px}
body:not(.compare-mode) .setup .divider{margin:13px 0}
body:not(.compare-mode) .setup .subheading{margin-bottom:10px}
body:not(.compare-mode) .setup .ratio-grid{gap:10px 8px;margin-bottom:12px}
body:not(.compare-mode) .setup .label-note{position:static}

@media (min-width:1600px){
  body:not(.compare-mode) .workspace{grid-template-columns:280px minmax(0,1fr)}
  body:not(.compare-mode) main>.dyno-strip,body:not(.compare-mode) main>.bottom-grid{margin-left:296px}
}
@media (min-width:700px) and (max-width:1099px){
  body:not(.compare-mode){--compare-plot-height:clamp(140px,calc(100dvh - 625px),290px)}
  body:not(.compare-mode) .workspace{display:flex;flex-direction:column;gap:0}
  body:not(.compare-mode) .workspace>*{width:100%}
  body:not(.compare-mode) #comparisonError{order:0}
  body:not(.compare-mode) .metrics{order:1}
  body:not(.compare-mode) .linked-charts{order:2;position:sticky;top:8px;z-index:2;background:var(--bg);scroll-margin-top:8px}
  body:not(.compare-mode) .setup{order:3;position:relative;top:auto;margin-top:14px;max-height:260px;display:grid;grid-template-columns:1fr 1fr;gap:12px 20px}
  body:not(.compare-mode) .setup>.panel-title,body:not(.compare-mode) .setup>.divider,body:not(.compare-mode) .setup>.subheading,body:not(.compare-mode) .setup>.ratio-grid,body:not(.compare-mode) .setup>#setupError{grid-column:1/-1;margin:0}
  body:not(.compare-mode) .setup>.ratio-grid{grid-template-columns:repeat(6,1fr)}
  body:not(.compare-mode) .setup>.source-note,body:not(.compare-mode) .setup>.micro,body:not(.compare-mode) .setup>.tire-result{margin:0;align-self:center}
  body:not(.compare-mode) .setup .lookup-trigger{margin:0}
  body:not(.compare-mode) .setup>#roadTire{margin-bottom:15px}
  body:not(.compare-mode) .bottom-grid{order:4}
  body:not(.compare-mode) main>.dyno-strip,body:not(.compare-mode) main>.bottom-grid{margin-left:0}
}
@media (max-width:699px){
  body:not(.compare-mode){--compare-plot-height:210px}
  body:not(.compare-mode) .workspace{display:flex;flex-direction:column;gap:0}
  body:not(.compare-mode) .workspace>*{width:100%}
  body:not(.compare-mode) #comparisonError{order:0}
  body:not(.compare-mode) .metrics{order:1}
  body:not(.compare-mode) .linked-charts{order:2}
  body:not(.compare-mode) .setup{order:3;position:static;max-height:none;overflow:visible;margin-top:16px}
  body:not(.compare-mode) .bottom-grid{order:4}
  body:not(.compare-mode) main>.dyno-strip,body:not(.compare-mode) main>.bottom-grid{margin-left:0}
}

/* Stacked plots for laptop windows. Heights fit the remaining viewport in app.mjs. */
@media (min-width:700px){
  .compact-charts{--dyno-plot-height:160px;--force-plot-height:190px}
  .compact-charts .topbar{min-height:46px;padding:6px 24px}
  .compact-charts .top-actions .button{padding:6px 12px;font-size:12px}
  .compact-charts main{padding-top:8px}
  .compact-charts .page-heading{margin-bottom:8px}
  .compact-charts .view-switch,.compact-charts .unit-switch{padding:3px}
  .compact-charts .view-switch button,.compact-charts .unit-switch button{padding:6px 10px;font-size:12px;line-height:16px}
  .compact-charts .setup-comparison{flex-wrap:nowrap;gap:8px;padding:5px}
  .compact-charts .setup-tabs{width:auto;flex:1;min-width:0}
  .compact-charts .setup-tab{flex:0 1 270px;padding:5px 8px}
  .compact-charts .comparison-actions{width:auto;flex-shrink:0}
  .compact-charts .comparison-actions .button{padding:7px 9px}
  .compact-charts .setup-context{margin-bottom:7px;font-size:11px}
  .compact-charts .metrics{padding:5px 4px 9px}
  .compact-charts .metrics>div{display:flex;align-items:baseline;gap:12px}
  .compact-charts .metrics strong{font-size:23px;white-space:nowrap}
  .compact-charts .metrics span{font-size:11px;margin-bottom:0;white-space:nowrap}
  .compact-charts .linked-charts{--charts-side-by-side:0;grid-template-columns:minmax(0,1fr);gap:10px}
  .compact-charts .linked-charts>.panel{display:grid;align-items:center;gap:4px 12px;padding:8px 12px}
  .compact-charts .sandbox-panel{grid-template-columns:max-content minmax(0,1fr) max-content}
  .compact-charts .linked-charts .chart-heading{display:contents}
  .compact-charts .chart-heading>div{grid-column:1;grid-row:1}
  .compact-charts .chart-heading h2{font-size:22px;white-space:nowrap}
  .compact-charts .chart-heading select{grid-column:-2;grid-row:1;max-width:145px;font-size:11px;padding:6px 23px 6px 8px;justify-self:end}
  .compact-charts .sandbox-toolbar{grid-column:2;grid-row:1;min-height:0;margin:0;justify-content:flex-end;align-items:center}
  .compact-charts .sandbox-legend{min-height:0;font-size:11px;gap:6px 12px;justify-content:flex-end}
  .compact-charts #sandboxHelp{grid-column:1/-1;grid-row:2;margin:0;font-size:10px;line-height:1.3}
  .compact-charts #dynoChartWrap{grid-column:1/-1;grid-row:3;height:var(--dyno-plot-height);min-width:0}
  .compact-charts .sandbox-controls{grid-column:1/3;grid-row:4;grid-template-columns:minmax(155px,1.3fr) minmax(90px,1fr) minmax(110px,1fr);gap:12px;padding-top:6px}
  .compact-charts .sandbox-selection{grid-column:auto;display:block;min-width:0}
  .compact-charts .sandbox-selection .micro{display:none}
  .compact-charts .sandbox-selection strong{font-size:20px;line-height:1.1;white-space:nowrap}
  .compact-charts .sandbox-selection small{font-size:10px;white-space:nowrap;margin:2px 0 0}
  .compact-charts .sandbox-controls .field{font-size:10px;gap:2px}
  .compact-charts .sandbox-controls input,.compact-charts .sandbox-controls select{font-size:12px;padding:5px 8px}
  .compact-charts .sandbox-actions{grid-column:3;grid-row:4;align-self:stretch;align-items:end;border-top:1px solid var(--line);padding:6px 0 0;flex-wrap:nowrap}
  .compact-charts .sandbox-actions>.micro{display:none}
  .compact-charts .sandbox-actions .button{padding:6px 8px;font-size:11px}
  .compact-charts #sandboxError{grid-column:1/-1;margin:4px 0 0}
  .compact-charts .chart-panel{grid-template-columns:max-content minmax(0,1fr) max-content max-content}
  .compact-charts .legend{grid-column:2;grid-row:1;min-height:0;justify-content:center;gap:6px 14px;margin:0}
  .compact-charts .force-setup-legend{grid-column:3;grid-row:1;gap:12px;margin:0;font-size:10px}
  .compact-charts .chart-wrap{grid-column:1/-1;grid-row:2;height:var(--force-plot-height)}
  .compact-charts .chart-footer{grid-column:1/-1;grid-row:3;padding:0;font-size:10px;line-height:1.2}
  .compact-charts .chart-tooltip{font-size:11px;line-height:1.45;padding:8px 10px;z-index:3}
  .compact-charts .tooltip-setups{display:flex;gap:16px}
  body:not(.compare-mode) .setup{max-height:calc(100dvh - 205px)}
}
@media (min-width:700px) and (max-width:1099px){
  .compact-charts .setup-tab{flex:1;padding:5px;gap:5px}
  .compact-charts .setup-tabs{gap:4px}
  .compact-charts .comparison-actions{gap:4px}
  .compact-charts .comparison-actions .button{font-size:11px;padding:7px}
  .compact-charts .linked-charts>.panel{gap:3px 8px;padding:7px 10px}
  .compact-charts .sandbox-legend{gap:5px 8px;font-size:10px}
  .compact-charts .sandbox-controls{gap:8px}
  .compact-charts .chart-panel{grid-template-columns:max-content minmax(0,1fr) max-content}
  .compact-charts .legend{gap:5px 10px}
  .compact-charts .legend i{width:12px}
  .compact-charts .force-setup-legend{grid-column:1/-1;grid-row:2;justify-content:flex-end}
  .compact-charts .chart-wrap{grid-row:3}
  .compact-charts .chart-footer{grid-row:4}
  body:not(.compare-mode) .setup{max-height:205px}
  body:not(.compare-mode) .linked-charts.charts-unpinned{position:static}
}

/* A wide browser window gives each neighboring plot room for its full curves. */
@media (min-width:1800px){
  .compact-charts main{max-width:none}
  .compact-charts .linked-charts{--charts-side-by-side:1;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;align-items:start}
  .compact-charts .chart-panel{grid-template-columns:max-content minmax(0,1fr) max-content}
  .compact-charts .legend{grid-column:1/-1;grid-row:2;justify-content:flex-start;margin:2px 0}
  .compact-charts .force-setup-legend{grid-column:2;grid-row:1;justify-content:flex-end}
  .compact-charts .chart-wrap{grid-row:3}
  .compact-charts .chart-footer{grid-row:4}
}
