/* =========================================
   ZMIENNE (KOLORY I USTAWIENIA)
   ========================================= */
   :root {
    --fire-red: #d32f2f;
    --dark-red: #b71c1c;
    --sidebar-bg: #1e1e2d;
    --sidebar-hover: #2b2b40;
    --bg-color: #f4f6f9;
    --card-bg: #ffffff;
    --text-main: #333333;
    --text-muted: #6c757d;
    --border-color: #e0e0e0;
    --text-green: #2e7d32;
}

/* =========================================
   RESETA I BAZA
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    display: flex;
    height: 100vh;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow: hidden;
}

/* =========================================
   PASEK BOCZNY (SIDEBAR)
   ========================================= */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    background-color: var(--dark-red);
    font-size: 1.2rem;
}

.nav-links {
    list-style: none;
    margin-top: 20px;
    overflow-y: auto;
}

.nav-links li {
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: 0.3s;
    border-left: 4px solid transparent;
}

.nav-links li:hover {
    background-color: var(--sidebar-hover);
}

.nav-links li.active {
    background-color: var(--sidebar-hover);
    border-left-color: var(--fire-red);
    font-weight: bold;
}

/* =========================================
   GŁÓWNA ZAWARTOŚĆ I ZAKŁADKI
   ========================================= */
.content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Pulpit - Karty */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
}

.card h3 {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.big-number {
    font-size: 2.5rem;
    font-weight: bold;
}

.text-green { color: var(--text-green); }
.text-red { color: var(--fire-red); }

/* =========================================
   LISTY I ELEMENTY (Członkowie)
   ========================================= */
.list-item {
    background: var(--card-bg);
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

.list-item:hover {
    transform: translateX(5px);
    border-left: 4px solid var(--fire-red);
}

.list-item-title {
    font-weight: bold;
    font-size: 1.1rem;
}

.list-item-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 5px;
}

.actions i {
    cursor: pointer;
    margin-left: 15px;
    font-size: 1.1rem;
    color: var(--text-muted);
    transition: 0.2s;
}

.actions i:hover {
    color: var(--text-main);
}
.actions i.text-red:hover {
    color: var(--fire-red);
}

/* =========================================
   PRZYCISKI I FORMULARZE
   ========================================= */
.btn-primary {
    background-color: var(--fire-red);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.btn-primary:hover {
    background-color: var(--dark-red);
}

.w-100 { width: 100%; }
.mt-15 { margin-top: 15px; }

fieldset {
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 10px;
}

legend {
    font-weight: bold;
    color: var(--text-muted);
    padding: 0 5px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.85rem;
    margin-bottom: 5px;
    color: var(--text-main);
    font-weight: 500;
}

.form-group input, .form-group select {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    outline: none;
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--fire-red);
}

/* =========================================
   MODALE (WYSKAKUJĄCE OKNA)
   ========================================= */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 1000px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.close-modal {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.close-modal:hover { color: var(--fire-red); }

/* Zakładki wewnątrz modala */
.modal-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.mtab-btn {
    background: none;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    font-weight: bold;
    color: var(--text-muted);
}

.mtab-btn.active {
    color: var(--fire-red);
    border-bottom: 3px solid var(--fire-red);
    margin-bottom: -2px;
}

.mtab-content {
    display: none;
}
.mtab-content.active {
    display: block;
}

/* =========================================
   WIZYTÓWKA (PODGLĄD) I ELEMENTY DODATKOWE
   ========================================= */
.detail-section {
    background: var(--bg-color);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
}

.detail-section h4 {
    color: var(--fire-red);
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border-color);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.detail-row strong {
    color: var(--text-main);
    text-align: right;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 10px;
}

.dynamic-add-row {
    display: flex;
    gap: 10px;
}
.dynamic-add-row input {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.mini-list {
    list-style: none;
    padding: 0;
}
.mini-list li {
    display: flex;
    justify-content: space-between;
    background: var(--bg-color);
    padding: 8px 10px;
    margin-bottom: 5px;
    border-radius: 4px;
    font-size: 0.9rem;
}
.details-section {
    background: #fdfdfd;
    border: 1px solid #eee;
    padding: 15px;
    border-radius: 8px;
}

.section-title {
    color: #d32f2f;
    border-bottom: 2px solid #d32f2f;
    padding-bottom: 5px;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.info-item label {
    display: block;
    font-size: 0.8em;
    color: #777;
    text-transform: uppercase;
}

.info-item span {
    font-weight: 600;
    color: #333;
}

.form-grid-mini {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    background: #f9f9f9;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 10px;
}

.btn-add-inline {
    background: #27ae60;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    height: 38px;
}

.mini-list-styled {
    list-style: none;
    padding: 0;
}

.mini-list-styled li {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    border-bottom: 1px solid #eee;
    background: white;
}

.mini-list-styled li button {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    padding: 2px 8px;
}

#calendar {
  max-width: 1100px;
  margin: 20px auto;
  height: 800px !important; 
  background-color: #ffffff !important;
  color: #000000 !important;
  
  /* Zmienne wewnętrzne FullCalendar: */
  --fc-page-bg-color: #ffffff;
  --fc-neutral-text-color: #000000;
  --fc-border-color: #dddddd;
  
  padding: 10px;
  border-radius: 8px;
}

/* =========================================
   HAMBURGER MENU I WIDOK MOBILNY (RWD)
   ========================================= */

/* Domyślnie ukrywamy górny pasek na dużych ekranach (komputerach) */
.mobile-header {
    display: none;
}

/* Ustawienia tylko dla ekranów mniejszych niż 768px (telefony i małe tablety) */
@media (max-width: 768px) {
    /* Pokazujemy górny pasek */
    .mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background-color: var(--sidebar-bg);
        color: white;
        padding: 15px 20px;
        position: fixed; /* Przyklejony do góry */
        top: 0;
        left: 0;
        width: 100%;
        z-index: 1000; /* Zawsze na wierzchu */
        box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    }

    .mobile-logo {
        font-size: 1.2rem;
        font-weight: bold;
    }

    .hamburger-btn {
        background: none;
        border: none;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
    }

    /* Odsunięcie głównej zawartości, żeby pasek jej nie zasłaniał */
    body {
        padding-top: 60px; 
    }

    /* Modyfikacja paska bocznego (chowamy go za lewą krawędź) */
    .sidebar {
        position: fixed;
        top: 0;
        left: -250px; /* Schowany 250px w lewo (tyle ile ma szerokości) */
        height: 100vh;
        z-index: 999;
        transition: left 0.3s ease-in-out; /* Płynna animacja wyjazdu */
        padding-top: 60px; /* Żeby menu nie wchodziło pod hamburgera */
    }

    /* Klasa, która będzie dodawana przez JS, żeby wysunąć menu */
    .sidebar.show {
        left: 0;
    }
}

/* STYLIZACJA LOGOWANIA */
.login-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--sidebar-bg);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
}
.login-box {
    background: white; padding: 40px; border-radius: 12px;
    width: 100%; max-width: 400px; box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}
