/* ============================================================================
   e-SOA 2.0 — NRA · Design System (wariant OPUS)
   Jedno źródło prawdy: tokeny + komponenty.
   Wszystkie ekrany linkują TYLKO ten plik. Zero wartości px ad-hoc w HTML.
   ============================================================================
   Struktura:
     1.  Reset
     2.  Tokeny  (kolory, odstępy, typografia, kontrolki, radius, shadow, layout)
     3.  Powłoka aplikacji (header, sidebar, main)
     4.  Breadcrumbs + nagłówek strony
     5.  Karty, sekcje, alerty
     6.  Formularze (.field, .control, .checkbox, .radio, password-strength)
     7.  Filtry (.filter-bar, .filter-grid)
     8.  Przyciski (.btn, warianty)
     9.  Tabela (.table + macierz CRUD + akcje + sticky head)
     10. Paginacja
     11. Badge/Pill + status-dot
     12. Modal / dialog
     13. Toast
     14. Zakładki językowe + segmented
     15. WYSIWYG (skeleton)
     16. Stany puste / loading
     17. Bulk actions
     18. Tooltip (CSS)
     19. Utilities
     20. RWD (≤ 1024 / ≤ 768)
     21. Print + forced-colors
   ============================================================================ */

/* === 1. RESET ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--hdr-h) + var(--s-3));
  scrollbar-gutter: stable;   /* zawsze rezerwuj miejsce na scrollbar — żaden layout shift między ekranami */
}
/* Sekcje z id (zakładki anchor) — odsuń od sticky headera */
section[id], .card[id] { scroll-margin-top: calc(var(--hdr-h) + var(--s-3)); }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { display: block; max-width: 100%; }
/* SVG-ikona inline obok tekstu (kłódki, tooltipy, badge) — nie łam linii */
span[data-tooltip] > svg,
.badge svg, .role-tag svg, .status > svg,
td b + span > svg,
.u-monospace + span > svg { display: inline-block; vertical-align: -0.15em; }
a { color: var(--c-link); text-decoration: none; }
a:hover { text-decoration: underline; }
/* Linki w treści — zawsze podkreślone (WCAG: link-in-text-block) */
.alert a, p a, .page-head__subtitle a, .toast a,
td a:not(.btn):not(.btn--icon), .card__body li a:not(.btn),
tfoot a, dd a, .modal__body a:not(.btn), .step a:not(.btn),
.card__subtitle a, .auth-card a, .auth-card li a, .pw-rules a, .card__footer a:not(.btn), .switch a, ol li a:not(.btn), .card__body a:not(.btn):not(.btn--icon) { text-decoration: underline; }
.alert a:hover, p a:hover, .toast a:hover { text-decoration: underline; }
button { cursor: pointer; font: inherit; border: none; background: none; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
fieldset { border: none; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; }

/* fokus globalny — widoczny i mocny (WCAG 2.4.7) */
:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
  border-radius: 2px;
}
.sr-only {
  position: absolute !important;
  width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important;
  overflow: hidden !important; clip: rect(0 0 0 0) !important;
  white-space: nowrap !important; border: 0 !important;
}
/* Skip-link */
.skip-link {
  position: absolute; top: -40px; left: 0;
  background: var(--c-text); color: #fff;
  padding: var(--s-2) var(--s-4);
  z-index: 9999;
  border-radius: 0 0 var(--r-md) 0;
}
.skip-link:focus { top: 0; text-decoration: none; }

/* === 2. TOKENY ============================================================ */
:root {
  /* --- Marka (NRA — kolorystyka z v1) -------------------------------- */
  --c-brand:        #2E6E4E;   /* główna zieleń panelu */
  --c-brand-700:    #235539;   /* hover/active */
  --c-brand-800:    #1a3f2b;   /* tła sidebaru */
  --c-brand-900:    #122c1f;   /* najgłębsze tło */
  --c-brand-300:    #4a8d6b;   /* delikatne akcenty */
  --c-brand-50:     #e9f3ed;   /* tła sukcesu/aktywności */

  --c-accent:       #C9A227;   /* złoto — jaśniejsze, ciemny tekst (#122c1f) na nim ≥4.5:1 (zweryfikowane axe) */
  --c-accent-700:   #8c6810;
  --c-accent-50:    #fbf4dd;

  --c-danger:       #B0341F;   /* czerwień „wyloguj" — AA-friendly */
  --c-danger-700:   #8a2818;
  --c-danger-50:    #fbe9e5;

  --c-warning:      #B45309;
  --c-warning-50:   #fff4e0;

  --c-success:      #1F7A45;
  --c-success-50:   #e6f4ec;

  --c-info:         #1448A3;
  --c-info-50:      #e3eeff;

  /* --- Powierzchnie ------------------------------------------------ */
  --c-bg:           #e6e8ee;   /* tło aplikacji — z v1 */
  --c-surface:      #ffffff;
  --c-surface-2:    #f5f6f9;   /* tło zebra / sekcji */
  --c-surface-3:    #eef0f5;

  /* --- Tekst ------------------------------------------------------- */
  --c-text:         #1a1f2b;   /* czarno-niebieski (lepszy niż czysty czarny) */
  --c-text-muted:   #525a6e;   /* AA na #fff = 7.3:1 */
  --c-text-soft:    #646b7d;   /* AA na #fff ≥4.5:1 (zweryfikowane axe) */
  --c-text-inv:     #ffffff;

  /* --- Linie / obramowania ---------------------------------------- */
  --c-border:       #c8cdd8;
  --c-border-strong:#a4adbf;
  --c-divider:      #e5e7ee;

  /* --- Linki & fokus ----------------------------------------------- */
  --c-link:         var(--c-brand-700);
  --c-link-hover:   var(--c-brand);
  --c-focus:        var(--c-brand);
  --c-focus-ring:   rgba(46,110,78,.25);

  /* --- Skala odstępów (siatka 4 px) -------------------------------- */
  --s-0: 0;
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 40px;
  --s-9: 48px;
  --s-10: 64px;
  --s-11: 80px;

  /* --- Typografia (skala modular 1.125) ----------------------------- */
  --t-xs:   12px;
  --t-sm:   13px;
  --t-base: 14px;   /* baza tekstu UI */
  --t-md:   15px;
  --t-lg:   17px;
  --t-xl:   20px;
  --t-2xl:  24px;
  --t-3xl:  30px;

  --fw-regular: 400;
  --fw-medium:  500;
  --fw-semi:    600;
  --fw-bold:    700;

  /* --- Promienie --------------------------------------------------- */
  --r-sm:  4px;
  --r-md:  6px;
  --r-lg:  10px;
  --r-xl:  14px;
  --r-pill: 999px;

  /* --- Cienie ------------------------------------------------------ */
  --sh-1: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.06);
  --sh-2: 0 2px 6px rgba(15,23,42,.07), 0 4px 12px rgba(15,23,42,.06);
  --sh-3: 0 8px 24px rgba(15,23,42,.12);
  --sh-4: 0 16px 48px rgba(15,23,42,.18);

  /* --- KONTROLKI (JEDEN ROZMIAR — twardo egzekwowany) ------------ */
  --ctrl-h:        40px;       /* wysokość input/select/textarea/btn w rzędzie */
  --ctrl-h-sm:     32px;       /* mała wersja (np. paginacja) */
  --ctrl-h-lg:     48px;       /* duża wersja (np. ekran logowania) */
  --ctrl-pad-x:    12px;
  --ctrl-radius:   var(--r-md);
  --ctrl-border:   1px solid var(--c-border);
  --ctrl-bg:       var(--c-surface);
  --ctrl-font:     var(--t-base);

  /* --- Layout ------------------------------------------------------ */
  --hdr-h:         60px;
  --sb-w:          240px;
  --sb-w-collapsed: 64px;
  --content-max:   1600px;

  /* --- Tabela ------------------------------------------------------ */
  --tbl-row-h:     48px;
  --tbl-pad-x:     16px;

  /* --- Tranzycje --------------------------------------------------- */
  --motion: .18s cubic-bezier(.2,.6,.2,1);
}

