/* styles.css - custom styles (loaded directly, Tailwind is in tailwind.min.css) */
/* --- Ogólne Style Podstawowe --- */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: #f3f4f6;
    color: #111827;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 14px;
    line-height: 1.5;
}

/* Efekt szkła dla dropdowna wyników */
#global-search-results {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Animacja pojawiania się */
#global-search-results:not(.hidden) {
    animation: fadeInDropdown 0.2s ease-out;
}

@keyframes fadeInDropdown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Nav links */
.nav-link {
    color: #6b7280;
    font-weight: 500;
    border-radius: 8px;
    transition: color 0.15s ease, background-color 0.15s ease;
    position: relative;
}
.nav-link:hover {
    color: #111827;
    background-color: #f3f4f6 !important;
}
.nav-link.active {
    background-color: #eef2ff !important;
    color: #4338ca;
    font-weight: 600;
}   





/* Styl dla komórki w ukrytym wierszu - usuwa domyślne obramowania */
.report-details-row td {
    padding: 0;
    border: none;
}

/* Podświetlenie aktywnego (rozwiniętego) wiersza głównego w tabeli raportów */
#reports-tbody tr.bg-slate-100 {
    background-color: #f1f5f9; /* Tailwind slate-100 */
}

/* Styl dla obracającej się ikony "chevron" w tabeli raportów */
#reports-tbody i[data-lucide="chevron-down"] {
    transition: transform 0.3s ease-in-out;
}

#reports-tbody i[data-lucide="chevron-down"].expanded {
    transform: rotate(180deg);
}
/* W pliku styles.css (dodaj na końcu) */

/* --- Style dla rozwijanych wierszy umów --- */

/* Styl dla komórki w ukrytym wierszu - usuwa domyślne obramowania */
.contract-details-row td {
    padding: 0;
    border: none;
}

/* Podświetlenie aktywnego (rozwiniętego) wiersza głównego */
#contracts-tbody tr.bg-slate-100 {
    background-color: #f1f5f9; /* Tailwind slate-100 */
}

/* Styl dla obracającej się ikony "chevron" */
#contracts-tbody i[data-lucide="chevron-down"] {
    transition: transform 0.3s ease-in-out;
}

#contracts-tbody i[data-lucide="chevron-down"].expanded {
    transform: rotate(180deg);
}

/* Zatrzymanie propagacji zdarzeń dla przycisków wewnątrz panelu */
/* To jest robione w JS przez `event.stopPropagation()`, ale można też dodać regułę, jeśli coś by nie działało */
.contract-details-row button {
    cursor: pointer;
}





/* Style dla przycisków zakładek w widoku szczegółów klienta */
.client-detail-tab-button {
    /* Dziedziczą style z Tailwind, ew. dodaj własne */
    transition: border-color 0.2s ease-in-out, color 0.2s ease-in-out;
}
/* Nie trzeba definiować klas aktywnych/nieaktywnych, bo są zarządzane przez Tailwind w JS */

/* Style dla paneli zakładek w widoku szczegółów klienta */
.client-detail-tab-panel {
    /* Domyślnie widoczne (klasa hidden jest dodawana/usuwana przez JS) */
    /* Możesz dodać np. animację pojawiania się */
    animation: fadeIn 0.3s ease-in-out;
}



.view {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out; /* Dodajemy transform */
    transform: translateY(10px); /* Początkowe przesunięcie w dół */
}

.view.active {
    display: block;
    opacity: 1;
    transform: translateY(0); /* Powrót do pozycji początkowej */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}




/* Opcjonalna animacja dla paneli */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Upewnij się, że kontener główny paneli ma odpowiednie tło i padding,
   co zrobiliśmy w HTML przez dodanie bg-white, shadow, rounded-lg, p-6 */

/* === Toasty === */
.toast {
    background: #fff;
    border: 1px solid rgba(0,0,0,.07);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,.13), 0 1px 4px rgba(0,0,0,.06);
    color: #111827;
    padding: 12px 14px 0;
    opacity: 0;
    transform: translateY(12px) scale(0.97);
    transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.34,1.56,0.64,1),
                background-color 0.25s ease, border-color 0.2s ease, color 0.2s ease;
    max-width: 360px;
    min-width: 260px;
    font-size: 0.8125rem;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    overflow: hidden;
}
.toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.toast-body {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 12px;
}

.toast-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.toast-icon i[data-lucide] { width: 16px; height: 16px; stroke-width: 2.5px; }

