/* =====================================================================
   MediCodetail – arkusz stylów
   Mobile first · kolorystyka Codetail (#F97316) · jasny motyw
   ===================================================================== */

/* ---------------------------------------------------------------
   1. Zmienne
   --------------------------------------------------------------- */
:root {
    --brand:        #f97316;
    --brand-600:    #ea580c;
    --brand-700:    #c2410c;
    --brand-50:     #fff7ed;
    --brand-100:    #ffedd5;
    --brand-200:    #fed7aa;
    --brand-300:    #fdba74;

    --ink:          #18181b;
    --ink-soft:     #3f3f46;
    --muted:        #71717a;
    --muted-light:  #a1a1aa;
    --line:         #e4e4e7;
    --line-soft:    #f1f1f3;
    --bg:           #f7f8fa;
    --surface:      #ffffff;
    --surface-alt:  #fafafa;

    --success:      #16a34a;
    --success-bg:   #f0fdf4;
    --danger:       #dc2626;
    --danger-bg:    #fef2f2;
    --warning:      #d97706;
    --warning-bg:   #fffbeb;
    --info:         #2563eb;
    --info-bg:      #eff6ff;

    --radius-sm:    10px;
    --radius:       16px;
    --radius-lg:    22px;
    --radius-full:  999px;

    --shadow-xs:    0 1px 2px rgba(24, 24, 27, .06);
    --shadow-sm:    0 2px 8px rgba(24, 24, 27, .06);
    --shadow:       0 8px 24px -8px rgba(24, 24, 27, .12), 0 2px 6px rgba(24, 24, 27, .04);
    --shadow-lg:    0 24px 48px -16px rgba(24, 24, 27, .18);
    --shadow-brand: 0 10px 28px -10px rgba(249, 115, 22, .55);

    --ease:         cubic-bezier(.32, .72, 0, 1);
    --ease-out:     cubic-bezier(.16, 1, .3, 1);

    --header-h:     64px;
    --bottomnav-h:  68px;
    --sidebar-w:    252px;

    --font: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ---------------------------------------------------------------
   2. Reset
   --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-wrap: break-word;
}

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; font-weight: 650; letter-spacing: -.02em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: .95rem; }
p  { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--brand-600); text-decoration: none; transition: color .18s var(--ease); }
a:hover { color: var(--brand-700); }

img, svg { max-width: 100%; display: block; }

/* Domyślny rozmiar i wyrównanie każdej ikony z Icon::get().
   Reguły kontekstowe (np. `.btn svg`) mają wyższą specyficzność i nadpisują tę. */
.mc-icon {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    display: inline-block;
    vertical-align: -0.16em;
}
button, input, select, textarea { font: inherit; color: inherit; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

::selection { background: var(--brand-200); color: var(--brand-700); }

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 6px;
}

/* Pasek przewijania (desktop) */
@media (min-width: 900px) {
    ::-webkit-scrollbar { width: 10px; height: 10px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 8px; border: 3px solid var(--bg); }
    ::-webkit-scrollbar-thumb:hover { background: var(--brand-300); }
}

/* ---------------------------------------------------------------
   3. Układ
   --------------------------------------------------------------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }

.container {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 16px;
}

.main {
    flex: 1;
    padding: 18px 0 calc(var(--bottomnav-h) + 28px);
    animation: fade-up .45s var(--ease-out) both;
}

@media (min-width: 900px) {
    .main { padding: 28px 0 56px; }
    .container { padding: 0 28px; }
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}
.page-head__title { display: flex; flex-direction: column; gap: 2px; }
.page-head__title h1 { margin: 0; }
.page-head__sub { color: var(--muted); font-size: .875rem; }
.page-head__actions { display: flex; flex-wrap: wrap; gap: 8px; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-sidebar { grid-template-columns: 1fr; }

@media (min-width: 700px) {
    .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1000px) {
    .grid { gap: 18px; }
    .grid-sidebar { grid-template-columns: minmax(0, 1fr) 340px; }
}

.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.spacer { flex: 1; }

/* ---------------------------------------------------------------
   4. Nagłówek
   --------------------------------------------------------------- */
.header {
    position: sticky;
    top: 0;
    z-index: 60;
    height: var(--header-h);
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, .86);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--line);
}
.header__inner {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}
@media (min-width: 900px) { .header__inner { padding: 0 28px; } }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; color: var(--ink); letter-spacing: -.03em; }
.brand:hover { color: var(--ink); }
.brand__mark {
    width: 34px; height: 34px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-600) 100%);
    display: grid; place-items: center;
    color: #fff; font-weight: 700; font-size: .95rem;
    box-shadow: var(--shadow-brand);
    flex-shrink: 0;
    transition: transform .3s var(--ease-out);
}
.brand:hover .brand__mark { transform: rotate(-8deg) scale(1.06); }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__text strong { font-size: .98rem; }
.brand__text span { font-size: .68rem; color: var(--muted); font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }

.header__nav { display: none; margin-left: 14px; gap: 2px; }
@media (min-width: 900px) { .header__nav { display: flex; } }

