/* Kalkulator v2. Arkusz zewnętrzny zamiast <style>, bo CSP strony (style-src 'self') blokuje style inline. */

/* Fonty self-hosted: Fontsource 5.3.0, licencja OFL 1.1 (fonts/OFL-*.txt) */
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/barlow-condensed-latin-ext-600-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/barlow-condensed-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/barlow-condensed-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/barlow-condensed-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/barlow-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/barlow-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/barlow-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/barlow-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

/* ─── TOKENY ─── */
:root {
  --orange: #F97316;
  --orange-dark: #d96010;
  --black: #0a0a0a;
  --dark: #111111;
  --dark2: #1a1a1a;
  --dark3: #222222;
  --gray: #2e2e2e;
  --mid: #666;
  --light: #aaa;
  --white: #f5f5f5;
  --font-display: 'Barlow Condensed', sans-serif;
  --font-body: 'Barlow', sans-serif;
  --radius: 4px;
  --transition: 0.25s ease;

  --stage: #141414;        /* ekran podglądu, ta sama wartość co COLOR.background w viewer.js */
  --line-strong: #444;     /* obrys aktywnych kontrolek */
  --dim: #8c8c8c;          /* tekst pomocniczy, kontrast 5,6:1 na --dark */
  --danger: #f87171;       /* wady siatki i błędy, kontrast 6,9:1 na --dark */

  --fs-xs: 12px;
  --fs-s: 14px;
  --fs-m: 16px;
  --fs-l: 20px;
  --fs-xl: 28px;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;

  --bar-h: 56px;
  --control-h: 40px;
  --panel-w: clamp(340px, 30vw, 420px);
}

/* ─── BAZA ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--black);
  color: var(--white);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--fs-m);
  line-height: 1.5;
}
img { display: block; max-width: 100%; height: auto; }
picture { display: contents; }
picture > source { display: none; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
fieldset { border: 0; min-width: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

.sprite { display: none; }
.icon {
  display: inline-block; width: 1em; height: 1em; vertical-align: -0.125em; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.num { font-variant-numeric: tabular-nums; }

/* ─── PRZYCISKI ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: var(--control-h); padding: 0 var(--sp-4);
  border: 1px solid transparent; border-radius: var(--radius);
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-s);
  letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap;
  text-decoration: none; cursor: pointer; background: none;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.btn--primary { background: var(--orange); color: var(--black); }
.btn--primary:hover { background: var(--orange-dark); }
.btn--ghost { border-color: var(--gray); color: var(--white); }
.btn--ghost:hover { border-color: var(--light); }
.btn--icon { width: var(--control-h); padding: 0; }
.btn--block { display: flex; width: 100%; }
.btn:disabled, .btn.is-disabled { opacity: 0.4; cursor: not-allowed; }
.btn--primary.is-disabled:hover { background: var(--orange); }

/* ─── PASEK GÓRNY ─── */
.bar {
  display: flex; align-items: center; gap: var(--sp-4);
  min-height: var(--bar-h); padding: var(--sp-2) var(--sp-5);
  border-bottom: 1px solid var(--gray);
}
.bar-logo { flex-shrink: 0; }
.bar-logo img { width: 50px; }
.bar-title {
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-l);
  line-height: 1.1; letter-spacing: 0.04em; text-transform: uppercase;
}
.bar-note {
  display: flex; align-items: center; gap: var(--sp-2); margin-left: auto;
  font-size: var(--fs-s); color: var(--light);
}

/* ─── STANOWISKO: PLIK, PODGLĄD, NARZĘDZIA, ODCZYT ─── */
.stage { display: flex; flex-direction: column; background: var(--dark); min-width: 0; }

.filebar {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-4); min-height: var(--bar-h);
  border-bottom: 1px solid var(--gray);
}
.file-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.file-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-sub { font-size: var(--fs-xs); color: var(--dim); }
.filebar-actions { display: flex; gap: var(--sp-2); }
.filebar-note {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 0 var(--sp-4) var(--sp-2); font-size: var(--fs-s); color: var(--light);
}

