/* ============================================================
   Finansometr – Globalny arkusz stylów
   Plik: assets/css/styles.css

   Uzupełnia Tailwind CSS v4 o rzeczy, których nie ma sensu
   robić klasami utility: animacje wejścia, dekoracyjne
   pseudo-elementy, komponenty powtarzalne w wielu miejscach.

   Kolory marki (bg-brand, bg-magenta, text-lime itd.) są
   zdefiniowane w includes/head.php wewnątrz bloku @theme.
   ============================================================ */


/* ============================================================
   0. ZMIENNE KOLORÓW (fallback)
   Tailwind v4 sam wystawia te zmienne w :root przez @theme,
   ale browser-CDN robi to asynchronicznie – zanim zdąży,
   nasze własne klasy (.hist-row-amount, .kat-trans-row-amount)
   renderują się z niezdefiniowanym var() i wpadają na kolor
   odziedziczony (biały). Dlatego duplikujemy je tutaj –
   to nasz "safety net" dla zewnętrznego CSS.
   ============================================================ */
:root {
    --color-brand:        #8537FD;
    --color-brand-strong: #6e22e8;
    --color-magenta:      #E837FD;
    --color-lime:         #AFFD37;
    --color-yellow:       #FDE837;
    --color-cyan:         #37C8FD;
    --color-danger:       #FF4757;
    --color-surface:      #181818;
    --color-surface-2:    #1C1C1C;
}


/* ============================================================
   1. BAZA – font i tło aplikacji
   Tło ustawiamy tutaj, żeby nie trzeba było dopinać klasy
   bg-[#0C0C0C] na każdym <body>.
   ============================================================ */
html,
body {
    font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif;
    background: #0C0C0C;
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;

    /* Blokada pinch-zoom/double-tap-zoom na całej aplikacji.
       touch-action: manipulation = zezwalamy tylko na scroll i kliknięcia,
       blokujemy gest 2-palcowego zoomu i szybkiego double-tap zoomu.
       Chrome/Safari automatycznie eliminują też 300ms opóźnienie kliku. */
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;   /* iOS nie powiększa tekstu po obrocie */
}

/* Input / textarea / select – zero zoomu przy focusie na iOS.
   iOS Safari zoomuje jak font-size < 16px, więc wymuszamy minimum 16px
   (`user-scalable=no` w viewport to nie zawsze wystarcza, w niektórych
   buildach iOS obchodzi ten flag). */
input, textarea, select {
    font-size: 16px;
}
input[type="date"], input[type="time"], input[type="datetime-local"] {
    font-size: 16px;
}

/* Przyciski/tapowalne elementy – bez 300ms opóźnienia i bez double-tap-zoom */
button, a, [role="button"], [data-bs-open], [data-bs-close] {
    touch-action: manipulation;
}

/* Usuwamy domyślny niebieski highlight tapnięć na iOS */
a,
button,
[role="button"] {
    -webkit-tap-highlight-color: transparent;
}


/* ============================================================
   1a. SEMANTYCZNE KOLORY TEKSTU (dublujemy Tailwinda)
   Duplikujemy kolory tekstu marki tutaj, na wypadek gdyby
   browser-CDN Tailwinda v4 nie zdążył zarejestrować klas
   text-danger / text-lime / text-brand przed pierwszym
   renderem. Dzięki temu kwoty wydatków (text-danger) i
   dochodów (text-lime) zawsze mają właściwy kolor.
   ============================================================ */
.text-danger { color: var(--color-danger); }
.text-lime   { color: var(--color-lime);   }
.text-brand  { color: var(--color-brand);  }
.text-magenta { color: var(--color-magenta); }
.text-yellow { color: var(--color-yellow); }
.text-cyan   { color: var(--color-cyan);   }


/* ============================================================
   2. WRAPPER APLIKACJI – max 480px na środku ekranu
   Cały UI aplikacji jest mobile-first. Na większych ekranach
   środkuje się w tej kolumnie – dokładnie jak widok
   w PWA/Capacitor po wrappingu.
   ============================================================ */
.app-shell {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
}


/* ============================================================
   3. ANIMACJE WEJŚCIA
   Zachowujemy takie same nazwy klas jak wcześniej (anim-1,
   anim-2 itd.), żeby HTML pozostał zwięzły i żeby nie trzeba
   było rozpinać opóźnień inline.
   ============================================================ */

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes heroSlide {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes logoIn {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.7); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes barGrow {
    from { width: 0 !important; }
}

/* Klasy z opóźnieniami – kaskadowe wejście elementów */
.anim-logo    { animation: logoIn    0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.05s both; }
.anim-hero    { animation: heroSlide 0.45s cubic-bezier(0.22, 1, 0.36, 1) both; }
.anim-success { animation: scaleIn   0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both; }

.anim-1 { animation: fadeUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.05s both; }
.anim-2 { animation: fadeUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both; }
.anim-3 { animation: fadeUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.25s both; }
.anim-4 { animation: fadeUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.35s both; }
.anim-5 { animation: fadeUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.45s both; }
.anim-6 { animation: fadeUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.55s both; }
.anim-7 { animation: fadeUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.65s both; }
.anim-8 { animation: fadeUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.75s both; }

/* Alternatywne opóźnienia używane na dashboardzie */
.anim-fade-1 { animation: fadeUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both; }
.anim-fade-2 { animation: fadeUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both; }
.anim-fade-3 { animation: fadeUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both; }
.anim-fade-4 { animation: fadeUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.4s both; }
.anim-fade-5 { animation: fadeUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.5s both; }
.anim-nav    { animation: fadeIn 0.5s ease 0.55s both; }

/* Animacja wyjeżdżających pasków kategorii na dashboardzie */
.bar-animated {
    animation: barGrow 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.6s both;
}


/* ============================================================
   4. SAFE-AREA HELPERS (iOS notch / home indicator)
   Używane jako klasy pomocnicze, bo arbitrary values
   w Tailwindzie z env() bywają niewygodne przy max().
   ============================================================ */
.pt-safe     { padding-top: max(48px, env(safe-area-inset-top, 0px)); }
.pt-safe-sm  { padding-top: max(24px, env(safe-area-inset-top, 0px)); }
.pb-safe     { padding-bottom: max(32px, env(safe-area-inset-bottom, 0px)); }
/* 70px = wysokość dolnej belki + 32px bufor, żeby scrolowana treść nie
   kończyła się milimetr pod navbarem (było zbyt ciasno). */
.pb-safe-nav { padding-bottom: calc(102px + env(safe-area-inset-bottom, 0px)); }


/* ============================================================
   5. HERO – dekoracyjne kółka
   Użycie: <header class="hero-decorated bg-brand">...</header>
   Dodaje dwa miękkie, półprzezroczyste kółka w rogach nagłówka.
   ============================================================ */
.hero-decorated {
    position: relative;
    overflow: hidden;
}
.hero-decorated::before,
.hero-decorated::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    pointer-events: none;
}
.hero-decorated::before {
    width: 260px;
    height: 260px;
    top: -110px;
    right: -70px;
}
.hero-decorated::after {
    width: 160px;
    height: 160px;
    bottom: -60px;
    left: -50px;
}


