/* =========================================================================
   OT27 PZK – arkusz stylów (tryb jasny / ciemny, WCAG 2.1 AA)
   ========================================================================= */

:root, [data-theme="light"] {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --text: #17202c;
  --muted: #4a5565;
  --border: #d3d9e1;
  --primary: #005fbe;
  --primary-hover: #004a94;
  --on-primary: #ffffff;
  --accent: #ffbb0b;
  --accent-text: #8a4b00;
  --link: #0055ab;
  --focus: #c2410c;
  --hero-bg: linear-gradient(135deg, #003f80 0%, #005fbe 100%);
  --hero-text: #ffffff;
  --important-bg: #fff4e0;
  --important-border: #e7a325;
  --ok-bg: #e5f4ea; --ok-text: #155c2e;
  --err-bg: #fbe7e8; --err-text: #9b1c23;
  --warn-bg: #fff3d6; --warn-text: #7a4300;
  --info-bg: #e5effa; --info-text: #0f4277;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 2px 8px rgba(16, 24, 40, .06);
  --radius: 12px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0e141c;
  --surface: #16202b;
  --surface-2: #1c2935;
  --text: #e8eef5;
  --muted: #a8b4c3;
  --border: #2c3b4c;
  --primary: #8ec1f2;
  --primary-hover: #b3d6f7;
  --on-primary: #0b1722;
  --accent: #ffbb0b;
  --accent-text: #ffc93d;
  --link: #93c8ff;
  --focus: #ffb26b;
  --hero-bg: linear-gradient(135deg, #0a2546 0%, #0f3d73 100%);
  --hero-text: #ffffff;
  --important-bg: #2b2112;
  --important-border: #b37b16;
  --ok-bg: #13301f; --ok-text: #9fe0b5;
  --err-bg: #3a1619; --err-text: #ffb3b8;
  --warn-bg: #33270f; --warn-text: #ffd58a;
  --info-bg: #132a42; --info-text: #a9d1fb;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

/* Kolory kategorii */
.cat-blue,  .cat-bg-blue   { --c: #1d5fa8; --c-soft: #e3eefb; }
.cat-red,   .cat-bg-red    { --c: #b0262c; --c-soft: #fbe5e6; }
.cat-green, .cat-bg-green  { --c: #1d6b3a; --c-soft: #e2f3e8; }
.cat-amber, .cat-bg-amber  { --c: #8a4b00; --c-soft: #fdf0d9; }
.cat-purple,.cat-bg-purple { --c: #6b3fa0; --c-soft: #efe7f8; }
.cat-teal,  .cat-bg-teal   { --c: #0e6a6a; --c-soft: #def2f1; }
.cat-slate, .cat-bg-slate  { --c: #3e4a59; --c-soft: #e8ebef; }
[data-theme="dark"] .cat-blue,  [data-theme="dark"] .cat-bg-blue   { --c: #9cc8f7; --c-soft: #1c3048; }
[data-theme="dark"] .cat-red,   [data-theme="dark"] .cat-bg-red    { --c: #ffadb1; --c-soft: #3d1c1f; }
[data-theme="dark"] .cat-green, [data-theme="dark"] .cat-bg-green  { --c: #9be0b2; --c-soft: #173322; }
[data-theme="dark"] .cat-amber, [data-theme="dark"] .cat-bg-amber  { --c: #f7c873; --c-soft: #362812; }
[data-theme="dark"] .cat-purple,[data-theme="dark"] .cat-bg-purple { --c: #d3b8f5; --c-soft: #2c2140; }
[data-theme="dark"] .cat-teal,  [data-theme="dark"] .cat-bg-teal   { --c: #8fe0dc; --c-soft: #143433; }
[data-theme="dark"] .cat-slate, [data-theme="dark"] .cat-bg-slate  { --c: #c5cfdb; --c-soft: #26313d; }

/* ---------- Podstawy ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 1.0625rem; line-height: 1.6;
  transition: background-color .2s, color .2s;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-underline-offset: .15em; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: clamp(1.75rem, 1.3rem + 2vw, 2.5rem); }
h2 { font-size: clamp(1.3rem, 1.1rem + .9vw, 1.65rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .92em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
main:focus { outline: none; }

.container { width: min(1180px, 100% - 2.5rem); margin-inline: auto; }
.narrow { max-width: 640px; }
.section { padding-block: 2rem; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.empty { padding: 2rem; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { margin-bottom: .35rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.icon { width: 1.25em; height: 1.25em; flex-shrink: 0; vertical-align: -.2em; }
.icon-sm { width: 1.05em; height: 1.05em; }
.icon-xs { width: .9em; height: .9em; vertical-align: -.1em; }

.skip-link { position: absolute; left: 1rem; top: -100px; z-index: 1000; background: var(--accent); color: #111; padding: .75rem 1.25rem; font-weight: 700; border-radius: 0 0 8px 8px; }
.skip-link:focus { top: 0; }

/* ---------- Nagłówek ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .7rem; }
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--text); }
.brand-logo { height: 56px; width: auto; }
[data-theme="dark"] .brand img { background: #fff; border-radius: 10px; padding: 3px 5px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 800; font-size: 1.05rem; }
.brand-sub { font-size: .85rem; color: var(--muted); }
.header-tools { display: flex; align-items: center; gap: .6rem; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }

/* Suwak trybu jasny/ciemny */
.theme-switch { background: none; border: 0; padding: 4px; cursor: pointer; border-radius: 999px; color: var(--text); }
.theme-switch .track { display: block; width: 60px; height: 32px; border-radius: 999px; background: #c9d3de; position: relative; transition: background .2s; border: 1px solid var(--border); }
.theme-switch .thumb { position: absolute; top: 2px; left: 2px; width: 26px; height: 26px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; color: #a15c00; }
.theme-switch .thumb .icon { width: 16px; height: 16px; grid-area: 1 / 1; }
.theme-switch .i-moon { opacity: 0; }
.theme-switch[aria-checked="true"] .track { background: #3d5a7a; }
.theme-switch[aria-checked="true"] .thumb { transform: translateX(28px); background: #0e141c; color: #ffbb0b; }
.theme-switch[aria-checked="true"] .i-sun { opacity: 0; }
.theme-switch[aria-checked="true"] .i-moon { opacity: 1; }
html:not(.js) .theme-switch { display: none; }

/* Menu */
.nav-toggle { display: none; }
.nav-toggle .i-close { display: none; }
.nav-toggle[aria-expanded="true"] .i-open { display: none; }
.nav-toggle[aria-expanded="true"] .i-close { display: inline; }
.main-nav { border-top: 1px solid var(--border); }
.main-nav > .container { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.menu { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; }
.menu > li { position: relative; display: flex; align-items: center; }
.menu-link { display: inline-flex; align-items: center; gap: .35rem; padding: .8rem .75rem; color: var(--text); text-decoration: none; font-weight: 600; font-size: .98rem; }
.menu-link:hover, .menu-link.is-active { color: var(--link); box-shadow: inset 0 -3px 0 var(--accent); }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; }
.sub-toggle { background: none; border: 0; color: var(--muted); padding: .4rem .2rem; margin-left: -.5rem; cursor: pointer; border-radius: 6px; display: inline-flex; }
.sub-toggle .icon { width: 1rem; height: 1rem; transition: transform .2s; }
.sub-toggle[aria-expanded="true"] .icon { transform: rotate(180deg); }
.submenu { list-style: none; margin: 0; padding: .5rem; position: absolute; top: 100%; left: 0; min-width: 270px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); display: none; z-index: 60; }
.has-sub.is-open > .submenu { display: block; }
html:not(.js) .has-sub:hover > .submenu, html:not(.js) .has-sub:focus-within > .submenu { display: block; }
.submenu a { display: flex; align-items: center; gap: .5rem; padding: .55rem .75rem; border-radius: 8px; color: var(--text); text-decoration: none; }
.submenu a:hover, .submenu a[aria-current="page"] { background: var(--surface-2); color: var(--link); }
.dot { width: .65rem; height: .65rem; border-radius: 50%; background: var(--c); display: inline-block; flex-shrink: 0; }
.inline-form { display: inline; margin: 0; }

@media (max-width: 960px) {
  .nav-toggle { display: inline-flex; }
  html.js .main-nav { display: none; }
  html.js .main-nav.is-open { display: block; }
  .main-nav > .container { flex-direction: column; align-items: stretch; padding-block: .5rem; }
  .menu { flex-direction: column; align-items: stretch; }
  .menu > li { flex-wrap: wrap; justify-content: space-between; border-bottom: 1px solid var(--border); }
  .menu-link { flex: 1; padding: .85rem .25rem; }
  .menu-link:hover, .menu-link.is-active { box-shadow: none; }
  .sub-toggle { width: 44px; height: 44px; justify-content: center; margin: 0; }
  .submenu { position: static; box-shadow: none; border: 0; width: 100%; padding: 0 0 .5rem .5rem; min-width: 0; }
  .brand-sub { display: none; }
}

/* ---------- Komunikaty ---------- */
.flashes { padding-top: 1rem; }
.alert { padding: .9rem 1.1rem; border-radius: 10px; margin-bottom: 1rem; border-left: 5px solid currentColor; }
.alert-success { background: var(--ok-bg); color: var(--ok-text); }
.alert-error { background: var(--err-bg); color: var(--err-text); }
.alert-warning { background: var(--warn-bg); color: var(--warn-text); }
.alert-info { background: var(--info-bg); color: var(--info-text); }
.alert a { color: inherit; font-weight: 700; }

/* ---------- Pasek „Ważne” ---------- */
.important-bar { background: var(--important-bg); border-bottom: 2px solid var(--important-border); }
.important-inner { display: flex; gap: 1rem; align-items: flex-start; padding-block: .7rem; }
.important-label { font-size: .95rem; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-text); margin: .1rem 0 0; display: flex; gap: .35rem; align-items: center; white-space: nowrap; }
.important-bar ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .2rem; }
.important-bar a { font-weight: 700; color: var(--text); }

/* ---------- Hero ---------- */
.hero { background: var(--hero-bg); color: var(--hero-text); overflow: hidden; }
.hero-inner { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2rem; align-items: center; padding-block: 3rem; }
.hero h1 { color: #fff; margin-bottom: .5rem; }
.hero .accent { color: var(--accent); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .85rem; font-weight: 700; opacity: .9; margin-bottom: .4rem; }
.lead { font-size: 1.15rem; max-width: 60ch; }
.hero .lead { color: #e6eef7; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.hero .btn-ghost { color: #fff; border-color: rgba(255,255,255,.7); }
.hero .btn-ghost:hover { background: rgba(255,255,255,.12); }
.hero .btn-primary { background: var(--accent); color: #1a1205; border-color: var(--accent); }
.hero .btn-primary:hover { background: #ffcd45; }
.hero-wave { height: 220px; background:
  radial-gradient(circle at 50% 100%, transparent 38px, rgba(255,187,11,.85) 39px, rgba(255,187,11,.85) 43px, transparent 44px),
  radial-gradient(circle at 50% 100%, transparent 78px, rgba(255,187,11,.55) 79px, rgba(255,187,11,.55) 83px, transparent 84px),
  radial-gradient(circle at 50% 100%, transparent 118px, rgba(255,255,255,.35) 119px, rgba(255,255,255,.35) 123px, transparent 124px),
  radial-gradient(circle at 50% 100%, transparent 158px, rgba(255,255,255,.2) 159px, rgba(255,255,255,.2) 163px, transparent 164px);
}
@media (max-width: 760px) { .hero-inner { grid-template-columns: 1fr; padding-block: 2rem; } .hero-wave { display: none; } }

/* ---------- Przyciski ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 44px; padding: .55rem 1.1rem; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--err-text); border-color: currentColor; background: transparent; }
.btn-danger:hover { background: var(--err-bg); }
.btn-small { min-height: 36px; padding: .35rem .8rem; font-size: .92rem; }
.btn-block { width: 100%; }

/* ---------- Sekcje / kafelki ---------- */
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.section-title { position: relative; padding-left: .9rem; }
.section-title::before { content: ""; position: absolute; left: 0; top: .15em; bottom: .15em; width: 5px; border-radius: 3px; background: var(--accent); }
.more { font-weight: 600; display: inline-flex; gap: .3rem; align-items: center; }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.tile { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: .85rem; height: 100%; padding: 1.1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.tile:hover { border-color: var(--primary); transform: translateY(-2px); }
.tile-icon { grid-row: span 2; width: 2.4rem; height: 2.4rem; padding: .45rem; border-radius: 10px; background: var(--surface-2); color: var(--primary); }
.tile-label { font-weight: 700; color: var(--link); }
.tile-desc { font-size: .92rem; color: var(--muted); }

/* Życzenia */
.greeting { padding-top: 2rem; }
.greeting-card { background: var(--surface); border: 2px solid var(--accent); border-radius: var(--radius); overflow: hidden; display: grid; box-shadow: var(--shadow); }
.greeting-card.has-image { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.greeting-card img { width: 100%; height: 100%; object-fit: cover; max-height: 420px; }
.greeting-text { padding: 1.5rem; align-self: center; }
.greeting-text h2 { display: flex; gap: .5rem; align-items: center; color: var(--accent-text); }
@media (max-width: 760px) { .greeting-card.has-image { grid-template-columns: 1fr; } }

/* ---------- Karty aktualności ---------- */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0 1.5rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .85rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font-size: .93rem; font-weight: 600; min-height: 36px; }
.chip:hover, .chip.is-active { border-color: var(--primary); color: var(--link); }
.chip.is-active { box-shadow: inset 0 0 0 1px var(--primary); }
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.card { position: relative; display: flex; flex-direction: column; height: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.card:hover, .card:focus-within { border-color: var(--primary); transform: translateY(-2px); }
.card-media { aspect-ratio: 16 / 9; background: linear-gradient(135deg, var(--c-soft), var(--surface-2)); display: grid; place-items: center; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-placeholder .icon { width: 3.5rem; height: 3.5rem; color: var(--c); opacity: .8; }
.card-body { padding: 1rem 1.15rem 1.25rem; display: flex; flex-direction: column; gap: .35rem; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .88rem; color: var(--muted); margin: 0; }
.card-title { margin: 0; font-size: 1.15rem; }
.card-title a { color: var(--text); text-decoration: none; }
.card-title a:hover { color: var(--link); text-decoration: underline; }
.stretched::after { content: ""; position: absolute; inset: 0; }
.card-excerpt { color: var(--muted); margin: 0; font-size: .97rem; }
.card-featured { flex-direction: row; margin-bottom: 1.25rem; }
.card-featured .card-media { flex: 1.2; aspect-ratio: auto; min-height: 260px; }
.card-featured .card-body { flex: 1; padding: 1.5rem; justify-content: center; }
.card-featured .card-title { font-size: 1.5rem; }
@media (max-width: 760px) { .card-featured { flex-direction: column; } .card-featured .card-media { min-height: 180px; } }
.badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; background: var(--c-soft); color: var(--c); font-weight: 700; font-size: .8rem; text-decoration: none; position: relative; z-index: 1; }
.pin { font-size: .78rem; font-weight: 700; color: var(--accent-text); border: 1px solid currentColor; border-radius: 999px; padding: 0 .5rem; }

/* ---------- Podstrony ---------- */
.page-head { padding-top: 1.5rem; }
.breadcrumbs ol { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem; font-size: .9rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "›"; margin-right: .35rem; }
.article { max-width: 820px; padding-block: 1.5rem 3rem; }
.article-head h1 { margin-top: .5rem; }
.article-cover { margin: 0 0 1.5rem; }
.article-cover img { border-radius: var(--radius); width: 100%; }
.page-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 2.5rem; }
.side-nav { margin-top: 4.5rem; align-self: start; position: sticky; top: 8rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.side-nav h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.side-nav ul { list-style: none; margin: 0; padding: 0; }
.side-nav a { display: block; padding: .45rem .6rem; border-radius: 8px; text-decoration: none; }
.side-nav a[aria-current="page"] { background: var(--surface-2); font-weight: 700; color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
@media (max-width: 960px) { .page-layout { grid-template-columns: 1fr; } .side-nav { margin-top: 0; position: static; } }

.prose { overflow-wrap: anywhere; }
.prose > *:last-child { margin-bottom: 0; }
.prose h2 { margin-top: 1.6em; }
.prose h3 { margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1em; }
.prose li { margin-bottom: .3em; }
.prose blockquote { margin: 1.2em 0; padding: .6em 1.1em; border-left: 4px solid var(--accent); background: var(--surface-2); border-radius: 0 8px 8px 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 1em 0 1.5em; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: .55em .8em; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); }
.prose img { border-radius: 8px; margin: 1em 0; }

.article-links, .related, .gallery { margin-top: 2.5rem; }
.article-links h2, .related h2, .gallery h2 { font-size: 1.2rem; display: flex; gap: .4rem; align-items: center; }
.article-links ul, .related ul { padding-left: 1.2em; }
.gallery ul { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .75rem; }
.gallery img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; border-radius: 8px; }
.gallery a:hover img { opacity: .9; }

/* Dokumenty */
.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--border); margin-bottom: 1.25rem; }
.tab { padding: .65rem 1rem; text-decoration: none; color: var(--muted); font-weight: 700; border-bottom: 3px solid transparent; margin-bottom: -2px; display: inline-flex; gap: .35rem; align-items: center; }
.tab.is-active { color: var(--text); border-color: var(--accent); }
.filter-bar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-bottom: 1.25rem; padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.filter-bar .field { margin: 0; min-width: 200px; flex: 1; }
.doc-group h2 { font-size: 1.2rem; margin-top: 1.5rem; }
.count { color: var(--muted); font-weight: 400; font-size: .95rem; }
.doc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.doc-item { display: flex; align-items: center; gap: 1rem; padding: .85rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.doc-ext { flex-shrink: 0; width: 3.2rem; height: 3.2rem; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); color: var(--primary); font-weight: 800; font-size: .8rem; border: 1px solid var(--border); }
.doc-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.doc-title { font-weight: 700; }
.doc-desc { font-size: .92rem; color: var(--muted); }
@media (max-width: 560px) { .doc-item { flex-wrap: wrap; } .doc-item .btn { width: 100%; } }

/* Wyszukiwarka */
.search-form { display: flex; gap: .6rem; max-width: 640px; }
.search-form input { flex: 1; }
.results { list-style: none; padding: 0; margin: 0 0 2rem; }
.results li { padding: .9rem 0; border-bottom: 1px solid var(--border); }
.results a { font-weight: 700; font-size: 1.05rem; }
.results p { margin: .3rem 0 0; color: var(--muted); }
mark { background: #ffe08a; color: #1a1205; padding: 0 .1em; border-radius: 3px; }

.pagination ul { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; padding: 0; margin: 2rem 0 0; }
.pagination a, .pagination span { display: inline-flex; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; padding: 0 .8rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); text-decoration: none; }
.pagination span[aria-current] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); font-weight: 700; }

.error-page { text-align: center; }
.error-code { font-size: 5rem; font-weight: 800; color: var(--accent-text); margin: 0; line-height: 1; }

/* ---------- Formularze ---------- */
.form { display: flex; flex-direction: column; gap: 1.1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label, .field-check label { font-weight: 600; }
input[type=text], input:not([type]), input[type=email], input[type=password], input[type=search], input[type=number], input[type=date], input[type=datetime-local], input[type=url], select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1.5px solid #8794a4; border-radius: 8px; padding: .6rem .75rem; min-height: 44px; width: 100%;
}
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { border-color: #5d6f84; }
input[type=file] { font: inherit; color: var(--text); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--primary); }
[aria-invalid="true"] { border-color: var(--err-text) !important; }
.field-check { display: flex; gap: .6rem; align-items: flex-start; }
.field-check input { width: 1.25rem; height: 1.25rem; margin-top: .2rem; flex-shrink: 0; accent-color: var(--primary); }
.field-check label { font-weight: 400; }
.hint { font-size: .9rem; color: var(--muted); margin: 0; }
.field-error { color: var(--err-text); font-weight: 600; font-size: .93rem; margin: 0; display: flex; gap: .3rem; align-items: center; }
.req { color: var(--err-text); }
.meta-list { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; margin: 0 0 2rem; }
.meta-list dt { font-weight: 700; }
.meta-list dd { margin: 0; }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; margin: 0; display: flex; flex-direction: column; gap: .8rem; }
.fieldset legend { font-weight: 700; padding: 0 .4rem; }

/* ---------- Stopka ---------- */
.site-footer { margin-top: 3rem; background: var(--surface); border-top: 4px solid var(--accent); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 2rem; padding-block: 2.5rem 1.5rem; }
.footer-title { font-weight: 800; margin-bottom: .5rem; }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; border-top: 1px solid var(--border); padding-block: 1rem; font-size: .9rem; color: var(--muted); }
.footer-bottom p { margin: 0; }

/* =========================================================================
   Panel CMS
   ========================================================================= */
.admin-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .6rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40; }
.admin-wrap { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: calc(100vh - 60px); }
.admin-nav { background: var(--surface); border-right: 1px solid var(--border); padding: 1rem .6rem; }
.admin-nav ul { list-style: none; margin: 0; padding: 0; position: sticky; top: 76px; }
.admin-nav a { display: flex; align-items: center; gap: .55rem; padding: .6rem .75rem; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 600; }
.admin-nav a:hover { background: var(--surface-2); }
.admin-nav a[aria-current="page"] { background: var(--surface-2); color: var(--link); box-shadow: inset 3px 0 0 var(--accent); }
.pill { margin-left: auto; background: var(--err-text); color: var(--surface); border-radius: 999px; padding: 0 .5rem; font-size: .8rem; }
.admin-main { padding: 1.5rem 2rem 4rem; min-width: 0; }
.admin-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.admin-head h1 { margin: 0; }
@media (max-width: 860px) {
  .admin-wrap { grid-template-columns: 1fr; }
  .admin-nav { border-right: 0; border-bottom: 1px solid var(--border); }
  .admin-nav ul { position: static; display: flex; flex-wrap: wrap; gap: .25rem; }
  .admin-main { padding: 1rem; }
}
.stats { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; }
.stats li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; color: var(--muted); }
.stats .stat-warn { border-color: var(--important-border); background: var(--important-bg); }
.stat-num { display: block; font-size: 2rem; font-weight: 800; color: var(--text); line-height: 1.1; }
.actions-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; align-items: center; }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; font-size: .96rem; }
.table th, .table td { padding: .7rem .8rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table thead th { background: var(--surface-2); font-size: .88rem; text-transform: uppercase; letter-spacing: .03em; }
.table .row-highlight { background: var(--important-bg); }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions > * { margin-left: .25rem; }
@media (max-width: 860px) { .table { display: block; overflow-x: auto; } }
.status { font-size: .82rem; font-weight: 700; padding: .1rem .55rem; border-radius: 999px; white-space: nowrap; }
.status-published, .status-active { background: var(--ok-bg); color: var(--ok-text); }
.status-draft, .status-disabled { background: var(--surface-2); color: var(--muted); }
.status-pending { background: var(--warn-bg); color: var(--warn-text); }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.5rem; align-items: start; }
.form-main { display: flex; flex-direction: column; gap: 1.1rem; min-width: 0; }
.form-side { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 76px; }
@media (max-width: 1100px) { .form-grid { grid-template-columns: 1fr; } .form-side { position: static; } }
.narrow-form { max-width: 680px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; gap: .9rem; }
.panel-title { font-size: 1.05rem; margin: 0; }
.cover-preview { border-radius: 8px; max-height: 180px; object-fit: cover; width: 100%; }
.danger-zone { margin-top: 2rem; padding: 1rem; border: 1px solid var(--err-text); border-radius: var(--radius); display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.danger-zone h2 { width: 100%; font-size: 1.05rem; margin: 0; }
.temp-password code { font-size: 1.5rem; padding: .5rem 1rem; display: inline-block; letter-spacing: .05em; user-select: all; }
.link-rows { display: flex; flex-direction: column; gap: .6rem; }
.link-row { display: grid; grid-template-columns: 1fr 1.4fr; gap: .6rem; }
@media (max-width: 600px) { .link-row { grid-template-columns: 1fr; } }
.admin-gallery { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem; }
.admin-gallery li { border: 1px solid var(--border); border-radius: 8px; padding: .5rem; display: flex; flex-direction: column; gap: .4rem; }
.admin-gallery img { aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; }
.cat-row { margin-bottom: 1rem; }
.cat-fields { display: flex; flex-wrap: wrap; gap: .75rem; }
.cat-fields .field { min-width: 150px; }
.cat-fields .grow { flex: 1; min-width: 240px; }

/* Edytor */
.editor-toolbar { display: flex; flex-wrap: wrap; gap: .2rem; padding: .35rem; background: var(--surface-2); border: 1.5px solid #8794a4; border-bottom: 0; border-radius: 8px 8px 0 0; }
.tb-btn { min-width: 38px; height: 38px; border: 1px solid transparent; background: transparent; color: var(--text); border-radius: 6px; cursor: pointer; font: inherit; font-weight: 700; font-size: .9rem; }
.tb-btn:hover { background: var(--surface); border-color: var(--border); }
.tb-btn[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.tb-i span { font-style: italic; } .tb-u span { text-decoration: underline; } .tb-s span { text-decoration: line-through; }
.tb-sep { width: 1px; background: var(--border); margin: .3rem .2rem; }
.editor-area { min-height: 320px; max-height: 70vh; overflow-y: auto; padding: 1rem; background: var(--surface); border: 1.5px solid #8794a4; border-radius: 0 0 8px 8px; }
.editor-area:focus { outline: 3px solid var(--focus); outline-offset: 1px; }
.editor textarea.editor-source:not([hidden]) { border-radius: 0 0 8px 8px; font-family: ui-monospace, Consolas, monospace; font-size: .9rem; min-height: 320px; }

/* ---------- Ruch ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .site-header, .site-footer, .skip-link, .chips, .pagination, .important-bar { display: none !important; }
  body { background: #fff; color: #000; }
}

.admin-top .brand img { height: 40px; width: auto; }
@media (max-width: 960px) { .brand-logo { height: 46px; } }

.hero-logo { justify-self: center; background: #fff; border-radius: 28px; padding: 1.25rem; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: 300px; }
.hero-logo img { width: 100%; height: auto; }
@media (max-width: 760px) { .hero-logo { display: none; } }