.viewport { position: relative; background: var(--stage); height: min(55svh, 520px); min-height: 300px; overflow: hidden; }
.viewport canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.viewport canvas:focus-visible { outline-offset: -2px; }
.labels { position: absolute; inset: 0; pointer-events: none; }
.dim-label {
  position: absolute; left: 0; top: 0;
  padding: 2px 5px; background: var(--stage);
  font-family: var(--font-display); font-weight: 600; font-size: 13px; line-height: 1.2;
  letter-spacing: 0.03em; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--white);
}
.viewport-hint, .section-note, .viewport-corner {
  position: absolute; font-size: var(--fs-xs); color: var(--dim); pointer-events: none;
}
.dim-axis { color: var(--dim); }
.viewport-hint { top: var(--sp-3); left: var(--sp-4); right: var(--sp-4); }
.wheel-hint {
  position: absolute; left: 50%; bottom: var(--sp-6); transform: translateX(-50%);
  padding: var(--sp-2) var(--sp-3); background: var(--black); border: 1px solid var(--line-strong);
  border-radius: var(--radius); font-size: var(--fs-s); white-space: nowrap; pointer-events: none;
}
.section-note { top: var(--sp-3); right: var(--sp-4); max-width: 280px; text-align: right; color: var(--light); }
.viewport-corner {
  right: var(--sp-4); bottom: var(--sp-3); display: flex; flex-direction: column; align-items: flex-end;
  gap: 2px; text-align: right; font-variant-numeric: tabular-nums;
}
.bed-label { color: var(--light); }
.triad { position: absolute; left: var(--sp-2); bottom: var(--sp-2); width: 56px; height: 56px; pointer-events: none; overflow: visible; }
.triad line { stroke: var(--light); stroke-width: 1.5; stroke-linecap: round; }
.triad text {
  fill: var(--light); font-family: var(--font-display); font-weight: 600; font-size: 9px;
  text-anchor: middle; dominant-baseline: central;
}
.triad .is-back { opacity: 0.35; }

.empty, .drop {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: var(--sp-3); padding: var(--sp-5); text-align: center;
}
.empty-title { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-xl); letter-spacing: 0.02em; text-transform: uppercase; line-height: 1.1; }
.empty-text { color: var(--light); font-size: var(--fs-s); }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-3); margin-top: var(--sp-2); }
.drop { background: var(--stage); }
.drop::before { content: ''; position: absolute; inset: var(--sp-3); border: 1px dashed var(--orange); pointer-events: none; }
.drop p { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-xl); text-transform: uppercase; letter-spacing: 0.02em; }
.viewport-error {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: var(--sp-5); text-align: center; color: var(--light);
}

/* Pasek narzędzi podglądu */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3);
  padding: var(--sp-2) var(--sp-4); border-top: 1px solid var(--gray);
}
.seg { display: inline-flex; }
.seg-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 var(--sp-3);
  border: 1px solid var(--gray); background: none; color: var(--light);
  font-family: var(--font-display); font-weight: 600; font-size: 13px;
  letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}
.seg .seg-btn + .seg-btn { margin-left: -1px; }
.seg .seg-btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.seg .seg-btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.seg-btn--solo { border-radius: var(--radius); }
.seg-btn--zoom { width: 36px; padding: 0; justify-content: center; font-family: var(--font-body); font-size: var(--fs-l); letter-spacing: 0; }
.seg-btn:hover { color: var(--white); }
.seg-btn[aria-pressed="true"] {
  position: relative; z-index: 1; color: var(--white); border-color: var(--line-strong);
  box-shadow: inset 0 -2px 0 var(--orange);
}
.seg-btn:focus-visible { z-index: 2; }
.seg-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.section-ctl { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; }
.section-ctl input[type="range"] { width: 140px; }
.section-value { min-width: 84px; font-size: var(--fs-s); color: var(--light); font-variant-numeric: tabular-nums; }