/* ============================================================
   6. STANDARDOWY INPUT Z IKONĄ
   Wygląd identyczny w login / register / reset / settings.
   Ikona jest osobnym <svg class="fm-input-icon">, a input
   dostaje klasę .fm-input (+ opcjonalnie .no-icon lub
   .with-toggle gdy po prawej jest oko / walidacja).
   ============================================================ */
.fm-input {
    width: 100%;
    background: #181818;
    border: 1px solid #2a2a2a;
    border-radius: 14px;
    padding: 16px 16px 16px 48px;
    font-size: 15px;
    font-weight: 500;
    color: #ffffff;
    outline: none;
    transition: border-color 0.15s;
    -webkit-appearance: none;
    font-family: inherit;
}
.fm-input.no-icon     { padding-left: 16px; }
.fm-input.with-toggle { padding-right: 48px; }
.fm-input::placeholder { color: rgba(255, 255, 255, 0.2); }
.fm-input:focus        { border-color: #8537FD; }
.fm-input.is-error     { border-color: #FF4757 !important; }
.fm-input.is-valid     { border-color: rgba(175, 253, 55, 0.5); }

/* Ikona wewnątrz inputu (lewa strona) */
.fm-input-icon {
    position: absolute;
    left: 16px;
    width: 18px;
    height: 18px;
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
    flex-shrink: 0;
}


/* ============================================================
   7. CUSTOM CHECKBOX – kwadrat z fajką
   Użycie:
     <label>
       <input type="checkbox" class="sr-only peer">
       <span class="fm-check-dot">
         <svg class="fm-check-tick">...</svg>
       </span>
     </label>
   Wariant bez peer: input + .fm-check-dot jako rodzeństwo.
   ============================================================ */
.fm-check-dot {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border-radius: 7px;
    background: #181818;
    border: 1.5px solid #333333;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}
/* Sąsiad input:checked + .fm-check-dot */
input[type="checkbox"]:checked + .fm-check-dot {
    background: #8537FD;
    border-color: #8537FD;
}
input[type="checkbox"]:checked + .fm-check-dot .fm-check-tick {
    display: block;
}
.fm-check-tick { display: none; }


/* ============================================================
   8. PASEK POSTĘPU (kategorie na dashboardzie)
   .bar-track – szyna, .bar-fill – wypełnienie (kolor inline)
   ============================================================ */
.bar-track {
    height: 6px;
    background: #242424;
    border-radius: 3px;
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}


/* ============================================================
   9. WSPÓLNE KOMPONENTY FORMULARZY
   Używane w: login / reset-password / new-account / ustawienia
   ============================================================ */

/* Przycisk "Wstecz" ze strzałką – używany w register, reset i potem w ustawieniach */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: color 0.15s;
    font-family: inherit;
}
.back-btn:active { color: #ffffff; }

/* Pasek siły hasła – 4 segmenty */
.pass-strength-bar {
    display: flex;
    gap: 4px;
    margin-top: 10px;
    margin-bottom: 8px;
}
.strength-seg {
    flex: 1;
    height: 4px;
    background: #333333;
    border-radius: 2px;
    transition: background 0.3s;
}

/* Wymogi hasła – podświetlane live na zielono/czerwono */
.pass-requirements {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 8px;
}
.req-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 500;
    transition: color 0.2s;
}
.req-item.met  { color: #AFFD37; }
.req-item.fail { color: #FF4757; }
.req-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #333333;
    flex-shrink: 0;
    transition: background 0.2s;
}
.req-item.met  .req-dot { background: #AFFD37; }
.req-item.fail .req-dot { background: #FF4757; }

/* Wskaźnik zgodności haseł (✓ Hasła są zgodne / ✗ Hasła nie są identyczne) */
.match-indicator {
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
    display: none;
}
.match-indicator.ok   { color: #AFFD37; display: block; }
.match-indicator.fail { color: #FF4757; display: block; }

/* Komunikat błędu pod polem (wzorzec ukryty/widoczny) */
.field-error {
    font-size: 12px;
    color: #FF4757;
    font-weight: 600;
    margin-top: 6px;
    display: none;
    align-items: center;
    gap: 5px;
}
.field-error.visible { display: flex; }


/* ============================================================
   10. KROKI KREATORA (onboarding, reset hasła)
   Tylko jeden krok widoczny naraz – przełączany przez JS
   klasą .active.
   ============================================================ */
.step {
    display: none;
    flex-direction: column;
    flex: 1;
}
.step.active { display: flex; }

/* Pasek postępu kroków – 3 lub 4 kropki (flex: 1) */
.progress-dot {
    flex: 1;
    height: 4px;
    background: #2a2a2a;
    border-radius: 2px;
    transition: background 0.3s;
}
.progress-dot.active { background: #8537FD; }
.progress-dot.done   { background: rgba(133, 55, 253, 0.4); }


/* ============================================================
   11. POLA KODU 6-CYFROWEGO (reset hasła, 2FA)
   Pojedynczy znak na pole, focus automatyczny przez JS.
   ============================================================ */
.code-input {
    flex: 1;
    aspect-ratio: 1;
    max-width: 52px;
    background: #181818;
    border: 1px solid #2a2a2a;
    border-radius: 14px;
    text-align: center;
    font-size: 22px;
    font-weight: 800;
    color: #ffffff;
    outline: none;
    transition: border-color 0.15s;
    -webkit-appearance: none;
    font-family: inherit;
}
.code-input:focus          { border-color: #8537FD; }
.code-input.filled         { border-color: rgba(133, 55, 253, 0.5); }


/* ============================================================
   12. EKRAN SUKCESU (po rejestracji, resecie, usunięciu konta)
   Fioletowy okrąg z fajką, tytuł, opis i CTA.
   Użycie: <div class="success-screen active">...</div>
   ============================================================ */
.success-screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    padding: 40px 0;
}
.success-screen.active { display: flex; }


/* ============================================================
   13. IKONA STATUSU PO PRAWEJ STRONIE INPUTU (✓/✗)
   Używana przy live-walidacji e-maila w rejestracji.
   ============================================================ */
.fm-input-status {
    position: absolute;
    right: 16px;
    width: 18px;
    height: 18px;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.fm-input-status.visible { display: flex; }


/* ============================================================
   14. AVATAR UPLOAD – okrągły picker zdjęcia
   Stan "pusty" – dashed border + placeholder
   Stan "ma zdjęcie" – dodać klasę .has-image
   ============================================================ */
.avatar-upload-circle {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: #181818;
    border: 2px dashed #333333;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s;
    flex-shrink: 0;
}
.avatar-upload-circle:active { border-color: #8537FD; }
.avatar-upload-circle.has-image {
    border-style: solid;
    border-color: rgba(133, 55, 253, 0.4);
    pointer-events: none;
}


/* ============================================================
   15. DASHBOARD – safe-area top pod hero
   Hero dashboardu ma minimalny padding-top 20px, ale musi
   zejść niżej pod notch/dynamic island jeśli urządzenie
   tego wymaga. Osobna klasa bo .pt-safe (max 48px) jest
   za duża a .pt-safe-sm (max 24px) była zaprojektowana
   dla ekranów bez hero.
   ============================================================ */
.pt-safe-hero { padding-top: max(20px, env(safe-area-inset-top, 0px)); }


/* ============================================================
   16. DASHBOARD – ikona kategorii (kolor z currentColor)
   Mała ikona SVG obok nazwy kategorii (przegląd wydatków).
   Dostaje kolor przez inline style="color:#XXX" na wrapperze,
   a strokes SVG dziedziczą go dzięki stroke: currentColor.
   Tailwind nie umie selektować dzieci SVG, więc zostaje to
   jako utility CSS.
   ============================================================ */
.cat-svg-ico {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.cat-svg-ico svg {
    width: 15px;
    height: 15px;
}
.cat-svg-ico svg line,
.cat-svg-ico svg path,
.cat-svg-ico svg circle,
.cat-svg-ico svg rect {
    stroke: currentColor;
    opacity: 1;
}


/* ============================================================
   17. LUCIDE ICONS – stylowanie
   Lucide po createIcons() podmienia <i data-lucide="nazwa">
   na <svg class="lucide lucide-nazwa">...</svg>.
   Chcemy: stroke dziedziczony z currentColor (żeby można
   było sterować kolorem przez text-*), brak domyślnych
   marginesów, wyrównanie pionowe do środka linii.
   ============================================================ */

/* Placeholder – zanim Lucide skompiluje ikonę */
[data-lucide] {
    display: inline-block;
    width: 24px;
    height: 24px;
}

/* Docelowy SVG wygenerowany przez Lucide */
.lucide {
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: middle;
    flex-shrink: 0;
    display: inline-block;
}

/* Wygodne rozmiary – użyj obok klasy ikony */
.lucide-xs { width: 14px; height: 14px; }
.lucide-sm { width: 16px; height: 16px; }
.lucide-md { width: 20px; height: 20px; }
.lucide-lg { width: 24px; height: 24px; }
.lucide-xl { width: 28px; height: 28px; }


/* ============================================================
   18. BOTTOMSHEET – wysuwane od dołu okno edycji
   Używane w kategoriach (edycja, picker koloru/ikony),
   transakcjach, filtrach historii.
   Struktura:
     <div class="bsheet-backdrop is-open">
       <div class="bsheet">
         <div class="bsheet-handle"></div>
         ...zawartość...
       </div>
     </div>
   ============================================================ */
.bsheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
.bsheet-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.bsheet {
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    background: #141414;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    padding: 14px 20px calc(28px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    border-top: 1px solid #1e1e1e;
}
.bsheet-backdrop.is-open .bsheet {
    transform: translateY(0);
}
.bsheet-handle {
    width: 44px;
    height: 4px;
    border-radius: 2px;
    background: #333;
    margin: 0 auto 16px;
}
.bsheet-title {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 4px;
    letter-spacing: -0.3px;
}
.bsheet-sub {
    font-size: 13px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 18px;
}


/* ============================================================
   19. PALETA KOLORÓW (picker w bottomsheet edycji kategorii)
   10 kolorów = 2 rzędy po 5. Klik zaznacza okrąg białą obwódką.
   ============================================================ */
.color-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.color-dot {
    aspect-ratio: 1;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: transform 0.15s;
    border: 2px solid transparent;
}
.color-dot:active { transform: scale(0.92); }
.color-dot.selected {
    border-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.15);
}
.color-dot.selected::after {
    content: '';
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    background: inherit;
}


/* ============================================================
   20. PICKER IKON (grid 6 kolumn, przewijalny)
   Siatka wszystkich ikon Lucide z listaIkon(). Nagłówki sekcji
   są widoczne jako cienkie etykiety.
   ============================================================ */
.icon-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255,255,255,0.35);
    margin: 14px 0 6px;
}
.icon-section-title:first-child { margin-top: 0; }

.icon-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}
.icon-btn {
    aspect-ratio: 1;
    border-radius: 12px;
    background: #1c1c1c;
    border: 1.5px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.75);
    transition: all 0.15s;
    cursor: pointer;
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn.selected {
    background: rgba(133,55,253,0.15);
    border-color: #8537FD;
    color: #ffffff;
}


/* ============================================================
   21. KATEGORIA – karta w liście (ekran kategorii, ustawienia)
   Duża, klikalna karta z ikoną w kolorze kategorii, nazwą
   i listą podkategorii. Systemowe = z plakietką "systemowa".
   ============================================================ */
.cat-card {
    background: #181818;
    border: 1px solid #222;
    border-radius: 18px;
    padding: 14px 14px;
    transition: border-color 0.15s;
}
.cat-card.is-system {
    background: #161616;
    border-color: #2a2a2a;
}
.cat-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
}
.cat-bubble {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #0C0C0C;
}
.cat-bubble .lucide {
    width: 22px;
    height: 22px;
    stroke-width: 2;
}
.cat-name {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.2px;
    flex: 1;
    min-width: 0;
}
.cat-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 3px 8px;
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.45);
}
.cat-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: #222;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.7);
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}
.cat-action-btn:active { background: #2a2a2a; }

/* Lista podkategorii wewnątrz karty */
.subcat-list {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.subcat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px;
    border-radius: 10px;
    transition: background 0.15s;
}
.subcat-row:active { background: #1e1e1e; }
.subcat-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.subcat-name {
    flex: 1;
    font-size: 14px;
    color: rgba(255,255,255,0.85);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.subcat-del {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.35);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}
.subcat-del:active {
    color: #FF4757;
    background: rgba(255,71,87,0.1);
}

/* Przycisk "+ dodaj podkategorię" */
.subcat-add {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.15s;
    margin-top: 2px;
}
.subcat-add:active { color: #ffffff; }


/* ============================================================
   22. PRZYCISK "DODAJ KATEGORIĘ" – duży dashed box
   ============================================================ */
.add-cat-btn {
    width: 100%;
    padding: 16px;
    border-radius: 18px;
    border: 1.5px dashed #333;
    background: transparent;
    color: rgba(255,255,255,0.55);
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.add-cat-btn:active {
    border-color: #8537FD;
    color: #ffffff;
    background: rgba(133,55,253,0.08);
}


/* ============================================================
   23. SEKCJA – wspólny nagłówek ekranu z tytułem i podpisem
   ============================================================ */
.sec-head {
    padding: 20px 0 12px;
}
.sec-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255,255,255,0.35);
    margin-bottom: 4px;
}
.sec-sub {
    font-size: 12px;
    color: rgba(255,255,255,0.35);
    line-height: 1.5;
}


/* ============================================================
   24. STANDARDOWY PRZYCISK (primary / ghost)
   ============================================================ */
.btn-primary {
    width: 100%;
    padding: 15px;
    background: #8537FD;
    color: #ffffff;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-primary:active {
    background: #6e22e8;
    transform: scale(0.98);
}
.btn-primary:disabled {
    opacity: 0.4;
    pointer-events: none;
}
.btn-ghost {
    width: 100%;
    padding: 14px;
    background: transparent;
    color: rgba(255,255,255,0.65);
    border: 1px solid #2a2a2a;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.btn-ghost:active {
    background: #181818;
    color: #ffffff;
}


/* ============================================================
   25. ONBOARDING
   Kreator pierwszej konfiguracji – 5 kroków.
   Używa też: .step / .step.active (sekcja 5) oraz
             .btn-primary / .btn-ghost (sekcja 24).
   ============================================================ */

/* ---- Pasek postępu u góry (5 segmentów) ---- */
.onb-segments {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 26px;
}
.onb-segments-6 {
    grid-template-columns: repeat(6, 1fr);
}
.onb-segment {
    height: 4px;
    border-radius: 2px;
    background: #2a2a2a;
    transition: background 0.25s ease;
}
.onb-segment.done,
.onb-segment.active {
    background: var(--color-brand);
}

/* ---- Tutorial card (krok 1) ---- */
.tut-card {
    display: flex;
    gap: 14px;
    background: var(--color-surface);
    border-radius: 18px;
    padding: 14px 16px;
    align-items: flex-start;
}
.tut-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(133, 55, 253, 0.15);
    color: var(--color-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.tut-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 3px;
    line-height: 1.25;
}
.tut-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.45;
}

/* ---- Day picker (krok 2) — poziomy scroll 1–31 ---- */
.day-picker {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 2px 10px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    margin: 0 -24px;           /* żeby scroll sięgał krawędzi */
    padding-left: 24px;
    padding-right: 24px;
}
.day-picker::-webkit-scrollbar { display: none; }

.day-btn {
    width: 56px;
    height: 66px;
    flex-shrink: 0;
    border-radius: 14px;
    background: var(--color-surface);
    border: 1.5px solid transparent;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 800;
    font-size: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    gap: 2px;
    transition: all 0.15s ease;
    font-family: inherit;
}
.day-btn .day-label {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.4px;
    text-transform: uppercase;
}
.day-btn.selected {
    background: var(--color-brand);
    color: #fff;
    border-color: var(--color-brand);
}
.day-btn.selected .day-label { color: rgba(255, 255, 255, 0.8); }

/* ---- Chipsy (krok 3 — subkategorie dochodu) ---- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--color-surface);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    padding: 8px 8px 8px 14px;
    border-radius: 999px;
}
.chip-x {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    border: 0;
    padding: 0;
    font-size: 12px;
    line-height: 1;
    flex-shrink: 0;
}
.chip-preset {
    background: transparent;
    border: 1.5px dashed rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    padding: 7px 14px;
    border-radius: 999px;
    font-family: inherit;
}
.chip-preset:active,
.chip-preset.used {
    opacity: 0.35;
    pointer-events: none;
}

/* ---- Expense preset grid (krok 4) ---- */
.ex-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.ex-preset {
    position: relative;
    background: var(--color-surface);
    border-radius: 16px;
    padding: 14px;
    border: 1.5px solid transparent;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.15s ease;
    text-align: left;
    color: #fff;
    font-family: inherit;
}
.ex-preset-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}
.ex-preset-name {
    font-weight: 700;
    font-size: 14px;
    color: #fff;
}
.ex-preset.selected {
    border-color: var(--color-brand);
    background: rgba(133, 55, 253, 0.08);
}
.ex-preset-check {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-brand);
    display: none;
    align-items: center;
    justify-content: center;
    color: #fff;
}
.ex-preset.selected .ex-preset-check { display: flex; }

/* ---- Start-option cards (krok 5) ---- */
.start-opt {
    background: var(--color-surface);
    border: 1.5px solid transparent;
    border-radius: 18px;
    padding: 18px;
    cursor: pointer;
    text-align: left;
    color: #fff;
    display: block;
    width: 100%;
    transition: all 0.15s ease;
    font-family: inherit;
}
.start-opt.selected {
    border-color: var(--color-brand);
    background: rgba(133, 55, 253, 0.08);
}
.start-opt-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
}
.start-opt-badge {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.6px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--color-brand);
    color: #fff;
    text-transform: uppercase;
}
.start-opt-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.45;
}

