/* APF Rdzeń — moduł ui 0.1.16 (M-34: .apfc-modal--wide, .apfc-cols / .apfc-col / .apfc-col--full); 0.1.15 (R-41: ikona aplikacji ze znakiem 102 w pasku, .apfc-appico, .apfc-applogo); 0.1.12 (R-23: wspólny wygląd — przyciski usuń / cichy / ikona, pasek przycisków, zakładki widoku, pigułki, belka filtrów,
   pasek liczb, pasek akcji, wiersz listy, odznaki; same NOWE klasy, istniejące bez zmian): powłoka, pasek górny, karty, okna, komunikaty.
   Tylko tokeny z apps/shared/platform-theme.css (żadnych kolorów na sztywno, żadnych nowych tokenów). */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.apfc-body {
    margin: 0; min-height: 100vh; background: var(--bg-page); color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px; line-height: 1.5; overflow-x: hidden;
}
body.apfc-noscroll { overflow: hidden; }
a { color: var(--primary-text); }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 12px; }
h1 { font-size: 24px; } h2 { font-size: 20px; } h3 { font-size: 17px; }

.apfc-skip { position: absolute; left: -9999px; top: 0; }
.apfc-skip:focus { left: 8px; top: 8px; z-index: 100; background: var(--bg-surface); padding: 10px 14px; border-radius: 8px; }

/* ---------- przyciski i pola ---------- */
.apfc-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; min-width: 44px; padding: 10px 16px; border-radius: 10px;
    border: 1px solid var(--border-strong); background: var(--bg-surface); color: var(--text-main);
    font: inherit; font-size: 16px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.apfc-btn:hover { background: var(--bg-surface-hover); }
.apfc-btn--primary { background: var(--primary-color); border-color: var(--primary-color); color: var(--on-primary); }
.apfc-btn--primary:hover { background: var(--primary-color); filter: brightness(0.95); }
.apfc-btn--ghost { border-color: transparent; background: transparent; }
.apfc-btn[disabled] { opacity: .6; cursor: not-allowed; }
.apfc-input {
    display: block; width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px;
    border: 1px solid var(--border-strong); background: var(--bg-surface); color: var(--text-main); font: inherit; font-size: 16px;
}
.apfc-label { display: block; font-weight: 600; margin: 0 0 6px; }

/* ---------- karty (status konta, regulamin, nie znaleziono) ---------- */
.apfc-card-wrap { display: flex; justify-content: center; padding: 48px 16px; }
.apfc-card {
    width: 100%; max-width: 560px; background: var(--bg-surface); border: 1px solid var(--border-color);
    border-radius: 16px; padding: 28px 24px; box-shadow: var(--shadow);
}
.apfc-card p { margin: 0 0 14px; }
.apfc-card-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px !important; }

