/* ---------- tokeny ---------- */
:root {
  --bg: #f5f6f9;
  --surface: #ffffff;
  --surface-2: #eceff5;
  --text: #1a2030;
  --muted: #596173;
  --line: #dce1ea;
  --accent: #1e40af;
  --accent-ink: #ffffff;
  --accent-soft: #e6ecfb;
  --focus: #3b82f6;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 8px 24px -12px rgb(0 0 0 / .15);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Times New Roman", Times, "Liberation Serif", Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1218;
    --surface: #161b24;
    --surface-2: #1d2430;
    --text: #e6e9f0;
    --muted: #9aa3b5;
    --line: #2a3240;
    --accent: #93b4ff;
    --accent-ink: #0b1a3a;
    --accent-soft: #18223d;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px -12px rgb(0 0 0 / .6);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; padding-top: 32px; padding-bottom: 48px; }

/* ---------- nagłówek i stopka ---------- */
.site-head { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { display: inline-flex; gap: 8px; align-items: center; font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.logo svg { color: var(--accent); }
.site-head nav { display: flex; gap: 20px; }
.site-head nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
.site-head nav a:hover { color: var(--text); }

.site-foot { margin-top: 64px; background: var(--surface); border-top: 1px solid var(--line); padding: 32px 0 24px; color: var(--muted); font-size: .95rem; }
.foot-grid { display: grid; gap: 32px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
.foot-name { font-weight: 700; color: var(--text); margin: 0 0 4px; }
.others h2 { font-size: 1rem; color: var(--text); margin: 0 0 8px; }
.others ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.others a { display: block; text-decoration: none; }
.others a span { display: block; color: var(--muted); font-size: .9rem; }
.fine { margin: 24px 0 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: .85rem; }

.bmc { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; padding: 9px 16px; border-radius: 999px; background: #ffdd00; color: #1c1c1c; font-weight: 600; text-decoration: none; }
.bmc:hover { filter: brightness(.95); }

/* ---------- strona główna ---------- */
.hero { padding: 48px 0 24px; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.7rem); line-height: 1.15; margin: 0 0 12px; letter-spacing: -.02em; max-width: 20ch; }
.lead { color: var(--muted); font-size: 1.08rem; max-width: 62ch; margin: 0 0 20px; }
.search input { width: 100%; max-width: 560px; padding: 14px 16px; font: inherit; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.badges { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 16px 0 0; }
.badges li { background: var(--accent-soft); color: var(--accent); padding: 4px 12px; border-radius: 999px; font-size: .85rem; font-weight: 600; }

.cat { margin-top: 32px; }
.cat h2, .related h2 { font-size: 1.15rem; margin: 0 0 12px; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card a { display: flex; flex-direction: column; height: 100%; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
.card a:hover { border-color: var(--accent); transform: translateY(-1px); }
.card h3 { margin: 0 0 6px; font-size: 1.02rem; }
.card p { margin: 0 0 12px; color: var(--muted); font-size: .93rem; flex: 1; }
.card .go { color: var(--accent); font-weight: 600; font-size: .9rem; }
.empty { color: var(--muted); padding: 24px 0; }

.how { margin-top: 48px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); counter-reset: s; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; counter-increment: s; }
.steps li::before { content: counter(s); display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; margin-bottom: 8px; }
.steps b { display: block; }
.steps span { color: var(--muted); font-size: .93rem; }

/* ---------- generator ---------- */
.crumbs { display: flex; gap: 8px; padding: 16px 0 0; font-size: .9rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.page-head h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); line-height: 1.2; margin: 8px 0 8px; letter-spacing: -.01em; }
.page-head .lead { font-size: 1rem; }

.gen { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1000px) {
  .gen { grid-template-columns: minmax(340px, 5fr) minmax(0, 7fr); }
  .preview-pane { position: sticky; top: 16px; }
  .tabs, .only-mobile { display: none !important; }
}
@media (max-width: 999.98px) {
  .gen[data-view="form"] .preview-pane, .gen[data-view="preview"] .form-pane { display: none; }
}
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: var(--radius); margin-bottom: 16px; position: sticky; top: 8px; z-index: 5; }
.tabs button { font: inherit; font-weight: 600; font-size: .92rem; border: 0; padding: 10px; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* formularz */
#form { display: grid; gap: 12px; }
#form fieldset { margin: 0; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
#form legend { float: left; width: 100%; padding: 0; margin: 0 0 12px; font-weight: 700; font-size: .98rem; }
#form legend + * { clear: both; }
#form.locked { opacity: .55; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.half { grid-column: span 1; }
@media (max-width: 420px) { .field.half { grid-column: 1 / -1; } }
.field label { font-size: .86rem; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
}
.field textarea { resize: vertical; min-height: 72px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field.check label { flex-direction: row; display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); font-size: .95rem; cursor: pointer; }
.field.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.help { color: var(--muted); font-size: .8rem; }
.privacy-note { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: .86rem; margin: 12px 4px; }
.privacy-note svg { flex: none; margin-top: 3px; color: var(--accent); }

/* przyciski */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.btn { font: inherit; font-weight: 600; font-size: .92rem; padding: 9px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.only-mobile { width: 100%; margin-top: 4px; padding: 13px; }
.hint { margin: 0 0 12px; padding: 10px 14px; background: var(--accent-soft); border-radius: 9px; font-size: .9rem; }

/* kartka A4 */
.paper-wrap { background: var(--surface-2); border-radius: var(--radius); padding: 16px; overflow: auto; max-height: calc(100vh - 120px); }
@media (max-width: 999.98px) { .paper-wrap { max-height: none; padding: 8px; } }
.paper {
  --ink: #111;
  background: #fff; color: var(--ink); box-shadow: 0 2px 12px rgb(0 0 0 / .12);
  width: 100%; max-width: 210mm; min-height: 297mm; margin: 0 auto; padding: 18mm 18mm 22mm;
  font: 11.5pt/1.5 var(--serif); text-align: justify; hyphens: auto; overflow-wrap: anywhere;
}
@media (max-width: 600px) { .paper { padding: 22px 18px; min-height: 0; font-size: 10.5pt; text-align: left; } }
.paper.editing { outline: 2px dashed var(--accent); outline-offset: 4px; cursor: text; }
.paper h1 { font-size: 15pt; text-align: center; margin: 1.2em 0 1em; text-transform: uppercase; letter-spacing: .03em; }
.paper h2 { font-size: 12pt; margin: 1.2em 0 .4em; }
.paper h2.center { text-align: center; }
.paper h3 { font-size: 11.5pt; text-align: center; margin: 1.2em 0 .4em; break-after: avoid; }
.paper h3 span { font-weight: 600; }
.paper p { margin: 0 0 .55em; }
.paper ol, .paper ul { margin: 0 0 .55em; padding-left: 1.6em; }
.paper li { margin-bottom: .3em; }
.paper .place { text-align: right; }
.paper .small { font-size: 9.5pt; }
.paper .addr { margin: 0 0 1.4em; text-align: left; }
.paper .addr.to { margin-left: 50%; margin-top: 1.6em; }
.paper table { width: 100%; border-collapse: collapse; margin: .4em 0 1em; text-align: left; }
.paper td, .paper th { border: 1px solid #999; padding: 4px 8px; vertical-align: top; }
.paper th { background: #f1f1f1; }
.paper table.kv td:first-child { width: 38%; }
.paper .ph { color: #8a8a8a; background: #fff6cc; border-radius: 2px; }
.sigs { display: flex; justify-content: space-between; gap: 10%; margin-top: 3.5em; break-inside: avoid; text-align: center; font-size: 9.5pt; color: #444; }
.sigs > div { flex: 1; max-width: 45%; }
.sigs.one { justify-content: flex-end; }
.sigs .line { display: block; border-bottom: 1px dotted #333; height: 2.5em; margin-bottom: 4px; }
.pagebreak { break-before: page; height: 0; margin: 2.5em 0; border-top: 1px dashed #bbb; }

/* treść informacyjna */
.prose .meta { color: var(--muted); margin-top: -8px; }
.terms ol { padding-left: 1.4em; }
.terms ol ol { margin-top: 6px; }
.privacy-note a { color: inherit; }
.info { margin-top: 40px; max-width: 820px; }
.prose h1 { font-size: 2rem; margin: 0 0 16px; }
.prose h2 { font-size: 1.2rem; margin: 28px 0 8px; }
.prose li { margin-bottom: 6px; }
.related { margin-top: 40px; }

/* ---------- druk / PDF ---------- */
@page { size: A4; margin: 18mm 18mm 20mm; }
@media print {
  body { background: #fff; }
  .site-head, .site-foot, .crumbs, .page-head, .tabs, .form-pane, .toolbar, .hint, .info, .related, .terms-box, .ad-slot { display: none !important; }
  .wrap { padding: 0; max-width: none; }
  .gen { display: block !important; }
  .preview-pane { display: block !important; position: static; }
  .paper-wrap { padding: 0; background: none; max-height: none; overflow: visible; }
  .paper { box-shadow: none; padding: 0; max-width: none; min-height: 0; font-size: 11.5pt; outline: none !important; }
  .paper .ph { background: none; color: #000; }
  .pagebreak { border: 0; margin: 0; }
}
@media (max-width: 480px) { .site-head nav { gap: 12px; font-size: .9rem; } }

/* ---------- strona główna: moduły i sprawy ---------- */
.hero h1 { max-width: none; }
.modules { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.module { position: relative; display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 20px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; box-shadow: var(--shadow); }
a.module { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
a.module:hover { filter: brightness(1.06); }
.module b { font-size: 1.15rem; }
.module span { font-size: .93rem; opacity: .85; }
.module.soon { color: var(--muted); box-shadow: none; border-style: dashed; }
.module.soon svg { color: var(--muted); }
.module em { position: absolute; top: 14px; right: 14px; font-style: normal; font-size: .75rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.section-title { font-size: 1.4rem; margin: 40px 0 14px; }
.intents { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.intent { display: flex; align-items: center; gap: 14px; min-height: 84px; padding: 16px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
.intent:hover { border-color: var(--accent); transform: translateY(-1px); }
.intent svg { flex: none; color: var(--accent); background: var(--accent-soft); padding: 9px; width: 46px; height: 46px; border-radius: 12px; }
.intent span { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.intent b { font-size: 1.02rem; line-height: 1.3; }
.intent small { color: var(--muted); font-size: .85rem; }
.intent em { font-style: normal; font-weight: 700; color: var(--muted); font-size: .85rem; }
.search input { max-width: none; }
.cat { scroll-margin-top: 16px; }
.cat h2 { display: flex; align-items: center; gap: 10px; }
.cat h2 svg { width: 24px; height: 24px; color: var(--accent); }

/* ---------- wygoda: dane, terminy, walidacja ---------- */
.btn.small { font-size: .84rem; padding: 6px 11px; }
.site-head nav { align-items: center; }
.data-tools { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.small-note { font-size: .78rem; }
.warn { display: block; color: #b45309; font-size: .8rem; margin-top: 3px; }
[aria-invalid] { border-color: #d97706 !important; }
.terms-box { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 12px; }
.terms-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.terms-box ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.terms-box li { font-size: .92rem; }
.terms-box li.own b { color: #b91c1c; }
.terms-box small { display: block; color: var(--muted); font-size: .8rem; line-height: 1.45; }
.ad-slot { display: block; min-height: 280px; margin: 24px 0; contain: layout size; background: var(--surface-2); border-radius: var(--radius); }
@media (prefers-color-scheme: dark) {
  .warn { color: #fbbf24; }
  .terms-box li.own b { color: #fca5a5; }
}

/* ---------- konwerter ---------- */
.conv-tools { display: grid; gap: 10px; margin: 8px 0 24px; }
.conv-tool { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.conv-tool summary { cursor: pointer; padding: 14px 18px; display: flex; flex-direction: column; gap: 2px; list-style: none; }
.conv-tool summary::-webkit-details-marker { display: none; }
.conv-tool summary b { font-size: 1.05rem; }
.conv-tool summary span { color: var(--muted); font-size: .9rem; }
.conv-tool[open] summary { border-bottom: 1px solid var(--line); }
.conv-body { padding: 16px 18px; display: grid; gap: 12px; }
.conv-drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px 16px; text-align: center; color: var(--muted); font-weight: 600; cursor: pointer; background: var(--surface-2); }
.conv-drop:hover, .conv-drop.over { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.conv-files { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.conv-files li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; }
.conv-files li > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.conv-files small { display: block; color: var(--muted); font-size: .8rem; }
.conv-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.conv-status { color: var(--muted); font-size: .9rem; }
.conv-pages { width: 100%; }
@media (max-width: 560px) { .site-head .nav-extra { display: none; } .site-head nav { gap: 14px; } }

/* ---------- narzędzia: wspólne ---------- */
.conv-drop.big { padding: 56px 16px; font-size: 1.05rem; }
.conv-opts { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.conv-opts .field span, .ft-opts .field span { font-size: .86rem; font-weight: 600; color: var(--muted); }
.conv-opts input, .conv-opts select, .ft-opts input, .ft-opts select, .pe-fields input, .pe-fields select, .pe-fields textarea, #we-block, #pe-size {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--text); width: 100%; }
#we-block, #pe-size { width: auto; padding: 5px 8px; font-size: .88rem; }
.tool-links { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.tool-links a { display: flex; flex-direction: column; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--text); }
.tool-links a:hover { border-color: var(--accent); }
.tool-links span { color: var(--muted); font-size: .88rem; }
.center-line { text-align: center; color: var(--muted); margin: 14px 0; }
.grow { flex: 1; }
.print-box { display: none; }
@media print {
  body.print-only-box > *:not(.print-box) { display: none !important; }
  body.print-only-box .print-box { display: block; color: #111; font: 11pt/1.5 Calibri, Carlito, "Segoe UI", Arial, sans-serif; }
  .print-box h1, .print-box h2, .print-box h3, .print-box h4 { line-height: 1.25; margin: 1em 0 .4em; break-after: avoid; }
  .print-box h1 { font-size: 18pt; } .print-box h2 { font-size: 15pt; } .print-box h3 { font-size: 13pt; }
  .print-box p { margin: 0 0 .5em; orphans: 3; widows: 3; }
  .print-box .c { text-align: center; } .print-box .r { text-align: right; } .print-box .j { text-align: justify; }
  .print-box ul, .print-box ol { margin: 0 0 .6em; padding-left: 7mm; }
  .print-box table { border-collapse: collapse; width: 100%; margin: .4em 0 .9em; font-size: 10pt; }
  .print-box tr { break-inside: avoid; }
  .print-box th, .print-box td { border: 1px solid #999; padding: 1.4mm 2mm; vertical-align: top; text-align: left; }
  .print-box th { background: #eee; }
  .print-box td p { margin: 0; }
  .print-box img { max-width: 100%; height: auto; }
  .print-box .page-break { display: block; break-before: page; }
}

/* ---------- edytor PDF ---------- */
.pe-bar { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; padding: 10px 12px; margin: 0 0 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pe-tools, .pe-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pe-size { font-size: .86rem; color: var(--muted); display: flex; gap: 6px; align-items: center; }
#pe-pages { display: grid; gap: 22px; justify-items: center; padding: 8px 0 24px; }
.pe-page { display: grid; gap: 6px; max-width: 100%; }
.pe-page-bar { display: flex; gap: 8px; align-items: center; font-size: .88rem; color: var(--muted); }
.pe-page.removed .pe-sheet { opacity: .25; }
.pe-sheet { position: relative; box-shadow: 0 2px 14px rgb(0 0 0 / .18); background: #fff; max-width: 100%; }
.pe-sheet canvas { display: block; }
.pe-layer { position: absolute; inset: 0; }
#pe-pages[data-tool="text"] .pe-layer, #pe-pages[data-tool="date"] .pe-layer { cursor: text; }
#pe-pages[data-tool="check"] .pe-layer, #pe-pages[data-tool="cross"] .pe-layer, #pe-pages[data-tool="white"] .pe-layer, #pe-pages[data-tool="sign"] .pe-layer { cursor: crosshair; }
.pe-ann { position: absolute; color: #000; touch-action: none; }
.pe-ann:hover, .pe-ann:focus-within { outline: 1px dashed #2563eb; }
.pe-text { min-width: 24px; padding: 2px 4px; line-height: 1.25; font-family: "Liberation Sans", Arial, Helvetica, sans-serif; white-space: pre; outline: none; }
.pe-image img { width: 100%; height: 100%; display: block; pointer-events: none; }
.pe-white { background: #fff; outline: 1px dashed #94a3b8; }
.pe-check, .pe-cross { display: grid; place-items: center; cursor: move; }
.pe-mark { line-height: 1; font-family: Arial, sans-serif; pointer-events: none; }
.pe-image { cursor: move; }
.pe-move, .pe-x { position: absolute; top: -20px; width: 20px; height: 20px; display: none; place-items: center; font-size: 12px; border-radius: 5px; border: 1px solid #2563eb; background: #fff; color: #1e3a8a; cursor: move; padding: 0; line-height: 1; }
.pe-move { left: -1px; }
.pe-x { right: -1px; cursor: pointer; color: #b91c1c; border-color: #b91c1c; }
.pe-ann:hover .pe-move, .pe-ann:hover .pe-x, .pe-ann:focus-within .pe-move, .pe-ann:focus-within .pe-x { display: grid; }
.pe-resize { position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; border-radius: 3px; background: #2563eb; cursor: nwse-resize; display: none; }
.pe-ann:hover .pe-resize { display: block; }
@media (hover: none) { .pe-move, .pe-x { display: grid; } .pe-resize { display: block; } }
.pe-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 16px; margin-bottom: 12px; }
.pe-form summary { cursor: pointer; padding: 4px 0; }
.pe-fields { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin: 10px 0; }
.pe-field { display: flex; flex-direction: column; gap: 4px; font-size: .86rem; color: var(--muted); }
.pe-field input[type=checkbox] { width: auto; align-self: flex-start; }
.pe-flat { font-size: .86rem; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.pe-sign { border: 0; border-radius: var(--radius); padding: 18px; width: min(640px, calc(100vw - 24px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.pe-sign::backdrop { background: rgb(0 0 0 / .45); }
.pe-sign h2 { margin: 0 0 4px; font-size: 1.15rem; }
#pe-pad { width: 100%; height: 200px; background: #fff; border: 1px dashed var(--line); border-radius: 9px; touch-action: none; display: block; margin: 10px 0; }
.pe-sign-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- edytor Word ---------- */
.we-paper { min-height: 60vh; font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif; text-align: left; outline: none; }
.we-paper:focus { box-shadow: 0 0 0 2px var(--focus), 0 2px 12px rgb(0 0 0 / .12); }
.we-paper h1 { font-size: 18pt; text-transform: none; text-align: left; margin: .8em 0 .4em; }
.we-paper h2 { font-size: 15pt; margin: .8em 0 .4em; }
.we-paper h3 { font-size: 13pt; margin: .8em 0 .4em; }
.we-paper .c { text-align: center; } .we-paper .r { text-align: right; } .we-paper .j { text-align: justify; }
.we-paper table { border-collapse: collapse; width: 100%; }
.we-paper td, .we-paper th { border: 1px solid #999; padding: 4px 8px; min-width: 40px; }
.we-paper img { max-width: 100%; height: auto; }
.we-paper .page-break { display: block; border-top: 1px dashed #bbb; margin: 1.5em 0; }

/* ---------- zdjęcie do urzędu ---------- */
.ft-work { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) minmax(260px, 360px); align-items: start; margin-bottom: 20px; }
.ft-preview { display: grid; gap: 8px; justify-items: start; }
#ft-canvas { max-width: 100%; border-radius: 8px; touch-action: none; cursor: move; background: var(--surface-2); }
.ft-row { display: flex; gap: 10px; align-items: center; width: 100%; font-size: .88rem; color: var(--muted); }
.ft-row input { flex: 1; }
.ft-opts { display: grid; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.ft-custom { display: grid; gap: 10px; }
.ft-row2 { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.ft-out { max-width: 160px; border: 1px solid var(--line); border-radius: 6px; }
@media (max-width: 760px) { .ft-work { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .pe-bar { position: static; } }

/* autor na stronie „O stronie” */
.author { display: flex; gap: 16px; align-items: center; margin: 28px 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.author img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; flex: none; }
.author p { margin: 0; }
@media (max-width: 480px) { .author { flex-direction: column; text-align: center; } }

/* blok sezonowy na stronie głównej */
.season { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius); padding: 18px 20px; margin: 8px 0 0; }
.season h2 { margin: 0 0 12px; font-size: 1.2rem; }
.season ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.season li { display: flex; flex-direction: column; gap: 4px; font-size: .92rem; }
.season li span { color: var(--muted); line-height: 1.45; }
.season a { font-weight: 600; margin-top: 2px; }

/* kalkulatory */
.calc-box { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.calc { display: grid; gap: 10px; }
.calc .field { display: grid; gap: 4px; }
.calc .field span { font-size: .88rem; font-weight: 600; }
.calc input, .calc select { font: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--text); width: 100%; box-sizing: border-box; }
.calc [hidden] { display: none; }
.calc-result { border-left: 4px solid var(--accent); padding: 4px 0 4px 14px; }
.calc-result.warn { border-left-color: #b91c1c; }
.calc-result p { margin: 0 0 8px; line-height: 1.5; }
.calc-result .big { font-size: 1.15rem; }
.calc-steps { margin: 0 0 8px; padding-left: 18px; }
.calc-steps li { margin-bottom: 6px; line-height: 1.45; }
.calc-hint { color: var(--muted); font-size: .88rem; }
.calc-links { font-weight: 600; }
.table-scroll { overflow-x: auto; margin: 0 0 8px; }
.calc-table { border-collapse: collapse; font-size: .88rem; width: 100%; }
.calc-table th, .calc-table td { border-bottom: 1px solid var(--line); padding: 5px 8px; text-align: right; white-space: nowrap; }
.calc-table th:first-child, .calc-table td:first-child { text-align: left; }
@media (max-width: 760px) { .calc-box { grid-template-columns: 1fr; padding: 14px; } }

/* Czy to fair? */
.faq-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.faq-nav a { padding: 6px 12px; border-radius: 999px; background: var(--accent-soft); font-weight: 600; text-decoration: none; }
.faq-calc { margin: 0 0 28px; }
.faq-calc h2, .faq-group h2 { font-size: 1.25rem; margin: 24px 0 10px; }
.faq { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin: 0 0 8px; }
.faq summary { cursor: pointer; padding: 12px 14px; font-weight: 600; list-style-position: inside; }
.faq > div { padding: 0 14px 14px; }
.faq p { margin: 0 0 8px; line-height: 1.55; }
.faq-law { color: var(--muted); font-size: .85rem; }
.home-calc { margin-top: 32px; }
.pe-black { background: #000; }

/* udostępnianie, poradniki, historia zmian */
.share-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; }
.share-btn { display: inline-flex; align-items: center; gap: 6px; }
.share-msg { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.guide-cta { margin: 0 0 16px; }
.guide-toc { background: var(--accent-soft); border-radius: 12px; padding: 14px 14px 14px 36px; margin: 0 0 24px; }
.guide-toc li { margin: 4px 0; }
.guide-step h2 { display: flex; align-items: center; gap: 10px; }
.step-no { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: .95rem; }
.guide-tip { border-left: 4px solid var(--accent); padding: 8px 14px; background: var(--accent-soft); border-radius: 0 8px 8px 0; }
.guide-link { font-weight: 600; }
.changelog h2 { font-size: 1.15rem; }
a.btn { text-decoration: none; display: inline-block; }

/* =========================================================
   Układ aplikacji: górny pasek, panel boczny, dolne zakładki
   ========================================================= */
:root { --top-h: 60px; --side-w: 264px; --tab-h: 64px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }
.topbar { position: sticky; top: 0; z-index: 40; height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .logo { flex: none; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
.gsearch { position: relative; flex: 1; max-width: 560px; margin: 0 auto; display: flex; align-items: center; }
.gsearch > svg { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search-input { width: 100%; font: inherit; font-size: .95rem; padding: 9px 70px 9px 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--text); }
.search-input:focus { background: var(--surface); border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.kbd { position: absolute; right: 10px; font: 600 .72rem var(--font); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; background: var(--surface); pointer-events: none; }
.search-list { position: absolute; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); max-height: min(70vh, 480px); overflow: auto; z-index: 50; }
.search-list a { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 9px 12px; border-radius: 8px; color: var(--text); text-decoration: none; }
.search-list small { flex: none; color: var(--muted); font-size: .78rem; }
.search-list [aria-selected="true"] a, .search-list a:hover { background: var(--accent-soft); }
.search-none { padding: 10px 12px; color: var(--muted); }
.search-toggle { display: none; }

.shell { display: flex; align-items: flex-start; min-height: calc(100vh - var(--top-h)); }
.sidebar { flex: none; width: var(--side-w); position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); padding: 14px 10px 20px; display: flex; flex-direction: column; gap: 8px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.nav-top { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--text); text-decoration: none; font-weight: 600; font-size: .95rem; margin-top: 6px; }
.nav-top svg { color: var(--muted); flex: none; }
.nav-top em, .nav-sub em, .cat-tabs em { margin-left: auto; font-style: normal; font-size: .75rem; font-weight: 600; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 1px 8px; }
.nav-top:hover, .nav-sub a:hover { background: var(--surface-2); }
.nav-top.on { color: var(--accent); }
.nav-top.on svg { color: var(--accent); }
.nav-top[aria-current="page"] { background: var(--accent-soft); }
.nav-sub { list-style: none; margin: 0 0 4px; padding: 0 0 0 30px; }
.nav-sub a { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: .9rem; line-height: 1.35; }
.nav-sub a[aria-current="page"], .nav-sub a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .85rem; }
.nav-foot a { color: var(--muted); text-decoration: none; }
.nav-foot a:hover { color: var(--text); }
.main-col { flex: 1; min-width: 0; container-type: inline-size; }
.main-col .wrap { max-width: 1180px; padding: 0 24px; }
.main-col .wrap.narrow { max-width: 800px; }
.site-foot { margin-top: 56px; padding: 28px 24px 24px; }
.tabbar { display: none; }
.nav-scrim { position: fixed; inset: 0; background: rgb(0 0 0 / .35); z-index: 44; }

/* generator: dwie kolumny zależnie od szerokości obszaru treści, nie okna */
@container (min-width: 940px) {
  .gen { grid-template-columns: minmax(320px, 5fr) minmax(0, 7fr); }
  .preview-pane { position: sticky; top: calc(var(--top-h) + 16px); }
  .tabs, .only-mobile { display: none !important; }
}
@container (max-width: 939.98px) {
  .gen { grid-template-columns: minmax(0, 1fr) !important; }
  .gen .preview-pane { position: static !important; }
  .gen[data-view="form"] .preview-pane, .gen[data-view="preview"] .form-pane { display: none; }
  .gen .tabs { display: grid !important; }
}
.tabs { top: calc(var(--top-h) + 8px); }

/* strona główna jako pulpit */
.home { max-width: 1180px; margin: 0 auto; padding: 8px 24px 0; }
.home .hero { background: none; padding: 28px 0 8px; text-align: left; }
.home .hero h1 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); margin: 0 0 6px; letter-spacing: -.015em; }
.hero-search-btn { display: flex !important; width: 100%; max-width: 720px; align-items: center; gap: 10px; padding: 14px 16px; font: inherit; color: var(--muted); text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); cursor: text; }
.hero-search-btn:hover { border-color: var(--accent); }
.home section { margin-top: 28px; }
.home .section-title { font-size: 1.1rem; margin: 0 0 12px; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { display: inline-block; padding: 7px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: .92rem; }
.chips a:hover { border-color: var(--accent); }
.more { margin: 12px 0 0; font-weight: 600; }
.more a { text-decoration: none; }
.home-cols { display: grid; gap: 0 24px; grid-template-columns: minmax(0, 1fr); }
@container (min-width: 900px) { .home-cols { grid-template-columns: 1fr 1fr; } }
.home .season { margin-top: 28px; }
.home .wrap { padding: 0; max-width: none; }

/* spisy wzorów */
.cat-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; margin-bottom: 8px; scrollbar-width: thin; }
.cat-tabs a { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; font-size: .9rem; font-weight: 500; }
.cat-tabs a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.cat-tabs a[aria-current="page"] em { background: rgb(255 255 255 / .2); color: inherit; }
.list-filter { margin: 4px 0 8px; }
.cat h2 a { color: inherit; text-decoration: none; }

/* telefon i tablet: panel wysuwany, dolne zakładki */
@media (max-width: 1023.98px) {
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; z-index: 45; transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow); padding-top: 18px; }
  .nav-open .sidebar { transform: none; }
  .gsearch { display: none; }
  .search-toggle { display: inline-grid; }
  .topbar .search-toggle { margin-left: auto; }
  .search-open .gsearch { display: flex; position: absolute; inset: 0; max-width: none; padding: 10px 12px; background: var(--surface); }
  .search-open .gsearch > svg { left: 24px; }
  .search-open .kbd { display: none; }
  .search-open .search-input { padding-right: 12px; }
  .search-open .search-list { left: 12px; right: 12px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: 600 .7rem var(--font); color: var(--muted); text-decoration: none; background: none; border: 0; cursor: pointer; }
  .tabbar .on { color: var(--accent); }
  body { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); }
  .main-col .wrap, .home { padding-left: 16px; padding-right: 16px; }
  .site-foot { padding-left: 16px; padding-right: 16px; }
  #btn-install { display: none; }
}
@media (min-width: 1024px) { .nav-toggle { display: none; } }
@media (max-width: 380px) { .topbar .logo { font-size: 1rem; } }
@media print {
  .topbar, .sidebar, .tabbar, .nav-scrim, .skip { display: none !important; }
  body { padding: 0 !important; }
  .shell { display: block; }
}
.hero-search-btn svg { flex: none; }
.search-input:focus ~ .kbd, .search-input:not(:placeholder-shown) ~ .kbd { display: none; }