/* ---- Info box (uniwersalny, brand-colored) ---- */
.info-box {
    background: rgba(133, 55, 253, 0.08);
    border: 1px solid rgba(133, 55, 253, 0.22);
    border-radius: 14px;
    padding: 13px 14px;
    display: flex;
    gap: 10px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.45;
    align-items: flex-start;
}
.info-box .lucide {
    flex-shrink: 0;
    color: var(--color-brand);
    margin-top: 1px;
}

/* ---- Pasek akcji (Wstecz / Dalej) na dole kroku ---- */
.onb-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}
.onb-actions .btn-primary  { flex: 1; }
.onb-actions .btn-back {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 14px;
    background: transparent;
    border: 1px solid #2a2a2a;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.onb-actions .btn-back:active {
    background: #181818;
    color: #fff;
}


/* ============================================================
   26. USTAWIENIA (hub + sekcje + listy + wylogowanie)
   ============================================================ */

/* ---- Tytuł sekcji ustawień (uppercase, przygaszony) ---- */
.settings-sec-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.38);
    margin: 24px 4px 10px;
}
.settings-sec-title:first-of-type { margin-top: 8px; }

/* ---- Lista rowów – karta grupująca ---- */
.settings-list {
    background: var(--color-surface);
    border-radius: 16px;
    overflow: hidden;
}

