:root {
    /* --- DARK THEME (Default) --- */
    --bg-gradient-start: #0f172a;
    --bg-gradient-end: #4a0418;

    --primary-color: #7f1d1d;
    --primary-hover: #991b1b;
    --text-color: #f8fafc;
    --text-muted: #cbd5e1;

    --card-bg: rgba(255, 255, 255, 0.08);
    --card-border: rgba(255, 255, 255, 0.15);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

    --input-bg: rgba(0, 0, 0, 0.2);
    --input-text: #fff;
    --input-focus-bg: rgba(0, 0, 0, 0.4);

    --header-bg: rgba(0, 0, 0, 0.3);

    --table-th-color: var(--text-muted);
    --table-row-bg: rgba(255, 255, 255, 0.05);
    --table-row-hover: rgba(255, 255, 255, 0.1);

    --modal-bg: #1e293b;
    --modal-text: #fff;

    /* Functional Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Departments */
    --dept-kasa: #fda4af;
    --dept-vip: #fed7aa;
    --dept-elektryka: #fef08a;
    --dept-okna: #bbf7d0;
    --dept-dostawy: #67e8f9;
    --dept-magazyn: #93c5fd;
    --dept-narzedzia: #a5b4fc;
}

/* --- LIGHT THEME OVERRIDES --- */
.theme-light {
    --bg-gradient-start: #e0f2fe;
    --bg-gradient-end: #ffe4e6;

    --primary-color: #881337;
    --primary-hover: #9f1239;
    --text-color: #1e293b;
    --text-muted: #64748b;

    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(255, 255, 255, 0.6);
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);

    --input-bg: rgba(255, 255, 255, 0.8);
    --input-text: #334155;
    --input-focus-bg: #fff;

    --header-bg: rgba(255, 255, 255, 0.5);

    --table-th-color: #475569;
    --table-row-bg: rgba(255, 255, 255, 0.5);
    --table-row-hover: rgba(255, 255, 255, 0.8);

    --modal-bg: #fff;
    --modal-text: #1e293b;

    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #2563eb;
}

body {
    font-family: 'Segoe UI', Inter, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    color: var(--text-color);
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end), var(--bg-gradient-start));
    background-size: 400% 400%;
    animation: gradientBG 20s ease infinite;
    min-height: 100vh;
    transition: color 0.3s ease;
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.hidden {
    display: none !important;
}

/* --- DASHBOARD GRID LAYOUT --- */
.layout-container {
    display: flex !important;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Sidebar - Left Fixed (ShiftFlow Branding) */
#sidebar {
    width: 280px;
    /* Reduced specific width for cleaner look */
    min-width: 280px;
    flex-shrink: 0;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    z-index: 50;
    height: 100vh;
}

/* Main Content Wrapper - Right Flexible */
.main-content-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    position: relative;
    width: calc(100% - 280px);
    /* Match sidebar width */
}

/* Top Bar - Top Fixed Inside Wrapper */
#top-bar {
    height: 60px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    /* Right align elements */
    padding: 0 2rem;
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Content Area - Scrollable Workspace */
#content-area {
    flex-grow: 1;
    overflow-y: auto;
    padding: 2rem;
    max-width: 100%;
}

/* --- COMPONENTS --- */

/* Brand/Logo Area - Horizontal Layout */
.brand {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--card-border);
    background: rgba(0, 0, 0, 0.1);
}

/* Back to Portal Button - Inline in sidebar-footer */
.back-to-portal {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    transition: all 0.25s ease;
    flex-shrink: 0;
    font-size: 18px;
}

.back-to-portal:hover {
    background: rgba(255, 255, 255, 0.10);
    color: rgba(255, 255, 255, 0.90);
    border-color: rgba(255, 255, 255, 0.30);
}

/* LEWA strona: ShiftFlow - DOMINUJĄCY (100% skali) */
.brand-left {
    flex: 0 0 auto;
}

.logo-shiftflow-sidebar {
    height: 56px;
    /* Powiększone */
    width: auto;
    object-fit: contain;
}

/* PRAWA strona: MOKADI - ENDORSEMENT (60-70% skali) */
.brand-right {
    flex: 0 0 auto;
    opacity: 0.75;
    /* Mniejszy kontrast */
}

.logo-mokadi-sidebar {
    height: 38px;
    /* Powiększone (~68% ShiftFlow) */
    width: auto;
    object-fit: contain;
}

/* Login Screen Logos - Hierarchia: ShiftFlow główny, MOKADI endorsement */
.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    /* Mniejszy gap dla lepszej hierarchii */
    margin-bottom: 30px;
}

/* ShiftFlow - GŁÓWNA MARKA (100%) */
.login-brand .logo-shiftflow {
    height: 80px;
    /* Duży, dominujący */
    width: auto;
    object-fit: contain;
}

/* MOKADI - ENDORSEMENT (55%) */
.login-brand .logo-mokadi {
    height: 44px;
    /* ~55% ShiftFlow */
    width: auto;
    object-fit: contain;
    opacity: 0.8;
    /* Spokojniejszy kontrast */
}

/* Navigation */
#sidebar-nav {
    padding: 10px 0;
    overflow-y: auto;
    flex-grow: 1;
}

/* Sidebar Navigation - Clean List */
.nav-group-label {
    padding: 24px 24px 10px;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 1.5px;
    opacity: 0.7;
}

.nav-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 24px;
    font-size: 0.95rem;
    color: var(--text-color);
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    opacity: 0.85;
    box-sizing: border-box;
    font-weight: 500;
}

/* Icon removal - ensure we just hide them if they exist in HTML, 
   or they are just not rendered. */
.nav-item svg,
.nav-item i {
    display: none !important;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    opacity: 1;
    padding-left: 28px;
    /* Subtle movement */
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.06), transparent);
    color: #fff;
    border-left-color: var(--primary-color);
    opacity: 1;
    font-weight: 600;
    box-shadow: inset 2px 0 0 0 rgba(255, 255, 255, 0.05);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 10px;
    border-top: 1px solid var(--card-border);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* User Profile in Sidebar */
.user-profile {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    transition: background 0.2s;
}

.user-profile:hover {
    background: rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    overflow: hidden;
    line-height: 1.2;
}

.user-info .name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.user-info .role {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
}

.user-avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#user-avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: #fff;
    font-weight: bold;
    border-radius: 50%;
}

/* User Dropdown (Upwards form sidebar) */
.user-dropdown {
    position: absolute;
    bottom: 110%;
    left: 0;
    right: 0;
    width: auto;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    padding: 6px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.user-dropdown button {
    background: transparent;
    color: var(--text-color);
    text-align: left;
    padding: 10px 15px;
    border-radius: 4px;
    text-transform: none;
    font-weight: normal;
    margin-bottom: 2px;
}

.user-dropdown button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.user-dropdown button.danger {
    color: var(--danger);
    border-top: 1px solid var(--card-border);
    margin-top: 5px;
    padding-top: 10px;
}

/* --- GENERAL & ADMIN STYLES --- */
.admin-section {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    color: var(--text-color);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.admin-section h3 {
    margin-top: 0;
    color: var(--text-muted);
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 10px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

th {
    text-align: left;
    padding: 12px;
    color: var(--table-th-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

td {
    padding: 16px;
    background: var(--table-row-bg);
    border: 1px solid transparent;
    /* Fix border collapse flicker */
}

td:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

td:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

tr:hover td {
    background: var(--table-row-hover);
}

/* Admin Tables - Specific overrides */
.admin-table td,
.admin-table th,
.approvals-table td,
.approvals-table th {
    height: 50px !important;
    padding-top: 0;
    padding-bottom: 0;
    vertical-align: middle;
}

.admin-table td img.avatar-sm,
.approvals-table td img.avatar-sm {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 50%;
    vertical-align: middle;
}

/* Zebra Striping (Alternating Colors) */
.admin-table tbody tr:nth-child(even) td,
.approvals-table tbody tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.08);
    /* Slightly lighter/different than default row */
}

.theme-light .admin-table tbody tr:nth-child(even) td,
.theme-light .approvals-table tbody tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.6);
}

/* ===========================================
   BUTTON SYSTEM - Modern, Consistent Design
   =========================================== */

/* Base Button */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    text-transform: none;
    letter-spacing: 0.3px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    user-select: none;
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn:focus-visible {
    outline: 2px solid var(--info);
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Button Icon */
.btn-icon {
    font-size: 1em;
    line-height: 1;
    flex-shrink: 0;
}

/* --- PRIMARY (Bordo/Main Action) --- */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: #fff;
    border-color: var(--primary-hover);
    box-shadow: 0 2px 8px rgba(127, 29, 29, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), #b91c1c);
    box-shadow: 0 4px 16px rgba(127, 29, 29, 0.4);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(127, 29, 29, 0.3);
}

/* --- SECONDARY (Neutral/Edit) --- */
.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-color);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-secondary:active {
    background: rgba(255, 255, 255, 0.1);
}