.toast-success .toast-icon { background: #ecfdf5; }
.toast-success .toast-icon i[data-lucide] { stroke: #10b981; }
.toast-error   .toast-icon { background: #fef2f2; }
.toast-error   .toast-icon i[data-lucide] { stroke: #ef4444; }
.toast-warning .toast-icon { background: #fffbeb; }
.toast-warning .toast-icon i[data-lucide] { stroke: #f59e0b; }
.toast-info    .toast-icon { background: #eef2ff; }
.toast-info    .toast-icon i[data-lucide] { stroke: #6366f1; }

.toast-msg {
    flex: 1;
    line-height: 1.4;
    color: #111827;
}

.toast-close {
    flex-shrink: 0;
    width: 22px; height: 22px;
    border-radius: 6px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #9ca3af;
    transition: background .12s, color .12s;
    padding: 0;
}
.toast-close:hover { background: #f3f4f6; color: #374151; }
.toast-close svg { width: 13px; height: 13px; stroke-width: 2.5px; }

.toast-bar {
    height: 3px;
    transform-origin: left;
    animation: toast-shrink var(--dur, 3000ms) linear forwards;
}
.toast-success .toast-bar { background: #10b981; }
.toast-error   .toast-bar { background: #ef4444; }
.toast-warning .toast-bar { background: #f59e0b; }
.toast-info    .toast-bar { background: #6366f1; }

@keyframes toast-shrink {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* === Undo toast === */
.undo-secs {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: #ef4444;
    margin-left: 3px;
}
.undo-cancel-btn {
    flex-shrink: 0;
    padding: 4px 10px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #dc2626;
    cursor: pointer;
    transition: background .15s;
    white-space: nowrap;
}
.undo-cancel-btn:hover { background: #fee2e2; }

.section-content {
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    max-height: 2000px; /* Duża wartość, aby pomieścić zawartość */
    opacity: 1;
    overflow: hidden;
}

.section-content.collapsed {
    max-height: 0;
    opacity: 0;
}

/* --- Style dla Kanban --- */
.kanban-column {
  width: 280px;
  flex-shrink: 0;
  background-color: #f9fafb; /* Jaśniejsze tło kolumny */
  border-radius: 4px; /* Zmniejszone zaokrąglenie */
  /* box-shadow: 0 1px 3px rgba(0,0,0,0.1); */ /* USUNIĘTY cień */
  border: 1px solid #e5e7eb; /* Dodana ramka */
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 200px);
}

.kanban-column > div:first-child { /* Nagłówek kolumny */
  padding: 0.75rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: #374151; /* Ciemniejszy szary */
  border-bottom: 1px solid #e5e7eb; /* Dopasowana ramka */
  background-color: #f3f4f6; /* Lekko ciemniejsze tło nagłówka */
  border-top-left-radius: 3px; /* Dostosowane zaokrąglenie (bo wewnętrzny border-radius to 4px) */
  border-top-right-radius: 3px;
}


.kanban-column > div:first-child { /* Nagłówek kolumny */
  padding: 0.75rem;
  font-weight: 600;
  font-size: 0.875rem; /* 14px */
  color: #4b5563; /* Ciemniejszy szary */
  border-bottom: 1px solid #d1d5db; /* Linia pod nagłówkiem */
  background-color: #f9fafb; /* Bardzo jasne tło nagłówka */
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
}

.kanban-cards {
  padding: 0.5rem;
  flex-grow: 1; /* Pozwala kontenerowi kart rosnąć */
  overflow-y: auto; /* Przewijanie kart w kolumnie */
  min-height: 100px; /* Minimalna wysokość obszaru na karty */
}

.kanban-card {
  background-color: white;
  padding: 0.75rem;
  border-radius: 0.375rem; /* mniejsze zaokrąglenie */
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  border: 1px solid #e5e7eb;
  margin-bottom: 0.5rem; /* Odstęp między kartami */
  cursor: grab; /* Kursor wskazujący na możliwość przeciągnięcia */
}

.kanban-card:active {
  cursor: grabbing; /* Kursor podczas przeciągania */
}

/* Style dla "ducha" przeciąganego elementu (SortableJS) */
.kanban-card-ghost {
  opacity: 0.4;
  background: #c7d2fe; /* Jasnoniebieskie tło dla ducha */
  border: 1px dashed #6366f1;
}

/* Style dla elementu podczas przeciągania (SortableJS) */
.kanban-card-dragging {
  /* Można dodać dodatkowe style, np. lekki cień */
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Style dla aktywnych/nieaktywnych przycisków widoku */
#cases-view-table-btn, #cases-view-kanban-btn {
    transition: background-color 0.2s ease;
}
/* --- Widoki (Sekcje) --- */
.view {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}
.view.active {
    display: block;
    opacity: 1;
    transform: translateY(0); /* Powrót do pozycji początkowej */
}




/* Tabele — nowoczesny styl */
tbody tr {
    transition: background-color 0.1s ease;
}
tbody tr:nth-child(even) {
    background-color: #fafafa;
}
tbody tr:hover {
    background-color: #eef2ff !important;
}
td, th {
    font-size: 0.8125rem;
}
th {
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.7rem;
    color: #6b7280;
}

/* --- Sidebar (ustawienia) --- */
.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.875rem;
    margin-bottom: 2px;
    border-radius: 8px;
    transition: background-color 0.12s ease, color 0.12s ease;
    cursor: pointer;
    color: #4b5563;
    font-weight: 500;
    font-size: 0.8125rem;
    gap: 0.625rem;
}
.sidebar-link:hover {
    background-color: #f3f4f6;
    color: #111827;
}
.sidebar-link.active {
    background-color: #eef2ff;
    color: #4338ca;
    font-weight: 600;
}
.sidebar-link i[data-lucide] {
    width: 1rem;
    height: 1rem;
    stroke-width: 2;
    flex-shrink: 0;
    color: inherit;
    opacity: 0.7;
}
.sidebar-link.active i[data-lucide] {
    opacity: 1;
}

/* --- Tagi Statusu --- */
/* Styl tagów jest już dość płaski, można zostawić */
.status-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px; /* Mniejsze zaokrąglenie dla bardziej płaskiego stylu */
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1.2;
}
/* Kolory tagów bez zmian */
status-tag.bg-yellow-100 { background-color: #fef3c7; border-color: #fcd34d; color: #92400e; }
.status-tag.text-yellow-800 { color: #92400e; } /* Zachowujemy dla spójności, ale kolor już jest w tle */
.status-tag.bg-blue-100 { background-color: #dbeafe; border-color: #bfdbfe; color: #1e40af; }
.status-tag.text-blue-800 { color: #1e40af; }
.status-tag.bg-green-100 { background-color: #d1fae5; border-color: #a7f3d0; color: #065f46; }
.status-tag.text-green-800 { color: #065f46; }
.status-tag.bg-red-100 { background-color: #fee2e2; border-color: #fecaca; color: #991b1b; }
.status-tag.text-red-800 { color: #991b1b; }
.status-tag.bg-gray-100 { background-color: #f3f4f6; border-color: #e5e7eb; color: #4b5563;} /* Domyślny */



/* --- Sekcje Szczegółów (np. Klienta) --- */
/* Usuwamy ramkę i cień */
.detail-section {
    background-color: white;
    padding: 1.5rem;
    border-radius: 6px; /* Lekkie zaokrąglenie */
    /* border: 1px solid #dadce0; <-- Usunięta ramka */
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #eee; /* Można dodać dolną ramkę dla separacji sekcji */
}
.detail-section h2 {
    font-size: 1.125rem;
    font-weight: 600; /* Trochę grubszy font dla hierarchii */
    color: #3c4043;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #eee; /* Jaśniejsza linia pod nagłówkiem */
}
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}
.detail-item dt {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #5f6368;
    margin-bottom: 0.25rem;
}
.detail-item dd {
    font-size: 0.9375rem;
    color: #202124;
}

/* --- Modale — nowoczesny styl SaaS --- */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    overflow-y: auto;
    padding: 1rem;
}
.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeInBackdrop 0.2s ease;
}
@keyframes fadeInBackdrop {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.modal-content {
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 14px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.15), 0 4px 16px rgba(0,0,0,.08);
    border: 1px solid rgba(255,255,255,0.8);
    animation: scaleIn 0.2s cubic-bezier(0.34,1.2,0.64,1);
}

/* Modal nieruchomości — flex layout z przyklejoną stopką */
#property-modal .property-inner {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#property-modal .property-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}
#property-modal button[type="submit"] {
    background-color: #d97706;
    color: #ffffff;
}
#property-modal button[type="submit"]:hover {
    background-color: #b45309;
}
.modal-close-button {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    color: #5f6368;
    transition: color 0.2s ease;
}
.modal-close-button:hover {
    color: #202124;
}

/* styles.css */

/* === Nowoczesne Style dla FullCalendar === */

/* Ogólny kontener kalendarza */
/* ════════════════════════════════════════════════════════════
   FullCalendar — pastelowy redesign (wzorzec ze screenshotu)
   ════════════════════════════════════════════════════════════ */

#calendar {
    border: none;
    background: #fff;
    overflow: hidden;
    font-family: 'Inter', system-ui, sans-serif;
    position: relative;
}

/* Ukryj domyślny toolbar FC (używamy custom w calendar.php) */
#calendar .fc-header-toolbar { display: none !important; }

/* ── Nagłówki kolumn dni ─────────────────────────────────── */
#calendar .fc-col-header-cell {
    background: #fff !important;
    border: none !important;
    border-bottom: 1px solid #f3f4f6 !important;
    padding: 10px 4px !important;
    font-size: 0.75rem;
    font-weight: 500;
    color: #9ca3af;
    text-transform: capitalize !important;
}
#calendar th.fc-col-header-cell {
    border-left: 1px solid #f3f4f6 !important;
}
#calendar th.fc-col-header-cell:first-child { border-left: none !important; }

/* Dzisiaj — header */
#calendar .fc-col-header-cell.fc-day-today .fc-col-header-cell-cushion {
    color: #4f46e5;
    font-weight: 700;
}

/* ── Siatka czasu ────────────────────────────────────────── */
#calendar .fc-timegrid-slot-label {
    font-size: 0.6875rem;
    color: #9ca3af;
    border: none !important;
    padding: 0 8px !important;
    text-align: right;
    vertical-align: top;
}
#calendar .fc-timegrid-slot-label-cushion { padding: 2px 8px !important; }
#calendar .fc-timegrid-slot-lane { border: none !important; }
#calendar .fc-timegrid-slot-minor { border-top: none !important; }
#calendar .fc-timegrid-slot:not(.fc-timegrid-slot-minor) {
    border-top: 1px solid #f3f4f6 !important;
}
#calendar .fc-timegrid-col {
    border-left: 1px solid #f3f4f6 !important;
}
#calendar .fc-timegrid-col:first-child { border-left: none !important; }

/* ── Kolumna "dzisiaj" — subtelny tint ── */
#calendar .fc-timegrid-col.fc-day-today .fc-timegrid-slots,
#calendar .fc-daygrid-day.fc-day-today {
    background: rgba(99,102,241,0.04) !important;
}

/* ── Wskaźnik "teraz" ────────────────────────────────────── */
#calendar .fc-timegrid-now-indicator-line {
    border-color: #6366f1;
    border-width: 1.5px;
    border-style: solid;
    z-index: 4;
}
#calendar .fc-timegrid-now-indicator-arrow {
    border: none !important;
    width: 8px; height: 8px;
    background: #6366f1;
    border-radius: 50%;
    margin-top: -3px;
    left: -4px;
}

/* Badge z godziną przy wskaźniku "teraz" */
#cal-now-badge {
    position: absolute;
    left: 2px;
    background: #111827;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 10px;
    z-index: 6;
    pointer-events: none;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
}

/* ── Zdarzenia — pastelowe bloki ─────────────────────────── */
#calendar .fc-event {
    border: none !important;
    border-radius: 8px !important;
    padding: 0 !important;
    box-shadow: none !important;
    overflow: hidden;
    transition: filter .15s, transform .15s;
    cursor: pointer;
}
#calendar .fc-event:hover {
    filter: brightness(0.95);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.08) !important;
}

/* Treść zdarzenia */
#calendar .fc-event-inner {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 5px 8px;
    height: 100%;
    overflow: hidden;
}
#calendar .fc-event-title {
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.25;
    truncate: '';
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: inherit !important;
}
#calendar .fc-event-timerange {
    font-size: 0.6875rem;
    font-weight: 400;
    opacity: 0.75;
    color: inherit !important;
    white-space: nowrap;
}
#calendar .fc-event-done .fc-event-title {
    text-decoration: line-through;
    opacity: 0.6;
}
#calendar .fc-event-completed-custom { opacity: 0.65; }

