/* Modern Clean Light Design System for Admin Portal */
:root {
    --bg-main: #f8fafc;
    --bg-surface: #ffffff;
    --bg-card: #f1f5f9;
    --bg-hover: #e2e8f0;
    --border-color: #e2e8f0;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary-color: #4f46e5;
    --text-secondary: #64748b;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
}

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header .logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), #4338ca);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.3px;
}

.nav-links {
    list-style: none;
    padding: 16px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
    background-color: rgba(79, 70, 229, 0.08);
    color: var(--primary);
}

.nav-link.active {
    border-left: 3px solid var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-muted);
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.topbar {
    height: 70px;
    padding: 0 32px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar h1 {
    font-size: 20px;
    font-weight: 700;
    color: #000000 !important;
}

.topbar-title-wrap h1 {
    color: #000000 !important;
}

/* Stat Cards & KPI Grids */
.stats-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
    gap: 16px !important;
    margin-bottom: 24px !important;
}

.stat-card {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 14px !important;
    padding: 18px 20px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.stat-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    color: var(--text-muted);
}

.stat-value {
    font-size: 30px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.1;
    margin-bottom: 4px;
}

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    vertical-align: middle;
}

.data-table tr:hover td {
    background: #f8fafc;
}

.content-area {
    padding: 32px;
    flex: 1;
}