/* === 3. POWŁOKA APLIKACJI ================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sb-w) 1fr;
  grid-template-rows: var(--hdr-h) 1fr;
  grid-template-areas:
    "header header"
    "sidebar main";
  min-height: 100vh;
}
.app.is-sb-collapsed { grid-template-columns: var(--sb-w-collapsed) 1fr; }

/* --- HEADER (belka marki) ------------------------------------------- */
.app-header {
  grid-area: header;
  display: flex; align-items: center; gap: var(--s-3);
  padding: 0 var(--s-5);
  background: linear-gradient(90deg, var(--c-brand-800) 0, var(--c-brand) 280px, var(--c-brand) 100%);
  color: var(--c-text-inv);
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--sh-1);
  height: var(--hdr-h);
}
.app-header__brand {
  display: flex; align-items: center; gap: var(--s-3);
  color: #fff;
  font-weight: var(--fw-semi); font-size: var(--t-md);
  white-space: nowrap;
  min-width: 200px;
}
.app-header__brand .brand-mark {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--c-accent); color: var(--c-brand-900);
  border-radius: var(--r-md);
  font-weight: var(--fw-bold);
}
.app-header__brand small {
  display: block;
  font-size: var(--t-xs); font-weight: var(--fw-regular);
  color: rgba(255,255,255,.75);
  margin-top: 1px;
  letter-spacing: .02em;
}
.app-header__sidebar-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--r-md); color: #fff;
  transition: background var(--motion);
}
.app-header__sidebar-toggle:hover,
.app-header__sidebar-toggle:focus-visible { background: rgba(255,255,255,.12); }
.app-header__sidebar-toggle svg { width: 18px; height: 18px; }

.app-header__search {
  flex: 1; max-width: 480px;
  display: flex; align-items: center; gap: var(--s-2);
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: var(--r-md);
  padding: 0 var(--s-3);
  height: 36px;
  transition: background var(--motion), border-color var(--motion);
}
.app-header__search:focus-within {
  background: rgba(255,255,255,.20);
  border-color: rgba(255,255,255,.45);
}
.app-header__search svg { width: 16px; height: 16px; color: rgba(255,255,255,.7); flex-shrink: 0; }
.app-header__search input {
  flex: 1; background: transparent; border: 0; outline: 0;
  color: #fff; font-size: var(--t-base);
  height: 100%;
}
.app-header__search input::placeholder { color: rgba(255,255,255,.65); }
.app-header__search kbd {
  font-size: 11px; padding: 2px 6px;
  background: rgba(255,255,255,.15); border-radius: var(--r-sm);
  color: rgba(255,255,255,.8);
  font-family: inherit;
}

.app-header__spacer { flex: 1; }

.app-header__nav {
  display: flex; align-items: center; gap: var(--s-1);
}
.hdr-icon-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  color: rgba(255,255,255,.92);
  border-radius: var(--r-md);
  transition: background var(--motion);
}
.hdr-icon-btn:hover,
.hdr-icon-btn:focus-visible { background: rgba(255,255,255,.14); color: #fff; }
.hdr-icon-btn svg { width: 18px; height: 18px; }
.hdr-icon-btn .dot {
  position: absolute; top: 9px; right: 9px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--c-accent);
  border: 2px solid var(--c-brand);
}

.app-header__user {
  display: flex; align-items: center; gap: var(--s-2);
  padding: 4px var(--s-2) 4px 4px;
  border-radius: var(--r-pill);
  background: rgba(255,255,255,.10);
  color: #fff;
  font-size: var(--t-sm);
  margin-left: var(--s-2);
}
.app-header__user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--c-accent); color: var(--c-brand-900);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: var(--fw-semi); font-size: var(--t-sm);
}
.app-header__user-meta { line-height: 1.2; }
.app-header__user-meta b { display: block; font-weight: var(--fw-semi); }
.app-header__user-meta small { display: block; color: rgba(255,255,255,.7); font-size: 11px; }

.app-header__logout {
  display: inline-flex; align-items: center; gap: var(--s-1);
  height: 36px; padding: 0 var(--s-3);
  background: var(--c-danger); color: #fff;
  border-radius: var(--r-md);
  font-size: var(--t-sm); font-weight: var(--fw-semi);
  margin-left: var(--s-2);
  transition: background var(--motion);
}
.app-header__logout:hover { background: var(--c-danger-700); text-decoration: none; }
.app-header__logout svg { width: 16px; height: 16px; }

/* --- SIDEBAR ---------------------------------------------------- */
.app-sidebar {
  grid-area: sidebar;
  background: var(--c-brand-800);
  color: rgba(255,255,255,.85);
  position: sticky; top: var(--hdr-h);
  height: calc(100vh - var(--hdr-h));
  overflow-y: auto;
  display: flex; flex-direction: column;
  transition: width var(--motion);
}
.sidebar-section {
  padding: var(--s-3) 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-section:last-child { border-bottom: 0; flex: 1; }
.sidebar-section__label {
  display: block;
  padding: var(--s-2) var(--s-4) var(--s-1);
  font-size: 11px; font-weight: var(--fw-semi);
  letter-spacing: .08em; text-transform: uppercase;
  color: rgba(255,255,255,.62);   /* AA na sidebarze (#1a3f2b) ≥4.5:1 */
}
.app.is-sb-collapsed .sidebar-section__label { display: none; }

.nav-item {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 10px var(--s-4);
  color: rgba(255,255,255,.82);
  font-size: var(--t-base); font-weight: var(--fw-medium);
  border-left: 3px solid transparent;
  min-height: 44px;
  position: relative;
  transition: background var(--motion), color var(--motion), border-color var(--motion);
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-item.is-active {
  background: var(--c-brand);
  color: #fff;
  border-left-color: var(--c-accent);
  font-weight: var(--fw-semi);
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 1; }
.nav-item .nav-item__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item .nav-item__badge {
  margin-left: auto;
  font-size: 10px; font-weight: var(--fw-semi);
  background: var(--c-accent); color: var(--c-brand-900);
  padding: 1px 6px; border-radius: var(--r-pill);
}
.app.is-sb-collapsed .nav-item { justify-content: center; padding: 10px var(--s-2); }
.app.is-sb-collapsed .nav-item__label,
.app.is-sb-collapsed .nav-item__badge { display: none; }
.app.is-sb-collapsed .nav-item[data-tip] { position: relative; }
.app.is-sb-collapsed .nav-item[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%);
  background: var(--c-text); color: #fff;
  padding: 6px var(--s-3); border-radius: var(--r-sm);
  font-size: var(--t-sm); white-space: nowrap;
  z-index: 200;
}

/* --- MAIN ------------------------------------------------------- */
.app-main {
  grid-area: main;
  padding: var(--s-6) var(--s-7);
  min-width: 0;
}
.app-main > .container { max-width: var(--content-max); margin: 0 auto; }

/* === 4. BREADCRUMBS + PAGE HEADER ======================================= */
.breadcrumbs {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: var(--s-1);
  font-size: var(--t-sm); color: var(--c-text-muted);
  margin-bottom: var(--s-4);
}
.breadcrumbs a { color: var(--c-link); }
.breadcrumbs__sep { color: var(--c-border-strong); }
.breadcrumbs__current { color: var(--c-text); font-weight: var(--fw-medium); }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--s-4); flex-wrap: wrap;
  margin-bottom: var(--s-6);
}
.page-head__back {
  display: inline-flex; align-items: center; gap: var(--s-1);
  font-size: var(--t-sm); color: var(--c-text-muted);
  margin-bottom: var(--s-2);
  white-space: nowrap;
}
.page-head__back svg { width: 16px; height: 16px; flex-shrink: 0; }
.page-head__back:hover { color: var(--c-link); }
.page-head__title {
  font-size: var(--t-2xl); font-weight: var(--fw-bold);
  color: var(--c-text); line-height: 1.15;
  letter-spacing: -.01em;
}
.page-head__subtitle {
  font-size: var(--t-base); color: var(--c-text-muted);
  margin-top: var(--s-1);
  max-width: 1100px;   /* cap tylko dla naprawdę długich opisów; krótkie idą do końca */
}
.page-head__actions {
  display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap;
}

