/* Reset i podstawowe style */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: #2c3e50;
    background: #f8f9fa;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header - Profesjonalny, ciemny */
header {
    background: #1a365d;
    color: #ffffff;
    padding: 12px 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.25em;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.02em;
}

header h1 a.header-title-link {
    color: #ffffff;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

header h1 a.header-title-link:hover {
    opacity: 0.9;
}

nav {
    display: flex;
    gap: 8px;
}

nav a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 10px;
    transition: all 0.2s ease;
    font-size: 0.9em;
    font-weight: 500;
}

nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

nav a.nav-active {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* Main content */
main {
    min-height: calc(100vh - 180px);
}

main.container {
    padding-top: 24px;
}

/* Page header */
.page-header {
    margin-top: 0;
    margin-bottom: 22px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h2 {
    font-size: 1.60em;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    letter-spacing: -0.01em;
}

.page-header p {
    color: #6c757d;
    font-size: 0.95em;
    margin-top: 4px;
}

.page-actions,
.page-header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Buttons - Stonowane, profesjonalne */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9em;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    cursor: pointer;
    line-height: 1.4;
}

.btn-primary {
    background: #495057;
    color: #ffffff;
    border-color: #495057;
}

.btn-primary:hover {
    background: #343a40;
    border-color: #343a40;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Przycisk "Zobacz szczegóły" w kafelkach raportów – kolor jak navbar */
.btn-report-details {
    background: #1a365d;
    color: #ffffff;
    border-color: #1a365d;
}

.btn-report-details:hover {
    background: #2c5282;
    border-color: #2c5282;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 54, 93, 0.35);
}

/* Primary w modalu edycji – ten sam kolor co navbar */
.modal-dialog--edit .btn-primary {
    background: #1a365d;
    border-color: #1a365d;
}
.modal-dialog--edit .btn-primary:hover {
    background: #2c5282;
    border-color: #2c5282;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 54, 93, 0.35);
}

.btn-secondary {
    background: #ffffff;
    color: #495057;
    border-color: #dee2e6;
}

.btn-secondary:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.btn-outline {
    background: transparent;
    color: #495057;
    border-color: #dee2e6;
}

.btn-outline:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

/* Mniejsze przyciski (np. "Pobierz", "Edytuj" w listach zadań / wydarzeń) */
.btn-small {
    padding: 4px 10px;
    font-size: 0.85em;
    min-width: 100px;
    letter-spacing: 0.5px;
}

/* Reports grid - Nowoczesne karty */
.reports-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 24px;
}

.report-card {
    width: fit-content;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    overflow: hidden;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.report-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-color: #dee2e6;
}

.report-card-header {
    background: #f8f9fa;
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e9ecef;
}

.report-card-header h3 {
    margin: 0;
    font-size: 1.25em;
    font-weight: 600;
    color: #2c3e50;
    letter-spacing: -0.01em;
}

.report-card-body {
    padding: 12px 14px;
}

.report-date {
    color: #6c757d;
    font-size: 0.875em;
    margin-bottom: 10px;
}

/* Badges - Subtelne, profesjonalne kolory */
.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.8em;
    font-weight: 500;
    letter-spacing: 0.01em;
    white-space: nowrap;
    line-height: 1.4;
}

.badge-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.badge-secondary {
    background: #f5f5f5;
    color: #616161;
    border: 1px solid #e0e0e0;
}

.badge-info {
    background: #f0f4f8;
    color: #495057;
    border: 1px solid #dee2e6;
    font-weight: 500;
}