/* ---------- pasek górny ---------- */
/* 0.1.13 (R-39): .apfc-topbar__ico — ikona aplikacji w kolorze aplikacji (data-app na <html>, platform-theme.css). */
.apfc-topbar {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
    min-height: 56px; padding: 6px 12px 6px 16px; background: var(--bg-surface); border-bottom: 1px solid var(--border-color);
}
.apfc-topbar__name { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.apfc-topbar__end { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.apfc-topbar .apf-theme-toggle {
    min-width: 44px; height: 44px; min-height: 44px; padding: 0 8px; border-radius: 10px; border: 1px solid transparent;
    background: transparent; color: var(--text-main); font-size: 18px; cursor: pointer;
}
.apfc-topbar .apf-theme-toggle:hover { background: var(--bg-surface-hover); }
.apfc-menu { position: relative; }
.apfc-menu__list {
    position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; z-index: 30;
    background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 12px; box-shadow: var(--shadow-lg);
    padding: 6px; margin: 0; list-style: none;
}
.apfc-menu__list[hidden] { display: none; }
.apfc-menu__list a, .apfc-menu__list button {
    display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 12px; border-radius: 8px; border: 0;
    background: transparent; color: var(--text-main); font: inherit; font-size: 16px; text-decoration: none; text-align: left; cursor: pointer;
}
.apfc-menu__list a:hover, .apfc-menu__list button:hover { background: var(--bg-surface-hover); }
.apfc-menu__user { padding: 8px 12px; color: var(--text-muted); font-size: 14px; border-bottom: 1px solid var(--border-color); margin-bottom: 4px; }
.apfc-menu__list a:focus-visible, .apfc-menu__list button:focus-visible { outline-offset: -3px; }
.apfc-navbtn[hidden] { display: none; }
@media (min-width: 900px) { .apfc-navbtn { display: none; } }
.apfc-topbar .apfc-navbtn { margin-left: -8px; }
/* R-15b: przycisk „Menu” i prawa strona paska nie zmniejszają się (przy 375 px „Menu” nachodziło na logo); miejsce oddaje nazwa aplikacji
   (skraca się wielokropkiem), a na telefonie przycisk „Menu” pokazuje samą ikonę ☰ (napis zostaje dla czytnika ekranu) */
.apfc-topbar .apfc-navbtn { flex: none; white-space: nowrap; }
.apfc-topbar__end { flex: none; }
/* S-05: przy 375 px nazwa aplikacji nie jest ucinana do „Ser…”: zawija się do dwóch linii (jedna reguła dla wszystkich aplikacji z paskiem, strona główna ma ten sam styl) */
@media (max-width: 599px) {
    .apfc-topbar { gap: 6px; padding-left: 10px; padding-right: 8px; }
    .apfc-topbar .apfc-menu > .apfc-btn { padding-left: 10px; padding-right: 10px; }
    .apfc-topbar .apfc-menu > .apfc-btn > span:last-child { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }   /* „Konto” tylko ikoną 👤 (napis zostaje dla czytnika ekranu): miejsce dla nazwy aplikacji */
    .apfc-topbar__name { white-space: normal; overflow-wrap: anywhere; font-size: 15px; line-height: 1.15; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; text-overflow: clip; }
}
@media (max-width: 599px) {
    .apfc-topbar .apfc-navbtn { padding-left: 10px; padding-right: 10px; }
    .apfc-navbtn > span:last-child { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ---------- układ: menu boczne (komputer) / wysuwane (telefon) ---------- */
.apfc-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
body.apfc-navlock { overflow: hidden; }
.apfc-layout { display: block; }
.apfc-sidenav { display: none; flex-direction: column; gap: 2px; padding: 12px; }
.apfc-sidenav__group { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.apfc-sidenav__title { padding: 6px 12px 4px; font-size: 14px; font-weight: 700; color: var(--text-muted); letter-spacing: .02em; }
.apfc-sidenav__link {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 10px 12px; border-radius: 10px;
    border: 1px solid transparent; color: var(--text-main); font-size: 16px; font-weight: 500; text-decoration: none;
}
.apfc-sidenav__link:hover { background: var(--bg-surface-hover); }
.apfc-sidenav__link[aria-current="page"] { background: var(--primary-color); color: var(--on-primary); border-color: var(--primary-color); font-weight: 600; }
.apfc-sidenav__label { min-width: 0; overflow-wrap: anywhere; }
.apfc-sidenav__count {
    flex: none; display: inline-block; min-width: 22px; padding: 0 7px; border-radius: 11px; background: var(--warn-bg); color: var(--warn-fg);
    border: 1px solid var(--warn-fg); font-size: 14px; font-weight: 700; text-align: center; line-height: 1.5;
}
.apfc-sidenav__link[aria-current="page"] .apfc-sidenav__count { background: var(--bg-surface); color: var(--text-main); border-color: var(--bg-surface); }
.apfc-sidenav__close { display: none; margin-top: 8px; }
.apfc-sidenav__backdrop { display: none; }
@media (min-width: 900px) {
    .apfc-layout--nav { display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: start; }
    .apfc-layout--nav .apfc-root { margin-left: 0; width: 100%; }   /* R-12: komórka siatki nie zwęża treści do jej zawartości */
    .apfc-layout--nav .apfc-sidenav {
        display: flex; position: sticky; top: 56px; max-height: calc(100vh - 56px); max-height: calc(100dvh - 56px); overflow-y: auto; overscroll-behavior: contain;
        border-right: 1px solid var(--border-color); padding: 16px 12px;
    }
}
@media (max-width: 899px) {
    .apfc-sidenav {
        position: fixed; z-index: 150; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); overflow-y: auto; overscroll-behavior: contain;
        background: var(--bg-surface); border-right: 1px solid var(--border-color); box-shadow: var(--shadow-lg);
        padding: 16px 12px calc(16px + env(safe-area-inset-bottom)); transform: translateX(-105%); visibility: hidden;
    }
    .apfc-sidenav--open { display: flex; transform: none; visibility: visible; }
    .apfc-sidenav__close { display: inline-flex; }
    .apfc-sidenav__backdrop--on { display: block; position: fixed; z-index: 140; inset: 0; border: 0; padding: 0; background: var(--overlay); cursor: pointer; }
}

/* ---------- pasek „tylko do odczytu” ---------- */
.apfc-robar { background: var(--warn-bg); color: var(--warn-fg); padding: 10px 16px; font-size: 15px; border-bottom: 1px solid var(--border-color); }

/* ---------- treść aplikacji ---------- */
.apfc-root { display: block; max-width: min(100%, 2200px); margin: 0 auto; padding: 20px 16px 48px; outline: none; min-width: 0; }
.apfc-loading { color: var(--text-muted); }
.apfc-refresh { max-width: 560px; margin: 32px auto; }

/* ---------- siatka kart i kafelków (R-12): ile kolumn mieści się, tyle ich jest; na telefonie 1 ---------- */
.apfc-grid {
    list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(min(var(--apfc-grid-min, 260px), 100%), 1fr));
}
.apfc-grid > * { min-width: 0; }

/* ---------- okno (modal) ---------- */
.apfc-modal-backdrop {
    position: fixed; inset: 0; z-index: 50; background: var(--overlay);
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
.apfc-modal {
    width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: hidden; display: flex; flex-direction: column;
    background: var(--bg-surface); color: var(--text-main); border-radius: 16px; box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}
.apfc-modal__head { display: flex; align-items: center; gap: 8px; padding: 14px 12px 8px 20px; flex: none; border-bottom: 1px solid var(--border-color); }
.apfc-modal__head h2 { margin: 0; flex: 1; font-size: 20px; }
.apfc-modal__body { padding: 12px 20px 20px; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
@media (max-width: 480px) {
    .apfc-modal-backdrop { align-items: flex-end; padding: 0; }
    .apfc-modal { max-height: 92vh; border-radius: 16px 16px 0 0; }
}

/* ---------- komunikaty (toast) ---------- */
.apfc-toasts {
    position: fixed; z-index: 60; left: 50%; bottom: 16px; transform: translateX(-50%);
    width: min(520px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.apfc-toast {
    pointer-events: auto; display: flex; align-items: flex-start; gap: 8px; padding: 12px 8px 12px 16px; border-radius: 12px;
    background: var(--info-bg); color: var(--info-fg); border: 1px solid var(--border-color); box-shadow: var(--shadow-lg); font-size: 15px;
}
.apfc-toast--ok { background: var(--ok-bg); color: var(--ok-fg); }
.apfc-toast--err { background: var(--err-bg); color: var(--err-fg); }
.apfc-toast--warn { background: var(--warn-bg); color: var(--warn-fg); }
.apfc-toast__text { flex: 1; padding-top: 2px; }
.apfc-toast__close {
    min-width: 44px; min-height: 44px; margin: -10px 0; border: 0; background: transparent; color: inherit; font-size: 20px; cursor: pointer; border-radius: 8px;
}

/* Nagłówki dostają fokus programowo (zmiana ekranu, otwarcie okna) — bez ramki fokusu, bo nie są klikalne. */
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; }

/* ---------- R-13b: logo i link do strony głównej (pasek aplikacji i strona główna) ---------- */
.apfc-brandlink { display: inline-flex; align-items: center; gap: 10px; flex: none; min-height: 44px; color: inherit; text-decoration: none; font-weight: 600; max-width: 45vw; }
.apfc-brandlink:hover .apfc-brandlink__co { text-decoration: underline; }
.apfc-brandlink__co { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.apfc-logo { display: none; height: 30px; width: auto; flex: none; }
.apfc-logo--h.apfc-logo--c { display: block; }                                   /* szeroki ekran, motyw jasny: poziome kolorowe */
:root[data-theme="dark"] .apfc-logo--h.apfc-logo--c { display: none; }
:root[data-theme="dark"] .apfc-logo--h.apfc-logo--w { display: block; }          /* motyw ciemny: białe */
@media (max-width: 599px) {                                                       /* telefon: sam znak 102 */
    .apfc-logo--h.apfc-logo--c, .apfc-logo--h.apfc-logo--w, :root[data-theme="dark"] .apfc-logo--h.apfc-logo--w, :root[data-theme="dark"] .apfc-logo--h.apfc-logo--c { display: none; }
    .apfc-logo--m.apfc-logo--c { display: block; }
    :root[data-theme="dark"] .apfc-logo--m.apfc-logo--c { display: none; }
    :root[data-theme="dark"] .apfc-logo--m.apfc-logo--w { display: block; }
    .apfc-brandlink__co, .apfc-sep { display: none; }
}
/* R-13c: kreska „|” (logo | firma | aplikacja albo „Start”); ten sam styl i wysokość co kreska przed nazwą aplikacji */
.apfc-sep { display: block; flex: none; width: 1px; height: 22px; background: var(--border-color); }
.apfc-brandlink + .apfc-topbar__name { padding-left: 10px; border-left: 1px solid var(--border-color); }
/* R-39: ikona aplikacji Manager⁴ w kolorze aplikacji, zawsze obok nazwy (Wedding i Event różnią się kolorem za mało, nazwa rozstrzyga) */
.apfc-topbar__ico { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--app-main, var(--primary-color)); color: var(--on-app-main, var(--on-primary)); box-shadow: 0 0 0 1px var(--app-ico-ring, transparent); font-size: 18px; line-height: 1; }
.apfc-topbar__mark { display: block; width: 20px; height: auto; }   /* R-41: znak 102 (SVG z shell.php) */
[hidden].apfc-topbar__ico { display: none; }
.apfc-brandlink:has(+ .apfc-topbar__ico)::after { content: ""; display: block; flex: none; width: 1px; height: 22px; background: var(--border-color); }
@media (max-width: 599px) { .apfc-topbar__ico { width: 26px; height: 26px; border-radius: 7px; } .apfc-topbar__mark { width: 18px; } }
@media (max-width: 419px) { .apfc-topbar__ico { display: none; } }   /* telefon: miejsce na pełną nazwę aplikacji (dwie linie); kolor aplikacji niesie reszta ekranu */

/* ---------- R-13c/R-13d: przycisk języka (flaga), taki sam w pasku aplikacji i strony głównej ---------- */
.apfc-langbtn {
    display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0; border-radius: 10px;
    border: 1px solid transparent; background: transparent; cursor: pointer;
}
.apfc-langbtn:hover { background: var(--bg-surface-hover); }
.apfc-langbtn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.apfc-langbtn:disabled { opacity: .6; cursor: default; }
.apfc-langbtn img { display: block; width: 24px; height: 16px; border-radius: 2px; box-shadow: 0 0 0 1px var(--border-color); }
/* R-13d: strona główna składa ten sam pasek (<header class="apfc-topbar">); opakowanie przełącznika motywu nie liczy się w układzie, formularz wylogowania bez marginesów */
.apfc-topbar__end > #apfh-theme, .apfc-topbar__end > .apfc-topbar__form { display: contents; }
.apfc-topbar__form { margin: 0; }
.apfc-topbar .apfc-btn { white-space: nowrap; }   /* „Wyloguj się” nie łamie się na dwie linie na telefonie (pasek ma jedną wysokość) */

/* =====================================================================================================================
   R-23 (ui 0.1.10): jeden wygląd. Same nowe klasy (istniejące wyżej bez zmian, więc aplikacje, które ich nie używają, wyglądają jak przed).
   Pomocnik DOM do tych klas: kit.js (ten sam folder). Każda reguła z `display` ma swoją wersję [hidden] (pułapka z M-02).
   ===================================================================================================================== */

/* ---------- „jeden wygląd” aplikacji: klasa .apfc-onelook na <body> (dodaje ją aplikacja, która przeszła na R-23; dziś Wedding Manager).
   Przycisk ma wtedy dokładnie 44 px wysokości (9 + 24 + 9 + ramka), a nagłówek ekranu 22 px. Bez tej klasy .apfc-btn i h1 są jak przed. ---------- */
.apfc-onelook .apfc-btn { padding-top: 9px; padding-bottom: 9px; line-height: 24px; }
.apfc-onelook .apfc-root h1 { font-size: 22px; }

/* ---------- przyciski: usuń, potwierdzenie usunięcia, cichy, ikona (jeden rozmiar: 44 px, 16 px, 600, zaokrąglenie 10 px z .apfc-btn) ---------- */
.apfc-btn--danger { background: var(--bg-surface); border-color: var(--danger-color); color: var(--err-fg); }
.apfc-btn--danger:hover { background: var(--err-bg); }
.apfc-btn--danger-solid { background: var(--danger-color); border-color: var(--danger-color); color: var(--on-solid); }
.apfc-btn--danger-solid:hover { background: var(--danger-color); filter: brightness(0.95); }
.apfc-btn--quiet { background: transparent; border-color: transparent; color: var(--text-main); }
.apfc-btn--quiet:hover { background: transparent; text-decoration: underline; text-underline-offset: 3px; }
.apfc-btn--icon { flex: none; width: 44px; height: 44px; padding: 0; }
.apfc-btn--icon svg, .apfc-btn svg.apfc-ico { width: 20px; height: 20px; flex: none; }
/* [hidden] tylko w nowych kontenerach i w aplikacji z .apfc-onelook (globalne .apfc-btn[hidden] zmieniłoby aplikacje, które na tym polegają, np. Service Manager) */
.apfc-onelook .apfc-btn[hidden], .apfc-actions > [hidden], .apfc-toolbar > [hidden], .apfc-row__actions > [hidden], .apfc-chip[hidden], .apfc-tab[hidden] { display: none; }

/* ---------- pasek przycisków okna i formularza: równo na całą szerokość; w oknie przyklejony do dołu ---------- */
/* Napis przycisku zawsze w jednej linii (wysokość 44 px); przycisk, który się nie mieści, przechodzi do nowego rzędu i rośnie na całą szerokość. */
.apfc-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 0; }
.apfc-actions[hidden] { display: none; }
/* ui 0.1.12: podstawa = szerokość napisu (było 0), więc przycisk, który się nie mieści, przechodzi do nowego rzędu zamiast nachodzić na sąsiedni */
.apfc-actions > .apfc-btn { flex: 1 1 auto; max-width: 100%; white-space: nowrap; }
.apfc-actions > .apfc-btn--icon { flex: none; }
.apfc-modal__body > .apfc-actions:last-child, .apfc-modal__body > :last-child > .apfc-actions:last-child {
    position: sticky; bottom: -20px; z-index: 2; margin: 16px -20px -20px; padding: 12px 20px 16px;   /* -20px = dolne dopełnienie .apfc-modal__body (Chrome liczy przyklejenie od krawędzi dopełnienia) */
    background: var(--bg-surface); border-top: 1px solid var(--border-color);
}
.apfc-actions--page { position: sticky; bottom: 0; z-index: 5; padding: 12px 0; background: var(--bg-page); border-top: 1px solid var(--border-color); }
/* Telefon: po dwa w rzędzie; trzeci (nieparzysty ostatni) sam w rzędzie na całą szerokość */
@media (max-width: 600px) { .apfc-actions > .apfc-btn { flex-basis: calc(50% - 5px); } }

/* ---------- zakładki widoku: tekst z kreską (role="tablist" / "tab", aria-selected); linki #/… zostają linkami ---------- */
.apfc-tabs { display: flex; gap: 0; overflow-x: auto; overflow-y: hidden; margin: 0 0 16px; scrollbar-width: thin; }
.apfc-tabs[hidden] { display: none; }
.apfc-tabs:has(> .apfc-tab) { box-shadow: inset 0 -1px 0 var(--border-color); }
.apfc-tab {
    flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 14px; margin: 0;
    border: 0; border-radius: 0; background: transparent; color: var(--text-muted); font: inherit; font-size: 16px; font-weight: 600;
    text-decoration: none; white-space: nowrap; cursor: pointer;
}
.apfc-tab:hover { color: var(--text-main); background: var(--bg-surface-hover); }
.apfc-tab[aria-selected="true"] { color: var(--text-main); box-shadow: inset 0 -3px 0 var(--primary-color); }
.apfc-tab:focus-visible { outline-offset: -3px; }
.apfc-tab__n { color: var(--text-muted); font-weight: 400; font-variant-numeric: tabular-nums; }

/* ---------- pigułki wyboru: filtry (aria-pressed) i opcje w formularzu (role="radio" + aria-checked); wybrana = jasne tło + ✓ ---------- */
.apfc-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; list-style: none; }
.apfc-chips[hidden] { display: none; }
.apfc-chip {
    display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 999px;
    border: 1px solid var(--border-strong); background: var(--bg-surface); color: var(--text-main);
    font: inherit; font-size: 15px; font-weight: 500; line-height: 1.2; text-align: left; text-decoration: none; cursor: pointer;
}
.apfc-chip:hover { background: var(--bg-surface-hover); }
.apfc-chip[aria-pressed="true"], .apfc-chip[aria-checked="true"] { background: var(--info-bg); color: var(--info-fg); border-color: var(--primary-color); font-weight: 700; }
.apfc-chip[aria-pressed="true"]::before, .apfc-chip[aria-checked="true"]::before { content: "✓"; font-weight: 700; }
.apfc-chip__n { color: var(--text-muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.apfc-chip[aria-pressed="true"] .apfc-chip__n, .apfc-chip[aria-checked="true"] .apfc-chip__n { color: inherit; }
.apfc-chip[disabled], .apfc-chip[aria-disabled="true"] { opacity: .6; cursor: not-allowed; }

/* ---------- belka filtrów: <details>, domyślnie zwinięta; w <summary> aktywne filtry z ✕ ---------- */
.apfc-filterbar { margin: 0 0 16px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-surface); min-width: 0; }
.apfc-filterbar[hidden] { display: none; }
.apfc-filterbar > summary {
    position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-height: 48px; padding: 2px 52px 2px 14px;
    list-style: none; cursor: pointer; font-weight: 700; border-radius: 10px;
}
.apfc-filterbar > summary::-webkit-details-marker { display: none; }
.apfc-filterbar > summary:focus-visible { outline-offset: -3px; }
.apfc-filterbar__chev { position: absolute; right: 14px; top: 50%; width: 20px; height: 20px; margin-top: -10px; transition: transform .15s; }
.apfc-filterbar[open] > summary .apfc-filterbar__chev { transform: rotate(180deg); }
.apfc-filterbar__active { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; font-weight: 400; }
.apfc-filterbar__active[hidden] { display: none; }
.apfc-filterbar__pill {
    display: inline-flex; align-items: center; min-height: 44px; padding: 0 0 0 12px; border-radius: 999px;
    background: var(--info-bg); color: var(--info-fg); font-size: 15px; font-weight: 600; overflow-wrap: anywhere;
}
.apfc-filterbar__x {
    display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0; margin: 0;
    border: 0; border-radius: 999px; background: transparent; color: inherit; font: inherit; font-size: 16px; cursor: pointer;
}
.apfc-filterbar__x:hover { background: var(--hover-tint); }
/* ui 0.1.11: grupy filtrów w kolumnach obok siebie, pigułki jedna pod drugą, cienka pionowa linia między kolumnami
   (pierwsza kolumna w każdym rzędzie bez linii: margines -1 px chowa ją pod brzegiem, który przycina overflow) */
.apfc-filterbar__body {
    display: flex; flex-wrap: wrap; gap: 12px 0; padding: 12px 14px 14px 13px; border-top: 1px solid var(--border-color); overflow: hidden;
}
.apfc-fgroup { min-width: 0; margin: 0 0 0 -1px; padding: 0 12px; border: 0; border-left: 1px solid var(--border-color); flex: 1 1 130px; max-width: 280px; }
.apfc-fgroup .apfc-chips { flex-direction: column; flex-wrap: nowrap; gap: 3px; }
.apfc-fgroup .apfc-chip { width: 100%; padding: 4px 10px; font-size: 14px; line-height: 1.25; }
@media (pointer: fine) { .apfc-fgroup .apfc-chip { min-height: 34px; } }   /* myszą zwarte wiersze; dotykiem zostaje 44 px */
@media (max-width: 600px) {
    .apfc-filterbar__body { flex-direction: column; gap: 14px; padding-left: 14px; }
    .apfc-fgroup { max-width: none; margin: 0; padding: 0; border-left: 0; }
}
.apfc-fgroup__label { display: block; margin: 0 0 6px; padding: 0; font-size: 14px; font-weight: 700; color: var(--text-muted); }
.apfc-filterbar__clear { flex: 1 1 100%; align-self: flex-start; margin-left: 13px; }
.apfc-filterbar__clear[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .apfc-filterbar__chev, .apfc-chev { transition: none; } }

/* ---------- pasek liczb: niska ramka, liczba 18 px + opis 14 px; ostrzeżenie słowami (.is-warn) ---------- */
.apfc-stats {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: 0 0 12px; padding: 8px 12px; list-style: none;
    border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-surface);
}
.apfc-stats[hidden] { display: none; }
.apfc-stats__item { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 0 6px; min-width: 0; }
.apfc-stats__item[hidden] { display: none; }
.apfc-stats__n { font-size: 18px; font-weight: 700; line-height: 1.3; color: var(--text-main); font-variant-numeric: tabular-nums; white-space: nowrap; }
.apfc-stats__t { font-size: 14px; color: var(--text-muted); }
.apfc-stats__item.is-warn, .apfc-stats__item.is-ok, .apfc-stats__item.is-err { align-items: center; padding: 2px 8px; border-radius: 6px; }
.apfc-stats__item.is-warn { background: var(--warn-bg); }
.apfc-stats__item.is-ok { background: var(--ok-bg); }
.apfc-stats__item.is-err { background: var(--err-bg); }
.apfc-stats__item.is-warn > * { color: var(--warn-fg); }
.apfc-stats__item.is-ok > * { color: var(--ok-fg); }
.apfc-stats__item.is-err > * { color: var(--err-fg); }
.apfc-stats__link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px; font-size: 14px; font-weight: 700; color: inherit; text-decoration: underline; text-underline-offset: 3px; background: none; border: 0; cursor: pointer; font-family: inherit; }

/* ---------- pasek akcji zakładki: główny „Dodaj …” pierwszy, szukanie wypełnia resztę rzędu ---------- */
.apfc-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; min-width: 0; }
.apfc-toolbar[hidden] { display: none; }
.apfc-toolbar > .apfc-input, .apfc-toolbar > .apfc-toolbar__search { flex: 1 1 220px; width: auto; min-width: 0; }
.apfc-toolbar__end { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-left: auto; }
.apfc-toolbar__end[hidden] { display: none; }
@media (max-width: 600px) {
    .apfc-toolbar > .apfc-btn { flex: 1 1 calc(50% - 5px); max-width: 100%; white-space: nowrap; }
    .apfc-toolbar > .apfc-btn--primary, .apfc-toolbar > .apfc-input, .apfc-toolbar > .apfc-toolbar__search { flex: 1 1 100%; }
    .apfc-toolbar__end { margin-left: 0; }
}

/* ---------- wiersz listy: nazwa, szczegóły i odznaki; akcje i strzałka zwijania po prawej ---------- */
.apfc-rows { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; min-width: 0; }
.apfc-row {
    display: flex; align-items: center; gap: 8px 12px; padding: 8px 8px 8px 14px; min-width: 0;
    border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-surface);
}
.apfc-row[hidden] { display: none; }
.apfc-row__main { flex: 1 1 auto; min-width: 0; }
.apfc-row__title { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.apfc-row__meta { margin: 2px 0 0; font-size: 14px; color: var(--text-muted); overflow-wrap: anywhere; }
.apfc-row__actions { flex: none; display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; }
.apfc-row__actions[hidden] { display: none; }
.apfc-row__actions > .apfc-btn { flex: none; }
.apfc-chev { display: block; width: 20px; height: 20px; transition: transform .15s; }
[aria-expanded="true"] > .apfc-chev, [aria-expanded="true"] .apfc-chev { transform: rotate(180deg); }
@media (max-width: 600px) {
    .apfc-row { flex-wrap: wrap; }
    .apfc-row__actions { flex: 1 1 100%; flex-wrap: wrap; }
}

/* ---------- odznaki: stan (nie przycisk) ---------- */
.apfc-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 0; padding: 0; list-style: none; }
.apfc-badges[hidden] { display: none; }
.apfc-badge {
    display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 6px; vertical-align: middle;
    background: var(--bg-surface-alt); color: var(--text-main); font-size: 14px; font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.apfc-badge[hidden] { display: none; }
.apfc-badge--ok { background: var(--ok-bg); color: var(--ok-fg); }
.apfc-badge--warn { background: var(--warn-bg); color: var(--warn-fg); }
.apfc-badge--err { background: var(--err-bg); color: var(--err-fg); }
.apfc-badge--info { background: var(--info-bg); color: var(--info-fg); }

/* ui 0.1.11: puste stany („Nie masz jeszcze…”) na całą szerokość treści, jak lista, którą zastępują */
.apfc-onelook .apfc-root .apfc-card[class*="-empty"] { max-width: none; }

/* ---------- R-40: pomoc w aplikacji — przycisk „?” (pasek i nagłówek okna) i panel z prawej ---------- */
.apfc-helpbtn {
    display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 44px; width: 44px; height: 44px; padding: 0;
    border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-main); cursor: pointer; font: inherit;
}
.apfc-helpbtn:hover { background: var(--bg-surface-hover); }
.apfc-helpbtn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.apfc-helpbtn__ico {
    display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%;
    border: 2px solid currentColor; font-size: 15px; font-weight: 700; line-height: 1;
}
.apfc-modal__tools { display: flex; align-items: center; gap: 4px; flex: none; }
body.apfc-helpopen { overflow: hidden; }
.apfc-help-backdrop { position: fixed; inset: 0; z-index: 70; background: var(--overlay); display: flex; justify-content: flex-end; }
.apfc-help-backdrop[hidden] { display: none; }
.apfc-help {
    display: flex; flex-direction: column; width: min(560px, 100%); height: 100%; background: var(--bg-surface); color: var(--text-main);
    border-left: 1px solid var(--border-color); box-shadow: var(--shadow-lg);
}
.apfc-help__head { display: flex; align-items: flex-start; gap: 8px; padding: 12px 12px 10px 20px; border-bottom: 1px solid var(--border-color); flex: none; }
.apfc-help__titles { flex: 1; min-width: 0; }
.apfc-help__head h2 { margin: 0; font-size: 20px; }
.apfc-help__head h2:focus { outline: none; }
.apfc-help__head h2:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.apfc-help__part { margin: 2px 0 0; color: var(--text-muted); font-size: 14px; }
.apfc-help__part:empty { display: none; }
.apfc-help__close { flex: none; }
.apfc-help__body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px 20px 32px; font-size: 16px; line-height: 1.55; }
.apfc-help__body h3 { font-size: 18px; margin: 20px 0 8px; }
.apfc-help__body h4 { font-size: 16px; margin: 16px 0 6px; }
.apfc-help__body h5 { font-size: 17px; margin: 18px 0 6px; }
.apfc-help__body p { margin: 0 0 10px; }
.apfc-help__body ul, .apfc-help__body ol { margin: 0 0 10px; padding-left: 22px; }
.apfc-help__body li { margin: 2px 0; }
.apfc-help__en { padding: 8px 12px; border-radius: 8px; background: var(--info-bg); color: var(--info-fg); font-size: 14px; }
.apfc-help__search label { display: block; font-weight: 600; margin-bottom: 4px; }
.apfc-help__search input { width: 100%; box-sizing: border-box; min-height: 44px; font-size: 16px; padding: 8px 12px; border: 1px solid var(--border-strong);
    border-radius: 8px; background: var(--bg-surface); color: var(--text-main); }