/* === 5. KARTY / SEKCJE / ALERTY ========================================= */
.card {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  border: 1px solid var(--c-divider);
  min-width: 0;
  overflow: hidden;
}
.card dd, .card dt { word-break: break-word; min-width: 0; }
.u-grid-2 > *, .u-grid-3 > *, .u-grid-4 > * { min-width: 0; }

/* INFO-LIST — lista label/value z label nad wartością (do wąskich kart, profile sidebar) */
.info-list { display: grid; gap: var(--s-3); margin-top: var(--s-4); text-align: left; }
.info-list dt {
  font-size: var(--t-xs);
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: var(--fw-semi);
  margin-bottom: 2px;
}
.info-list dd {
  font-size: var(--t-base);
  color: var(--c-text);
  overflow-wrap: anywhere;          /* bezpiecznik dla ekstremalnie długich wartości */
  line-height: 1.4;
}
.info-list dd + dt { margin-top: var(--s-2); padding-top: var(--s-3); border-top: 1px solid var(--c-divider); }
.card__header {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--c-divider);
}
.card__title {
  font-size: var(--t-lg); font-weight: var(--fw-semi); color: var(--c-text);
}
.card__subtitle { font-size: var(--t-sm); color: var(--c-text-muted); margin-top: 2px; }
.card__body { padding: var(--s-5); }
.card__footer {
  padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--c-divider);
  background: var(--c-surface-2);
  display: flex; justify-content: flex-end; gap: var(--s-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* sekcja formularza z legendą jako nagłówkiem */
.form-section { margin-bottom: var(--s-4); }
.form-section__legend {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-5);
  background: var(--c-brand);
  color: #fff;
  font-size: var(--t-md); font-weight: var(--fw-semi);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.form-section__legend svg { width: 18px; height: 18px; }
.form-section__body {
  padding: var(--s-5);
  background: var(--c-surface);
  border: 1px solid var(--c-divider);
  border-top: 0;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* alerty */
.alert {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: var(--t-base);
  margin-bottom: var(--s-3);
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; }
.alert__title { font-weight: var(--fw-semi); margin-bottom: 2px; }
.alert--info    { background: var(--c-info-50);    color: var(--c-info);    border-color: #b6cdf2; }
.alert--success { background: var(--c-success-50); color: var(--c-success); border-color: #a4d4b4; }
.alert--warning { background: var(--c-warning-50); color: var(--c-warning); border-color: #f0c97a; }
.alert--danger  { background: var(--c-danger-50);  color: var(--c-danger);  border-color: #efb1a5; }

/* === 6. FORMULARZE ====================================================== */
.field { display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; }
.field--row { flex-direction: row; align-items: center; gap: var(--s-3); }
.field__label {
  font-size: var(--t-sm); font-weight: var(--fw-medium);
  color: var(--c-text);
}
.field__label .req { color: var(--c-danger); margin-left: 2px; }
.field__hint { font-size: var(--t-xs); color: var(--c-text-muted); }
.field__error {
  display: none;
  font-size: var(--t-xs); color: var(--c-danger);
  margin-top: 2px;
}
.field.is-invalid .field__error { display: block; }
.field.is-invalid .control { border-color: var(--c-danger); box-shadow: 0 0 0 3px rgba(176,52,31,.18); }

/* uniwersalna kontrolka — JEDEN rozmiar dla wszystkich */
.control {
  display: block;
  width: 100%;
  height: var(--ctrl-h);
  box-sizing: border-box;
  padding: 0 var(--ctrl-pad-x);
  font-family: inherit;
  font-size: var(--ctrl-font);
  line-height: calc(var(--ctrl-h) - 2px);  /* centruje tekst, kompensuje border */
  color: var(--c-text);
  background: var(--ctrl-bg);
  border: var(--ctrl-border);
  border-radius: var(--ctrl-radius);
  appearance: none; -webkit-appearance: none;
  transition: border-color var(--motion), box-shadow var(--motion), background var(--motion);
}
.control::placeholder { color: var(--c-text-soft); }
.control:hover:not(:disabled):not(:focus) { border-color: var(--c-border-strong); }
.control:focus {
  outline: 0;
  border-color: var(--c-focus);
  box-shadow: 0 0 0 3px var(--c-focus-ring);
}
.control:disabled,
.control[readonly] {
  background: var(--c-surface-2);
  color: var(--c-text-muted);
  cursor: not-allowed;
}
.control--sm { height: var(--ctrl-h-sm); line-height: calc(var(--ctrl-h-sm) - 2px); padding: 0 10px; font-size: var(--t-sm); }
.control--lg { height: var(--ctrl-h-lg); line-height: calc(var(--ctrl-h-lg) - 2px); padding: 0 var(--s-4); font-size: var(--t-md); }

/* select — wymuszona wysokość + strzałka */
select.control {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%23525a6e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}
select.control:disabled { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%23a4adbf' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>"); }

/* textarea — pozwala rosnąć */
textarea.control {
  height: auto; min-height: calc(var(--ctrl-h) * 2.4);
  line-height: 1.55;
  padding: 10px var(--ctrl-pad-x);
  resize: vertical;
}

/* group: input z ikoną */
.input-group {
  position: relative;
  display: flex; align-items: stretch;
}
.input-group .control { padding-left: 38px; }
.input-group__icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--c-text-soft);
  pointer-events: none;
}
.input-group__suffix-btn {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  height: calc(var(--ctrl-h) - 8px);
  padding: 0 var(--s-3);
  display: inline-flex; align-items: center; gap: var(--s-1);
  font-size: var(--t-sm); color: var(--c-text-muted);
  border-radius: var(--r-sm);
}
.input-group__suffix-btn:hover { background: var(--c-surface-2); color: var(--c-text); }

/* checkbox / radio custom — wyrównane z linią tekstu */
.check {
  display: inline-flex; align-items: flex-start; gap: var(--s-2);
  font-size: var(--t-base); color: var(--c-text);
  cursor: pointer;
  min-height: 24px;
  user-select: none;
}
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check__box {
  flex-shrink: 0;
  width: 18px; height: 18px;
  border: 1.5px solid var(--c-border-strong);
  border-radius: var(--r-sm);
  background: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--motion), border-color var(--motion);
  margin-top: 1px;
}
.check input:checked + .check__box {
  background: var(--c-brand); border-color: var(--c-brand);
}
.check input:checked + .check__box::after {
  content: ''; width: 10px; height: 6px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(1px,-1px);
}
.check input:focus-visible + .check__box { box-shadow: 0 0 0 3px var(--c-focus-ring); }
.check input:disabled + .check__box { background: var(--c-surface-2); border-color: var(--c-border); }
.check--radio .check__box { border-radius: 50%; }
.check--radio input:checked + .check__box { background: #fff; border-color: var(--c-brand); border-width: 5px; }
.check--radio input:checked + .check__box::after { content: none; }

/* toggle switch */
.switch {
  display: inline-flex; align-items: center; gap: var(--s-3);
  font-size: var(--t-base);
  cursor: pointer;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track {
  width: 38px; height: 22px;
  background: var(--c-border-strong);
  border-radius: var(--r-pill);
  position: relative;
  transition: background var(--motion);
}
.switch__track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff;
  box-shadow: var(--sh-1);
  transition: transform var(--motion);
}
.switch input:checked + .switch__track { background: var(--c-brand); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 3px var(--c-focus-ring); }

/* wskaźnik siły hasła */
.pw-strength { margin-top: var(--s-1); }
.pw-strength__bar {
  height: 6px; background: var(--c-surface-3);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.pw-strength__fill {
  height: 100%; width: 0;
  background: var(--c-danger);
  border-radius: var(--r-pill);
  transition: width var(--motion), background var(--motion);
}
.pw-strength.is-weak   .pw-strength__fill { width: 25%; background: var(--c-danger); }
.pw-strength.is-fair   .pw-strength__fill { width: 50%; background: var(--c-warning); }
.pw-strength.is-good   .pw-strength__fill { width: 75%; background: var(--c-accent); }
.pw-strength.is-strong .pw-strength__fill { width: 100%; background: var(--c-success); }
.pw-strength__label {
  display: flex; justify-content: space-between;
  font-size: var(--t-xs); color: var(--c-text-muted);
  margin-top: var(--s-1);
}
.pw-rules { list-style: none; padding: 0; margin: var(--s-2) 0 0; font-size: var(--t-xs); color: var(--c-text-muted); }
.pw-rules li { display: flex; align-items: center; gap: var(--s-1); margin-bottom: 2px; }
.pw-rules li::before { content: '○'; color: var(--c-text-soft); font-weight: var(--fw-bold); }
.pw-rules li.is-ok { color: var(--c-success); }
.pw-rules li.is-ok::before { content: '✓'; color: var(--c-success); }
.pw-rules li.is-bad { color: var(--c-danger); }
.pw-rules li.is-bad::before { content: '✕'; color: var(--c-danger); }

/* === 7. FILTRY ========================================================= */
.filter-bar {
  background: var(--c-surface);
  border: 1px solid var(--c-divider);
  border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-5);
  margin-bottom: var(--s-4);
  box-shadow: var(--sh-1);
}
.filter-bar__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--s-3);
}
.filter-bar__title {
  font-size: var(--t-sm); font-weight: var(--fw-semi);
  color: var(--c-text-muted);
  letter-spacing: .04em; text-transform: uppercase;
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--s-3) var(--s-4);
  align-items: end;
}
.filter-grid > .filter-actions {
  display: flex; gap: var(--s-2); align-items: end;
}
.filter-grid .field { gap: 6px; }

/* === 8. PRZYCISKI ====================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s-2);
  height: var(--ctrl-h);
  box-sizing: border-box;
  padding: 0 var(--s-4);
  border: 1px solid transparent;
  border-radius: var(--ctrl-radius);
  font-family: inherit;
  font-size: var(--t-base);
  font-weight: var(--fw-semi);
  line-height: 1;
  white-space: nowrap;
  transition: background var(--motion), border-color var(--motion), color var(--motion), box-shadow var(--motion);
  text-decoration: none;
  min-width: 44px;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn--primary {
  background: var(--c-brand); border-color: var(--c-brand); color: #fff;
}
.btn--primary:hover:not(:disabled) { background: var(--c-brand-700); border-color: var(--c-brand-700); text-decoration: none; }
.btn--secondary {
  background: var(--c-surface); border-color: var(--c-border-strong); color: var(--c-text);
}
.btn--secondary:hover:not(:disabled) { background: var(--c-surface-2); text-decoration: none; }
.btn--ghost {
  background: transparent; border-color: transparent; color: var(--c-link);
}
.btn--ghost:hover:not(:disabled) { background: var(--c-brand-50); color: var(--c-brand-700); text-decoration: none; }
.btn--danger {
  background: var(--c-danger); border-color: var(--c-danger); color: #fff;
}
.btn--danger:hover:not(:disabled) { background: var(--c-danger-700); border-color: var(--c-danger-700); text-decoration: none; }
.btn--danger-outline {
  background: var(--c-surface); border-color: var(--c-danger); color: var(--c-danger);
}
.btn--danger-outline:hover:not(:disabled) { background: var(--c-danger-50); text-decoration: none; }
.btn--accent {
  background: var(--c-accent); border-color: var(--c-accent); color: var(--c-brand-900);
}
.btn--accent:hover:not(:disabled) { background: var(--c-accent-700); border-color: var(--c-accent-700); color: #fff; text-decoration: none; }

.btn--sm { height: var(--ctrl-h-sm); padding: 0 var(--s-3); font-size: var(--t-sm); min-width: 32px; }
.btn--lg { height: var(--ctrl-h-lg); padding: 0 var(--s-5); font-size: var(--t-md); }
.btn--block { width: 100%; }

/* icon-only — kwadrat, etykieta przez aria-label */
.btn--icon {
  width: var(--ctrl-h); padding: 0;
  background: var(--c-surface); border: 1px solid var(--c-border);
  color: var(--c-text-muted);
}
.btn--icon:hover:not(:disabled) { background: var(--c-surface-2); color: var(--c-text); border-color: var(--c-border-strong); }
.btn--icon.btn--sm { width: var(--ctrl-h-sm); }

/* === 9. TABELA ========================================================= */
.table-wrap {
  background: var(--c-surface);
  border: 1px solid var(--c-divider);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  overflow: hidden;
}
.table-wrap__scroll {
  overflow-x: auto;
  max-width: 100%;
}
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--t-base);
  color: var(--c-text);
}
.table thead th {
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-border);
  padding: var(--s-3) var(--tbl-pad-x);
  text-align: left;
  font-size: var(--t-xs);
  font-weight: var(--fw-semi);
  color: var(--c-text-muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
.table thead th.is-numeric { text-align: right; }
.table thead th.is-center  { text-align: center; }
.table thead th .sort-btn {
  display: inline-flex; align-items: center; gap: 4px;
  color: inherit; font-weight: inherit; text-transform: inherit; letter-spacing: inherit;
}
.table thead th .sort-btn:hover { color: var(--c-text); }
.table thead th .sort-btn svg { width: 12px; height: 12px; opacity: .55; }
.table thead th.is-sorted-asc  .sort-btn svg,
.table thead th.is-sorted-desc .sort-btn svg { opacity: 1; color: var(--c-brand); }

.table tbody tr {
  background: var(--c-surface);
  transition: background var(--motion);
}
.table tbody tr + tr td { border-top: 1px solid var(--c-divider); }
.table tbody tr:hover { background: var(--c-brand-50); }
.table tbody tr.is-selected { background: #f0f7f3; }
.table tbody td {
  padding: var(--s-3) var(--tbl-pad-x);
  vertical-align: middle;
  font-size: var(--t-base);
}
.table tbody td.is-numeric { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody td.is-center  { text-align: center; }
.table tbody td.is-muted   { color: var(--c-text-muted); }
.table tbody td.is-actions { white-space: nowrap; }

.table .row-checkbox { width: 36px; }
.table .row-actions {
  display: inline-flex; align-items: center; gap: var(--s-1);
  position: relative;   /* kontener dla popover menu */
}

/* MENU KONTEKSTOWE (popover dla „…") */
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 220px;
  background: var(--c-surface);
  border: 1px solid var(--c-divider);
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
  padding: 4px;
  z-index: 60;
  display: none;
}
.menu.is-open { display: block; }
.menu__item {
  display: flex; align-items: center; gap: var(--s-2);
  width: 100%;
  padding: 8px 10px;
  font-size: var(--t-sm);
  color: var(--c-text);
  border-radius: var(--r-sm);
  text-align: left;
  text-decoration: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  line-height: 1.3;
}
.menu__item:hover { background: var(--c-surface-2); text-decoration: none; }
.menu__item svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--c-text-muted); }
.menu__item:hover svg { color: var(--c-text); }
.menu__item--danger { color: var(--c-danger); }
.menu__item--danger svg { color: var(--c-danger); }
.menu__item--danger:hover { background: var(--c-danger-50); }
.menu__sep { height: 1px; background: var(--c-divider); margin: 4px 0; border: 0; }
.menu__hint { padding: 6px 10px 4px; font-size: var(--t-xs); color: var(--c-text-soft); }

