/* Czcionki z własnego serwera (bez Google Fonts): szybciej i bez przekazywania adresu IP do Google.
   Inter i Great Vibes: licencja SIL Open Font License 1.1 (pliki w /fonts). */
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/fonts/inter-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,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: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/fonts/inter-latin.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+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Great Vibes"; font-style: normal; font-display: swap; font-weight: 400; src: url(/fonts/great-vibes-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,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: "Great Vibes"; font-style: normal; font-display: swap; font-weight: 400; src: url(/fonts/great-vibes-latin.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+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

/* ============================================================
   GENERATOR UMÓW - STYL
   Czysto i jasno, bo to narzędzie do podpisów i pieniędzy.
   Charakter dają detale: ledwo widoczne ikony DJ-skie w tle
   i zielona poświata na przyciskach, które prowadzą dalej.
   ============================================================ */
:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --sunken: #f1f0ed;
  --ink: #111111;
  --ink-2: #4d4d4d;
  --ink-3: #8a8a87;
  --line: #e7e6e2;
  --line-2: #d3d2cd;
  --ok: #1d7f49;
  --ok-bg: #edf7f1;
  --warn: #b26b00;
  --warn-bg: #fdf6e8;
  --bad: #c0362c;
  --bad-bg: #fcefee;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --go: #16a34a;
  /* Rodzaje umów: kolory tylko w aplikacji, nigdy w PDF */
  --cat-wesele: #be185d; --cat-wesele-bg: #fdf2f8;
  --cat-prywatna: #6d28d9; --cat-prywatna-bg: #f5f3ff;
  --cat-firma: #1d4ed8; --cat-firma-bg: #eff6ff;
  --font-doc: Georgia, "Times New Roman", serif;
  --font-sig: "Great Vibes", cursive;
  --r: 8px;
  --r-lg: 12px;
  --shadow: 0 1px 2px rgba(17, 17, 17, 0.04), 0 4px 16px rgba(17, 17, 17, 0.06);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --pad-x: clamp(1rem, 3vw, 2rem);
  --bar-h: 60px;
  --steps-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
::selection { background: var(--ink); color: #fff; }

/* Pikselowy akcent: tylko duże nagłówki */
h1, h2 { font-family: var(--font-display); font-weight: 700; line-height: 1.08; letter-spacing: -0.03em; }
h3 { font-family: var(--font-ui); font-weight: 600; font-size: 1.05rem; line-height: 1.3; letter-spacing: -0.01em; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.88em; background: var(--sunken); padding: 0.05em 0.35em; border-radius: 4px; }
em { font-style: normal; color: var(--ink-3); font-weight: 400; }

.label { display: inline-block; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.hint { color: var(--ink-3); font-size: 0.85rem; line-height: 1.5; margin: 0.5rem 0 1rem; }
.hint.center { text-align: center; }
.lead { color: var(--ink-2); margin: 0.5rem 0 1.6rem; max-width: 60ch; }

/* ── Pasek górny ───────────────────────────────── */
.bar {
  position: sticky; top: 0; z-index: 50;
  height: var(--bar-h);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 var(--pad-x);
  background: rgba(250, 250, 249, 0.92);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.bar-logo { text-decoration: none; font-size: 0.85rem; color: var(--ink-3); white-space: nowrap; }
.bar-logo:hover { color: var(--ink); }
.bar-title { font-family: var(--font-display); font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; flex: 1; text-align: center; white-space: nowrap; line-height: 1; }
.bar-right { display: flex; gap: 0.5rem; }
.bar-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  min-height: 38px; padding: 0 0.85rem;
  border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface);
  font-size: 0.85rem; font-weight: 500; white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}
.bar-btn:hover { border-color: var(--ink); }
.count { display: inline-block; min-width: 1.4em; padding: 0 0.35em; border-radius: 99px; background: var(--ink); color: #fff; font-size: 0.75rem; text-align: center; line-height: 1.5; }
/* Klient nie potrzebuje paska narzędzia: widzi tylko umowę */
body:not([data-mode="edit"]) .bar { display: none; }
@media (max-width: 640px) {
  .bar-title { display: none; }
  .bar { justify-content: space-between; }
  .bar-btn { padding: 0 0.65rem; }
}

/* ── Przyciski ─────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 46px; padding: 0.65rem 1.15rem;
  border: 1px solid var(--line-2); border-radius: var(--r);
  font-size: 0.92rem; font-weight: 600; letter-spacing: -0.005em;
  text-decoration: none; white-space: nowrap;
  transition: background 0.15s var(--ease), border-color 0.15s, color 0.15s, transform 0.1s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #2b2b2b; }
.btn-ghost { background: var(--surface); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-big { width: 100%; min-height: 54px; font-size: 1rem; }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.arr { font-weight: 500; transition: transform 0.15s var(--ease); }
.btn:hover .arr { transform: translateX(2px); }
.mini {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.3rem;
  min-height: 34px; padding: 0.25rem 0.65rem;
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface);
  color: var(--ink-2); font-size: 0.8rem; font-weight: 500;
  transition: border-color 0.15s, color 0.15s;
}
.mini:hover { border-color: var(--ink-3); color: var(--ink); }
.mini.danger:hover { border-color: var(--bad); color: var(--bad); }
.link-btn { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; font-size: 0.88rem; padding: 0.5rem; }
.link-btn:hover { color: var(--ink); }
.file-mini { cursor: pointer; }

/* ── Kroki: cienki pasek postępu ───────────────── */
.steps {
  display: grid; grid-template-columns: repeat(4, 1fr);
  position: sticky; top: var(--bar-h); z-index: 40;
  height: var(--steps-h);
  background: rgba(250, 250, 249, 0.92);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 0 var(--pad-x);
}
.step {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 0.55rem;
  font-size: 0.88rem; font-weight: 500; color: var(--ink-3);
  transition: color 0.15s;
}
.step::after {
  content: ""; position: absolute; left: 10%; right: 10%; bottom: -1px; height: 2px;
  background: var(--ink); transform: scaleX(0); transition: transform 0.25s var(--ease);
}
.step span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--line-2); background: var(--surface);
  font-size: 0.75rem; font-weight: 600; color: var(--ink-3);
}
.step:hover { color: var(--ink); }
.step.is-active { color: var(--ink); }
.step.is-active::after { transform: scaleX(1); }
.step.is-active span { background: var(--ink); border-color: var(--ink); color: #fff; }
.step.is-done:not(.is-active) { color: var(--ink-2); }
.step.is-done:not(.is-active) span { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); font-size: 0; }
.step.is-done:not(.is-active) span::before { content: "✓"; font-size: 0.75rem; }
@media (max-width: 640px) {
  .steps { display: flex; }
  .step { flex: 1; font-size: 0; gap: 0; }
  .step.is-active { flex: 2.6; font-size: 0.85rem; gap: 0.45rem; white-space: nowrap; }
}

