/* =========================================================
   Formularz zamówienia eHandel365 — tokeny z landingu eHandel/mHandel
   ========================================================= */
:root {
  --ink: #141821;
  --ink-2: #515b6b;
  --muted: #6e7888;
  --divider: #e2e5eb;
  --pill: #eef0f4;
  --brand: #00dd00;
  --brand-ink: #0b2e18;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  --green-100: #dcfce7;
  --green-50: #f0fdf4;
  --surface: #ffffff;
  --bg-1: #fcfdfc;
  --bg-2: #f6f9f5;
  --bg-3: #edf3ec;
  --danger: #c0392b;
  --danger-bg: #fdeceb;
  --amber-bg: #fdf7e7;
  --amber-ink: #8a5a00;
  --shadow-card: 0 8px 10px rgba(20, 50, 30, .07);
  --shadow-float: 0 24px 48px -16px rgba(20, 50, 30, .22);
  --r-card: 24px;
  --r-md: 16px;
  --r-sm: 12px;
  --r-pill: 999px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Quicksand', 'Inter', system-ui, sans-serif;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-soft: cubic-bezier(.4, 0, .2, 1);
  --container: 1240px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 28px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 45%, var(--bg-3) 100%);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 700; letter-spacing: -.01em; line-height: 1.14; }
p { margin: 0; }
ul, ol, dl { margin: 0; padding: 0; list-style: none; }
dt, dd { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.is-hidden { display: none !important; }
:focus-visible { outline: 3px solid rgba(22, 163, 74, .45); outline-offset: 2px; border-radius: 6px; }

.container { width: min(var(--container), 100% - 48px); margin-inline: auto; }
@media (max-width: 640px) { .container { width: calc(100% - 32px); } }

/* ---------- background blobs ---------- */
.bg-blobs { position: fixed; inset: 0; pointer-events: none; z-index: -1; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .5; }
.blob-a { width: 720px; height: 720px; left: -240px; top: -200px; background: radial-gradient(circle, rgba(0,221,0,.18), transparent 70%); animation: drift 22s var(--ease-soft) infinite alternate; }
.blob-b { width: 640px; height: 640px; right: -260px; top: 40vh; background: radial-gradient(circle, rgba(21,128,61,.16), transparent 70%); animation: drift 28s var(--ease-soft) infinite alternate-reverse; }
@keyframes drift { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(60px, 80px, 0) scale(1.08); } }