/* Light theme secondary */
.theme-light .btn-secondary {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-color);
    border-color: rgba(0, 0, 0, 0.15);
}

.theme-light .btn-secondary:hover {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.25);
}

/* --- DANGER (Delete/Destructive) --- */
.btn-danger {
    background: rgba(185, 28, 28, 0.15);
    color: #fca5a5;
    border-color: rgba(185, 28, 28, 0.4);
}

.btn-danger:hover {
    background: rgba(185, 28, 28, 0.3);
    color: #fecaca;
    border-color: rgba(185, 28, 28, 0.6);
    box-shadow: 0 4px 12px rgba(185, 28, 28, 0.25);
}

.btn-danger:active {
    background: rgba(185, 28, 28, 0.4);
}

/* Light theme danger */
.theme-light .btn-danger {
    background: rgba(185, 28, 28, 0.1);
    color: #b91c1c;
    border-color: rgba(185, 28, 28, 0.3);
}

.theme-light .btn-danger:hover {
    background: rgba(185, 28, 28, 0.2);
    color: #991b1b;
    border-color: rgba(185, 28, 28, 0.5);
}

/* --- WARNING (Important actions) --- */
.btn-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.4);
}

.btn-warning:hover {
    background: rgba(245, 158, 11, 0.3);
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.6);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.theme-light .btn-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
    border-color: rgba(245, 158, 11, 0.3);
}

.theme-light .btn-warning:hover {
    background: rgba(245, 158, 11, 0.2);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.5);
}

/* --- INFO (Informational actions) --- */
.btn-info {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.4);
}

.btn-info:hover {
    background: rgba(59, 130, 246, 0.3);
    color: #bfdbfe;
    border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.theme-light .btn-info {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
    border-color: rgba(59, 130, 246, 0.3);
}

.theme-light .btn-info:hover {
    background: rgba(59, 130, 246, 0.2);
    color: #1d4ed8;
    border-color: rgba(59, 130, 246, 0.5);
}

/* --- GHOST (Minimal/Cancel) --- */
.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-color);
}

.theme-light .btn-ghost:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* --- SUCCESS State (for "Saved" feedback) --- */
.btn-success {
    background: linear-gradient(135deg, var(--success), #059669) !important;
    color: #fff !important;
    border-color: var(--success) !important;
}

/* --- SIZE VARIANTS --- */
.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
    gap: 4px;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 1rem;
    border-radius: 10px;
}

/* --- ACTION BUTTONS CONTAINER (for table cells) --- */
.action-buttons {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.action-buttons .btn {
    margin: 0;
}

/* Small buttons - size modifier only */
.btn-sm,
button.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    text-transform: none;
    border-radius: 6px;
    min-width: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 0;
}

/* --- APPROVALS PANEL --- */
.approvals-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Approvals Table Adjustments */
.approvals-table tbody tr {
    height: 35px;
}

.approvals-table td {
    height: 35px;
    padding: 0 10px;
    vertical-align: middle;
    box-sizing: border-box;
}

/* Force separate borders like admin table if not inherited */
.approvals-table {
    border-collapse: separate !important;
    border-spacing: 0 6px !important;
}

.approvals-table td:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.approvals-table td:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.approvals-table tr:hover td {
    background: var(--table-row-hover);
}

.approvals-table th {
    padding: 8px !important;
    height: 38px;
    vertical-align: middle;
}

/* Action Buttons Actions Cell - Vertical Centering */
/* Action Buttons Actions Cell - Vertical Centering */
.approvals-table td.actions-cell {
    padding: 0 8px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

/* Ensure History/Approved table gets the same treatment */
.approvals-container table tbody tr {
    height: 35px;
}

.approvals-container table td {
    height: 35px;
    padding: 0 10px;
    vertical-align: middle;
    box-sizing: border-box;
    border-top: 1px solid var(--card-border);
}

/* Specific fix for action cells in any table within approvals container */
.approvals-container table td.actions-cell {
    padding: 0 8px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

/* --- Approvals: compact "Typ + Źródło" in one line --- */
.approvals-table td.type-cell {
    white-space: nowrap;
}

.approvals-table .type-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.approvals-table .source-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    line-height: 1;
    white-space: nowrap;
}

.approvals-table .source-badge--manager {
    background: #e0f2fe;
    color: #0369a1;
}

.approvals-table .source-badge--employee {
    background: #f3f4f6;
    color: #4b5563;
}

/* ==========================================
   APPROVALS TABLE — COLUMN WIDTH TUNING
   ========================================== */

.approvals-table {
    table-layout: fixed !important;
    width: 100% !important;
}

/* 1-liniowo wszędzie */
.approvals-table th,
.approvals-table td {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Kolumny wg kolejności w tabeli:
   1 TERMIN
   2 PRACOWNIK
   3 DZIAŁ
   4 TYP
   5 AKCJE
   6 OPIS
   7 DATA ZŁOŻENIA
*/

/* TERMIN — zwęzić */
.approvals-table th:nth-child(1),
.approvals-table td:nth-child(1) {
    width: 150px !important;
}

/* PRACOWNIK — zwęzić */
.approvals-table th:nth-child(2),
.approvals-table td:nth-child(2) {
    width: 170px !important;
}

/* DZIAŁ — zwęzić */
.approvals-table th:nth-child(3),
.approvals-table td:nth-child(3) {
    width: 120px !important;
}

/* TYP — zwęzić (najdłuższe: Niedostępność) */
.approvals-table th:nth-child(4),
.approvals-table td:nth-child(4) {
    width: 130px !important;
}

/* AKCJE — poszerzyć (4 przyciski: Konsultuj, Zatwierdź, Odrzuć, Symulacja) */
.approvals-table th:nth-child(5),
.approvals-table td:nth-child(5) {
    width: 300px !important;
}

/* OPIS — auto (zostaw) */
.approvals-table th:nth-child(6),
.approvals-table td:nth-child(6) {
    width: auto !important;
}

/* DATA ZŁOŻENIA — stałe */
.approvals-table th:nth-child(7),
.approvals-table td:nth-child(7) {
    width: 160px !important;
}

/* Approvals: all action buttons - smaller font to fit */
.approvals-table .btn-approval-action {
    font-size: 0.7rem !important;
    padding: 4px 8px !important;
    white-space: nowrap !important;
}

/* Approvals: simulate button - text only, compact, same color as Konsultuj */
.approvals-table .btn-simulate {
    padding: 2px 10px !important;
    height: 22px !important;
    min-height: 22px !important;
    font-size: 0.74rem !important;
    line-height: 1 !important;
    border-radius: 6px !important;
    font-weight: 600;
    white-space: nowrap;
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    color: white !important;
}

.approvals-table .btn-simulate:hover {
    background-color: #5a6268 !important;
    border-color: #545b62 !important;
}

/* Hide any icons/svg/images inside simulate button */
.approvals-table .btn-simulate .icon,
.approvals-table .btn-simulate svg,
.approvals-table .btn-simulate img {
    display: none !important;
}


/* Action Buttons in Approvals */
.btn-approval-action {
    width: 88px !important;
    height: 30px !important;
    padding: 0 !important;
    font-size: 0.75rem !important;
    border-radius: 4px !important;
    display: inline-flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin-right: 4px !important;
}

.btn-approval-action:last-child {
    margin-right: 0 !important;
}

.approvals-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.approval-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.approval-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.approval-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.approval-employee {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.approval-employee strong {
    font-size: 1.1rem;
}

.approval-type {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.approval-dates {
    color: var(--primary-color);
    font-weight: 600;
}

.approval-reason {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 6px;
    margin: 10px 0;
    font-style: italic;
    color: var(--text-muted);
}

.theme-light .approval-reason {
    background: rgba(0, 0, 0, 0.03);
}

.approval-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 15px;
}

/* Simulation cell colors */
.sim-cell {
    padding: 4px !important;
    font-size: 0.9rem;
}

.sim-vacation {
    background: rgba(34, 197, 94, 0.2) !important;
    color: #22c55e !important;
}

.sim-sick {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #ef4444 !important;
}

.sim-unavailable {
    background: rgba(156, 163, 175, 0.2) !important;
    color: #9ca3af !important;
}

/* --- MONTH PLANNING VIEW --- */
.month-planning-container {
    max-width: 100%;
    padding-bottom: 40px;
}

.days-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.day-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    overflow: hidden;
}

.day-card.weekend {
    border-color: rgba(239, 68, 68, 0.3);
}

.day-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--card-border);
    flex-wrap: wrap;
    gap: 10px;
}