/* priorytet kolumn — chowaj drugorzędne, NIE pozwalaj na poziomy scroll tabeli */
@media (max-width: 1280px) { .table .col-prio-3 { display: none; } }
@media (max-width: 1080px) { .table .col-prio-2 { display: none; } }
@media (max-width: 920px)  { .table .col-prio-1 { display: none; } }

/* Inline grid 2fr/1fr → 1 kolumna @ ≤1100 (zapobiega rozjeżdżaniu się sidebar+content) */
@media (max-width: 1100px) {
  [style*="grid-template-columns:2fr 1fr"],
  [style*="grid-template-columns: 2fr 1fr"],
  [style*="grid-template-columns:1fr 2fr"],
  [style*="grid-template-columns: 1fr 2fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* Wszelki inline grid 2-col (1fr 1fr) → 1 kolumna @ ≤480 */
@media (max-width: 480px) {
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  /* page-head__title z gender-icon + status badge zawijaj */
  .page-head__title { flex-wrap: wrap; font-size: var(--t-xl); line-height: 1.2; }
  .page-head__title .status { font-size: var(--t-sm); }
}

/* Tabs — zawijają się (flex-wrap w bazie), nie rozszerzają kontenera */
.tabs { width: 100%; min-width: 0; }
.tab { flex: 0 0 auto; }
/* na bardzo małych ekranach — taby pionowo */
@media (max-width: 480px) {
  .tab { width: 100%; justify-content: flex-start; border-bottom: 1px solid var(--c-divider); margin-bottom: 0; }
  .tab.is-active { border-bottom-color: var(--c-brand); }
}

/* perm-matrix — pierwsza kolumna może łamać długie nazwy */
.perm-matrix td:first-child { word-break: break-word; }
@media (max-width: 480px) {
  .perm-matrix td:first-child { max-width: 140px; font-size: var(--t-xs); }
  .perm-matrix .badge { font-size: 9px; padding: 0 4px; }
}

/* table cells — łam długie wartości (np. e-mail) na mobile */
@media (max-width: 480px) {
  .table tbody td { word-break: break-word; }
}

/* macierz CRUD */
.perm-matrix th, .perm-matrix td { text-align: center; }
.perm-matrix th:first-child,
.perm-matrix td:first-child { text-align: left; }
/* mobile @≤480: macierz CRUD się nie zmieści — kompresja paddingów + ukrycie pomocniczych kolumn */
@media (max-width: 480px) {
  .perm-matrix th, .perm-matrix td { padding: var(--s-1) 4px; font-size: var(--t-xs); }
}
/* średnie ekrany: zmniejsz padding macierzy CRUD */
@media (max-width: 1280px) {
  .perm-matrix th, .perm-matrix td { padding: var(--s-2) 8px; font-size: var(--t-sm); }
}
.perm-matrix tbody td:not(:first-child) { font-variant-numeric: tabular-nums; }
.perm-matrix .check { justify-content: center; }
.perm-matrix tfoot td {
  background: var(--c-surface-2);
  border-top: 1px solid var(--c-border);
  font-size: var(--t-xs); color: var(--c-text-muted);
  padding: var(--s-2) var(--tbl-pad-x);
}

/* === 10. PAGINACJA ===================================================== */
.pager {
  display: flex; align-items: center; justify-content: flex-end;
  gap: var(--s-3); flex-wrap: wrap;
  padding: var(--s-3) var(--s-5);
  background: var(--c-surface);
  border-top: 1px solid var(--c-divider);
}
.pager__info {
  font-size: var(--t-sm); color: var(--c-text-muted);
  margin-right: auto;
}
.pager__sizes { display: flex; align-items: center; gap: var(--s-2); font-size: var(--t-sm); color: var(--c-text-muted); }
.pager__sizes .control { width: 84px; }
.pager__nav { display: inline-flex; align-items: center; gap: 2px; }
.pager__btn {
  min-width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 10px;
  background: transparent; border: 1px solid transparent;
  color: var(--c-text);
  font-size: var(--t-sm); font-weight: var(--fw-medium);
  border-radius: var(--r-sm);
  transition: background var(--motion), border-color var(--motion);
}
.pager__btn:hover { background: var(--c-surface-2); border-color: var(--c-border); text-decoration: none; }
.pager__btn.is-active {
  background: var(--c-brand); color: #fff; border-color: var(--c-brand);
}
.pager__btn:disabled { opacity: .35; cursor: not-allowed; }
.pager__ellipsis { padding: 0 var(--s-1); color: var(--c-text-muted); }

/* === 11. BADGE / PILL =================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px;
  background: var(--c-surface-3); color: var(--c-text);
  font-size: 12px; font-weight: var(--fw-semi);
  border-radius: var(--r-pill);
  line-height: 1;
  white-space: nowrap;
}
.badge--success  { background: var(--c-success-50); color: var(--c-success); }
.badge--danger   { background: var(--c-danger-50);  color: var(--c-danger); }
.badge--warning  { background: var(--c-warning-50); color: var(--c-warning); }
.badge--info     { background: var(--c-info-50);    color: var(--c-info); }
.badge--neutral  { background: var(--c-surface-3);  color: var(--c-text-muted); }
.badge--brand    { background: var(--c-brand-50);   color: var(--c-brand-700); }
.badge--accent   { background: var(--c-accent-50);  color: var(--c-accent-700); }
.badge--outline {
  background: transparent;
  border: 1px solid var(--c-border-strong);
  color: var(--c-text-muted);
}
.badge .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

/* status text z kropką */
.status {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-size: var(--t-sm);
  white-space: nowrap;   /* pigułka — nie łam tekstu („Konto zablokowane", „Błędne hasło") */
}
.status::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--c-text-soft);
}
.status--ok::before      { background: var(--c-success); }
.status--warn::before    { background: var(--c-warning); }
.status--danger::before  { background: var(--c-danger); }
.status--info::before    { background: var(--c-info); }
.status--locked::before  { background: var(--c-text-soft); }

