/* Tarvio — konfigurator zadaszeń (demo koncepcyjne) */
:root {
  --bg: #f3f2ef;
  --surface: #ffffff;
  --surface-2: #f7f6f3;
  --ink: #1b1e21;
  --muted: #5a6168;
  --line: #e4e1db;
  --line-2: #cfcac1;
  --acc: #1f4f4a;
  --acc-h: #153a36;
  --acc-soft: #e6efec;
  --warn-bg: #fff2cc;
  --warn-ink: #5c4400;
  --err: #b42318;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 24, 28, .06), 0 6px 20px rgba(20, 24, 28, .07);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { flex: none; }
h1, h2 { margin: 0; letter-spacing: -.015em; }
.muted { color: var(--muted); font-weight: 400; }
.sr-only, .vh {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 3px solid var(--acc); outline-offset: 2px; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--acc); color: #fff; padding: 10px 14px; border-radius: 8px; text-decoration: none; font-weight: 600;
}
.skip:focus { top: 10px; }

/* ---------- top bar ---------- */
.topbar {
  height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 30px; height: 30px; }
.brand-mark rect { fill: var(--acc); }
.brand-mark path { fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; }
.brand-name { font-weight: 750; font-size: 19px; letter-spacing: -.03em; }
.brand-sub { color: var(--muted); font-size: 13px; padding-left: 10px; border-left: 1px solid var(--line); }
.demo-badge {
  margin: 0; display: inline-flex; align-items: center; gap: 8px;
  background: var(--warn-bg); color: var(--warn-ink); font-size: 13px; font-weight: 600;
  padding: 6px 12px; border-radius: 999px; white-space: nowrap;
}
.demo-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: #c58a00; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: minmax(0, 1fr) 432px; height: calc(100vh - 58px); height: calc(100dvh - 58px); }
.viewer { position: relative; min-height: 0; background: #dfe6e9; overflow: hidden; }
#scena { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
#scena:focus-visible { outline: 3px solid var(--acc); outline-offset: -3px; }
.side { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-left: 1px solid var(--line); }
.panel { flex: 1; min-height: 0; overflow-y: auto; padding: 26px 26px 12px; overscroll-behavior: contain; scrollbar-gutter: stable; }
.panel:focus { outline: none; }

/* ---------- viewer overlay ---------- */
.v-top, .v-bottom { position: absolute; left: 14px; right: 14px; display: flex; justify-content: space-between; gap: 10px; pointer-events: none; }
.v-top { top: 14px; align-items: flex-start; }
.v-bottom { bottom: 14px; align-items: flex-end; }
.v-top > *, .v-bottom > * { pointer-events: auto; }
.glass, .chip, .v-btn, .views, .hint-3d {
  background: rgba(255, 255, 255, .86);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, .6);
  box-shadow: 0 2px 10px rgba(20, 24, 28, .1);
}
.chip { margin: 0; padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.v-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px 7px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; min-height: 36px;
}
.v-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.v-btn .i-sun { display: none; }
.v-btn[aria-pressed="true"] .i-sun { display: block; }
.v-btn[aria-pressed="true"] .i-moon { display: none; }
.v-btn:hover, .views button:hover { background: #fff; }
.views { display: inline-flex; padding: 3px; border-radius: 999px; }
.views button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; min-height: 32px;
}
.views button[aria-pressed="true"] { background: var(--acc); color: #fff; }
.hint-3d { margin: 0; font-size: 12px; color: var(--muted); padding: 6px 12px; border-radius: 999px; }
@media (pointer: coarse) { .h-desk { display: none; } }
@media (pointer: fine), (pointer: none) { .h-touch { display: none; } }

.loader, .v-error {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 12px;
  background: linear-gradient(#dfe7ea, #ece9e3); color: var(--muted); font-weight: 600; transition: opacity .4s;
}
.loader.done { opacity: 0; pointer-events: none; }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(31, 79, 74, .2); border-top-color: var(--acc); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.v-error[hidden] { display: none; }
.v-error p { max-width: 380px; margin: 16px; padding: 18px 20px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); font-weight: 400; color: var(--ink); }

/* ---------- panel ---------- */
.intro h1 { font-size: 23px; line-height: 1.2; font-weight: 700; }
.intro p { margin: 8px 0 4px; color: var(--muted); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.step { padding: 22px 0; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.step > legend, .step > h2 {
  display: flex; align-items: center; gap: 10px; padding: 0; margin-bottom: 14px;
  font-size: 16px; font-weight: 700; letter-spacing: -.01em;
}
.step > legend { float: left; width: 100%; }
.step > legend + * { clear: both; }
.num {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--acc-soft); color: var(--acc); font-size: 13px; font-weight: 700;
}

.dim + .dim { margin-top: 14px; }
.dim-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dim-head label { font-weight: 600; font-size: 14px; }
.dim-head output { font-weight: 700; font-variant-numeric: tabular-nums; }
.num-in { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.num-in input {
  width: 74px; padding: 6px 8px; text-align: right; border: 1.5px solid var(--line-2); border-radius: 8px;
  font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; background: #fff;
}
.num-in input:focus-visible { border-color: var(--acc); }
.lim { display: flex; justify-content: space-between; margin: 0; font-size: 12px; color: var(--muted); }
.info { margin: 14px 0 0; font-size: 13px; color: var(--muted); }
.info b { color: var(--ink); font-weight: 600; }

input[type="range"] {
  --p: 50%;
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 28px; margin: 4px 0 2px;
  background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--acc) var(--p), var(--line-2) var(--p));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%;
  background: #fff; border: 2px solid var(--acc); box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
}
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line-2); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--acc); }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--acc); }
input[type="range"]:focus-visible { outline: 3px solid var(--acc); outline-offset: 3px; border-radius: 8px; }