/* ── Układ kreatora ────────────────────────────── */
.edit-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) {
  .edit-grid { grid-template-columns: minmax(0, 580px) minmax(0, 1fr); }
}
.panel { padding: 2rem var(--pad-x) 2.5rem; min-width: 0; background: transparent; }
@media (min-width: 1100px) { .panel { border-right: 1px solid var(--line); } }
@media (max-width: 1099px) { .panel { padding-bottom: 6rem; max-width: 680px; margin: 0 auto; width: 100%; } }
.pane { display: none; }
.pane.is-active { display: block; animation: fadeIn 0.3s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.pane h2 { font-size: clamp(1.9rem, 4vw, 2.35rem); }
.pane h3 { margin: 2.2rem 0 0.25rem; }
.pane-nav { display: flex; justify-content: space-between; gap: 0.75rem; margin-top: 2.2rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.pane-nav .btn { flex: 1; }

/* ── Pola ──────────────────────────────────────── */
.fields { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.9rem 0.8rem; margin: 0.7rem 0; }
.f { display: flex; flex-direction: column; gap: 0.35rem; grid-column: span 3; min-width: 0; }
.f-wide { grid-column: span 6; }
.f-narrow { grid-column: span 2; }
.f > span { font-size: 0.82rem; font-weight: 500; color: var(--ink-2); display: flex; align-items: center; gap: 0.4rem; min-height: 28px; }

/* Kłódka: wartość „na stałe” */
.lock {
  margin-left: auto; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 28px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface);
  color: var(--ink-3); transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.15s;
}
.lock svg { width: 13px; height: 13px; }
.lock:active { transform: scale(0.92); }
.lock:hover { border-color: var(--ink-3); color: var(--ink); }
.lock[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.f.is-locked input, .f.is-locked select { background: var(--sunken); color: var(--ink-2); cursor: not-allowed; border-style: dashed; }
.f.is-locked input:hover, .f.is-locked select:hover { border-color: var(--line-2); }
.radio-row .lock { align-self: center; }
.radio-row.is-locked .radio { opacity: 0.6; cursor: not-allowed; }
.lock-tip { font-size: 0.85rem; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 0.7rem 0.9rem; margin: -0.6rem 0 1.2rem; }
.tpl-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0.8rem 1rem 0.1rem; margin: 0 0 1rem; }
.tpl-box .check { min-height: 32px; }
.tpl-box .hint { margin: 0.2rem 0 0.7rem 1.8rem; }
.reset-links { display: inline-flex; flex-wrap: wrap; gap: 0 0.4rem; }
@media (max-width: 520px) {
  .f { grid-column: span 6; }
  .f-narrow { grid-column: span 3; }
}
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%; min-height: 46px; padding: 0.6rem 0.8rem;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r);
  font-size: 16px; /* 16px = brak zoomu na iOS */
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08); }
input::placeholder, textarea::placeholder { color: #b0afab; }
input[readonly] { background: var(--sunken); color: var(--ink-2); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23111' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.85rem center;
}
textarea { resize: vertical; min-height: 64px; line-height: 1.55; font-family: var(--font-doc); font-size: 15.5px; }
.f.is-bad input, .f.is-bad select { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(192, 54, 44, 0.1); }

.check, .radio { display: inline-flex; align-items: center; gap: 0.6rem; cursor: pointer; min-height: 40px; font-size: 0.92rem; }
.check input, .radio input { width: 18px; height: 18px; accent-color: var(--ink); flex-shrink: 0; }
.radio-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 0; }
.radio-row .radio { border: 1px solid var(--line-2); border-radius: var(--r); padding: 0 0.9rem; background: var(--surface); transition: border-color 0.15s; }
.radio-row .radio:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

/* ── Krok 3: edytor ────────────────────────────── */
.skip-box {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 1.2rem 1.2rem 0.5rem; margin: 1.2rem 0 1.6rem; box-shadow: var(--shadow);
}
.skip-box p { margin-bottom: 0.9rem; }
.skip-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.skip-actions .btn { flex: 1 1 220px; }

.tok-bar {
  position: sticky; top: calc(var(--bar-h) + var(--steps-h)); z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem;
  margin: 1.2rem 0 1rem; padding: 0.6rem 0;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.tok-label { font-size: 0.82rem; font-weight: 500; color: var(--ink-2); }
.tok-bar select { flex: 1; min-width: 200px; min-height: 40px; }

.para-list { display: flex; flex-direction: column; gap: 0.9rem; }
.ed-para {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 1rem; transition: border-color 0.15s, box-shadow 0.15s;
}
.ed-para:focus-within { border-color: var(--line-2); box-shadow: var(--shadow); }
.para-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.7rem; }
.para-num { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; color: var(--ink-3); min-width: 2.2rem; line-height: 1; }
.para-head input { flex: 1; font-weight: 600; }
.para-tools { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.8rem; }
.para-tools .mini[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.para-lead { margin-bottom: 0.5rem; }
.pts { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.7rem; }
.pt { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto; gap: 0.4rem; align-items: start; }
.pt-n { color: var(--ink-3); font-size: 0.85rem; padding-top: 0.7rem; text-align: right; }
.pt-side { display: flex; flex-direction: column; gap: 0.25rem; }
.pt-side .mini { min-height: 30px; min-width: 32px; padding: 0.1rem 0.35rem; }
.pt-cond { grid-column: 2 / 3; font-size: 0.78rem; color: var(--warn); margin-top: -0.15rem; }
.pt-cond.is-off { color: var(--ink-3); }
.pt.is-off textarea { opacity: 0.55; }
.para-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; margin: 1.2rem 0; }
.annex-box { margin-top: 1.6rem; padding: 1rem 1.1rem; border: 1px dashed var(--line-2); border-radius: var(--r-lg); }
.annex-box .f { margin: 0.6rem 0; }