.apfc-help__search input:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.apfc-help__hint { color: var(--text-muted); font-size: 14px; margin: 4px 0 0; }
.apfc-help__sec { margin-top: 8px; }
.apfc-help__body .apfc-help__list, .apfc-help__body .apfc-help__results { list-style: none; padding: 0; margin: 0; }
.apfc-help__item, .apfc-help__result {
    display: block; width: 100%; min-height: 44px; padding: 10px 12px; margin: 0 0 6px; text-align: left; font: inherit; font-size: 16px; cursor: pointer;
    border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-surface); color: var(--text-main);
}
.apfc-help__item:hover, .apfc-help__result:hover { background: var(--bg-surface-hover); }
.apfc-help__item:focus-visible, .apfc-help__result:focus-visible, .apfc-help__a:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.apfc-help__result strong, .apfc-help__result span { display: block; }
.apfc-help__kind { color: var(--text-muted); font-size: 14px; }
.apfc-help__snip { color: var(--text-muted); font-size: 14px; margin-top: 2px; }
.apfc-help__empty { color: var(--text-muted); }
.apfc-help__a {
    display: inline; padding: 0; margin: 0; border: 0; background: none; font: inherit; color: var(--primary-text); text-decoration: underline; cursor: pointer; text-align: left;
}
.apfc-help__body a { color: var(--primary-text); }
.apfc-help__back { margin: 0 0 4px -8px; }
.apfc-help__atitle { margin-top: 8px; font-size: 20px; }
.apfc-help__atitle:focus { outline: none; }
.apfc-help__note { border: 1px solid var(--border-color); border-left: 4px solid var(--info-fg); border-radius: 8px; background: var(--subtle-bg); padding: 10px 12px; margin: 0 0 12px; }
.apfc-help__note p:last-child { margin-bottom: 0; }
.apfc-help__notelabel { display: block; margin-bottom: 4px; }
.apfc-help__tablewrap { overflow-x: auto; margin: 0 0 12px; }
.apfc-help__table { border-collapse: collapse; font-size: 15px; min-width: 100%; }
.apfc-help__table th, .apfc-help__table td { border: 1px solid var(--border-color); padding: 6px 8px; text-align: left; vertical-align: top; }
.apfc-help__table th { background: var(--bg-surface-alt); }
.apfc-help__faqgroup h4 { margin-top: 14px; }
.apfc-help__faq { border: 1px solid var(--border-color); border-radius: 8px; margin: 0 0 6px; background: var(--bg-surface); }
.apfc-help__faq > summary { min-height: 44px; padding: 10px 12px; cursor: pointer; font-weight: 600; box-sizing: border-box; }
.apfc-help__faq > summary:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.apfc-help__answer { padding: 0 12px 4px; }
.apfc-help__see { border-top: 1px solid var(--border-color); margin-top: 16px; }
.apfc-help__err p { margin-bottom: 12px; }
.apfc-help__loading { color: var(--text-muted); }
@media (max-width: 599px) {
    .apfc-help { width: 100%; border-left: 0; }
    .apfc-help__head { padding-left: 14px; }
    .apfc-help__body { padding: 12px 14px 28px; }
}
@media (max-width: 359px) { .apfc-topbar__end { gap: 0; } }
/* R-40: przy 320–359 px pasek z „?” mieści się bez poziomego przewijania (mniejsze odstępy; przyciski dalej 44 px) */
@media (max-width: 359px) {
    .apfc-topbar { gap: 2px; padding-left: 4px; padding-right: 2px; }
    .apfc-topbar .apfc-navbtn { margin-left: 0; padding-left: 6px; padding-right: 6px; }
    .apfc-topbar .apfc-menu > .apfc-btn { padding-left: 6px; padding-right: 6px; }
    .apfc-brandlink .apfc-sep { display: none; }
}
/* R-40: telefon < 420 px z przyciskiem „?”: logo 102event chowa się, żeby nazwa aplikacji dalej mieściła się w dwóch liniach (Start jest w menu konta) */
@media (max-width: 419px) { .apfc-topbar--help .apfc-brandlink { display: none; } }