/* Ukryj domyślne elementy tekstu FC wewnątrz eventContent */
#calendar .fc-event-main { padding: 0 !important; }
#calendar .fc-event-title-container,
#calendar .fc-event-time { display: none !important; }

/* ── Widok miesiąca ──────────────────────────────────────── */
#calendar .fc-daygrid-day {
    border-color: #f3f4f6 !important;
}
#calendar .fc-daygrid-day-number {
    font-size: 0.75rem;
    padding: 4px 8px;
    color: #6b7280;
    font-weight: 500;
}
#calendar .fc-daygrid-day.fc-day-today .fc-daygrid-day-number {
    background: #4f46e5;
    color: #fff;
    border-radius: 6px;
    padding: 2px 6px;
}
#calendar .fc-day-other .fc-daygrid-day-number { color: #d1d5db; }

/* ── Święta ──────────────────────────────────────────────── */
#calendar .fc-event-holiday {
    background: #fef3c7 !important;
    border-color: #f59e0b !important;
    border-left: 3px solid #d97706 !important;
}
#calendar .fc-event-holiday .fc-event-title {
    color: #92400e !important;
    font-size: 10.5px !important;
}

/* ── Slot all-day ────────────────────────────────────────── */
#calendar .fc-daygrid-body { border-bottom: 1px solid #f3f4f6; }

/* ── Misc ────────────────────────────────────────────────── */
#calendar .fc-non-business { background: transparent !important; }
#calendar .fc-scrollgrid { border: none !important; }
#calendar .fc-scrollgrid td, #calendar .fc-scrollgrid th {
    border-color: #f3f4f6 !important;
}
/* Zabij wszelkie tła poza slotami */
#calendar .fc-scroller-harness,
#calendar .fc-scroller,
#calendar .fc-timegrid-body,
#calendar .fc-timegrid-col-frame,
#calendar .fc-view-harness { background: #fff !important; }
#calendar .fc-highlight { background: rgba(99,102,241,0.06) !important; }
/* === Koniec stylów FullCalendar === */


/* --- Style dla zwijalnej sekcji dokumentów --- */

.collapsible-content {
    overflow: hidden; /* Ukryj zawartość, która się nie mieści */
    transition: max-height 0.4s ease-in-out, padding 0.4s ease-in-out, margin 0.4s ease-in-out, border 0.4s ease-in-out; /* Płynne przejście */
    max-height: 400px; /* Maksymalna wysokość PRZED pojawieniem się paska przewijania (dostosuj) */
    /* Można też dodać padding/margin dla stanu rozwiniętego, jeśli trzeba */
     /* border-top: 1px solid #e5e7eb; */ /* Opcjonalna górna ramka */
     /* margin-top: 0.75rem; */ /* Przywraca margines z #client-documents-list */
}

.collapsible-content.collapsed {
    max-height: 0; /* Całkowicie zwinięty */
    /* Ukryj padding/margin/border w stanie zwiniętym dla płynniejszego efektu */
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
     border-width: 0;
}

/* Pasek przewijania TYLKO gdy rozwinięty i zawartość się nie mieści */
.collapsible-content:not(.collapsed) {
     overflow-y: auto;
}

/* Obrót ikony przycisku Rozwiń/Zwiń */
#toggle-documents-btn i[data-lucide] {
    transition: transform 0.3s ease-in-out; /* Płynny obrót ikony */
}
/* Kiedy KONTENER JEST ROZWINIĘTY (nie ma klasy collapsed), obróć ikonę */
.collapsible-content:not(.collapsed) + /* to nie zadziała, bo button jest przed */
/* Poprawka: Użyjemy klasy na przycisku dodawanej przez JS */
#toggle-documents-btn.expanded i[data-lucide="chevron-down"] {
    transform: rotate(180deg);
}
#toggle-documents-btn.expanded i[data-lucide="chevron-up"] {
    transform: rotate(0deg);
}

/* FullCalendar CSS custom properties */
:root {
    --fc-today-bg-color: transparent;
    --fc-border-color: #f3f4f6;
    --fc-page-bg-color: #ffffff;
    --fc-neutral-bg-color: #f9fafb;
    --fc-list-event-hover-bg-color: #f5f3ff;
    --fc-non-business-color: transparent;
}