/* Empty state */
.empty-state {
    padding: 24px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.empty-state p {
    font-size: 0.9em;
    color: #6c757d;
    margin: 0;
}

.text-muted {
    color: #6c757d;
    font-size: 0.9em;
}

/* Error container */
.error-container {
    text-align: center;
    padding: 80px 24px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.error-message {
    font-size: 1.1em;
    color: #dc3545;
    margin: 20px 0;
}

/* Footer - Minimalistyczny */
footer {
    background: #ffffff;
    color: #6c757d;
    padding: 32px 0;
    text-align: center;
    margin-top: 60px;
    border-top: 1px solid #e9ecef;
}

footer p {
    margin: 0;
    font-size: 0.875em;
}

/* Stats bar - Profesjonalny */
.stats-bar {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
    padding: 20px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 0.85em;
    color: #6c757d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.75em;
    font-weight: 600;
    color: #2c3e50;
    letter-spacing: -0.02em;
}

/* Table - Nowoczesna, profesjonalna, szeroka */
.table-container {
    overflow-x: auto;
    margin-top: 24px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    width: 100%;
}

.hearings-table {
    width: 100%;
    min-width: 1400px;
    border-collapse: collapse;
    background: #ffffff;
    font-size: 0.9em;
    table-layout: auto;
}

.hearings-table th {
    background: #f8f9fa;
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #e9ecef;
    position: sticky;
    top: 0;
    z-index: 10;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: normal;
    min-width: 100px;
}

.hearings-table th:nth-child(1) {
    min-width: 140px; /* Termin rozprawy */
}

.hearings-table th:nth-child(2) {
    min-width: 350px; /* Sprawa */
}

.hearings-table th:nth-child(3) {
    min-width: 100px; /* I rozprawa */
}

.hearings-table th:nth-child(4) {
    min-width: 90px; /* Świadkowie */
}

.hearings-table th:nth-child(5) {
    min-width: 280px; /* Sędzia + sąd */
}

.hearings-table th:nth-child(6) {
    min-width: 90px; /* Replika */
}

.hearings-table th:nth-child(7) {
    min-width: 140px; /* Zdalna/Stacjonarna */
}

.hearings-table th:nth-child(8) {
    min-width: 180px; /* Stan sprawy */
}

.hearings-table th:nth-child(9) {
    min-width: 90px; /* Ankieta */
}

.hearings-table th:nth-child(10) {
    min-width: 90px; /* Pkt 10 */
}

.hearings-table th:nth-child(11) {
    min-width: 200px; /* Pełnomocnik (Poznań) */
}

.hearings-table th:nth-child(12) {
    min-width: 150px; /* Decyzja o udziale */
}

.hearings-table th:nth-child(13) {
    min-width: 140px; /* Data wysyłki UPO */
}

.hearings-table td {
    padding: 14px 20px;
    border-bottom: 1px solid #f1f3f5;
    color: #495057;
    vertical-align: top;
    word-wrap: break-word;
    line-height: 1.5;
}

.hearings-table tbody tr {
    transition: background 0.15s ease;
}

.hearings-table tbody tr:hover {
    background: #f8f9fa;
}

.hearings-table tbody tr:last-child td {
    border-bottom: none;
}

/* Responsive */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    nav {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }

    nav a {
        flex: 1;
        text-align: center;
        min-width: 120px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }


    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .hearings-table {
        min-width: 1400px;
    }

    .stats-bar {
        flex-direction: column;
        gap: 16px;
    }
}

/* Dodatkowe style dla lepszej czytelności */
.page-header p {
    color: #6c757d;
    font-size: 0.95em;
    margin: 0;
}

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

.report-card {
    animation: fadeIn 0.3s ease;
}

/* Lepsze style dla długich tekstów - szerokie kolumny */
.hearings-table td:nth-child(2) {
    max-width: 400px; /* Sprawa - szersza kolumna */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.hearings-table td:nth-child(5) {
    max-width: 320px; /* Sędzia + sąd - szersza kolumna */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.hearings-table td:nth-child(8) {
    max-width: 220px; /* Stan sprawy - szersza kolumna */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.hearings-table td:nth-child(11) {
    max-width: 220px; /* Pełnomocnik (Poznań) - szersza kolumna */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.hearings-table td:nth-child(12) {
    max-width: 180px; /* Decyzja o udziale */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.hearings-table td:nth-child(13) {
    max-width: 160px; /* Data wysyłki UPO */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Formularz logowania i alerty */
.card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    padding: 32px;
    max-width: 480px;
    margin: 0 auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.form-login {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

.form-login label {
    display: flex;
    flex-direction: column;
    font-weight: 500;
    color: #495057;
    gap: 6px;
}

.form-login input {
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 10px;
    font-size: 1em;
    transition: border-color 0.2s ease;
}

.form-login input:focus {
    outline: none;
    border-color: #495057;
    box-shadow: 0 0 0 2px rgba(73, 80, 87, 0.15);
}

.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.9em;
}

.alert-error {
    background: #fdecef;
    border: 1px solid #f5c2c7;
    color: #842029;
}

.user-pill {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.85em;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Widok logowania - układ */
.auth-layout {
    min-height: 100vh;
    background: linear-gradient(135deg, #dfe7f3, #f9fbff);
}

.auth-layout header {
    background: transparent;
    color: #2c3e50;
    box-shadow: none;
    border: none;
}

.auth-layout header .header-title-link {
    color: #2c3e50;
}

.login-wrapper {
    display: grid;
    grid-template-columns: minmax(320px, 480px);
    justify-content: center;
    padding: 60px 0;
}

.login-wrapper.only-form {
    grid-template-columns: minmax(320px, 420px);
}

.login-card {
    width: 100%;
    padding: 40px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.05);
    box-shadow:
        0 16px 40px rgba(15, 23, 42, 0.1),
        0 6px 20px rgba(15, 23, 42, 0.08);
}

.card-header {
    margin-bottom: 24px;
}

.card-badge {
    display: inline-flex;
    padding: 6px 14px;
    border-radius: 999px;
    background: #ecf2ff;
    color: #2643d3;
    font-size: 0.85em;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.card-header h3 {
    margin: 0;
    font-size: 1.5em;
    color: #1f2937;
}

.card-header p {
    margin: 8px 0 0 0;
    color: #6b7280;
    font-size: 0.95em;
}

.btn-full {
    width: 100%;
    justify-content: center;
    font-size: 1em;
    padding: 12px;
}

.login-hint {
    margin-top: 16px;
    font-size: 0.85em;
    color: #6c757d;
    text-align: center;
}
@media (max-width: 768px) {
    .login-card {
        padding: 32px;
    }
}

/* Paginacja */
/* Filtr statusu na stronie Lista zadań */
.task-list-filter {
    margin-bottom: 16px;
}

.task-list-filter-inner {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.task-list-filter-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #ffffff;
    color: #495057;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.task-list-filter-link:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    color: #2c3e50;
}

.task-list-filter-link.active {
    background: #1a365d;
    border-color: #1a365d;
    color: #ffffff;
    cursor: default;
}

.pagination {
    margin-top: 24px;
    display: flex;
    justify-content: center;
}

.pagination-inner {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.9em;
    font-weight: 500;
    text-decoration: none;
    color: #495057;
    background: #ffffff;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
}

.pagination-link:hover:not(.disabled):not(.active) {
    background: #f8f9fa;
    border-color: #adb5bd;
    color: #2c3e50;
}

.pagination-link.active {
    background: #1a365d;
    border-color: #1a365d;
    color: #ffffff;
    cursor: default;
}

.pagination-link.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    color: #6c757d;
}

/* Sprawy – layout dwukolumnowy */
.cases-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 180px);
}

/* Lista zadań – jedna kolumna, pełna wysokość */
.task-list-page .cases-panel {
    max-height: none;
    width: 100%;
}

#cases-list-container {
    flex: 1 1 auto;
    overflow-y: auto;
    padding-right: 4px; /* miejsce na scrollbar */
}

.documents-panel {
    min-width: 0;
    position: sticky;
    top: 0;
}

.documents-panel-title {
    margin: 0 0 16px 0;
    font-size: 1.15em;
    font-weight: 600;
    color: #2c3e50;
}

.documents-placeholder {
    padding: 24px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.documents-placeholder p {
    margin: 0;
}

.documents-container .table-container {
    margin-top: 0;
}

.case-row {
    cursor: pointer;
}

.case-row.selected {
    background: #e9ecef;
}

.case-row:hover {
    background: #f8f9fa;
}

.case-row.selected:hover {
    background: #dee2e6;
}

/* Tabela spraw – dwa wiersze na sprawę, mieszczące się w szerokości okna */
.cases-table-twolines {
    min-width: 0;
    table-layout: fixed;
    width: 100%;
}

.cases-table-twolines th,
.cases-table-twolines td {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    line-height: 1.4;
    padding: 10px 12px;
    font-size: 0.875em;
}

.cases-table-twolines thead tr:first-child th {
    border-bottom: 1px solid #e9ecef;
}

.cases-table-twolines .case-row-1 td {
    border-bottom: 1px solid #f1f3f5;
}

.cases-table-twolines .case-row-2 td {
    border-bottom: 1px solid #e9ecef;
}

.cases-table-twolines .case-row-2.selected td,
.cases-table-twolines .case-row-1.selected td {
    border-bottom-color: #dee2e6;
}

.doc-title {
    font-weight: 600;
    color: #2c3e50;
}

.stats-bar-compact {
    margin-bottom: 16px;
}

/* Cases list styles */
.cases-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.case-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    position: relative;
    padding-left: 70px;
}

.case-index {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    font-weight: bold;
    color: #ffffff;
    z-index: 2;
}

.case-task-count {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #f59e0b;
    color: #ffffff;
    font-size: 14px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 8px;
    min-width: 20px;
    text-align: center;
    z-index: 2;
}

.case-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 48px;
    background: #1a365d;
    border-radius: 8px 0 0 8px;
    z-index: 1;
}

.case-card::after {
    content: '';
    position: absolute;
    left: 48px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #d1d5db;
    z-index: 0;
}

.case-card:hover {
    border-color: #9ca3af;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.case-card.selected {
    border-color: #3b82f6;
    border-width: 2px;
    background-color: #eff6ff;
    box-shadow: 0 8px 28px rgba(59, 130, 246, 0.45);
    transform: translateY(-1px);
}

.case-card.case-suspended {
    background-color: #fefce8;
    border-color: #fbbf24;
    overflow: hidden;
}

.case-card.case-suspended::before {
    background: #f59e0b;
}

.case-card.case-suspended::after {
    content: "ZAWIESZONE";
    position: absolute;
    left: 75%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(-28deg);
    width: auto;
    background: transparent;
    font-size: 28px;
    font-weight: bold;
    letter-spacing: 0.05em;
    color: rgba(245, 158, 11, 0.14);
    pointer-events: none;
    z-index: 0;
    white-space: nowrap;
}

.case-card.case-suspended .case-info-grid {
    position: relative;
    z-index: 1;
}

.case-info-grid {
    display: flex;
    flex-direction: column;
}


.case-info-item {
    display: flex;
    align-items: flex-start;
    gap: 3px;
    min-height: 24px;
}

.case-label {
    font-weight: 600;
    color: #374151;
    font-size: 0.875em;
    white-space: nowrap;
    flex-shrink: 0;
}

.case-value {
    color: #1f2937;
    font-size: 0.875em;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

@media (max-width: 1024px) {
    .cases-top-row {
        grid-template-columns: 1fr;
    }

    .cases-main-layout {
        grid-template-columns: 1fr;
    }

    .documents-panel {
        position: static;
    }

    .cases-panel {
        max-height: none;
    }

    #cases-list-container {
        overflow-y: visible;
        padding-right: 0;
    }

    .case-info-grid {
        gap: 8px;
    }


    .case-info-item {
        flex-direction: column;
        gap: 4px;
    }

    .case-label {
        font-size: 0.8em;
    }

    .case-value {
        font-size: 0.85em;
    }
}

/* Tasks Cards Layout */
.tasks-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(600px, 1fr));
    gap: 15px;
    padding: 0;
}

.case-search-suggestions {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-top: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    max-height: 260px;
    overflow-y: auto;
    font-size: 0.9em;
}

.case-search-suggestion-item {
    padding: 6px 10px;
    cursor: pointer;
}

.case-search-suggestion-item:hover {
    background: #f8f9fa;
}

.case-search-suggestion-empty {
    color: #6c757d;
    cursor: default;
}

.task-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 5px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    font-size: 15px;
}

.task-card:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

/* Karty terminów (wydarzenia) – odróżnienie od zadań */
.task-card-event {
    border-left: 4px solid #c0392b;
    background: #fef5f5;
}

.task-card-event .task-top-info {
    grid-template-columns: 1fr auto;
}

.task-card-event .task-top-actions {
    justify-self: end;
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 10px;
}

.task-title {
    font-size: 1.25em;
    font-weight: 600;
    color: #333;
    margin: 0;
    flex: 1;
    line-height: 1.3;
}

.task-document-type {
    font-size: 0.85em;
    color: #666;
    font-weight: 500;
}

.task-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    font-size: 0.9em;
    font-weight: 500;
    line-height: 1.4;
    border-radius: 10px;
    background: transparent;
    color: #495057;
    border: 1px solid #dee2e6;
    text-align: center;
    white-space: nowrap;
}

