/* Additions for the native (Fortran + C#) edition — same palette and tokens as
   style.css; only the new results layout, ranking table and grouped fit bar. */

/* grouped fit-bar actions */
.fb-group { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 10px; border-left: 1px solid var(--line); }
.fb-lbl { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); margin-right: 2px; }

/* ── Control band: ONE fixed row of five panes (never wraps, not resizable) ──
   sidebar | model selection | θ parameters | K parameters | results (stats ⇄ ranking).
   The sidebar/model panes set the row height; the parameter and results panes
   take that height and scroll inside (height:0 + min-height:100% keeps their
   content from growing the row), so learner mode or a trimodal model never
   reflows the layout. */
.band { display: grid !important; grid-template-columns: 168px 338px minmax(320px, 1fr) minmax(320px, 1fr) 250px;
        gap: 10px; align-items: stretch; flex-wrap: nowrap; overflow-x: auto; }
.band > .gbox, .band > .sidecol { width: auto !important; min-width: 0; flex: none; resize: none; }
.rsz-handle { display: none !important; }
.gb-params, .gb-stats { height: 0; min-height: 100%; display: flex; flex-direction: column; }
#ret-params-box, #cond-params-box, #stats-pane, #rank-pane { flex: 1 1 0; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.gb-params .ptable { width: 100%; table-layout: fixed; }
.gb-params .ptable th:nth-child(1) { width: 20px; }  .gb-params .ptable th:nth-child(2) { width: 50px; }
.gb-params .ptable th:nth-child(3) { width: 62px; }  .gb-params .ptable th:nth-child(4),
.gb-params .ptable th:nth-child(5) { width: 46px; }  .gb-params .ptable th:nth-child(7) { width: 44px; }
.gb-params .ptable .pci { font-size: 10px; font-variant-numeric: tabular-nums; }
.gb-params .ptable th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gb-params .ptable .pin { width: 100% !important; } .gb-params .ptable .pin > input { width: 100%; min-width: 0; }
.gb-params .ptable .pci { white-space: normal; line-height: 1.25; }
.gb-params .ptable .punit { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gb-model > .mode-sel { flex-wrap: nowrap; white-space: nowrap; }
.gb-model > .mode-sel .dash-options-list-option { margin-right: 2px; }
.gb-model .learner-row .dash-dropdown { width: 100%; }
.side-tab { margin-bottom: 6px; }
.empty.small { padding: 10px; font-size: 12px; }

/* plots: full width under the fit bar */
.res-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.sample-nav { display: flex; align-items: center; gap: 8px; }
.sample-nav label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted); }
.sample-nav .dash-dropdown { min-width: 220px; }

