/* ==========================================================================
   Konfigurator mebli — style podstrony (korzysta ze zmiennych z assets/css/style.css)
   ========================================================================== */

.site-header--solid,
.site-header--solid.is-scrolled { background: var(--ink); border-color: var(--line-light); }

.cfg { padding-top: var(--header-h); padding-bottom: 96px; background: var(--paper); }
.cfg__intro { padding-top: clamp(32px, 5vw, 64px); padding-bottom: clamp(24px, 3vw, 40px); display: grid; gap: 14px; }
.cfg__title { font-family: var(--serif); font-weight: 400; font-size: clamp(2.3rem, 5vw, 4.2rem); line-height: 1.02; margin-top: 8px; }
.cfg__title em { color: var(--bronze-deep); }
.cfg__lead { color: var(--muted); max-width: 60ch; }

/* --- układ: panel + podgląd --- */
.cfg__layout { display: grid; gap: 24px; grid-template-areas: "preview" "panel"; }
.cfg__panel { grid-area: panel; min-width: 0; }
.cfg__preview { grid-area: preview; min-width: 0; }
@media (min-width: 1024px) {
  .cfg__layout { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); grid-template-areas: "panel preview"; gap: 40px; align-items: start; }
  .cfg__preview { position: sticky; top: calc(var(--header-h) + 20px); }
}