/* ── Krok 4 ────────────────────────────────────── */
.checklist { display: flex; flex-direction: column; gap: 0.45rem; margin: 1.2rem 0 1.4rem; }
.ck { display: flex; gap: 0.6rem; align-items: baseline; font-size: 0.92rem; }
.ck::before {
  content: "✓"; flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; transform: translateY(3px);
  background: var(--ok-bg); color: var(--ok); font-size: 0.72rem; font-weight: 700;
}
.ck.warn::before { content: "!"; background: var(--warn-bg); color: var(--warn); }
.ck.bad::before { content: "✕"; background: var(--bad-bg); color: var(--bad); }
.ck button { color: var(--ink-3); text-decoration: underline; text-underline-offset: 2px; font-size: 0.85rem; margin-left: 0.2rem; }
.ck button:hover { color: var(--ink); }
.review-btn { margin-top: 0.2rem; }
.review-link { display: block; margin: 0 auto 0.8rem; text-align: center; }
.send-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.2rem; box-shadow: var(--shadow); }
.code-line { margin: 1.1rem 0 0.6rem; font-size: 0.88rem; color: var(--ink-2); }
.code-line strong { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 1.05rem; font-weight: 600; color: var(--ink); letter-spacing: 0.04em; }
.link-field { margin-bottom: 0.8rem; font-size: 14px !important; color: var(--ink-2); background: var(--sunken) !important; }
.share, .file-btns { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.share .btn, .file-btns .btn { flex: 1 1 140px; }

/* ── Podgląd na żywo ───────────────────────────── */
.preview { background: var(--sunken); min-width: 0; }
.preview-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem var(--pad-x); border-bottom: 1px solid var(--line);
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3);
}
@media (min-width: 1100px) {
  .preview { position: sticky; top: calc(var(--bar-h) + var(--steps-h)); height: calc(100vh - var(--bar-h) - var(--steps-h)); overflow-y: auto; }
  .only-mobile { display: none !important; }
}
@media (max-width: 1099px) {
  .preview {
    position: fixed; inset: 0; z-index: 80; overflow-y: auto;
    transform: translateY(100%); transition: transform 0.35s var(--ease);
  }
  .preview.is-open { transform: none; }
  .preview-head { position: sticky; top: 0; background: var(--sunken); z-index: 1; }
}
.fab {
  position: fixed; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: 60;
  padding: 0 1.2rem; min-height: 48px; border-radius: 99px;
  background: var(--ink); color: #fff; font-size: 0.9rem; font-weight: 600;
  box-shadow: 0 6px 24px rgba(17, 17, 17, 0.25);
}
body:not([data-mode="edit"]) .fab { display: none; }