/* Kolor tła i obramowania całej karty w zależności od statusu zadania */
.task-card-pending {
    border-left: 4px solid #f59e0b;
    background: #fff7ed;
}

.task-card-completed {
    border-left: 4px solid #28a745;
    background: #e8f5e9;
}

/* Karta w dwóch kolumnach: sprawa | zadanie (strona Lista zadań) */
.task-card-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
    padding: 12px;
}

.task-card-case {
    padding-right: 1rem;
    border-right: 1px solid #e9ecef;
}

.task-card-case .case-info-grid {
    margin-top: 8px;
}

@media (max-width: 768px) {
    .task-card-split {
        grid-template-columns: 1fr;
    }

    .task-card-case {
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
        padding-bottom: 0.75rem;
        margin-bottom: 0.5rem;
    }
}

/* Kolory statusu zadania */
.task-status.status-pending {
    background: #f59e0b;
    color: #ffffff;
    border-color: #f59e0b;
}

.task-status.status-completed {
    background: #28a745;
    color: #ffffff;
    border-color: #28a745;
}

.task-status-clickable {
    cursor: pointer;
    transition: opacity 0.15s ease, filter 0.15s ease;
}

.task-content {
    margin-bottom: 12px;
}

.task-text {
    color: #666;
    font-size: 0.85em;
    line-height: 1.5;
    margin: 0 0 12px 0;
}