/* ikona płci przy nazwisku (skala 14px obok tekstu) */
.gender-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--c-surface-3);
  color: var(--c-text-muted);
  font-size: 12px; font-weight: var(--fw-bold);
  vertical-align: middle;
  margin-right: var(--s-1);
}
.gender-icon--f { background: #fce7ea; color: #9b2b3a; }
.gender-icon--m { background: #e0ecfb; color: #18467b; }

/* tagi roli (Pracownik / Koordynator / Super) — kompaktowe, łamią się w wąskiej kolumnie */
.role-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.role-tag {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 8px;
  border-radius: var(--r-pill);
  font-size: 12px; font-weight: var(--fw-semi);
  white-space: nowrap;
  background: var(--c-surface-3); color: var(--c-text-muted);
}
.role-tag--employee { background: var(--c-brand-50); color: var(--c-brand-700); }
.role-tag--coord    { background: var(--c-accent-50); color: var(--c-accent-700); }
.role-tag--super    { background: #f0d4f0; color: #5a1d5a; }
.role-tag--member   { background: var(--c-info-50); color: var(--c-info); }

/* === 12. MODAL ========================================================== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.45);
  display: flex; align-items: center; justify-content: center;
  padding: var(--s-5);
  z-index: 1000;
}
.modal {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-4);
  width: 100%; max-width: 560px;
  max-height: calc(100vh - var(--s-10));
  display: flex; flex-direction: column;
  overflow: hidden;
}
.modal--sm { max-width: 420px; }
.modal--lg { max-width: 820px; }
.modal__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--c-divider);
  flex-shrink: 0;
}
.modal__title { font-size: var(--t-lg); font-weight: var(--fw-semi); }
.modal__close {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--c-text-muted);
  font-size: 24px; line-height: 1; font-weight: var(--fw-regular);
  transition: background var(--motion);
}
.modal__close:hover { background: var(--c-surface-2); color: var(--c-text); }
.modal__body { padding: var(--s-5); overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal__footer {
  display: flex; justify-content: flex-end; gap: var(--s-2);
  padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--c-divider);
  background: var(--c-surface-2);
  flex-shrink: 0;
}
/* Gdy <form> owija body+footer — musi przejąć layout kolumny modala,
   inaczej body się nie kurczy a stopka (akcje) wypada poza modal i znika. */
.modal > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.modal--danger .modal__header { background: var(--c-danger-50); border-bottom-color: #efb1a5; }
.modal--danger .modal__title  { color: var(--c-danger); }

/* === 13. TOAST ========================================================== */
.toast-stack {
  position: fixed; bottom: var(--s-5); right: var(--s-5);
  display: flex; flex-direction: column; gap: var(--s-2);
  z-index: 2000;
  max-width: 380px;
}
.toast {
  display: flex; align-items: flex-start; gap: var(--s-3);
  background: var(--c-surface);
  border: 1px solid var(--c-divider);
  border-left: 4px solid var(--c-brand);
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
  padding: var(--s-3) var(--s-4);
  font-size: var(--t-base);
}
.toast--success { border-left-color: var(--c-success); }
.toast--danger  { border-left-color: var(--c-danger); }
.toast--warning { border-left-color: var(--c-warning); }
.toast__icon { flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px; }
.toast--success .toast__icon { color: var(--c-success); }
.toast--danger  .toast__icon { color: var(--c-danger); }
.toast--warning .toast__icon { color: var(--c-warning); }
.toast__body { flex: 1; }
.toast__title { font-weight: var(--fw-semi); margin-bottom: 2px; }
.toast__msg { color: var(--c-text-muted); font-size: var(--t-sm); line-height: 1.45; }

/* === 14. ZAKŁADKI ======================================================= */
.tabs {
  display: flex; gap: 0;
  flex-wrap: wrap;                 /* wiele zakładek (np. karta członka) zawija się — bez poziomego scrolla */
  border-bottom: 1px solid var(--c-border);
  margin-bottom: var(--s-4);
}
.tab {
  display: inline-flex; align-items: center; gap: var(--s-2);
  height: 40px; padding: 0 var(--s-4);
  border: 0; background: transparent;
  color: var(--c-text-muted);
  font-size: var(--t-base); font-weight: var(--fw-medium);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color var(--motion), border-color var(--motion);
  white-space: nowrap;
  flex-shrink: 0;  /* nie zwijaj — niech tabs scrollują się poziomo wewnątrz .tabs */
}
.tab:hover { color: var(--c-text); text-decoration: none; }
.tab.is-active {
  color: var(--c-brand-700); border-bottom-color: var(--c-brand);
  font-weight: var(--fw-semi);
}
.tab .badge { margin-left: var(--s-1); }

/* zakładki językowe — kompaktowe */
.lang-tabs {
  display: inline-flex; gap: 4px;
  padding: 4px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  margin-bottom: var(--s-3);
}
.lang-tab {
  height: 28px; padding: 0 var(--s-3);
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--t-sm); font-weight: var(--fw-medium);
  color: var(--c-text-muted);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.lang-tab:hover { color: var(--c-text); }
.lang-tab.is-active { background: var(--c-surface); color: var(--c-brand-700); box-shadow: var(--sh-1); font-weight: var(--fw-semi); }

/* segmented control */
.segmented {
  display: inline-flex; padding: 3px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
}
.segmented__opt {
  height: 30px; padding: 0 var(--s-3);
  display: inline-flex; align-items: center;
  font-size: var(--t-sm); font-weight: var(--fw-medium);
  color: var(--c-text-muted);
  border-radius: var(--r-sm);
}
.segmented__opt.is-active { background: var(--c-surface); color: var(--c-brand-700); box-shadow: var(--sh-1); }

/* === 15. WYSIWYG ======================================================== */
.wysiwyg {
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
  overflow: hidden;
}
.wysiwyg__toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  padding: 6px var(--s-2);
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-divider);
}
.wysiwyg__group {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 0 var(--s-1);
  border-right: 1px solid var(--c-border);
}
.wysiwyg__group:last-child { border-right: 0; }
.wysiwyg__btn {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  cursor: pointer;
}
.wysiwyg__btn:hover { background: var(--c-surface-3); color: var(--c-text); }
.wysiwyg__btn.is-active { background: var(--c-brand-50); color: var(--c-brand-700); border-color: var(--c-brand-300); }
.wysiwyg__btn svg { width: 16px; height: 16px; }
.wysiwyg__body {
  padding: var(--s-4);
  min-height: 180px;
  font-size: var(--t-base);
  line-height: 1.6;
  color: var(--c-text);
}
.wysiwyg__body[contenteditable]:focus { outline: 0; }

/* === 16. STANY ========================================================== */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: var(--s-3);
  padding: var(--s-10) var(--s-5);
  color: var(--c-text-muted);
}
.empty__icon { width: 56px; height: 56px; opacity: .35; color: var(--c-text-soft); }
.empty__title { font-size: var(--t-lg); font-weight: var(--fw-semi); color: var(--c-text); }
.empty__msg   { font-size: var(--t-base); max-width: 360px; }

.skeleton {
  background: linear-gradient(90deg, var(--c-surface-2) 0%, var(--c-surface-3) 50%, var(--c-surface-2) 100%);
  background-size: 200% 100%;
  animation: skel 1.4s infinite;
  border-radius: var(--r-sm);
}
@keyframes skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* === 17. BULK ACTIONS =================================================== */
.bulk-bar {
  display: none;
  align-items: center; gap: var(--s-3);
  padding: var(--s-2) var(--s-5);
  background: var(--c-info-50);
  border-bottom: 1px solid #b6cdf2;
  font-size: var(--t-sm);
  color: var(--c-info);
}
.bulk-bar.is-visible { display: flex; }
.bulk-bar__count { font-weight: var(--fw-semi); }
.bulk-bar__spacer { flex: 1; }

/* === 18. TOOLTIP CSS ==================================================== */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  background: var(--c-text); color: #fff;
  padding: 4px 8px; border-radius: var(--r-sm);
  font-size: var(--t-xs); white-space: nowrap;
  z-index: 200; pointer-events: none;
}

