/* =========================================================
   Technika i USC – style portalu (wariant B)
   ========================================================= */

:root {
  --ink: #17202A;
  --text-2: #3A444F;
  --muted: #4B5560;
  --line: #D8DCE0;
  --line-soft: #DFE2E6;
  --line-strong: #C9CFD4;
  --field: #9AA3AC;
  --bg: #F2F2F2;   /* jasne tło stron; karty, pola i ramki zostają białe */
  --bg-soft: #F2F3F5;
  --bg-reader: #E4E6E8;
  --accent: #166a57;
  --accent-hover: #0F4D3F;
  --accent-tint: #EEF3F0;
  --accent-soft: #E3F0EA;
  --brand-blue: #3D6FB6;
  --brand-navy: #1F2D4A;
  --error: #B42318;
  --error-dark: #8F1D16;
  --error-bg: #FDF3F2;
  --error-line: #E9B8B2;
  --warn-bg: #FFF4E5;
  --warn-line: #F0C98A;

  --font-sans: 'Source Sans 3 Variable', 'Source Sans 3', system-ui, sans-serif;
  --font-serif: 'Source Serif 4 Variable', 'Source Serif 4', Georgia, serif;
  --font-logo: 'Roboto Condensed Variable', 'Roboto Condensed', 'Arial Narrow', sans-serif;

  --container: 1200px;
  --gutter: 20px;
  --radius: 4px;
  --header-h: 206px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.55;
}
img { max-width: 100%; }
h1, h2, h3 { text-wrap: balance; }
::selection { background: #CFE3DA; color: var(--ink); }

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

[id] { scroll-margin-top: 96px; }

.container { max-width: var(--container); margin: 0 auto; padding-inline: var(--gutter); }
.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;
}
.serif { font-family: var(--font-serif); }
.muted { color: var(--muted); }

/* --- Link „Przejdź do treści” --- */
.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--ink); color: #FFFFFF; padding: 10px 16px; border-radius: var(--radius);
  font-weight: 700; text-decoration: none;
}
.skip-link:focus { left: 16px; color: #FFFFFF; }

/* =========================================================
   Przyciski i pola
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: var(--radius);
  font: inherit; font-size: 17px; font-weight: 700; line-height: 1.2;
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #FFFFFF; }
.btn-primary:hover { background: var(--accent-hover); color: #FFFFFF; }
.btn-outline { background: #FFFFFF; color: var(--ink); border-color: var(--ink); font-weight: 600; }
.btn-outline:hover { background: var(--bg-soft); color: var(--ink); }
.btn-quiet { background: #FFFFFF; color: var(--ink); border-color: var(--field); font-weight: 600; }
.btn-quiet:hover { background: var(--bg-soft); color: var(--ink); }
.btn-block { width: 100%; }
.btn-sm { min-height: 44px; padding: 0 16px; font-size: 15px; }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--bg-soft); color: var(--muted); border-color: var(--line-strong); cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-weight: 600; font-size: 16px; }
.input {
  height: 48px; padding: 0 14px; min-width: 0; width: 100%;
  border: 2px solid var(--ink); border-radius: var(--radius);
  font: inherit; font-size: 17px; color: var(--ink); background: #FFFFFF;
}
.input[readonly] { border: 1px solid var(--line); background: var(--bg-soft); }
.input[aria-invalid="true"], .field-group[data-invalid="true"] { border-color: var(--error); }
.field-group {
  display: flex; align-items: stretch; border: 2px solid var(--ink); border-radius: var(--radius);
  overflow: hidden; background: #FFFFFF;
}
.field-group:focus-within { outline: 3px solid var(--ink); outline-offset: 2px; }
.field-group .input { border: 0; height: 48px; }
.field-group .input:focus-visible { outline: none; }
.field-group button {
  flex: 0 0 auto; min-width: 72px; border: 0; border-left: 1px solid var(--line);
  background: #FFFFFF; padding: 0 14px; font: inherit; font-size: 15px; font-weight: 600; color: var(--ink); cursor: pointer;
}
.field-error { margin: 0; font-size: 15px; font-weight: 600; color: var(--error); }
.field-hint { font-size: 15px; color: var(--muted); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 16px; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: 0 0 20px; accent-color: var(--accent); }

.alert { border-radius: var(--radius); padding: 14px 16px; display: flex; gap: 10px; align-items: flex-start; }
.alert svg { flex: 0 0 20px; margin-top: 3px; }
.alert-error { border: 1px solid var(--error-line); background: var(--error-bg); }
.alert-error svg { color: var(--error); }
.alert-warn { border: 1px solid var(--warn-line); background: var(--warn-bg); }
.alert p { margin: 0; }
.alert-title { font-weight: 700; color: var(--error-dark); }

.inline-form { display: inline; margin: 0; }
.link-button { border: 0; padding: 0; background: none; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.topbar .link-button { color: var(--accent); font-weight: 600; text-decoration: none; }
.topbar .link-button:hover { text-decoration: underline; }
.menu-panel .link-button { display: block; padding: 12px 0; text-decoration: none; }

.tag-link { color: var(--accent); font-weight: 600; text-decoration: underline dotted; text-underline-offset: 3px; }

/* =========================================================
   Nagłówek (przyklejony, zwija się przy przewijaniu)
   ========================================================= */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: var(--header-bg, var(--bg-soft)); border-bottom: 1px solid #A9B4B9;
  box-shadow: 0 3px 14px rgba(23, 32, 42, 0.11);
  transition: box-shadow .35s ease;
}
.site-header.is-compact { box-shadow: 0 6px 20px rgba(23, 32, 42, 0.18); }
.header-spacer { height: var(--header-h); }

.topbar { border-bottom: 1px solid var(--line-soft); max-height: 80px; overflow: hidden;
  transition: max-height .35s ease, opacity .25s ease, border-color .35s ease; }