/* Odczyt wymiarów */
.readout {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--gray);
}
.readout-cell { padding: var(--sp-3) var(--sp-4); min-width: 0; }
.readout-cell + .readout-cell { border-left: 1px solid var(--gray); }
.readout dt { font-size: 13px; color: var(--dim); white-space: nowrap; }
.readout dd { display: flex; align-items: baseline; gap: var(--sp-1); white-space: nowrap; }
.readout .num {
  font-family: var(--font-display); font-weight: 600; font-size: var(--fs-xl); line-height: 1.15;
  overflow: hidden; text-overflow: ellipsis;
}
.readout .unit { font-size: var(--fs-s); color: var(--light); }
.readout .is-missing { color: var(--dim); }

.mesh-status {
  display: flex; align-items: flex-start; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--gray);
  font-size: var(--fs-s); color: var(--light); min-height: 46px;
}
.mesh-status .icon { margin-top: 3px; }
.mesh-status.is-bad { color: var(--danger); }
.mesh-status ul { margin: var(--sp-1) 0; padding-left: 18px; color: var(--white); }
.mesh-status ul + p { color: var(--light); }

.size-note {
  display: flex; align-items: flex-start; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--gray);
  font-size: var(--fs-s); color: var(--white); font-weight: 500;
}
.size-note .icon { margin-top: 3px; }

/* ─── PANEL ─── */
.panel { background: var(--dark); border-top: 1px solid var(--gray); }
.block { padding: var(--sp-5); border-bottom: 1px solid var(--gray); }
.block-title {
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-l);
  letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.1; margin-bottom: var(--sp-3);
}
.block-text { font-size: var(--fs-s); color: var(--light); }
.block-text + .summary, .block-text + .quote { margin-top: var(--sp-4); }
.attach-note { display: flex; gap: var(--sp-2); margin-top: var(--sp-2); font-size: var(--fs-s); color: var(--white); font-weight: 500; }
.attach-note .icon { margin-top: 3px; }
.attach-note + .summary { margin-top: var(--sp-4); }

.field { margin-top: var(--sp-4); display: grid; gap: 6px; }
.field-row { display: flex; justify-content: space-between; align-items: baseline; }
.field-label { font-size: var(--fs-s); font-weight: 500; }
.field-value { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-m); font-variant-numeric: tabular-nums; }
.field-note { font-size: var(--fs-xs); color: var(--dim); }

.select { position: relative; }
.select select {
  appearance: none; -webkit-appearance: none; width: 100%; height: var(--control-h);
  padding: 0 40px 0 var(--sp-3); background: var(--dark2); border: 1px solid var(--gray);
  border-radius: var(--radius); font-weight: 500; cursor: pointer;
}
.select select:hover { border-color: var(--light); }
.select .icon { position: absolute; right: var(--sp-3); top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--light); }
.select option, .select optgroup { background: var(--dark2); color: var(--white); }