.theme-light .day-card-header {
    background: rgba(0, 0, 0, 0.02);
}

.day-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.day-name {
    font-weight: 700;
    font-size: 1.1rem;
}

.day-date {
    color: var(--text-muted);
}

.day-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.workday-badge {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.weekend-badge {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.dept-counts {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dept-count {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.day-matrix-wrapper {
    overflow-x: auto;
    padding: 10px;
}

.day-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.day-matrix th,
.day-matrix td {
    padding: 8px 6px;
    text-align: center;
    border: 1px solid var(--card-border);
}

.day-matrix th {
    font-weight: 600;
    white-space: nowrap;
}

.day-matrix .emp-col {
    text-align: left;
    min-width: 120px;
    background: var(--card-bg);
}

.day-matrix .emp-name {
    text-align: left;
    font-weight: 500;
    white-space: nowrap;
    background: var(--card-bg);
    position: sticky;
    left: 0;
    z-index: 1;
}

.matrix-cell {
    min-width: 70px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
}

.matrix-cell[data-editable="true"]:hover {
    background: rgba(var(--primary-color-rgb, 127, 29, 29), 0.2) !important;
    transform: scale(1.05);
}

.cell-work {
    font-weight: 600;
    border-width: 2px !important;
}

.cell-block {
    background: rgba(100, 100, 100, 0.3) !important;
    color: #888;
}

.cell-vacation {
    background: rgba(34, 197, 94, 0.25) !important;
    color: #22c55e;
    font-weight: 700;
}

.cell-sick {
    background: rgba(239, 68, 68, 0.25) !important;
    color: #ef4444;
    font-weight: 700;
}

.cell-unavailable {
    background: rgba(156, 163, 175, 0.2) !important;
    color: #9ca3af;
}

/* ===========================================
   HOURLY GRID - New Planner View
   =========================================== */

.hourly-grid-container {
    max-width: 100%;
    padding-bottom: 40px;
}

.hourly-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.hourly-day-nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

.hourly-day-nav h2 {
    margin: 0;
    font-size: 1.3rem;
}

/* Department Legend */
.dept-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 15px 20px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    margin-bottom: 20px;
}

.dept-legend-title {
    width: 100%;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.dept-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
}

.dept-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

/* Hourly Grid Table - ChatGPT Style */
.hourly-grid-wrapper {
    overflow-x: auto;
    background: rgb(32, 22, 36);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.hourly-grid {
    width: max-content;
    /* FIX: Don't let table grow beyond columns */
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    border-radius: 12px;
    overflow: hidden;
    table-layout: fixed;
    /* FIX: Columns must be exactly 44px */
}

.hourly-grid th,
.hourly-grid td {
    padding: 0;
    text-align: center;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    /* KLUCZ: pionowe linie jak w nagłówku */
    box-sizing: border-box;
    /* FIX: Ensure borders don't add to width */
}

/* Synchronized thick separators (indices N+1 because of Name column) */
/* Thick line at 08:00 (after 1st hour col - col 2), 10:00 (after 3rd hour col - col 4), 16:00 (after 9th hour col - col 10) */
.hourly-grid td:nth-child(2),
.hourly-grid td:nth-child(4),
.hourly-grid td:nth-child(10),
.hourly-grid th:nth-child(2),
.hourly-grid th:nth-child(4),
.hourly-grid th:nth-child(10) {
    border-right: 4px solid rgba(255, 255, 255, 0.9) !important;
}

/* Clear adjacent thick borders from previous failed attempts */
.hourly-grid td:nth-child(3),
.hourly-grid td:nth-child(5),
.hourly-grid td:nth-child(11),
.hourly-grid th:nth-child(3),
.hourly-grid th:nth-child(5),
.hourly-grid th:nth-child(11) {
    border-right: 1px solid rgba(255, 255, 255, 0.06) !important;
}

/* Remove left border on columns AFTER thick separators to prevent double-line effect (ghost lines) */
.hourly-grid td:nth-child(3),
.hourly-grid td:nth-child(5),
.hourly-grid td:nth-child(11),
.hourly-grid th:nth-child(3),
.hourly-grid th:nth-child(5),
.hourly-grid th:nth-child(11) {
    border-left: none !important;
}


.hourly-grid thead th {
    background: transparent;
    font-weight: 500;
    font-size: 0.7rem;
    position: sticky;
    top: 0;
    z-index: 10;
    color: rgb(170, 160, 180);
    height: 40px;
    padding: 6px 4px;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.hourly-grid thead th:first-child {
    border-left: none;
}

.theme-light .hourly-grid thead th {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-color);
}

/* Vertical hour labels */
.hourly-grid .hour-col {
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    writing-mode: vertical-lr;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-size: 0.65rem;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.hourly-grid .emp-name-col {
    text-align: left;
    min-width: 240px;
    max-width: 300px;
    font-weight: 500;
    position: sticky;
    left: 0;
    z-index: 5;
    padding: 10px 14px !important;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: rgb(240, 236, 242);
}

/* Employee Row - Gradient department color */
.hourly-grid .employee-row {
    height: 44px;
}

.hourly-grid .employee-row:hover {
    outline: 1px solid rgba(255, 255, 255, 0.15);
}

.hourly-grid .employee-row td {
    height: 44px;
}

.hourly-grid .employee-row .emp-name-col {
    border-left: none;
    color: rgb(240, 236, 242);
    text-shadow: none;
    font-weight: 500;
}

/* Hour Cell States - ChatGPT Style */
.hour-cell {
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    height: 44px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    user-select: none;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    padding: 5px 2px;
    box-sizing: border-box;
    /* FIX: Width now includes padding/borders */
}

.hour-cell:hover {
    z-index: 2;
}

.hour-cell:active {}

/* State: WORK - white overlay, no text */
.hour-cell.state-work {
    /* allow inline department color */
}

.hour-cell.state-work::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background: rgba(255, 255, 255, 0.10);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    pointer-events: none;
}

/* State: BLOCK - dark overlay */
.hour-cell.state-block {
    background: transparent !important;
    cursor: not-allowed;
}

.hour-cell.state-block::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background: rgba(0, 0, 0, 0.38);
    border-radius: 6px;
}

.hour-cell.state-block:hover {
    filter: none;
}

/* State: VACATION (U) */
.hour-cell.state-vacation {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444;
    font-weight: 700;
    text-align: center;
    vertical-align: middle;
    line-height: 44px;
    font-size: 0.8rem;
    cursor: context-menu;
}

.hour-cell.state-vacation:hover {
    background: rgba(239, 68, 68, 0.25) !important;
}

/* State: SICK LEAVE (L4) */
.hour-cell.state-sick {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444;
    font-weight: 700;
    text-align: center;
    vertical-align: middle;
    line-height: 44px;
    font-size: 0.8rem;
    cursor: context-menu;
}

.hour-cell.state-sick:hover {
    background: rgba(239, 68, 68, 0.25) !important;
}

/* State: OTHER LEAVE (X/0) */
.hour-cell.state-other-leave {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444;
    font-weight: 700;
    text-align: center;
    vertical-align: middle;
    line-height: 44px;
    font-size: 0.8rem;
    cursor: context-menu;
}

.hour-cell.state-other-leave:hover {
    background: rgba(156, 163, 175, 0.4) !important;
}

.hour-cell.state-blocked-req {
    cursor: not-allowed;
}

/* State: Empty - transparent */
.hour-cell.state-empty {
    background: transparent !important;
}

.hour-cell.state-empty:hover {
    cursor: pointer;
}

.hour-cell.state-empty:hover::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
}

/* Editable indicator */
.hour-cell[data-editable="true"]:not(.state-block):hover {
    box-shadow: none;
}

/* Cell Value Indicator */
.cell-value {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Drag Selection Effect */
.hour-cell.drag-selected {
    outline: 3px solid #fff !important;
    outline-offset: -3px;
    animation: pulse-drag 0.3s ease;
}

@keyframes pulse-drag {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* READ-ONLY ENFORCEMENT */
.hour-cell[data-editable="false"] {
    cursor: default !important;
    pointer-events: none !important;
}

.hour-cell[data-editable="false"]:hover {
    z-index: auto !important;
    box-shadow: none !important;
    transform: none !important;
    filter: none !important;
}

.hour-cell[data-editable="false"]::after {
    /* Ensure overlays still show but don't react to hover if we had hover effects on after */
}

/* Employee Cell Content - ChatGPT Style */
.emp-cell-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 14px;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
}

.emp-name {
    font-weight: 400;
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 100px;
    color: rgb(240, 236, 242);
}

/* Preset Buttons - ChatGPT Style */
.preset-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: nowrap;
    margin-right: 10px;
}

.preset-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: rgb(240, 236, 242);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.preset-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.preset-btn:active {
    background: rgba(255, 255, 255, 0.15);
}

/* Adjust employee column for preset buttons */
.hourly-grid .emp-name-col {
    min-width: 280px;
    max-width: 360px;
    padding: 0 !important;
}

/* Mini Modal for Hourly Grid */
.hourly-mini-modal {
    position: fixed;
    background: var(--modal-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 3000;
    min-width: 200px;
}

.hourly-mini-modal h4 {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.hourly-mini-modal .modal-info {
    margin-bottom: 15px;
    font-size: 0.85rem;
}

.hourly-mini-modal .modal-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.hourly-mini-modal .btn-work {
    background: var(--success);
    color: #fff;
}

.hourly-mini-modal .btn-clear {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
}

/* Sunday collapsed state */
.sunday-collapsed {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.sunday-collapsed:hover {
    background: rgba(239, 68, 68, 0.15);
}

.sunday-collapsed .sunday-label {
    font-weight: 600;
    color: #ef4444;
}

.sunday-collapsed .expand-icon {
    color: var(--text-muted);
}

input,
select {
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    color: var(--input-text);
    padding: 10px;
    border-radius: 6px;
}

/* ===========================================
   MODAL SYSTEM - Modern Admin Panels
   =========================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Base */
.modal {
    background: var(--modal-bg);
    color: var(--modal-text);
    padding: 24px;
    /* Slightly more padding */
    border-radius: 16px;
    /* Rounded corners */
    max-width: 550px;
    /* Sane default */
    width: 90%;
    z-index: 1001;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--card-border);
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);

    /* STABILITY FIXES */
    max-height: 85vh;
    /* Never exceed 85% of viewport height */
    overflow-y: auto;
    /* Scroll INSIDE the modal */
    display: flex;
    flex-direction: column;
}

/* Ensure modal header stays up */
.modal-header {
    flex-shrink: 0;
    margin-bottom: 20px;
}

/* Ensure modal content scrolls */
.modal-content,
.modal form {
    overflow-y: auto;
    flex-grow: 1;
}

.modal-wide {
    max-width: 800px;
}

.modal-request-wide {
    max-width: 900px;
}

/* Modal Header */
.modal h3 {
    margin: 0;
    padding: 1.5rem 2rem;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-color);
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid var(--card-border);
    letter-spacing: 0.3px;
}

/* Modal Form Content */
.modal form {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: calc(85vh - 80px);
}

/* Form Section Groups */
.modal-section {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-section:last-of-type {
    border-bottom: none;
}

.modal-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--card-border), transparent);
}

