@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

body { 
    background-color: #F8FAFC; 
    color: #0F172A; 
    -webkit-tap-highlight-color: transparent; 
    padding-bottom: 120px; 
    overflow-x: hidden; 
    position: relative;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Abstrakcyjne tło (Blobs) */
.bg-blobs { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -1; overflow: hidden; pointer-events: none; }
.blob-1 { position: absolute; top: -10%; left: -10%; width: 50vw; height: 50vw; background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, rgba(255,255,255,0) 70%); border-radius: 50%; filter: blur(40px); }
.blob-2 { position: absolute; bottom: -10%; right: -10%; width: 60vw; height: 60vw; background: radial-gradient(circle, rgba(168,85,247,0.15) 0%, rgba(255,255,255,0) 70%); border-radius: 50%; filter: blur(40px); }

/* Karty Glassmorphism */
.glass-card { 
    background: rgba(255, 255, 255, 0.65); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.8); border-radius: 24px; box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.05); 
    transition: background-color 0.4s ease, border-color 0.4s ease;
}

/* Nowoczesne inputy */
.neo-input {
    background: rgba(255, 255, 255, 0.8); border: 1px solid rgba(226, 232, 240, 0.8); border-radius: 16px;
    padding: 0.875rem 1rem; font-size: 1rem; font-weight: 500; color: #1E293B; width: 100%; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: inset 0 2px 4px rgba(0,0,0,0.01); appearance: none; -webkit-appearance: none;
}
.neo-input:focus { background: #FFFFFF; outline: none; border-color: #6366f1; box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1); }
select.neo-input {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 1rem center; background-size: 1em; padding-right: 2.5rem !important;
}

.tnum { font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }

.fade-in { animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

/* Loader OCR i globalny */
#loader { display: flex; position: fixed; inset: 0; background: rgba(248, 250, 252, 0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); z-index: 9999; flex-direction: column; justify-content: center; align-items: center; transition: opacity 0.3s, background-color 0.4s ease; opacity: 0; pointer-events: none; }
#loader.show { opacity: 1; pointer-events: auto; }
.spinner { width: 50px; height: 50px; border: 4px solid rgba(99, 102, 241, 0.2); border-top-color: #6366f1; border-radius: 50%; animation: spin 1s cubic-bezier(0.5, 0.1, 0.1, 0.9) infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.scan-line { width: 120px; height: 3px; background: linear-gradient(90deg, transparent, #a855f7, transparent); animation: scan 1.5s ease-in-out infinite; box-shadow: 0 0 15px #a855f7; margin-top: 20px; border-radius: 100%; }
@keyframes scan { 0% { transform: translateY(-30px); opacity: 0;} 50% { opacity: 1; } 100% { transform: translateY(30px); opacity: 0;} }

/* Pływająca nawigacja */
.pill-nav { background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); border: 1px solid rgba(255, 255, 255, 0.5); box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1); transition: background-color 0.4s ease, border-color 0.4s ease; }
.nav-btn { position: relative; padding: 0.75rem; color: #94a3b8; transition: all 0.3s; border-radius: 16px; }
.nav-btn.active { color: #6366f1; }
.nav-btn.active::after { content: ''; position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; background: #6366f1; }

/* Segmented Control */
.neo-segment { background: rgba(241, 245, 249, 0.8); border-radius: 14px; padding: 4px; display: flex; position: relative; transition: background-color 0.4s ease; }
.neo-segment-btn { flex: 1; text-align: center; padding: 10px 0; font-size: 14px; font-weight: 700; color: #64748b; border-radius: 10px; transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1); cursor: pointer; border: none; background: transparent; position: relative; z-index: 10; }
.neo-segment-btn.active { color: #0F172A; }
.segment-glider { position: absolute; top: 4px; bottom: 4px; width: calc(33.333% - 4px); background: #FFFFFF; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1); z-index: 1; }

.neo-segment-sm { background: rgba(226, 232, 240, 0.5); border-radius: 10px; padding: 3px; display: flex; position: relative; width: 100%; max-width: 300px; margin: 0 auto; transition: background-color 0.4s ease; }
.neo-segment-sm-btn { flex: 1; text-align: center; padding: 6px 0; font-size: 12px; font-weight: 700; color: #64748b; border-radius: 8px; transition: 0.3s; cursor: pointer; border: none; background: transparent; position: relative; z-index: 10; }
.neo-segment-sm-btn.active { color: #0F172A; }
.segment-glider-sm { position: absolute; top: 3px; bottom: 3px; width: calc(50% - 3px); background: #FFFFFF; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1); z-index: 1; }

/* Nakładki i Modale */
#overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4); backdrop-filter: blur(4px); z-index: 40; opacity: 0; pointer-events: none; transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
#overlay.show { opacity: 1; pointer-events: auto; }

.bottom-sheet { position: fixed; left: 0; right: 0; bottom: 0; margin: 0 auto; width: 100%; max-width: 550px; background: #FFFFFF; z-index: 50; border-radius: 32px 32px 0 0; padding: 1.5rem; box-shadow: 0 -20px 40px rgba(0,0,0,0.1); transform: translateY(100%); transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.4s ease; max-height: 90vh; overflow-y: auto; }
.bottom-sheet.show { transform: translateY(0); }

.center-modal { position: fixed; bottom: 6rem; right: 1rem; left: 1rem; background: #FFFFFF; border-radius: 32px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15); z-index: 60; padding: 1.5rem; transform: scale(0.9) translateY(20px); opacity: 0; pointer-events: none; transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.4s ease; max-height: 80vh; overflow-y: auto; }
@media (min-width: 640px) { .center-modal { left: 50%; transform: translateX(-50%) scale(0.9) translateY(20px); width: 420px; } }
.center-modal.show { transform: scale(1) translateY(0); opacity: 1; pointer-events: auto; }
@media (min-width: 640px) { .center-modal.show { transform: translateX(-50%) scale(1) translateY(0); } }

/* OCR WIZARD SPECIFIC */
#ocrWizardModal { z-index: 70; } 

/* Gesty swipe */
.swipe-container { position: relative; overflow: hidden; border-radius: 20px; margin-bottom: 12px; background: #FFFFFF; border: 1px solid rgba(226, 232, 240, 0.5); transition: background-color 0.4s ease, border-color 0.4s ease; }
.swipe-actions { position: absolute; top: 0; bottom: 0; width: 100%; display: flex; justify-content: space-between; align-items: center; z-index: 0; }
.swipe-content { position: relative; background: #FFFFFF; z-index: 1; transition: transform 0.2s ease-out, background-color 0.4s ease, border-color 0.4s ease; width: 100%; border-radius: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.02); }

.toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: 2000; background: #1E293B; color: white; padding: 14px 28px; border-radius: 100px; font-size: 0.9rem; font-weight: 600; box-shadow: 0 20px 40px rgba(0,0,0,0.2); pointer-events: none; display: flex; align-items: center; gap: 8px; transition: background-color 0.4s ease, color 0.4s ease; }

.cat-icon-container { width: 48px; height: 48px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; transition: transform 0.2s; }
.swipe-container:hover .cat-icon-container { transform: scale(1.05); }

.custom-scrollbar::-webkit-scrollbar { width: 4px; height: 4px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 10px; transition: background-color 0.4s ease; }

/* Checkboxy premium */
.neo-checkbox { display: none; }
.neo-checkbox-label { padding: 8px 16px; border-radius: 100px; font-size: 0.85rem; font-weight: 700; cursor: pointer; transition: 0.2s; background: rgba(255,255,255,0.5); color: #64748b; border: 1px solid #E2E8F0; }
.neo-checkbox:checked + .neo-checkbox-label.c-inc { background: #ECFDF5; color: #10B981; border-color: #A7F3D0; }
.neo-checkbox:checked + .neo-checkbox-label.c-exp { background: #FEF2F2; color: #EF4444; border-color: #FECACA; }
.neo-checkbox:checked + .neo-checkbox-label.c-tax { background: #FFFBEB; color: #F59E0B; border-color: #FDE68A; }

/* Wybór ikon i kolorów */
.color-picker-btn { width: 36px; height: 36px; border-radius: 50%; cursor: pointer; transition: 0.2s; border: 2px solid transparent; }
.color-picker-btn.active { transform: scale(1.1); border-color: #1E293B; box-shadow: 0 0 0 2px white, 0 0 0 4px #1E293B; }
.icon-picker-btn { width: 44px; height: 44px; border-radius: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; transition: 0.2s; background: #F1F5F9; color: #64748b; border: 2px solid transparent;}
.icon-picker-btn.active { background: #EEF2FF; color: #6366f1; border-color: #6366f1; transform: scale(1.05); }

/* ==========================================
   DARK MODE (TRYB CIEMNY)
========================================== */
html.dark body { background-color: #0F172A; color: #F8FAFC; }
html.dark .glass-card { background: rgba(30, 41, 59, 0.65); border-color: rgba(255, 255, 255, 0.05); }

/* Wyciszenie rozbłysków (blobs) w trybie ciemnym */
html.dark .blob-1 { background: radial-gradient(circle, rgba(99,102,241,0.05) 0%, rgba(255,255,255,0) 70%); }
html.dark .blob-2 { background: radial-gradient(circle, rgba(168,85,247,0.05) 0%, rgba(255,255,255,0) 70%); }

/* Pasek nawigacyjny (Header) miękko wtapiający się w tło */
html.dark header.glass-card { background-color: rgba(15, 23, 42, 0.6) !important; border-bottom: 1px solid rgba(255,255,255,0.05) !important; }

html.dark .neo-input { background: rgba(15, 23, 42, 0.5); border-color: #334155; color: #F8FAFC; }
html.dark .neo-input:focus { background: rgba(15, 23, 42, 0.9); }
html.dark .bottom-sheet, html.dark .center-modal { background: #1E293B; box-shadow: 0 -20px 40px rgba(0,0,0,0.5); }
html.dark .swipe-content, html.dark .swipe-container { background: #1E293B; border-color: #334155; }
html.dark .pill-nav { background: rgba(30, 41, 59, 0.85); border-color: rgba(255, 255, 255, 0.1); }
html.dark .neo-segment, html.dark .neo-segment-sm { background: rgba(15, 23, 42, 0.6); }
html.dark .segment-glider, html.dark .segment-glider-sm { background: #334155; }
html.dark .neo-segment-btn, html.dark .neo-segment-sm-btn { color: #94A3B8; }
html.dark .neo-segment-btn.active, html.dark .neo-segment-sm-btn.active { color: #F8FAFC; }
html.dark .toast { background: #334155; color: #F8FAFC; border: 1px solid #475569; }
html.dark .custom-scrollbar::-webkit-scrollbar-thumb { background: #475569; }

/* Poprawka placeholderów w trybie ciemnym */
html.dark .neo-input::placeholder, html.dark input::placeholder { color: #64748B !important; }

/* Wymuszanie nadpisań dla klas użytkowych (Tailwind) generowanych na sztywno z poziomu JavaScript */
html.dark .bg-white { background-color: #1E293B !important; }
html.dark .bg-slate-50 { background-color: #0F172A !important; }
html.dark .bg-slate-100 { background-color: #334155 !important; }

/* FIX: Nadpisanie wymuszonych teł dla pola kwoty (!bg-white/80 i !bg-slate-50) */
html.dark .\!bg-white\/80 { background-color: #1E293B !important; }
html.dark .\!bg-slate-50 { background-color: #0F172A !important; }

html.dark .text-slate-800 { color: #F8FAFC !important; }
html.dark .text-slate-700 { color: #E2E8F0 !important; }
html.dark .text-slate-600 { color: #CBD5E1 !important; }
html.dark .border-slate-100 { border-color: #334155 !important; }
html.dark .border-slate-200 { border-color: #475569 !important; }
html.dark #loader { background: rgba(15, 23, 42, 0.85); }

/* POPRAWKI CZYTELNOŚCI IKON I PLAKIETEK W TRYBIE CIEMNYM (Miękkie, półprzezroczyste pastele) */
html.dark .bg-amber-50, html.dark .bg-amber-100, html.dark .bg-amber-200 { background-color: rgba(245, 158, 11, 0.15) !important; color: #FCD34D !important; border-color: rgba(245, 158, 11, 0.3) !important; }
html.dark .text-amber-500, html.dark .text-amber-600, html.dark .text-amber-700, html.dark .text-amber-800 { color: #FCD34D !important; }

html.dark .bg-emerald-50, html.dark .bg-emerald-100, html.dark .bg-emerald-200 { background-color: rgba(16, 185, 129, 0.15) !important; color: #6EE7B7 !important; border-color: rgba(16, 185, 129, 0.3) !important; }
html.dark .text-emerald-500, html.dark .text-emerald-600, html.dark .text-emerald-700, html.dark .text-emerald-800 { color: #6EE7B7 !important; }

html.dark .bg-rose-50, html.dark .bg-rose-100, html.dark .bg-rose-200 { background-color: rgba(244, 63, 94, 0.15) !important; color: #FDA4AF !important; border-color: rgba(244, 63, 94, 0.3) !important; }
html.dark .text-rose-500, html.dark .text-rose-600, html.dark .text-rose-700, html.dark .text-rose-800 { color: #FDA4AF !important; }

html.dark .bg-blue-50, html.dark .bg-blue-100, html.dark .bg-blue-200 { background-color: rgba(59, 130, 246, 0.15) !important; color: #93C5FD !important; border-color: rgba(59, 130, 246, 0.3) !important; }
html.dark .text-blue-500, html.dark .text-blue-600, html.dark .text-blue-700, html.dark .text-blue-800 { color: #93C5FD !important; }

html.dark .bg-indigo-50, html.dark .bg-indigo-100, html.dark .bg-indigo-200 { background-color: rgba(99, 102, 241, 0.15) !important; color: #A5B4FC !important; border-color: rgba(99, 102, 241, 0.3) !important; }
html.dark .text-primary, html.dark .text-indigo-500, html.dark .text-indigo-600, html.dark .text-indigo-700, html.dark .text-indigo-800 { color: #A5B4FC !important; }