.navlink {
    position: relative;
    display: flex; align-items: center; gap: 7px;
    padding: 8px 13px;
    border-radius: var(--radius-full);
    font-size: .875rem; font-weight: 500;
    color: var(--ink-soft);
    transition: background .2s var(--ease), color .2s var(--ease);
    white-space: nowrap;
}
.navlink svg { width: 17px; height: 17px; opacity: .75; }
.navlink:hover { background: var(--brand-50); color: var(--brand-700); }
.navlink.is-active { background: var(--brand); color: #fff; box-shadow: var(--shadow-brand); }
.navlink.is-active svg { opacity: 1; }
.navlink__badge {
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: var(--radius-full);
    background: var(--danger); color: #fff;
    font-size: .68rem; font-weight: 600;
    display: grid; place-items: center;
}
.navlink.is-active .navlink__badge { background: #fff; color: var(--brand-700); }

/* Menu użytkownika */
.usermenu { position: relative; margin-left: auto; }
.usermenu__toggle {
    display: flex; align-items: center; gap: 9px;
    padding: 5px 9px 5px 5px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.usermenu__toggle:hover { border-color: var(--brand-200); box-shadow: var(--shadow-sm); }
.avatar {
    width: 32px; height: 32px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--brand-200), var(--brand));
    color: #fff;
    display: grid; place-items: center;
    font-size: .78rem; font-weight: 650;
    flex-shrink: 0;
}
.avatar-lg { width: 54px; height: 54px; font-size: 1.15rem; }
.usermenu__name { display: none; font-size: .84rem; font-weight: 500; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 640px) { .usermenu__name { display: block; } }
.usermenu__caret { width: 14px; height: 14px; color: var(--muted); transition: transform .25s var(--ease); }
.usermenu.is-open .usermenu__caret { transform: rotate(180deg); }

.dropdown {
    position: absolute;
    top: calc(100% + 10px); right: 0;
    min-width: 236px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 7px;
    opacity: 0; visibility: hidden;
    transform: translateY(-8px) scale(.97);
    transform-origin: top right;
    transition: opacity .2s var(--ease), transform .25s var(--ease-out), visibility .2s;
    z-index: 70;
}
.usermenu.is-open .dropdown { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.dropdown__head { padding: 9px 11px 11px; border-bottom: 1px solid var(--line-soft); margin-bottom: 6px; }
.dropdown__head strong { display: block; font-size: .9rem; }
.dropdown__head span { font-size: .78rem; color: var(--muted); word-break: break-all; }
.dropdown__item {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    padding: 9px 11px;
    border: 0; background: none;
    border-radius: var(--radius-sm);
    font-size: .875rem; color: var(--ink-soft);
    text-align: left; cursor: pointer;
    transition: background .16s var(--ease), color .16s var(--ease);
}
.dropdown__item svg { width: 16px; height: 16px; opacity: .7; }
.dropdown__item:hover { background: var(--brand-50); color: var(--brand-700); }
.dropdown__item.is-danger:hover { background: var(--danger-bg); color: var(--danger); }

/* ---------------------------------------------------------------
   5. Dolna nawigacja (mobile)
   --------------------------------------------------------------- */
.bottomnav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 60;
    height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, .93);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--line);
    display: flex;
    align-items: stretch;
}
@media (min-width: 900px) { .bottomnav { display: none; } }

.bottomnav__item {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    position: relative;
    font-size: .66rem; font-weight: 500;
    color: var(--muted);
    transition: color .2s var(--ease);
    -webkit-tap-highlight-color: transparent;
}
.bottomnav__item svg { width: 21px; height: 21px; transition: transform .3s var(--ease-out); }
.bottomnav__item.is-active { color: var(--brand-600); }
.bottomnav__item.is-active svg { transform: translateY(-2px) scale(1.08); }
.bottomnav__item.is-active::before {
    content: '';
    position: absolute; top: 0; left: 50%;
    width: 26px; height: 3px;
    background: var(--brand);
    border-radius: 0 0 4px 4px;
    transform: translateX(-50%);
    animation: nav-pop .35s var(--ease-out) both;
}
.bottomnav__dot {
    position: absolute; top: 8px; right: calc(50% - 18px);
    min-width: 16px; height: 16px; padding: 0 4px;
    background: var(--danger); color: #fff;
    border-radius: var(--radius-full);
    font-size: .6rem; font-weight: 650;
    display: grid; place-items: center;
    border: 2px solid var(--surface);
}