.swatches { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.swatch { position: relative; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch label { display: block; width: 32px; height: 32px; border-radius: 2px; border: 1px solid var(--mid); cursor: pointer; } /* --mid: 3,3:1 na --dark, próg 3:1 dla kontrolek */
.swatch input:checked + label { outline: 2px solid var(--orange); outline-offset: 2px; }
.swatch input:focus-visible + label { outline: 2px solid var(--white); outline-offset: 2px; }
.swatch input:disabled + label { opacity: 0.25; cursor: not-allowed; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: none; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: var(--line-strong); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -7px; border: 0; border-radius: 2px; background: var(--orange); }
input[type="range"]::-moz-range-track { height: 2px; background: var(--line-strong); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 2px; background: var(--orange); }
input[type="range"]:disabled { opacity: 0.4; cursor: not-allowed; }

.stepper { display: flex; }
.stepper input {
  width: 96px; height: var(--control-h); text-align: center; background: var(--dark2);
  border: 1px solid var(--gray); border-left: 0; border-right: 0;
  font-family: var(--font-display); font-weight: 600; font-size: var(--fs-l); font-variant-numeric: tabular-nums;
  -moz-appearance: textfield; appearance: textfield;
}
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper-btn {
  width: var(--control-h); height: var(--control-h); border: 1px solid var(--gray); background: none;
  font-size: var(--fs-l); cursor: pointer; color: var(--light);
}
.stepper-btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.stepper-btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.stepper-btn:hover { color: var(--white); border-color: var(--light); }

.quote { border-left: 2px solid var(--gray); padding-left: var(--sp-4); }
.quote.is-price { border-left-color: var(--orange); }
.quote-state { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-xl); text-transform: uppercase; letter-spacing: 0.02em; line-height: 1.1; margin-bottom: var(--sp-2); }
.quote.is-price .quote-state { text-transform: none; font-variant-numeric: tabular-nums; }
.quote-gross { margin: calc(-1 * var(--sp-1)) 0 var(--sp-2); font-family: var(--font-display); font-weight: 600; font-size: var(--fs-l); font-variant-numeric: tabular-nums; color: var(--light); }
.mesh-note { margin-top: var(--sp-1); color: var(--danger); }
.quote-lines { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-1) var(--sp-4); margin-top: var(--sp-3); font-size: var(--fs-s); }
.quote-lines dt { color: var(--light); }
.quote-lines dd { text-align: right; font-variant-numeric: tabular-nums; }
.limits { margin-top: var(--sp-4); font-size: var(--fs-s); color: var(--light); }
.limits summary { cursor: pointer; color: var(--white); font-weight: 500; }
.limits ul { margin-top: var(--sp-2); padding-left: 18px; display: grid; gap: 6px; }

.summary {
  margin-bottom: var(--sp-3); padding: var(--sp-3); max-height: 220px; overflow: auto;
  background: var(--dark2); border: 1px solid var(--gray); border-radius: var(--radius);
  font-family: var(--font-body); font-size: 13px; line-height: 1.5; white-space: pre-wrap; color: var(--light);
}
.copy-status { min-height: 1.5em; margin: var(--sp-1) 0 var(--sp-3); font-size: var(--fs-xs); color: var(--light); }

.consent { position: relative; display: flex; gap: var(--sp-3); align-items: flex-start; margin-bottom: var(--sp-4); cursor: pointer; font-size: var(--fs-s); color: var(--light); }
.consent input { position: absolute; opacity: 0; pointer-events: none; }
.consent-box {
  flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px; border: 1.5px solid var(--orange); border-radius: 2px;
  display: inline-flex; align-items: center; justify-content: center;
}
.consent-box .icon { width: 14px; height: 14px; color: var(--white); stroke-width: 3; opacity: 0; }
.consent input:checked + .consent-box { background: var(--orange); }
.consent input:checked + .consent-box .icon { opacity: 1; }
.consent input:focus-visible + .consent-box { outline: 2px solid var(--orange); outline-offset: 2px; }
.consent a { color: var(--white); text-underline-offset: 2px; }
.consent a:hover { color: var(--orange); }
.mail-gate { margin-top: var(--sp-2); font-size: var(--fs-xs); color: var(--dim); }
.mail-note { margin-top: var(--sp-3); font-size: var(--fs-xs); color: var(--light); }
.mail-note + .mail-note { margin-top: var(--sp-1); }
.mail-address { color: var(--white); user-select: all; }
.mail-status { margin-top: var(--sp-3); font-size: var(--fs-s); color: var(--white); }
.mail-status:empty { display: none; }

.foot { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); padding: var(--sp-5); font-size: var(--fs-xs); color: var(--dim); }
.foot a { color: var(--light); text-decoration: none; }
.foot a:hover { color: var(--white); }