/* ---- Pojedynczy row ---- */
.settings-row {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid #202020;
    color: #fff;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    transition: background 0.15s ease;
}
.settings-row:last-child { border-bottom: 0; }
.settings-row:active    { background: #1e1e1e; }

.settings-row-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.settings-row-label {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
}
.settings-row-sub {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 2px;
}
.settings-row-value {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.55);
    white-space: nowrap;
}
.settings-row-chev {
    color: rgba(255, 255, 255, 0.35);
    flex-shrink: 0;
}

/* Wariant danger (czerwony tytuł) */
.settings-row.danger .settings-row-icon {
    background: rgba(255, 71, 87, 0.12);
    color: var(--color-danger);
}
.settings-row.danger .settings-row-label {
    color: var(--color-danger);
}

/* ---- Karta profilu (u góry ekranu) ---- */
.profile-card {
    background: var(--color-surface);
    border-radius: 18px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    border: 0;
    width: 100%;
    font-family: inherit;
    color: #fff;
    text-align: left;
    transition: background 0.15s ease;
}
.profile-card:active { background: #1e1e1e; }
.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--color-brand);
    color: #fff;
    font-weight: 800;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.profile-name {
    font-size: 17px;
    font-weight: 800;
    color: #fff;
    line-height: 1.15;
}
.profile-email {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 3px;
    line-height: 1.2;
}