/* Form Grid Layout */
.modal-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.modal-form-grid.single-column {
    grid-template-columns: 1fr;
}

.modal-form-grid .full-width {
    grid-column: 1 / -1;
}

/* Form Groups */
.modal .form-group,
.modal-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.modal .form-group label,
.modal-form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
    letter-spacing: 0.2px;
}

.modal .form-group .hint,
.modal-form-group .hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Modal Form Inputs */
.modal input[type="text"],
.modal input[type="email"],
.modal input[type="password"],
.modal input[type="number"],
.modal input[type="tel"],
.modal select,
.modal textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    color: var(--input-text);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.modal input:focus,
.modal select:focus,
.modal textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--input-focus-bg);
    box-shadow: 0 0 0 3px rgba(127, 29, 29, 0.2);
}

.modal input::placeholder,
.modal textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

/* Select Styling */
.modal select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    cursor: pointer;
}

.modal select option {
    background: var(--modal-bg);
    color: var(--modal-text);
    padding: 10px;
}

/* Multi-Select Styling */
.modal select[multiple] {
    min-height: 140px;
    padding: 8px;
    background-image: none;
}

.modal select[multiple] option {
    padding: 10px 12px;
    margin: 2px 0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.modal select[multiple] option:checked {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
}

.modal select[multiple] option:hover {
    background: rgba(127, 29, 29, 0.2);
}

/* Color Input */
.modal input[type="color"] {
    width: 100%;
    height: 50px;
    padding: 4px;
    border-radius: 10px;
    cursor: pointer;
}

.modal input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 4px;
}

.modal input[type="color"]::-webkit-color-swatch {
    border-radius: 6px;
    border: none;
}

/* Color Preview Row */
.color-input-row {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.color-input-row input[type="color"] {
    width: 60px;
    height: 44px;
    flex-shrink: 0;
}

.color-input-row .color-hex {
    flex: 1;
}

/* Modal Actions Footer */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 1.25rem 2rem;
    background: rgba(0, 0, 0, 0.1);
    border-top: 1px solid var(--card-border);
    margin-top: auto;
}