.fc .fc-toolbar-title {
    font-size: 1rem !important;
    font-weight: 700 !important;
    color: #111827 !important;
    letter-spacing: -0.01em;
}

.fc .fc-col-header-cell-cushion {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-decoration: none !important;
    padding: 8px 4px;
}

.fc .fc-daygrid-day-number {
    font-size: 0.8rem;
    color: #374151;
    text-decoration: none !important;
}

.fc-day-today .fc-daygrid-day-number {
    background: #4F46E5;
    color: #fff !important;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 4px;
}

.fc .fc-timegrid-slot-label-cushion {
    font-size: 0.7rem;
    color: #9CA3AF;
    font-weight: 500;
}

.fc .fc-timegrid-now-indicator-line {
    border-color: #EF4444;
    border-width: 2px;
}

.fc .fc-timegrid-now-indicator-arrow {
    border-top-color: #EF4444;
    border-bottom-color: #EF4444;
}

/* Karty zdarzeń */
.fc-event {
    border: none !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18), 0 1px 2px rgba(0,0,0,0.12) !important;
    transition: filter 0.12s ease, box-shadow 0.12s ease !important;
}

.fc-event:hover {
    filter: brightness(0.93) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.18), 0 2px 4px rgba(0,0,0,0.12) !important;
}

.fc-timegrid-event .fc-event-main {
    padding: 0 !important;
}

.fc-daygrid-event .fc-event-main {
    padding: 2px 4px !important;
}

/* Przycisk "dziś" odróżniony od reszty */
.fc .fc-today-button {
    background-color: #F9FAFB !important;
    border-color: #E5E7EB !important;
    color: #374151 !important;
    font-weight: 500 !important;
}

.fc .fc-today-button:hover {
    background-color: #F3F4F6 !important;
    border-color: #D1D5DB !important;
}

.fc .fc-button {
    border-radius: 6px !important;
    font-size: 0.8rem !important;
    font-weight: 500 !important;
    padding: 5px 12px !important;
}

.fc .fc-button-group .fc-button {
    border-radius: 0 !important;
}

.fc .fc-button-group .fc-button:first-child {
    border-radius: 6px 0 0 6px !important;
}

.fc .fc-button-group .fc-button:last-child {
    border-radius: 0 6px 6px 0 !important;
}

/* Animacja rozwijania wniosków w widoku 360 */
.case-apps-container {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.38s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s ease,
                margin-bottom 0.38s ease;
    margin-bottom: 0;
}
.case-apps-container.open {
    max-height: 800px;
    opacity: 1;
    margin-bottom: 0.75rem;
}

/* === PRIVATE EVENTS (Rezerwacje prywatne) === */
.fc-private-event .fc-event-main {
    background: repeating-linear-gradient(
        45deg,
        #e2e8f0 0px, #e2e8f0 4px,
        #f1f5f9 4px, #f1f5f9 10px
    ) !important;
    color: #475569 !important;
    border-left: 3px solid #64748b !important;
}
.fc-private-event {
    border: 1px dashed #94a3b8 !important;
    border-radius: 4px !important;
    background: transparent !important;
}
.fc-private-event .fc-event-title {
    font-style: italic;
    font-size: 0.75rem;
    color: #475569;
}

@keyframes scaleIn { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* === GLOBALNE DOPIESZCZENIA — Modern SaaS === */

/* Inputy i selecty — spójny styl */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="tel"],
select, textarea {
    font-family: inherit;
    font-size: 0.8125rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 3px rgba(99,102,241,.12) !important;
}

/* Przyciski globalne — lepszy feel */
button {
    font-family: inherit;
}

/* Karty white z subtelnym cieniem */
.bg-white.shadow-sm.rounded-xl,
.bg-white.rounded-xl.shadow-sm {
    box-shadow: 0 1px 4px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04) !important;
    border-color: #e5e7eb !important;
}

/* Linie w tabelach — subtelniejsze */
.divide-y > tr,
.divide-y > * {
    border-color: #f3f4f6;
}

/* Nagłówek strony — lekki separator */
nav.fixed.top-0 {
    box-shadow: 0 1px 0 #e5e7eb;
}

/* Scrollbar — delikatny */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* =============================================================================
   CD360 — Widok Klienta 360°
   ============================================================================= */

/* ── KPI Cards ──────────────────────────────────────────────────────────────── */
.cd360-kpi-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 72px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    transition: box-shadow .15s;
}
.cd360-kpi-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }

.cd360-kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.cd360-kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #111827;
    letter-spacing: -.02em;
}
.cd360-kpi-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-top: 3px;
}
.cd360-kpi-sub {
    font-size: 0.7rem;
    color: #6b7280;
    margin-top: 2px;
}
.cd360-kpi-skeleton {
    width: 100%;
    height: 36px;
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    border-radius: 8px;
    animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Widget Cards ─────────────────────────────────────────────────────────── */
.cd360-widget {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    transition: box-shadow .15s;
}
.cd360-widget:hover { box-shadow: 0 2px 10px rgba(0,0,0,.07); }

.cd360-widget-head {
    padding: 13px 18px;
    border-bottom: 1px solid #f3f4f6;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
}
.cd360-widget-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}
.cd360-widget-body {
    padding: 16px 18px;
}
.cd360-widget-footer {
    padding: 9px 18px;
    border-top: 1px solid #f3f4f6;
    background: #fafafa;
    flex-shrink: 0;
}
.cd360-footer-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #6366f1;
    transition: color .12s;
}
.cd360-footer-link:hover { color: #4338ca; }

/* ── Widget add button ──────────────────────────────────────────────────────── */
.cd360-btn-add {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #4f46e5;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    transition: background .12s, color .12s;
    white-space: nowrap;
}
.cd360-btn-add:hover { background: #e0e7ff; color: #3730a3; }

/* ── Widget: Sprawy — case row ──────────────────────────────────────────────── */
.cd360-case-row {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 14px;
    transition: border-color .12s, box-shadow .12s;
    cursor: default;
}
.cd360-case-row:hover { border-color: #a5b4fc; box-shadow: 0 1px 6px rgba(99,102,241,.1); }

.cd360-case-bank-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 0.6875rem;
    font-weight: 600;
    border: 1px solid;
}

/* ── Widget: Aktywność — mini timeline item ─────────────────────────────────── */
.cd360-activity-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid #f9fafb;
}
.cd360-activity-item:last-child { border-bottom: none; padding-bottom: 0; }
.cd360-activity-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}
.cd360-activity-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.3;
}
.cd360-activity-sub {
    font-size: 0.7rem;
    color: #9ca3af;
    margin-top: 1px;
}
.cd360-activity-date {
    font-size: 0.6875rem;
    color: #d1d5db;
    font-weight: 500;
    white-space: nowrap;
    margin-left: auto;
    padding-left: 8px;
    flex-shrink: 0;
}