.task-top-info {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto auto;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.task-top-info > * {
    font-size: 0.85em;
    color: #666;
    font-weight: 500;
}

/* Ujednolicony wygląd akcji w kartach zadań: "Pobierz" i "Edytuj" */
.task-card .task-top-actions .btn {
    padding: 4px 10px;
    font-size: 0.9em;
}

.task-top-info strong {
    color: #333;
}

/* .task-main zawiera tytuł i treść zadania */

.task-main .task-title {
    margin-bottom: 8px;
    margin-top: 0;
}

.task-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    justify-self: end;
}

.task-download-link,
.task-top-info .task-delete-btn,
.task-top-info .event-delete-btn {
    padding: 6px 16px;
    font-size: 0.85em;
    white-space: nowrap;
}

.task-download-link {
    justify-self: auto;
}

.task-no-doc {
    justify-self: end;
    font-size: 0.85em;
}

.task-deadline {
    font-size: 0.85em;
    color: #666;
    font-weight: 500;
}

.task-deadline strong {
    color: #333;
    font-weight: 600;
}

.task-pisp-pub {
    font-size: 0.85em;
    color: #666;
    font-weight: 500;
}

.task-pisp-pub strong {
    color: #333;
    font-weight: 600;
}

.task-actions {
    border-top: 1px solid #f0f0f0;
    padding-top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .tasks-cards-container {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px 0;
    }

    .task-card {
        padding: 3px;
        font-size: 14px;
    }

    .task-top-info {
        grid-template-columns: 1fr;
        gap: 8px;
        margin-bottom: 12px;
    }

    .task-top-info > * {
        justify-self: start;
    }

    .task-top-actions {
        justify-self: start;
    }

    .task-download-link,
    .task-no-doc {
        justify-self: auto;
    }

    .task-title {
        font-size: 1.1em;
    }

    .task-deadline {
        font-size: 0.95em;
    }
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8em;
}