/* Modal Action Buttons */
.modal-actions button {
    padding: 12px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

/* Cancel Button (Secondary) */
.modal-actions button[type="button"],
.modal-actions .btn-cancel {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-color);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-actions button[type="button"]:hover,
.modal-actions .btn-cancel:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Submit Button (Primary) */
.modal-actions button[type="submit"],
.modal-actions .btn-submit {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: #fff;
    border: 1px solid var(--primary-hover);
    box-shadow: 0 2px 8px rgba(127, 29, 29, 0.3);
}

.modal-actions button[type="submit"]:hover,
.modal-actions .btn-submit:hover {
    background: linear-gradient(135deg, var(--primary-hover), #b91c1c);
    box-shadow: 0 4px 16px rgba(127, 29, 29, 0.4);
    transform: translateY(-1px);
}

.modal-actions button[type="submit"]:active,
.modal-actions .btn-submit:active {
    transform: translateY(0);
}

/* Light Theme Modal Adjustments */
.theme-light .modal {
    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.25),
        0 10px 30px rgba(0, 0, 0, 0.15);
}

.theme-light .modal h3 {
    background: rgba(0, 0, 0, 0.03);
}

.theme-light .modal-actions {
    background: rgba(0, 0, 0, 0.02);
}

.theme-light .modal-actions button[type="button"] {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.15);
    color: var(--text-color);
}

.theme-light .modal-actions button[type="button"]:hover {
    background: rgba(0, 0, 0, 0.1);
}

.theme-light .modal select[multiple] option:hover {
    background: rgba(127, 29, 29, 0.1);
}

/* Badge/Status within modal */
.modal .status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 20px;
    background: rgba(127, 29, 29, 0.2);
    color: #fca5a5;
}

/* Info Box in Modal */
.modal-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 10px;
    padding: 1rem;
    font-size: 0.85rem;
    color: #93c5fd;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.modal-info::before {
    content: 'ℹ️';
    font-size: 1rem;
}

.theme-light .modal-info {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
}

/* Responsive Modal */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 1rem;
    }

    .modal {
        max-width: 100%;
        min-width: unset;
        max-height: 90vh;
    }

    .modal h3 {
        padding: 1.25rem 1.5rem;
        font-size: 1.2rem;
    }

    .modal-section {
        padding: 1.25rem 1.5rem;
    }

    .modal-form-grid {
        grid-template-columns: 1fr;
    }

    .modal-actions {
        padding: 1rem 1.5rem;
        flex-direction: column-reverse;
    }

    .modal-actions button {
        width: 100%;
    }
}

/* --- Avatar Styles --- */
.avatar-sm {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--card-border);
    vertical-align: middle;
}

.avatar-placeholder {
    width: 60px;
    height: 60px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--input-bg);
    border-radius: 50%;
    font-size: 1.6rem;
    color: var(--text-muted);
    vertical-align: middle;
    border: 2px solid var(--card-border);
}

/* --- Calendar / Requests View --- */
.requests-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.month-nav {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.2rem;
    font-weight: bold;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 30px;
}

.day-name {
    text-align: center;
    padding: 10px;
    font-weight: bold;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.8rem;
}

.calendar-day {
    background: rgba(255, 255, 255, 0.03);
    min-height: 100px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    border: 1px solid transparent;
}

.calendar-day:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.calendar-day.empty {
    background: transparent;
    cursor: default;
    pointer-events: none;
}

.day-number {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    position: absolute;
    top: 8px;
    right: 10px;
}

/* Statusy w kalendarzu */
.day-pending {
    border-color: rgba(245, 158, 11, 0.5);
    background: rgba(245, 158, 11, 0.05);
}

.day-approved {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.05);
}

.day-rejected {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.05);
}

.day-event {
    margin-top: 25px;
    font-size: 0.75rem;
    padding: 3px 6px;
    border-radius: 4px;
    text-align: center;
    font-weight: bold;
    text-transform: uppercase;
}

.day-pending .day-event {
    background: var(--warning);
    color: #000;
}

.day-approved .day-event {
    background: var(--success);
    color: #fff;
}

.day-rejected .day-event {
    background: var(--danger);
    color: #fff;
}

/* Legenda */
.calendar-legend {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.dot.pending {
    background: var(--warning);
}

.dot.approved {
    background: var(--success);
}

.dot.rejected {
    background: var(--danger);
}

/* List styles */
.simple-list {
    list-style: none;
    padding: 0;
}

.simple-list li {
    padding: 10px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: 15px;
}

.status-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
}