/* ---- 0.1.15 (R-41): marka Manager⁴ — ikona aplikacji (znak 102 na --app-main) i logotyp nazwy (Archivo M4). Kolory tylko z tokenów platform-theme.css. ---- */
.apfc-appico { flex: none; display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 16px; background: var(--app-main); color: var(--on-app-main); box-shadow: 0 0 0 1px var(--app-ico-ring); }
.apfc-appico__mark { display: block; width: 69%; height: auto; }
.apfc-applogo { display: flex; flex-direction: column; margin: 0; font-family: "Archivo M4", "Arial Black", system-ui, sans-serif; font-stretch: 125%; font-weight: 850; font-size: 24px; line-height: 0.95; letter-spacing: 0.005em; text-transform: uppercase; color: var(--text-main); overflow-wrap: anywhere; }
.apfc-applogo__a { color: var(--primary-text); }
.apfc-applogo__b { color: var(--text-main); }

/* ---- 0.1.16 (M-34): szerokie okno z dwiema kolumnami (opt-in: bez tych klas nic się nie zmienia). Okno z formularzem ≥ 6 pól albo 2 grup = szerokie. ---- */
.apfc-cols { display: flex; flex-direction: column; gap: var(--apfc-col-gap, 14px); min-width: 0; }
.apfc-cols[hidden] { display: none; }
.apfc-col, .apfc-col--full { display: flex; flex-direction: column; gap: var(--apfc-col-gap, 14px); min-width: 0; }
.apfc-col[hidden], .apfc-col--full[hidden] { display: none; }
.apfc-col > *, .apfc-col--full > * { min-width: 0; }
@media (min-width: 1100px) {
    .apfc-modal.apfc-modal--wide { max-width: min(1160px, calc(100vw - 48px)); }
    .apfc-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--apfc-col-gap, 14px) 32px; align-items: start; }
    .apfc-cols > .apfc-col--full { grid-column: 1 / -1; }
    .apfc-cols > .apfc-col > :first-child, .apfc-cols > .apfc-col > fieldset:first-child { margin-top: 0; }
}