.login-header { text-align: center; margin-bottom: 30px; }
.login-header i { font-size: 3rem; color: var(--fire-red); }
.btn-login {
    width: 100%; padding: 12px; background: var(--fire-red);
    color: white; border: none; border-radius: 6px;
    font-size: 1.1rem; cursor: pointer; margin-top: 10px;
}
.btn-login:hover { background: var(--dark-red); }
.login-error { color: red; text-align: center; margin-top: 15px; font-size: 0.9rem; }

.mini-list-styled {
    list-style: none;
    padding: 0;
    margin-top: 5px;
}
.mini-list-styled li {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px dashed #eee;
    font-size: 0.9rem;
}
.mini-list-styled li span { color: var(--text-muted); }
.mini-list-styled li strong { color: var(--text-main); }

.detail-section h4 {
    border-bottom: 2px solid var(--fire-red);
    padding-bottom: 5px;
    margin-bottom: 10px;
    margin-top: 15px;
    font-size: 0.95rem;
    text-transform: uppercase;
    color: var(--fire-red);
}

/* FILTRY LISTY CZŁONKÓW */
.filters-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    background-color: #f4f6f8;
    border: 1px solid #dcdcdc;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.9em;
    font-weight: bold;
    color: #555;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    background-color: #e2e6ea;
}

.filter-btn.active {
    background-color: var(--fire-red, #d32f2f);
    color: white;
    border-color: var(--fire-red, #d32f2f);
    box-shadow: 0 2px 4px rgba(211, 47, 47, 0.3);
}

.modal {
    background-color: #ffffff !important; /* !important wymusi biały kolor, jeśli coś innego go nadpisuje */
    color: #333;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    position: relative;
}

/* Aby ikonka w aktywnej zakładce też zmieniała kolor na czerwony */
.etab-btn.active i {
    color: #d32f2f;
    margin-right: 8px; /* Odstęp ikonki od tekstu */
}

.etab-btn i {
    margin-right: 8px;
    color: #666; /* Kolor ikonki w nieaktywnej zakładce */
}

/* Wymuszamy, by formularze dodawania zawsze były nad listą szczegółów */
#modal-equipment, #modal-simple-equipment {
    z-index: 2000 !important;
}

#modal-equipment-details {
    z-index: 1050 !important;
}

/* Tło modala - musi być FIXED */
#modal-worktime-details {
    display: none;          /* Pokazywane przez JS (flex) */
    position: fixed;        /* Kluczowe: modal nie "płynie" z tekstem */
    top: 0;
    left: 0;
    width: 100vw;           /* Cała szerokość ekranu */
    height: 100vh;          /* Cała wysokość ekranu */
    background-color: rgba(0, 0, 0, 0.7); /* Przyciemnienie tła */
    z-index: 99999;         /* Bardzo wysoki priorytet warstwy */
    
    /* Centrowanie zawartości */
    justify-content: center;
    align-items: center;
}

/* Białe okienko w środku */
#modal-worktime-details .modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;       /* Przewijanie jeśli długa lista */
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    position: relative;
}