/* ---------- pills / buttons ---------- */
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600; line-height: 1.4; background: var(--pill); color: var(--ink-2); }
.pill-green { background: var(--green-100); color: var(--green-700); }
.pill-outline-green { background: rgba(0,221,0,.12); color: var(--green-700); border: 1px solid rgba(0,221,0,.35); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 22px; border-radius: var(--r-pill); font-weight: 600; font-size: 15px; line-height: 1.2; border: 1px solid transparent; cursor: pointer; transition: transform .35s var(--ease-out), box-shadow .35s var(--ease-out), background-color .25s, color .25s, border-color .25s; will-change: transform; }
.btn svg { width: 18px; height: 18px; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.98); transition-duration: .1s; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-lg { padding: 16px 28px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); color: var(--brand-ink); box-shadow: 0 8px 20px -8px rgba(0,221,0,.6); }
.btn-primary:hover { background: #1ae61a; box-shadow: 0 14px 28px -10px rgba(0,221,0,.7); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #1f2531; box-shadow: 0 14px 28px -12px rgba(20,24,33,.5); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--divider); box-shadow: var(--shadow-card); }
.btn-ghost:hover { border-color: #cfd5de; }

.eyebrow { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--green-700); margin-bottom: 16px; }

/* ---------- nav ---------- */
.nav { position: static; z-index: 50; padding: 18px 0 6px; }
.nav-inner { width: min(var(--container), 100% - 48px); margin-inline: auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 10px 12px 10px 16px; border-radius: var(--r-pill); background: rgba(255,255,255,.72); border: 1px solid rgba(255,255,255,.7); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4); box-shadow: 0 1px 0 rgba(20,50,30,.04); transition: box-shadow .4s var(--ease-out), background-color .4s; }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-logo { width: 164px; height: 41.8px; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.brand-text small { font-size: 11px; color: var(--muted); font-weight: 500; }
.nav-links { display: flex; gap: 4px; }
.nav-links a { padding: 8px 14px; border-radius: var(--r-pill); font-size: 14px; font-weight: 500; color: var(--ink-2); transition: background-color .25s, color .25s; }
.nav-links a:hover, .nav-links a.is-active { background: var(--green-50); color: var(--green-700); }
.nav-cta { display: flex; gap: 8px; }
.nav-cta .btn { padding: 10px 18px; font-size: 14px; }
.nav-burger { display: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--divider); background: #fff; position: relative; cursor: pointer; }
.nav-burger span { position: absolute; left: 13px; right: 13px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .35s var(--ease-out), top .35s var(--ease-out); }
.nav-burger span:first-child { top: 17px; } .nav-burger span:last-child { top: 25px; }
.nav-burger[aria-expanded="true"] span:first-child { top: 21px; transform: rotate(45deg); }
.nav-burger[aria-expanded="true"] span:last-child { top: 21px; transform: rotate(-45deg); }
.nav-mobile { display: none; width: min(var(--container), 100% - 48px); margin: 10px auto 0; padding: 12px; border-radius: var(--r-card); background: rgba(255,255,255,.96); backdrop-filter: blur(16px); box-shadow: var(--shadow-float); flex-direction: column; gap: 4px; transform-origin: top; transform: translateY(-8px) scale(.98); opacity: 0; pointer-events: none; transition: transform .35s var(--ease-out), opacity .3s; }
.nav-mobile a { padding: 12px 16px; border-radius: 14px; font-weight: 600; }
.nav-mobile a:hover { background: var(--green-50); }
.nav-mobile.is-open { transform: none; opacity: 1; pointer-events: auto; }
@media (max-width: 1080px) { .nav-links, .nav-cta { display: none; } .nav-burger { display: block; } .nav-mobile { display: flex; } }
@media (max-width: 640px) { .nav-inner, .nav-mobile { width: calc(100% - 32px); } }

/* ---------- page head ---------- */
.page-head { padding: 26px 0 40px; }
.page-head h1 { font-size: clamp(32px, 4.6vw, 56px); margin: 18px 0 18px; }
.page-head .accent-line { color: var(--green-700); }
.page-head .accent { position: relative; white-space: nowrap; }
.page-head .accent::after { content: ''; position: absolute; left: .02em; right: .02em; bottom: .18em; height: .14em; background: var(--brand); border-radius: 4px; opacity: .45; z-index: -1; }
.lead { font-size: clamp(16px, 1.25vw, 19px); color: var(--ink-2); max-width: 680px; }
.head-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 26px; font-size: 14px; color: var(--ink-2); }
.head-meta b { font-family: var(--font-display); color: var(--ink); }
.head-meta i { width: 4px; height: 4px; border-radius: 50%; background: var(--divider); }

/* ---------- progress ---------- */
.progress-bar { position: sticky; top: 0; z-index: 40; height: 3px; width: min(var(--container), 100% - 48px); margin: 0 auto 20px; border-radius: 3px; background: rgba(20,50,30,.08); overflow: hidden; }
.progress-bar i { display: block; height: 100%; width: 0%; border-radius: 3px; background: linear-gradient(90deg, var(--green-500), var(--brand)); transition: width .5s var(--ease-out); }
@media (max-width: 640px) { .progress-bar { width: calc(100% - 32px); } }

/* ---------- layout ---------- */
.section { padding: 8px 0 80px; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; align-items: start; }
.form-col { display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 1080px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--divider); border-radius: var(--r-card); padding: 28px; box-shadow: var(--shadow-card); scroll-margin-top: 24px; transition: border-color .3s, box-shadow .3s; }
.card:focus-within { border-color: rgba(22,163,74,.35); box-shadow: var(--shadow-float); }
.card-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 24px; }
.card-num { flex: none; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--green-100); color: var(--green-700); font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.card-head h2 { font-size: 21px; }
.card-head p { margin-top: 4px; font-size: 14px; color: var(--ink-2); }
@media (max-width: 640px) { .card { padding: 22px 18px; } }