.sub { margin-top: 14px; padding: 12px 14px; background: var(--surface-2); border-radius: 10px; }
.sub[hidden] { display: none; }
.sub.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 14px; }
.sub.row label { font-weight: 600; }
select {
  padding: 7px 32px 7px 10px; border: 1.5px solid var(--line-2); border-radius: 8px; background: #fff;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%235a6168' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 16px;
}

/* karty pokrycia */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.card { position: relative; display: block; }
.card-in {
  display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 12px 10px 11px;
  border: 1.5px solid var(--line-2); border-radius: var(--radius); background: #fff; cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.card-in svg { width: 100%; height: 38px; }
.card-in b { font-size: 14px; line-height: 1.2; }
.card-in small { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card:hover .card-in { border-color: var(--acc); }
.card input:checked + .card-in { border-color: var(--acc); background: var(--acc-soft); box-shadow: inset 0 0 0 1px var(--acc); }
.card input:focus-visible + .card-in { outline: 3px solid var(--acc); outline-offset: 2px; }

/* kolory RAL */
.swatches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 6px; }
.sw { position: relative; display: block; }
.sw-in { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 6px 2px; border-radius: 10px; cursor: pointer; text-align: center; }
.sw-dot {
  width: 38px; height: 38px; border-radius: 50%; background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18), inset 0 -8px 14px rgba(0, 0, 0, .12), inset 0 6px 10px rgba(255, 255, 255, .18);
  transition: box-shadow .15s;
}
.sw-dot.metal { background: linear-gradient(135deg, var(--c) 0%, #e6e6e3 45%, var(--c) 70%, #77746f 100%); }
.sw-in b { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sw-in small { font-size: 11px; color: var(--muted); line-height: 1.2; }
.sw:hover .sw-in { background: var(--surface-2); }
.sw input:checked + .sw-in .sw-dot { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--acc), inset 0 0 0 1px rgba(0, 0, 0, .18); }
.sw input:checked + .sw-in b { color: var(--acc); }
.sw input:focus-visible + .sw-in { outline: 3px solid var(--acc); outline-offset: 0; }

/* dodatki */
.addon + .addon { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); }
.addon-title { margin: 0 0 10px; font-weight: 600; font-size: 14px; }
.addon-title .muted { font-size: 13px; }
.toggles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tg { position: relative; display: block; }
.tg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tg-box {
  display: flex; flex-direction: column; gap: 2px; padding: 9px 10px 9px 32px; border: 1.5px solid var(--line-2);
  border-radius: 10px; cursor: pointer; position: relative; background: #fff; transition: border-color .15s, background-color .15s;
}
.tg-box::before {
  content: ""; position: absolute; left: 10px; top: 11px; width: 15px; height: 15px; border-radius: 4px;
  border: 1.5px solid var(--line-2); background: #fff;
}
.tg-box b { font-size: 14px; }
.tg-box small { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tg:hover .tg-box { border-color: var(--acc); }
.tg input:checked + .tg-box { border-color: var(--acc); background: var(--acc-soft); box-shadow: inset 0 0 0 1px var(--acc); }
.tg input:checked + .tg-box::before {
  background: var(--acc) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat;
  border-color: var(--acc);
}
.tg input:focus-visible + .tg-box { outline: 3px solid var(--acc); outline-offset: 2px; }

.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--acc); flex: none; cursor: pointer; }
.check b { font-weight: 600; }