.modal-new-overlay {
    display: none; /* Domyślnie ukryty */
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.modal-new-content {
    background: white;
    width: 90%;
    max-width: 650px;
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 15px 50px rgba(0,0,0,0.3);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-new-header {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-new-header h2 { margin: 0; font-size: 1.4rem; color: #d32f2f; }

.close-new-modal {
    font-size: 28px;
    cursor: pointer;
    color: #666;
}

.modal-new-body {
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    background: #fdfdfd;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.info-item label {
    display: block;
    font-size: 0.8rem;
    color: #777;
    text-transform: uppercase;
    font-weight: bold;
}

.info-item span {
    font-size: 1rem;
    color: #333;
}

.details-section h4 {
    border-left: 4px solid #d32f2f;
    padding-left: 10px;
    margin: 20px 0 10px 0;
    color: #444;
}

.mini-list-styled {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

.mini-list-styled li {
    background: #f1f1f1;
    padding: 8px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.form-group textarea {
    padding: 9px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    outline: none;
    resize: vertical;
    line-height: 1.45;
}

.form-group textarea:focus {
    border-color: var(--fire-red);
}

/* =========================================
   PANEL FILTRÓW ZEBRAŃ
   ========================================= */
.meeting-filters-panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--fire-red);
    border-radius: 8px;
    padding: 16px 18px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.meeting-filters-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding-bottom: 13px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
}

.meeting-filters-title {
    display: flex;
    align-items: center;
    gap: 11px;
}

.meeting-filters-title strong {
    display: block;
    font-size: 0.98rem;
    color: var(--text-main);
}

.meeting-filters-title small {
    display: block;
    color: var(--text-muted);
    font-size: 0.76rem;
    margin-top: 2px;
}

.meeting-filters-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    color: var(--fire-red);
    background: rgba(211, 47, 47, 0.1);
}

.meeting-results-count {
    flex-shrink: 0;
    padding: 6px 11px;
    border-radius: 16px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.meeting-filters-grid {
    display: grid;
    grid-template-columns: minmax(145px, 0.8fr) minmax(120px, 0.65fr) minmax(210px, 1.2fr) minmax(260px, 1.7fr) auto;
    gap: 12px;
    align-items: end;
}

.meeting-filter-field {
    min-width: 0;
}

.meeting-filter-field label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 600;
}

.meeting-filter-field label i {
    width: 15px;
    margin-right: 3px;
    color: var(--fire-red);
}

.meeting-filter-control {
    width: 100%;
    height: 39px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    outline: none;
    background: #fff;
    color: var(--text-main);
    font-size: 0.86rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.meeting-filter-control:focus {
    border-color: var(--fire-red);
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1);
}

.meeting-search-box {
    position: relative;
}

.meeting-search-box > i {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: #9aa0a6;
    font-size: 0.85rem;
    pointer-events: none;
}

.meeting-search-box .meeting-filter-control {
    padding-left: 34px;
}

.meeting-filter-actions {
    display: flex;
}

.meeting-reset-button {
    height: 39px;
    padding: 0 14px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: #fff;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.meeting-reset-button:hover {
    color: var(--fire-red);
    border-color: var(--fire-red);
    background: rgba(211, 47, 47, 0.04);
}

.meeting-reset-button i {
    margin-right: 5px;
}

@media (max-width: 1150px) {
    .meeting-filters-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .meeting-filter-search {
        grid-column: 1 / -1;
    }

    .meeting-filter-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }
}

@media (max-width: 600px) {
    .meeting-filters-panel {
        padding: 14px;
    }

    .meeting-filters-heading {
        align-items: flex-start;
    }

    .meeting-filters-title small {
        display: none;
    }

    .meeting-filters-grid {
        grid-template-columns: 1fr;
    }

    .meeting-filter-search,
    .meeting-filter-actions {
        grid-column: auto;
    }

    .meeting-filter-actions {
        justify-content: stretch;
    }

    .meeting-reset-button {
        width: 100%;
    }
}

/* ==========================================
   STATUT
   ========================================== */
.statute-page-header,
.statute-card-header,
.draft-editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}
.statute-page-header { margin-bottom: 22px; }
.statute-page-header p { margin-top: 5px; color: var(--text-muted); font-size: 0.9rem; }
.statute-main-status { min-height: 20px; font-size: 0.82rem; font-weight: 800; text-align: right; }
.statute-main-status.success { color: #2e7d32; }
.statute-main-status.error { color: #c62828; }
.statute-loading { padding: 38px; border: 1px solid var(--border-color); border-radius: 8px; background: #fff; color: var(--text-muted); text-align: center; }

.statute-card {
    margin-bottom: 18px;
    overflow: hidden;
    border: 1px solid #dce1e5;
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 2px 7px rgba(30, 42, 50, 0.04);
}
.statute-card-header { padding: 17px 19px; border-bottom: 1px solid #e7eaed; }
.statute-card-header h3 { margin: 3px 0 0; color: #2b343b; }
.statute-card-header p { margin-top: 5px; color: var(--text-muted); font-size: 0.78rem; }
.statute-card-kicker { color: var(--fire-red); font-size: 0.68rem; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; }
.current-statute-card { border-top: 4px solid #2f3b46; }
.draft-statute-card { border-top: 4px solid #1976d2; }

.statute-document {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 55px 55px;
    background: #fff;
    color: #20272d;
    font-family: Georgia, 'Times New Roman', serif;
    line-height: 1.58;
}
.statute-document-title { text-align: center; font-weight: 800; font-size: 1.15rem; }
.statute-chapter { margin-top: 32px; text-align: center; font-weight: 800; letter-spacing: 0.12em; }
.statute-section-title { margin: 4px 0 16px; text-align: center; font-weight: 800; }
.statute-paragraph-number { margin: 22px 0 7px; text-align: center; font-weight: 800; }
.statute-text-line { white-space: pre-wrap; }
.statute-line-empty { height: 5px; }

.draft-statute-editor {
    display: block;
    width: calc(100% - 38px);
    min-height: 720px;
    margin: 19px;
    padding: 24px;
    resize: vertical;
    border: 1px solid #cdd4d9;
    border-radius: 7px;
    background: #fbfcfd;
    color: #20272d;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 0.94rem;
    line-height: 1.55;
    box-sizing: border-box;
}
.draft-statute-editor:focus { outline: 3px solid rgba(25, 118, 210, 0.13); border-color: #1976d2; background: #fff; }
.draft-editor-footer { padding: 0 19px 18px; color: var(--text-muted); font-size: 0.76rem; }
.draft-editor-actions { display: flex; gap: 8px; }
.draft-dirty-indicator { padding: 5px 8px; border-radius: 5px; font-size: 0.7rem; font-weight: 800; white-space: nowrap; }
.draft-dirty-indicator.dirty { color: #8a5700; background: #fff3d6; }
.draft-dirty-indicator.saved { color: #2e7d32; background: #e8f5e9; }

.statute-publish-panel,
.statute-history-panel {
    margin-top: 18px;
    overflow: hidden;
    border: 1px solid #dce1e5;
    border-radius: 9px;
    background: #fff;
}
.statute-publish-panel > summary,
.statute-history-panel > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 16px 18px;
    cursor: pointer;
    font-weight: 800;
    list-style: none;
}
.statute-publish-panel > summary::-webkit-details-marker,
.statute-history-panel > summary::-webkit-details-marker { display: none; }
.statute-publish-panel > summary span { display: flex; align-items: center; gap: 9px; }
.statute-publish-panel > summary i { color: #9b1c1c; }
.statute-publish-panel > summary small { color: var(--text-muted); font-weight: 600; }
.statute-publish-content { padding: 0 18px 20px; border-top: 1px solid #eceff1; }
.statute-warning-box { display: flex; gap: 13px; margin: 18px 0; padding: 14px; border: 1px solid #efc5c5; border-radius: 7px; background: #fff6f6; color: #7b2525; }
.statute-warning-box > i { margin-top: 2px; }
.statute-warning-box p { margin-top: 3px; font-size: 0.8rem; line-height: 1.45; }
.statute-publish-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.statute-publish-form .form-group { margin-bottom: 13px; }
.statute-publish-error { min-height: 21px; color: #c62828; font-size: 0.8rem; font-weight: 700; }
.statute-publish-restricted { padding: 14px; border-radius: 7px; background: #f3f5f6; color: #6d7880; text-align: center; }
.btn-danger { padding: 10px 15px; border: 0; border-radius: 6px; background: #b71c1c; color: #fff; cursor: pointer; font-weight: 800; }
.btn-danger:hover { background: #8e1414; }
.btn-danger:disabled { opacity: 0.55; cursor: wait; }

.statute-history-panel { margin-bottom: 20px; }
.statute-history-panel > summary { justify-content: flex-start; }
.statute-history-list { border-top: 1px solid #eceff1; }
.statute-history-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 13px 17px; border-bottom: 1px solid #edf0f2; }
.statute-history-row:last-child { border-bottom: 0; }
.statute-history-row strong,
.statute-history-row span { display: block; }
.statute-history-row span { margin-top: 3px; color: var(--text-muted); font-size: 0.75rem; }
.statute-history-empty { padding: 22px; color: var(--text-muted); text-align: center; font-size: 0.82rem; }
.statute-history-modal-content { max-width: 980px; max-height: 92vh; overflow-y: auto; }
.statute-history-document { padding-top: 20px; }

@media (max-width: 700px) {
    .statute-page-header,
    .statute-card-header,
    .draft-editor-footer { align-items: stretch; flex-direction: column; }
    .statute-main-status { text-align: left; }
    .statute-document { padding: 25px 18px 35px; font-size: 0.88rem; }
    .draft-statute-editor { min-height: 560px; padding: 15px; }
    .draft-editor-actions { flex-direction: column-reverse; }
    .draft-editor-actions button { width: 100%; }
    .statute-publish-grid { grid-template-columns: 1fr; gap: 0; }
    .statute-publish-panel > summary { align-items: flex-start; flex-direction: column; }
    .statute-history-row { align-items: stretch; flex-direction: column; }
}

/* ==========================================
   GRAFIK WYJAZDOWYCH
   ========================================== */
.departure-schedule-section { color: var(--text-main); }

.departure-schedule-header,
.departure-schedule-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.departure-schedule-header p {
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.departure-month-navigation { display: flex; align-items: center; gap: 7px; }
.departure-nav-button,
.departure-today-button {
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: #fff;
    color: var(--text-main);
    cursor: pointer;
    font-weight: 600;
}
.departure-nav-button:hover,
.departure-today-button:hover { border-color: var(--fire-red); color: var(--fire-red); }
.departure-nav-button { width: 38px; padding: 8px; }

.departure-schedule-status-row { margin: 22px 0 10px; }
.departure-schedule-status-row h3 { text-transform: capitalize; }
.departure-save-status { min-height: 20px; font-size: 0.82rem; font-weight: 700; }
.departure-save-status.saving { color: #8a6600; }
.departure-save-status.success { color: #218838; }
.departure-save-status.error { color: #c62828; }

.departure-schedule-loading {
    padding: 34px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    color: var(--text-muted);
}

.departure-calendar-scroll {
    overflow-x: auto;
    border: 1px solid #cfd5da;
    border-radius: 8px;
    background: #fff;
}

.departure-calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(175px, 1fr));
    min-width: 1225px;
}

.departure-weekday {
    padding: 10px 8px;
    border-right: 1px solid #dfe3e6;
    background: #2f3b46;
    color: #fff;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 700;
}
.departure-weekday:nth-child(7) { border-right: 0; }

.departure-day {
    min-height: 252px;
    padding: 8px;
    border-top: 1px solid #dfe3e6;
    border-right: 1px solid #dfe3e6;
    background: #fff;
    transition: background-color 0.18s, box-shadow 0.18s;
}
.departure-day:nth-child(7n) { border-right: 0; }
.departure-day-empty { background: #f2f4f5; }
.departure-day.is-today { background: #fff8f7; box-shadow: inset 0 0 0 2px var(--fire-red); }
.departure-day.is-saving { background: #fffceb; }
.departure-day.save-success { background: #f0fff3; }
.departure-day.save-error { box-shadow: inset 0 0 0 2px #c62828; }

.departure-day-number {
    width: 27px;
    height: 27px;
    margin: 0 0 7px auto;
    border-radius: 50%;
    text-align: center;
    line-height: 27px;
    font-size: 0.8rem;
    font-weight: 800;
}
.departure-day.is-today .departure-day-number { background: var(--fire-red); color: #fff; }

.departure-role-row { display: block; margin-bottom: 6px; }
.departure-role-row span {
    display: block;
    margin-bottom: 2px;
    color: #59636c;
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
}
.departure-member-select {
    width: 100%;
    min-width: 0;
    height: 27px;
    padding: 2px 5px;
    border: 1px solid #ccd2d7;
    border-radius: 5px;
    background: #fff;
    color: #27313a;
    font-size: 0.72rem;
}
.departure-member-select:focus { outline: 2px solid rgba(211, 47, 47, 0.2); border-color: var(--fire-red); }
.departure-member-select:disabled { opacity: 0.72; }

@media (max-width: 700px) {
    .departure-schedule-header { align-items: stretch; flex-direction: column; }
    .departure-month-navigation { justify-content: space-between; }
    .departure-today-button { flex: 1; }
    .departure-schedule-status-row { align-items: flex-start; flex-direction: column; gap: 4px; }
}

/* ==========================================
   TABLICA ZADAŃ
   ========================================== */
.task-board-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}
.task-board-header p { margin-top: 5px; color: var(--text-muted); font-size: 0.9rem; }
.training-qualification-hint { margin-bottom: 14px; padding: 10px 12px; border: 1px solid #b8d8c2; border-radius: 7px; background: #f0faf3; color: #25633a; font-size: .82rem; font-weight: 700; }

.task-board-loading {
    padding: 38px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    color: var(--text-muted);
    text-align: center;
}

.task-board-columns {
    display: grid;
    grid-template-columns: repeat(3, minmax(250px, 1fr));
    gap: 16px;
    align-items: start;
}
.task-column {
    min-height: 420px;
    overflow: hidden;
    border: 1px solid #dce1e5;
    border-radius: 9px;
    background: #f5f7f8;
    transition: border-color 0.2s, background-color 0.2s;
}
.task-column.drag-over { border-color: #1976d2; background: #eaf4ff; }
.task-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 15px;
    border-bottom: 3px solid transparent;
    background: #fff;
    font-size: 0.88rem;
    font-weight: 800;
}
.task-column-header span { display: flex; align-items: center; gap: 8px; }
.task-column-header.todo { border-bottom-color: #78909c; }
.task-column-header.in-progress { border-bottom-color: #1976d2; }
.task-column-header.done { border-bottom-color: #2e7d32; }
.task-count {
    min-width: 26px;
    height: 26px;
    padding: 0 7px;
    border-radius: 13px;
    background: #edf0f2;
    text-align: center;
    line-height: 26px;
    font-size: 0.75rem;
}
.task-column-list { min-height: 355px; padding: 12px; }
.task-column-empty {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #9aa2a9;
    font-size: 0.82rem;
}
.task-column-empty i { font-size: 1.6rem; }

.task-card {
    margin-bottom: 10px;
    padding: 14px;
    border: 1px solid #dfe3e6;
    border-left: 4px solid #78909c;
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 2px 5px rgba(30, 42, 50, 0.05);
    cursor: grab;
}
.task-column[data-status="in-progress"] .task-card { border-left-color: #1976d2; }
.task-column[data-status="done"] .task-card { border-left-color: #2e7d32; }
.task-card.overdue { border-left-color: #c62828; }
.task-card.dragging { opacity: 0.45; }
.task-card h4 { margin: 0; color: #28323a; font-size: 0.94rem; line-height: 1.35; }
.task-card-description {
    display: -webkit-box;
    overflow: hidden;
    margin: 8px 0;
    color: #64717a;
    font-size: 0.8rem;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}
.task-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.task-due-date { display: flex; align-items: center; gap: 5px; color: #68747c; font-size: 0.74rem; font-weight: 700; }
.task-overdue-label { padding: 3px 6px; border-radius: 4px; background: #ffebee; color: #c62828; font-size: 0.65rem; font-weight: 800; }
.task-card-actions { display: flex; justify-content: flex-end; gap: 5px; margin-top: 12px; padding-top: 10px; border-top: 1px solid #edf0f2; }
.task-card-button {
    width: 30px;
    height: 30px;
    border: 1px solid #d8dde1;
    border-radius: 5px;
    background: #fff;
    color: #59656e;
    cursor: pointer;
}
.task-card-button:hover:not(:disabled) { border-color: #90caf9; background: #eaf4ff; color: #1565c0; }
.task-card-button:disabled { opacity: 0.3; cursor: not-allowed; }
.task-card-button.task-delete-button:hover { border-color: #ef9a9a; background: #ffebee; color: #c62828; }

.task-modal-content { max-width: 650px; }
.task-form-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.task-history-modal { max-width: 780px; }
.task-history-filters { display: grid; grid-template-columns: 160px 130px 1fr; gap: 10px; margin: 15px 0; }
.task-history-filters label { display: flex; flex-direction: column; gap: 5px; color: #536170; font-size: .76rem; font-weight: 700; }
.task-history-filters select, .task-history-filters input { height: 39px; border: 1px solid #cbd5e1; border-radius: 6px; padding: 0 10px; background: #fff; }
.task-history-list { display: grid; gap: 10px; max-height: 62vh; overflow-y: auto; padding: 2px; }
.task-history-list .task-card { border-left-color: #2e7d32; }
.action-attachment-list { display: grid; gap: 7px; margin: 10px 0 0; padding: 0; list-style: none; }
.action-attachment-list li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid #dbe4ee; border-radius: 6px; background: #fff; }
.action-attachment-list a { flex: 1; min-width: 0; overflow: hidden; color: #1565c0; text-overflow: ellipsis; white-space: nowrap; }
.action-attachment-list span { color: #718096; font-size: .74rem; }
.contact-search-label { display: block; color: #475569; font-size: .74rem; font-weight: 700; }
.contact-search-field { margin-top: 5px; margin-bottom: 16px; }
.contacts-list { display: grid; gap: 10px; }
.contact-card { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(220px, 1fr) auto; align-items: center; gap: 15px; padding: 15px 17px; border: 1px solid #dde4ea; border-radius: 9px; background: #fff; box-shadow: 0 2px 7px rgba(15, 23, 42, .04); }
.contact-card-identity strong, .contact-card-identity span { display: block; }
.contact-card-identity strong { color: #27313b; font-size: .96rem; }
.contact-card-identity span { margin-top: 4px; color: #74808b; font-size: .78rem; }
.contact-card-details { display: grid; gap: 5px; }
.contact-card-details a { display: flex; align-items: center; gap: 8px; min-width: 0; color: #315b78; text-decoration: none; font-size: .84rem; }
.contact-card-details a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-card-actions { display: flex; gap: 6px; }
.contact-card-actions button { width: 34px; height: 34px; border: 1px solid #dbe1e7; border-radius: 6px; background: #fff; color: #1976d2; cursor: pointer; }
.contact-card-actions button:last-child { color: #c62828; }
.contacts-empty { display: grid; place-items: center; gap: 8px; min-height: 180px; border: 1px dashed #cbd5e1; border-radius: 9px; color: #718096; }
@media (max-width: 720px) { .contact-card { grid-template-columns: 1fr auto; } .contact-card-details { grid-column: 1 / -1; grid-row: 2; } }
.task-form-error { min-height: 20px; margin-top: 8px; color: #c62828; font-size: 0.8rem; font-weight: 700; }
.task-modal-footer { display: flex; justify-content: flex-end; gap: 9px; margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--border-color); }

@media (max-width: 950px) {
    .task-board-columns { grid-template-columns: 1fr; }
    .task-column { min-height: 220px; }
    .task-column-list { min-height: 150px; }
}
@media (max-width: 600px) {
    .task-board-header { align-items: stretch; flex-direction: column; }
    .task-board-header .btn-primary { width: 100%; }
    .task-form-row { grid-template-columns: 1fr; gap: 0; }
    .task-history-filters { grid-template-columns: 1fr 1fr; }
    .task-history-search { grid-column: 1 / -1; }
    .task-modal-footer { flex-direction: column-reverse; }
    .task-modal-footer button { width: 100%; }
}

/* =========================================
   FINANSE
   ========================================= */
.finances-section-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 20px; }
.finances-description { margin-top: 5px; color: var(--text-muted); font-size: .9rem; }
.finances-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.finances-header-actions button { white-space: nowrap; }

.finance-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.finance-summary-card { min-width: 0; display: flex; align-items: center; gap: 12px; padding: 15px; background: #fff; border: 1px solid #e3e8ee; border-radius: 9px; box-shadow: 0 2px 7px rgba(15, 23, 42, .05); }
.finance-summary-card > i { flex: 0 0 auto; display: grid; place-items: center; width: 39px; height: 39px; border-radius: 9px; color: #fff; background: #64748b; }
.finance-summary-card div { min-width: 0; }
.finance-summary-card span { display: block; margin-bottom: 3px; color: #64748b; font-size: .73rem; font-weight: 700; text-transform: uppercase; line-height: 1.2; }
.finance-summary-card strong { display: block; color: #1f2937; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.finance-summary-bank > i { background: #2563eb; }
.finance-summary-cash > i { background: #7c3aed; }
.finance-summary-income > i, .finance-summary-positive > i { background: #168a52; }
.finance-summary-expense > i, .finance-summary-negative > i { background: #c73b3b; }

.finance-alerts:empty { display: none; }
.finance-alert { display: flex; align-items: flex-start; gap: 10px; margin: 12px 0; padding: 11px 13px; border: 1px solid #f0d58a; border-radius: 7px; background: #fff9e8; color: #7a5610; font-size: .84rem; }
.finance-alert i { margin-top: 2px; color: #b7791f; }

.finance-filters-panel { margin-bottom: 16px; padding: 15px; border: 1px solid #dce3ea; border-radius: 9px; background: #fff; box-shadow: 0 2px 7px rgba(15, 23, 42, .04); }
.finance-filters-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.finance-filters-heading > div { display: flex; align-items: center; gap: 10px; }
.finance-filters-heading > div > i { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: #eef2f7; color: #475569; }
.finance-filters-heading span span, .finance-filters-heading strong, .finance-filters-heading small { display: block; }
.finance-filters-heading small { margin-top: 2px; color: #718096; font-size: .75rem; }
.finance-results-count { padding: 6px 10px; border-radius: 999px; background: #eef2f7; color: #475569; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.finance-filters-grid { display: grid; grid-template-columns: .8fr .65fr 1fr .8fr 1.35fr 1.7fr auto; gap: 9px; align-items: end; }
.finance-filters-grid > label { display: flex; flex-direction: column; gap: 5px; color: #475569; font-size: .74rem; font-weight: 700; }
.finance-filters-grid select, .finance-filters-grid input { width: 100%; height: 39px; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; padding: 0 9px; color: #263238; }
.finance-search { position: relative; }
.finance-search i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: #94a3b8; }
.finance-search input { padding-left: 33px; }
.finance-reset-button { height: 39px; padding: 0 13px; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; color: #475569; cursor: pointer; white-space: nowrap; }
.finance-reset-button:hover { background: #f8fafc; }

.finance-list { display: flex; flex-direction: column; gap: 8px; }
.finance-row { display: flex; align-items: stretch; overflow: hidden; border: 1px solid #e0e6ec; border-radius: 8px; background: #fff; box-shadow: 0 2px 6px rgba(15, 23, 42, .04); }
.finance-row-main { flex: 1; min-width: 0; display: grid; grid-template-columns: 92px minmax(220px, 1fr) minmax(125px, auto) 125px; align-items: center; gap: 14px; padding: 13px 15px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.finance-row-main:hover { background: #fafbfc; }
.finance-row-main time { color: #475569; font-size: .82rem; font-weight: 700; }
.finance-row-copy { min-width: 0; }
.finance-row-copy > strong, .finance-row-copy > small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.finance-row-copy > strong { color: #27313b; font-size: .92rem; }
.finance-row-copy > small { margin-top: 3px; color: #7b8794; font-size: .76rem; }
.finance-category-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.finance-category-tags span { padding: 3px 7px; border-radius: 999px; background: #edf2f7; color: #526274; font-size: .68rem; }
.finance-row-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; color: #657384; font-size: .76rem; }
.finance-row-meta > span { white-space: nowrap; }
.finance-row-meta i { width: 16px; text-align: center; }
.finance-warning { padding: 3px 6px; border-radius: 4px; background: #fff4d6; color: #8b6212; font-weight: 700; }
.finance-amount { text-align: right; font-size: 1rem; white-space: nowrap; }
.finance-amount-income { color: #13834d; }
.finance-amount-expense { color: #c23a3a; }
.finance-amount-classification { color: #6b7280; }
.finance-row-actions { display: flex; flex-direction: column; justify-content: center; gap: 5px; padding: 8px; border-left: 1px solid #edf0f3; background: #fbfcfd; }
.finance-row-actions button { width: 32px; height: 31px; border: 1px solid #d8dee5; border-radius: 5px; background: #fff; color: #667481; cursor: pointer; }
.finance-row-actions button:hover { color: var(--fire-red); border-color: #e9b4b4; }
.finance-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 170px; gap: 8px; padding: 25px; border: 1px dashed #cbd5e1; border-radius: 9px; color: #718096; text-align: center; }
.finance-empty > i { font-size: 1.5rem; color: #94a3b8; }

.finance-modal-content { max-width: 820px; }
.finance-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.finance-form-wide { grid-column: span 2; }
.finance-money-input { position: relative; }
.finance-money-input input { width: 100%; padding-right: 36px !important; }
.finance-money-input span { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: #7b8794; font-size: .78rem; pointer-events: none; }
.finance-split-toggle { display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; padding: 12px; border: 1px solid #dce3ea; border-radius: 7px; background: #f8fafc; cursor: pointer; }
.finance-split-toggle input { margin-top: 3px; }
.finance-split-toggle strong, .finance-split-toggle small { display: block; }
.finance-split-toggle small { margin-top: 2px; color: #718096; font-size: .76rem; }
.finance-split-area { margin-top: 12px; padding: 13px; border: 1px solid #dce3ea; border-radius: 7px; background: #fbfcfd; }
.finance-split-area[hidden] { display: none; }
.finance-split-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.finance-split-heading button { padding: 7px 10px; font-size: .78rem; }
.finance-split-row { display: grid; grid-template-columns: minmax(0, 1fr) 145px 34px; gap: 8px; margin-top: 7px; }
.finance-split-row select, .finance-split-row input { width: 100%; height: 38px; border: 1px solid #cbd5e1; border-radius: 6px; padding: 0 9px; background: #fff; }
.finance-split-row button { border: 1px solid #e3b8b8; border-radius: 6px; background: #fff; color: #b43b3b; cursor: pointer; }
.finance-split-total { margin-top: 9px; font-size: .78rem; font-weight: 700; text-align: right; }
.finance-split-total.is-valid { color: #168a52; }
.finance-split-total.is-invalid { color: #b45309; }
.finance-notes { margin-top: 14px; }
.finance-form-error { margin-top: 12px; padding: 10px 12px; border: 1px solid #e8b6b6; border-radius: 6px; background: #fff1f1; color: #a52d2d; font-size: .82rem; }
.finance-form-error[hidden] { display: none; }
.finance-modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid #e6eaf0; }
.finance-form-help { margin-bottom: 15px; color: #657384; font-size: .85rem; line-height: 1.45; }
.finance-balances-modal { max-width: 620px; }

.finance-details-hero { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 16px; border-left: 4px solid #2563eb; border-radius: 7px; background: #f8fafc; }
.finance-details-hero span, .finance-details-hero small { display: block; color: #718096; font-size: .78rem; }
.finance-details-hero h3 { margin: 4px 0; color: #263238; }
.finance-details-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 14px; }
.finance-details-grid > div { padding: 11px; border: 1px solid #e1e6eb; border-radius: 6px; }
.finance-details-grid span, .finance-details-grid strong { display: block; }
.finance-details-grid span { margin-bottom: 3px; color: #718096; font-size: .72rem; text-transform: uppercase; }
.finance-details-grid strong { font-size: .86rem; }
.finance-details-section { margin-top: 14px; padding: 14px; border: 1px solid #e1e6eb; border-radius: 7px; }
.finance-details-section h4 { margin-bottom: 9px; }
.finance-details-section > div { display: flex; justify-content: space-between; gap: 15px; padding: 7px 0; border-top: 1px solid #edf0f3; font-size: .84rem; }
.finance-details-section > div:first-of-type { border-top: 0; }
.finance-details-section p { white-space: pre-wrap; color: #52606d; line-height: 1.5; }

@media (max-width: 1150px) {
    .finance-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .finance-filters-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .finance-search-label { grid-column: span 2; }
}

@media (max-width: 760px) {
    .finances-section-header { flex-direction: column; }
    .finances-header-actions { width: 100%; }
    .finances-header-actions button { flex: 1; }
    .finance-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .finance-filters-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .finance-search-label { grid-column: 1 / -1; }
    .finance-row-main { grid-template-columns: 82px 1fr auto; gap: 9px; }
    .finance-row-meta { display: none; }
    .finance-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .finance-details-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
    .finance-summary { gap: 8px; }
    .finance-summary-card { padding: 10px; gap: 8px; }
    .finance-summary-card > i { width: 34px; height: 34px; }
    .finance-summary-card strong { font-size: .92rem; }
    .finance-filters-heading { align-items: flex-start; }
    .finance-filters-heading small { display: none; }
    .finance-filters-grid, .finance-form-grid { grid-template-columns: 1fr; }
    .finance-form-wide, .finance-search-label { grid-column: auto; }
    .finance-row-main { grid-template-columns: 1fr auto; padding: 11px; }
    .finance-row-main time { grid-column: 1 / -1; }
    .finance-row-copy > strong, .finance-row-copy > small { white-space: normal; }
    .finance-row-actions { padding: 5px; }
    .finance-split-row { grid-template-columns: 1fr 110px 34px; }
    .finance-details-hero { align-items: flex-start; flex-direction: column; }
    .finance-modal-footer { flex-direction: column-reverse; }
    .finance-modal-footer button { width: 100%; }
}

/* Powiązanie pojazdów i sprzętu z dofinansowaniami */
.funding-fieldset {
    border-color: #eadfae;
    background: #fffdf5;
}

.funding-fieldset legend {
    color: #8a6200;
}

.funding-fieldset legend i {
    margin-right: 5px;
}

.funding-checkbox-row {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 600;
}

.funding-checkbox-row input {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    accent-color: var(--fire-red);
}

.funding-select-wrap {
    margin-top: 13px;
    padding-top: 13px;
    border-top: 1px solid #eadfae;
}

.funding-select-wrap[hidden] {
    display: none;
}

.funding-select-wrap small {
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.asset-funding-section .section-title i {
    color: #a66d00;
}

.asset-funding-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid #eadfae;
    border-radius: 7px;
    background: #fffdf5;
}

.asset-funding-card label {
    display: block;
    margin-bottom: 4px;
    color: var(--text-muted);
    font-size: 0.73rem;
    font-weight: 700;
    text-transform: uppercase;
}

.asset-funding-card strong {
    color: #5f4700;
    font-size: 0.98rem;
}

.asset-grant-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 12px;
    border: 1px solid #d5b85b;
    border-radius: 5px;
    background: #fff;
    color: #7d5900;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, border-color 0.2s;
}

.asset-grant-link:hover {
    background: #fff6d8;
    border-color: #b89019;
}

.asset-grant-missing {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-style: italic;
}

@media (max-width: 600px) {
    .asset-funding-card {
        align-items: stretch;
        flex-direction: column;
    }

    .asset-grant-link {
        width: 100%;
    }
}

/* =========================================
   DOFINANSOWANIA
   ========================================= */
.grants-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.grants-section-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.grants-section-header h2 i {
    color: var(--fire-red);
}

.grants-section-description {
    color: var(--text-muted);
    margin-top: 5px;
    font-size: 0.9rem;
}

.grants-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.grant-summary-card {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 76px;
    padding: 14px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.grant-summary-card > i {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 8px;
    color: #455a64;
    background: #eceff1;
}

.grant-summary-card span {
    display: block;
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-bottom: 2px;
}

.grant-summary-card strong {
    display: block;
    font-size: 1.35rem;
    color: var(--text-main);
}

.grant-summary-progress > i { color: #a66300; background: #fff3d6; }
.grant-summary-awarded > i { color: #2e7d32; background: #e8f5e9; }
.grant-summary-settled > i { color: #1565c0; background: #e3f2fd; }

.grant-list-item {
    gap: 18px;
    padding: 16px 18px;
}

.grant-list-main {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    min-width: 0;
    cursor: pointer;
    outline: none;
}

.grant-list-main:focus-visible {
    border-radius: 5px;
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.12);
}

.grant-list-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 8px;
    color: var(--fire-red);
    background: rgba(211, 47, 47, 0.09);
    font-size: 1.1rem;
}

.grant-list-copy {
    min-width: 0;
    flex: 1;
}

.grant-list-heading {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 5px;
}

.grant-list-heading > strong {
    font-size: 1rem;
    color: var(--text-main);
}

.grant-list-purpose {
    color: #4d555c;
    font-size: 0.9rem;
    line-height: 1.4;
}

.grant-list-meta {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-top: 6px;
}

.grant-list-meta i { margin-right: 4px; }

.grant-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 14px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
    color: #8a5700;
    background: #fff3d6;
}

.grant-status-submitted { color: #1565c0; background: #e3f2fd; }
.grant-status-awarded { color: #2e7d32; background: #e8f5e9; }
.grant-status-rejected { color: #c62828; background: #ffebee; }
.grant-status-settled { color: #5e35b1; background: #ede7f6; }

.grant-list-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.grant-action-button {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.grant-edit-button { color: #1976d2; }
.grant-delete-button { color: var(--fire-red); }
.grant-edit-button:hover { background: #e3f2fd; border-color: #90caf9; }
.grant-delete-button:hover { background: #ffebee; border-color: #ef9a9a; }

.grants-empty {
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 25px;
    text-align: center;
    color: var(--text-muted);
    background: var(--card-bg);
    border: 1px dashed #cfd4da;
    border-radius: 8px;
}

.grants-empty > i { color: var(--fire-red); font-size: 1.8rem; margin-bottom: 3px; }
.grants-empty strong { color: var(--text-main); }
.grants-empty span { max-width: 480px; font-size: 0.88rem; line-height: 1.45; }

.grants-modal-content { max-width: 760px; }

.grant-form-intro {
    display: flex;
    gap: 12px;
    padding: 13px 15px;
    margin-bottom: 18px;
    border: 1px solid #bbdefb;
    border-radius: 7px;
    background: #f2f8fd;
    color: #315b78;
}

.grant-form-intro > i { margin-top: 2px; color: #1976d2; }
.grant-form-intro strong { display: block; font-size: 0.88rem; }
.grant-form-intro span { display: block; margin-top: 2px; font-size: 0.8rem; line-height: 1.4; }

.grant-form-grid { grid-template-columns: 1.35fr 0.8fr 1fr; }
.grant-form-grid + .form-group,
.grant-form-grid ~ .form-group { margin-top: 14px; }

.grants-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.grant-details-content { padding-top: 2px; }

.grant-details-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 16px;
    border-radius: 8px;
    background: #f8f9fa;
    border-left: 4px solid var(--fire-red);
}

.grant-details-hero > div > span {
    display: block;
    color: var(--text-muted);
    font-size: 0.74rem;
    text-transform: uppercase;
    font-weight: 700;
}

.grant-details-hero h3 { margin-top: 4px; font-size: 1.2rem; }

.grant-details-date {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 0 4px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.grant-details-date i { color: var(--fire-red); }
.grant-details-date strong { color: var(--text-main); }

.grant-details-section {
    margin-top: 16px;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
}

.grant-details-section h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: #3d454c;
}

.grant-details-section h4 i { color: var(--fire-red); }
.grant-details-section p { white-space: pre-wrap; line-height: 1.55; color: #50575e; }
.grant-requirements-section { background: #fffdf4; border-color: #eadfae; }
.grant-requirements-section h4 i { color: #a66300; }

@media (max-width: 850px) {
    .grants-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grant-form-grid { grid-template-columns: 1fr 1fr; }
    .grant-form-grid .form-group:first-child { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
    .grants-section-header { align-items: stretch; flex-direction: column; }
    .grants-section-header .btn-primary { width: 100%; }
    .grants-summary { grid-template-columns: 1fr 1fr; gap: 8px; }
    .grant-summary-card { min-height: 68px; padding: 10px; gap: 9px; }
    .grant-summary-card > i { width: 34px; height: 34px; }
    .grant-list-item { align-items: flex-start; gap: 10px; }
    .grant-list-icon { display: none; }
    .grant-list-actions { flex-direction: column; }
    .grant-form-grid { grid-template-columns: 1fr; }
    .grant-form-grid .form-group:first-child { grid-column: auto; }
    .grant-details-hero { align-items: flex-start; flex-direction: column; }
    .grants-modal-footer { flex-direction: column-reverse; }
    .grants-modal-footer button { width: 100%; }
}