/* ---------- fields ---------- */
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field.col-2 { grid-column: span 2; }
@media (max-width: 640px) { .fields { grid-template-columns: minmax(0, 1fr); } .field.col-2 { grid-column: span 1; } }
.field label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.field label em { color: var(--green-600); font-style: normal; }
.field input, .field select, .field textarea {
  width: 100%; padding: 13px 16px; border-radius: var(--r-sm); border: 1px solid var(--divider);
  background: var(--bg-1); outline: none; transition: border-color .25s, background-color .25s, box-shadow .25s;
}
.field textarea { resize: vertical; min-height: 88px; line-height: 1.5; }
.field select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e7888' stroke-width='2' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; padding-right: 38px; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: #cfd5de; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green-500); background: #fff; box-shadow: 0 0 0 4px rgba(34,197,94,.12); }
.field input::placeholder, .field textarea::placeholder { color: #a6aeba; }
.field.is-invalid input, .field.is-invalid select, .field.is-invalid textarea { border-color: var(--danger); background: var(--danger-bg); }
.err { display: none; font-size: 12.5px; color: var(--danger); font-weight: 500; }
.field.is-invalid .err { display: block; }
.err-block.is-shown { display: block; margin-top: 10px; }

/* ---------- subcard (dostawca) ---------- */
.subcard { margin-top: 22px; padding: 18px 20px; border-radius: var(--r-md); background: var(--green-50); border: 1px solid rgba(22,163,74,.16); }
.subcard-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.subcard-head small { font-size: 12.5px; color: var(--muted); }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; font-size: 14px; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px dashed rgba(22,163,74,.18); }
.kv dt { color: var(--ink-2); }
.kv dd { font-weight: 600; text-align: right; }
.fields-supplier { margin-top: 16px; padding-top: 16px; border-top: 1px dashed rgba(22,163,74,.22); }
.fields-supplier input { background: #fff; }
@media (max-width: 720px) { .kv { grid-template-columns: minmax(0, 1fr); } }

/* ---------- checkbox / radio ---------- */
.check { display: flex; gap: 12px; align-items: flex-start; margin-top: 14px; font-size: 14.5px; color: var(--ink-2); cursor: pointer; line-height: 1.5; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check .box { flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 7px; border: 2px solid var(--divider); background: #fff; display: grid; place-items: center; transition: background-color .22s, border-color .22s, transform .22s var(--ease-out); }
.check .box::after { content: ''; width: 11px; height: 6px; border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff; transform: rotate(-45deg) scale(.4); opacity: 0; transition: transform .22s var(--ease-out), opacity .18s; }
.check input:checked + .box { background: var(--green-600); border-color: var(--green-600); }
.check input:checked + .box::after { transform: rotate(-45deg) scale(1); opacity: 1; }
.check input:focus-visible + .box { box-shadow: 0 0 0 4px rgba(34,197,94,.25); }
.check:hover .box { border-color: var(--green-500); }
.check a { color: var(--green-700); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.check em { color: var(--green-600); font-style: normal; }
.check.is-invalid .box { border-color: var(--danger); background: var(--danger-bg); }
.check-inline { margin: 0 0 18px; padding: 12px 14px; border-radius: var(--r-md); background: var(--bg-2); border: 1px dashed var(--divider); }

.radio-set { border: 0; padding: 0; margin: 0 0 4px; }
.radio-set legend { padding: 0; font-size: 13.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 12px; }
.radios { display: flex; flex-wrap: wrap; gap: 10px; }
.radios-col { flex-direction: column; }
.radio { display: inline-flex; align-items: center; gap: 10px; padding: 11px 18px 11px 14px; border-radius: var(--r-pill); border: 1px solid var(--divider); background: var(--bg-1); font-size: 14.5px; cursor: pointer; transition: border-color .25s, background-color .25s, box-shadow .25s; }
.radios-col .radio { border-radius: var(--r-md); }
.radio input { position: absolute; opacity: 0; width: 0; height: 0; }
.radio .dot { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--divider); background: #fff; display: grid; place-items: center; transition: border-color .22s; }
.radio .dot::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--green-600); transform: scale(0); transition: transform .22s var(--ease-out); }
.radio input:checked + .dot { border-color: var(--green-600); }
.radio input:checked + .dot::after { transform: scale(1); }
.radio:has(input:checked) { border-color: var(--green-500); background: var(--green-50); box-shadow: 0 0 0 3px rgba(34,197,94,.1); }
.radio input:focus-visible + .dot { box-shadow: 0 0 0 4px rgba(34,197,94,.25); }

/* ---------- note ---------- */
.note { padding: 16px 18px; border-radius: var(--r-md); background: var(--amber-bg); color: var(--amber-ink); font-size: 14px; display: grid; gap: 10px; margin-bottom: 6px; }
.note b { font-weight: 700; }

/* ---------- licznik ilości (wspólny: pozycje zamówienia i kreator) ---------- */
.qty { display: inline-flex; align-items: center; border: 1px solid var(--divider); border-radius: var(--r-pill); background: #fff; overflow: hidden; }
.qty button { width: 36px; height: 38px; border: 0; background: transparent; cursor: pointer; color: var(--ink-2); font-size: 18px; line-height: 1; transition: background-color .2s, color .2s; }
.qty button:hover { background: var(--green-50); color: var(--green-700); }
.qty input { width: 52px; height: 38px; border: 0; text-align: center; font-weight: 700; background: transparent; outline: none; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* w pozycji zamówienia licznik rozciąga się na szerokość pola */
.f-seats .qty { display: flex; }
.f-seats .qty input { flex: 1 1 auto; width: auto; }

/* ---------- product rows ---------- */
.card-wide { overflow: visible; }
.rows { display: flex; flex-direction: column; gap: 14px; }
.row { position: relative; border: 1px solid var(--divider); border-radius: var(--r-md); padding: 18px 18px 16px; background: var(--bg-1); transition: border-color .25s, box-shadow .25s; }
.row:hover { border-color: #cfd5de; }
.row:focus-within { border-color: rgba(22,163,74,.4); box-shadow: 0 0 0 4px rgba(34,197,94,.08); }
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.row-badge { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--green-700); }
.row-del { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--divider); background: #fff; display: grid; place-items: center; cursor: pointer; color: var(--muted); transition: color .25s, border-color .25s, background-color .25s; }
.row-del svg { width: 16px; height: 16px; }
.row-del:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }
.row-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; }
.row-grid .field { grid-column: span 3; }
.row-grid .f-name { grid-column: span 6; }
.row-grid .f-sale, .row-grid .f-lic { grid-column: span 3; }
.row-grid .f-seats { grid-column: span 3; }
.row-grid .f-price { grid-column: span 4; }
.row-grid .f-sum { grid-column: span 5; }
@media (max-width: 860px) { .row-grid .field, .row-grid .f-name, .row-grid .f-sale, .row-grid .f-lic, .row-grid .f-seats, .row-grid .f-price, .row-grid .f-sum { grid-column: span 12; } }
.row-sum { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 16px; border-radius: var(--r-sm); background: var(--green-50); border: 1px solid rgba(22,163,74,.16); font-size: 14px; color: var(--ink-2); height: 100%; }
.row-sum b { font-family: var(--font-display); font-size: 19px; color: var(--green-700); }
.rows-actions { margin-top: 18px; }
.rows-empty { padding: 26px; border: 1px dashed var(--divider); border-radius: var(--r-md); text-align: center; color: var(--muted); font-size: 14.5px; }

/* ---------- summary ---------- */
.summary-col { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 1080px) { .summary-col { position: static; } }
.summary { border-radius: var(--r-card); padding: 24px; background: linear-gradient(135deg, var(--ink) 0%, var(--green-700) 100%); color: #fff; box-shadow: var(--shadow-float); }
.sum-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; opacity: .95; }
.sum-head .pill-outline-green { background: rgba(0,221,0,.16); color: #b8ffb8; border-color: rgba(0,221,0,.4); text-transform: none; letter-spacing: 0; }
.sum-total { display: flex; align-items: baseline; gap: 8px; margin: 14px 0 18px; }
.sum-total b { font-family: var(--font-display); font-size: 40px; line-height: 1; letter-spacing: -.02em; }
.sum-total small { font-size: 16px; opacity: .8; }
/* `minmax(0, 1fr)` pozwala ścieżce zejść poniżej szerokości tekstu —
   bez tego długa nazwa produktu rozpychała wiersz i ucinała kwotę. */
.sum-rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; font-size: 14px; padding-bottom: 16px; border-bottom: 1px solid rgba(255,255,255,.18); }
.sum-rows > div { display: flex; justify-content: space-between; gap: 14px; }
.sum-rows dt { flex: 1 1 auto; min-width: 0; opacity: .82; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sum-rows dd { flex: none; font-weight: 600; white-space: nowrap; }
.sum-empty dt, .sum-empty dd { opacity: .55; font-style: italic; }
.sum-foot { display: grid; gap: 8px; padding: 14px 0 18px; font-size: 14px; }
.sum-foot > div { display: flex; justify-content: space-between; gap: 12px; }
.sum-foot span { opacity: .82; }
.sum-foot .is-brutto { font-size: 16px; }
.sum-foot .is-brutto b { font-family: var(--font-display); font-size: 18px; }
.sum-note { margin-top: 12px; font-size: 12.5px; opacity: .72; line-height: 1.45; }

.checklist { background: var(--surface); border: 1px solid var(--divider); border-radius: var(--r-card); padding: 20px 22px; box-shadow: var(--shadow-card); font-size: 14px; }
.checklist b { display: block; font-family: var(--font-display); font-size: 15px; margin-bottom: 10px; }
.checklist ul { display: grid; gap: 7px; }
.checklist li { display: flex; gap: 9px; align-items: flex-start; color: var(--ink-2); }
.checklist li::before { content: ''; flex: none; width: 7px; height: 7px; margin-top: 8px; border-radius: 50%; background: #e3a008; }
.checklist li.ok { color: var(--green-700); font-weight: 600; }
.checklist li.ok::before { background: var(--green-500); }

/* ---------- form actions ---------- */
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.autosave { font-size: 13px; color: var(--muted); }

/* ---------- mobile bar ---------- */
.mobile-bar { display: none; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 45; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 12px 12px 20px; border-radius: var(--r-pill); background: rgba(255,255,255,.94); backdrop-filter: blur(16px); border: 1px solid var(--divider); box-shadow: var(--shadow-float); }
.mobile-bar small { display: block; font-size: 11.5px; color: var(--muted); }
.mobile-bar b { font-family: var(--font-display); font-size: 18px; }
@media (max-width: 1080px) { .mobile-bar { display: flex; } body { padding-bottom: 88px; } }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(12, 22, 16, .55); backdrop-filter: blur(4px); animation: fade .25s var(--ease-out); }
.modal-panel { position: relative; width: min(1000px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: var(--bg-2); border-radius: var(--r-card); box-shadow: var(--shadow-float); overflow: hidden; animation: pop .35s var(--ease-out); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.98); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; background: #fff; border-bottom: 1px solid var(--divider); }
.modal-head b { display: block; font-family: var(--font-display); font-size: 16px; }
.modal-head small { font-size: 12.5px; color: var(--muted); }
.modal-actions { display: flex; align-items: center; gap: 8px; }
.modal-actions .btn { padding: 10px 18px; font-size: 14px; }
.modal-x { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--divider); background: #fff; display: grid; place-items: center; cursor: pointer; transition: background-color .25s, border-color .25s; }
.modal-x svg { width: 18px; height: 18px; }
.modal-x:hover { background: var(--bg-2); border-color: #cfd5de; }
.modal-body { overflow: auto; padding: 24px; -webkit-overflow-scrolling: touch; }
@media (max-width: 640px) {
  .modal { padding: 0; }
  .modal-panel { max-height: 100vh; height: 100vh; border-radius: 0; width: 100%; }
  .modal-head { flex-wrap: wrap; }
  .modal-body { padding: 12px; }
}

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 24px); z-index: 100; padding: 13px 22px; border-radius: var(--r-pill); background: var(--ink); color: #fff; font-size: 14.5px; font-weight: 500; box-shadow: var(--shadow-float); opacity: 0; pointer-events: none; transition: opacity .3s, transform .35s var(--ease-out); max-width: calc(100% - 32px); text-align: center; }
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--danger); }

/* ---------- footer ---------- */
.footer { padding: 32px 0 40px; border-top: 1px solid var(--divider); background: rgba(255,255,255,.5); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; font-size: 13px; color: var(--muted); }
.footer nav { display: flex; gap: 18px; }
.footer nav a:hover { color: var(--green-700); }

/* =========================================================
   DOKUMENT (podgląd + PDF) — A4
   ========================================================= */
.doc { width: 800px; min-height: 1131px; margin: 0 auto; padding: 44px 52px 34px; background: #fff; color: #1a1d23; font-family: var(--font); font-size: 10.5px; line-height: 1.45; box-shadow: var(--shadow-card); border-radius: 4px; display: flex; flex-direction: column; }
.doc + .doc { margin-top: 20px; }
.doc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 14px; border-bottom: 2px solid var(--brand); }
.doc-head h1 { font-family: var(--font-display); font-size: 26px; color: var(--green-700); }
.doc-head p { font-size: 10px; color: #6e7888; margin-top: 4px; }
.doc-logo { display: flex; align-items: center; }
.doc-logo img { width: 168px; height: 42.9px; display: block; }
.doc-meta { display: flex; justify-content: space-between; font-size: 9px; color: #8b93a1; padding: 8px 0 14px; }
/* Bez `border-bottom` — linia biegła na wysokości znaków i wyglądała jak
   przekreślenie nagłówka. Sekcje rozdziela teraz odstęp, nie kreska. */
.doc h2 { font-family: var(--font-display); font-size: 13.5px; margin: 19px 0 9px; color: #141821; letter-spacing: -.01em; }
.doc h2:first-of-type { margin-top: 12px; }
.doc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 32px; }
.doc-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 4px 0 5px; border-bottom: 1px dotted #eceff3; }
.doc-row span { flex: 0 1 auto; }
.doc-row b { flex: 0 0 auto; }
.doc-row span { color: #6e7888; }
.doc-row b { font-weight: 600; text-align: right; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 9.5px; margin-top: 8px; }
/* Pełna siatka odstawała od reszty dokumentu — zostaje linia pod nagłówkiem
   i włosowe separatory wierszy. */
.doc-table th { background: transparent; color: #6e7888; font-weight: 600; font-size: 8px; letter-spacing: .08em; text-transform: uppercase; padding: 0 9px 7px; text-align: left; border: 0; border-bottom: 1.5px solid var(--green-500); white-space: nowrap; }
.doc-table td { padding: 6.5px 9px; border: 0; border-bottom: 1px solid #eef0f3; vertical-align: top; }
.doc-table tbody tr:last-child td { border-bottom: 0; }
.doc-table td:first-child { font-weight: 600; color: #141821; }
.doc-table th:first-child, .doc-table td:first-child { padding-left: 0; }
.doc-table th:last-child, .doc-table td:last-child { padding-right: 0; }
.doc-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-total { display: flex; justify-content: flex-end; gap: 28px; margin-top: 10px; font-size: 11px; }
.doc-total div { text-align: right; }
.doc-total span { display: block; color: #6e7888; font-size: 9px; }
.doc-total b { font-family: var(--font-display); font-size: 15px; color: var(--green-700); }
.doc-consents { display: grid; gap: 6px; margin-top: 6px; }
.doc-consent { display: flex; gap: 9px; align-items: flex-start; line-height: 1.5; }
/* Ptaszek rysowany geometrią, nie znakiem ✓ — glif rasteryzuje się niechlujnie. */
/* Ptaszek rysowany geometrią, nie znakiem ✓ — glif rasteryzuje się niechlujnie. */
.doc-mark { position: relative; flex: none; width: 11px; height: 11px; margin-top: 3px; border: 1px solid #8b93a1; border-radius: 2px; background: #fff; }

/* html2canvas sadza tekst niżej, niż wynika z DOM, więc na scenie PDF-a
   znacznik dostaje korektę. Podgląd i wydruk (zwykły DOM) zostają bez niej. */
#pdfStage .doc-mark { margin-top: 10px; }
.doc-mark.is-on { background: var(--green-700); border-color: var(--green-700); }
.doc-mark.is-on::after { content: ''; position: absolute; left: 3px; top: 1px; width: 3px; height: 6px; border-right: 1.6px solid #fff; border-bottom: 1.6px solid #fff; transform: rotate(45deg); }
.doc-legal { font-size: 8.5px; color: #6e7888; line-height: 1.5; margin-top: 6px; display: grid; gap: 5px; }
/* podpisy zjeżdżają w dół kartki razem ze stopką, zamiast wisieć w połowie */
.doc-sign { display: flex; justify-content: space-between; gap: 40px; margin-top: auto; padding-top: 40px; }
.doc-sign div { flex: 1; text-align: center; }
.doc-sign i { display: block; border-top: 1px solid #8b93a1; margin-bottom: 6px; }
.doc-sign span { font-size: 8.5px; color: #6e7888; }
.doc-sign b { display: block; font-size: 11px; margin-bottom: 40px; font-family: var(--font-display); }
/* `margin-top: auto` zbiera całą wolną przestrzeń kartki, więc stopka siada
   przy dolnej krawędzi zamiast wisieć tuż pod ostatnim akapitem. */
.doc-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid #e2e5eb; font-size: 7.5px; color: #8b93a1; display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.doc-foot-page { white-space: nowrap; font-weight: 600; color: #6e7888; }
.doc-empty { color: #8b93a1; font-style: italic; padding: 6px 0; }

/* pasek z kwotą zamykający stronę (zamówienie i okładka oferty) */
.doc-spacer { flex: 1 1 auto; min-height: 18px; }
.doc-hero-total { flex: none; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 18px 20px; border-radius: 12px; background: linear-gradient(135deg, #141821 0%, #15803d 100%); color: #fff; }
.doc-hero-total span { display: block; font-size: 10px; opacity: .8; }
.doc-hero-total b { display: block; font-family: var(--font-display); font-size: 26px; line-height: 1.15; }
.doc-hero-total small { display: block; font-size: 10px; opacity: .8; margin-top: 2px; }


@media (max-width: 900px) {
  .modal-body { display: flex; justify-content: flex-start; }
  #docWrap { transform-origin: top left; }
}

/* ---------- pdf stage (off-screen render target) ---------- */
/* Scena renderowania do PDF. Siedzi w normalnym przepływie (absolute, bez
   przycinającego rodzica) — html2canvas musi widzieć pełną wysokość. Na czas
   generowania zasłania ją overlay #pdfCurtain. */
#pdfStage { position: absolute; left: 0; top: 0; width: 800px; z-index: 1; opacity: 0; pointer-events: none; }
#pdfStage.is-rendering { opacity: 1; }

/* Kurtyna na czas generowania PDF */
.curtain { position: fixed; inset: 0; z-index: 200; display: none; place-items: center; background: rgba(252, 253, 252, .96); backdrop-filter: blur(6px); }
.curtain.is-shown { display: grid; }
.curtain-box { display: grid; justify-items: center; gap: 14px; text-align: center; padding: 32px 40px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--divider); box-shadow: var(--shadow-float); }
.curtain-box b { font-family: var(--font-display); font-size: 17px; }
.curtain-box small { font-size: 13.5px; color: var(--muted); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--green-100); border-top-color: var(--green-600); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- print ---------- */
@media print {
  .nav, .page-head, .progress-bar, .section, .footer, .mobile-bar, .bg-blobs, .toast, .modal-head, .modal-backdrop { display: none !important; }
  body { background: #fff; padding: 0; }
  .modal { position: static; padding: 0; display: block; }
  .modal[hidden] { display: none !important; }
  .modal-panel { box-shadow: none; border-radius: 0; max-height: none; height: auto; background: #fff; }
  .modal-body { overflow: visible; padding: 0; }
  /* Bez wymuszonej wysokości kartka kończy się na treści i reszta arkusza
     zostaje pusta — stąd wcześniejsza dziura u dołu każdej strony. */
  .doc { box-shadow: none; border-radius: 0; margin: 0; padding: 13mm 14mm 9mm; width: 210mm; min-height: 288mm; page-break-after: always; display: flex; flex-direction: column; }
  .doc:last-child { page-break-after: auto; }
  /* podgląd skaluje dokument transformem pod szerokość modala — w druku
     to tylko psuje podział na kartki */
  #docWrap { transform: none !important; width: auto !important; height: auto !important; }
  @page { size: A4; margin: 0; }
}

/* ---------- pdf stage overrides ---------- */
/* wrapper renderowany do PDF — klon żyje poza #pdfStage, więc szerokość i style
   muszą siedzieć na klasie, inaczej klon rozciąga się na szerokość okna */
.doc-pages { width: 800px; margin: 0 auto; background: #fff; }
.doc-pages .doc { box-shadow: none; border-radius: 0; margin: 0; }
.doc-pages .doc + .doc { margin-top: 0; }

/* ---------- armed destructive button ---------- */
.btn.is-armed { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }

/* ---------- hint under price ---------- */
.hint { font-size: 12px; color: var(--muted); }

@media print { #pdfStage { display: none !important; } }