.cases-top-row {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 24px;
    align-items: start;
    margin-top: -24px;
}

.cases-top-row-right {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.cases-top-row-right .cases-filter-hint {
    margin-bottom: 0;
}

.cases-top-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
}

.cases-top-actions .btn-sm,
.cases-filter-hint .btn-sm {
    padding: 6px 12px;
    font-size: 0.875em;
}

.cases-filter-hint {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.cases-main-layout {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 24px;
    align-items: start;
    margin-top: 24px;
}

.right-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.right-column .calendar-mini-wrap {
    flex-shrink: 0;
}

.right-column .documents-panel {
    flex: 1;
    min-height: 0;
}

/* Widok tylko z kalendarzem na stronie cases (bez listy spraw/zadań) */
.calendar-only {
    margin-top: 24px;
}

.calendar-form-layout {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.calendar-form-column {
    flex: 0 0 50%;
    max-width: 640px;
}

.calendar-form-column--form {
    display: flex;
}

.calendar-form-layout .calendar-mini-wrap {
    width: 100%;
    min-width: 0;
    max-width: 640px;
    margin: 0 auto;
}

.calendar-form-layout .calendar-mini {
    width: 100%;
}

.calendar-form-card {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    padding: 20px 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.calendar-form-header h2 {
    margin: 0 0 4px 0;
    font-size: 1.2em;
    font-weight: 600;
    color: #2c3e50;
}

.calendar-form-subtitle {
    margin: 0;
    font-size: 0.9em;
    color: #6c757d;
}

.calendar-form-body {
    margin-top: 16px;
    flex: 1 1 auto;
}

.calendar-form-group {
    margin-bottom: 12px;
}

.calendar-form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.9em;
    font-weight: 500;
    color: #495057;
}

.calendar-form-group input[type="text"],
.calendar-form-group input[type="search"],
.calendar-form-group input[type="date"],
.calendar-form-group input[type="time"],
.calendar-form-group select,
.calendar-form-group textarea {
    width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #dee2e6;
    font-size: 0.9em;
    font-family: inherit;
    box-sizing: border-box;
    background: #ffffff;
    color: #212529;
}

.calendar-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.calendar-form-group input[type="text"]:focus,
.calendar-form-group input[type="search"]:focus,
.calendar-form-group input[type="date"]:focus,
.calendar-form-group input[type="time"]:focus,
.calendar-form-group select:focus,
.calendar-form-group textarea:focus {
    outline: none;
    border-color: #1a365d;
    box-shadow: 0 0 0 1px rgba(26, 54, 93, 0.15);
}

.calendar-form-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
}

.calendar-form-card .btn-primary {
    background: #1a365d;
    border-color: #1a365d;
}

.calendar-form-card .btn-primary:hover {
    background: #2c5282;
    border-color: #2c5282;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 54, 93, 0.35);
}

@media (max-width: 1024px) {
    .calendar-form-layout {
        max-width: 1000px;
    }
}

@media (max-width: 900px) {
    .calendar-form-layout {
        flex-direction: column;
        align-items: stretch;
        max-width: 700px;
    }

    .calendar-form-column {
        flex: 1 1 auto;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .calendar-only {
        margin-top: 16px;
    }

    .calendar-form-layout {
        padding: 0 8px;
    }
}

/* Style calendar navigation arrows like secondary buttons */
.calendar-mini .fc-prev-button,
.calendar-mini .fc-next-button {
    background: #ffffff !important;
    color: #495057 !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 10px !important;
    padding: 6px 12px !important;
    font-size: 0.875em !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    line-height: 1.4 !important;
    height: auto !important;
    min-height: auto !important;
    box-shadow: none !important;
    vertical-align: top !important;
    margin-top: 0 !important;
}

.calendar-mini .fc-prev-button:hover,
.calendar-mini .fc-next-button:hover {
    background: #f8f9fa !important;
    border-color: #adb5bd !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

/* Align calendar toolbar with other buttons */
.calendar-mini .fc-toolbar {
    align-items: flex-start !important;
}

/* Add spacing between calendar navigation arrows and custom buttons */
.calendar-mini .fc-toolbar-chunk:last-child .fc-prev-button {
    margin-right: 4px;
}

.calendar-mini .fc-toolbar-chunk:last-child .fc-button[data-custom-button="backButton"] {
    margin-left: 8px;
}

/* Style custom buttons in calendar header */
.calendar-mini .fc-toolbar .fc-backButton-button,
.calendar-mini .fc-toolbar .fc-apiButton-button,
.calendar-mini .fc-toolbar .fc-showAllButton-button {
    background: #ffffff !important;
    color: #495057 !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 10px !important;
    padding: 8px 12px !important;
    font-size: 0.875em !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    line-height: 1.4 !important;
    height: auto !important;
    min-height: auto !important;
    box-shadow: none !important;
    vertical-align: top !important;
    margin-top: 0 !important;
    margin-left: 8px !important;
}

.calendar-mini .fc-toolbar .fc-backButton-button:hover,
.calendar-mini .fc-toolbar .fc-apiButton-button:hover,
.calendar-mini .fc-toolbar .fc-showAllButton-button:hover {
    background: #f8f9fa !important;
    border-color: #adb5bd !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}


.calendar-mini .fc-toolbar .fc-showAllButton-button:hover {
    background: #f8f9fa !important;
    border-color: #adb5bd !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

/* Kalendarz: kolory pastelowe, dzisiaj szary, wybrany dzień żółty */
.calendar-mini .fc-daygrid-day {
    position: relative;
    background: #fdfcfa;
}
.calendar-mini .fc-daygrid-day:hover {
    background: #f8f6f2;
}
.calendar-mini .fc-day-today {
    background: #e8e6e3 !important;
}
.calendar-mini .fc-daygrid-day.day-selected {
    background: #fef9e0 !important;
}
.calendar-mini .fc-day-today.day-selected {
    background: #f5edc8 !important;
}

/* Calendar day cell: day number (top) + task count badge (centered in full cell) */
.calendar-mini .fc-daygrid-day .fc-daygrid-day-frame {
    height: 100%;
    min-height: 0.5em;
}

.calendar-mini .day-cell-inner {
    display: block;
    height: 100%;
    min-height: inherit;
    width: 100%;
}

.calendar-mini .day-number {
    display: block;
}

/* Badges są przenoszone w JS do fc-daygrid-day (td) */
.calendar-mini .fc-daygrid-day > .day-badges {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.calendar-mini .fc-daygrid-day > .day-badges .day-count-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 12px;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.calendar-mini .fc-daygrid-day > .day-badges .day-count-badge-tasks {
    background: #2c3e50;
}

.calendar-mini .fc-daygrid-day > .day-badges .day-count-badge-events {
    background: #c0392b;
}

/* Zachowanie pojedynczego badge gdy day-badges nie jest używane (fallback) */
.calendar-mini .fc-daygrid-day > .day-count-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 12px;
    background: #2c3e50;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.calendar-mini .fc-toolbar-title {
    font-size: 1.60em;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    letter-spacing: -0.01em;
}

/* Delete confirmation modal */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal.modal--open {
    display: flex;
}
.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}
.modal-dialog {
    position: relative;
    background: var(--bg-primary, #fff);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}
.modal-dialog--edit {
    max-width: 700px;
    width: 95%;
    padding: 2rem 2.25rem;
    border-radius: 14px;
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.28);
}
.modal-title {
    margin: 0 0 0.75rem;
    font-size: 1.125rem;
    font-weight: 600;
}
.modal-dialog--edit .modal-title {
    font-size: 1.25rem;
    padding-bottom: 0.75rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border, #e0e0e0);
}
.modal-body {
    margin: 0 0 1.25rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--text-secondary, #555);
}
.modal-dialog--edit .form-group {
    margin-bottom: 1.25rem;
    width: 100%;
}
.modal-dialog--edit .form-group input[type="text"],
.modal-dialog--edit .form-group input[type="date"],
.modal-dialog--edit .form-group input[type="time"],
.modal-dialog--edit .form-group textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    border: 1px solid #d0d7de;
    font-family: inherit;
    font-size: 0.95rem;
    color: inherit;
    background-color: #fff;
}
.modal-dialog--edit .form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 600;
    font-size: 0.9rem;
}
.modal-dialog--edit .form-row-title-date {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}
.modal-dialog--edit .form-row-title-date .form-group:first-child {
    flex: 2;
}
.modal-dialog--edit .form-row-title-date .form-group:last-child {
    flex: 1;
}
@media (max-width: 640px) {
    .modal-dialog--edit .form-row-title-date {
        flex-direction: column;
        align-items: stretch;
    }
}
.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}
.modal-dialog--edit .modal-actions {
    margin-top: 1.5rem;
}
.modal-actions .btn {
    min-width: 5rem;
}