/* ---------------------------------------------------------------
   6. Karty
   --------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    transition: box-shadow .3s var(--ease), transform .3s var(--ease-out), border-color .3s var(--ease);
}
.card--hover:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--brand-200); }
.card--flat { box-shadow: none; }
.card--accent { border-color: var(--brand-200); background: linear-gradient(180deg, var(--brand-50), var(--surface) 70%); }

.card__head {
    padding: 15px 16px;
    border-bottom: 1px solid var(--line-soft);
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    flex-wrap: wrap;
}
.card__head h2, .card__head h3 { margin: 0; }
.card__title-group { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.card__title-group span { font-size: .78rem; color: var(--muted); }
.card__body { padding: 16px; }
.card__body--tight { padding: 12px 16px; }
.card__foot {
    padding: 12px 16px;
    border-top: 1px solid var(--line-soft);
    background: var(--surface-alt);
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}

/* Kafelki statystyk */
.stat {
    position: relative;
    padding: 15px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .3s var(--ease-out), box-shadow .3s var(--ease);
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
a.stat { display: block; color: inherit; text-decoration: none; }
a.stat.is-active { border-color: var(--brand-300, var(--brand-200)); box-shadow: 0 0 0 3px var(--brand-50); }
/* Kafelek „spokojny" – informacja, nie alarm (np. nadchodzące płatności) */
.stat--quiet .stat__value { color: var(--muted); }
.stat--quiet .stat__icon { background: var(--surface-alt); color: var(--muted); }
.stat--quiet::after { background: var(--surface-alt); }
.stat::after {
    content: '';
    position: absolute; inset: auto -30px -40px auto;
    width: 110px; height: 110px;
    border-radius: 50%;
    background: var(--brand-50);
    opacity: .8;
    transition: transform .5s var(--ease-out);
}
.stat:hover::after { transform: scale(1.25); }
.stat > * { position: relative; z-index: 1; }
.stat__label { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.stat__value { font-size: 1.5rem; font-weight: 680; letter-spacing: -.03em; margin-top: 3px; }
.stat__meta { font-size: .78rem; color: var(--muted); margin-top: 3px; }
/* Odsyłacze w opisie kafelka mają być dyskretne, nie pomarańczowe */
.stat__meta a { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; white-space: nowrap; }
.stat__meta a:hover { color: var(--ink); }
.stat__icon {
    position: absolute; top: 14px; right: 14px;
    width: 34px; height: 34px;
    border-radius: 11px;
    display: grid; place-items: center;
    background: var(--brand-100); color: var(--brand-700);
}
.stat__icon svg { width: 17px; height: 17px; }
.stat--success .stat__icon { background: var(--success-bg); color: var(--success); }
.stat--success::after { background: var(--success-bg); }
.stat--danger .stat__icon { background: var(--danger-bg); color: var(--danger); }
.stat--danger::after { background: var(--danger-bg); }
.stat--info .stat__icon { background: var(--info-bg); color: var(--info); }
.stat--info::after { background: var(--info-bg); }
.stat--warning .stat__icon { background: var(--warning-bg); color: var(--warning); }
.stat--warning::after { background: var(--warning-bg); }

/* ---------------------------------------------------------------
   7. Przyciski
   --------------------------------------------------------------- */
.btn {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 17px;
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    font-size: .875rem; font-weight: 550;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: transform .16s var(--ease), box-shadow .22s var(--ease), background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
}
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn:active { transform: scale(.97); }
.btn:disabled, .btn.is-loading { opacity: .62; pointer-events: none; }

.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-brand); }
.btn-primary:hover { background: var(--brand-600); color: #fff; box-shadow: 0 14px 30px -10px rgba(249, 115, 22, .68); }

.btn-secondary { background: var(--surface); color: var(--ink-soft); border-color: var(--line); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { border-color: var(--brand-200); color: var(--brand-700); background: var(--brand-50); }

.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--brand-50); color: var(--brand-700); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; color: #fff; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }

.btn-outline-danger { background: transparent; color: var(--danger); border-color: #fecaca; }
.btn-outline-danger:hover { background: var(--danger-bg); }

.btn-sm { padding: 7px 13px; min-height: 34px; font-size: .8rem; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg { padding: 13px 24px; min-height: 50px; font-size: .95rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 0; width: 38px; height: 38px; min-height: 38px; border-radius: var(--radius-sm); }

.btn.is-loading::after {
    content: '';
    position: absolute; inset: 0;
    background: inherit;
    background-image: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent);
    background-size: 200% 100%;
    animation: shimmer 1.1s linear infinite;
}

.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ---------------------------------------------------------------
   8. Formularze
   --------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 15px; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 15px; }
@media (min-width: 640px) {
    .form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--full { grid-column: 1 / -1; }

.label { font-size: .82rem; font-weight: 550; color: var(--ink-soft); display: flex; align-items: center; gap: 5px; }
.label .req { color: var(--brand-600); }

.input, .select, .textarea {
    width: 100%;
    padding: 11px 13px;
    min-height: 44px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
    appearance: none;
    -webkit-appearance: none;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: var(--muted-light); }
.input:hover, .select:hover, .textarea:hover { border-color: #d4d4d8; }
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3.5px rgba(249, 115, 22, .14);
}
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger); background: var(--danger-bg); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-alt); color: var(--muted); cursor: not-allowed; }

.select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 38px;
}

.field__hint { font-size: .76rem; color: var(--muted); line-height: 1.45; }
.field__error { font-size: .78rem; color: var(--danger); display: flex; align-items: flex-start; gap: 5px; }
.field__error svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 2px; }

.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-right: 46px; }
.input-group__btn {
    position: absolute; right: 5px;
    width: 34px; height: 34px;
    display: grid; place-items: center;
    background: none; border: 0; border-radius: 8px;
    color: var(--muted); cursor: pointer;
    transition: background .18s var(--ease), color .18s var(--ease);
}
.input-group__btn:hover { background: var(--brand-50); color: var(--brand-600); }
.input-group__btn svg { width: 17px; height: 17px; }