.link-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 2px; border: 0; background: none;
  color: var(--acc); font-weight: 600; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.link-btn:hover { text-decoration-thickness: 2px; }
.link-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* podsumowanie */
.breakdown { width: 100%; border-collapse: collapse; font-size: 14px; }
.breakdown th, .breakdown td { padding: 8px 0; vertical-align: top; border-bottom: 1px solid var(--line); }
.breakdown th { text-align: left; font-weight: 500; padding-right: 12px; }
.breakdown th small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; }
.breakdown td { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.breakdown tfoot th, .breakdown tfoot td { border-bottom: 0; padding: 6px 0; }
.breakdown tfoot tr:first-child th, .breakdown tfoot tr:first-child td { padding-top: 12px; }
.breakdown tfoot th { font-weight: 600; }
.breakdown tfoot .total th, .breakdown tfoot .total td { font-size: 17px; font-weight: 750; border-top: 1.5px solid var(--ink); padding-top: 10px; }
.note { margin: 14px 0 10px; font-size: 13px; color: var(--muted); }
.rates { margin: 0 0 12px; font-size: 13px; }
.rates summary { cursor: pointer; color: var(--acc); font-weight: 600; width: fit-content; padding: 2px 0; }
.rates ul { margin: 10px 0 0; padding: 12px 14px 12px 30px; background: var(--surface-2); border-radius: 10px; color: var(--ink); }
.rates li + li { margin-top: 4px; }
.rates li span { color: var(--muted); }

/* pasek ceny */
.pricebar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 22px 16px; background: var(--surface); border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(20, 24, 28, .05);
}
.pb-price { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.pb-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.pb-netto { font-size: 24px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pb-netto small { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.pb-brutto { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pb-netto.bump { animation: bump .35s ease; }
@keyframes bump { 40% { color: var(--acc); } }

.btn-primary, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px;
  padding: 11px 18px; border-radius: 10px; font-weight: 650; font-size: 15px; white-space: nowrap;
  transition: background-color .15s, border-color .15s, transform .1s;
}
.btn-primary { background: var(--acc); color: #fff; border: 1.5px solid var(--acc); }
.btn-primary:hover { background: var(--acc-h); border-color: var(--acc-h); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary[disabled] { opacity: .7; cursor: progress; }
.btn-ghost { background: #fff; color: var(--ink); border: 1.5px solid var(--line-2); }
.btn-ghost:hover { border-color: var(--ink); }

/* ---------- okno wyceny ---------- */
dialog {
  width: min(640px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 16px;
  box-shadow: 0 30px 80px rgba(10, 14, 18, .35); color: var(--ink);
}
dialog::backdrop { background: rgba(18, 21, 24, .55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.dlg-in { position: relative; padding: 28px 28px 24px; }
.dlg-x {
  position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: var(--surface-2);
}
.dlg-x svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.dlg-x:hover { background: var(--line); }
#dlg h2 { font-size: 21px; padding-right: 48px; }
.dlg-lead { margin: 8px 0 14px; color: var(--muted); }
.dlg-sum {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 11px 14px; margin-bottom: 18px;
  background: var(--acc-soft); border-radius: 10px; font-size: 14px;
}
.dlg-sum b { font-variant-numeric: tabular-nums; }
.f-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 14px; }
.f.full { grid-column: 1 / -1; }
.f label:not(.check) { display: block; font-weight: 600; font-size: 14px; margin-bottom: 5px; }
.f input:not([type="checkbox"]), .f textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line-2); border-radius: 10px; background: #fff; min-height: 44px;
}
.f textarea { resize: vertical; min-height: 80px; }
.f input:focus-visible, .f textarea:focus-visible { border-color: var(--acc); outline-offset: 1px; }
.f [aria-invalid="true"] { border-color: var(--err) !important; }
.req { color: var(--err); }
.err { margin: 5px 0 0; color: var(--err); font-size: 13px; font-weight: 600; }
.err[hidden] { display: none; }
.consent { margin-top: 16px; }
.consent .check { font-size: 13.5px; color: var(--ink); }
.demo-note { margin: 16px 0 0; padding: 10px 14px; background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; font-size: 13px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
#dlg-ok { text-align: center; padding: 8px 4px 0; }
#dlg-ok:focus { outline: none; }
#dlg-ok h2 { padding: 0; }
#dlg-ok p { margin: 10px auto 0; max-width: 480px; }
.ok-prod { color: var(--muted); font-size: 14px; }
.ok-ico { width: 60px; height: 60px; margin: 6px auto 14px; border-radius: 50%; background: var(--acc-soft); display: grid; place-items: center; }
.ok-ico svg { width: 30px; height: 30px; fill: none; stroke: var(--acc); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
#dlg-ok .dlg-actions { justify-content: center; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px); z-index: 50;
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- tablet / telefon ---------- */
@media (max-width: 1100px) {
  .app { grid-template-columns: minmax(0, 1fr) 380px; }
  .panel { padding: 22px 20px 12px; }
  .hint-3d { display: none; }
}
@media (max-width: 899px) {
  .topbar { height: auto; min-height: 52px; padding: 9px 16px; flex-wrap: wrap; row-gap: 6px; }
  .brand-sub { display: none; }
  .demo-badge { font-size: 12px; padding: 5px 10px; white-space: normal; }
  .app { display: block; height: auto; }
  .viewer { position: sticky; top: 0; z-index: 5; height: 46vh; height: 46svh; min-height: 260px; box-shadow: 0 6px 16px rgba(20, 24, 28, .08); }
  .v-top { top: 10px; left: 10px; right: 10px; }
  .v-bottom { bottom: 10px; left: 10px; right: 10px; justify-content: center; }
  .chip { font-size: 12px; padding: 6px 11px; }
  .views button { padding: 6px 11px; }
  .side { border-left: 0; }
  .panel { overflow: visible; padding: 22px 16px 24px; scrollbar-gutter: auto; }
  .pricebar {
    position: sticky; bottom: 0; z-index: 6; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 20px rgba(20, 24, 28, .1);
  }
  .pb-netto { font-size: 20px; }
  .btn-primary { padding: 10px 14px; }
  .toast { bottom: 96px; }
}
@media (max-width: 420px) {
  .cards { gap: 6px; }
  .card-in { padding: 10px 8px; }
  .card-in svg { height: 32px; }
  .toggles { gap: 6px; }
  .tg-box { padding: 8px 8px 8px 30px; }
  .tg-box::before { left: 9px; }
  .f-grid { grid-template-columns: 1fr; }
  .dlg-in { padding: 22px 18px 18px; }
  .dlg-actions .btn-primary, .dlg-actions .btn-ghost { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