.status-badge.status-pending {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.status-badge.status-approved {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.status-badge.status-rejected {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

/* Drag and Drop for Employee Rows */
.employee-row-draggable {
    cursor: grab;
    transition: background 0.2s ease, transform 0.15s ease;
}

.employee-row-draggable:hover {
    background: rgba(255, 255, 255, 0.05);
}

.employee-row-draggable.dragging {
    opacity: 0.5;
    cursor: grabbing;
    background: rgba(100, 100, 255, 0.15);
}

.employee-row-draggable.drag-over {
    border-top: 3px solid var(--primary-color);
    background: rgba(100, 100, 255, 0.1);
}

.drag-handle {
    cursor: grab;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    user-select: none;
}

.drag-handle:hover {
    color: rgba(255, 255, 255, 0.8);
}

.drag-handle:active {
    cursor: grabbing;
}

/* ====================================
   HOUR BLOCK VISUAL SEPARATORS (MVP Grid)
   ==================================== */

/* Thicker borders between specific hour blocks for better visual clarity */

/* Removed redundant separators */

/* ====================================
   HOUR TABLE HEADER STYLING
   ==================================== */

/* Fixed table layout to ensure column widths match between header and body */
table {
    table-layout: fixed !important;
    width: 100%;
}

/* Hour header cells - 150px height */
table thead th {
    height: 150px !important;
    min-height: 150px !important;
    max-height: 150px !important;
    vertical-align: middle;
    padding: 10px !important;
    font-size: 1rem !important;
}

/* ====================================
/* Old stats panel styles removed */
/* Muted "Rotten" Pastel Colors */
.stat-row-days8 {
    background: #e3dcb2;
    /* Muted Pastel Yellow */
    color: #fff;
}

.stat-row-days10 {
    background: #d99aa0;
    /* Muted Pastel Red */
    color: #fff;
}

.stat-row-over10 {
    background: #99c2bb;
    /* Muted Pastel Teal */
    color: #fff;
}

.stat-row-free {
    background: #a3c4a3;
    /* Muted Pastel Green */
    color: #fff;
}

.stat-row-freeSat {
    background: #9ab4d0;
    /* Muted Pastel Blue */
    color: #fff;
}

.stat-row-vacation {
    background: #d1d1d1;
    /* Muted Gray */
    color: #fff;
}

.stat-row-sick {
    background: #e0b0be;
    /* Muted Pastel Pink */
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-row-hours {
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 600;
}

/* ====================================
   PHASE 5: MONTHLY GRID REFACTOR
   ==================================== */

.monthly-grid-wrapper {
    overflow: auto;
    /* Height will be handled dynamically or clamped */
    height: calc(100vh - 350px);
    position: relative;
    border: 1px solid var(--card-border);
    background: var(--bg-card);
    border-radius: 8px;
    margin-top: 20px;
}

.monthly-grid {
    border-collapse: separate;
    /* Critical for sticky headers */
    border-spacing: 0;
    width: 100%;
    min-width: max-content;
}

.monthly-grid th,
.monthly-grid td {
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 4px;
    text-align: center;
    font-size: 0.85rem;
    vertical-align: middle;
}

/* --- Sticky Header (Top) --- */
.monthly-grid thead th {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 20;
    height: 60px;
    color: var(--text-primary);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

/* --- Sticky First Column (Left) --- */
.monthly-grid .sticky-col {
    position: sticky;
    left: 0;
    background: #1e1e1e;
    z-index: 10;
    width: 200px;
    min-width: 200px;
    max-width: 200px;
    text-align: left;
    padding-left: 12px;
    border-right: 2px solid var(--card-border);
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.5);
}

.monthly-grid td.sticky-col {
    background: #1e1e1e;
    /* Ensure background handles Transparency */
}

/* --- Corner Cell (Intersection) --- */
.monthly-grid thead th.sticky-col {
    z-index: 30;
    /* Highest */
    background: var(--bg-secondary);
    text-align: center;
    padding-left: 0;
}

/* --- Day Columns --- */
.day-col {
    min-width: 45px;
    width: 45px;
}

.day-col.weekend {
    background: rgba(255, 80, 80, 0.1);
    color: #ffdada;
}

.day-col.today {
    background: rgba(52, 152, 219, 0.2);
    border-bottom: 3px solid #3498db;
}

/* --- Cells --- */
.day-cell {
    height: 50px;
    cursor: pointer;
    transition: background 0.1s;
    position: relative;
}

.day-cell:hover {
    outline: 2px solid rgba(255, 255, 255, 0.3);
    z-index: 5;
}

.day-cell.weekend {
    background: rgba(0, 0, 0, 0.3);
}

/* Cell Contents */
.cell-content-work {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.5);
    color: #81c784;
    border-radius: 4px;
    padding: 4px 2px;
    font-weight: bold;
    font-size: 0.8rem;
    display: block;
    width: 100%;
}

.cell-content-block {
    background: rgba(255, 255, 255, 0.05);
    color: #666;
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.cell-vacation {
    background: #ffffff !important;
    color: #000 !important;
    font-weight: bold;
}

.cell-sick {
    background: #e0e0e0 !important;
    color: #000 !important;
    font-weight: bold;
}

/* ====================================
   PHASE 5: MONTHLY GRID HOURLY MODE (AIRPORT VIEW)
   ==================================== */

.monthly-grid.hourly-mode th.day-group-header {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-right: 2px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    font-weight: bold;
    font-size: 0.9rem;
    padding: 4px;
    z-index: 25;
    /* Higher than normal headers */
    top: 0;
    position: sticky;
}

.monthly-grid.hourly-mode th.hour-header {
    min-width: 44px;
    /* Very narrow */
    width: 44px;
    max-width: 44px;
    font-size: 0.65rem;
    padding: 2px;
    background: #2a2a2a;
    color: #888;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 20;
    top: 32px;
    /* Offset by day header height approx */
    height: 25px;
    position: sticky;
}

/* Specific styling for sticky column in this mode */
.monthly-grid.hourly-mode th.sticky-col {
    z-index: 40;
    /* Highest for corner */
    top: 0;
    height: auto;
    /* Allow expanding for rowspan */
    vertical-align: middle;
    background: var(--bg-secondary);
}

.monthly-grid.hourly-mode .hour-cell {
    min-width: 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

/* Border between days in body - targeting specific columns (need JS logic or nth-child if constant)
   Or better: add a specific class to the last hour of each day
*/
.hourly-grid.monthly-version td.hour-cell.day-end {
    border-right: 2px solid rgba(255, 255, 255, 0.2);
}

/* State Styling for Hours */
.hour-work {
    background: rgba(76, 175, 80, 0.6);
}

.hour-block {
    background: repeating-linear-gradient(45deg,
            rgba(0, 0, 0, 0.2),
            rgba(0, 0, 0, 0.2) 5px,
            rgba(0, 0, 0, 0.4) 5px,
            rgba(0, 0, 0, 0.4) 10px);
}

.hour-vacation {
    background: #ffffff;
}

.hour-sick {
    background: #e0e0e0;
}

/* --- Layout Fixes for Massive Grid --- */
.hourly-grid.monthly-version {
    width: max-content;
    /* Force horizontal scroll */
    min-width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

.monthly-grid-wrapper {
    overflow-x: auto;
    /* Enable scrolling */
    width: 100%;
}

.hourly-grid-wrapper.collapsed .hourly-grid {
    display: none;
}

.day-header {
    cursor: pointer;
    transition: background-color 0.2s;
}

.day-header:hover {
    background-color: var(--hover-color);
}

.toggle-icon {
    transition: transform 0.3s ease;
    display: inline-block;
    width: 20px;
    text-align: center;
}

.hourly-grid-wrapper.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

/* --- Presets Column --- */
.hourly-grid.monthly-version th.presets-header {
    background: var(--bg-secondary);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 25;
    position: sticky;
    top: 32px;
    height: 120px;
    /* Match tall hour header */
    vertical-align: middle;
    font-size: 0.7rem;
    color: #aaa;
    width: 90px;
    min-width: 90px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hourly-grid.monthly-version td.presets-cell {
    width: 90px;
    min-width: 90px;
    padding: 2px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--bg-card);
    /* Slightly different bg */
}

.preset-buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
}

.preset-btn-sm {
    background: #444;
    border: none;
    color: #fff;
    font-size: 0.55rem;
    /* Smaller font */
    padding: 1px 0;
    border-radius: 2px;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.preset-btn-sm:hover {
    background: var(--primary-color);
}

.hourly-grid.monthly-version td.hour-cell {
    width: 24px;
    min-width: 24px;
    max-width: 24px;
    padding: 0;
    text-align: center;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.hourly-grid.monthly-version th.hour-header {
    width: 24px;
    min-width: 24px;
    font-size: 0.65rem;
    padding: 5px 0;
    text-align: center;
    color: #888;
    /* Vertical Text */
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    white-space: nowrap;
    height: 120px;
    vertical-align: bottom;
}

/* Day End Border */
.hourly-grid.monthly-version td.day-end,
.hourly-grid.monthly-version th.hour-header:nth-last-child(1) {
    border-right: 2px solid rgba(255, 255, 255, 0.4);
    /* Stronger separator */
}

/* --- Vertical Month Planning View --- */

.month-planning-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Prevent body scroll interaction */
}

/* Stats Panel Styling */
.stats-panel-container {
    padding: 10px;
}

#toggle-stats-btn {
    width: 100%;
    margin-bottom: 5px;
    background: var(--bg-secondary);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.stats-table th {
    padding: 5px;
    font-weight: normal;
    color: var(--text-muted);
}

.stats-table td {
    border: 1px solid var(--card-border);
    padding: 4px 8px;
    text-align: center;
}

/* Row Colors matching screenshot approximately */
.stat-row-days8 {
    background-color: rgba(255, 255, 0, 0.2);
}

/* Yellowish */
.stat-row-days10 {
    background-color: rgba(255, 69, 0, 0.2);
}

/* Red/Orange */
.stat-row-over10 {
    background-color: rgba(169, 169, 169, 0.2);
}

/* Grey */
.stat-row-free {
    background-color: rgba(50, 205, 50, 0.2);
}

/* Green */
.stat-row-freeSat {
    background-color: rgba(0, 191, 255, 0.2);
}

/* Cyan */
.stat-row-vacation {
    background-color: rgba(255, 255, 255, 0.1);
}

/* White/Transparent */
.stat-row-hours {
    background-color: rgba(255, 0, 0, 0.1);
    font-weight: bold;
}

/* Red bottom */

.stat-label {
    text-align: left !important;
    font-weight: 500;
    white-space: nowrap;
    padding-left: 10px !important;
    background: rgba(0, 0, 0, 0.1);
    /* Slightly darker for label column */
}


/* Day Section */
.day-section {
    border-bottom: 3px solid var(--bg-main);
    /* Thick separator between days */
}

.day-card-header {
    /* Styled inline in JS, can be moved here */
    color: var(--text-primary);
}

.day-weekend .day-card-header {
    color: #ff6b6b;
}

/* Hide the duplicate header inside generated grid */
.day-section table.hourly-grid thead {
    display: none;
}

/* ===========================================
   MONTH / PLANNING — STICKY HOURS HEADER
   =========================================== */

/* Sticky wrapper (stats + hour header) inside the scroll container */
.month-sticky-top {
    position: sticky;
    top: 0;
    z-index: 999;
    /* zawsze nad tabelą */
    background: rgb(32, 22, 36);
    /* twarde tło = nic nie prześwituje */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    isolation: isolate;
    /* tworzy własną warstwę (pewniejszy z-index) */
}

/* The hour "grid" header row shown above all day sections */
.month-hours-header {
    display: flex;
    align-items: stretch;
    width: max-content;
    /* keeps columns exact width */
    min-width: 100%;
    /* but still fills container */
    border-top: 1px solid var(--card-border);
    border-bottom: 1px solid var(--card-border);
    background: rgb(32, 22, 36);
    /* same vibe as grid wrapper */
    box-sizing: border-box;
}

/* Left spacer to cover: employee column (and preset buttons area) */
.month-hours-spacer {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 14px;
    min-width: var(--month-left-width, 360px);
    /* JS alignHeader may overwrite */
    max-width: var(--month-left-width, 360px);
    width: var(--month-left-width, 360px);

    font-size: 1.1rem;
    /* match .emp-name */
    font-weight: 400;
    /* match .emp-name */
    color: rgb(240, 236, 242);
    white-space: nowrap;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-sizing: border-box;
    /* FIX: Width now includes padding */
}

/* Container for 11 hour columns */
.month-hours-cols {
    display: flex;
    align-items: stretch;
}

/* Single hour column label */
.month-hour-label {
    width: 44px;
    min-width: 44px;
    max-width: 44px;

    height: 150px;
    /* tall like a proper header */
    display: flex;
    align-items: center;
    justify-content: center;

    writing-mode: vertical-rl;
    /* vertical text */
    text-orientation: mixed;
    transform: rotate(180deg);

    font-size: 1.1rem;
    /* match .emp-name */
    font-weight: 400;
    /* match .emp-name */
    color: rgb(170, 160, 180);

    border-right: 1px solid rgba(255, 255, 255, 0.06);
    user-select: none;
    box-sizing: border-box;
    flex-shrink: 0;
    /* FIX: Prevent labels from squashing */
    flex-grow: 0;
}

/* Standard borders for all labels (thick separators removed) */
.month-hour-label {
    border-right: 1px solid rgba(255, 255, 255, 0.06) !important;
}

/* Adjust cell interactivity for delegation */
.hour-cell.drag-selected {
    outline: 2px solid var(--accent-color);
    z-index: 5;
}

/* Approvals Table Layout */
.approvals-container {
    width: 100%;
    display: block;
}

.approvals-table {
    width: 100% !important;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    table-layout: auto;
    /* Let columns adjust content */
}

.approvals-table th {
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-weight: 500;
    text-align: left;
    padding: 12px 15px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--card-border);
    white-space: nowrap;
}

.approvals-table td {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.01);
    vertical-align: middle;
}

.approvals-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

.approvals-table .actions-cell {
    display: flex;
    gap: 5px;
}

/* Scroll Area */
.vertical-scroll-area::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.vertical-scroll-area::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.vertical-scroll-area::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

/* Blocked Request Visuals (Red X/U/W/L4) */
.visual-blocked-x {
    background-color: #d32f2f !important;
    /* Red background */
    color: white !important;
    font-weight: bold;
    /* Removed display: flex to prevent breaking table-cell behavior */
    text-align: center;
    vertical-align: middle;
    font-size: 0.9rem;
    /* Adjusted for L4 fitting */
    pointer-events: none;
    /* Block interactions */
}

/* Sidebar Theme Toggle */
.theme-toggle-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    /* Spacing from profile */
    transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
    background: var(--bg-hover);
    transform: scale(1.05);
}

.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Space out toggle and profile */
    padding: 15px 20px;
    border-top: 1px solid var(--card-border);
    margin-top: auto;
}

/* Modal Generic Styles */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: var(--bg-card);
    background-image: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.1));
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: modalAppear 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 90vw;
    max-height: 90vh;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--card-border);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--card-border) transparent;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background-color: var(--card-border);
    border-radius: 20px;
}