/* KPI Metric Cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.metric-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 22px;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.metric-card.primary { border-top: 4px solid var(--primary); }
.metric-card.success { border-top: 4px solid var(--success); }
.metric-card.warning { border-top: 4px solid var(--warning); }

.metric-title {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 32px;
    font-weight: 800;
    margin: 8px 0 4px;
    color: var(--text-main);
}

.metric-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* Tables & Panels */
.panel {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 30px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.panel-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

th {
    padding: 12px 16px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    background-color: #f8fafc;
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

tr:hover td {
    background-color: #f8fafc;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-in { background-color: rgba(16, 185, 129, 0.12); color: #047857; }
.badge-out { background-color: rgba(239, 68, 68, 0.12); color: #b91c1c; }
.badge-recent { background-color: rgba(16, 185, 129, 0.12); color: #047857; }
.badge-delayed { background-color: rgba(245, 158, 11, 0.12); color: #b45309; }
.badge-stale { background-color: rgba(107, 114, 128, 0.12); color: #475569; }

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: 0.2s;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

/* Filter Controls */
.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background-color: var(--bg-surface);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

.form-control {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--text-main);
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.password-input-wrapper {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.password-input-wrapper .form-control {
    width: 100%;
    padding-right: 46px;
}

.password-toggle-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    user-select: none;
    transition: transform 0.15s;
}

.password-toggle-btn:hover {
    transform: translateY(-50%) scale(1.2);
}

/* Map Containers */
#map, .map-container {
    width: 100%;
    height: 550px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    z-index: 1;
}

/* ==========================================================================
   Mobile-Friendly & Responsive Architecture
   ========================================================================== */

/* Mobile Hamburger Menu Button */
.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-btn:hover {
    background-color: var(--bg-hover);
    border-color: var(--primary);
    color: var(--primary);
}

.mobile-menu-btn:active {
    transform: scale(0.95);
}

/* Sidebar Close Button (Mobile Only) */
.sidebar-close-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 26px;
    cursor: pointer;
    padding: 6px;
    line-height: 1;
    margin-left: auto;
    border-radius: 8px;
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-close-btn:hover {
    color: var(--text-main);
}

/* Sidebar Backdrop for Mobile Drawer */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(5, 8, 15, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

/* Topbar Components */
.topbar-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.topbar-title-wrap {
    min-width: 0;
}

.topbar-title-wrap h1 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Base Modal Responsiveness */
.modal {
    padding: 16px;
    box-sizing: border-box;
    overflow-y: auto;
}

.modal-content {
    max-height: calc(100dvh - 32px);
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.modal-content::-webkit-scrollbar {
    width: 6px;
}
.modal-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 6px;
}

/* Tablet & Mobile Breakpoint (<= 991px) */
@media (max-width: 991px) {
    body {
        position: relative;
        overflow-x: hidden;
    }

    .mobile-menu-btn {
        display: inline-flex;
    }

    .sidebar-close-btn {
        display: block;
    }

    .sidebar-backdrop {
        display: block;
    }

    /* Off-canvas Sliding Drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        max-width: 82vw;
        height: 100%;
        height: 100dvh;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: none;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 16px 0 40px rgba(0, 0, 0, 0.7);
    }

    .sidebar-header {
        padding: 20px 16px;
    }

    /* Topbar adjustments */
    .topbar {
        height: auto;
        min-height: 64px;
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 12px;
    }

    .topbar h1 {
        font-size: 18px;
    }

    .content-area {
        padding: 20px 16px;
    }

    /* KPI Metrics */
    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
        gap: 14px;
        margin-bottom: 24px;
    }

    .metric-card {
        padding: 16px;
    }

    .metric-value {
        font-size: 26px;
    }
}

/* Phone Breakpoint (<= 768px) */
@media (max-width: 768px) {
    .content-area {
        padding: 16px 12px;
    }

    .topbar {
        padding: 10px 12px;
        gap: 10px;
    }

    .topbar-actions {
        width: 100%;
        justify-content: flex-start;
        gap: 8px;
    }

    .topbar-actions .btn {
        flex: 1 1 auto;
        justify-content: center;
        padding: 9px 12px;
        font-size: 12px;
    }

    .panel {
        padding: 16px 14px;
        margin-bottom: 20px;
        border-radius: 14px;
    }

    .panel-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 16px;
    }

    .panel-header h3 {
        font-size: 15px;
        line-height: 1.4;
    }

    .panel-header .btn {
        width: 100%;
        justify-content: center;
    }

    /* Filter form on mobile */
    .filter-form {
        padding: 14px;
        flex-direction: column;
        gap: 12px;
    }

    .filter-form .form-group {
        width: 100%;
    }

    /* Responsive Mobile Card View for Tables */
    .table-responsive.responsive-cards table,
    .table-responsive.responsive-cards thead,
    .table-responsive.responsive-cards tbody,
    .table-responsive.responsive-cards th,
    .table-responsive.responsive-cards td,
    .table-responsive.responsive-cards tr {
        display: block;
        width: 100%;
    }

    .table-responsive.responsive-cards thead {
        display: none;
    }

    .table-responsive.responsive-cards tr {
        background-color: #0f172a !important; /* Deep dark black card for iPhone/Mobile */
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        border-radius: 16px !important;
        padding: 16px !important;
        margin-bottom: 16px !important;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45) !important;
        color: #f8fafc !important;
    }

    .table-responsive.responsive-cards tr:last-child {
        margin-bottom: 0 !important;
    }

    .table-responsive.responsive-cards td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
        font-size: 13px;
        text-align: right;
        color: #f8fafc !important;
    }

    .table-responsive.responsive-cards td:last-child {
        border-bottom: none !important;
        padding-bottom: 0;
    }

    .table-responsive.responsive-cards td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #94a3b8 !important;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        text-align: left;
        margin-right: 12px;
        flex-shrink: 0;
    }

    /* Special card header for first cell (Staff name & code) */
    .table-responsive.responsive-cards td.staff-primary-cell {
        display: block;
        text-align: left;
        padding-top: 0;
        padding-bottom: 12px;
        margin-bottom: 6px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.14) !important;
    }

    .table-responsive.responsive-cards td.staff-primary-cell::before {
        display: none !important;
    }

    .table-responsive.responsive-cards td.staff-primary-cell strong {
        font-size: 16px;
        font-weight: 800;
        display: block;
        margin-bottom: 3px;
        color: #ffffff !important;
        letter-spacing: -0.2px;
    }

    .table-responsive.responsive-cards td.staff-primary-cell small {
        color: #94a3b8 !important;
        font-size: 12px;
        display: block;
    }

    /* Action buttons in mobile card */
    .table-responsive.responsive-cards td.actions-cell {
        justify-content: flex-end;
        padding-top: 14px;
        margin-top: 6px;
        border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    .table-responsive.responsive-cards td.actions-cell::before {
        content: "Actions";
        color: #94a3b8 !important;
    }

    .table-responsive.responsive-cards .action-btn-group {
        gap: 10px;
    }

    .table-responsive.responsive-cards .btn-icon {
        width: 38px;
        height: 38px;
        font-size: 16px;
        background: rgba(255, 255, 255, 0.08) !important;
        border: 1px solid rgba(255, 255, 255, 0.18) !important;
        color: #ffffff !important;
        border-radius: 10px;
    }

    .table-responsive.responsive-cards .btn-icon:hover {
        background: rgba(255, 255, 255, 0.18) !important;
    }

    /* Modals on Mobile */
    .modal {
        padding: 10px;
        align-items: flex-end;
    }

    .modal-content {
        max-width: 100% !important;
        width: 100%;
        border-radius: 20px 20px 14px 14px;
        padding: 22px 18px;
        max-height: 88vh;
        max-height: 88dvh;
    }

    /* Collapse multi-column modal forms to single column on mobile */
    .modal-content div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .modal-content .form-group {
        margin-bottom: 12px !important;
    }

    .modal-content input,
    .modal-content select {
        font-size: 15px;
        padding: 11px 14px;
    }

    .modal-content .btn {
        padding: 11px 18px;
        font-size: 14px;
    }
}

/* Small Mobile Screen Breakpoint (<= 480px) */
@media (max-width: 480px) {
    .topbar h1 {
        font-size: 16px;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .metric-card {
        padding: 14px;
    }

    .metric-value {
        font-size: 24px;
    }

    /* Login Card Mobile Polish */
    .login-card {
        padding: 24px 18px !important;
        border-radius: 16px !important;
    }

    .login-header .logo {
        width: 46px !important;
        height: 46px !important;
        font-size: 24px !important;
    }

    .login-header h2 {
        font-size: 19px !important;
    }

    .form-control {
        font-size: 16px !important; /* Prevents auto-zoom on iOS */
        padding: 12px 14px !important;
    }

    .password-toggle-btn {
        width: 44px;
        height: 44px;
        right: 4px;
    }

    .btn {
        min-height: 44px;
    }
}

/* ==========================================================================
   Staff Attendance Calendar Styles (Matching Reference Design)
   ========================================================================== */

/* Calendar Top Filter & Selector Bar */
.calendar-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px 20px;
    margin-bottom: 24px;
}

.calendar-staff-select-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 300px;
}

.calendar-staff-select-wrap label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Small KPI Cards Row (Total Working Days, Full Day, Half Days, Leaves, WO) */
.calendar-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.kpi-mini-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.kpi-mini-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.kpi-mini-card.working::before { background: #38bdf8; }
.kpi-mini-card.fullday::before { background: var(--success); }
.kpi-mini-card.halfday::before { background: var(--warning); }
.kpi-mini-card.leave::before { background: #fb923c; }
.kpi-mini-card.weekoff::before { background: #94a3b8; }
.kpi-mini-card.hours::before { background: #6366f1; }

.kpi-mini-card .kpi-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.kpi-mini-card .kpi-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.1;
    margin-bottom: 4px;
}

.kpi-mini-card .kpi-subtext {
    font-size: 11px;
    color: var(--text-muted);
}

/* Calendar Card Container */
.calendar-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
}

/* Calendar Month Header Navigation (< August 2026 >) */
.calendar-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.calendar-nav-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.3px;
    text-align: center;
    flex: 1;
}

.calendar-nav-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    user-select: none;
}

.calendar-nav-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* 7-Column Days Header */
.calendar-weekdays-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
    text-align: center;
}