/* ── Widget: Kontakt — contact row ─────────────────────────────────────────── */
.cd360-contact-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid #f9fafb;
}
.cd360-contact-row:last-child { border-bottom: none; }
.cd360-contact-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #f3f4f6;
    color: #6b7280;
}
.cd360-contact-value {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #111827;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cd360-contact-label {
    font-size: 0.6875rem;
    color: #9ca3af;
    margin-top: 0;
}

/* ── Widget: Profil — finansowy row ─────────────────────────────────────────── */
.cd360-profil-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 5px 0;
    border-bottom: 1px solid #f9fafb;
}
.cd360-profil-row:last-child { border-bottom: none; }
.cd360-profil-label { font-size: 0.75rem; color: #6b7280; }
.cd360-profil-value { font-size: 0.8125rem; font-weight: 600; color: #111827; }

/* ── Detail section label ──────────────────────────────────────────────────── */

/* =============================================================================
   SIDEBAR — Lewa belka nawigacyjna
   ============================================================================= */

:root {
    --sb-width:      240px;
    --sb-bg:         rgba(255,255,255,0.88);
    --sb-border:     rgba(229,231,235,0.8);
    --sb-text:       #6b7280;
    --sb-text-dim:   #9ca3af;
    --sb-hover:      #f9fafb;
    --sb-active:     #eef2ff;
    --sb-active-txt: #4f46e5;
}

/* ── Aside wrapper ─────────────────────────────────────────────────────────── */
#main-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sb-width);
    background: var(--sb-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    display: flex;
    flex-direction: column;
    z-index: 40;
    border-right: 1px solid var(--sb-border);
    overflow: hidden;
}

/* ── Header ──────────────────────────────────────────────────────────────────── */
.sb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 16px 14px;
    border-bottom: 1px solid var(--sb-border);
    flex-shrink: 0;
}
.sb-logo {
    display: flex;
    align-items: center;
    gap: 9px;
    overflow: hidden;
}
.sb-logo-mark {
    width: 30px; height: 30px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(37,99,235,0.35);
    display: flex; align-items: center; justify-content: center;
    font-weight: 900;
    font-size: 0.9375rem;
    color: #fff;
    flex-shrink: 0;
    letter-spacing: -.02em;
}
.sb-logo-text {
    font-size: 0.9375rem;
    font-weight: 800;
    color: #111827;
    letter-spacing: -.02em;
    white-space: nowrap;
}

/* ── Icon button (bell, logout) ─────────────────────────────────────────────── */
.sb-icon-btn {
    display: flex; align-items: center; justify-content: center;
    width: 30px; height: 30px;
    border-radius: 8px;
    color: var(--sb-text);
    transition: background .12s, color .12s;
    position: relative;
    flex-shrink: 0;
}
.sb-icon-btn:hover { background: var(--sb-hover); color: #4f46e5; }

/* ── Search ──────────────────────────────────────────────────────────────────── */
.sb-search-wrap {
    padding: 10px 12px 6px;
    flex-shrink: 0;
}
.sb-search-wrap .relative { position: relative; }
.sb-search-icon {
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    width: 14px; height: 14px;
    color: var(--sb-text-dim);
    pointer-events: none;
}
.sb-search-input {
    width: 100%;
    background: #f9fafb;
    border: 1px solid var(--sb-border);
    border-radius: 8px;
    padding: 7px 10px 7px 32px;
    font-size: 0.8125rem;
    color: var(--sb-text);
    outline: none;
    transition: background .12s, border-color .12s;
    font-family: inherit;
}
.sb-search-input::placeholder { color: var(--sb-text-dim); }
.sb-search-input:focus {
    background: #fff;
    border-color: rgba(99,102,241,.5);
    color: #111827;
}

/* ── Nav ─────────────────────────────────────────────────────────────────────── */
.sb-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 8px 4px;
    scrollbar-width: none;
}
.sb-nav::-webkit-scrollbar { display: none; }

.sb-nav-group { margin-bottom: 2px; }

.sb-section-label {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--sb-text-dim);
    padding: 14px 8px 4px;
}

.sb-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--sb-text);
    text-align: left;
    transition: background .1s, color .1s;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
}
.sb-item:hover { background: var(--sb-hover); color: #111827; }
.sb-item.active,
.sb-item.bg-indigo-50 {
    background: var(--sb-active) !important;
    color: var(--sb-active-txt) !important;
    font-weight: 600 !important;
}

.sb-item-icon {
    width: 16px; height: 16px;
    flex-shrink: 0;
    opacity: .75;
}
.sb-item.active .sb-item-icon,
.sb-item:hover .sb-item-icon { opacity: 1; }

.sb-item-label { flex: 1; }

/* ── Count badge ─────────────────────────────────────────────────────────────── */
.sb-count {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--sb-text-dim);
    min-width: 20px;
    text-align: right;
    flex-shrink: 0;
}
.sb-item.active .sb-count { color: #4f46e5; }
.sb-item:hover .sb-count { color: #6b7280; }

/* ── Footer: karta użytkownika ────────────────────────────────────────────────── */
.sb-footer {
    border-top: 1px solid var(--sb-border);
    padding: 10px 8px;
    flex-shrink: 0;
}
.sb-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px;
    border-radius: 10px;
    transition: background .12s;
    cursor: default;
}
.sb-user-card:hover { background: var(--sb-hover); cursor: default; }
.sb-user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: #6366f1;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    letter-spacing: -.01em;
}
.sb-user-info { flex: 1; min-width: 0; }
.sb-user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sb-user-role {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--sb-text-dim);
    margin-top: 1px;
}
.sb-user-actions { display: flex; gap: 4px; }

/* ── Main content offset ────────────────────────────────────────────────────── */
#main-content { margin-left: var(--sb-width); padding-top: 2rem; }
nav.fixed.top-0 { display: none !important; }  /* stary top-nav → ukryty */

/* ── Sidebar: overflow visible, scroll tylko w nav ────────────────────────── */
#main-sidebar { overflow: visible; }
.sb-nav       { overflow-y: auto; }

/* ── Notification dropdown — fixed, wychodzi poza sidebar ──────────────────── */
#notification-dropdown {
    position: fixed !important;
    left: calc(var(--sb-width) + 8px) !important;
    top: 12px !important;
    right: auto !important;
    bottom: auto !important;
}
/* Wyniki wyszukiwania — analogicznie ────────────────────────────────────────── */
#global-search-results {
    position: fixed !important;
    left: calc(var(--sb-width) + 8px) !important;
    top: 60px !important;
    right: auto !important;
}

/* =============================================================================
   MOBILE — responsywny sidebar (breakpoint: 768px)
   ============================================================================= */

/* Overlay — tło gdy sidebar otwarty na mobile */
#sb-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 45;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
}

/* Mobile top bar — ukryty na desktop */
#sb-topbar {
    display: none;
}