@keyframes modalAppear {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalAppear {
    from {
        transform: scale(0.9) translateY(20px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Stats Table Styles */
.stats-table-wrapper {
    max-width: 100%;
    overflow: auto;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
}

.stats-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
    border-top: 1px solid var(--card-border);
    border-left: 1px solid var(--card-border);
}

.stats-table th,
.stats-table td {
    padding: 8px 12px;
    text-align: center;
    border-bottom: 1px solid var(--card-border);
    border-right: 1px solid var(--card-border);
    white-space: nowrap;
    min-width: 44px;
    box-sizing: border-box;
}

.stats-table th:last-child,
.stats-table td:last-child {
    border-right: 1px solid var(--card-border);
}

/* Header Cells */
.stats-table thead th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Vertical Employee Headers */
.stat-emp-header {
    height: 180px;
    min-width: 44px !important;
    max-width: 44px !important;
    width: 44px !important;
    vertical-align: bottom !important;
    padding: 15px 2px !important;
}

.stat-vertical-text {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-align: left;
    white-space: nowrap;
    margin: 0 auto;
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.2;
    color: #fff;
    letter-spacing: 0.5px;
}

/* Sticky Parametr Label Column */
.stats-table .stat-label {
    min-width: 250px !important;
    width: 250px !important;
    padding: 12px 20px !important;
    text-align: left !important;
    font-weight: 700 !important;
    color: #fff !important;
    background: #1e293b !important;
    /* Fixed dark background */
    position: sticky !important;
    left: 0 !important;
    z-index: 100 !important;
    /* Ensure it stays above everything */
    border-right: 3px solid var(--card-border) !important;
}

.stat-label-text {
    display: block;
    position: relative;
    z-index: 101;
    color: #fff;
}

.stats-table thead th.stat-label {
    z-index: 110 !important;
}

/* Row colors based on user preferences */
.stat-row-8 {
    background-color: rgba(253, 164, 175, 0.15) !important;
}

.stat-row-10 {
    background-color: rgba(254, 215, 170, 0.15) !important;
}

.stat-row-over10 {
    background-color: rgba(254, 240, 138, 0.15) !important;
}

.stat-row-free {
    background-color: rgba(187, 247, 208, 0.25) !important;
}

/* Zielony jak okna */
.stat-row-sat {
    background-color: rgba(103, 232, 249, 0.15) !important;
}

.stat-row-sick {
    background-color: rgba(239, 68, 68, 0.15) !important;
}

.stat-row-vacation {
    background-color: rgba(34, 197, 94, 0.15) !important;
}

.stat-row-total {
    background-color: rgba(255, 255, 255, 0.1) !important;
    font-size: 1.1rem;
    color: #fff;
}

/* Table hover effects */
.stats-table tr:hover td:not(.stat-label) {
    background: rgba(255, 255, 255, 0.05);
}

/* =========================================================================================================
   READ-ONLY MONTH VIEW - Cell Styling
   ========================================================================================================= */
/* Non-editable cells should not suggest interactivity */
td[data-editable="false"] {
    cursor: default !important;
    user-select: none;
}

/* Remove hover effects from non-editable cells */
td[data-editable="false"]:hover {
    opacity: 1 !important;
    transform: none !important;
}

/* =========================================================================================================
   ADDITIONAL READ-ONLY HARDENING
   ========================================================================================================= */
/* Extra protection: disable all pointer events on non-editable cells */
td[data-editable="false"] {
    pointer-events: none !important;
}

/* Ensure any accidentally included buttons are hidden in read-only rows */
.employee-row td[data-editable="false"] button,
.employee-row td[data-editable="false"] .preset-btn {
    display: none !important;
}

/* =========================================================================================================
   PREMIUM GLASS CARD - Manager Absences
   ========================================================================================================= */
.gf-card--glow {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 18px;
    padding: 28px 28px 26px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.gf-card--glow::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 30%, rgba(239, 68, 68, 0.08), transparent 50%);
    pointer-events: none;
    opacity: 0.7;
}

/* Premium Form Styles */
.gf-form {
    position: relative;
    z-index: 1;
}

.gf-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
}

.gf-span-2 {
    grid-column: span 2;
}

.gf-field-wrap {
    display: flex;
    flex-direction: column;
}

.gf-label {
    font-size: 12.5px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    opacity: 0.85;
    margin-bottom: 6px;
    display: block;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
}

.gf-field {
    width: 100%;
    height: 46px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.18);
    color: rgba(255, 255, 255, 0.92);
    font-size: 14.5px;
    outline: none;
    transition: border 140ms ease, box-shadow 140ms ease, transform 140ms ease, background 140ms ease;
}