/* ---- Duży danger button (wyloguj) ---- */
.logout-btn {
    width: 100%;
    padding: 16px;
    background: rgba(255, 71, 87, 0.08);
    color: var(--color-danger);
    border: 1px solid rgba(255, 71, 87, 0.22);
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    margin-top: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.15s ease;
}
.logout-btn:active {
    background: rgba(255, 71, 87, 0.18);
    transform: scale(0.99);
}

/* Wariant full-danger (dla przycisku "Tak, usuń konto") */
.btn-danger {
    width: 100%;
    padding: 16px;
    background: var(--color-danger);
    color: #fff;
    border: 0;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}
.btn-danger:active { transform: scale(0.98); background: #e53e4d; }
.btn-danger:disabled { opacity: 0.4; pointer-events: none; }

/* ---- Wersja aplikacji (pod logout) ---- */
.app-version {
    text-align: center;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.28);
    margin-top: 18px;
    font-weight: 500;
    letter-spacing: 0.3px;
}


/* ============================================================
   27. DODAJ TRANSAKCJĘ (dodaj-transakcje.php)
   ------------------------------------------------------------
   Struktura ekranu:
     [header: back + "Nowa transakcja"]
     [.dt-segments: Wydatek | Dochód | Oszczędności]
     [.dt-amount: duży display kwoty]
     [.dt-fields: kategoria / data / nazwa]
     [.dt-numpad: siatka 3x4 + backspace]
     [.dt-submit: CTA zapisz]
   Numpad jest przyklejony do dołu ekranu; CTA jest nad nim.
   ============================================================ */

/* ---- Segmenty (przełącznik typu transakcji) ---- */
.dt-segments {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 4px;
    background: #141414;
    border: 1px solid #1f1f1f;
    border-radius: 14px;
    margin: 14px 20px 16px;
}
.dt-segment {
    padding: 11px 6px;
    background: transparent;
    border: 0;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.2px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.dt-segment:active { transform: scale(0.97); }
/* Ikona / SVG w środku przycisku nie mogą łapać klika – inaczej event.target
   bywa <svg> i niektóre przeglądarki komplikują dispatch. */
.dt-segment > * { pointer-events: none; }

/* Tryb wydatek (domyślny) – akcent czerwony */
.dt-segment.active[data-type="wydatek"] {
    background: rgba(255, 71, 87, 0.15);
    color: var(--color-danger);
    box-shadow: inset 0 0 0 1px rgba(255, 71, 87, 0.35);
}
/* Tryb dochód – akcent lime */
.dt-segment.active[data-type="dochod"] {
    background: rgba(175, 253, 55, 0.12);
    color: #AFFD37;
    box-shadow: inset 0 0 0 1px rgba(175, 253, 55, 0.35);
}
/* Tryb oszczędności – akcent brand */
.dt-segment.active[data-type="oszczednosci"] {
    background: rgba(133, 55, 253, 0.16);
    color: var(--color-brand);
    box-shadow: inset 0 0 0 1px rgba(133, 55, 253, 0.4);
}

/* ---- Duży display kwoty ---- */
.dt-amount-wrap {
    text-align: center;
    padding: 14px 20px 18px;
}
.dt-amount-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 8px;
}
.dt-amount {
    font-size: 54px;
    font-weight: 900;
    letter-spacing: -2px;
    line-height: 1;
    color: #fff;
    transition: color 0.2s ease;
}
.dt-amount .dt-grosze {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -1px;
    opacity: 0.55;
    margin-left: 2px;
}
.dt-amount .dt-sign {
    display: inline-block;
    margin-right: 4px;
}
/* Kolor kwoty w zależności od typu */
.dt-root[data-type="wydatek"] .dt-amount { color: var(--color-danger); }
.dt-root[data-type="dochod"] .dt-amount { color: #AFFD37; }
.dt-root[data-type="oszczednosci"] .dt-amount { color: var(--color-brand); }

/* ---- Lista pól (kategoria, data, nazwa) ---- */
.dt-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 20px;
    margin-bottom: 16px;
}
.dt-field {
    background: #141414;
    border: 1px solid #1f1f1f;
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.dt-field:active { background: #1a1a1a; }
.dt-field-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
}
/* Kolorowa wersja ikony kategorii – nadpisywana przez inline style */
.dt-field-icon.is-cat {
    background: rgba(255, 255, 255, 0.06);
}
.dt-field-text { flex: 1; min-width: 0; }
.dt-field-label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}
.dt-field-value {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dt-field-value.is-placeholder {
    color: rgba(255, 255, 255, 0.35);
    font-weight: 500;
}
.dt-field-chev {
    color: rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

/* Wariant "input tekstowy" zamiast klikalnego rowa */
.dt-field-input {
    flex: 1;
    background: transparent;
    border: 0;
    outline: none;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    min-width: 0;
}
.dt-field-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-weight: 500;
}

/* ---- CTA zapisz ---- */
.dt-submit {
    margin: 0 20px 14px;
    padding: 16px;
    width: calc(100% - 40px);
    background: var(--color-brand);
    color: #fff;
    border: 0;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.3px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.dt-submit:active { transform: scale(0.99); background: var(--color-brand-strong); }
.dt-submit:disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ---- Numpad (Revolut-like) ---- */
.dt-numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 8px 14px calc(14px + env(safe-area-inset-bottom, 0px));
    background: #0a0a0a;
    border-top: 1px solid #1a1a1a;
}
.dt-key {
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 26px;
    font-weight: 700;
    padding: 14px 0;
    cursor: pointer;
    font-family: inherit;
    border-radius: 12px;
    transition: background 0.1s ease, transform 0.08s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.dt-key:active {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(0.97);
}
.dt-key.is-back {
    color: rgba(255, 255, 255, 0.7);
}

/* ---- Drzewo kategorii w bottomsheecie ---- */
.dt-cat-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 58vh;
    overflow-y: auto;
    padding-right: 2px;
}
.dt-cat-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #141414;
    border: 1px solid #1f1f1f;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.dt-cat-row:active { background: #1a1a1a; }
.dt-cat-row.is-selected {
    border-color: rgba(133, 55, 253, 0.5);
    background: rgba(133, 55, 253, 0.08);
}
.dt-cat-row-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}
.dt-cat-row-text { flex: 1; min-width: 0; }
.dt-cat-row-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}
.dt-cat-row-sub {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 2px;
}
.dt-cat-row-expand {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 0;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    transition: all 0.15s ease;
    flex-shrink: 0;
}
.dt-cat-row-expand:active { transform: scale(0.94); }
.dt-cat-row-expand.is-open {
    background: rgba(133, 55, 253, 0.15);
    color: var(--color-brand);
    transform: rotate(180deg);
}