.input-prefix { position: relative; }
.input-prefix .input { padding-left: 40px; }
.input-prefix__label {
    position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    font-size: .85rem; color: var(--muted); pointer-events: none;
}
.input-suffix { position: relative; }
.input-suffix .input { padding-right: 46px; }
.input-suffix__label {
    position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
    font-size: .85rem; color: var(--muted); pointer-events: none; font-weight: 500;
}

/* Checkbox / radio */
.check {
    display: flex; align-items: flex-start; gap: 10px;
    cursor: pointer;
    font-size: .85rem; line-height: 1.5;
    user-select: none;
}
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check__box {
    width: 21px; height: 21px; flex-shrink: 0;
    margin-top: 1px;
    border: 1.8px solid var(--line);
    border-radius: 7px;
    background: var(--surface);
    display: grid; place-items: center;
    transition: all .2s var(--ease-out);
}
.check__box svg { width: 13px; height: 13px; color: #fff; opacity: 0; transform: scale(.5); transition: all .2s var(--ease-out); }
.check input:checked + .check__box { background: var(--brand); border-color: var(--brand); }
.check input:checked + .check__box svg { opacity: 1; transform: scale(1); }
.check input:focus-visible + .check__box { box-shadow: 0 0 0 3.5px rgba(249, 115, 22, .18); }
.check:hover .check__box { border-color: var(--brand-300); }
.check__text strong { display: block; font-weight: 550; }
.check__text span { color: var(--muted); font-size: .78rem; }

/* Przełącznik */
.switch { display: flex; align-items: center; gap: 11px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
    width: 46px; height: 26px; flex-shrink: 0;
    border-radius: var(--radius-full);
    background: #d4d4d8;
    position: relative;
    transition: background .28s var(--ease);
}
.switch__track::after {
    content: '';
    position: absolute; top: 3px; left: 3px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--shadow-sm);
    transition: transform .28s var(--ease-out);
}
.switch input:checked + .switch__track { background: var(--brand); }
.switch input:checked + .switch__track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 3.5px rgba(249, 115, 22, .18); }

/* Segmenty (radio jako przyciski) */
.segments { display: flex; gap: 4px; padding: 4px; background: var(--surface-alt); border: 1px solid var(--line); border-radius: var(--radius-full); overflow-x: auto; }
.segments::-webkit-scrollbar { display: none; }
.segment { position: relative; flex: 1; min-width: max-content; }
.segment input { position: absolute; opacity: 0; }
.segment span {
    display: block; text-align: center;
    padding: 8px 14px;
    border-radius: var(--radius-full);
    font-size: .82rem; font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    transition: all .22s var(--ease);
    white-space: nowrap;
}
.segment input:checked + span { background: var(--surface); color: var(--brand-700); box-shadow: var(--shadow-xs); font-weight: 600; }
.segment:hover span { color: var(--ink); }

/* ---------------------------------------------------------------
   9. Etykiety / plakietki
   --------------------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: .74rem; font-weight: 600;
    letter-spacing: .01em;
    white-space: nowrap;
}
.badge svg { width: 12px; height: 12px; }
.badge-success { background: var(--success-bg); color: #15803d; }
.badge-danger  { background: var(--danger-bg);  color: #b91c1c; }
.badge-warning { background: var(--warning-bg); color: #b45309; }
.badge-info    { background: var(--info-bg);    color: #1d4ed8; }
.badge-brand   { background: var(--brand-100);  color: var(--brand-700); }
.badge-muted   { background: var(--line-soft);  color: var(--muted); }

.badge-dot::before {
    content: '';
    width: 6px; height: 6px; border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.badge-pulse::before { animation: pulse-dot 1.8s ease-in-out infinite; }

.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 11px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-full);
    font-size: .78rem; color: var(--ink-soft);
}
.chip svg { width: 13px; height: 13px; color: var(--muted); }

/* ---------------------------------------------------------------
   10. Tabele
   --------------------------------------------------------------- */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
}
.table { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 560px; }
.table th, .table td { padding: 12px 14px; text-align: left; vertical-align: middle; }
.table thead th {
    font-size: .72rem; font-weight: 650;
    text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted);
    background: var(--surface-alt);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    position: sticky; top: 0; z-index: 2;
}
.table tbody tr { border-bottom: 1px solid var(--line-soft); transition: background .16s var(--ease); }
.table tbody tr:last-child { border-bottom: 0; }
.table tbody tr:hover { background: var(--brand-50); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.actions { text-align: right; white-space: nowrap; }
.table .cell-strong { font-weight: 600; }
.table .cell-muted { color: var(--muted); font-size: .8rem; }

.table-compact th, .table-compact td { padding: 9px 12px; }

/* Lista na urządzenia mobilne */
.list { display: flex; flex-direction: column; }
.list__item {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line-soft);
    transition: background .16s var(--ease);
}
.list__item:last-child { border-bottom: 0; }
.list__item:hover { background: var(--surface-alt); }
.list__body { flex: 1; min-width: 0; }
.list__title { font-weight: 550; font-size: .9rem; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.list__meta { font-size: .78rem; color: var(--muted); margin-top: 1px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.list__aside { text-align: right; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }

/* Nagłówek grupy pozycji (np. kilka zgłoszeń jednego pracownika) */
.list__group {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 8px 12px;
    padding: 10px 16px;
    background: var(--surface-alt);
    border-bottom: 1px solid var(--line-soft);
}
.list__group-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-weight: 600; font-size: .88rem; }

/* Sekcja zwijana (<details>) – np. nadchodzące płatności, żeby nie kłuły w oczy */
.collapse { border-top: 1px solid var(--line-soft); }
.collapse__toggle {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px;
    font-size: .86rem; font-weight: 550; color: var(--muted);
    cursor: pointer; list-style: none; user-select: none;
    transition: background .16s var(--ease), color .16s var(--ease);
}
.collapse__toggle::-webkit-details-marker { display: none; }
.collapse__toggle:hover { background: var(--surface-alt); color: var(--ink); }
.collapse__toggle:focus-visible { outline: 2px solid var(--brand-200); outline-offset: -2px; }
.collapse__toggle .mc-icon { width: 16px; height: 16px; flex-shrink: 0; }
.collapse__aside { margin-left: auto; font-variant-numeric: tabular-nums; }
.collapse__caret { transition: transform .2s var(--ease); }
.collapse[open] .collapse__caret { transform: rotate(180deg); }
.collapse[open] > .list { animation: collapse-in .22s var(--ease-out); }
@keyframes collapse-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
    .collapse[open] > .list { animation: none; }
}
.list__group + .list__item { background: transparent; }