.is-compact .topbar { max-height: 0; opacity: 0; border-bottom-color: transparent; }
.topbar .container { padding-block: 8px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.topbar strong { color: var(--ink); }
.topbar-links { display: flex; gap: 20px; align-items: center; }
.topbar-links a { color: var(--muted); }
.topbar-links .topbar-primary { color: var(--accent); font-weight: 600; }
.topbar-badge { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #FFFFFF; background: var(--ink); border-radius: 3px; padding: 2px 8px; }

.masthead { padding-top: 16px; transition: padding .35s ease; }
.is-compact .masthead { padding-top: 8px; padding-bottom: 8px; }
.mast { position: relative; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.mast-line {
  position: absolute; left: -26px; bottom: 20px; height: 3px; width: calc(100% + 26px);
  background: var(--brand-blue); pointer-events: none;
  transition: width .35s ease, left .35s ease, bottom .35s ease, height .35s ease;
}
.is-compact .mast-line { left: -16px; bottom: 12px; height: 2px; width: 146px !important; }
.logo-link { position: relative; z-index: 1; display: block; text-decoration: none; }
.logo { display: block; overflow: visible; width: 241px; height: 76px; margin-left: -26px;
  transition: width .35s ease, height .35s ease, margin .35s ease; }
.is-compact .logo { width: 146px; height: 46px; margin-left: -16px; }

.mast-tools { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; flex: 0 1 400px; min-width: 240px;
  margin-bottom: 30px; transition: margin .35s ease; }
.is-compact .mast-tools { margin-bottom: 0; }
.search {
  display: flex; align-items: stretch; flex: 1 1 auto; min-width: 0;
  border: 1px solid var(--field); border-radius: var(--radius); overflow: hidden; background: #FFFFFF;
}
.search:focus-within { outline: 3px solid var(--ink); outline-offset: 2px; }
.search input { flex: 1 1 auto; min-width: 0; height: 44px; padding: 0 14px; border: 0; font: inherit; font-size: 16px; color: var(--ink); }
.search input:focus-visible { outline: none; }
.search button { width: 48px; border: 0; border-left: 1px solid var(--field); background: #F4F5F3; color: var(--ink); cursor: pointer; display: flex; align-items: center; justify-content: center; }

.burger {
  flex: 0 0 auto; height: 46px; padding: 0; border: 1px solid var(--ink); border-radius: var(--radius);
  background: #FFFFFF; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; overflow: hidden;
  font: inherit; font-size: 16px; font-weight: 600; white-space: nowrap;
  width: 0; opacity: 0; visibility: hidden; margin-left: -8px;
  transition: width .35s ease, opacity .2s ease, margin .35s ease, visibility 0s linear .35s, background-color .15s ease;
}
/* Stała szerokość mieści i „Menu”, i „Zamknij” – przycisk nie skacze po kliknięciu. */
.is-compact .burger { width: 118px; opacity: 1; visibility: visible; margin-left: 0;
  transition: width .35s ease, opacity .25s ease .1s, margin .35s ease, visibility 0s, background-color .15s ease; }
.burger:hover { background: #EEF1F2; }
.burger svg { flex: 0 0 auto; }
/* Wąski telefon, zwinięty nagłówek: wyszukiwarka zwija się do samej lupy (prowadzi na stronę „Artykuły” z pełnym polem). */
@media (max-width: 420px) {
  .is-compact .burger { width: 96px; gap: 6px; font-size: 15px; }
  .is-compact .mast-tools { justify-content: flex-end; }
  .is-compact .search { flex: 0 0 auto; }
  .is-compact .search input { display: none; }
  .is-compact .search button { width: 46px; height: 44px; border-left: 0; }
}
.burger .icon-close { display: none; }
.burger[aria-expanded="true"] .icon-close { display: block; }
.burger[aria-expanded="true"] .icon-open { display: none; }

.navwrap { max-height: 120px; overflow: hidden; transition: max-height .35s ease, opacity .25s ease; }
.is-compact .navwrap { max-height: 0; opacity: 0; }
.main-nav { display: flex; flex-wrap: wrap; gap: 4px 28px; padding: 10px 0; font-weight: 600; font-size: 16px; }
.main-nav a { color: var(--ink); text-decoration: none; padding: 4px 0; }
.main-nav a:hover { text-decoration: underline; }
.main-nav a[aria-current="page"] { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }

.menu-panel { border-top: 1px solid var(--line-soft); animation: tiuDrop .25s ease; }
.menu-panel[hidden] { display: none; }
.menu-panel ul { list-style: none; margin: 0 auto; padding: 8px var(--gutter) 20px; max-width: var(--container);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); column-gap: 32px; }
.menu-panel li { border-bottom: 1px solid var(--line-soft); }
.menu-panel a, .menu-panel .menu-text { display: block; padding: 12px 0; color: var(--ink); text-decoration: none; font-weight: 600; }
.menu-panel .menu-text { color: var(--muted); font-weight: 400; font-size: 15px; overflow-wrap: anywhere; }
.menu-panel a[aria-current="page"], .menu-panel .menu-primary { color: var(--accent); font-weight: 700; }

@keyframes tiuDrop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* =========================================================
   Stopka
   ========================================================= */
/* Tło: gradient #43575f → #30434a (ciemniej na dole) na całej stopce. Stopka zaczyna się równą krawędzią,
   bez przejścia od tła strony. Biały tekst: kontrast 7,6–10,4:1. */
.site-footer {
  --footer-top: #43575f;
  --footer-bottom: #30434a;
  position: relative; color: #FFFFFF;
  padding-top: 24px;
  background: linear-gradient(180deg, var(--footer-top) 0, var(--footer-bottom) 100%);
}
.site-footer a { color: #FFFFFF; text-decoration-color: rgba(255, 255, 255, .5); }
.site-footer a:hover { color: #FFFFFF; text-decoration-color: #FFFFFF; }
.site-footer :focus-visible { outline-color: #FFFFFF; }
.site-footer ::selection { background: rgba(255, 255, 255, .9); color: var(--ink); }
.site-footer h2 { margin: 0; }

/* Ramka newslettera w jasnej, górnej części stopki (tylko strona główna). */
.site-footer:has(.footer-lead) { padding-top: clamp(32px, 4vw, 48px); }
.footer-lead { color: var(--ink); padding-bottom: clamp(16px, 2vw, 24px); }
.footer-lead a { color: var(--accent); text-decoration-color: currentColor; }
.footer-lead a:hover { color: var(--accent-hover); }
.footer-lead :focus-visible { outline-color: var(--ink); }
.footer-lead ::selection { background: #CFE3DA; color: var(--ink); }
.footer-main { padding-block: 32px 40px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 40px 64px; }

.footer-help { flex: 1 1 480px; max-width: 700px; min-width: 0; }
.footer-help h2 { margin-bottom: 8px; font-family: var(--font-serif); font-size: 26px; line-height: 1.2; font-weight: 600; }
.footer-help > p { margin: 0 0 28px; max-width: 52ch; color: #FFFFFF; }
.footer-contact { display: flex; flex-wrap: wrap; gap: 12px 40px; }
.footer-contact > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.footer-contact-label { font-size: 20px; color: #E3EBED; }
.footer-contact-value { font-family: var(--font-serif); font-size: 26px; line-height: 1.25; font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.footer-contact-value:hover { text-decoration: underline; }
.footer-contact-value.nowrap { white-space: nowrap; }
.footer-help .footer-help-link { margin: 24px 0 0; }
.footer-help-link a { font-weight: 600; }

.footer-navs { display: flex; flex-wrap: wrap; gap: 32px 64px; align-content: start; }
.footer-navs h2 { margin-bottom: 10px; font-family: var(--font-serif); font-size: 24px; line-height: 1.2; font-weight: 600; }
.footer-navs ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.footer-navs a { text-decoration: none; }
.footer-navs a:hover { text-decoration: underline; }

.footer-legal { border-top: 1px solid rgba(255, 255, 255, .22); }
.footer-legal .container { padding-block: 16px 20px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; font-size: 14px; color: #E3EBED; }
.footer-legal .nowrap { white-space: nowrap; }
.footer-legal strong { font-family: var(--font-serif); font-size: 16px; color: #FFFFFF; }

@media (max-width: 640px) {
  .footer-main { padding-block: 24px 32px; }
  .footer-help h2 { font-size: 23px; }
  .footer-contact-label { font-size: 17px; }
  .footer-contact-value { font-size: 23px; }
  .footer-navs { column-gap: 40px; }
  .footer-navs h2 { font-size: 21px; }
}

/* =========================================================
   Wspólne elementy treści
   ========================================================= */
.page-pad { padding-block: clamp(28px, 4vw, 48px) 56px; }
.breadcrumb { padding-top: 20px; font-size: 15px; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.breadcrumb span[aria-hidden] { margin: 0 8px; }
.breadcrumb [aria-current] { color: var(--ink); }

.cover {
  display: block; width: 100%; height: auto; aspect-ratio: 566 / 771; object-fit: cover;
  border: 1px solid var(--line-strong); background: #FBFBFA;
  box-shadow: 0 1px 2px rgba(23, 32, 42, 0.06), 0 8px 24px rgba(23, 32, 42, 0.08);
}
.cover-placeholder {
  aspect-ratio: 566 / 771; background: #FBFBFA; border: 1px solid var(--line-strong);
  display: flex; flex-direction: column;
}
.cover-placeholder .band { background: var(--ink); color: #FFFFFF; padding: 8px 10px; display: flex; justify-content: space-between; align-items: baseline; font-family: var(--font-serif); font-weight: 700; font-size: 12px; }
.cover-placeholder .num { margin-top: auto; align-self: flex-end; padding: 10px; font-family: var(--font-serif); font-size: 64px; line-height: .85; font-weight: 700; color: var(--ink); }

.section-title { margin: 0; font-family: var(--font-serif); font-size: clamp(28px, 3vw, 34px); line-height: 1.2; }
.label-caps { margin: 0 0 4px; font-size: 14px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* --- Strona główna: bieżące wydanie --- */
.current { display: flex; flex-wrap: wrap; gap: clamp(28px, 5vw, 56px); align-items: flex-start; }
.current-cover { flex: 1 1 300px; max-width: 380px; }
.current-body { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.current-body h1 { margin: 0; font-family: var(--font-serif); font-size: clamp(30px, 4.5vw, 44px); line-height: 1.15; letter-spacing: -0.01em; }
.lead { margin: 0; font-size: 19px; color: var(--text-2); max-width: 640px; }

.toc { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.toc li { display: flex; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.toc-pages { flex: 0 0 64px; font-family: var(--font-serif); font-size: 16px; color: var(--muted); }
.toc-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.toc-title { font-family: var(--font-serif); font-size: 20px; font-weight: 600; line-height: 1.3; color: var(--ink); text-decoration: none; }
.toc-meta { font-size: 15px; color: var(--muted); }

.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }

/* --- Archiwum --- */
.archive .container { padding-block: 56px; }
/* Ramka w obrębie kontenera (jak newsletter), a nie pasek na całą szerokość strony. */
.archive-box {
  background: #EEF4F0; border: 1px solid #B7D2C4; border-radius: 16px;
  padding: clamp(24px, 4vw, 40px);
}
.archive-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; margin-bottom: 28px; }
.archive-head .section-title { margin-right: auto; }
.year-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.year-filter a {
  display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border-radius: 20px;
  border: 1px solid var(--field); background: #FFFFFF; color: var(--ink); font-size: 15px; text-decoration: none;
}
.year-filter a[aria-current="true"] { border-color: var(--ink); background: var(--ink); color: #FFFFFF; font-weight: 600; }
/* Archiwum: jedna linia wydań na półce, przewijana w poziomie (licznik, strzałki i pasek w nagłówku sekcji). */
.shelf-nav { display: flex; align-items: center; gap: 8px; padding-left: 20px; border-left: 1px solid #B7D2C4; }
.shelf-nav[hidden] { display: none; }
.shelf-count { min-width: 76px; margin-right: 6px; text-align: right; font-size: 15px; color: #4C5D55; font-variant-numeric: tabular-nums; }
.shelf-count b { color: var(--ink); font-weight: 700; }
.shelf-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #FFFFFF; color: var(--ink); border: 1px solid #A9C4B6; cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease, transform .15s ease;
}
.shelf-btn:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.shelf-btn:active:not(:disabled) { transform: scale(.94); }
.shelf-btn:disabled { color: #8FA59A; border-color: #CFDED6; background: transparent; cursor: default; }

.shelf { --tile-w: 176px; --rail-pad: 8px; position: relative; margin-inline: calc(var(--rail-pad) * -1); }
.shelf-plank {
  position: absolute; left: 0; right: 0; top: calc(14px + var(--tile-w) * 771 / 566); height: 14px;
  border-radius: 1px 1px 3px 3px;
  background: linear-gradient(180deg, #FAFCFB 0, #DDEAE2 5px, #B4CFC1 6px, #9CBEAD 100%);
  box-shadow: 0 10px 14px -8px rgba(23, 50, 38, .45);
}
.shelf-rail {
  position: relative; list-style: none; margin: 0; padding: 14px var(--rail-pad) 4px;
  display: flex; gap: 28px;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scroll-padding-inline: var(--rail-pad);
  scrollbar-width: none;
}
.shelf-rail::-webkit-scrollbar { display: none; }
.shelf-rail > li { flex: 0 0 var(--tile-w); scroll-snap-align: start; }
.shelf-bar { position: relative; height: 4px; margin-top: 22px; border-radius: 2px; background: #D3E3DA; cursor: pointer; touch-action: none; }
.shelf-bar[hidden] { display: none; }
.shelf-bar span { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 2px; background: var(--accent); cursor: grab; }

.issue-tile { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); }
.issue-tile .cover, .issue-tile .cover-placeholder {
  box-shadow: 0 1px 1px rgba(23, 32, 42, .10), 0 6px 10px -4px rgba(23, 32, 42, .22);
  transform-origin: 50% 100%;
  transition: transform .35s cubic-bezier(.16, 1, .3, 1), box-shadow .35s cubic-bezier(.16, 1, .3, 1);
}
.issue-tile:hover .cover, .issue-tile:focus-visible .cover,
.issue-tile:hover .cover-placeholder, .issue-tile:focus-visible .cover-placeholder {
  transform: translateY(-6px); box-shadow: 0 16px 22px -10px rgba(23, 32, 42, .36);
  animation: cover-hop .55s cubic-bezier(.33, 1, .68, 1);
}
/* Okładka lekko podskakuje: w górę, krótkie odbicie i zostaje minimalnie uniesiona. */
@keyframes cover-hop {
  0% { transform: translateY(0); }
  40% { transform: translateY(-12px); }
  70% { transform: translateY(-4px); }
  100% { transform: translateY(-6px); }
}
.issue-tile:focus-visible { outline: none; }
.issue-tile:focus-visible .issue-tile-name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; text-decoration-color: var(--accent); }
.issue-tile:hover .issue-tile-name { color: var(--accent); }
.issue-tile-name { margin-top: 28px; font-weight: 700; font-size: 17px; }
.issue-tile-meta { margin-top: 2px; font-size: 14px; line-height: 1.4; color: #4C5D55; }
@media (max-width: 600px) {
  .shelf { --tile-w: 136px; }
  .shelf-rail { gap: 18px; }
  .shelf-nav { padding-left: 0; border-left: 0; margin-left: auto; }
  .shelf-count { min-width: 0; }
}
.empty-note { margin: 0; color: var(--muted); }

/* --- Tematy --- */
.topics { display: flex; flex-wrap: wrap; gap: 40px; }
.topics-intro { flex: 1 1 280px; display: flex; flex-direction: column; gap: 10px; }
.topics-intro p { margin: 0; color: var(--text-2); }
.topics-list { flex: 2 1 560px; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); border-top: 1px solid var(--ink); }
.topics-list li { border-bottom: 1px solid var(--line); }
.topics-list a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 4px; color: var(--ink); font-size: 17px; font-weight: 500; text-decoration: none; }

/* --- Newsletter --- */
.newsletter { border: 1px solid var(--ink); border-radius: 16px; background: #FFFFFF; padding: clamp(20px, 4vw, 40px); display: flex; flex-wrap: wrap; gap: 32px; align-items: center; }
.newsletter-intro { flex: 1 1 360px; display: flex; flex-direction: column; gap: 8px; }
.newsletter-intro h2 { margin: 0; font-family: var(--font-serif); font-size: 30px; line-height: 1.2; }
.newsletter-intro p { margin: 0; color: var(--text-2); }
.newsletter form { flex: 1 1 420px; display: flex; flex-direction: column; gap: 12px; }
.newsletter .label { font-weight: 600; font-size: 15px; }
.spacer-64 { height: 64px; }
/* Odstęp między treścią a stopką (stopka zaczyna się równą krawędzią). */
main#tresc { padding-bottom: 72px; }
.reader-page main#tresc { padding-bottom: 0; background: none; }

.newsletter-row { display: flex; flex-wrap: wrap; gap: 8px; }
.newsletter-row .input { flex: 1 1 240px; border-width: 1px; border-color: var(--field); }
.newsletter .check { font-size: 14px; color: var(--muted); line-height: 1.45; }
.form-status { margin: 0; font-weight: 600; }
.form-status.ok { color: var(--accent); }
.form-status.err { color: var(--error); }

/* --- Strona wydania --- */
.issue-head { padding-block: 28px 48px; display: flex; flex-wrap: wrap; gap: clamp(24px, 4vw, 48px); align-items: flex-start; border-bottom: 1px solid var(--line); }
.issue-head-cover { flex: 0 1 260px; min-width: 200px; }
.issue-head-body { flex: 999 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.issue-head-body h1 { margin: 0; font-family: var(--font-serif); font-size: clamp(32px, 5vw, 48px); line-height: 1.1; }
.facts { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; max-width: 620px; border-block: 1px solid var(--line); padding: 14px 0; }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.pdf-box { background: #F4F5F3; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px; max-width: 680px; }
.pdf-box-text { flex: 1 1 260px; display: flex; flex-direction: column; }
.pdf-box-text span:first-child { font-weight: 700; }
.pdf-box-text span:last-child { font-size: 15px; color: var(--muted); }

.articles { padding-block: 48px 32px; }
.articles-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.article-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.article-item { display: flex; flex-wrap: wrap; gap: 28px; padding: 28px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.article-thumb { flex: 0 0 108px; width: 108px; height: 147px; object-fit: cover; object-position: top; background: #FFFFFF; border: 1px solid var(--line-strong); box-shadow: 0 1px 2px rgba(23, 32, 42, 0.06); }
.article-body { flex: 999 1 440px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.article-body h3 { margin: 0; font-family: var(--font-serif); font-size: clamp(20px, 2.6vw, 26px); line-height: 1.25; font-weight: 600; }
.article-body h3 a { color: var(--ink); text-decoration: none; }
.article-meta { font-size: 16px; color: var(--text-2); }
.article-meta strong { font-weight: 600; color: var(--ink); }
.article-lead { margin: 0; color: var(--text-2); max-width: 680px; }
.article-tags { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 2px; font-size: 15px; }
.article-action { flex: 0 0 auto; display: flex; align-items: center; padding-top: 4px; }

.issue-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; padding: 8px 0 64px; }
.issue-nav a { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); }
.issue-nav a:last-child { align-items: flex-end; }
.issue-nav small { font-size: 14px; color: var(--muted); }
.issue-nav span { font-family: var(--font-serif); font-size: 22px; font-weight: 600; }

/* --- Strony kont (logowanie, hasła) --- */
.auth { width: 100%; max-width: var(--container); margin: 0 auto; padding: clamp(32px, 6vw, 64px) var(--gutter) clamp(48px, 7vw, 80px);
  display: flex; flex-wrap: wrap; gap: clamp(28px, 5vw, 56px); align-items: flex-start; justify-content: center; }
.auth-card { flex: 1 1 400px; max-width: 520px; min-width: 0; border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: clamp(24px, 4vw, 40px); display: flex; flex-direction: column; gap: 24px; }
.auth-card h1 { margin: 0; font-family: var(--font-serif); font-size: clamp(26px, 3.4vw, 32px); line-height: 1.2; }
.auth-card .intro { margin: 0; color: var(--text-2); }
.auth-card form { display: flex; flex-direction: column; gap: 20px; }
.auth-aside { flex: 1 1 280px; max-width: 360px; min-width: 0; display: flex; flex-direction: column; gap: 28px; padding-top: 6px; }
.auth-aside h2 { margin: 0; font-size: 18px; line-height: 1.3; }
.auth-aside p { margin: 0; color: var(--text-2); }
.auth-aside .block + .block { border-top: 1px solid var(--line); padding-top: 22px; }
.auth-aside .block { display: flex; flex-direction: column; gap: 8px; }
.opens { display: flex; gap: 16px; align-items: flex-start; text-decoration: none; color: var(--ink); }
.opens img { flex: 0 0 72px; width: 72px; height: auto; aspect-ratio: 566 / 771; border: 1px solid var(--line-strong); }
.opens strong { font-family: var(--font-serif); font-size: 20px; display: block; }
.status-icon { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.status-icon.ok { background: var(--accent-soft); color: var(--accent); }
.status-icon.warn { background: var(--warn-bg); color: #8A4B00; }
.rules { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 16px; }
.rules li { display: flex; gap: 10px; align-items: center; color: var(--text-2); }
.rules li[data-ok="true"] { color: var(--accent); }
.rules .ok-icon { display: none; }
.rules li[data-ok="true"] .ok-icon { display: block; }
.rules li[data-ok="true"] .todo-icon { display: none; }
.list-plain { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); }

/* --- Strony informacyjne --- */
.prose { max-width: 760px; }
.prose h2 { font-family: var(--font-serif); font-size: 24px; margin: 32px 0 8px; }
.prose p { margin: 0 0 12px; }
.prose h3 { font-size: 19px; margin: 24px 0 6px; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 1.5em; }
.prose li { margin: 0 0 6px; }
.prose blockquote { margin: 16px 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--line-strong); color: var(--muted); }
.prose a { color: var(--accent); text-underline-offset: 3px; }
.prose > :first-child { margin-top: 0; }
/* Pod treścią strony informacyjnej: data aktualizacji i (dla administratora) link do edycji. */
.page-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 15px; color: var(--muted); }
.page-meta a { color: var(--accent); font-weight: 600; }

/* --- Wyszukiwanie --- */
.search-results { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.search-results li { position: relative; padding: 18px 0 18px 26px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
/* Kropka listy na wysokości środka pierwszej linii tytułu (21 px × 1,3). */
.search-results li::before {
  content: ""; position: absolute; left: 4px; top: calc(18px + 21px * 1.3 / 2 - 4px);
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  transition: transform .25s cubic-bezier(.16, 1, .3, 1), box-shadow .25s ease, background-color .25s ease;
}
/* Najechanie na tytuł (lub fokus z klawiatury): kropka „rozświetla się” – jaśniejsza, większa, z poświatą. */
.search-results li:has(h2 a:hover, h2 a:focus-visible)::before {
  background: #1F9A7D; transform: scale(1.35);
  box-shadow: 0 0 0 3px rgba(22, 106, 87, .16), 0 0 10px 3px rgba(31, 154, 125, .55);
}
.search-results h2 { margin: 0; font-family: var(--font-serif); font-size: 21px; line-height: 1.3; }
.search-results h2 a { color: var(--ink); text-decoration: none; }

/* =========================================================
   Czytnik PDF
   ========================================================= */
.reader-page { --header-h: 66px; }
.reader-toolbar { position: sticky; top: var(--header-h); z-index: 40; background: #FFFFFF; border-bottom: 1px solid var(--line-strong); box-shadow: 0 2px 8px rgba(23, 32, 42, 0.06); }
.reader-toolbar .bar { max-width: 1400px; margin: 0 auto; padding: 8px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; font-size: 16px; }
.reader-title { flex: 1 1 340px; min-width: 0; display: flex; align-items: center; gap: 12px; }
.reader-title h1 { margin: 0; font-family: var(--font-serif); font-size: 18px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-title .meta { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.reader-title > div { min-width: 0; }
.tbtn {
  min-width: 44px; height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); background: #FFFFFF; border-radius: var(--radius);
  color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 15px; font-weight: 600; white-space: nowrap;
}
.tbtn:hover { background: #EEF0F2; }
.tbtn-icon { padding: 0; width: 44px; }
.tbtn-strong { border-color: var(--ink); }
.tgroup { display: flex; align-items: center; gap: 6px; }
.page-input { width: 52px; height: 40px; text-align: center; border: 1px solid var(--field); border-radius: var(--radius); font: inherit; font-size: 16px; font-variant-numeric: tabular-nums; }
.zoom-select { height: 44px; padding: 0 10px; border: 1px solid var(--field); border-radius: var(--radius); font: inherit; font-size: 15px; background: #FFFFFF; color: var(--ink); }
.tactions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.pop { position: relative; }
.pop-menu {
  position: absolute; right: 0; top: calc(100% + 6px); width: 300px; z-index: 60;
  background: #FFFFFF; border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(23, 32, 42, 0.14); padding: 6px; animation: tiuDrop .2s ease;
}
.pop-menu[hidden] { display: none; }
.pop-menu a, .pop-menu button {
  width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: 3px; background: #FFFFFF;
  font: inherit; color: var(--ink); cursor: pointer; display: flex; flex-direction: column; text-decoration: none;
}
.pop-menu a:hover, .pop-menu button:hover { background: var(--accent-tint); text-decoration: none; }
.pop-menu strong { font-weight: 700; }
.pop-menu small { font-size: 14px; color: var(--muted); }

.pop-range { padding: 10px 12px; border-top: 1px solid var(--line-soft); margin-top: 4px; display: flex; flex-direction: column; gap: 8px; }
.pop-range label { display: flex; flex-direction: column; }
.pop-range .range-input { width: 100px; }
.page-input[aria-invalid="true"] { border-color: var(--error); }
.reader-body { max-width: 1400px; margin: 0 auto; display: flex; align-items: stretch; background: var(--bg-reader); min-height: 70vh; }
.reader-toc { flex: 0 0 300px; max-width: 300px; background: #FFFFFF; border-right: 1px solid var(--line-strong); padding: 16px 0 24px; }
.reader-toc[hidden] { display: none; }
.reader-toc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 16px 10px 20px; }
.reader-toc-head h2 { margin: 0; font-size: 17px; }
.reader-toc-close { display: none; }
.reader-toc ol { list-style: none; margin: 0; padding: 0; }
.reader-toc a { display: flex; gap: 12px; padding: 10px 16px 10px 20px; text-decoration: none; color: var(--ink); font-size: 16px; line-height: 1.35; }
.reader-toc a:hover { background: var(--accent-tint); text-decoration: none; }
.reader-toc a span:first-child { flex: 0 0 30px; font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.reader-toc a[aria-current="true"] { background: var(--accent-tint); font-weight: 700; }
.reader-toc a[aria-current="true"] span:first-child { color: var(--accent); font-weight: 700; }
.reader-backdrop { display: none; }

.reader-doc { flex: 1 1 auto; min-width: 0; padding: 24px 24px 48px; display: flex; flex-direction: column; align-items: safe center; gap: 20px; overflow-x: auto; }
.reader-canvas-wrap { position: relative; background: #FFFFFF; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 8px 28px rgba(0,0,0,.10); }
.reader-canvas-wrap canvas { display: block; width: 100%; height: auto; }
.reader-status { padding: 40px 24px; text-align: center; color: var(--muted); }

/* =========================================================
   Telefon i tablet
   ========================================================= */
@media (max-width: 900px) {
  .reader-toc { position: fixed; top: 0; bottom: 0; left: 0; z-index: 80; width: min(86vw, 340px); max-width: none; overflow-y: auto; box-shadow: 8px 0 24px rgba(23,32,42,.18); }
  .reader-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 75; border: 0; background: rgba(23,32,42,.45); cursor: pointer; }
  .reader-toc-close { display: inline-flex; }
}

@media (max-width: 640px) {
  :root { --header-h: 150px; }
  [id] { scroll-margin-top: 80px; }
  .hide-sm { display: none !important; }
  .masthead { padding-top: 10px; }
  .mast { flex-wrap: nowrap; gap: 12px; }
  .logo { width: 139px; height: 44px; margin-left: -15px; }
  .is-compact .logo { width: 120px; height: 38px; margin-left: -13px; }
  .mast-line { left: -15px; bottom: 11px; height: 2px; width: calc(100% + 15px); }
  .is-compact .mast-line { left: -13px; bottom: 10px; width: 120px !important; }
  .mast-tools { flex: 1 1 auto; min-width: 0; margin-bottom: 18px; }
  .main-nav { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; column-gap: 22px; padding: 8px 0; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, #000 86%, transparent); mask-image: linear-gradient(to right, #000 86%, transparent); }
  .main-nav::-webkit-scrollbar { display: none; }
  .current-cover { max-width: 220px; }
  .issue-head-cover { flex-basis: 180px; min-width: 0; max-width: 180px; }
  .article-item { gap: 16px; padding: 20px 0; }
  .article-thumb { flex-basis: 72px; width: 72px; height: 98px; }
  .article-body { flex-basis: 200px; }
  .reader-doc { padding: 16px 12px 32px; }
  .zoom-group { display: none; }
  .tbtn .lbl-sm { position: absolute; left: -9999px; }
}

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


/* =========================================================
   Panel administratora
   ========================================================= */
/* Panel administratora: jasnoliliowa „pastylka” na szerokość kontenera – od razu widać, że to inna część portalu.
   Na #D6C2DC biały tekst byłby nieczytelny (1,7:1), więc tekst jest ciemny (8,9:1), a ikony fioletowe (4,4:1);
   od szarego tła strony pastylkę odcina ciemniejsza liliowa obwódka i cień. */
.admin-bar { padding-top: 20px; }
.admin-pill {
  --admin-lilac: #D6C2DC; --admin-lilac-ink: #2E2338; --admin-lilac-icon: #6A4A7A;
  display: flex; align-items: stretch; gap: 4px; padding: 6px;
  background: var(--admin-lilac); border: 1px solid #B9A1C2; border-radius: 999px;
  box-shadow: 0 1px 2px rgba(60, 40, 80, .10), 0 8px 20px -12px rgba(74, 52, 100, .45);
}
.admin-pill-title {
  display: inline-flex; align-items: center; gap: 10px; flex: 0 0 auto;
  padding: 0 22px 0 16px; margin-right: 4px;
  border-right: 1px solid rgba(46, 35, 56, .2);
  color: var(--ink); font-weight: 700; font-size: 16px; white-space: nowrap;
}
.admin-pill-title svg { color: var(--admin-lilac-icon); }
.admin-pill a {
  flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 16px; border-radius: 999px;
  color: var(--admin-lilac-ink); font-weight: 600; font-size: 16px; text-decoration: none; white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}
.admin-pill a svg { color: var(--admin-lilac-icon); }
.admin-pill a:hover { background: rgba(255, 255, 255, .45); color: var(--ink); }
.admin-pill a:focus-visible { outline: 3px solid var(--admin-lilac-ink); outline-offset: 2px; }
.admin-pill a[aria-current="page"] { background: #FFFFFF; color: var(--ink); box-shadow: 0 1px 3px rgba(60, 40, 80, .25); }
/* Pływające zaznaczenie (gdy działa JavaScript): białe tło jest osobnym elementem pod zakładkami
   i przesuwa się płynnie do klikniętej zakładki; same zakładki są wtedy przezroczyste. */
.admin-pill { position: relative; isolation: isolate; }
.admin-pill-indicator {
  position: absolute; top: 0; left: 0; z-index: 0; width: 0; height: 0;
  border-radius: 999px; background: #FFFFFF; box-shadow: 0 1px 3px rgba(60, 40, 80, .25);
  opacity: 0; pointer-events: none;
  transition: transform .34s cubic-bezier(.22, 1, .36, 1), width .34s cubic-bezier(.22, 1, .36, 1), height .34s cubic-bezier(.22, 1, .36, 1);
}
.admin-pill.has-indicator .admin-pill-indicator { opacity: 1; }
.admin-pill-title, .admin-pill a { position: relative; z-index: 1; }
.admin-pill.has-indicator a[aria-current="page"] { background: transparent; box-shadow: none; }
@media (prefers-reduced-motion: reduce) { .admin-pill-indicator { transition: none; } }
/* Węższy ekran: tytuł nad zakładkami, zakładki w siatce (pastylka staje się zaokrąglonym kafelkiem). */
@media (max-width: 1000px) {
  .admin-pill { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-radius: 22px; padding: 8px; }
  .admin-pill-title { grid-column: 1 / -1; min-height: 40px; padding: 0 10px; margin: 0 0 4px; border-right: 0; border-bottom: 1px solid rgba(46, 35, 56, .2); }
  .admin-pill a { min-height: 46px; padding: 0 10px; }
}
@media (max-width: 640px) {
  .admin-pill { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.admin-page { padding-block: 28px 64px; display: flex; flex-direction: column; gap: 24px; }
.admin-narrow { max-width: 860px; }
.admin-crumb { font-size: 15px; color: var(--muted); }
.admin-crumb a { color: var(--muted); }
.admin-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.admin-head h1 { margin: 0; font-family: var(--font-serif); font-size: clamp(28px, 3.4vw, 36px); line-height: 1.2; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.admin-head p { margin: 6px 0 0; max-width: 62ch; }
.admin-head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.admin-note { margin: 0; padding: 12px 16px; border-radius: var(--radius); font-weight: 600; border: 1px solid; }
.admin-note.ok { background: var(--accent-soft); border-color: #A9CFBF; color: var(--accent-hover); }
.admin-note.err { background: var(--error-bg); border-color: var(--error-line); color: var(--error-dark); }
.admin-note.warn { background: var(--warn-bg); border-color: var(--warn-line); color: #6B4200; }
.admin-note[hidden] { display: none; }
.warn-title { color: #6B4200; }
.problem-list { margin: 6px 0 0; padding-left: 20px; }
.problem-list li + li { margin-top: 4px; }

.admin-empty { border: 1px dashed var(--line-strong); border-radius: 16px; padding: 40px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.admin-empty h2 { margin: 0; font-family: var(--font-serif); font-size: 24px; }
.admin-empty p { margin: 0; color: var(--text-2); max-width: 52ch; }

/* position: relative – ukryte etykiety dla czytników ekranu (np. „Akcje” w nagłówku, position: absolute) zostają
   przycięte przez ramkę; bez tego „wystawały” poza nią i telefon rozszerzał stronę do szerokości całej tabeli. */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line-strong); border-radius: 12px; background: #FFFFFF; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 16px; }
.admin-table th { text-align: left; font-size: 14px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 12px 16px; background: var(--bg-soft); border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.admin-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
/* Pierwsza kolumna (nazwa wydania, tagu, konta) nie ściska się przy przewijanej tabeli na telefonie. */
.admin-table td:first-child { min-width: 180px; }
.admin-table .row-title { white-space: nowrap; }
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.row-title { display: block; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
a.row-title { color: var(--accent); }
.row-sub { display: block; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
/* Komórka z przyciskami zostaje zwykłą komórką tabeli (display: flex rozjeżdżał linie wierszy);
   przyciski stoją w jednym rzędzie przy prawej krawędzi (na wąskim ekranie tabela przewija się w bok). */
.row-actions { text-align: right; white-space: nowrap; }
.row-actions > * { vertical-align: middle; margin: 4px 0 4px 8px; }
.row-actions > form { display: inline-block; }
.row-actions > :first-child { margin-left: 0; }
.pill { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 14px; font-size: 14px; font-weight: 700; font-family: var(--font-sans); letter-spacing: 0; white-space: nowrap; }
.pill.ok { background: var(--accent-soft); color: var(--accent-hover); }
.pill.draft { background: var(--warn-bg); color: #6B4200; border: 1px solid var(--warn-line); }
.pill.off { background: var(--bg-soft); color: var(--muted); border: 1px solid var(--line-strong); }
.btn.danger { color: var(--error-dark); border-color: var(--error-line); }
.btn.danger:hover { background: var(--error-bg); color: var(--error-dark); }

.admin-card { background: #FFFFFF; border: 1px solid var(--line-strong); border-radius: 16px; padding: clamp(20px, 3vw, 32px); display: flex; flex-direction: column; gap: 16px; }
.admin-card h2 { margin: 0; font-family: var(--font-serif); font-size: 22px; line-height: 1.25; }
.admin-card > p { margin: 0; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.card-head h2 { margin: 0; font-family: var(--font-serif); font-size: 22px; }
.admin-form { display: flex; flex-direction: column; gap: 24px; }
.admin-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 20px; }
.admin-grid .span-2 { grid-column: span 2; }
.admin-grid .span-4 { grid-column: 1 / -1; }
.admin-narrow .admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-narrow .admin-grid .span-2, .admin-narrow .admin-grid .span-4 { grid-column: 1 / -1; }
.textarea { height: auto; min-height: 112px; padding: 12px 14px; line-height: 1.5; resize: vertical; font-family: inherit; }
select.input { padding-right: 10px; }
.file-input { height: auto; padding: 10px 12px; }
.file-line { margin: 0; color: var(--text-2); overflow-wrap: anywhere; }
.file-replace { display: flex; flex-direction: column; gap: 6px; }
.file-replace-label { font-weight: 600; font-size: 16px; }
.file-replace-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.file-replace-row .input { flex: 1 1 320px; width: auto; }
.role-field { max-width: 560px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; background: rgba(242, 242, 242, .96); border-top: 1px solid var(--line-strong); margin-inline: calc(-1 * var(--gutter)); padding: 14px var(--gutter); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.file-btn { position: relative; }
.file-btn:focus-within { outline: 3px solid var(--ink); outline-offset: 2px; }
#gen-status.err, .field-hint.err { color: var(--error); font-weight: 600; }

.cover-box { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.cover-preview { flex: 0 0 190px; }
.cover-preview img { display: block; width: 190px; height: auto; aspect-ratio: 566 / 771; object-fit: cover; border: 1px solid var(--line-strong); box-shadow: 0 1px 2px rgba(23, 32, 42, .06), 0 8px 24px rgba(23, 32, 42, .08); }
.cover-preview img[hidden] { display: none; }
.cover-empty { width: 190px; aspect-ratio: 566 / 771; display: flex; align-items: center; justify-content: center; text-align: center; padding: 12px; color: var(--muted); background: var(--bg-soft); border: 1px dashed var(--line-strong); }
.cover-actions { flex: 1 1 320px; display: flex; flex-direction: column; gap: 12px; }
.cover-actions p { margin: 0; }

.article-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.article-row { display: grid; grid-template-columns: 60px minmax(0, 1fr) auto; gap: 16px; align-items: start; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #FBFBFA; }
.art-thumb { width: 60px; min-height: 85px; }
.art-thumb img { display: block; width: 60px; height: 85px; object-fit: cover; border: 1px solid var(--line-strong); background: #FFFFFF; }
.art-thumb-empty { display: flex; width: 60px; height: 85px; align-items: center; justify-content: center; text-align: center; font-size: 12px; line-height: 1.2; color: var(--muted); background: var(--bg-soft); border: 1px dashed var(--line-strong); padding: 4px; }
/* Przycisk „Usuń” na wysokości pól (pod etykietą: 15 px × 1,55 + 6 px odstępu), a nie etykiet. */
.article-row .article-remove { margin-top: calc(15px * 1.55 + 6px); }
.art-fields { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px 14px; }
.art-title { grid-column: span 8; }
.art-author { grid-column: span 4; }
.art-page { grid-column: span 2; }
.art-tags { grid-column: span 8; }
.art-error { grid-column: 1 / -1; margin: 0; }
.article-row .input { height: 44px; font-size: 16px; border-width: 1px; border-color: var(--field); }
.article-row .field label { font-size: 15px; }
.tag-picker { border-top: 1px solid var(--line); padding-top: 14px; }
.tag-picker summary { cursor: pointer; font-weight: 600; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.chip { border: 1px solid var(--field); background: #FFFFFF; color: var(--ink); border-radius: 18px; padding: 6px 12px; font: inherit; font-size: 15px; cursor: pointer; min-height: 36px; }
.chip:hover { background: var(--accent-tint); border-color: var(--accent); color: var(--accent); }

.admin-search { display: flex; gap: 8px; align-items: center; }
.admin-search .input { height: 44px; width: min(320px, 60vw); font-size: 16px; }
.admin-pager { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center; margin-top: 8px; }

@media (max-width: 900px) {
  .admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .art-title, .art-tags { grid-column: 1 / -1; }
  .art-author { grid-column: span 8; }
  .art-page { grid-column: span 2; }
}
@media (max-width: 640px) {
  .admin-grid, .admin-narrow .admin-grid { grid-template-columns: minmax(0, 1fr); }
  .admin-grid .span-2, .admin-grid .span-4 { grid-column: 1 / -1; }
  .article-row { grid-template-columns: 60px minmax(0, 1fr); }
  .article-row .article-remove { grid-column: 1 / -1; justify-self: start; margin-top: 0; }
  .art-author { grid-column: 1 / -1; }
  .art-page { grid-column: span 6; }
  .admin-head-actions { width: 100%; }
}

/* Atrybut hidden ma wygrywać z display ustawionym w klasach (np. flex) */
.cover-empty[hidden], .art-thumb[hidden], .tag-picker[hidden] { display: none; }


/* =========================================================
   Czytnik PDF: wyraźna, ciemna belka narzędzi i pełny ekran
   ========================================================= */
.reader-toolbar {
  background: var(--ink); color: #FFFFFF;
  border-bottom: 3px solid var(--accent);
  box-shadow: 0 6px 18px rgba(23, 32, 42, .22);
}
.reader-title h1 { color: #FFFFFF; }
.reader-title .meta { color: #C9D0D7; }
.reader-title .meta a { color: #FFFFFF; text-decoration-color: rgba(255, 255, 255, .55); }
.reader-title .meta a:hover { text-decoration-color: #FFFFFF; }
.reader-toolbar .tgroup .muted { color: #C9D0D7; }
.reader-toolbar .tbtn {
  background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .38); color: #FFFFFF;
}
.reader-toolbar .tbtn:hover { background: rgba(255, 255, 255, .20); }
.reader-toolbar .tbtn[aria-pressed="true"] { background: #FFFFFF; color: var(--ink); border-color: #FFFFFF; }
.reader-toolbar .tbtn-strong { border-color: rgba(255, 255, 255, .7); }
.reader-toolbar .btn-primary { background: #1E7F66; border-color: rgba(255, 255, 255, .5); }
.reader-toolbar .btn-primary:hover { background: #176A55; border-color: #FFFFFF; }
.reader-toolbar :focus-visible { outline-color: #FFFFFF; }
.reader-toolbar .page-input, .reader-toolbar .zoom-select { border-color: rgba(255, 255, 255, .6); }
.reader-toolbar .pop-menu :focus-visible { outline-color: var(--ink); }
.reader-toolbar .tbtn svg[hidden] { display: none; }

/* Pełny ekran: czytnik przykrywa nagłówek i stopkę, belka zostaje na górze, strona dostaje całą resztę. */
html.reader-full, html.reader-full body { overflow: hidden; }
.reader.is-full {
  position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column;
  background: var(--bg-reader);
}
.reader.is-full .reader-toolbar { position: static; flex: 0 0 auto; }
.reader.is-full .reader-body { flex: 1 1 auto; min-height: 0; max-width: none; width: 100%; }
.reader.is-full .reader-toc { overflow-y: auto; }
.reader.is-full .reader-doc { overflow: auto; height: 100%; padding-bottom: 32px; }

/* Kartkowanie w pełnym ekranie: rozkładówka na środku, powiększenie niepotrzebne (strona zawsze mieści się w całości). */
.reader.is-full .zoom-group { display: none; }
.reader.is-full .reader-doc:has(.flip-host:not([hidden])) { overflow: hidden; padding: 20px 24px; justify-content: center; }
.flip-host { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 0; }
.flip-host[hidden] { display: none; }
.flip-book { flex: 0 0 auto; }
.flip-page { background: #FFFFFF; }
.flip-page canvas { display: block; width: 100%; height: 100%; }
.reader-canvas-wrap[hidden] { display: none; }

/* Przycisk „Spis treści” ma zawsze ten sam rozmiar; przy długim tytule skraca się tytuł (wielokropek). */
.reader-title .toc-toggle { flex: 0 0 auto; }
.toc-toggle .eye { opacity: .9; }
.toc-toggle[aria-expanded="true"] .eye-off,
.toc-toggle[aria-expanded="false"] .eye-on { display: none; }


/* =========================================================
   Nagłówek w kolorze #E3E8EA (własny kolor, niezależny od --bg-soft)
   Zieleń portalu #166a57 ma tu 5,3:1, więc zostaje bez zmian;
   pole wyszukiwania dostaje ciemniejszą ramkę, linie podziału są przyciemnione zamiast jaśniejszych od tła.
   ========================================================= */
.site-header { --header-bg: #E3E8EA; }
.site-header .topbar { border-bottom-color: rgba(23, 32, 42, .12); }
.site-header .search { border-color: #66737A; }
.site-header .search button { border-left-color: #66737A; background: #EEF1F2; }
.site-header .menu-panel { border-top-color: rgba(23, 32, 42, .14); }
.site-header .menu-panel li { border-bottom-color: rgba(23, 32, 42, .14); }


/* =========================================================
   Edytor stron informacyjnych (panel administratora)
   ========================================================= */
.editor { border: 1px solid var(--field); border-radius: 12px; background: #FFFFFF; overflow: clip; }
.editor:focus-within { outline: 3px solid var(--ink); outline-offset: 2px; }
.editor-toolbar {
  position: sticky; top: var(--header-h, 0px); z-index: 2;
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 8px;
  background: #F4F6F5; border-bottom: 1px solid var(--line);
}
.editor-toolbar button {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px;
  border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink);
  font: inherit; font-size: 15px; cursor: pointer;
}
.editor-toolbar button:hover { background: #E4ECE8; }
.editor-toolbar button:focus-visible { outline: 3px solid var(--ink); outline-offset: 1px; }
.editor-toolbar button[aria-pressed="true"] { background: var(--accent-tint); border-color: var(--accent); color: var(--accent); }
.editor-sep { align-self: stretch; width: 1px; margin: 4px 4px; background: var(--line-strong); }
.editor-area { max-width: none; min-height: 420px; padding: 24px clamp(16px, 3vw, 32px); outline: none; cursor: text; }
.editor-area[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--error); }
.editor-area ::selection { background: #CFE4DA; }
.warn-text { color: #8A4B00; }


/* =========================================================
   Tagi i popularne tematy (panel administratora)
   ========================================================= */
.admin-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin: 8px 0 16px; }
.topics-preview { margin-bottom: 24px; }
.topics-preview h2 { font-size: 19px; }
.preview-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; counter-reset: topic; }
.preview-list li {
  counter-increment: topic; display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 20px; background: #FBFBFA; font-weight: 600;
}
.preview-list li::before { content: counter(topic) "."; color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.admin-table .row-actions .btn[disabled] { opacity: .4; cursor: default; }
.tag-form { display: flex; flex-direction: column; gap: 12px; }
.tag-form .file-replace-row .input { flex: 1 1 auto; min-width: 0; }
.tag-articles { list-style: none; margin: 0; padding: 0; }
.tag-articles li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tag-articles li:last-child { border-bottom: 0; }
.tag-articles a { font-weight: 600; color: var(--accent); white-space: nowrap; }
.danger-zone { border-color: var(--error-line); }


/* =========================================================
   Statystyki (panel administratora)
   ========================================================= */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 0 0 24px; }
.stat-tile { margin: 0; padding: 16px 18px; background: #FFFFFF; border: 1px solid var(--line-strong); border-radius: 12px; display: flex; flex-direction: column; gap: 2px; }
.stat-tile dt { font-size: 15px; font-weight: 600; color: var(--muted); }
.stat-tile dd { margin: 0; }
.stat-value { font-family: var(--font-serif); font-size: 32px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat-hint { font-size: 14px; color: var(--muted); }
.stat-delta { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; }
.card-head h2, .card-head p { margin: 0; }
.chart { position: relative; overflow-x: auto; }
.chart-svg { display: block; width: 100%; min-width: 640px; height: auto; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis { stroke: var(--line-strong); stroke-width: 1; }
.chart-label { fill: var(--muted); font-size: 12px; font-family: inherit; font-variant-numeric: tabular-nums; }
.chart-bar { fill: var(--accent); }
.chart-hit { fill: transparent; cursor: crosshair; }
.chart-hit.is-active { fill: rgba(22, 106, 87, .08); }
.chart-tip {
  position: absolute; top: 4px; transform: translateX(-50%); z-index: 2; pointer-events: none;
  display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; white-space: nowrap;
  background: var(--ink); color: #FFFFFF; border-radius: 8px; font-size: 14px; box-shadow: 0 6px 16px rgba(23, 32, 42, .25);
}
.chart-tip[hidden] { display: none; }
.chart-table summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.chart-table .table-wrap { margin-top: 12px; max-height: 320px; overflow-y: auto; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; margin-top: 16px; }
.stats-grid .admin-card h2 { font-size: 20px; margin: 0; }
.rank-list { margin: 0; padding-left: 1.6em; display: flex; flex-direction: column; gap: 2px; }
.rank-list li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.rank-list li:last-child { border-bottom: 0; }
.rank-list li::marker { color: var(--muted); font-variant-numeric: tabular-nums; }
.rank-list a { color: var(--accent); font-weight: 600; }
.rank-count { font-weight: 700; font-variant-numeric: tabular-nums; margin-left: 6px; }
.rank-list .row-sub { margin-left: 8px; }
.stats-note { margin-top: 24px; max-width: 900px; }


/* =========================================================
   Poczta (panel administratora) i okno dialogowe
   ========================================================= */
.mail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; }
.mail-sep { grid-column: 1 / -1; height: 1px; background: var(--line); }
.mail-check { justify-content: center; }
.mail-actions { padding-top: 16px; border-top: 1px solid var(--line); }
.mail-updated { text-align: right; margin-top: -8px; }
.req { color: var(--error); font-weight: 700; }
.label-note { font-weight: 400; font-size: 14px; color: var(--muted); }
.input.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 15px; }
.input:disabled { background: var(--bg-soft); color: var(--muted); cursor: not-allowed; }
@media (max-width: 760px) { .mail-grid { grid-template-columns: minmax(0, 1fr); } }

.modal {
  width: min(520px, calc(100vw - 32px)); padding: 28px; border: 0; border-radius: 16px;
  background: #FFFFFF; color: var(--ink); box-shadow: 0 24px 60px -12px rgba(23, 32, 42, .45);
}
.modal::backdrop { background: rgba(23, 32, 42, .5); }
.modal[open] { animation: modal-in .22s cubic-bezier(.22, 1, .36, 1); }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal h2 { margin: 0 40px 8px 0; font-family: var(--font-serif); font-size: 24px; line-height: 1.25; }
.modal > p { margin: 0 0 18px; }
.modal-close-form { position: absolute; top: 14px; right: 14px; margin: 0; }
.modal-x { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.modal-x:hover { background: var(--bg-soft); color: var(--ink); }
.modal-x:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.modal-form { display: flex; flex-direction: column; gap: 16px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.modal-result { margin: 0; padding: 12px 14px; border-radius: 10px; border: 1px solid; font-size: 15px; line-height: 1.45; }
.modal-result.ok { background: var(--accent-soft); border-color: #9CC9B7; color: var(--accent-hover); }
.modal-result.err { background: var(--error-bg); border-color: var(--error-line); color: var(--error-dark); }
.modal-result[hidden] { display: none; }