/* --- etapy --- */
.csteps { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 0 18px; scrollbar-width: thin; }
.csteps__btn {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  min-height: 40px; padding: 6px 12px 6px 6px; background: transparent; border: 1px solid var(--line);
  font-size: .8125rem; font-weight: 500; color: var(--muted); transition: border-color .2s, background-color .2s, color .2s;
}
.csteps__btn:hover:not(:disabled) { border-color: var(--ink); color: var(--ink); }
.csteps__btn:disabled { opacity: .45; cursor: not-allowed; }
.csteps__num { display: grid; place-items: center; width: 26px; height: 26px; background: var(--paper-2); font-size: .75rem; font-weight: 700; }
.csteps__item.is-current .csteps__btn { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.csteps__item.is-current .csteps__num { background: var(--bronze); color: var(--ink); }
.csteps__item.is-done .csteps__num { background: var(--bronze-deep); color: var(--paper); }

.cfg__notices { display: grid; gap: 8px; }
.cfg__notices:not(:empty) { margin-bottom: 16px; }
.notice { padding: 12px 16px; font-size: .875rem; border-left: 2px solid var(--bronze-deep); background: var(--paper-2); }
.notice--error { border-color: var(--error); background: #f5e6e1; }
.cfg__loading { color: var(--muted); padding: 40px 0; }

/* --- krok --- */
.cfg__step { background: #fbf8f3; border: 1px solid var(--line); padding: clamp(20px, 3vw, 36px); }
.cstep { display: grid; gap: 26px; transition: opacity .35s var(--ease), transform .35s var(--ease); }
.cstep--enter { opacity: 0; transform: translateY(8px); }
.cstep__head { display: grid; gap: 8px; }
.cstep__kicker { font-size: .6875rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--bronze-deep); }
.cstep__title { font-family: var(--serif); font-weight: 400; font-size: clamp(1.9rem, 3vw, 2.6rem); line-height: 1.05; outline: none; }
.cstep__lead { color: var(--muted); }
.cstep__note { font-size: .8125rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }
.cstep-errors { padding: 14px 16px; border-left: 2px solid var(--error); background: #f5e6e1; color: var(--error); font-size: .875rem; font-weight: 500; display: grid; gap: 4px; outline: none; }
.linkbtn { background: none; border: 0; padding: 4px 0; color: var(--bronze-deep); font: inherit; font-size: .875rem; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; justify-self: start; }
.linkbtn:hover { color: var(--ink); }

/* --- kategorie --- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.cat-card {
  display: grid; align-content: start; gap: 6px; text-align: left; padding: 16px; min-height: 190px;
  background: var(--paper); border: 1px solid var(--line); cursor: pointer; transition: border-color .2s, background-color .2s, transform .25s var(--ease);
}
.cat-card:hover { border-color: var(--ink); transform: translateY(-2px); }
.cat-card.is-selected { border-color: var(--ink); background: #fff; box-shadow: inset 0 0 0 1px var(--ink); }
.cat-card__icon { width: 52px; height: 52px; color: var(--bronze-deep); margin-bottom: 4px; }
.cat-card__icon svg { width: 100%; height: 100%; }
.cat-card__name { font-family: var(--serif); font-size: 1.35rem; line-height: 1.1; }
.cat-card__desc { font-size: .8125rem; color: var(--muted); line-height: 1.45; }
.badge { justify-self: start; margin-top: auto; font-size: .625rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; padding: 4px 8px; background: var(--paper-2); color: var(--muted); }
.badge--full { background: var(--ink); color: var(--bronze); }

/* --- grupy wyboru --- */
.group { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 10px; }
.group__legend { padding: 0; margin-bottom: 10px; font-size: .8125rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.group__current { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
.group__hint { font-size: .8125rem; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px;
  border: 1px solid rgba(20, 18, 16, .22); background: var(--paper); cursor: pointer; font-size: .875rem;
  transition: border-color .2s, background-color .2s, color .2s;
}
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip:hover { border-color: var(--ink); }
.chip:has(input:checked) { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip:has(input:focus-visible) { outline: 2px solid var(--bronze-deep); outline-offset: 2px; }
.chip.is-disabled { opacity: .4; cursor: not-allowed; }
.chip.is-disabled input { cursor: not-allowed; }
.chip__text { display: grid; }
.chip__desc { font-size: .75rem; opacity: .7; }
.chip__dot { width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); flex: none; }
.chips--cards .chip { align-items: flex-start; padding: 12px 14px; min-width: 150px; }

/* --- liczniki i wymiary --- */
.counter { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 16px; }
.counter__label { font-size: .875rem; font-weight: 600; }
.counter__ctrl { display: inline-flex; align-items: center; border: 1px solid rgba(20, 18, 16, .22); background: var(--paper); }
.counter__btn {
  width: 44px; height: 44px; display: grid; place-items: center; background: transparent; border: 0;
  font-size: 1.25rem; line-height: 1; color: var(--ink); transition: background-color .2s;
}
.counter__btn:hover:not(:disabled) { background: var(--paper-2); }
.counter__btn:disabled { opacity: .3; cursor: not-allowed; }
.counter__value { min-width: 40px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.counter__note { grid-column: 1 / -1; font-size: .75rem; color: var(--muted); margin-top: -2px; }

.dims { display: grid; gap: 18px; }
.dim { display: grid; gap: 6px; }
.dim__label { font-size: .875rem; font-weight: 600; }
.dim__ctrl { display: flex; align-items: stretch; border: 1px solid rgba(20, 18, 16, .28); background: var(--paper); max-width: 340px; }
.dim__ctrl:focus-within { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.dim__input { position: relative; flex: 1; display: flex; align-items: center; border-inline: 1px solid var(--line); }
.dim__input input {
  width: 100%; min-height: 48px; padding: 8px 44px 8px 14px; border: 0; background: transparent;
  font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield;
}
.dim__input input::-webkit-outer-spin-button, .dim__input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.dim__input input:focus { outline: none; }
.dim__input input[aria-invalid="true"] { color: var(--error); }
.dim__unit { position: absolute; right: 14px; font-size: .8125rem; color: var(--muted); pointer-events: none; }
.dim__hint { font-size: .75rem; color: var(--muted); }
.field-error { font-size: .8125rem; color: var(--error); font-weight: 500; }
.field-error:empty { display: none; }

/* --- segmenty --- */
.segs { display: grid; gap: 12px; }
.seg { border: 1px solid var(--line); background: var(--paper); padding: 16px; margin: 0; display: grid; gap: 16px; min-width: 0; }
.seg__title { font-family: var(--serif); font-size: 1.3rem; padding: 0 6px; margin-left: -6px; }
.seg__meta { font-family: var(--sans); font-size: .8125rem; color: var(--muted); }
.seg .group__legend { font-size: .75rem; margin-bottom: 6px; }

/* --- materiały --- */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.swatch { position: relative; display: grid; gap: 6px; cursor: pointer; font-size: .75rem; line-height: 1.3; }
.swatch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.swatch__sample { display: block; aspect-ratio: 1; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); transition: box-shadow .2s, transform .25s var(--ease); }
.swatch:hover .swatch__sample { transform: translateY(-2px); }
.swatch:has(input:checked) .swatch__sample { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }
.swatch:has(input:checked) .swatch__name { font-weight: 700; }
.swatch:has(input:focus-visible) .swatch__sample { outline: 2px solid var(--bronze-deep); outline-offset: 6px; }
.custom-color__row { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: end; }
.field { display: grid; gap: 6px; font-size: .875rem; font-weight: 600; min-width: 0; }
.field input[type="text"], .field input[type="tel"], .field input[type="email"], .field textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; font: inherit; font-weight: 400; font-size: 1rem;
  background: var(--paper); border: 1px solid rgba(20, 18, 16, .28); border-radius: 0;
}
.field textarea { resize: vertical; min-height: 110px; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); background: #fff; }
.field [aria-invalid="true"] { border-color: var(--error); }
.field--color input { width: 64px; height: 48px; padding: 2px; border: 1px solid rgba(20, 18, 16, .28); background: var(--paper); cursor: pointer; }

/* --- dodatki --- */
.checks { display: grid; gap: 10px; }
.check { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--ink); flex: none; }
.check:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: #fff; }
.check.is-disabled { opacity: .5; cursor: not-allowed; }
.check__text { display: grid; gap: 2px; }
.check__name { font-weight: 600; font-size: .9375rem; }
.check__desc { font-size: .8125rem; color: var(--muted); }

/* --- podsumowanie --- */
.summary-media { display: grid; gap: 12px; }
@media (min-width: 640px) { .summary-media { grid-template-columns: 1fr 1fr; } }
.summary-media figure { background: #fff; border: 1px solid var(--line); }
.summary-media img { width: 100%; height: auto; }
.summary-media figcaption { font-size: .75rem; color: var(--muted); padding: 8px 10px; border-top: 1px solid var(--line); }
.summary-media__drawing svg { display: block; width: 100%; height: auto; }
.summary { display: grid; gap: 0; border-top: 1px solid var(--ink); }
.summary__group { padding: 16px 0; border-bottom: 1px solid var(--line); }
.summary__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.summary__head h3 { font-family: var(--serif); font-weight: 400; font-size: 1.35rem; }
.summary dl { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 6px 16px; margin: 0; font-size: .875rem; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; overflow-wrap: anywhere; }
.warnings { margin: 0; padding: 14px 16px 14px 34px; background: var(--paper-2); font-size: .8125rem; display: grid; gap: 4px; list-style: disc; }
.price { padding: 18px 20px; background: var(--ink); color: var(--paper); display: grid; gap: 6px; }
.price__label { font-family: var(--serif); font-size: 1.6rem; line-height: 1.15; color: var(--bronze); }
.price__note { font-size: .8125rem; color: var(--muted-light); }
.fields { display: grid; gap: 16px; }
.summary-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.btn--outline { --fg: var(--ink); --bd: rgba(20, 18, 16, .4); }
.btn--outline:hover { --bd: var(--ink); --bg: #fff; }

.send { display: grid; gap: 16px; padding: clamp(18px, 3vw, 28px); background: var(--paper-2); border-top: 2px solid var(--ink); }
.send__title { font-family: var(--serif); font-weight: 400; font-size: 1.9rem; line-height: 1.1; }
.send__lead, .send__privacy { font-size: .875rem; color: var(--muted); }
.send__privacy { font-size: .75rem; }
.send__grid { display: grid; gap: 14px; }
@media (min-width: 640px) { .send__grid { grid-template-columns: 1fr 1fr; } .send__grid .field:first-child { grid-column: 1 / -1; } }
.send__status:empty { display: none; }
.send__status { padding: 16px; font-size: .9375rem; outline: none; }
.send__status.is-error { background: #f5e6e1; border-left: 2px solid var(--error); }
.send__fallback { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.sent { padding: 24px; background: #e8efe6; border-left: 3px solid var(--ok); display: grid; gap: 10px; outline: none; }
.sent h3 { font-family: var(--serif); font-weight: 400; font-size: 1.8rem; line-height: 1.1; }

/* --- podgląd --- */
.preview { background: #fbf8f3; border: 1px solid var(--line); }
.preview__tabs { display: flex; border-bottom: 1px solid var(--line); }
.preview__tab {
  flex: 1; min-height: 46px; background: transparent; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  font-size: .8125rem; font-weight: 600; letter-spacing: .04em; color: var(--muted); cursor: pointer;
}
.preview__tab[aria-selected="true"] { color: var(--ink); border-color: var(--ink); }
.preview__tab:focus-visible { outline-offset: -3px; }
.preview__stage { position: relative; height: clamp(300px, 46vh, 420px); background: #ece5da; }
@media (min-width: 1024px) { .preview__stage { height: calc(100vh - var(--header-h) - 300px); min-height: 380px; max-height: 640px; } }
.preview__canvas, .preview__drawing { position: absolute; inset: 0; }
.preview__canvas { touch-action: none; cursor: grab; }
.preview__canvas:active { cursor: grabbing; }
.preview__canvas canvas { display: block; width: 100% !important; height: 100% !important; }
.preview__drawing[hidden], .preview__canvas[hidden] { display: none !important; }
.preview__drawing { background: #fff; display: grid; place-items: center; padding: 12px; overflow: auto; }
.preview__drawing svg { width: 100%; height: 100%; max-height: 100%; }
.preview__empty { position: absolute; inset: 0; display: none; place-items: center; text-align: center; padding: 24px; color: var(--muted); font-size: .9375rem; }
.cfg__preview.is-empty .preview__empty { display: grid; }
.cfg__preview.is-empty .preview__canvas, .cfg__preview.is-empty .preview__drawing, .cfg__preview.is-empty .preview__tools { visibility: hidden; }
.preview__tools { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 6px; }
.tool {
  min-height: 38px; padding: 6px 12px; background: rgba(251, 248, 243, .92); border: 1px solid var(--line);
  font-size: .75rem; font-weight: 600; cursor: pointer; backdrop-filter: blur(4px);
}
.tool:hover { border-color: var(--ink); }
.tool[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.preview__hint { font-size: .75rem; color: var(--muted); padding: 8px 12px; border-top: 1px solid var(--line); }
.preview__drawing:not([hidden]) ~ .preview__tools { display: none; }

.mini { margin-top: 12px; padding: 16px 18px; background: var(--ink); color: var(--paper); display: grid; gap: 10px; }
.mini__title { font-family: var(--serif); font-size: 1.4rem; line-height: 1.1; }
.mini__title span { color: var(--muted-light); }
.mini__list { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; font-size: .8125rem; }
.mini__list dt { color: var(--muted-light); }
.mini__list dd { margin: 0; }
.mini__price { color: var(--bronze); font-weight: 600; font-size: .875rem; border-top: 1px solid var(--line-light); padding-top: 10px; }
.mini__warn { font-size: .8125rem; color: #f0b8a4; }
.mini__empty { color: var(--muted-light); font-size: .875rem; }
@media (max-width: 1023px) { .mini { display: none; } }

/* --- dolny pasek --- */
.cfg__bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: rgba(251, 248, 243, .96); border-top: 1px solid var(--line); backdrop-filter: blur(8px); padding-bottom: env(safe-area-inset-bottom); }
.cfg__bar-inner { display: flex; align-items: center; gap: 12px; min-height: 68px; }
.cfg__bar-status { flex: 1; text-align: center; font-size: .8125rem; font-weight: 600; color: var(--muted); }
.cfg__bar [hidden] { display: none; }
.cfg__bar-preview { display: none; background: none; border: 1px solid var(--line); min-height: 40px; padding: 6px 12px; font-size: .75rem; font-weight: 600; cursor: pointer; }
@media (max-width: 1023px) { .cfg__bar-preview { display: inline-block; } }
@media (max-width: 560px) {
  .cfg__bar-inner { gap: 8px; }
  .cfg__bar-status { font-size: .75rem; text-align: left; }
  .cfg__bar .btn--sm { padding: 8px 12px; letter-spacing: .06em; }
}
.page-cfg .site-footer { padding-top: 0; padding-bottom: 72px; }

.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* --- arkusz do druku / PDF --- */
.print-sheet { display: none; }
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; }
  .site-header, .cfg, .site-footer, .skip-link, noscript { display: none !important; }
  .print-sheet { display: block !important; color: #111; font-size: 10pt; }
  .ps__head { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid #111; padding-bottom: 8px; }
  .ps__brand { font-weight: 700; letter-spacing: .2em; }
  .ps__date { margin-left: auto; }
  .print-sheet h1 { font-family: var(--serif); font-weight: 400; font-size: 22pt; margin: 12px 0; }
  .ps__media { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; break-inside: avoid; }
  .ps__media img, .ps__drawing svg { width: 100%; height: auto; border: 1px solid #ccc; }
  .ps__groups { columns: 2; column-gap: 18px; margin-top: 12px; }
  .ps__groups section { break-inside: avoid; margin-bottom: 10px; }
  .ps__groups h2 { font-size: 11pt; margin: 0 0 4px; border-bottom: 1px solid #999; }
  .ps__groups dl { display: grid; grid-template-columns: 40% 1fr; gap: 2px 8px; margin: 0; }
  .ps__groups dt { color: #555; }
  .ps__groups dd { margin: 0; }
  .ps__price { font-weight: 700; margin-top: 10px; }
  .ps__note { font-size: 8pt; color: #555; margin-top: 8px; }
}