/* model ranking */
.rank { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.rank th { text-align: left; font-size: 10px; font-weight: 700; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .04em; padding: 4px 5px; border-bottom: 1px solid var(--line); }
.rank td { padding: 4px 5px; border-bottom: 1px solid var(--line-light); }
.rank td.num { text-align: right; font-variant-numeric: tabular-nums; }
.rank tbody tr { cursor: pointer; transition: background .14s; }
.rank tbody tr:hover { background: var(--line-light); }
.rank tr.cur td { background: var(--accent-light); }
.rank .sw { display: inline-block; width: 14px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.rank .g1 { background: #d4efdf; color: #1e7d46; font-weight: 600; }
.rank .g2 { background: #d6ecf6; color: #1f6f9c; font-weight: 600; }
.rank .g3 { background: #fdebd0; color: #9c640c; font-weight: 600; }
.rank .g4 { background: #fadbd8; color: #a93226; font-weight: 600; }
.rank .flag { color: #c0562e; margin-left: 4px; }
.rank-foot { margin-top: 6px; font-size: 10.5px; color: var(--ink-faint); }

/* fit timing / engine badge */
.engine-badge { display: inline-block; margin-left: 10px; padding: 2px 8px; font-size: 10.5px; border-radius: 999px; background: var(--accent-light); color: var(--accent); font-weight: 600; }
.fitbar .btn { white-space: nowrap; }
.fitbar { flex-wrap: wrap; row-gap: 8px; }

/* model-equation pop-up (hover a matrix cell) */
.eq-pop { position: fixed; z-index: 10001; display: none; max-width: 560px; padding: 12px 16px 10px; background: var(--card);
          border: 1px solid var(--line); border-top: 3px solid var(--accent2); border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
          color: var(--ink); pointer-events: none; font-size: 12px; }
.eq-pop .eqp-h { font-weight: 700; color: var(--accent); font-size: 12.5px; margin-bottom: 4px; }
.eq-pop .eqp-s { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); margin: 8px 0 0; }
.eq-pop .eqp-k { font-size: 11px; color: var(--ink-muted); margin-top: 4px; }
.eq-pop .katex-display { margin: 4px 0; text-align: left; }
.eq-pop .katex-display > .katex { text-align: left; font-size: 1.02em; }

/* ══ One-page layout: everything fits the window, no page scroll ══════════════
   header (title + fit/export bar) · data toolbar · fixed-height control band ·
   plot tabs · plots (fill the rest, sized by JS) · one-line footer.
   Panes scroll inside themselves if their content is taller than the band. */
html, body { height: 100%; overflow: hidden; }
.wrap { height: 100vh; box-sizing: border-box; display: flex; flex-direction: column; gap: 8px; padding: 8px 14px 4px; }
.wrap > * { flex: none; margin-top: 0 !important; margin-bottom: 0 !important; }
.hero { gap: 12px; min-height: 0; }
.hero .logo { font-size: 22px; }
.hero h1 { font-size: 20px; margin: 0; white-space: nowrap; }
.hero .subtitle { font-size: 11.5px; white-space: nowrap; }
.hero .fitbar { flex: 1 1 auto; justify-content: flex-end; align-items: center; flex-wrap: nowrap; gap: 10px; padding: 6px 10px; min-width: 0; }
.hero .fitbar .btn.big { padding: 7px 26px; font-size: 14.5px; }
.hero .fitbar .status { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1750px) { .hero .subtitle, .hero .compare-hint { display: none; } }
@media (max-width: 1450px) { .hero .fb-lbl { display: none; } .hero .fitbar .status { max-width: 140px; } }
.toolbar { flex-wrap: nowrap; padding: 8px 12px; gap: 8px; overflow-x: auto; overflow-y: hidden; }
.toolbar .tb-group { flex: none; }
.band { height: clamp(300px, 41vh, 470px); padding: 10px; box-sizing: border-box; }
.band > .gbox, .band > .sidecol { height: 100%; min-height: 0 !important; box-sizing: border-box; overflow-y: auto; overflow-x: hidden; }
.gb-params, .gb-stats { height: 100%; }
.res-head { margin: 0 !important; }
#plots { flex: 1 1 0; min-height: 0; overflow: auto; }
#plots .plot-row { flex-wrap: nowrap; align-items: flex-start; margin: 0; }
#plots .empty { margin: 0; }
.footer.slim { padding: 2px 0 0; font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-top: 1px solid var(--line-light); text-align: center; }
.footer.slim .engine-badge { margin-left: 6px; }

/* ⓘ tips are drawn by JS as one fixed element, so scrolling panes never clip them */
.info::after { display: none !important; }
.tip-float { position: fixed; z-index: 10002; width: 260px; padding: 9px 11px; background: #1f2d3d; color: #eef3f8; font-size: 11.5px; line-height: 1.45;
             border-radius: 7px; box-shadow: 0 8px 22px rgba(20, 35, 55, 0.28); pointer-events: none; display: none; }

/* compaction so the plots get the height (one-page layout) */
.band { height: clamp(280px, 38vh, 450px); }
.hero .fitbar { padding: 4px 10px; }
.toolbar { padding: 6px 12px; }
.res-head .ptabs { padding: 0; margin: 0; border: 0; gap: 0; }
.res-head .ptabs .dash-options-list-option { padding: 2px 10px 2px 0; }
.res-head .ptab { font-size: 11px; }
#plots .plot-cell { padding: 4px 6px; }
#plots .plot-cell .sname { display: none; }           /* kept in the DOM: figure export names files from it */
#plots .legend-panel { align-self: flex-start; }
.sidecol { gap: 5px; }
.sidecol .sidebtn { padding: 6px 9px; }
.sidecol .metric-row { margin: 0; }
.gb-model .matrix td, .gb-model .matrix th { padding-top: 1px; padding-bottom: 1px; }
.gb-model .kmodel-row { margin-top: 4px; }
.hero .fitbar .btn.tiny { padding: 4px 9px; }
.hero .fitbar .btn.big { padding: 5px 24px; }
.hero { min-height: 40px; }
.toolbar .dash-dropdown { min-height: 30px; height: 30px; padding-top: 0; padding-bottom: 0; }
.toolbar .drop { padding: 6px 12px; min-height: 0; }
.toolbar .tb-group { padding-top: 10px; padding-bottom: 6px; }
.toolbar .ctl > label { margin-bottom: 1px; }
.res-head .ptabs .dash-options-list-option { min-height: 0; height: 24px; padding-top: 0; padding-bottom: 0; }
.res-head .ptabs .dash-options-list-option-wrapper { transform: scale(.85); }
@media (max-width: 1750px) { .hero .fb-lbl, .hero .fitbar .status { display: none; } .hero .fb-group { padding-left: 6px; gap: 4px; } }
.hero .fitbar { overflow: hidden; }
/* header bar: Fit + actions never get clipped — the bar starts at the left, buttons
   don't shrink, only the hint text truncates on the right. Status messages appear
   as the toast (the inline copy would only crowd the header). */
.hero .fitbar { justify-content: flex-start; }
.hero .fitbar > .btn, .hero .fitbar .fb-group, .hero .fitbar .fb-group .btn { flex-shrink: 0; }
.hero .fitbar .compare-hint { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero .fitbar .status { display: none !important; }
/* toast sits below the header bar, never over the Save/Restore buttons */
.toast-container { top: 64px !important; }

/* fit bar back in its own row under the control band (as in the Dash app),
   compact for the one-page layout; Fit never shrinks, the hint/status truncate. */
.wrap > .fitbar { display: flex; align-items: center; flex-wrap: nowrap; gap: 10px; padding: 6px 12px; overflow: hidden; }
.wrap > .fitbar > .btn, .wrap > .fitbar .fb-group, .wrap > .fitbar .fb-group .btn { flex-shrink: 0; }
.wrap > .fitbar .btn.big { padding: 6px 26px; font-size: 14.5px; }
.wrap > .fitbar .btn.tiny { padding: 4px 9px; }
.wrap > .fitbar .compare-hint { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrap > .fitbar .status { display: block !important; flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1500px) { .wrap > .fitbar .fb-lbl { display: none; } .wrap > .fitbar .fb-group { padding-left: 6px; gap: 4px; } }
@media (max-width: 1250px) { .wrap > .fitbar .compare-hint { display: none; } }
.hero .subtitle { display: inline !important; }
.toast-container { top: 14px !important; }

/* drag & drop: the whole window accepts data files; the Browse box lights up */
body.drag-over .toolbar .drop { outline: 2px dashed var(--accent2); outline-offset: 2px; background: var(--accent-light); }
body.drag-over::after { content: "Drop data (CSV · Excel · text) or a session .json"; position: fixed; inset: auto 0 18px 0; margin: auto; width: max-content;
  padding: 8px 16px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 600; font-size: 13px; z-index: 10003; box-shadow: var(--shadow-lg); }

/* Akaike weight: number over a proportional bar */
.rank .wbar { display: inline-block; min-width: 34px; padding: 0 3px; border-radius: 3px; text-align: right;
              background: linear-gradient(90deg, rgba(43,127,196,.22) var(--w), transparent var(--w)); }
.rank td, .rank th { padding: 3px 4px; }
.rank .wbar { margin-top: 2px; font-size: 10px; }

/* ══ Fit to any screen (fit.js): nothing ever scrolls ════════════════════════
   Panes never show scrollbars — fit.js shrinks their content to fit instead. */
.toolbar, .band > .gbox, .band > .sidecol, #ret-params-box, #cond-params-box, #stats-pane, #rank-pane, .res-head, .wrap > .fitbar { overflow: hidden !important; }
#plots { overflow: hidden; }
#plots .plot-row { flex-wrap: wrap; align-content: flex-start; gap: 12px; }
#plots .legend-panel { max-width: 260px; }
.band { height: clamp(280px, calc(38vh / var(--ui-zoom, 1)), 450px); }

/* phone / narrow: one view at a time + bottom tab bar (same palette & components) */
.mnav { display: none; }
body.compact .mnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 58px; z-index: 900;
  background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(15,23,42,.06); padding-bottom: env(safe-area-inset-bottom); }
.mnav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: none;
  font: 600 10.5px Inter, "Segoe UI", system-ui, sans-serif; color: var(--ink-muted); letter-spacing: .02em; cursor: pointer; }
.mnav button .mi { font-size: 16px; line-height: 1; }
.mnav button.active { color: var(--accent); background: var(--accent-light); box-shadow: inset 0 3px 0 var(--accent2); }
body.compact .wrap { height: 100vh; height: 100dvh; padding: 6px 8px 64px; gap: 6px; max-width: none; }
body.compact .hero { order: 0; } body.compact .wrap > .fitbar { order: 1; } body.compact .toolbar, body.compact .band, body.compact .res-head, body.compact #plots { order: 2; }
body.compact .hero .subtitle, body.compact .footer { display: none !important; }
body.compact .hero h1 { font-size: 17px; }
body.compact .wrap > .fitbar { flex-wrap: wrap !important; justify-content: center; gap: 6px; padding: 6px; }
body.compact .wrap > .fitbar .compare-hint, body.compact .wrap > .fitbar .fb-lbl, body.compact .wrap > .fitbar .status, body.compact .wrap > .fitbar > .info { display: none !important; }
body.compact .wrap > .fitbar .fb-group { border: 0; padding: 0; }
/* views */
body.compact .toolbar, body.compact .band, body.compact .res-head, body.compact #plots { display: none !important; }
body.compact[data-view=data] .toolbar { display: flex !important; flex: 1 1 0; min-height: 0; flex-wrap: wrap !important; align-content: flex-start; }
body.compact[data-view=model] .band, body.compact[data-view=params] .band, body.compact[data-view=results] .band {
  display: flex !important; flex-direction: column; flex: 1 1 0; height: auto !important; min-height: 0; padding: 8px; gap: 8px; }
body.compact .band > * { display: none !important; }
body.compact[data-view=model] .band > .sidecol, body.compact[data-view=model] .band > .gb-model,
body.compact[data-view=params] .band > .gb-params, body.compact[data-view=results] .band > .gb-stats {
  display: flex !important; flex-direction: column; flex: 1 1 0; height: auto !important; min-height: 0 !important; width: auto !important; }
body.compact[data-view=model] .band > .sidecol { flex: 0.8 1 0; }
body.compact[data-view=plots] .res-head { display: flex !important; }
body.compact[data-view=plots] #plots { display: block !important; flex: 1 1 0; min-height: 0; }
/* plot-tab row: room for the checkbox labels (was 3 px short) */
.res-head .ptabs .dash-options-list-option { height: auto; min-height: 24px; }
.res-head { padding: 1px 0 3px; }
/* phone: the Dash stylesheet's ≤760 px rules force 92vw-wide stacked plots — use the packed grid size instead */
body.compact .plot-row { flex-direction: row !important; align-items: flex-start !important; justify-content: center; }
body.compact .plot-cell { width: auto !important; max-width: none !important; }
body.compact .plot-cell .dash-graph, body.compact .plot-cell .js-plotly-plot, body.compact .plot-cell > div:last-child {
  width: var(--pw, var(--psize)) !important; height: var(--psize) !important; max-width: none !important; max-height: none !important; }
body.compact .legend-panel { width: auto !important; max-width: var(--psize) !important; }
/* legend labels wrap inside the (possibly narrow) legend box instead of spilling out */
#plots .legend-panel { overflow: hidden; }
/* 3.2: every pane of the band has the same height (--pane-h, set by fit.js from the window size
   only); what does not fit scrolls inside the pane with a slim, visible scrollbar */
html:not(.band2) body:not(.compact) .band { grid-template-rows: var(--pane-h, auto); }
body:not(.compact) .band > .gbox, body:not(.compact) .band > .sidecol { align-self: stretch; }
.band > .pane-scroll { scrollbar-width: thin; scrollbar-color: #b3c0cf transparent; }
.band > .pane-scroll::-webkit-scrollbar { width: 6px; }
.band > .pane-scroll::-webkit-scrollbar-thumb { background: #b3c0cf; border-radius: 3px; }
.band > .pane-scroll::-webkit-scrollbar-track { background: transparent; }
/* 3.2: conductivity (K) models as compact rows with the round markers of the model matrix
   (several can be ticked, as before) */
.gb-model .kmodel-sel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px 10px; }
.gb-model .kmodel-sel label { display: flex !important; align-items: center; justify-content: flex-start !important; gap: 6px; min-height: 0 !important;
  padding: 2px 0 !important; border: 0 !important; background: none !important; box-shadow: none !important; border-radius: 0 !important;
  font-size: 11px !important; font-weight: 500 !important; line-height: 1.2 !important; color: var(--ink-light) !important; text-align: left !important; }
.gb-model .kmodel-sel label::before { content: ""; flex: 0 0 auto; width: 14px; height: 14px; box-sizing: border-box; border-radius: 50%;
  border: 2px solid var(--ink-faint); background: var(--card); }
.gb-model .kmodel-sel label:hover::before { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.gb-model .kmodel-sel label:has(input:checked)::before { border-color: var(--accent);
  background: radial-gradient(circle at 40% 35%, #2b7fc4 30%, var(--accent) 55%, #0d2f4a 100%); box-shadow: 0 0 0 3px var(--accent-glow); }
.gb-model .kmodel-sel label:has(input:checked) { color: var(--accent) !important; font-weight: 600 !important; }
.gb-model .kmodel-sel label:has(input:focus-visible)::before { outline: 2px solid var(--accent); outline-offset: 2px; }
.gb-model .kmodel-sel .dash-options-list-option-text { font-size: 11px !important; }
.gb-model .kmodel-row > label { margin-bottom: 3px !important; }
/* 3.2: per-model ticks for the 95 % confidence / prediction intervals under each legend entry */
#plots .legend-panel .leg-bands { display: flex; flex-wrap: wrap; gap: 1px 8px; margin: -3px 0 4px 30px; font-size: .78em; color: #55606f; line-height: 1.2; }
#plots .legend-panel .leg-bands label { display: inline-flex; align-items: center; gap: 3px; cursor: pointer; white-space: nowrap;
  text-transform: none !important; letter-spacing: normal !important; font-weight: 400 !important; font-size: inherit !important; color: inherit !important; margin: 0 !important; padding: 0 !important; }
#plots .legend-panel .leg-bands input { margin: 0; width: 12px; height: 12px; cursor: pointer; }
#plots .legend-panel .leg-all { margin: 0 0 6px 0; padding-bottom: 5px; border-bottom: 1px solid #e3e9f0; }
#plots .legend-panel .leg-all > span { font-weight: 600; }
#plots .legend-panel .leg-item { white-space: normal; overflow-wrap: anywhere; align-items: flex-start; }
#plots .legend-panel .leg-item > span:first-child { margin-top: 6px; }
/* option checklists stack and wrap instead of running sideways (phone sidebar is wide) */
.sidecol .metric-row { flex-wrap: wrap; }
#opt-flags, #vapor-toggle { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; max-width: 100%; }
#opt-flags .dash-options-list-option, #vapor-toggle .dash-options-list-option { white-space: normal; max-width: 100%; }
/* the sidebar must stack in ONE column (Dash rules let it wrap into a 2nd column off-screen) */
.band > .sidecol { flex-wrap: nowrap !important; }
.band > .sidecol { flex-direction: column !important; width: auto !important; }

/* ── stability: nothing moves when you select, load or fit ───────────────────
   Toolbar dropdowns have fixed widths (long names are truncated with …), so a
   selection can never change the toolbar's size and shift the page. */
.toolbar .ctl .dash-dropdown { width: 104px; min-width: 0; }
.toolbar .ctl .dash-dropdown .dash-dropdown-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.toolbar .ctl .dash-dropdown-grid-container { min-width: 0; }
.toolbar [data-dd="sample-vals"] .dash-dropdown, .toolbar #sample-vals { width: 160px; }
.toolbar #db-source { width: 130px; } .toolbar #db-sample { width: 190px; } .toolbar #sheet-sel { width: 150px; }
.toolbar #suction-unit, .toolbar #k-unit { width: 84px; }
/* plots fade in without sliding (the Dash fadeUp animation moved them 10 px on every redraw) */
#plots .plot-cell, #plots .legend-panel { animation: swrcFade .25s ease both !important; }
@keyframes swrcFade { from { opacity: 0; } to { opacity: 1; } }
/* phone: the Data view is a screen of its own — dropdowns fill their slot (fixed widths would overlap) */
body.compact .toolbar .ctl, body.compact .toolbar .ctl .dash-dropdown, body.compact .toolbar #db-source, body.compact .toolbar #db-sample,
body.compact .toolbar #sheet-sel, body.compact .toolbar #suction-unit, body.compact .toolbar #k-unit, body.compact .toolbar #sample-vals { width: 100% !important; min-width: 0; }
body.compact .toolbar .tb-group { display: flex; gap: 8px; }
body.compact .toolbar .tb-group > .ctl { flex: 1 1 0; min-width: 0; }
body.compact .toolbar .tb-group > .btn { flex: 0 0 auto; align-self: flex-end; }
/* narrow Data view: every toolbar group is its own full-width row, so loading data can't re-wrap them */
body.compact[data-view=data] .toolbar { flex-direction: column !important; align-items: stretch !important; }
body.compact .toolbar > .tb-group, body.compact .toolbar > #upload { width: 100% !important; flex: 0 0 auto !important; }

/* ══ Uniform pane scale (fit.js layoutWide) ══════════════════════════════════
   Wide screens: panes take their natural height so fit.js can measure them; the band
   is as tall as its tallest pane (all panes share one content scale). No scrollbars. */
body:not(.compact) .band { height: var(--band-h, auto) !important; overflow: hidden !important;
  grid-template-columns: 168px 338px minmax(0, 1fr) minmax(0, 1fr) 286px; align-items: stretch; }
body:not(.compact) .band > .gbox, body:not(.compact) .band > .sidecol { height: auto !important; min-height: 0 !important; }
body:not(.compact) #ret-params-box, body:not(.compact) #cond-params-box,
body:not(.compact) #stats-pane, body:not(.compact) #rank-pane { flex: none !important; overflow: visible !important; }
.side-tab .dash-options-list-option { white-space: nowrap; }

/* compact statistics: θ(h) | K(h) side by side */
.sa-grid { display: grid; grid-template-columns: auto 1fr 1fr; column-gap: 8px; row-gap: 1px; align-items: baseline; font-size: 11.5px; }
.sa-grid > .sa-sub { margin: 0 0 2px; text-align: right; }
.sa-grid > .sa-sub:first-child { text-align: left; }
.sa-grid > .sa-l { color: var(--ink-light); white-space: nowrap; padding: 1px 0; }
.sa-grid > .sa-v { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding: 1px 0; }
.sa-grid > .sa-span { grid-column: 2 / span 2; }
.sa-grid > hr { grid-column: 1 / -1; margin: 3px 0; border: 0; border-top: 1px solid var(--line-light); }
.sa-grid .sa-ci { margin-left: 5px; }
.sa-grid small { color: var(--ink-faint); }
/* wide screens: no 1820 px cap — the UI scale (fit.js) sizes the page; a cap squeezed the
   scaled band so the parameter tables' CI column collapsed to 0 px */
body:not(.compact) .wrap { max-width: none !important; }
/* parameter tables: the 95% CI column is fixed; the short Unit column is the flexible one */
.gb-params .ptable th:nth-child(6) { width: 66px; }
.gb-params .ptable th:nth-child(6) { white-space: normal; text-overflow: clip; line-height: 1.1; overflow-wrap: normal; text-transform: none !important; letter-spacing: 0 !important; }   /* "95 % confidence interval" in full, on up to three lines */
.gb-params .ptable th:nth-child(7) { width: auto; }
.gb-params .ptable td.punit { max-width: 0; }

/* plots row centred: what the plots do not need is split evenly left and right */
body:not(.compact) #plots .plot-row { justify-content: center; }
/* toasts scale with the rest of the interface */
body:not(.compact) .toast-container { zoom: var(--ui-zoom, 1); }
/* the Dash ≤1100 px rules make side-column items grow (flex:1, min-width 200 px) — keep their natural size */
.band > .sidecol > *, .band > .sidecol .sidebtn, .band > .sidecol .optrow { flex: none !important; min-width: 0 !important; }
/* ── stillness: nothing on screen moves or resizes by itself ──────────────────────────
   Hover/focus feedback is colour, border and shadow only (no lifting, growing or sliding),
   transitions never animate a size or position (the old `transition: all` made boxes
   visibly stretch whenever the fit-to-screen scale was applied), no entrance animations,
   and the window stays blank until the first fit-to-screen layout is done. */
*, *::before, *::after { transition-property: color, background-color, border-color, box-shadow, opacity, visibility, filter, outline-color !important; }
.plot-cell:hover, .radio:hover, .drop:hover .up-ic, .hero .logo:hover, .btn:hover, .btn:active, .gbox:hover,
.legend-panel:hover, .kmodel-sel label:hover, .ptab:hover { transform: none !important; }
.toolbar, .band, .plot-cell, .legend-panel, #plots .plot-cell, #plots .legend-panel { animation: none !important; }
html:not(.swrc-ready) .wrap, html:not(.swrc-ready) .mnav { visibility: hidden; }
/* messages fade in place instead of sliding in */
@keyframes swrcToastFade { from { opacity: 0; } to { opacity: 1; } }
.toast { animation: swrcToastFade .2s ease both !important; transform: none !important; }

/* ══ 3.1 — readable on every screen, browser zoom honoured (fit.js layoutWide) ═══════════
   The interface is only ever scaled UP (big monitors); panes compact by at most 10 %, and
   when the content still does not fit the pane — or the whole page — scrolls instead. */
.band > .pane-scroll, .toolbar.pane-scroll, #ret-params-box.pane-scroll, #cond-params-box.pane-scroll,
#stats-pane.pane-scroll, #rank-pane.pane-scroll, .wrap > .fitbar.pane-scroll, .res-head.pane-scroll, .hero.pane-scroll { overflow-y: auto !important; }
html.page-scroll, html.page-scroll body { height: auto; overflow-x: hidden; overflow-y: auto; }
html.page-scroll body:not(.compact) .wrap { height: auto; min-height: 100vh; }
html.page-scroll body:not(.compact) #plots { flex: none; height: var(--plots-h, 480px); }
/* strips wrap onto a second line instead of shrinking their text */
body:not(.compact) .toolbar { flex-wrap: wrap !important; row-gap: 14px; overflow: visible !important; }
body:not(.compact) .wrap > .fitbar .compare-hint { flex: 0 1 auto; }
body:not(.compact) .res-head .ptabs { flex-wrap: wrap; }
/* narrower windows: the band has two rows — sidebar · model · results / θ parameters · K parameters */
html.band2 body:not(.compact) .band { grid-template-columns: 168px minmax(338px, 1fr) minmax(286px, 1fr); grid-template-rows: var(--pane-h, auto) var(--pane-h, auto); }
html.band2 body:not(.compact) .band > .sidecol { grid-column: 1; grid-row: 1; }
html.band2 body:not(.compact) .band > .gb-model { grid-column: 2; grid-row: 1; }
html.band2 body:not(.compact) .band > .gb-stats { grid-column: 3; grid-row: 1; }
html.band2 body:not(.compact) .band > .gb-params:nth-of-type(3) { grid-column: 1 / span 2; grid-row: 2; }
html.band2 body:not(.compact) .band > .gb-params:nth-of-type(4) { grid-column: 3; grid-row: 2; }
/* no control text below 11 px at UI scale 1 (was 9–10.5 px; the panes compact by ≤ 10 %) */
.gbox-h, .tb-tag, .fb-lbl, .sa-grid > .sa-sub, .rank th, .rank-foot, .rank .wbar, .gb-model .matrix th,
.ptable .punit, .ptable .pci, .gb-params .ptable .pci, .kmodel-row > label, .metric-row > label, .optrow label, .ctl > label,
.sample-nav label, .mode-sel .dash-options-list-option-text, .kmodel-sel .dash-options-list-option-text, .res-head .ptab { font-size: 11px !important; }
.tb-tag { top: -9px !important; }
/* wide five-pane row: a slightly wider sidebar keeps its options on one line each (shorter band) */
html:not(.band2) body:not(.compact) .band { grid-template-columns: 184px 338px minmax(0, 1fr) minmax(0, 1fr) 286px; }
.gb-model > .mode-sel .dash-options-list-option { padding-left: 6px !important; padding-right: 8px !important; }
.gb-model .matrix th { padding-left: 2px !important; padding-right: 2px !important; letter-spacing: 0 !important; }
/* equation pop-up opened by a long press on a touch screen: a closable card that fits the phone */
.eq-pop.eq-pinned { pointer-events: auto; max-width: calc(100vw - 16px); max-height: calc(100vh - 90px); overflow: auto; }
.eq-pop .eqp-x { float: right; margin: -4px -6px 4px 8px; border: 1px solid var(--line); background: var(--card); border-radius: 6px; padding: 2px 8px; font-size: 14px; cursor: pointer; }

/* ══ 3.1 — Simple | Power user ══════════════════════════════════════════════════════════ */
.gb-model > .gbox-h { display: flex; align-items: center; gap: 8px; padding-right: 24px; }
.ui-level { margin-left: auto; display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--card); flex: none; }
.ui-level button { border: 0; background: transparent; padding: 2px 9px; font: 600 11px Inter, "Segoe UI", system-ui, sans-serif; color: var(--ink-muted);
  letter-spacing: 0; text-transform: none; cursor: pointer; line-height: 1.5; }
.ui-level button + button { border-left: 1px solid var(--line); }
.ui-level button.on { background: var(--accent); color: #fff; }
.ui-level button:not(.on):hover { background: var(--accent-light); color: var(--accent); }
html.lvl-simple .power-only { display: none !important; }
.matrix-simple th, .matrix-simple td.rowlabel { line-height: 1.2; }
.matrix-simple th small, .matrix-simple td.rowlabel small { display: block; font-size: 11px; font-weight: 500; color: var(--ink-faint); text-transform: none; letter-spacing: 0; }
.gb-model .matrix-simple { margin: 4px 0 2px; }
.gb-model .matrix-simple td, .gb-model .matrix-simple th { padding: 4px 10px !important; }
/* several models: the selection, compactly */
.sel-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 5px; margin: 5px 0 2px; font-size: 11px; min-height: 22px; }
.sel-n { font-weight: 700; color: var(--ink-muted); margin-right: 2px; }
.sel-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 4px 1px 6px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--ink-light); cursor: pointer; white-space: nowrap; line-height: 1.5; }
.sel-chip.prim { border-color: var(--accent); color: var(--accent); font-weight: 600; cursor: default; }
.sel-chip i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.sel-chip .sel-x, .sel-clear { border: 0; background: none; color: var(--ink-faint); cursor: pointer; padding: 0 3px; font-size: 11px; line-height: 1; }
.sel-chip .sel-x:hover, .sel-clear:hover { color: #c0392b; }
.sel-clear { text-decoration: underline; }
.sel-max { color: #9c640c; font-weight: 600; }
.cmp-toggle { display: inline-flex !important; align-items: center; gap: 4px; margin: 0 0 0 auto; font-size: 11px; font-weight: 600; color: var(--accent);
  text-transform: none; letter-spacing: 0; cursor: pointer; }
html.touch .cmp-toggle, body.compact .cmp-toggle { display: inline-flex !important; }
.cmp-toggle input { width: 16px; height: 16px; margin: 0; }
/* ══ 3.1 — full-screen figures ══════════════════════════════════════════════════════════ */
#plots .plot-cell { position: relative; }
.fs-btn { position: absolute; top: 4px; right: 6px; z-index: 5; width: 26px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 6px;
  background: rgba(255,255,255,.92); color: var(--accent); font-size: 15px; line-height: 1; cursor: pointer; opacity: .75; }
.fs-btn:hover, .fs-btn:focus-visible { opacity: 1; border-color: var(--accent2); background: #fff; }
html.touch .fs-btn { opacity: 1; width: 32px; height: 32px; }
.fs-view { position: fixed; inset: 0; z-index: 10005; display: flex; flex-direction: column; background: var(--bg, #f4f7fa); }
.fs-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--card); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.fs-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--accent); }
.fs-hint { font-size: 11.5px; color: var(--ink-faint); white-space: nowrap; }
.fs-head .btn { flex: none; font-size: 13px; padding: 5px 12px; }
.fs-bands { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; padding: 6px 14px 0; font-size: 12px; color: #55606f; }
.fs-bands .fsb-item { display: inline-flex; align-items: center; gap: 8px; }
.fs-bands .fsb-item > i { display: inline-block; width: 20px; height: 4px; border-radius: 2px; }
.fs-bands .fsb-name { color: #2a3f5f; font-weight: 600; }
.fs-bands label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; white-space: nowrap; text-transform: none !important;
  letter-spacing: normal !important; font-weight: 400 !important; font-size: 12px !important; color: inherit !important; margin: 0 !important; }
.fs-bands input { margin: 0; width: 13px; height: 13px; cursor: pointer; }
/* 3.2: figure + ONE legend panel side by side (below the figure on narrow screens); the axes box is
   square (plots.js squareAxes) and centred in its area */
.fs-body { flex: 1 1 0; min-height: 0; display: flex; gap: 8px; margin: 8px; }
.fs-body > .fs-plot { flex: 1 1 0; min-width: 0; margin: 0 !important; }
.fs-body > .fs-legend { flex: 0 0 auto; width: 300px; max-height: 100%; overflow-y: auto; align-self: center; box-sizing: border-box; margin: 0 !important; }
.fs-legend .leg-bands { display: flex; flex-wrap: wrap; gap: 1px 8px; margin: -3px 0 4px 30px; font-size: .82em; color: #55606f; line-height: 1.2; }
.fs-legend .leg-bands label { display: inline-flex; align-items: center; gap: 3px; cursor: pointer; white-space: nowrap; text-transform: none !important;
  letter-spacing: normal !important; font-weight: 400 !important; font-size: inherit !important; color: inherit !important; margin: 0 !important; padding: 0 !important; }
.fs-legend .leg-bands input { margin: 0; width: 12px; height: 12px; cursor: pointer; }
.fs-legend .leg-all { margin: 0 0 6px 0; padding-bottom: 5px; border-bottom: 1px solid #e3e9f0; }
.fs-legend .leg-all > span { font-weight: 600; }
.fs-legend .leg-item { white-space: normal; overflow-wrap: anywhere; align-items: flex-start; }
@media (max-width: 699px) { .fs-body { flex-direction: column; } .fs-body > .fs-legend { width: auto; max-height: 34%; align-self: stretch; } }
.fs-plot.js-plotly-plot, #plots .dash-graph.js-plotly-plot { display: flex !important; align-items: center; justify-content: center; }
.fs-plot.js-plotly-plot > .plot-container, #plots .dash-graph.js-plotly-plot > .plot-container { width: auto !important; height: auto !important; margin: auto; flex: none; }
.fs-plot { flex: 1 1 0; min-height: 0; margin: 8px; padding-bottom: env(safe-area-inset-bottom); background: #fff; border: 1px solid var(--line); border-radius: 10px; }
html.fs-open, html.fs-open body { overflow: hidden !important; }
@media (max-width: 700px) { .fs-hint { display: none; } }
/* data toolbar a little tighter, so it stays on one line from ~1500 layout px */
body:not(.compact) .toolbar { gap: 10px; }
body:not(.compact) .toolbar .ctl .dash-dropdown { width: 94px; }
body:not(.compact) .toolbar #sample-vals { width: 136px; }
body:not(.compact) .toolbar #db-source { width: 118px; } body:not(.compact) .toolbar #db-sample { width: 156px; }
body:not(.compact) .toolbar .drop { min-width: 150px; }
body:not(.compact) .toolbar #suction-unit, body:not(.compact) .toolbar #k-unit { width: 80px; }
.sidecol .metric-row .mode-sel .dash-options-list-option { padding: 2px 5px 2px 3px !important; margin-right: 0 !important; }
.sidecol .metric-row .mode-sel { flex-wrap: nowrap; gap: 2px; }
.fs-btn { display: inline-flex; align-items: center; justify-content: center; }
html.page-scroll { background: var(--bg, #f1f4f9); }
html.page-scroll body { min-height: 100vh; }
body.compact .fs-btn { left: 6px; right: auto; }
body:not(.compact) .sel-line { min-height: 46px; align-content: flex-start; }