.only-mobile { display: block; }
.only-desktop { display: none; }
@media (min-width: 860px) {
    .only-mobile { display: none; }
    .only-desktop { display: block; }
}

/* ---------------------------------------------------------------
   11. Płatności – siatka miesięcy
   --------------------------------------------------------------- */
.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 11px; }

.month {
    position: relative;
    padding: 14px;
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    display: flex; flex-direction: column; gap: 9px;
    transition: transform .28s var(--ease-out), box-shadow .28s var(--ease), border-color .28s var(--ease);
    overflow: hidden;
    animation: fade-up .5s var(--ease-out) both;
}
.month:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.month::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: var(--line);
    transition: background .3s var(--ease);
}
.month__period { font-weight: 620; font-size: .95rem; letter-spacing: -.01em; }
.month__amount { font-size: 1.28rem; font-weight: 680; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.month__due { font-size: .74rem; color: var(--muted); }
.month__foot { margin-top: auto; }

.month--paid { border-color: #bbf7d0; background: linear-gradient(180deg, var(--success-bg), var(--surface) 60%); }
.month--paid::before { background: var(--success); }
.month--declared { border-color: #bfdbfe; background: linear-gradient(180deg, var(--info-bg), var(--surface) 60%); }
.month--declared::before { background: var(--info); }
.month--unpaid { border-color: var(--brand-200); background: linear-gradient(180deg, var(--warning-bg), var(--surface) 60%); }
.month--unpaid::before { background: var(--warning); }
.month--rejected { border-color: #fecaca; background: linear-gradient(180deg, var(--danger-bg), var(--surface) 60%); }
.month--rejected::before { background: var(--danger); }
.month--waived { opacity: .82; }
.month--waived::before { background: var(--muted-light); }

/* ---------------------------------------------------------------
   12. Komunikaty / alerty / puste stany
   --------------------------------------------------------------- */
.alert {
    display: flex; align-items: flex-start; gap: 11px;
    padding: 13px 15px;
    border-radius: var(--radius);
    border: 1px solid;
    font-size: .86rem;
    line-height: 1.55;
}
.alert svg { width: 19px; height: 19px; flex-shrink: 0; margin-top: 1px; }
.alert strong { display: block; margin-bottom: 2px; }
.alert-success { background: var(--success-bg); border-color: #bbf7d0; color: #14532d; }
.alert-danger  { background: var(--danger-bg);  border-color: #fecaca; color: #7f1d1d; }
.alert-warning { background: var(--warning-bg); border-color: var(--brand-200); color: #78350f; }
.alert-info    { background: var(--info-bg);    border-color: #bfdbfe; color: #1e3a8a; }
.alert-brand   { background: var(--brand-50);   border-color: var(--brand-200); color: var(--brand-700); }

.empty {
    padding: 44px 22px;
    text-align: center;
    color: var(--muted);
}
.empty__icon {
    width: 62px; height: 62px;
    margin: 0 auto 14px;
    border-radius: 20px;
    background: var(--brand-50);
    color: var(--brand);
    display: grid; place-items: center;
    animation: float 3.4s ease-in-out infinite;
}
.empty__icon svg { width: 28px; height: 28px; }
.empty h3 { color: var(--ink); margin-bottom: 5px; }
.empty p { font-size: .87rem; max-width: 420px; margin: 0 auto 16px; }

/* Powiadomienia */
.toasts {
    position: fixed;
    top: calc(var(--header-h) + 12px); right: 12px; left: 12px;
    z-index: 200;
    display: flex; flex-direction: column; gap: 9px;
    pointer-events: none;
}
@media (min-width: 640px) { .toasts { left: auto; width: 388px; } }

.toast {
    display: flex; align-items: flex-start; gap: 11px;
    padding: 13px 15px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: .86rem;
    pointer-events: auto;
    animation: toast-in .45s var(--ease-out) both;
    position: relative;
    overflow: hidden;
}
.toast.is-leaving { animation: toast-out .3s var(--ease) forwards; }
.toast svg.toast__icon { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.toast__body { flex: 1; min-width: 0; }
.toast__close {
    background: none; border: 0;
    color: var(--muted-light);
    cursor: pointer;
    padding: 6px; margin: -6px -4px -6px 0;
    border-radius: 7px;
    display: grid; place-items: center;
    transition: color .18s var(--ease), background .18s var(--ease);
}
.toast__close:hover { color: var(--ink); background: var(--line-soft); }
.toast__close svg { width: 15px; height: 15px; }
.toast::after {
    content: '';
    position: absolute; bottom: 0; left: 0; height: 2px;
    background: currentColor; opacity: .3;
    animation: toast-progress 6s linear forwards;
}
/* Pod kursorem odliczanie stoi — komunikat da się spokojnie przeczytać. */
.toast.is-paused::after { animation-play-state: paused; }
.toast-success { border-left-color: var(--success); color: #14532d; }
.toast-success svg.toast__icon { color: var(--success); }
.toast-error   { border-left-color: var(--danger); color: #7f1d1d; }
.toast-error svg.toast__icon { color: var(--danger); }
.toast-warning { border-left-color: var(--warning); color: #78350f; }
.toast-warning svg.toast__icon { color: var(--warning); }
.toast-info    { border-left-color: var(--info); color: #1e3a8a; }
.toast-info svg.toast__icon { color: var(--info); }

/* ---------------------------------------------------------------
   13. Okna modalne
   --------------------------------------------------------------- */
.modal {
    position: fixed; inset: 0;
    z-index: 300;
    display: flex; align-items: flex-end; justify-content: center;
    padding: 0;
    opacity: 0; visibility: hidden;
    transition: opacity .28s var(--ease), visibility .28s;
}
@media (min-width: 640px) { .modal { align-items: center; padding: 24px; } }
.modal.is-open { opacity: 1; visibility: visible; }

.modal__backdrop {
    position: absolute; inset: 0;
    background: rgba(24, 24, 27, .48);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
.modal__panel {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: 92vh;
    background: var(--surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: var(--shadow-lg);
    display: flex; flex-direction: column;
    transform: translateY(28px);
    transition: transform .4s var(--ease-out);
    overflow: hidden;
}
@media (min-width: 640px) {
    .modal__panel { border-radius: var(--radius-lg); transform: translateY(12px) scale(.96); }
}
.modal.is-open .modal__panel { transform: translateY(0) scale(1); }
.modal__panel--wide { max-width: 720px; }
.modal__panel--confirm { max-width: 420px; }
.modal__panel--confirm .modal__body { padding-top: 4px; padding-bottom: 20px; }
.modal__panel--confirm .modal__body p { color: var(--ink-soft); font-size: .9rem; line-height: 1.6; }

.modal__grip { width: 40px; height: 4px; background: var(--line); border-radius: 3px; margin: 9px auto 0; }
@media (min-width: 640px) { .modal__grip { display: none; } }

.modal__head { padding: 16px 18px 12px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal__head h3 { margin: 0; }
.modal__head p { font-size: .82rem; color: var(--muted); margin: 3px 0 0; }
.modal__close {
    width: 32px; height: 32px; flex-shrink: 0;
    border: 0; background: var(--surface-alt); border-radius: 9px;
    color: var(--muted); cursor: pointer;
    display: grid; place-items: center;
    transition: background .18s, color .18s;
}
.modal__close:hover { background: var(--danger-bg); color: var(--danger); }
.modal__close svg { width: 16px; height: 16px; }
.modal__body { padding: 0 18px 16px; overflow-y: auto; }
.modal__foot {
    padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line-soft);
    background: var(--surface-alt);
    display: flex; gap: 9px; flex-wrap: wrap;
}
.modal__foot .btn { flex: 1; }
@media (min-width: 640px) { .modal__foot { justify-content: flex-end; } .modal__foot .btn { flex: 0 0 auto; } }

/* Pop-up o zaległości */
.paywall__hero {
    padding: 26px 20px 20px;
    text-align: center;
    background: linear-gradient(160deg, var(--brand-50), var(--surface));
    border-bottom: 1px solid var(--line-soft);
}
.paywall__badge {
    width: 66px; height: 66px;
    margin: 0 auto 13px;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--brand), var(--brand-600));
    color: #fff;
    display: grid; place-items: center;
    box-shadow: var(--shadow-brand);
    animation: bounce-in .6s var(--ease-out) both;
}
.paywall__badge svg { width: 30px; height: 30px; }
.paywall__amount {
    font-size: 2.15rem; font-weight: 700;
    letter-spacing: -.04em;
    color: var(--brand-700);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.paywall__periods { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 11px; }

.payinfo { display: flex; flex-direction: column; gap: 2px; }
.payinfo__row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 11px 13px;
    background: var(--surface-alt);
    border-radius: var(--radius-sm);
    font-size: .86rem;
}
.payinfo__row + .payinfo__row { margin-top: 6px; }
.payinfo__label {
    display: flex; align-items: center; gap: 6px;
    color: var(--muted); font-size: .78rem;
    min-width: 0;
}
.payinfo__label svg { width: 15px; height: 15px; opacity: .8; }
.payinfo__value { font-weight: 600; text-align: right; word-break: break-word; }
.payinfo__value--big { font-size: 1.02rem; color: var(--brand-700); }

.copy-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 9px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 8px;
    font-size: .72rem; color: var(--muted);
    cursor: pointer;
    transition: all .18s var(--ease);
}
.copy-btn:hover { border-color: var(--brand-200); color: var(--brand-700); background: var(--brand-50); }
.copy-btn svg { width: 12px; height: 12px; }
.copy-btn.is-copied { background: var(--success-bg); border-color: #bbf7d0; color: var(--success); }

/* ---------------------------------------------------------------
   14. Zakładki, postęp, oś czasu
   --------------------------------------------------------------- */
.tabs {
    display: flex; gap: 3px;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    scrollbar-width: none;
    margin-bottom: 16px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    position: relative;
    display: inline-flex; align-items: center; gap: 7px;
    padding: 11px 15px;
    font-size: .86rem; font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
    cursor: pointer;
    background: none; border: 0;
    transition: color .2s var(--ease);
}
.tab svg { width: 16px; height: 16px; opacity: .8; }
.tab.is-active svg { opacity: 1; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--brand-700); font-weight: 600; }
.tab.is-active::after {
    content: '';
    position: absolute; left: 12px; right: 12px; bottom: -1px;
    height: 2.5px; border-radius: 3px 3px 0 0;
    background: var(--brand);
    animation: tab-in .3s var(--ease-out) both;
}

.progress { height: 8px; background: var(--line-soft); border-radius: var(--radius-full); overflow: hidden; }
.progress__bar {
    height: 100%;
    background: linear-gradient(90deg, var(--brand), var(--brand-600));
    border-radius: var(--radius-full);
    width: 0;
    transition: width 1s var(--ease-out);
}
.progress__bar--success { background: linear-gradient(90deg, #4ade80, var(--success)); }

.bars { display: flex; align-items: flex-end; gap: 9px; height: 128px; padding-top: 8px; }
.bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; }
.bars__stack { flex: 1; width: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; }
.bars__bar {
    width: 100%;
    border-radius: 6px 6px 3px 3px;
    background: linear-gradient(180deg, var(--brand-300), var(--brand));
    min-height: 3px;
    transform-origin: bottom;
    animation: bar-grow .8s var(--ease-out) both;
    position: relative;
}
.bars__bar--due { background: linear-gradient(180deg, #e4e4e7, #d4d4d8); border-radius: 3px; }
.bars__label { font-size: .68rem; color: var(--muted); text-transform: capitalize; white-space: nowrap; }

.timeline { position: relative; padding-left: 24px; }
.timeline::before {
    content: '';
    position: absolute; left: 6px; top: 6px; bottom: 6px;
    width: 2px; background: var(--line);
}
.timeline__item { position: relative; padding-bottom: 15px; }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before {
    content: '';
    position: absolute; left: -23px; top: 5px;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--surface);
    border: 2.5px solid var(--brand-300);
}
.timeline__item--active::before { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-100); }
.timeline__time { font-size: .72rem; color: var(--muted-light); }
.timeline__title { font-size: .85rem; font-weight: 500; }
.timeline__desc { font-size: .78rem; color: var(--muted); }

/* ---------------------------------------------------------------
   15. Ekran logowania / rejestracji
   --------------------------------------------------------------- */
.auth {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex; flex-direction: column;
    background:
        radial-gradient(1000px 520px at 12% -8%, var(--brand-100), transparent 62%),
        radial-gradient(760px 420px at 96% 6%, #fff1e2, transparent 58%),
        var(--bg);
    padding: 22px 16px 34px;
}
.auth__inner {
    width: 100%; max-width: 460px;
    margin: auto;
    display: flex; flex-direction: column; gap: 18px;
}
.auth__inner--wide { max-width: 640px; }
.auth__brand { display: flex; flex-direction: column; align-items: center; gap: 11px; text-align: center; }
.auth__brand .brand__mark { width: 50px; height: 50px; border-radius: 16px; font-size: 1.25rem; }
.auth__brand h1 { font-size: 1.35rem; margin: 0; }
.auth__brand p { color: var(--muted); font-size: .87rem; margin: 0; }

.auth__card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 22px 20px;
    animation: fade-up .5s var(--ease-out) both;
}
@media (min-width: 640px) { .auth__card { padding: 28px 26px; } }

.auth__foot { text-align: center; font-size: .8rem; color: var(--muted); }
.auth__foot a { font-weight: 500; }

.steps { display: flex; align-items: center; gap: 7px; margin-bottom: 18px; }
.steps__item { flex: 1; height: 4px; background: var(--line); border-radius: 3px; transition: background .4s var(--ease); }
.steps__item.is-done { background: var(--brand); }

/* ---------------------------------------------------------------
   16. Pomocnicze
   --------------------------------------------------------------- */
.text-muted { color: var(--muted); }
.text-sm { font-size: .82rem; }
.text-xs { font-size: .74rem; }
.text-lg { font-size: 1.05rem; }
.text-brand { color: var(--brand-600); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 680; }
.nums { font-variant-numeric: tabular-nums; }
.break-all { word-break: break-all; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 26px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.divider-text { display: flex; align-items: center; gap: 12px; color: var(--muted-light); font-size: .76rem; margin: 16px 0; }
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.code {
    font-family: ui-monospace, 'SFMono-Regular', 'Cascadia Code', Consolas, monospace;
    font-size: .8rem;
    background: var(--surface-alt);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 3px 7px;
    word-break: break-all;
}
.code-block {
    display: block;
    padding: 11px 13px;
    line-height: 1.65;
    white-space: pre-wrap;
}

.link-box {
    display: flex; align-items: center; gap: 9px;
    padding: 11px 13px;
    background: var(--brand-50);
    border: 1px dashed var(--brand-200);
    border-radius: var(--radius-sm);
}
.link-box code { flex: 1; font-size: .76rem; word-break: break-all; color: var(--brand-700); }

.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }

.filters {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
}
@media (min-width: 640px) { .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .filters { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; } }

.sticky-actions {
    position: sticky;
    bottom: calc(var(--bottomnav-h) + 8px);
    z-index: 40;
    padding: 11px 13px;
    background: rgba(255, 255, 255, .95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex; flex-wrap: wrap; align-items: center; gap: 9px;
    animation: fade-up .3s var(--ease-out) both;
}
@media (min-width: 900px) { .sticky-actions { bottom: 16px; } }

/* Sekcja opcjonalna (instalator) */
.install-optional {
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
    background: var(--surface-alt);
    transition: border-color .25s var(--ease), background .25s var(--ease);
}
.install-optional[open] { border-style: solid; border-color: var(--brand-200); background: var(--surface); }
.install-optional summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.install-optional summary::-webkit-details-marker { display: none; }
.install-optional__title {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    font-size: 1.02rem; font-weight: 650; letter-spacing: -.02em;
}
.install-optional__title svg { width: 18px; height: 18px; color: var(--brand); }
.install-optional__title::after {
    content: '';
    width: 8px; height: 8px;
    margin-left: auto;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform .3s var(--ease-out);
}
.install-optional[open] .install-optional__title::after { transform: rotate(225deg) translate(-2px, -2px); }
.install-optional__hint { font-size: .78rem; color: var(--muted); line-height: 1.5; }

/* Ujawnianie przy przewijaniu */
.reveal { opacity: 0; transform: translateY(14px); }
.reveal.is-visible { animation: fade-up .55s var(--ease-out) both; }

/* ---------------------------------------------------------------
   17. Animacje
   --------------------------------------------------------------- */
@keyframes fade-up {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes toast-in {
    from { opacity: 0; transform: translateX(28px) scale(.96); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toast-out {
    to { opacity: 0; transform: translateX(28px) scale(.94); }
}
@keyframes toast-progress {
    from { width: 100%; }
    to   { width: 0; }
}
@keyframes bounce-in {
    0%   { opacity: 0; transform: scale(.5); }
    60%  { opacity: 1; transform: scale(1.08); }
    100% { transform: scale(1); }
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: .45; transform: scale(1.35); }
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-7px); }
}
@keyframes shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}
@keyframes bar-grow {
    from { transform: scaleY(0); opacity: 0; }
    to   { transform: scaleY(1); opacity: 1; }
}
@keyframes nav-pop {
    from { transform: translateX(-50%) scaleX(0); }
    to   { transform: translateX(-50%) scaleX(1); }
}
@keyframes tab-in {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
    width: 18px; height: 18px;
    border: 2.2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
}

/* Opóźnienia dla efektu kaskady */
.stagger > * { animation: fade-up .5s var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: .03s; }
.stagger > *:nth-child(2) { animation-delay: .07s; }
.stagger > *:nth-child(3) { animation-delay: .11s; }
.stagger > *:nth-child(4) { animation-delay: .15s; }
.stagger > *:nth-child(5) { animation-delay: .19s; }
.stagger > *:nth-child(6) { animation-delay: .23s; }
.stagger > *:nth-child(7) { animation-delay: .27s; }
.stagger > *:nth-child(8) { animation-delay: .31s; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---------------------------------------------------------------
   18. Wydruk
   --------------------------------------------------------------- */
@media print {
    .header, .bottomnav, .toasts, .btn, .page-head__actions, .filters, .sticky-actions { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; border-color: #ddd; break-inside: avoid; }
    .table { min-width: 0; font-size: 11px; }
}