/* Subkategorie – wysuwane pod kategorią */
.dt-sub-list {
    display: none;
    flex-direction: column;
    gap: 3px;
    padding: 4px 0 4px 48px;
    margin-bottom: 4px;
}
.dt-sub-list.is-open { display: flex; }
.dt-sub-row {
    padding: 10px 14px;
    background: #121212;
    border: 1px solid #1c1c1c;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    transition: background 0.15s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}
.dt-sub-row:active { background: #181818; }
.dt-sub-row.is-selected {
    border-color: rgba(133, 55, 253, 0.5);
    background: rgba(133, 55, 253, 0.08);
    color: #fff;
}
.dt-sub-row-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}
.dt-sub-row.is-selected .dt-sub-row-dot {
    background: var(--color-brand);
}

/* ---- Preview wybranej kategorii w .dt-field ----
   Gdy kategoria/subkategoria jest wybrana, ukrywamy małą etykietę
   "Kategoria" (klasa .has-value na .dt-field). Dzięki temu:
     • ikona centruje się w pionie do dwóch linii nazwy, a nie trzech,
     • obie linie są wyrównane do tej samej lewej krawędzi. */
.dt-field.has-value .dt-field-label { display: none; }

.dt-cat-preview {
    display: block;
    min-width: 0;
    text-align: left;
}
.dt-cat-preview-main {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dt-cat-preview-sub {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 3px;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- Date picker native (ukrycie brzydkich domyślnych ikon) ---- */
.dt-date-input {
    background: #141414;
    border: 1px solid #1f1f1f;
    border-radius: 12px;
    padding: 14px 16px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    width: 100%;
    outline: none;
    color-scheme: dark;
}
.dt-date-input:focus { border-color: rgba(133, 55, 253, 0.5); }
.dt-date-quick {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 10px;
}
.dt-date-quick-btn {
    padding: 10px 6px;
    background: #141414;
    border: 1px solid #1f1f1f;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
}
.dt-date-quick-btn:active { transform: scale(0.97); }
.dt-date-quick-btn.is-active {
    background: rgba(133, 55, 253, 0.15);
    color: var(--color-brand);
    border-color: rgba(133, 55, 253, 0.4);
}


/* ============================================================
   28. SZCZEGÓŁ KATEGORII (kategoria.php)
   ------------------------------------------------------------
   Struktura:
     [header back + ikona kat]
     [.kat-hero – ikona + nazwa + suma miesiąca + średnia]
     [.kat-chart – sparkline 12mc, dots klikalne]
     [.kat-trans – header wybranego miesiąca + lista]
   ============================================================ */

.kat-hero {
    margin: 14px 20px 16px;
    padding: 20px;
    border-radius: 20px;
    background: #141414;
    border: 1px solid #1f1f1f;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
}
/* Dekoracyjne kółko w tle w kolorze kategorii */
.kat-hero::before {
    content: '';
    position: absolute;
    right: -40px;
    top: -40px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: var(--kat-color, #8537FD);
    opacity: 0.08;
    pointer-events: none;
}
.kat-hero-icon {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    position: relative;
    z-index: 1;
}
.kat-hero-text { flex: 1; min-width: 0; position: relative; z-index: 1; }
.kat-hero-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 2px;
}
.kat-hero-name {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: #fff;
    line-height: 1.1;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kat-hero-sum {
    font-size: 24px;
    font-weight: 900;
    letter-spacing: -0.5px;
    color: #fff;
    line-height: 1;
}
/* Kolor wielkiej sumy w hero dopasowany do typu kategorii */
.kat-hero[data-zach="wydatek"]      .kat-hero-sum { color: var(--color-danger); }
.kat-hero[data-zach="dochod"]       .kat-hero-sum { color: var(--color-lime);   }
.kat-hero[data-zach="oszczednosci"] .kat-hero-sum { color: var(--color-brand);  }
.kat-hero-sum-grosze {
    font-size: 16px;
    font-weight: 700;
    opacity: 0.55;
    margin-left: 2px;
}
.kat-hero-avg {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 5px;
}
.kat-hero-avg b {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 700;
}

/* ---- Sparkline chart ---- */
.kat-chart {
    margin: 0 20px 16px;
    padding: 18px 16px 12px;
    background: #141414;
    border: 1px solid #1f1f1f;
    border-radius: 20px;
}
.kat-chart-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 14px;
    padding: 0 4px;
}
.kat-chart-title {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.1px;
}
.kat-chart-legend {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
}
.kat-chart-svg {
    width: 100%;
    height: 110px;
    display: block;
    overflow: visible;
}
/* Line path + obszar pod linią */
.kat-chart-area  { fill: var(--kat-color, #8537FD); opacity: 0.1; }
.kat-chart-line  {
    fill: none;
    stroke: var(--kat-color, #8537FD);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.kat-chart-dot {
    fill: #141414;
    stroke: var(--kat-color, #8537FD);
    stroke-width: 2;
    cursor: pointer;
    transition: r 0.15s ease;
}
.kat-chart-dot.is-active {
    fill: var(--kat-color, #8537FD);
    stroke: #fff;
    stroke-width: 2;
    r: 5.5;
}
.kat-chart-hit {
    fill: transparent;
    cursor: pointer;
}
/* Pionowa linia wskazania wybranego miesiąca */
.kat-chart-guide {
    stroke: rgba(255, 255, 255, 0.18);
    stroke-width: 1;
    stroke-dasharray: 2 3;
    pointer-events: none;
}
/* Etykiety miesięcy pod wykresem */
.kat-chart-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    padding: 0 2px;
}
.kat-chart-label {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    flex: 1;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    cursor: pointer;
    padding: 3px 0;
    transition: color 0.15s ease;
}
.kat-chart-label.is-active {
    color: var(--kat-color, #8537FD);
    font-weight: 800;
}

/* ---- Lista transakcji ---- */
.kat-trans {
    margin: 0 20px;
}
.kat-trans-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 4px 4px 10px;
}
.kat-trans-head-title {
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.2px;
}
.kat-trans-head-meta {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.45);
}
.kat-day-group { margin-bottom: 14px; }
.kat-day-group:last-child { margin-bottom: 4px; }
.kat-day-label {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 0 6px 6px;
}
.kat-trans-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #141414;
    border: 1px solid #1f1f1f;
    border-radius: 14px;
    margin-bottom: 6px;
    /* Reset dla <button>, bo wiersze są klikalne i otwierają edycję tx. */
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
}
.kat-trans-row:last-child { margin-bottom: 0; }
.kat-trans-row:active { background: #181818; }
.kat-trans-row-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}
.kat-trans-row-text { flex: 1; min-width: 0; }
.kat-trans-row-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kat-trans-row-sub {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 2px;
}
.kat-trans-row-amount {
    font-size: 14px;
    font-weight: 800;
    color: var(--color-danger);
    flex-shrink: 0;
    letter-spacing: -0.2px;
}
.kat-trans-row-amount.is-income { color: #AFFD37; }

/* Empty state dla miesiąca bez transakcji */
.kat-trans-empty {
    padding: 40px 20px;
    text-align: center;
    background: #141414;
    border: 1px dashed #2a2a2a;
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.4);
}
.kat-trans-empty-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    color: rgba(255, 255, 255, 0.3);
}
.kat-trans-empty-title {
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 4px;
}
.kat-trans-empty-sub {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.35);
}


/* ============================================================
   29. PRZEGLĄD KATEGORII (kategorie-pelna.php)
   ------------------------------------------------------------
   Struktura:
     [header back + nawigator miesiąca]
     [.kp-summary – kwota miesiąca + liczba transakcji]
     [.kp-segments – Wydatki | Dochody | Oszczędności]
     [.kp-list – kategorie sortowane malejąco po kwocie]
   ============================================================ */

/* ---- Nawigator miesiąca w headerze ---- */
.kp-month-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 4px;
}
.kp-month-btn {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 0;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    transition: background 0.15s ease;
}
.kp-month-btn:active { background: rgba(255, 255, 255, 0.12); transform: scale(0.94); }
.kp-month-btn:disabled { opacity: 0.3; pointer-events: none; }
.kp-month-label {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.2px;
    min-width: 135px;
    text-align: center;
}

/* ---- Karta podsumowania ----
   Gradient tła + kolor wielkiej kwoty dopasowują się do typu
   (wydatki = czerwień, dochody = limonka, oszczędności = brand). */
.kp-summary {
    margin: 14px 20px 14px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(133, 55, 253, 0.22) 0%, rgba(232, 55, 253, 0.12) 100%);
    border: 1px solid rgba(133, 55, 253, 0.35);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
}
.kp-summary[data-typ="wydatki"] {
    background: linear-gradient(135deg, rgba(255, 71, 87, 0.22) 0%, rgba(255, 71, 87, 0.08) 100%);
    border-color: rgba(255, 71, 87, 0.35);
}
.kp-summary[data-typ="dochody"] {
    background: linear-gradient(135deg, rgba(175, 253, 55, 0.20) 0%, rgba(175, 253, 55, 0.06) 100%);
    border-color: rgba(175, 253, 55, 0.35);
}
.kp-summary[data-typ="oszczednosci"] {
    background: linear-gradient(135deg, rgba(133, 55, 253, 0.22) 0%, rgba(232, 55, 253, 0.12) 100%);
    border-color: rgba(133, 55, 253, 0.35);
}
.kp-summary::before {
    content: '';
    position: absolute;
    right: -60px;
    top: -60px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    pointer-events: none;
}
.kp-summary-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}
.kp-summary-value {
    font-size: 34px;
    font-weight: 900;
    letter-spacing: -1px;
    color: #fff;
    line-height: 1;
    position: relative;
    z-index: 1;
}
.kp-summary[data-typ="wydatki"]      .kp-summary-value { color: var(--color-danger); }
.kp-summary[data-typ="dochody"]      .kp-summary-value { color: var(--color-lime);   }
.kp-summary[data-typ="oszczednosci"] .kp-summary-value { color: var(--color-brand);  }
.kp-summary-value-grosze {
    font-size: 20px;
    font-weight: 700;
    opacity: 0.6;
    margin-left: 2px;
}
.kp-summary-meta {
    display: flex;
    gap: 16px;
    margin-top: 14px;
    position: relative;
    z-index: 1;
}
.kp-summary-meta-item {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
}
.kp-summary-meta-item b {
    display: block;
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 2px;
    letter-spacing: -0.2px;
}