/* === 19. UTILITIES ====================================================== */
.u-stack { display: flex; flex-direction: column; gap: var(--s-3); }
.u-stack--sm { gap: var(--s-2); }
.u-stack--lg { gap: var(--s-5); }
.u-row { display: flex; gap: var(--s-3); align-items: center; }
.u-row--end { justify-content: flex-end; }
.u-row--between { justify-content: space-between; }
.u-row--wrap { flex-wrap: wrap; }

.u-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.u-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4); }
.u-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-4); }
.u-col-span-2 { grid-column: span 2; }
.u-col-span-3 { grid-column: span 3; }
.u-col-span-all { grid-column: 1 / -1; }

.u-mt-0 { margin-top: 0 !important; }
.u-mt-1 { margin-top: var(--s-1); }
.u-mt-2 { margin-top: var(--s-2); }
.u-mt-3 { margin-top: var(--s-3); }
.u-mt-4 { margin-top: var(--s-4); }
.u-mt-5 { margin-top: var(--s-5); }
.u-mb-0 { margin-bottom: 0 !important; }
.u-mb-1 { margin-bottom: var(--s-1); }
.u-mb-2 { margin-bottom: var(--s-2); }
.u-mb-3 { margin-bottom: var(--s-3); }
.u-mb-4 { margin-bottom: var(--s-4); }
.u-mb-5 { margin-bottom: var(--s-5); }

.u-text-muted { color: var(--c-text-muted); }
.u-text-soft  { color: var(--c-text-soft); }
.u-text-danger { color: var(--c-danger); }
.u-text-success { color: var(--c-success); }
.u-text-right { text-align: right; }
.u-text-center { text-align: center; }
.u-text-sm { font-size: var(--t-sm); }
.u-text-xs { font-size: var(--t-xs); }
.u-text-lg { font-size: var(--t-lg); }
.u-font-semi { font-weight: var(--fw-semi); }
.u-font-bold { font-weight: var(--fw-bold); }
.u-monospace { font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace; font-variant-numeric: tabular-nums; }
/* Data/godzina w listach: UI font + tabular-nums (wyrównanie cyfr) + nowrap (nie zawijaj „2026-05-14 09:42") */
.u-datetime { font-variant-numeric: tabular-nums; white-space: nowrap; font-feature-settings: "tnum"; letter-spacing: -.01em; }

.u-w-100 { width: 100%; }
.u-mw-md { max-width: 480px; }
.u-mw-lg { max-width: 720px; }
.u-flex-1 { flex: 1; }

