
  .main-nav { display: flex; gap: 2px; align-items: center; }
  .main-nav a { padding: 7px 11px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: .92rem; text-decoration: none; white-space: nowrap; }
  .main-nav a:hover { color: var(--text); background: color-mix(in srgb, var(--text) 7%, transparent); }
  .main-nav a[aria-current] { color: var(--text); background: color-mix(in srgb, var(--accent) 16%, transparent); }
  .topbar .main-nav { flex: 0 0 auto; }
  /* z menu działów wyszukiwarka nie może już wisieć absolutnie na środku – byłaby nad linkami */
  @media (min-width: 1181px) { .topbar .pdfowo-search { position: relative; left: auto; top: auto; transform: none; flex: 1 1 auto; width: auto; min-width: 0; max-width: 560px; margin: 0 auto; } }
  @media (max-width: 1180px) {
    .topbar .in { flex-wrap: wrap; height: auto; row-gap: 4px; padding-top: 8px; padding-bottom: 6px; }
    .topbar .main-nav { order: 50; flex-basis: 100%; justify-content: center; }
  }
  .tpl-work > *, .tpl-group, .tpl-field { min-width: 0; }
  .hx-tpl .hx-more, .hx-guides .hx-more { margin-top: 26px !important; }
  .tpl-mode { margin: 0 0 14px; }
  .tpl-work { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 22px; align-items: start; }
  @media (max-width: 900px) { .tpl-work { grid-template-columns: 1fr; } }
  .tpl-form.off { opacity: .45; pointer-events: none; }
  .tpl-group { margin: 0 0 14px; padding: 12px 14px 4px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
  .tpl-group legend { padding: 0 6px; font-weight: 700; }
  .tpl-group[hidden] { display: none; }
  .tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
  .tpl-field { grid-column: 1 / -1; display: grid; gap: 4px; margin: 0 0 10px; }
  .tpl-field.half { grid-column: auto; }
  @media (max-width: 520px) { .tpl-field.half { grid-column: 1 / -1; } }
  .tpl-field[hidden], .tpl-check[hidden] { display: none; }
  .tpl-field label { font-size: .85rem; color: var(--muted); }
  .tpl-field label em { font-style: normal; color: var(--accent); font-size: .78rem; }
  .tpl-field input, .tpl-field select, .tpl-field textarea { width: 100%; box-sizing: border-box; margin: 0; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; }
  .tpl-field input:focus, .tpl-field select:focus, .tpl-field textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; }
  .tpl-check { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; margin: 0 0 10px; font-size: .92rem; }
  .tpl-check input { accent-color: var(--accent); margin: 0; }
  #tool-template > .container { max-width: 1480px; padding-top: 12px; }
  @media (min-width: 901px) { .tpl-work { grid-template-columns: minmax(340px, 1fr) minmax(0, 1.1fr); gap: 28px; } }
  #tool-template .toolhead.tpl-head { text-align: left; max-width: none; margin: 0 0 16px; }
  #tool-template .tpl-head h1, #tool-template .tpl-head .xh1 { font-size: clamp(1.45rem, 2.2vw, 1.9rem); margin: 0 0 8px; }
  #tool-template .tpl-head p { margin: 0; }
  .tpl-prevwrap { position: sticky; top: 14px; display: flex; flex-direction: column; align-items: center; }
  /* kartka A4: szerokość ograniczona tak, by cała strona (z paskiem pod spodem) była widoczna już po wejściu na stronę */
  .tpl-paper { --tpl-off: 196px; width: min(100%, calc((100vh - var(--tpl-off)) * 0.7071)); width: min(100%, calc((100dvh - var(--tpl-off)) * 0.7071)); aspect-ratio: 210 / 297; }
  .tpl-sheet { display: block; width: 100%; height: 100%; border-radius: 3px; box-shadow: 0 6px 26px rgba(0,0,0,.32); }
  body.light-theme .tpl-sheet { box-shadow: 0 4px 22px rgba(0,0,0,.14), 0 0 0 1px rgba(0,0,0,.06); }
  .tpl-sheet text { font-family: "PDFowoTplSerif", "Liberation Serif", "Times New Roman", Times, serif; fill: #141419; font-kerning: none; white-space: pre; }
  .tpl-bar { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; margin-top: 12px; }
  .tpl-pager { display: flex; align-items: center; gap: 8px; margin-right: 6px; font-weight: 600; font-variant-numeric: tabular-nums; }
  .tpl-pager[hidden] { display: none; }
  .tpl-pager button { min-width: 38px; padding: 7px 10px; }
  #tplmsg { min-height: 1.3em; margin-top: 6px; text-align: center; }
  /* nagłówek w dwóch wierszach (menu działów pod spodem) */
  @media (max-width: 1180px) { .tpl-paper { --tpl-off: 228px; } }
  @media (max-width: 900px) { .tpl-prevwrap { position: static; } .tpl-paper { width: min(100%, 620px); } }
  .tpl-note { margin: 12px 0 0; }
  #tplmsg.ok { color: var(--ok, #1a7f4b); } #tplmsg.error { color: var(--error, #d92d20); }
  .tpl-article { margin: 34px auto 0; }
  .tpl-next { margin: 0 0 34px; }
  .tpl-next h2 { margin-top: 0; }
  .tpl-next-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
  .tpl-next-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 16px 40px 16px 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
  .tpl-next-card:hover { border-color: var(--accent); transform: translateY(-1px); }
  .tpl-next-card strong { font-size: 1rem; line-height: 1.35; }
  .tpl-next-card span { color: var(--muted); font-size: .9rem; line-height: 1.5; }
  .tpl-next-card .tpl-next-arrow { position: absolute; right: 16px; top: 16px; color: var(--muted); font-size: 1.1rem; }
  @media (prefers-reduced-motion: reduce) { .tpl-next-card { transition: none; } }
  .tpl-nextlink { font-weight: 700; color: inherit; }
  .tpl-disclaimer { margin: 22px 0; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); color: var(--muted); font-size: .9rem; }
  #article .tpl-disclaimer { padding: 0; border: 0; border-radius: 0; background: none; }   /* spis wzorów: zwykły tekst, bez ramki (nie wygląda jak kolejny kafelek) */
  .hx-tpl, .hx-guides { margin-top: 56px; text-align: center; }
  .hx-tpl-grid { text-align: left; }
  .hx-tpl .hx-tpl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  @media (max-width: 900px) { .hx-tpl .hx-tpl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  @media (max-width: 560px) { .hx-tpl .hx-tpl-grid { grid-template-columns: 1fr; } }
  .hx-tpl-card { display: block; color: var(--text); text-decoration: none; }
  .hx-tpl-card h3 { margin: 12px 0 6px; font-size: 1.02rem; }
  .hx-more { margin: 22px 0 0; }
  .hx-more a { display: inline-flex; padding: 11px 18px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-weight: 700; text-decoration: none; }
  .hx-more a:hover { border-color: var(--accent); }