@media (max-width: 767px) {

    /* Overlay i topbar widoczne */
    #sb-overlay { display: block; }
    #sb-topbar {
        display: flex;
        position: fixed;
        top: 0; left: 0; right: 0;
        height: 52px;
        background: #fff;
        border-bottom: 1px solid #e5e7eb;
        align-items: center;
        padding: 0 14px;
        gap: 10px;
        z-index: 41;
    }

    /* Sidebar: schowany poza ekranem, wysuwa się po .sb-open */
    #main-sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: none;
        z-index: 50;
    }
    #main-sidebar.sb-open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,.18);
    }

    /* Overlay: widoczny gdy sidebar otwarty */
    #sb-overlay.sb-open {
        opacity: 1;
        pointer-events: auto;
    }

    /* Treść: pełna szerokość, padding górny na top bar */
    #main-content {
        margin-left: 0 !important;
        padding-top: 4.5rem !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Notification dropdown: full-width na mobile */
    #notification-dropdown {
        left: 8px !important;
        right: 8px !important;
        top: 56px !important;
        width: auto !important;
        min-width: 0 !important;
    }

    /* Search results: full-width na mobile */
    #global-search-results {
        left: 8px !important;
        right: 8px !important;
        top: 56px !important;
        width: auto !important;
    }

    /* Tabele: przewijalne poziomo na wąskich ekranach */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ── Task Quick Panel ──────────────────────────────────────────────── */