/* === 20. RWD ============================================================ */
@media (max-width: 1024px) {
  .app-main { padding: var(--s-5); }
  .app-header__search { max-width: 280px; }
  .u-grid-3, .u-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .app {
    grid-template-columns: 0 1fr;
    grid-template-areas:
      "header header"
      "main   main";
  }
  .app-sidebar {
    position: fixed; top: var(--hdr-h); left: 0;
    width: var(--sb-w);
    transform: translateX(-100%);
    transition: transform var(--motion);
    z-index: 60;
    box-shadow: var(--sh-3);
  }
  .app.is-mobile-menu-open .app-sidebar { transform: translateX(0); }
  .app-sidebar .sidebar-section__label { display: block; }
  .app-sidebar .nav-item { justify-content: flex-start; padding: 10px var(--s-4); }
  .app-sidebar .nav-item__label { display: block; }

  .app-header__search { display: none; }
  .app-header__brand small { display: none; }
  .app-header__user-meta { display: none; }
  .app-main { padding: var(--s-4); }

  .page-head { flex-direction: column; align-items: stretch; }
  .page-head__actions { width: 100%; }

  /* @≤768 — wszystkie zwykłe tabele zmniejszają padding, by się zmieścić */
  .table thead th, .table tbody td { padding: var(--s-2) var(--s-3); font-size: var(--t-sm); }
  /* Tabela → karty (gdy ma klasę table-cards) */
  .table-cards thead { display: none; }
  .table-cards tbody tr {
    display: grid; grid-template-columns: 1fr;
    background: var(--c-surface);
    border: 1px solid var(--c-divider);
    border-radius: var(--r-md);
    margin-bottom: var(--s-3);
    padding: var(--s-3);
    box-shadow: var(--sh-1);
  }
  .table-cards tbody tr + tr td { border-top: 0; }
  .table-cards tbody td {
    display: flex; justify-content: space-between; align-items: center;
    padding: var(--s-2) 0;
    border-top: 1px solid var(--c-divider) !important;
    gap: var(--s-3);
  }
  .table-cards tbody td:first-child { border-top: 0 !important; }
  .table-cards tbody td::before {
    content: attr(data-label);
    flex-shrink: 0;
    font-size: var(--t-xs); font-weight: var(--fw-semi);
    color: var(--c-text-muted);
    text-transform: uppercase; letter-spacing: .04em;
  }

  .filter-grid { grid-template-columns: 1fr; }
  .u-grid-2, .u-grid-3, .u-grid-4 { grid-template-columns: 1fr !important; }

  .pager { justify-content: center; flex-direction: column; align-items: stretch; gap: var(--s-2); }
  .pager__info { width: 100%; text-align: center; margin-right: 0; }
  .pager__nav { flex-wrap: wrap; justify-content: center; }
}
@media (max-width: 480px) {
  /* na małych ekranach skróć paginację do prev/page/next */
  .pager__nav .pager__btn:not(.is-active):not([aria-label="Poprzednia strona"]):not([aria-label="Następna strona"]):not([aria-label="Pierwsza strona"]):not([aria-label="Ostatnia strona"]) { display: none; }
  .pager__nav .pager__ellipsis { display: none; }
}

/* hamburger w headerze widoczny tylko na mobile */
.hamburger { display: none; }
@media (max-width: 768px) {
  .hamburger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    border-radius: var(--r-md); color: #fff;
  }
  .hamburger:hover { background: rgba(255,255,255,.12); }
}

/* mobile ≤480px — belka MUSI się zmieścić (fix poziomego scrolla @360) */
@media (max-width: 480px) {
  .app-header { gap: var(--s-2); padding: 0 var(--s-3); }
  .app-header__brand { min-width: 0; }
  .app-header__brand span:not(.brand-mark) { display: none; }  /* zostaw tylko znak „eS" */
  .app-header__sidebar-toggle { display: none; }               /* collapse-toggle zbędny na mobile (jest hamburger) */
  .app-header__user { display: none; }                         /* pigułka użytkownika */
  .hdr-icon-btn { width: 34px; height: 34px; }
}

/* === 21. PRINT + FORCED-COLORS ========================================= */
@media print {
  .app-header, .app-sidebar, .pager, .toast-stack, .modal-backdrop { display: none !important; }
  .app { display: block; }
  .app-main { padding: 0; }
  .card, .table-wrap { box-shadow: none; border-color: #000; }
}
@media (forced-colors: active) {
  .btn, .control, .badge, .table-wrap, .card, .modal {
    border: 1px solid CanvasText;
  }
  .btn:focus-visible, .control:focus { outline: 2px solid Highlight; }
}

/* ============================================================================
   TIMELINE — oś statusu wniosku/sprawy (komponent dodatkowy, Fala 2 Panel)
   ============================================================================ */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline__item { position: relative; padding: 0 0 var(--s-4) var(--s-6); }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before { /* linia łącząca */
  content: ""; position: absolute; left: 6px; top: 4px; bottom: -4px;
  width: 2px; background: var(--c-surface-3);
}
.timeline__item:last-child::before { display: none; }
.timeline__dot {
  position: absolute; left: 0; top: 2px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--c-surface); border: 2px solid var(--c-surface-3); box-sizing: border-box;
}
.timeline__item--done .timeline__dot { background: var(--c-success); border-color: var(--c-success); }
.timeline__item--done::before { background: var(--c-success); }
.timeline__item--active .timeline__dot { background: var(--c-warning); border-color: var(--c-warning); box-shadow: 0 0 0 3px var(--c-warning-50); }
.timeline__title { font-weight: 600; line-height: 1.35; }
.timeline__meta { font-size: var(--t-sm); margin-top: 2px; }

/* ============================================================================
   THREAD — korespondencja / dyskusja przy wniosku (komponent dodatkowy)
   ============================================================================ */
.thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-3); }
.thread__msg { display: flex; gap: var(--s-3); align-items: flex-start; }
.thread__msg--out { flex-direction: row-reverse; }
.thread__avatar {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-size: var(--t-sm); font-weight: 700;
  background: var(--c-brand-50); color: var(--c-brand-800);
}
.thread__msg--out .thread__avatar { background: var(--c-surface-3); color: var(--c-text); }
.thread__bubble {
  flex: 1 1 auto; min-width: 0; max-width: 100%;
  background: var(--c-surface-2); border: 1px solid var(--c-border);
  border-radius: var(--r-md); padding: var(--s-2) var(--s-3);
}
.thread__msg--out .thread__bubble { background: var(--c-brand-50); border-color: var(--c-brand-300); }
.thread__head { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); align-items: baseline; margin-bottom: 2px; }
.thread__bubble p { margin: 0; overflow-wrap: anywhere; }
.thread__compose { display: block; }

/* ============================================================================
   ID-CARD — wizualizacja legitymacji adwokackiej (komponent dodatkowy, Panel)
   ============================================================================ */
.id-card {
  width: 100%; max-width: 360px;
  border: 1px solid var(--c-brand-300);
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--c-brand-50), var(--c-surface));
  overflow: hidden; margin-bottom: var(--s-4);
}
.id-card__band {
  background: var(--c-brand-800); color: var(--c-text-inv);
  font-size: 11px; letter-spacing: .04em; font-weight: 600;
  padding: 6px var(--s-3);
}
.id-card__row { display: flex; gap: var(--s-3); align-items: center; padding: var(--s-3); }
.id-card__photo {
  flex: 0 0 auto; width: 64px; height: 76px; border-radius: var(--r-sm);
  background: var(--c-surface); border: 1px solid var(--c-brand-300);
  color: var(--c-brand-700); display: grid; place-items: center;
}
.id-card__photo svg { width: 36px; height: 44px; }
.id-card__data { min-width: 0; }
.id-card__name { font-weight: 700; font-size: var(--t-lg); color: var(--c-brand-900); margin-bottom: 2px; }
.id-card__line { font-size: var(--t-sm); color: var(--c-text); }

/* QR-BOX — kod QR legitymacji mObywatel */
.qr-box {
  flex: 0 0 auto; width: 110px; height: 110px; padding: 8px;
  border: 1px solid var(--c-border); border-radius: var(--r-md);
  background: var(--c-surface); color: var(--c-text); box-sizing: border-box;
}
.qr-box svg { width: 100%; height: 100%; display: block; }

/* ============================================================================
   VIDEO-FRAME — placeholder odtwarzacza wideo (komponent dodatkowy, Panel)
   ============================================================================ */
.video-frame {
  width: 100%; aspect-ratio: 16 / 9;
  background: var(--c-surface-3); color: var(--c-brand-700);
  border: 1px solid var(--c-border); border-radius: var(--r-md);
  display: grid; place-items: center;
}
.video-frame svg { width: 64px; height: 64px; }

/* ============================================================================
   NOTE — notatka wewnętrzna z załącznikiem (komponent dodatkowy, Instytucje)
   ============================================================================ */
.note {
  border: 1px solid var(--c-border); border-left: 3px solid var(--c-brand-300);
  border-radius: var(--r-md); background: var(--c-surface-2);
  padding: var(--s-3);
}
.note__head { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); align-items: baseline; justify-content: space-between; margin-bottom: var(--s-1); }
.note p { margin: 0; overflow-wrap: anywhere; }