/* ─── UKŁAD NARZĘDZIA NA DUŻYM EKRANIE: podgląd na pełną wysokość, panel przewijany ───
   Warunek powtórzony w app.js (TWO_COLUMN). 520 px wysokości obejmuje laptop 1366×768 (okno ok. 607 px). */
@media (min-width: 960px) and (min-height: 520px) {
  body { height: 100svh; display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
  .tool { display: grid; grid-template-columns: minmax(0, 1fr) var(--panel-w); min-height: 0; }
  .stage { min-height: 0; }
  .viewport { flex: 1; height: auto; min-height: 0; }
  .panel { overflow-y: auto; border-top: 0; border-left: 1px solid var(--gray); }
  .mesh-status { max-height: 140px; overflow-y: auto; }
}

/* Niskie okno w układzie dwukolumnowym: ciaśniejsze paski, żeby podgląd zachował wysokość */
@media (min-width: 960px) and (min-height: 520px) and (max-height: 760px) {
  :root { --bar-h: 48px; --control-h: 36px; }
  .bar { padding-top: var(--sp-1); padding-bottom: var(--sp-1); }
  .bar-logo img { width: 42px; }
  .filebar { padding-top: 6px; padding-bottom: 6px; }
  .toolbar { padding-top: 6px; padding-bottom: 6px; }
  .seg-btn { height: 32px; }
  .seg-btn--zoom { width: 32px; }
  .readout-cell { padding: 6px var(--sp-4); }
  .readout dt { font-size: var(--fs-xs); }
  .readout .num { font-size: 22px; }
  .mesh-status { min-height: 0; padding: var(--sp-2) var(--sp-4); }
  .block { padding: var(--sp-4) var(--sp-5); }
}

/* ─── TELEFON ─── */
@media (max-width: 700px) {
  .bar { flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); padding: var(--sp-2) var(--sp-4); }
  .bar-logo img { width: 40px; }
  .bar-title { font-size: 18px; }
  .bar-note { margin-left: 0; width: 100%; font-size: var(--fs-xs); }
  .filebar { flex-wrap: wrap; }
  .filebar .btn--primary { order: 3; flex: 1; }
  .file-meta { order: 1; flex-basis: calc(100% - 140px); }
  .file-name { white-space: normal; }
  .filebar-actions { order: 2; margin-left: auto; }
  .filebar-actions .btn span { display: none; }
  .filebar-actions .btn--ghost:not(.btn--icon) { width: var(--control-h); padding: 0; }
  .toolbar { padding: var(--sp-2) var(--sp-3); }
  /* Wiersze: widoki | przybliżenie, reset, przekrój | oś, suwak, położenie */
  .toolbar > .seg:first-child { flex: 1 1 100%; }
  .toolbar > .seg:first-child .seg-btn { flex: 1; justify-content: center; padding: 0 var(--sp-2); }
  .section-ctl { display: contents; }
  #sectionToggle { margin-left: auto; }
  .section-ctl input[type="range"] { flex: 1; width: auto; min-width: 120px; }
  .section-value { min-width: 0; }
  .readout { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .readout-cell { grid-column: span 2; padding: var(--sp-2) var(--sp-3); }
  .readout-cell:nth-child(n+4) { grid-column: span 3; border-top: 1px solid var(--gray); }
  .readout-cell:nth-child(4) { border-left: 0; }
  .readout .num { font-size: 22px; }
  .readout dt { font-size: var(--fs-xs); }
  .block { padding: var(--sp-5) var(--sp-4); }
  .section-note { left: var(--sp-4); max-width: none; text-align: left; top: auto; bottom: 64px; }
}

@media (pointer: coarse) {
  .seg-btn { height: 40px; }
  .seg-btn--zoom { width: 40px; }
  input[type="range"]::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: -10px; }
  input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