.gf-field:focus {
    border-color: rgba(239, 68, 68, 0.55);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18), 0 8px 18px rgba(239, 68, 68, 0.12);
    background: rgba(0, 0, 0, 0.24);
}

.gf-field option {
    background: var(--bg-color);
    color: var(--text-color);
}

.gf-textarea {
    height: auto;
    min-height: 110px;
    resize: vertical;
    padding-top: 12px;
    line-height: 1.5;
    font-family: inherit;
}

/* Actions */
.gf-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
}

/* Premium Button */
.gf-btn {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
}

.gf-btn--primary {
    height: 46px;
    padding: 0 24px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.95), rgba(185, 28, 28, 0.95));
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    box-shadow: 0 10px 24px rgba(220, 38, 38, 0.22);
    transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.gf-btn--primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(220, 38, 38, 0.28), 0 0 0 3px rgba(239, 68, 68, 0.16);
}

.gf-btn--primary:active:not(:disabled) {
    transform: translateY(0px);
}

.gf-btn--primary:disabled {
    opacity: 0.55;
    filter: grayscale(0.3);
    cursor: not-allowed;
}

/* Mobile Responsive */
@media (max-width: 900px) {
    .gf-grid {
        grid-template-columns: 1fr;
    }

    .gf-span-2 {
        grid-column: span 1;
    }

    .gf-actions {
        justify-content: stretch;
    }

    .gf-btn--primary {
        width: 100%;
    }

    .gf-card--glow {
        padding: 20px 18px;
    }
}

/* ====================================
   SETTINGS PANEL STYLES
   ==================================== */

/* Settings Tabs */
.settings-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 16px;
}

.settings-tab {
    padding: 12px 24px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.settings-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
}

.settings-tab.active {
    background: var(--primary-color);
    color: #fff;
}

/* Settings Content */
.settings-content {
    padding: 10px 0;
}

.settings-section {
    padding: 10px 0;
}

.settings-section h3 {
    margin: 0 0 12px;
    font-size: 1.2rem;
    color: var(--text-color);
}

.settings-hint {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Holidays List */
.holidays-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.holiday-item {
    display: flex;
    gap: 16px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.08); /* Trochę jaśniejsze tło */
    border: 1px solid rgba(255, 255, 255, 0.15); /* Jaśniejsza ramka */
    border-radius: 8px;
}

.holiday-date {
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.85); /* Wysoki kontrast */
    min-width: 100px;
}

.holiday-name {
    color: #ffffff; /* Czysty biały */
    font-weight: 600;
}

/* Norms Grid */
.norms-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.norm-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.norm-item label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
}

.norm-input {
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 1rem;
    text-align: center;
    transition: all 0.2s ease;
}

.norm-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.2);
}

.norms-grid .premium-field {
    text-align: center;
}

/* Radio Cards */
.planning-modes {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.radio-card:hover {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.05);
}

.radio-card.active {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: var(--primary-color);
}

.radio-card input[type="radio"] {
    margin-top: 4px;
    accent-color: var(--primary-color);
    width: 18px;
    height: 18px;
}

.radio-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.radio-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
}

.radio-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Settings Actions */
.settings-actions {
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: flex-end;
}

.empty-state {
    color: var(--text-muted);
    font-style: italic;
    padding: 20px;
    text-align: center;
}

@media (max-width: 700px) {
    .norms-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .settings-tabs {
        flex-wrap: wrap;
    }

    .settings-tab {
        flex: 1;
        text-align: center;
        padding: 10px 12px;
        font-size: 0.85rem;
    }
}

/* Algorithm Settings Sub-tabs */
.algo-sub-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px
}

.algo-sub-tab {
    flex: 1;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px 8px 0 0;
    font-weight: 500
}

.algo-sub-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9)
}

.algo-sub-tab.active {
    background: rgba(100, 200, 255, 0.15);
    color: #64c8ff;
    border-color: #64c8ff;
    font-weight: 600
}

/* ===========================================
   WORKFLOW SLEEK LOGIN UI STYLES
   =========================================== */

/* Ensure the login view is a flexbox overlay */
#login-view {
    display: flex;
    width: 100%;
    height: 100vh;
    align-items: center;
    justify-content: center;
    position: absolute;
    inset: 0;
    z-index: 200;
    padding: 24px;
}

.login-shell {
    width: 100%;
    max-width: 520px;
}

.login-tile {
    position: relative;
    border-radius: 26px;
    overflow: hidden;
    padding: 28px 28px 26px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.00)),
        radial-gradient(1000px 260px at 25% 20%, rgba(255, 255, 255, 0.11), transparent 55%),
        radial-gradient(900px 240px at 80% 90%, rgba(255, 255, 255, 0.08), transparent 55%),
        rgba(16, 24, 37, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 26px 80px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: fadeIn .35s ease-out;
}

.login-tile::before {
    content: "";
    position: absolute;
    inset: -2px;
    background: radial-gradient(720px 300px at 50% 30%, rgba(255, 255, 255, 0.22), transparent 60%);
    opacity: .55;
    pointer-events: none;
    mix-blend-mode: overlay;
}

.login-tile::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0));
    opacity: .45;
    pointer-events: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

.login-top {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    text-align: center;
}

.login-wf-logo {
    height: 56px;
    width: auto;
    filter: drop-shadow(0 22px 28px rgba(0, 0, 0, 0.50));
    opacity: 0.98;
}

.login-title {
    color: rgba(255, 255, 255, 0.92);
    font-weight: 800;
    font-size: 1.65rem;
    letter-spacing: 0.2px;
    text-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    margin-top: 2px;
}

.login-subtitle {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.98rem;
    margin-top: -2px;
}

.error-message {
    display: none;
    position: relative;
    z-index: 2;
    color: #fecaca;
    background: rgba(239, 68, 68, 0.16);
    border: 1px solid rgba(239, 68, 68, 0.25);
    padding: 10px 12px;
    border-radius: 12px;
    font-size: .92rem;
    margin: 14px 0 10px;
    text-align: left;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.error-message:not(:empty) {
    display: block;
}

.form {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 6px;
}

.field label {
    display: block;
    margin-bottom: 8px;
    font-size: .92rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.86);
}

.field input {
    width: 100%;
    padding: 14px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06) !important;
    color: rgba(255, 255, 255, 0.92) !important;
    font-size: 1rem;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    box-sizing: border-box;
}

.field input::placeholder {
    color: rgba(255, 255, 255, 0.55) !important;
}

.field input:focus {
    border-color: rgba(255, 255, 255, 0.26) !important;
    background: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18) !important;
}

.login-btn {
    margin-top: 10px;
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(180deg, rgba(128, 0, 32, 1), rgba(96, 0, 24, 1));
    color: #fff;
    font-size: 1.05rem;
    font-weight: 900;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
    box-shadow: 0 18px 40px rgba(128, 0, 32, 0.28);
}

.login-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
    box-shadow: 0 26px 60px rgba(128, 0, 32, 0.32);
}