/* Konfigurator wiaty. Biel, czerń, cienkie linie, jeden kolor akcji. */
@font-face { font-family: 'Hanken Grotesk'; src: url('fonts/hanken-grotesk-latin.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; 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: 'Hanken Grotesk'; src: url('fonts/hanken-grotesk-latin-ext.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; 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; }

:root {
  --paper: #ffffff;
  --paper-2: #f0f0f0;
  --stage: #f4f4f4;
  --ink: #141414;
  --ink-2: #3a3a3a;
  --muted: #5e5e5e;
  --rule: rgba(20, 20, 20, 0.16);
  --rule-strong: rgba(20, 20, 20, 0.45);
  --accent: #d0381c;
  --accent-strong: #b02d14;
  --accent-ink: #ffffff;
  --field: #ffffff;
  --ink-disabled: rgba(20, 20, 20, 0.4);
  --swatch-edge: rgba(20, 20, 20, 0.2);
  --scrim: rgba(20, 20, 20, 0.5);
  --night-ink: #f2f2f2;
  --night-muted: #bdbdbd;
  --rule-inverse: rgba(255, 255, 255, 0.36);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --focus: #141414;
  --font: 'Hanken Grotesk', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --r: 3px;
  --bar-h: 76px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow-x: clip; }
body { background: var(--paper); color: var(--ink); font: 400 16px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.app { display: grid; grid-template-columns: minmax(0, 1fr) 440px; grid-template-rows: minmax(0, 1fr) auto; height: 100dvh; }

/* ---------- podgląd ---------- */
.stage { position: relative; grid-row: 1 / 3; min-height: 0; background: var(--stage); overflow: hidden; }
.view3d { position: absolute; inset: 0; overflow: hidden; }
.stage canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.stage canvas:active { cursor: grabbing; }
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.dim-label { position: absolute; left: 0; top: 0; padding: 1px 6px; background: var(--paper); border: 1px solid var(--rule-strong); border-radius: var(--r); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); will-change: transform; }
.stage-brand { position: absolute; left: 20px; top: 16px; margin: 0; display: flex; gap: 10px; align-items: baseline; font-size: 13px; color: var(--muted); }
.stage-brand a { color: var(--ink); font-weight: 700; letter-spacing: 0.08em; text-decoration: none; }
.stage-brand a:hover { text-decoration: underline; }
.views { position: absolute; z-index: 2; right: 16px; top: 12px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: calc(100% - 32px); }
.hint { position: absolute; left: 20px; bottom: 14px; margin: 0; font-size: 13px; color: var(--muted); }
.nogl { position: absolute; inset: 0; margin: auto; height: max-content; max-width: 420px; padding: 20px; text-align: center; color: var(--ink-2); }
.view3d.is-night .stage-brand, .view3d.is-night .hint { color: var(--night-muted); }
.view3d.is-night .stage-brand a { color: var(--night-ink); }

/* ---------- panel ---------- */
.panel { grid-column: 2; grid-row: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; border-left: 1px solid var(--rule-strong); background: var(--paper); padding: 26px 26px 12px; scrollbar-width: thin; }
.panel-head h1 { margin: 0 0 8px; font-size: 26px; line-height: 1.12; font-weight: 600; letter-spacing: -0.01em; }
.panel-head p { margin: 0 0 6px; color: var(--muted); font-size: 15px; }
fieldset { border: 0; border-top: 1px solid var(--rule-strong); margin: 22px 0 0; padding: 16px 0 0; min-width: 0; }
legend { float: left; width: 100%; padding: 0; margin: 0 0 14px; font-size: 19px; font-weight: 600; letter-spacing: -0.005em; display: flex; gap: 10px; align-items: baseline; }
legend + * { clear: both; }
.lbl { display: block; font-size: 14px; color: var(--ink-2); margin: 0 0 6px; }
.field { margin-top: 14px; }
.info { margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.info:empty { display: none; }
.info.warn { color: var(--accent); }

.seg { display: flex; border: 1px solid var(--rule-strong); border-radius: var(--r); background: var(--paper); }
.seg button { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 8px 6px; white-space: nowrap; background: transparent; border: 0; border-left: 1px solid var(--rule); font-size: 15px; line-height: 1.2; color: var(--ink-2); }
.seg button:first-child { border-left: 0; }
.seg button:hover { background: var(--paper-2); }
.seg button[aria-pressed='true'] { background: var(--ink); color: var(--paper); }
.seg button[aria-pressed='true'] + button[aria-pressed='true'] { border-left-color: var(--rule-inverse); }
.seg button:disabled { color: var(--ink-disabled); cursor: not-allowed; background: transparent; text-decoration: line-through; }
.seg-s button { min-height: 36px; padding: 6px 11px; font-size: 14px; }

.range { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; margin-top: 14px; }
.range label { font-size: 15px; }
.range input[type='range'] { grid-column: 1 / 3; width: 100%; height: 30px; margin: 0; accent-color: var(--ink); cursor: pointer; }
.step { display: flex; align-items: center; gap: 2px; }
.step output { min-width: 68px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.step button { width: 34px; height: 34px; border: 1px solid var(--rule-strong); border-radius: var(--r); background: transparent; font-size: 18px; line-height: 1; }
.step button:hover { background: var(--paper-2); }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 44px; height: 44px; padding: 3px; border: 1px solid var(--rule-strong); border-radius: var(--r); background: var(--paper); }
.swatches button i { display: block; width: 100%; height: 100%; border-radius: 1px; border: 1px solid var(--swatch-edge); }
.swatches button[aria-pressed='true'] { border: 2px solid var(--ink); padding: 2px; }

.wallrow { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 10px; margin-top: 8px; }
.wallrow .lbl { margin: 0; }
.wallrow:first-of-type { margin-top: 0; }

.check { display: flex; align-items: flex-start; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: 15px; cursor: pointer; }
.check:first-of-type { padding-top: 2px; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--ink); flex: none; }
.check em { font-style: normal; color: var(--muted); }
.check:has(input:disabled) { color: var(--ink-disabled); cursor: not-allowed; }

.lines { list-style: none; margin: 0; padding: 0; }
.lines li { display: grid; grid-template-columns: 1fr auto; gap: 0 14px; padding: 8px 0; border-bottom: 1px solid var(--rule); font-size: 15px; }
.lines li small { grid-column: 1 / 3; color: var(--muted); font-size: 13px; }
.lines li b, .totals dd { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.totals { margin: 10px 0 0; }
.totals div { display: flex; justify-content: space-between; gap: 14px; padding: 3px 0; font-size: 15px; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; }
.totals .total { padding-top: 8px; font-size: 19px; }
.totals .total dt { color: var(--ink); font-weight: 600; }
.totals .total dd { font-weight: 700; }
.links { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 14px; }
.link { background: none; border: 0; padding: 4px 0; font-size: 15px; text-decoration: underline; text-underline-offset: 3px; color: var(--ink); }
.link:hover { color: var(--accent); }
.panel-foot { margin-top: 26px; padding: 14px 0 6px; border-top: 1px solid var(--rule-strong); font-size: 14px; color: var(--muted); }
.panel-foot p { margin: 0; }

/* ---------- pasek ceny ---------- */
.bar { grid-column: 2; grid-row: 2; display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'price vat' 'btns btns'; gap: 10px 12px; align-items: end; padding: 14px 26px 18px; border-left: 1px solid var(--rule-strong); border-top: 1px solid var(--ink); background: var(--paper); }
.bar-price { grid-area: price; display: flex; flex-direction: column; min-width: 0; }
.bar-lbl { font-size: 13px; color: var(--muted); }
.bar-price strong { font-size: 32px; line-height: 1.1; font-weight: 700; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-id { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-vat { grid-area: vat; }
.bar-btns { grid-area: btns; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn { min-height: 48px; padding: 10px 16px; white-space: nowrap; border: 1px solid var(--ink); border-radius: var(--r); background: transparent; font-size: 16px; font-weight: 600; color: var(--ink); }
.btn:hover { background: var(--paper-2); }
.btn-pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-pri:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-s { min-height: 36px; padding: 6px 12px; font-size: 14px; font-weight: 500; background: var(--paper); border-color: var(--rule-strong); }
.btn[disabled] { opacity: 0.6; cursor: progress; }

/* ---------- okna ---------- */
dialog { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 24px; border: 1px solid var(--ink); border-radius: var(--r); background: var(--paper); color: var(--ink); overflow-y: auto; }
dialog.wide { width: min(1040px, calc(100vw - 24px)); }
dialog::backdrop { background: var(--scrim); }
dialog h2 { margin: 0 0 6px; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
dialog label { display: block; margin-top: 12px; font-size: 14px; color: var(--ink-2); }
dialog input, dialog textarea { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 1px solid var(--rule-strong); border-radius: var(--r); background: var(--field); font-size: 16px; color: var(--ink); }
dialog textarea { resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.dlg-btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 4px; }
.dlg-head h2 { margin: 0; }
#ask-out { margin: 14px 0 0; padding: 14px; border: 1px solid var(--rule-strong); border-radius: var(--r); background: var(--field); font: 400 14px/1.5 var(--font); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 46dvh; overflow-y: auto; }
.plans { display: grid; grid-template-columns: 1.25fr 1fr; grid-template-areas: 'plan front' 'plan side'; gap: 14px; margin-top: 14px; }
.plans figure { margin: 0; padding: 12px; border: 1px solid var(--rule-strong); border-radius: var(--r); background: var(--field); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.plans figure:nth-child(1) { grid-area: plan; }
.plans figure:nth-child(2) { grid-area: front; }
.plans figure:nth-child(3) { grid-area: side; }
.plans figcaption { font-size: 15px; font-weight: 600; }
.plans figure > div { flex: 1; display: flex; align-items: center; justify-content: center; }
.plans svg { width: 100%; height: auto; max-height: 56dvh; }
table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 15px; }
th, td { text-align: left; padding: 7px 0; border-bottom: 1px solid var(--rule); font-weight: 400; }
th { font-size: 14px; font-weight: 600; border-bottom-color: var(--rule-strong); }
td:last-child, th:last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); padding: 10px 16px; border-radius: var(--r); background: var(--ink); color: var(--paper); font-size: 15px; opacity: 0; pointer-events: none; transition: opacity 160ms var(--ease-out); z-index: 20; max-width: calc(100vw - 32px); }
.toast.on { opacity: 1; }

/* ---------- telefon i tablet w pionie ---------- */
@media (max-width: 900px) {
  html, body { height: auto; }
  .app { display: block; height: auto; padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom)); }
  .stage { display: contents; }
  .view3d { position: sticky; inset: auto; top: 0; z-index: 5; height: 42dvh; min-height: 260px; background: var(--stage); border-bottom: 1px solid var(--ink); }
  .stage-brand { left: 12px; top: 10px; font-size: 12px; }
  .stage-brand span { display: none; }
  .views { position: static; display: grid; grid-template-columns: 3fr 1fr; gap: 6px; max-width: none; padding: 10px 16px; background: var(--paper); border-bottom: 1px solid var(--rule-strong); }
  .views [data-views] { grid-column: 1 / 3; }
  .views .seg-s button { min-height: 38px; padding: 6px 4px; font-size: 14px; }
  .views .btn-s { min-height: 40px; padding: 6px 4px; font-size: 14px; border-color: var(--rule-strong); }
  .hint { display: none; }
  .dim-label { font-size: 12px; padding: 0 4px; }
  .panel { border-left: 0; padding: 20px 16px 8px; overflow: visible; }
  .panel-head h1 { font-size: 23px; }
  .bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; grid-template-columns: 1fr auto; grid-template-areas: 'price btns'; align-items: center; gap: 10px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); border-left: 0; min-height: var(--bar-h); }
  .bar-vat { display: none; }
  .bar-id { display: none; }
  .bar-price strong { font-size: 22px; }
  .bar-lbl { font-size: 12px; }
  .bar-btns { grid-template-columns: auto auto; gap: 6px; }
  .bar-lbl { white-space: nowrap; }
  .bar .btn { min-height: 46px; padding: 8px 12px; font-size: 15px; }
  .toast { bottom: calc(var(--bar-h) + 16px); }
  .grid2 { grid-template-columns: 1fr; }
  dialog { padding: 18px; }
  .plans { grid-template-columns: 1fr; grid-template-areas: 'plan' 'front' 'side'; }
}
@media (max-width: 350px) {
  .seg button { font-size: 13px; padding: 8px 3px; }
}
@media (max-width: 430px) {
  .bar .btn .x { display: none; }
  .bar .btn .cap { text-transform: capitalize; }
  .bar .btn { padding: 8px 12px; }
  .bar-price strong { font-size: 21px; }
  .seg button { font-size: 14px; }
  .wallrow { grid-template-columns: 52px 1fr; }
}
@media (max-width: 900px) and (orientation: landscape) {
  .view3d { height: 68dvh; }
}
@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}
@media print {
  .bar, .views, .hint { display: none; }
}