/* ---- Segmenty (filtr typu) ---- */
.kp-segments {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 4px;
    background: #141414;
    border: 1px solid #1f1f1f;
    border-radius: 14px;
    margin: 0 20px 14px;
}
.kp-segment {
    padding: 10px 6px;
    background: transparent;
    border: 0;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.2px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.kp-segment:active { transform: scale(0.97); }
.kp-segment.is-active {
    background: rgba(133, 55, 253, 0.15);
    color: var(--color-brand);
    box-shadow: inset 0 0 0 1px rgba(133, 55, 253, 0.4);
}

/* ---- Lista kategorii z progress bar ---- */
.kp-list {
    margin: 0 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.kp-sec-title {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 14px 4px 4px;
}
.kp-sec-title:first-child { margin-top: 4px; }

.kp-cat-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    background: #141414;
    border: 1px solid #1f1f1f;
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.15s ease;
    text-decoration: none;
    color: inherit;
}
.kp-cat-row:active { background: #181818; }
.kp-cat-row-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}
.kp-cat-row-body { flex: 1; min-width: 0; }
.kp-cat-row-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}
.kp-cat-row-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
}
.kp-cat-row-amount {
    font-size: 14px;
    font-weight: 800;
    color: var(--color-danger);           /* wydatki – czerwony (default) */
    letter-spacing: -0.2px;
    flex-shrink: 0;
}
/* Kolorowanie kwot per typ widoku – cascada z data-typ na .kp-list */
.kp-list[data-typ="wydatki"]      .kp-cat-row-amount { color: var(--color-danger); }
.kp-list[data-typ="dochody"]      .kp-cat-row-amount { color: var(--color-lime);   }
.kp-list[data-typ="oszczednosci"] .kp-cat-row-amount { color: var(--color-brand);  }
/* Progress bar – kolor dziedziczony z --kat-color */
.kp-cat-bar {
    width: 100%;
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}
.kp-cat-bar-fill {
    height: 100%;
    background: var(--kat-color, #8537FD);
    border-radius: 3px;
    transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.kp-cat-row-meta {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 5px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}
.kp-cat-row-meta b {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 700;
}

/* Empty state – brak kategorii */
.kp-empty {
    margin: 40px 20px;
    padding: 30px 20px;
    text-align: center;
    background: #141414;
    border: 1px dashed #2a2a2a;
    border-radius: 16px;
}
.kp-empty-title {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 4px;
}
.kp-empty-sub {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}


/* ============================================================
   30. HISTORIA TRANSAKCJI (historia.php)
   ------------------------------------------------------------
   Struktura:
     [header back + "Historia"]
     [.hist-search – wyszukiwarka]
     [.hist-chips – zakres dat]
     [.hist-segments – typ transakcji]
     [.hist-summary – wydatki/dochody/liczba]
     [.hist-list – grupy dni + transakcje]
     [.hist-load-more / .hist-no-more]
   Reużywa .kat-trans-row, .kat-day-group z sekcji 28.
   ============================================================ */

/* ---- Wyszukiwarka ---- */
.hist-search {
    margin: 12px 20px 10px;
    position: relative;
}
.hist-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.35);
    pointer-events: none;
}
.hist-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 0;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}
.hist-search-clear.is-visible { display: flex; }
.hist-search-input {
    width: 100%;
    padding: 13px 40px 13px 42px;
    background: #141414;
    border: 1px solid #1f1f1f;
    border-radius: 14px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s ease;
}
.hist-search-input:focus { border-color: rgba(133, 55, 253, 0.5); }
.hist-search-input::placeholder { color: rgba(255, 255, 255, 0.35); }