/* ── Dokument (kartka) ─────────────────────────── */
.paper-wrap { padding: clamp(0.8rem, 3vw, 2.2rem); }
.doc {
  max-width: 794px; margin: 0 auto;
  background: #fff; color: #111;
  padding: clamp(1.4rem, 5vw, 3.4rem);
  font-family: var(--font-doc); font-size: 15px; line-height: 1.6;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(17, 17, 17, 0.06), 0 12px 40px rgba(17, 17, 17, 0.08);
}
.doc h1 { font-family: var(--font-doc); text-transform: uppercase; font-size: 1.25rem; line-height: 1.3; letter-spacing: 0.04em; text-align: center; font-weight: 700; }
.doc-sub { text-align: center; color: #444; margin: 0.4rem 0 1.4rem; }
.parties { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.4rem; }
@media (max-width: 560px) { .parties { grid-template-columns: 1fr; } }
.party { border: 1px solid #d8d8d8; padding: 0.8rem 0.9rem; font-size: 0.88rem; line-height: 1.55; border-radius: 3px; }
.party .role { font-family: var(--font-ui); font-size: 0.66rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: #777; margin-bottom: 0.2rem; }
.party .pname { font-weight: 700; font-size: 1rem; }
.party .k { color: #777; }
.doc .para { margin-bottom: 1.1rem; }
.doc h2 { font-family: var(--font-doc); font-size: 1.02rem; font-weight: 700; line-height: 1.3; margin-bottom: 0.35rem; letter-spacing: 0; }
.doc ol, .doc ul { padding-left: 1.4rem; }
.doc li { margin-bottom: 0.25rem; }
.doc ol.sub { list-style: none; padding-left: 1.6rem; margin: 0.25rem 0 0.35rem; }
.doc ol.sub > li { position: relative; }
.doc ol.sub .sn { position: absolute; left: -1.6rem; }
.subs { grid-column: 2 / 4; display: flex; flex-direction: column; gap: 0.35rem; padding-left: 0.6rem; border-left: 2px solid var(--line); }
.sub-row { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto; gap: 0.4rem; align-items: start; }
.sub-row textarea { min-height: 46px; font-size: 14.5px; }
.sub-add { align-self: flex-start; padding: 0.15rem 0; font-size: 0.8rem; }
.consent { border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 1rem 1.1rem 1.1rem; margin: 1.4rem 0 0.6rem; }
.consent h3 { margin-bottom: 0.2rem; }
.consent .hint { margin: 0.2rem 0 0.6rem; }
.consent.is-bad { border-color: var(--bad); background: var(--bad-bg); }
.doc p { margin-bottom: 0.3rem; }
.doc .fill { font-weight: 700; }
.doc .blank { color: #999; letter-spacing: -0.05em; }
.doc.is-preview .fill { background: #fff3c4; box-shadow: 0 0 0 2px #fff3c4; border-radius: 2px; }
.doc.is-preview .blank { background: #ffe1e1; color: #c33; box-shadow: 0 0 0 2px #ffe1e1; border-radius: 2px; }
.doc .annex { border-top: 1px solid #ccc; padding-top: 1rem; margin-top: 1.4rem; }
.sigs { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-top: 2.2rem; }
.sig { text-align: center; }
.sig-img { height: 78px; display: flex; align-items: flex-end; justify-content: center; }
.sig-img img { max-height: 78px; max-width: 100%; }
.sig-line { border-bottom: 1px solid #111; margin: 0.2rem 0 0.35rem; }
.sig-name { font-size: 0.9rem; }
.sig-role { font-family: var(--font-ui); font-size: 0.66rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: #777; }
.doc-foot { margin-top: 1.8rem; padding-top: 0.7rem; border-top: 1px solid #ddd; font-family: var(--font-ui); font-size: 0.7rem; color: #777; text-align: center; }

/* Ukryta scena PDF: stała szerokość A4, ten sam układ na każdym telefonie */
#pdfStage { position: absolute; left: -10000px; top: 0; width: 794px; }
#pdfStage .doc { box-shadow: none; max-width: none; width: 794px; padding: 0; background: #fff; border-radius: 0; }
#pdfStage .pdf-block { background: #fff; padding: 0 2px; }
#pdfStage .parties { grid-template-columns: 1fr 1fr; }
#pdfStage .sigs { grid-template-columns: 1fr 1fr; }
#pdfStage .doc-foot { display: none; } /* stopka idzie na każdą stronę z jsPDF */

/* ── Podpis ────────────────────────────────────── */
.sig-tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; margin: 0.6rem 0; background: var(--sunken); border-radius: 10px; max-width: 100%; }
.sig-tab { min-height: 36px; padding: 0 0.85rem; border-radius: 7px; font-size: 0.85rem; font-weight: 500; color: var(--ink-2); transition: background 0.15s, color 0.15s, box-shadow 0.15s; }
.sig-tab:hover { color: var(--ink); }
.sig-tab.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(17, 17, 17, 0.12); }
.sig-box { margin: 0.5rem 0 1rem; }
.pad {
  position: relative; width: 100%; aspect-ratio: 3 / 1; min-height: 120px;
  background: #fff; border: 1px dashed var(--line-2); border-radius: var(--r-lg);
  touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none;
  transition: border-color 0.15s; /* bez overflow:hidden - długopis może wystawać poza ramkę */
}
.pad:hover { border-color: var(--ink-3); }
.pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pad::after {
  /* linia podpisu */
  content: ""; position: absolute; left: 8%; right: 8%; bottom: 24%;
  border-bottom: 1px solid #e3e2de; pointer-events: none;
}
.pad-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  color: #c4c3bf; font-family: var(--font-sig); font-size: clamp(1.7rem, 6vw, 2.6rem);
  pointer-events: none; transition: opacity 0.2s;
}
.pad-hint svg { width: 22px; height: 22px; flex-shrink: 0; opacity: 0.7; }
.pad.pen-ready .pad-hint svg { display: none; } /* przy myszce długopisem jest sam kursor */
.pad.has-ink .pad-hint { opacity: 0; }
.pad.is-bad { border-color: var(--bad); border-style: solid; }
.pad-btns { display: flex; gap: 0.4rem; justify-content: flex-end; margin-top: 0.5rem; }

/* Długopis zamiast kursora - tylko dla myszki; na dotyku zostaje ikona w podpowiedzi */
.pen {
  position: absolute; left: 0; top: 0; width: 30px; height: 30px; z-index: 2;
  pointer-events: none; opacity: 0;
  transition: opacity 0.22s ease;
  will-change: transform, opacity;
}
.pen svg { width: 100%; height: 100%; display: block; transition: transform 0.12s var(--ease); transform-origin: 2px 28px; }
.pad.pen-on .pen { opacity: 1; }
.pad.pen-down .pen svg { transform: rotate(-6deg) scale(0.94); }
@media (hover: hover) and (pointer: fine) {
  .pad.pen-ready { cursor: none; }
}
@media (prefers-reduced-motion: reduce) { .pen { transition: none; } }

.typed-sig {
  background: #fff; color: #0a0a0a; border: 1px solid var(--line-2); border-radius: var(--r-lg);
  font-family: var(--font-sig); font-size: clamp(2rem, 7vw, 3rem);
  aspect-ratio: 3 / 1; display: flex; align-items: center; justify-content: center;
  padding: 0 1rem; text-align: center; overflow: hidden; white-space: nowrap;
}

/* ── Widok klienta ─────────────────────────────── */
.sign-wrap { max-width: 860px; margin: 0 auto; padding: 1.6rem var(--pad-x) 6rem; }
.sign-intro { padding: 1rem 0 0.4rem; }
.sign-intro h1 { font-size: clamp(1.8rem, 6vw, 2.6rem); margin: 0.5rem 0 0.5rem; }
.sign-intro p { color: var(--ink-2); }
.sign-steps { display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; margin-top: 1rem; list-style: none; counter-reset: s; font-size: 0.88rem; color: var(--ink-2); }
.sign-steps li { counter-increment: s; display: flex; align-items: center; gap: 0.45rem; }
.sign-steps li::before { content: counter(s); display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 0.72rem; font-weight: 600; }
.view-sign .paper-wrap, .view-done .paper-wrap { padding-left: 0; padding-right: 0; }
.sign-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(1.1rem, 4vw, 2rem); margin-top: 1rem; box-shadow: var(--shadow); scroll-margin-top: 1rem; }
.sign-form h2 { font-size: 1.5rem; margin: 0.3rem 0 0.4rem; }
.sign-form h2 + .fields { margin-top: 0.4rem; }
.sign-form .fields + h2 { margin-top: 1.8rem; }
.sign-form .sig-box { margin-bottom: 1.4rem; }

/* Przyklejony pasek: klient zawsze wie, co ma zrobić dalej */
.sign-sticky {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  padding: 0.75rem var(--pad-x) calc(0.75rem + env(safe-area-inset-bottom));
  background: rgba(250, 250, 249, 0.94);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  transform: translateY(110%); transition: transform 0.3s var(--ease);
}
.sign-sticky.is-on { transform: none; }
.sign-sticky .btn { width: 100%; max-width: 560px; margin: 0 auto; display: flex; }

/* Akceptacja ze strzałką wskazującą checkbox */
.accept {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 0.75rem;
  padding: 1rem; margin: 0.4rem 0 1rem;
  border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--surface);
  cursor: pointer; position: relative;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.accept:hover { border-color: var(--ink-3); }
.accept input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.accept-box {
  width: 24px; height: 24px; border: 1.5px solid var(--ink); border-radius: 6px; background: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background 0.15s;
}
.accept input:focus-visible + .accept-box { outline: 2px solid var(--ink); outline-offset: 3px; }
.accept input:checked + .accept-box { background: var(--ink); }
.accept input:checked + .accept-box::after { content: ""; width: 6px; height: 12px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.accept-arrow { color: var(--warn); font-size: 1.05rem; line-height: 1; animation: nudge 0.9s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-6px); } }
.accept-text { font-size: 0.9rem; line-height: 1.5; color: var(--ink-2); }
.accept-text strong { color: var(--ink); }
.accept.is-checked { border-color: var(--ok); background: var(--ok-bg); }
.accept.is-checked .accept-arrow { visibility: hidden; animation: none; }
.accept.is-bad { border-color: var(--bad); background: var(--bad-bg); }
@media (prefers-reduced-motion: reduce) { .accept-arrow { animation: none; } }

.err { background: var(--bad-bg); color: var(--bad); border-radius: var(--r); padding: 0.75rem 0.95rem; margin-bottom: 1rem; font-size: 0.9rem; }

/* ── Po podpisie / zwrot ───────────────────────── */
.done-head { padding: 1rem 0 0.4rem; }
.done-head h1 { font-size: clamp(2rem, 6.5vw, 2.9rem); margin: 0.5rem 0; }
.done-head p { color: var(--ink-2); max-width: 60ch; }
.verify { display: flex; gap: 0.75rem; align-items: flex-start; margin: 1.1rem 0 0; padding: 0.85rem 1rem; border-radius: var(--r); background: var(--ok-bg); color: #18492d; font-size: 0.9rem; }
.verify.warn { background: var(--warn-bg); color: #6b4300; }
.verify.bad { background: var(--bad-bg); color: #7a221b; }
.verify b { font-weight: 700; font-size: 1rem; line-height: 1.4; }
.done-actions { display: flex; flex-direction: column; gap: 0.6rem; margin: 1.5rem 0 0.6rem; }
.done-actions .row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.done-actions .row .btn { flex: 1 1 160px; }
.done-actions h3 { margin-top: 1rem; }
.dj-late-sign { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.1rem; }

/* ── Komunikaty ────────────────────────────────── */
.view-msg { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem var(--pad-x); }
.msg-box { max-width: 520px; text-align: center; }
.msg-box h1 { font-size: 2.1rem; margin-bottom: 0.8rem; }
.msg-box p { color: var(--ink-2); margin-bottom: 1.4rem; }

/* ── Logowanie ─────────────────────────────────── */
.view-auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem var(--pad-x); }
.auth-box { width: 100%; max-width: 440px; }
.auth-box h1 { font-size: clamp(2rem, 7vw, 2.5rem); margin: 0.5rem 0 0.6rem; }
.auth-text { color: var(--ink-2); margin-bottom: 1.4rem; }
.auth-form { display: flex; flex-direction: column; gap: 0.9rem; }
.btn-google { display: inline-flex; align-items: center; justify-content: center; gap: 0.7rem; background: #fff; color: #1f1f1f; border: 1px solid #c7c7c7; font-weight: 600; }
.btn-google:hover { background: #f7f8f8; border-color: #9a9a9a; }
.btn-google:disabled { opacity: 0.6; }
.auth-or { display: flex; align-items: center; gap: 0.8rem; margin: 1.1rem 0; color: var(--ink-3); font-size: 0.85rem; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.auth-msg { margin-top: 1rem; padding: 0.85rem 1rem; border-radius: var(--r); background: var(--ok-bg); color: #18492d; font-size: 0.92rem; }
.auth-msg.bad { background: var(--bad-bg); color: #7a221b; }
.auth-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin: 0.4rem 0 0.8rem; }
.plan-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; text-align: left;
  padding: 1rem; border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.plan-btn:hover { border-color: var(--ink); box-shadow: var(--shadow); }
.plan-btn strong { font-family: var(--font-display); font-weight: 700; font-size: 1.45rem; line-height: 1.1; letter-spacing: -0.02em; }
.plan-btn span { font-size: 0.82rem; color: var(--ink-3); }
.plan-btn[disabled] { opacity: 0.55; cursor: progress; }
.plan-btn.plan-best { border: 2px solid var(--ink); }
@media (max-width: 380px) { .auth-plans { grid-template-columns: 1fr; } }
.auth-foot { margin-top: 1.6rem; padding-top: 1.2rem; border-top: 1px solid var(--line); font-size: 0.9rem; color: var(--ink-3); }
.auth-foot a { color: var(--ink); font-weight: 600; text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }
#authLogout { margin-top: 0.8rem; padding-left: 0; }
.acct { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin: 0.4rem 0 0.2rem; padding: 0.8rem 0.9rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); font-size: 0.85rem; }
.acct-who { display: flex; flex-direction: column; min-width: 0; }
.acct-who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-who span { color: var(--ink-3); font-size: 0.8rem; }
.acct-btns { display: flex; gap: 0.35rem; flex-wrap: wrap; }

/* ── Archiwum ──────────────────────────────────── */
.drawer { position: fixed; inset: 0; z-index: 100; }
.drawer-bg { position: absolute; inset: 0; background: rgba(17, 17, 17, 0.35); animation: fadeIn 0.2s; }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(600px, 100%);
  background: var(--bg); border-left: 1px solid var(--line);
  padding: 1.2rem var(--pad-x); overflow-y: auto;
  box-shadow: -12px 0 40px rgba(17, 17, 17, 0.12);
  animation: slideIn 0.3s var(--ease);
}
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.drawer-head h2 { font-size: 1.6rem; }
.drawer-tools { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.archive-list { display: flex; flex-direction: column; gap: 0.6rem; }
/* Moje umowy: wyszukiwarka, widoki, foldery */
.arc-bar { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem; margin: 0.4rem 0 0.7rem; }
@media (max-width: 520px) { .arc-bar { grid-template-columns: 1fr; } .arc-bar select { justify-self: start; min-height: 38px; font-size: 0.85rem; border-radius: 99px; } }
#acctBox { margin-top: 1rem; }
.arc-bar input, .arc-bar select { min-height: 44px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 0 0.8rem; font: inherit; font-size: 0.92rem; color: var(--ink); }
.arc-bar select { padding-right: 0.5rem; }
.arc-tabs, .arc-folders { display: flex; gap: 0.35rem; overflow-x: auto; padding-bottom: 0.3rem; margin-bottom: 0.5rem; scrollbar-width: none; }
.arc-tabs::-webkit-scrollbar, .arc-folders::-webkit-scrollbar { display: none; }
.arc-tab, .arc-chip { flex: none; min-height: 38px; padding: 0 0.85rem; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: 0.85rem; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.arc-tab[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.arc-tab .n { font-weight: 500; opacity: 0.7; margin-left: 0.25rem; }
.arc-chip { font-weight: 500; min-height: 34px; font-size: 0.82rem; }
.arc-chip[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); background: var(--sunken); }
.arc-chip.add { border-style: dashed; }
.folder-tools { display: flex; gap: 0.35rem; margin: -0.2rem 0 0.6rem; }
.arc-tag { display: inline-block; font-size: 0.72rem; color: var(--ink-2); background: var(--sunken); border-radius: 4px; padding: 0.05rem 0.4rem; margin-left: 0.35rem; }
.arc-more { position: relative; }
.arc-more > summary { list-style: none; cursor: pointer; }
.arc-more > summary::-webkit-details-marker { display: none; }
.arc-more[open] > summary { background: var(--sunken); }
.arc-menu { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.45rem; width: 100%; }
.arc-actions .arc-more[open] { flex-basis: 100%; }
.arc-annex { margin-top: 0.7rem; padding-top: 0.6rem; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 0.45rem; }
.arc-annex-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; font-size: 0.85rem; }
.arc-annex-row b { font-weight: 600; margin-right: auto; }
.arc-trash-note { font-size: 0.78rem; color: var(--ink-3); margin: -0.3rem 0 0.6rem; }
.folder-pick { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.4rem 1.2rem 0; }
.folder-pick button { min-height: 48px; text-align: left; padding: 0 1rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); font-weight: 600; }
.folder-pick button[aria-current="true"] { border-color: var(--ink); }
.folder-new { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem; padding: 0.8rem 1.2rem 0.6rem; }
.folder-new input { min-height: 48px; border: 1px solid var(--line); border-radius: var(--r); padding: 0 0.8rem; font: inherit; }
@media (max-width: 420px) { .folder-new { grid-template-columns: 1fr; } }
.arc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0.9rem; }
.arc-top { display: flex; justify-content: space-between; gap: 0.6rem; align-items: baseline; }
.arc-name { font-weight: 600; }
.arc-meta { color: var(--ink-3); font-size: 0.82rem; margin: 0.2rem 0 0.7rem; }
.badge { font-size: 0.72rem; font-weight: 600; padding: 0.15rem 0.55rem; border-radius: 99px; white-space: nowrap; }
.badge.sent { background: var(--warn-bg); color: var(--warn); }
.badge.signed { background: var(--ok-bg); color: var(--ok); }
.badge.draft { background: var(--sunken); color: var(--ink-3); }
.arc-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.empty { color: var(--ink-3); padding: 2rem 0; text-align: center; }

/* ── Podgląd pełnoekranowy ─────────────────────── */
.modal { position: fixed; inset: 0; z-index: 120; background: var(--sunken); overflow-y: auto; animation: fadeIn 0.2s var(--ease); }
.modal-panel { max-width: 900px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
.modal-head {
  position: sticky; top: 0; z-index: 2; background: rgba(241, 240, 237, 0.94);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 0.8rem var(--pad-x); border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 1.4rem; }
.modal-panel > .hint { padding: 0 var(--pad-x); margin-top: 0.9rem; }
.modal .paper-wrap { flex: 1; }
.modal-foot {
  position: sticky; bottom: 0; z-index: 2; background: rgba(241, 240, 237, 0.94);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  padding: 0.8rem var(--pad-x) calc(0.8rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
}
.modal-foot .btn { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 0.6rem 0.8rem; }
.modal-foot .btn-primary { flex-basis: 100%; min-height: 52px; }
@media (min-width: 700px) { .modal-foot .btn-primary { flex-basis: 0; flex-grow: 2; } }
body.modal-open { overflow: hidden; }

/* ── Stopka marki: dyskretna, na każdym ekranie ── */
.brand-foot { text-align: center; padding: 1.4rem var(--pad-x) 2rem; font-size: 0.8rem; color: var(--ink-3); }
.brand-foot a { color: var(--ink-2); text-decoration: none; font-weight: 600; }
.brand-foot a:hover { color: var(--ink); }
body[data-mode="edit"] .brand-foot { display: none; }

/* ── Toast ─────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: calc(1.2rem + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 200;
  display: flex; gap: 1rem; align-items: center;
  background: var(--ink); color: #fff; border-radius: 10px;
  padding: 0.75rem 1.05rem; font-size: 0.88rem; font-weight: 500;
  max-width: calc(100vw - 2rem); box-shadow: 0 10px 30px rgba(17, 17, 17, 0.25);
  animation: toastIn 0.25s var(--ease);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast button { text-decoration: underline; text-underline-offset: 2px; font-weight: 600; color: #fff; }

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


/* ── Unoszące się ikony DJ-skie (flakes.js) ───── */
.flakes { position: fixed; inset: 0; pointer-events: none; z-index: -1; overflow: hidden; } /* pod całą treścią, nad tłem strony */
.flake { position: absolute; bottom: -60px; color: var(--ink); opacity: 0; will-change: transform, opacity; animation: flakeUp var(--d) linear var(--delay) infinite; }
.flake svg { width: 100%; height: 100%; display: block; }
@keyframes flakeUp {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 0; }
  12%  { opacity: var(--o); }
  88%  { opacity: var(--o); }
  100% { transform: translate3d(var(--dx), -118vh, 0) rotate(var(--r)); opacity: 0; }
}

/* ── „Dalej”: zielona obwódka i przelatujący błysk ─ */
.btn-go { position: relative; overflow: hidden; isolation: isolate; box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.55), 0 8px 22px -8px rgba(22, 163, 74, 0.45); }
.btn-go:hover { box-shadow: 0 0 0 2px var(--go), 0 10px 26px -8px rgba(22, 163, 74, 0.6); }
.btn-go::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.32) 50%, transparent 65%);
  transform: translateX(-130%); animation: sheen 3.4s ease-in-out infinite;
}
.btn-ghost.btn-go::after { background: linear-gradient(105deg, transparent 35%, rgba(22, 163, 74, 0.16) 50%, transparent 65%); }
@keyframes sheen { 0%, 55% { transform: translateX(-130%); } 100% { transform: translateX(130%); } }
.btn-go .arr { position: relative; }
@media (prefers-reduced-motion: reduce) { .btn-go::after { animation: none; display: none; } }

/* Drobne ożywienie: karty unoszą się lekko pod kursorem */
@media (hover: hover) {
  .ed-para, .arc, .plan-btn, .skip-box, .send-box { transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.15s; }
  .arc:hover, .plan-btn:hover { transform: translateY(-2px); }
}
.step.is-done:not(.is-active) span::before { display: inline-block; animation: pop 0.35s var(--ease); }
@keyframes pop { 0% { transform: scale(0.4); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }
.sign-form .consent + h2 { margin-top: 1.8rem; }

/* ── Kłódka na dane DJ-a (krok 1) ── */
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.lock.lock-lg { width: 40px; height: 40px; margin-left: 0; }
.lock.lock-lg svg { width: 17px; height: 17px; }
.pane.is-prof-locked .fields .f input, .pane.is-prof-locked .fields .f select { background: var(--sunken); color: var(--ink-2); cursor: not-allowed; border-style: dashed; }

/* ── Warunki w treści umowy (krok 3, zwinięte) ── */
.terms-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); margin: 0 0 1.2rem; }
.terms-box > summary { list-style: none; cursor: pointer; padding: .9rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 52px; }
.terms-box > summary::-webkit-details-marker { display: none; }
.terms-box > summary::after { content: "+"; font-size: 1.3rem; color: var(--ink-3); line-height: 1; }
.terms-box[open] > summary::after { content: "−"; }
.terms-box > summary span { display: flex; flex-direction: column; gap: .1rem; }
.terms-box > summary em { font-size: .84rem; }
.terms-box > .hint { margin: 0 1rem .4rem; }
.terms-box > .fields { padding: 0 1rem 1rem; margin-top: 0; }
.pref { font-size: .74rem; font-weight: 600; color: var(--ink-3); background: var(--sunken); border-radius: 4px; padding: .05rem .35rem; white-space: nowrap; }
.pref:empty { display: none; }

/* ── Plan darmowy i polecenia ── */
.quota { font-size: .88rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .7rem .9rem; margin: 1.2rem 0 0; color: var(--ink-2); }
.quota b { color: var(--ink); }
.quota.low { background: var(--warn-bg); border-color: transparent; color: #6b4300; }
.quota a { color: inherit; font-weight: 600; }
.modal.pay-modal { background: rgba(17, 17, 17, .45); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.pay-panel { max-width: 520px; width: 100%; min-height: 0; margin: 0; background: var(--bg); border-radius: var(--r-lg); box-shadow: 0 20px 50px rgba(0,0,0,.25); padding-bottom: 1rem; overflow: hidden; }
.pay-panel .modal-head { position: static; }
.pay-panel .modal-head h2 { font-size: 1.2rem; }
.pay-panel .auth-plans { display: grid; grid-template-columns: 1fr; gap: .5rem; margin: 1rem var(--pad-x) .4rem; }
.pay-panel .plan-btn { flex-direction: row; align-items: baseline; justify-content: space-between; gap: .8rem; text-align: left; padding: .8rem 1rem; }
.pay-panel .plan-btn strong { font-size: 1.2rem; white-space: nowrap; }
.pay-panel .plan-btn span { text-align: right; }
.pay-panel > .hint { padding: 0 var(--pad-x); }
.ref-box { margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: .5rem; }
.ref-box strong { font-size: .95rem; }
.ref-box p { font-size: .84rem; color: var(--ink-2); margin: 0; }
.ref-box .row { display: flex; gap: .4rem; flex-wrap: wrap; }
.ref-box input { min-height: 38px; font-size: .82rem; flex: 1 1 180px; }
.ref-box .ok { color: var(--ok); font-weight: 600; }

/* Blokada PIN-em */
.pin-screen { position: fixed; inset: 0; z-index: 300; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 1.5rem var(--pad-x); }
.pin-box { width: min(360px, 100%); text-align: center; display: flex; flex-direction: column; gap: 0.8rem; align-items: stretch; }
.pin-ico { font-size: 2.2rem; }
.pin-box h2 { font-size: 1.5rem; }
.pin-text { color: var(--ink-2); }
.pin-form, .pin-setup { display: flex; flex-direction: column; gap: 0.8rem; }
.pin-setup { padding: 0.4rem 1.2rem 0.6rem; }
.pin-setup-text { padding: 0 1.2rem; }
.pin-input { min-height: 56px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); text-align: center; font-size: 1.6rem; letter-spacing: 0.5em; font-family: var(--font-ui); width: 100%; }
.pin-input:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.pin-err { color: var(--bad); font-size: 0.9rem; }
.pin-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 1.2rem 0 0.4rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: 0.88rem; color: var(--ink-2); }
.pin-row span { margin-right: auto; }

/* Powiadomienia e-mail */
.notify { margin: 1.2rem 0 0; padding-top: 1rem; border-top: 1px solid var(--line); }
.notify summary { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.6rem; cursor: pointer; list-style: none; min-height: 44px; font-size: 0.95rem; }
.notify summary::-webkit-details-marker { display: none; }
.notify summary::after { content: "›"; margin-left: auto; font-size: 1.3rem; color: var(--ink-3); transition: transform 0.2s var(--ease); }
.notify[open] summary::after { transform: rotate(90deg); }
.notify-title { font-weight: 600; }
.notify-sum { font-size: 0.82rem; color: var(--ink-3); }
.notify-intro { font-size: 0.86rem; color: var(--ink-2); margin: 0.2rem 0 0.8rem; line-height: 1.5; }
.notify-item { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); margin-bottom: 0.5rem; }
.notify-check { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.75rem 0.85rem; cursor: pointer; }
.notify-check input { width: 20px; height: 20px; margin: 0.1rem 0 0; flex: none; accent-color: var(--ink); }
.notify-check b { display: block; font-size: 0.92rem; }
.notify-check small { display: block; font-size: 0.82rem; color: var(--ink-3); line-height: 1.45; margin-top: 0.15rem; }
.notify-when { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--ink-2); padding: 0 0.85rem 0.75rem 2.55rem; }
.notify select { width: auto; min-width: 0; min-height: 40px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); font: inherit; padding: 0 0.5rem; color: var(--ink); }
.notify select:disabled { opacity: 0.5; }
.notify-hour { margin: 0.8rem 0 0.4rem; font-size: 0.88rem; color: var(--ink-2); }
.notify-hour label { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; font-weight: 600; color: var(--ink); }
.notify-hour small { display: block; font-size: 0.8rem; color: var(--ink-3); margin-top: 0.3rem; line-height: 1.45; }
.notify-tip { font-size: 0.8rem; color: var(--ink-3); margin: 0.3rem 0 0; }

/* ── Rodzaje umów ─────────────────────────────────────────── */
.cat-wesele { --cat: var(--cat-wesele); --cat-bg: var(--cat-wesele-bg); }
.cat-prywatna { --cat: var(--cat-prywatna); --cat-bg: var(--cat-prywatna-bg); }
.cat-firma { --cat: var(--cat-firma); --cat-bg: var(--cat-firma-bg); }
.cat-lead { display: none; }
.pane.no-cat .cat-lead { display: block; }
.pane.no-cat .after-cat { display: none; }
.cat-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; margin: 1rem 0 1.2rem; }
.fields.wed-only { margin-bottom: 0.9rem; }
.cat-tile { display: flex; align-items: center; gap: 0.6rem; text-align: left; min-height: 56px; padding: 0.6rem 0.8rem; border: 1.5px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; transition: border-color 0.15s, background 0.15s, transform 0.15s var(--ease); }
.cat-tile:hover { border-color: var(--cat); }
.cat-tile:focus-visible { outline: 2px solid var(--cat); outline-offset: 2px; }
.cat-ico { font-size: 1.35rem; line-height: 1; flex: none; }
.cat-txt { display: flex; flex-direction: column; min-width: 0; }
.cat-txt b { font-size: 0.95rem; }
.cat-txt small { display: none; font-size: 0.8rem; color: var(--ink-3); line-height: 1.35; margin-top: 0.15rem; }
.cat-tile[aria-checked="true"] { border-color: var(--cat); background: var(--cat-bg); box-shadow: inset 0 0 0 1px var(--cat); }
.cat-tile[aria-checked="true"] b { color: var(--cat); }
/* Przed wyborem: duże kafelki z opisem, reszta kroku czeka */
.pane.no-cat .cat-pick { grid-template-columns: 1fr; gap: 0.75rem; max-width: 520px; }
.pane.no-cat .cat-tile { min-height: 84px; padding: 1rem 1.1rem; gap: 0.9rem; }
.pane.no-cat .cat-ico { font-size: 1.9rem; }
.pane.no-cat .cat-txt b { font-size: 1.08rem; }
.pane.no-cat .cat-txt small { display: block; }
.pane.no-cat .cat-tile:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.cat-note { font-size: 0.88rem; color: var(--ink-2); line-height: 1.5; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--cat, var(--ink)); border-radius: var(--r); padding: 0.7rem 0.9rem; margin: -0.4rem 0 1.4rem; }
.pane[data-cat="wesele"] .cat-note { --cat: var(--cat-wesele); }
.pane[data-cat="prywatna"] .cat-note { --cat: var(--cat-prywatna); }
.pane[data-cat="firma"] .cat-note { --cat: var(--cat-firma); }
.cat-note .link-btn { white-space: nowrap; }
@media (max-width: 520px) {
  .cat-pick { gap: 0.4rem; }
  .cat-tile { flex-direction: column; justify-content: center; gap: 0.25rem; text-align: center; padding: 0.55rem 0.3rem; }
  .cat-txt b { font-size: 0.8rem; line-height: 1.2; }
  .pane.no-cat .cat-tile { flex-direction: row; text-align: left; }
}
/* Edytor: paragrafy i punkty dodane przez rodzaj umowy */
.ed-para.cat-hl { border-color: var(--cat); box-shadow: inset 3px 0 0 var(--cat); background: linear-gradient(var(--cat-bg), var(--cat-bg)) top / 100% 2.6rem no-repeat, var(--surface); }
.cat-why { font-size: 0.8rem; font-weight: 600; color: var(--cat); margin-bottom: 0.55rem; }
.pt.cat-hl-pt { background: var(--cat-bg); border-radius: var(--r); box-shadow: inset 3px 0 0 var(--cat); padding-top: 0.35rem; padding-bottom: 0.35rem; }
.pt-cond.cat-why { margin: 0.1rem 0 0; font-weight: 600; }
.para-scope { display: flex; flex-basis: 100%; align-items: center; gap: 0.4rem; font-size: 0.78rem; color: var(--ink-3); margin-top: 0.15rem; white-space: nowrap; }
.para-scope select { min-height: 32px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font: inherit; font-size: 0.78rem; color: var(--ink-2); padding: 0 0.3rem; max-width: 14rem; }
.cat-hidden { font-size: 0.82rem; color: var(--ink-3); margin: 0.2rem 0 1rem; }
/* Podgląd DJ-a (nie PDF, nie strona klienta) */
.doc.is-preview .cat-hl { position: relative; background: var(--cat-bg); box-shadow: -10px 0 0 var(--cat-bg), 10px 0 0 var(--cat-bg), -13px 0 0 var(--cat); border-radius: 2px; padding: 0.35rem 0 0.2rem; }
.doc.is-preview .hl-why { display: inline-block; font-family: var(--font-ui); font-size: 0.68rem; font-weight: 700; color: var(--cat); margin-bottom: 0.2rem; }
.doc.is-preview li.cat-hl-pt { background: var(--cat-bg); box-shadow: -4px 0 0 var(--cat-bg), 4px 0 0 var(--cat-bg), -7px 0 0 var(--cat); border-radius: 2px; }
/* Moje umowy */
.arc-cats { display: flex; gap: 0.35rem; overflow-x: auto; scrollbar-width: none; margin-bottom: 0.5rem; padding-bottom: 0.2rem; }
.arc-cats::-webkit-scrollbar { display: none; }
.arc-cat-btn { flex: 1 0 auto; min-height: 38px; padding: 0 0.7rem; border-radius: var(--r); border: 1px solid var(--line); border-bottom: 3px solid var(--cat); background: var(--surface); font: inherit; font-size: 0.82rem; color: var(--ink-2); white-space: nowrap; cursor: pointer; }
.arc-cat-btn b { color: var(--ink); margin-left: 0.15rem; }
.arc-cat-btn[aria-pressed="true"] { background: var(--cat-bg); border-color: var(--cat); color: var(--cat); font-weight: 600; }
.arc-cat-btn[aria-pressed="true"] b { color: var(--cat); }
.arc-cat-btn .x { font-size: 0.7rem; margin-left: 0.15rem; }
.arc.cat-wesele, .arc.cat-prywatna, .arc.cat-firma { box-shadow: inset 4px 0 0 var(--cat); padding-left: 1.1rem; }
.arc-cat { display: inline-block; font-size: 0.72rem; font-weight: 600; color: var(--cat); background: var(--cat-bg); border-radius: 4px; padding: 0.05rem 0.4rem; margin-right: 0.15rem; }

/* Wesele nie ma wyboru rodzaju: data zajmuje cały wiersz, żeby „Od” i „Do” zostały obok siebie */
.pane[data-cat="wesele"] .f-date { grid-column: 1 / -1; }