.tqp-phone-btn {
    display: flex; align-items: center; gap: .75rem;
    width: 100%; padding: .9rem 1.1rem;
    border-radius: 1rem; border: 1.5px solid #e5e7eb;
    background: #f9fafb; text-decoration: none;
    transition: background .15s, border-color .15s, transform .1s;
    -webkit-tap-highlight-color: transparent;
}
.tqp-phone-btn:active { transform: scale(.97); background: #eff6ff; border-color: #6366f1; }

/* Dark overrides — inline styles na #tqp-panel wymagają !important */
.dark #tqp-panel                        { background: #1e293b !important; box-shadow: 0 -8px 40px rgba(0,0,0,.55) !important; }
.dark #tqp-panel > div:first-child      { background: #1e293b !important; }
.dark #tqp-panel > div:first-child > div { background: #334155 !important; }
.dark .tqp-phone-btn                    { background: #293548 !important; border-color: #334155 !important; }
.dark .tqp-phone-btn:active             { background: rgba(99,102,241,.15) !important; border-color: #6366f1 !important; }

.tqp-done-btn {
    display: flex; align-items: center; justify-content: center; gap: .6rem;
    width: 100%; padding: 1rem; border-radius: 1rem;
    background: #16a34a; color: #fff; font-weight: 700; font-size: 1rem;
    border: none; cursor: pointer; transition: background .15s, transform .1s;
    -webkit-tap-highlight-color: transparent;
}
.tqp-done-btn:hover  { background: #15803d; }
.tqp-done-btn:active { transform: scale(.97); }
.tqp-done-btn:disabled { background: #86efac; cursor: default; }

/* =============================================================================
   TYPOGRAPHY SCALE — Finsupply CRM
   Wzorzec: Inter, mocna hierarchia (jak Finsupply marketing)
   =============================================================================

   fs-eyebrow    → "PROWIZJA" / etykieta sekcji — indigo, uppercase, spaced
   fs-page-title → h1 widoku — black 900, tight tracking
   fs-section-title → nagłówek sekcji/widgetu
   fs-kpi-value  → duże liczby (metryki)
   ============================================================================= */

.fs-eyebrow {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #4f46e5;
}
.fs-page-title {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.025em;
    line-height: 1.2;
    color: #111827;
}
.fs-section-title {
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #111827;
}
.fs-kpi-value {
    font-size: 1.875rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1;
    color: #111827;
    font-variant-numeric: tabular-nums;
}

/* Dark variants */
.dark .fs-eyebrow        { color: #818cf8; }
.dark .fs-page-title     { color: #f1f5f9; }
.dark .fs-section-title  { color: #f1f5f9; }
.dark .fs-kpi-value      { color: #f1f5f9; }

/* =============================================================================
   DARK MODE — przełącznik: class="dark" na <html>
   Sidebar używa CSS vars (--sb-*) — tu je nadpisujemy.
   Tailwind utility classes nadpisujemy selektorem .dark .utility.
   ============================================================================= */

/* Płynne przejście tła i tekstu na elementach kluczowych */
body,
#main-sidebar,
.modal-content,
.kanban-card,
.kanban-column,
.detail-section {
    transition: background-color 0.25s ease, border-color 0.2s ease, color 0.2s ease;
}

/* ── Sidebar vars ────────────────────────────────────────────────────────── */
.dark {
    --sb-bg:         rgba(15,23,42,0.97);
    --sb-border:     rgba(51,65,85,0.7);
    --sb-text:       #94a3b8;
    --sb-text-dim:   #475569;
    --sb-hover:      rgba(248,250,252,0.05);
    --sb-active:     rgba(99,102,241,0.18);
    --sb-active-txt: #818cf8;
}

/* ── Body ────────────────────────────────────────────────────────────────── */
.dark body { background-color: #0f172a !important; color: #e2e8f0; }

/* ── Backgrounds ─────────────────────────────────────────────────────────── */
.dark .bg-white           { background-color: #1e293b !important; }
.dark .bg-gray-50,
.dark .bg-slate-50        { background-color: #0f172a !important; }
.dark .bg-gray-100,
.dark .bg-slate-100       { background-color: #1e293b !important; }
.dark .bg-gray-200,
.dark .bg-slate-200       { background-color: #293548 !important; }
.dark .bg-gray-300        { background-color: #334155 !important; }
.dark .bg-gray-800        { background-color: #0f172a !important; }
.dark .bg-gray-900        { background-color: #020617 !important; }

/* Indigo — przyciski i aktywne stany zostawiamy bez zmian, subtelniejszy bg */
.dark .bg-indigo-50       { background-color: rgba(99,102,241,.12) !important; }
.dark .bg-indigo-100      { background-color: rgba(99,102,241,.18) !important; }

/* Status badges — muted w dark */
.dark .bg-green-50,  .dark .bg-emerald-50  { background-color: rgba(16,185,129,.12) !important; }
.dark .bg-green-100, .dark .bg-emerald-100 { background-color: rgba(16,185,129,.18) !important; }
.dark .bg-red-50                           { background-color: rgba(239,68,68,.12) !important; }
.dark .bg-red-100                          { background-color: rgba(239,68,68,.18) !important; }
.dark .bg-amber-50,  .dark .bg-yellow-50   { background-color: rgba(245,158,11,.12) !important; }
.dark .bg-amber-100, .dark .bg-yellow-100  { background-color: rgba(245,158,11,.18) !important; }
.dark .bg-blue-50                          { background-color: rgba(59,130,246,.12) !important; }
.dark .bg-blue-100                         { background-color: rgba(59,130,246,.18) !important; }
.dark .bg-purple-50, .dark .bg-violet-50   { background-color: rgba(139,92,246,.12) !important; }
.dark .bg-purple-100                       { background-color: rgba(139,92,246,.18) !important; }
.dark .bg-orange-50                        { background-color: rgba(249,115,22,.12) !important; }
.dark .bg-teal-50,  .dark .bg-cyan-50      { background-color: rgba(20,184,166,.12) !important; }
.dark .bg-pink-50                          { background-color: rgba(236,72,153,.12) !important; }
.dark .bg-sky-50                           { background-color: rgba(14,165,233,.12) !important; }

/* ── Text ────────────────────────────────────────────────────────────────── */
.dark .text-gray-900, .dark .text-slate-900 { color: #f1f5f9 !important; }
.dark .text-gray-800, .dark .text-slate-800 { color: #e2e8f0 !important; }
.dark .text-gray-700, .dark .text-slate-700 { color: #cbd5e1 !important; }
.dark .text-gray-600, .dark .text-slate-600 { color: #94a3b8 !important; }
.dark .text-gray-500, .dark .text-slate-500 { color: #64748b !important; }
.dark .text-gray-400, .dark .text-slate-400 { color: #475569 !important; }
.dark .text-gray-300, .dark .text-slate-300 { color: #334155 !important; }
.dark .text-black                           { color: #f1f5f9 !important; }

.dark .text-indigo-600, .dark .text-indigo-500 { color: #818cf8 !important; }
.dark .text-indigo-700                         { color: #6366f1 !important; }
.dark .text-indigo-800                         { color: #4f46e5 !important; }
.dark .text-indigo-400                         { color: #a5b4fc !important; }

.dark .text-green-600, .dark .text-emerald-600 { color: #34d399 !important; }
.dark .text-green-700, .dark .text-emerald-700 { color: #10b981 !important; }
.dark .text-green-800                          { color: #059669 !important; }
.dark .text-red-600                            { color: #f87171 !important; }
.dark .text-red-700                            { color: #ef4444 !important; }
.dark .text-red-800                            { color: #dc2626 !important; }
.dark .text-amber-600, .dark .text-yellow-600  { color: #fbbf24 !important; }
.dark .text-amber-700, .dark .text-yellow-700  { color: #f59e0b !important; }
.dark .text-amber-800                          { color: #d97706 !important; }
.dark .text-orange-600                         { color: #fb923c !important; }
.dark .text-orange-500                         { color: #f97316 !important; }
.dark .text-blue-600, .dark .text-blue-800     { color: #60a5fa !important; }
.dark .text-purple-600, .dark .text-violet-600 { color: #c084fc !important; }
.dark .text-teal-600                           { color: #2dd4bf !important; }
.dark .text-pink-600                           { color: #f472b6 !important; }

/* ── Borders ─────────────────────────────────────────────────────────────── */
.dark .border-gray-100, .dark .border-slate-100 { border-color: #1e293b !important; }
.dark .border-gray-200, .dark .border-slate-200 { border-color: #334155 !important; }
.dark .border-gray-300, .dark .border-slate-300 { border-color: #475569 !important; }
.dark .border-gray-400                          { border-color: #64748b !important; }
.dark .border-indigo-200                        { border-color: rgba(99,102,241,.3) !important; }
.dark .border-indigo-300                        { border-color: rgba(99,102,241,.4) !important; }

/* Divide */
.dark .divide-gray-50 > * + *,
.dark .divide-slate-50 > * + * { border-color: #1e293b !important; }
.dark .divide-gray-100 > * + *,
.dark .divide-slate-100 > * + * { border-color: #1e293b !important; }
.dark .divide-gray-200 > * + *,
.dark .divide-slate-200 > * + * { border-color: #334155 !important; }

/* ── Shadows ─────────────────────────────────────────────────────────────── */
.dark .shadow-sm { box-shadow: 0 1px 3px rgba(0,0,0,.5) !important; }
.dark .shadow    { box-shadow: 0 2px 8px rgba(0,0,0,.6) !important; }
.dark .shadow-lg { box-shadow: 0 8px 24px rgba(0,0,0,.55) !important; }
.dark .shadow-xl { box-shadow: 0 16px 40px rgba(0,0,0,.55) !important; }

/* ── Form inputs ─────────────────────────────────────────────────────────── */
.dark input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
.dark select,
.dark textarea {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}
.dark input::placeholder, .dark textarea::placeholder { color: #475569 !important; }
.dark input:focus, .dark select:focus, .dark textarea:focus {
    background-color: #1e293b !important;
    border-color: #6366f1 !important;
    color: #f1f5f9 !important;
}
.dark option { background-color: #1e293b; color: #e2e8f0; }

/* ── Custom components ───────────────────────────────────────────────────── */

/* Modals */
.dark .modal-content {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.dark .modal-close-button { color: #94a3b8; }
.dark .modal-close-button:hover { color: #f1f5f9; }

/* Kanban */
.dark .kanban-column {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}
.dark .kanban-column > div:first-child {
    background-color: #293548 !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}
.dark .kanban-card {
    background-color: #293548 !important;
    border-color: #334155 !important;
}

/* Tables */
.dark tbody tr:nth-child(even) { background-color: rgba(255,255,255,.02) !important; }
.dark tbody tr:hover           { background-color: rgba(99,102,241,.09) !important; }
.dark th                       { color: #64748b !important; }

/* Nav links */
.dark .nav-link       { color: #64748b; }
.dark .nav-link:hover { color: #e2e8f0; background-color: rgba(255,255,255,.05) !important; }
.dark .nav-link.active {
    background-color: rgba(99,102,241,.18) !important;
    color: #818cf8 !important;
}

/* Settings sidebar links */
.dark .sidebar-link       { color: #94a3b8; }
.dark .sidebar-link:hover { background-color: rgba(255,255,255,.05); color: #e2e8f0; }
.dark .sidebar-link.active { background-color: rgba(99,102,241,.18); color: #818cf8; }

/* Toasts */
.dark .toast { background: #1e293b; border-color: #334155; color: #e2e8f0; }
.dark .toast-msg { color: #e2e8f0; }
.dark .toast-close { color: #64748b; }
.dark .toast-close:hover { background: #0f172a; color: #e2e8f0; }
.dark .undo-cancel-btn { background: #2d1f1f; border-color: #7f1d1d; color: #fca5a5; }
.dark .undo-cancel-btn:hover { background: #3b1f1f; }

/* Detail sections */
.dark .detail-section { background-color: #1e293b; border-color: #334155; }
.dark .detail-section h2 { color: #e2e8f0; border-color: #334155; }
.dark .detail-item dt { color: #94a3b8; }
.dark .detail-item dd { color: #e2e8f0; }

/* Sidebar search input */
.dark .sb-search-input {
    background: rgba(15,23,42,.7);
    color: #94a3b8;
    border-color: var(--sb-border);
}
.dark .sb-search-input:focus {
    background: #0f172a;
    color: #e2e8f0;
}
.dark .sb-logo-text  { color: #e2e8f0; }
.dark .sb-user-name  { color: #e2e8f0; }

/* FullCalendar dark overrides */
.dark #calendar { background: #1e293b; }
.dark #calendar .fc-col-header-cell { background: #1e293b !important; border-color: #293548 !important; }
.dark #calendar .fc-col-header-cell-cushion { color: #64748b; }
.dark #calendar .fc-timegrid-slot-label { color: #475569 !important; }
.dark #calendar .fc-timegrid-slot:not(.fc-timegrid-slot-minor) { border-top-color: #1e293b !important; }
.dark #calendar .fc-timegrid-col { border-left-color: #1e293b !important; }
.dark #calendar .fc-daygrid-day { border-color: #1e293b !important; }
.dark #calendar .fc-daygrid-day-number { color: #64748b; }
.dark #cal-now-badge { background: #334155; }

/* FullCalendar CSS vars — grid cells, today bg, borders */
.dark #calendar {
    --fc-page-bg-color:            #1e293b;
    --fc-neutral-bg-color:         #293548;
    --fc-border-color:             #334155;
    --fc-today-bg-color:           rgba(99,102,241,0.12);
    --fc-neutral-text-color:       #94a3b8;
    --fc-list-event-hover-bg-color:#293548;
}
.dark #calendar .fc-view-harness,
.dark #calendar .fc-scroller-harness,
.dark #calendar .fc-scroller,
.dark #calendar .fc-timegrid-body,
.dark #calendar .fc-timegrid-col-frame,
.dark #calendar .fc-timegrid-col-bg { background: #1e293b !important; }
.dark #calendar .fc-timegrid-col.fc-day-today .fc-timegrid-slots,
.dark #calendar .fc-daygrid-day.fc-day-today { background: rgba(99,102,241,0.12) !important; }
.dark #calendar .fc-scrollgrid td,
.dark #calendar .fc-scrollgrid th { border-color: #293548 !important; }

/* ── 360° KPI cards ─────────────────────────────────────────────────────── */
.dark .cd360-kpi-card       { background: #1e293b !important; border-color: #334155 !important; }
.dark .cd360-kpi-value      { color: #f1f5f9 !important; }
.dark .cd360-kpi-sub        { color: #94a3b8 !important; }
.dark .cd360-kpi-skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #293548 50%, #1e293b 75%);
    background-size: 200% 100%;
}

/* ── 360° Widget cards ───────────────────────────────────────────────────── */
.dark .cd360-widget         { background: #1e293b !important; border-color: #334155 !important; }
.dark .cd360-widget-head    { background: #293548 !important; border-color: #334155 !important; }
.dark .cd360-widget-title   { color: #cbd5e1 !important; }
.dark .cd360-widget-footer  { background: #293548 !important; border-color: #334155 !important; }
.dark .cd360-footer-link        { color: #818cf8 !important; }
.dark .cd360-footer-link:hover  { color: #a5b4fc !important; }
.dark .cd360-btn-add {
    background: rgba(99,102,241,.18) !important;
    border-color: rgba(99,102,241,.3) !important;
    color: #a5b4fc !important;
}
.dark .cd360-btn-add:hover  { background: rgba(99,102,241,.28) !important; }

/* ── 360° Case rows ──────────────────────────────────────────────────────── */
.dark .cd360-case-row       { border-color: #334155 !important; }
.dark .cd360-case-row:hover { border-color: #6366f1 !important; box-shadow: 0 1px 6px rgba(99,102,241,.2) !important; }

/* ── 360° Activity items ─────────────────────────────────────────────────── */
.dark .cd360-activity-item  { border-bottom-color: #293548 !important; }
.dark .cd360-activity-title { color: #e2e8f0 !important; }

/* ── 360° Contact rows ───────────────────────────────────────────────────── */
.dark .cd360-contact-row    { border-bottom-color: #293548 !important; }
.dark .cd360-contact-icon   { background: #293548 !important; color: #94a3b8 !important; }
.dark .cd360-contact-value  { color: #e2e8f0 !important; }

/* ── 360° Profile rows ───────────────────────────────────────────────────── */
.dark .cd360-profil-row     { border-bottom-color: #293548 !important; }
.dark .cd360-profil-label   { color: #94a3b8 !important; }
.dark .cd360-profil-value   { color: #e2e8f0 !important; }

/* ── Profile sub-tabs (inline-style override) ────────────────────────────── */
.dark .profile-tab-button.active                { background-color: rgba(99,102,241,.2) !important; color: #818cf8 !important; }
.dark .profile-tab-button:not(.active)          { color: #94a3b8 !important; background-color: transparent !important; }
.dark .profile-tab-button:not(.active):hover    { color: #e2e8f0 !important; background-color: #293548 !important; }

/* ── Onboarding Wizard — kreator klienta ─────────────────────────────────── */
.dark #ow-overlay              { background: #0f172a !important; }
.dark .ow-label                { color: #94a3b8 !important; }
.dark .ow-input-group          { background: #0f172a !important; border-color: #334155 !important; }
.dark .ow-input-group:focus-within { background: #1e293b !important; border-color: #6366f1 !important; }
.dark .ow-suffix               { background: #1e293b !important; border-left-color: #334155 !important; color: #475569 !important; }
.dark .ow-type-btn.ow-type-active { background: #293548 !important; color: #818cf8 !important; box-shadow: 0 1px 3px rgba(0,0,0,.4) !important; }
.dark .ow-step-btn .ow-step-num { background: #293548 !important; color: #64748b !important; }
.dark .ow-step-btn.ow-step-active .ow-step-num { background: #4f46e5 !important; color: #fff !important; }
.dark .ow-step-btn.ow-step-done  .ow-step-num  { background: rgba(16,185,129,.2) !important; color: #34d399 !important; }
.dark .ow-prod-tile            { border-color: #334155 !important; background: #1e293b !important; }
.dark .ow-prod-tile:hover      { border-color: rgba(99,102,241,.5) !important; background: rgba(99,102,241,.08) !important; }
.dark .ow-prod-tile.selected   { border-color: #6366f1 !important; background: rgba(99,102,241,.18) !important; }
.dark .ow-act-card div         { border-color: #334155 !important; }

/* ── Mortgage Wizard — kreator hipoteczny ────────────────────────────────── */
.dark .mw-radio-label          { color: #cbd5e1 !important; }
.dark .mw-radio-card-inner     { border-color: #334155 !important; background: #1e293b !important; color: #94a3b8 !important; }
.dark .mw-radio-card:hover .mw-radio-card-inner { border-color: rgba(99,102,241,.5) !important; background: rgba(99,102,241,.08) !important; }
.dark .mw-input[readonly],
.dark .mw-input.bg-gray-50     { background: #293548 !important; color: #64748b !important; border-color: #334155 !important; }
.dark .mw-step-btn .mw-step-num { background: #293548 !important; color: #64748b !important; }
.dark .mw-step-btn.mw-step-done  .mw-step-num  { background: rgba(16,185,129,.2) !important; color: #34d399 !important; }
.dark .mw-step-btn.mw-step-active              { background: rgba(99,102,241,.18) !important; color: #818cf8 !important; }
.dark .mw-step-btn.mw-step-active .mw-step-num { background: #6366f1 !important; color: #fff !important; }
.dark .mw-bank-card-inner      { border-color: #334155 !important; }

/* Mobile topbar */
.dark #sb-topbar { background: #1e293b; border-color: #334155; }

/* Notification dropdown */
.dark #notification-dropdown {
    background: #1e293b;
    border-color: #334155;
}

/* ── Dark mode toggle button ──────────────────────────────────────────────── */
#dark-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 30px; height: 30px;
    border-radius: 8px;
    color: var(--sb-text);
    transition: background .12s, color .12s;
    flex-shrink: 0;
    cursor: pointer;
    border: none;
    background: none;
}
#dark-toggle:hover { background: var(--sb-hover); color: #f59e0b; }