/* ---- Chipy zakresu dat (horizontal scroll) ---- */
.hist-chips {
    display: flex;
    gap: 8px;
    padding: 2px 20px 10px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.hist-chips::-webkit-scrollbar { display: none; }
.hist-chip {
    flex-shrink: 0;
    padding: 8px 14px;
    background: #141414;
    border: 1px solid #1f1f1f;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
}
.hist-chip:active { transform: scale(0.96); }
.hist-chip.is-active {
    background: rgba(133, 55, 253, 0.15);
    color: var(--color-brand);
    border-color: rgba(133, 55, 253, 0.4);
}

/* ---- Segmenty typu (reużywamy wzoru z dt-segments) ---- */
.hist-segments {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 3px;
    background: #141414;
    border: 1px solid #1f1f1f;
    border-radius: 14px;
    margin: 0 20px 12px;
}
.hist-segment {
    padding: 9px 4px;
    background: transparent;
    border: 0;
    border-radius: 9px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.1px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hist-segment:active { transform: scale(0.96); }
.hist-segment.is-active[data-type="all"] {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}
.hist-segment.is-active[data-type="wydatek"] {
    background: rgba(255, 71, 87, 0.14);
    color: var(--color-danger);
    box-shadow: inset 0 0 0 1px rgba(255, 71, 87, 0.32);
}
.hist-segment.is-active[data-type="dochod"] {
    background: rgba(175, 253, 55, 0.12);
    color: #AFFD37;
    box-shadow: inset 0 0 0 1px rgba(175, 253, 55, 0.32);
}
.hist-segment.is-active[data-type="oszczednosci"] {
    background: rgba(133, 55, 253, 0.14);
    color: var(--color-brand);
    box-shadow: inset 0 0 0 1px rgba(133, 55, 253, 0.38);
}

/* ---- Karta summary ---- */
.hist-summary {
    margin: 0 20px 14px;
    padding: 16px 18px;
    background: #141414;
    border: 1px solid #1f1f1f;
    border-radius: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 14px;
    align-items: stretch;
}
.hist-summary-col { min-width: 0; }
.hist-summary-col.is-sep {
    width: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0 4px;
}
.hist-summary-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 4px;
}
.hist-summary-value {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.3px;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hist-summary-value.is-out { color: var(--color-danger); }
.hist-summary-value.is-in  { color: #AFFD37; }
.hist-summary-count {
    text-align: center;
    padding-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 54px;
}
.hist-summary-count-num {
    font-size: 22px;
    font-weight: 900;
    color: #fff;
    line-height: 1;
    letter-spacing: -0.5px;
}
.hist-summary-count-lbl {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 4px;
    letter-spacing: 0.3px;
}

/* ---- Lista (reużywa .kat-day-group / .kat-trans-row) ---- */
.hist-list { margin: 0 20px; }

/* Wiersz historii – jak .kat-trans-row, ale dodatkowo pokazuje
   nazwę kategorii pod nazwą transakcji (bo tutaj mieszamy
   kategorie z różnych miejsc). */
.hist-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #141414;
    border: 1px solid #1f1f1f;
    border-radius: 14px;
    margin-bottom: 6px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background 0.15s ease;
}
.hist-row:active { background: #181818; }
.hist-row-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}
.hist-row-text { flex: 1; min-width: 0; }
.hist-row-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hist-row-cat {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hist-row-cat-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 5px;
    margin-bottom: 2px;
}
.hist-row-amount {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.2px;
    flex-shrink: 0;
    color: var(--color-danger);
}
.hist-row-amount.is-income { color: #AFFD37; }

/* ---- Loader / sentinel ---- */
.hist-sentinel {
    padding: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    font-weight: 500;
}
.hist-sentinel.is-done {
    padding: 14px 20px 30px;
    color: rgba(255, 255, 255, 0.25);
    font-size: 11px;
}
.hist-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--color-brand);
    border-radius: 50%;
    animation: histSpin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}
@keyframes histSpin {
    to { transform: rotate(360deg); }
}

/* Empty state */
.hist-empty {
    margin: 40px 20px;
    padding: 36px 20px;
    text-align: center;
    background: #141414;
    border: 1px dashed #2a2a2a;
    border-radius: 16px;
}
.hist-empty-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    color: rgba(255, 255, 255, 0.3);
}
.hist-empty-title {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 4px;
}
.hist-empty-sub {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}