/* ============================================================================
   DOC-LIST — lista dokumentów do pobrania (komponent dodatkowy, Egzaminy)
   ============================================================================ */
.doc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.doc-list__item {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  padding: var(--s-2) 0; border-bottom: 1px solid var(--c-divider);
}
.doc-list__item:last-child { border-bottom: 0; }
.doc-list__name { display: inline-flex; align-items: center; gap: var(--s-2); min-width: 0; overflow-wrap: anywhere; color: var(--c-text); }
.doc-list__name svg { flex: 0 0 auto; color: var(--c-brand-700); }

/* ============================================================================
   EXAM-ROW — wiersz egzaminu na publicznej liście CRE (komponent dodatkowy)
   ============================================================================ */
.exam-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  flex-wrap: wrap;
  padding: var(--s-3); border: 1px solid var(--c-border); border-radius: var(--r-md);
  background: var(--c-surface);
}
.exam-row__title { font-size: var(--t-base); margin: 0; }
.exam-row__side { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }

/* ============================================================================
   GENERATOR — karty szablonów + podgląd kreatora grafik (komponenty dodatkowe)
   ============================================================================ */
.tpl-card {
  display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-2);
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md);
  cursor: pointer; text-align: left; font: inherit; color: var(--c-text); width: 100%;
}
.tpl-card:hover { border-color: var(--c-brand-300); background: var(--c-brand-50); }
.tpl-card:focus-visible { outline: 2px solid var(--c-brand); outline-offset: 2px; }
.tpl-card__thumb {
  display: block; width: 100%; border-radius: var(--r-sm);
  background: repeating-linear-gradient(135deg, var(--c-surface-3) 0 8px, var(--c-surface-2) 8px 16px);
  border: 1px solid var(--c-divider);
}
.tpl-card__label { font-size: var(--t-sm); font-weight: 600; }

.canvas-preview {
  width: 100%; aspect-ratio: 3 / 4; border: 1px solid var(--c-border); border-radius: var(--r-md);
  background: linear-gradient(160deg, var(--c-brand-900), var(--c-brand));
  color: var(--c-text-inv); display: grid; place-items: center; padding: var(--s-5);
}
.canvas-preview__inner { display: flex; flex-direction: column; gap: var(--s-2); align-items: center; text-align: center; }
.canvas-preview__inner strong { font-size: var(--t-2xl); line-height: 1.1; }

/* ============================================================================
   CALENDAR — miesięczny widok wydarzeń (komponent dodatkowy, Wydarzenia)
   ============================================================================ */
.cal { border: 1px solid var(--c-border); border-radius: var(--r-md); overflow: hidden; }
.cal__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--c-border); }
.cal__title { font-weight: 600; }
.cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal__dow { padding: 6px; font-size: var(--t-xs); font-weight: 600; color: var(--c-text-muted); text-align: center; border-bottom: 1px solid var(--c-divider); background: var(--c-surface-2); }
.cal__day { min-height: 84px; padding: 4px 6px; border-right: 1px solid var(--c-divider); border-bottom: 1px solid var(--c-divider); display: flex; flex-direction: column; gap: 3px; }
.cal__day:nth-child(7n) { border-right: 0; }
.cal__daynum { font-size: var(--t-sm); color: var(--c-text-muted); }
.cal__day--muted { background: var(--c-surface-2); }
.cal__day--today .cal__daynum { font-weight: 700; color: var(--c-brand-700); }
.cal__event { font-size: var(--t-xs); line-height: 1.25; padding: 2px 6px; border-radius: var(--r-sm); background: var(--c-brand-50); color: var(--c-brand-800); border: 1px solid var(--c-brand-300); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal__event--accent { background: var(--c-warning-50); color: var(--c-warning); border-color: var(--c-warning); }
@media (max-width: 640px) {
  .cal__day { min-height: 56px; }
  .cal__event { font-size: 9px; padding: 1px 4px; }
}

/* ============================================================================
   TREE — drzewo katalogów/podkatalogów (komponent dodatkowy, Multimedia)
   ============================================================================ */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: var(--s-4); }
.tree__row { display: flex; align-items: center; gap: var(--s-2); padding: 6px 8px; border-radius: var(--r-sm); color: var(--c-text); }
.tree__row:hover { background: var(--c-surface-2); }
.tree__row.is-active { background: var(--c-brand-50); color: var(--c-brand-800); font-weight: 600; }
.tree__row svg { flex: 0 0 auto; color: var(--c-brand-700); }
.tree__row svg { width: 18px; height: 18px; }
.tree__label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; padding: 0; }
.tree__count { font-size: var(--t-xs); color: var(--c-text-muted); }

/* ============================================================================
   POPRAWKI SPÓJNOŚCI — filtry / footer / collapsible (iteracja UX)
   ============================================================================ */
/* Akcje filtra (Wyczyść / Filtruj) — odstęp i wyrównanie (było zbite) */
.filter-grid > .filter-bar__actions { display: flex; gap: var(--s-2); align-items: end; flex-wrap: wrap; }

/* Filtr osadzony w karcie nad listą: czytelny pasek, NIE zlewa się z tabelą,
   bez efektu „box-in-box" (dziedziczy spójny wygląd globalnie). */
.card > .filter-bar {
  border: 0; border-bottom: 1px solid var(--c-border);
  border-radius: 0; box-shadow: none; margin: 0;
  background: var(--c-surface-2);
}

/* Collapsible filtr (<details>) — np. karta członka » Wydarzenia (rozwiń filtry) */
.filter-details { border-bottom: 1px solid var(--c-border); background: var(--c-surface-2); }
.filter-details > summary {
  list-style: none; cursor: pointer; padding: var(--s-3) var(--s-5);
  font-size: var(--t-sm); font-weight: var(--fw-semi); color: var(--c-text);
  display: flex; align-items: center; gap: var(--s-2);
}
.filter-details > summary::-webkit-details-marker { display: none; }
.filter-details > summary::before {
  content: ""; width: 7px; height: 7px; flex: 0 0 auto;
  border-right: 2px solid var(--c-text-muted); border-bottom: 2px solid var(--c-text-muted);
  transform: rotate(-45deg); transition: transform .15s;
}
.filter-details[open] > summary::before { transform: rotate(45deg); }
.filter-details > .filter-grid { padding: 0 var(--s-5) var(--s-4); }
/* .filter-grid ma display:grid (reguła autora), co nadpisuje natywne ukrywanie
   zamkniętego <details> (reguła UA) — jawnie chowamy treść w stanie zamkniętym. */
.filter-details:not([open]) > .filter-grid { display: none; }

/* Stopka kontekstów publicznych (CRE / logowanie) — wyśrodkowana */
.auth-foot { text-align: center; padding: var(--s-4) var(--s-5); color: var(--c-text-muted); font-size: var(--t-sm); }
.auth-foot a { color: inherit; }

/* ============================================================================
   FAQ — accordion pytań i odpowiedzi (komponent dodatkowy, §14)
   ============================================================================ */
.faq-list { display: flex; flex-direction: column; gap: var(--s-2); }
.faq-item { border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-surface); overflow: hidden; }
.faq-item > summary {
  list-style: none; cursor: pointer; padding: var(--s-3) var(--s-4);
  font-weight: 600; color: var(--c-text); display: flex; align-items: center; gap: var(--s-2);
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::after {
  content: ""; margin-left: auto; flex: 0 0 auto; width: 8px; height: 8px;
  border-right: 2px solid var(--c-text-muted); border-bottom: 2px solid var(--c-text-muted);
  transform: rotate(45deg); transition: transform .15s;
}
.faq-item[open] > summary::after { transform: rotate(-135deg); }
.faq-item[open] > summary { border-bottom: 1px solid var(--c-divider); }
/* jawne ukrycie treści w stanie zamkniętym (niezależnie od silnika renderującego <details>) */
.faq-item:not([open]) > .faq-item__a { display: none; }
.faq-item__a { padding: var(--s-3) var(--s-4); }
.faq-item__a p { margin: 0 0 var(--s-2); overflow-wrap: anywhere; }