.calendar-weekday-cell {
    padding: 10px 4px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
}

/* The Calendar Matrix Grid */
.calendar-matrix-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background-color: var(--border-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.calendar-cell {
    background-color: var(--bg-surface);
    min-height: 86px;
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    position: relative;
    cursor: pointer;
    transition: background-color 0.15s ease;
    user-select: none;
}

.calendar-cell:hover:not(.empty) {
    background-color: var(--bg-hover);
    z-index: 2;
}

.calendar-cell.empty {
    background-color: #f8fafc;
    cursor: default;
}

/* Day Number Header */
.calendar-day-num-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-bottom: 6px;
    width: 100%;
}

.calendar-day-num {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
}

/* Cell Body (Timings / Status) */
.calendar-day-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1.35;
    width: 100%;
}

/* Timing Lines */
.timing-in {
    color: #059669;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.timing-out {
    color: #dc2626;
    font-weight: 500;
    letter-spacing: 0.2px;
}

.shift-duration-badge {
    margin-top: 3px;
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 600;
}
.shift-duration-badge.full {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}
.shift-duration-badge.half {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

/* Date Box Working Hours Tag */
.date-hours-tag {
    margin-top: 3px;
    font-size: 11px;
    font-weight: 700;
    color: #4f46e5;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    padding: 1.5px 6px;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    letter-spacing: -0.2px;
    line-height: 1.25;
    white-space: nowrap;
}
.date-hours-tag.full {
    color: #047857;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
}
.date-hours-tag.half {
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fde68a;
}
.date-hours-tag.active {
    color: #1d4ed8;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

/* Week Off (WO) Style - Sunday Only */
.calendar-cell.week-off {
    background-color: #f8fafc;
}

.calendar-cell.week-off .wo-tag {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    background: #e2e8f0;
    border-radius: 4px;
    padding: 2px 6px;
    margin-top: 4px;
    letter-spacing: 0.5px;
}

/* Leave Style (CL, SL, PL) - Warm Peach / Cream Background */
.calendar-cell.leave-day {
    background-color: #fce9d8 !important;
    color: #7c2d12 !important;
    justify-content: center;
}

.calendar-cell.leave-day .calendar-day-num {
    color: #7c2d12 !important;
    font-size: 15px;
    font-weight: 700;
}

.calendar-cell.leave-day .leave-code {
    font-size: 14px;
    font-weight: 800;
    color: #7c2d12 !important;
    margin-top: 4px;
    letter-spacing: 0.5px;
}

/* Today Cell Indicator - Clean subtle border (no star) */
.calendar-cell.is-today {
    box-shadow: inset 0 0 0 2px var(--primary);
}

.calendar-cell.is-today .calendar-day-num {
    color: #a5b4fc;
    font-weight: 800;
}

/* Calendar Legend */
.calendar-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-muted);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* Mobile Adjustments for Calendar */
@media (max-width: 768px) {
    .calendar-card {
        padding: 16px 10px;
        border-radius: 16px;
    }
    .calendar-nav-title {
        font-size: 17px;
    }
    .calendar-cell {
        min-height: 80px;
        padding: 5px 2px;
    }
    .calendar-day-num {
        font-size: 12px;
    }
    .timing-in, .timing-out {
        font-size: 9.5px;
        line-height: 1.25;
    }
    .date-hours-tag {
        font-size: 9.5px;
        padding: 1px 4px;
        gap: 2px;
        margin-top: 2px;
    }
    .calendar-cell.week-off .wo-tag {
        font-size: 10px;
    }
    .calendar-cell.leave-day .leave-code {
        font-size: 11px;
    }
    .shift-duration-badge {
        display: none;
    }
    .calendar-weekday-cell {
        font-size: 11px;
        padding: 6px 2px;
    }
    .calendar-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .calendar-cell {
        min-height: 74px;
        padding: 4px 1px;
    }
    .timing-in, .timing-out {
        font-size: 8.5px;
        letter-spacing: -0.2px;
    }
    .date-hours-tag {
        font-size: 8.5px;
        padding: 0.5px 3px;
        letter-spacing: -0.3px;
    }
    .calendar-nav-title {
        font-size: 16px;
    }
}
