/* Modern & Elegant REKA Dashboard - Eco-Friendly Theme */

:root {
    --primary: #3498db;
    --primary-dark: #2980b9;
    --primary-light: #5dade2;
    --secondary: #34495e;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #16a085;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --border: #ecf0f1;
    --bg-light: #f8f9fa;
    --bg-lighter: #ffffff;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    color: var(--text-dark);
    background: var(--bg-light);
}

body {
    display: flex;
    overflow: hidden;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: linear-gradient(180deg, #1f2937 0%, #2d3748 100%);
    border-right: 1px solid rgba(52, 152, 219, 0.15);
    display: flex;
    flex-direction: column;
    padding: 20px;
    z-index: 1000;
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    transition: width 0.3s ease, transform 0.3s ease;
}

body.sidebar-collapsed .sidebar {
    width: 80px;
}

body.sidebar-collapsed .sidebar-header {
    flex-direction: column;
    gap: 0;
}

body.sidebar-collapsed .sidebar-header h1 {
    display: none;
}

body.sidebar-collapsed .nav-link span {
    display: none;
}

body.sidebar-collapsed .sidebar-footer {
    padding: 0;
}

body.sidebar-collapsed .btn-logout span {
    display: none;
}

body.sidebar-collapsed .main-container {
    margin-left: 80px;
    width: calc(100% - 80px);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(52, 152, 219, 0.2);
}

.sidebar-logo {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border-radius: 10px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo img {
    width: 100%;
    height: 100%;
    border-radius: 6px;
}

.sidebar-header h1 {
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: #b0bbc4;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    background: transparent;
}

.nav-link:hover {
    color: #3498db;
    background: rgba(52, 152, 219, 0.1);
}

.nav-link.active {
    color: #ffffff;
    background: linear-gradient(90deg, rgba(52, 152, 219, 0.25) 0%, transparent 100%);
    border-left: 3px solid #3498db;
    padding-left: 13px;
}

.nav-icon {
    font-size: 18px;
    display: inline-block;
    min-width: 20px;
}

body.sidebar-collapsed .nav-icon {
    min-width: auto;
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid rgba(52, 152, 219, 0.2);
    margin-top: auto;
    flex-shrink: 0;
}

.btn-logout {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.btn-logout:hover {
    background: rgba(231, 76, 60, 0.25);
}

/* ==================== MAIN CONTAINER ==================== */
.main-container {
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: calc(100% - 260px);
}

/* ==================== TOP HEADER ==================== */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    background: var(--bg-lighter);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    margin-right: 12px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.menu-toggle:hover {
    background: rgba(52, 152, 219, 0.1);
}

body.sidebar-collapsed .menu-toggle {
    display: inline-block;
}

.header-title h2 {
    font-size: 26px;
    color: var(--text-dark);
    font-weight: 700;
    letter-spacing: -0.3px;
}

.header-sub {
    color: var(--text-light);
    font-size: 13px;
    margin-top: 4px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-logout-mobile {
    display: none;
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-weight: 500;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.btn-logout-mobile:hover {
    background: rgba(231, 76, 60, 0.25);
}

.user-avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    font-weight: 700;
    box-shadow: var(--shadow-md);
}

.user-details {
    display: flex;
    flex-direction: column;
}

body.sidebar-collapsed .user-details {
    display: none;
}

.user-name {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--text-light);
}

/* ==================== CONTENT AREA ==================== */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    scroll-behavior: smooth;
}

.content-area::-webkit-scrollbar {
    width: 8px;
}

.content-area::-webkit-scrollbar-track {
    background: transparent;
}

.content-area::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.section-header h2 {
    font-size: 24px;
    color: var(--text-dark);
    font-weight: 700;
}

/* ==================== DASHBOARD STATS ==================== */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

/* Dashboard new layout */
.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.text-muted { color: var(--text-light); }

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.cards-grid.two-cols {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    margin-top: 16px;
}

.card {
    background: var(--bg-lighter);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.card.kpi {
    display: flex;
    align-items: center;
    gap: 12px;
    height: auto;
}

.cards-grid .card:not(.kpi) {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card-header h4 { font-size: 16px; font-weight: 700; }

.kpi { display: flex; align-items: center; gap: 12px; }
.kpi-icon { width: 44px; height: 44px; display:flex; align-items:center; justify-content:center; border-radius: 10px; background: rgba(52,152,219,0.12); }
.kpi-label { font-size: 12px; color: var(--text-light); text-transform: uppercase; }
.kpi-value { font-size: 24px; font-weight: 700; }

.list { display: grid; gap: 10px; flex: 1; }
.list-row { display:flex; align-items:center; justify-content: space-between; }
.list-label { color: var(--text-light); }
.list-value { font-weight: 700; }

.actions { display:flex; gap: 10px; margin-top: auto; padding-top: 12px; }

/* Heatmap */
.heatmap {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    padding: 12px;
}
.heatmap-day {
    height: 34px;
    border-radius: 6px;
    background: var(--border);
    position: relative;
}
.heatmap-day.present { background: rgba(39,174,96,0.25); }
.heatmap-day.leave { background: rgba(243,156,18,0.25); }
.heatmap-day.sick { background: rgba(231,76,60,0.25); }
.heatmap-day .label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--text-dark);
}

/* Team presence */
.team-presence { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px; }
.presence-item { display:flex; align-items:center; gap:8px; padding:8px 10px; border:1px solid var(--border); border-radius:8px; }
.presence-dot { width:10px; height:10px; border-radius:50%; }
.presence-dot.onsite { background:#27ae60; }
.presence-dot.remote { background:#3498db; }
.presence-dot.sick { background:#e74c3c; }

.stat-card {
    background: var(--bg-lighter);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 20px;
    transition: all 0.3s ease;
    cursor: default;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3498db 0%, #5dade2 100%);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: #3498db;
}

.stat-icon {
    font-size: 32px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    flex-shrink: 0;
    background: rgba(52, 152, 219, 0.1);
}

.stat-info h3 {
    font-size: 13px;
    color: var(--text-light);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
}

.stat-label {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
    display: block;
}

/* ==================== DASHBOARD GRID ==================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
}

.dashboard-section {
    background: var(--bg-lighter);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.dashboard-section:hover {
    box-shadow: var(--shadow-md);
    border-color: #3498db;
}

.dashboard-section .section-header {
    margin-bottom: 20px;
}

.dashboard-section h3 {
    font-size: 16px;
    color: var(--text-dark);
    font-weight: 700;
    margin: 0;
}

.attendance-quick-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-label {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 500;
}

.info-value {
    font-size: 16px;
    color: var(--text-dark);
    font-weight: 600;
}

.quick-actions {
    display: flex;
    gap: 12px;
}

.btn-action {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-checkin {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.2);
}

.btn-checkin:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(39, 174, 96, 0.3);
}

.btn-checkout {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.2);
}

.btn-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(231, 76, 60, 0.3);
}

.pending-list {
    max-height: 300px;
    overflow-y: auto;
}

/* Project list */
.project-list {
    display: grid;
    gap: 12px;
}

.project-item {
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 16px;
    background: #fbfdff;
}

.project-title {
    font-weight: 700;
    color: var(--text-dark);
}

.project-sub {
    color: var(--text-light);
    font-size: 12px;
    margin-top: 4px;
}

.badge {
    display: inline-block;
    background: var(--border);
    color: var(--text-light);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    margin-right: 6px;
}

.badge-blue { background: rgba(52,152,219,0.15); color: #2980b9; }
.badge-green { background: rgba(39,174,96,0.15); color: #229954; }

/* ==================== BUTTONS ==================== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.btn-secondary {
    background: var(--border);
    color: var(--text-dark);
}

.btn-secondary:hover {
    background: #d5dbdb;
}

.btn-large {
    padding: 16px 32px;
    font-size: 15px;
    min-width: 200px;
}

.btn-icon {
    font-size: 18px;
}

/* ==================== ATTENDANCE SECTION ==================== */
.attendance-actions {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.status-message {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    display: none;
}

.status-message.show {
    display: block;
}

.status-message.success {
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
    border-left: 4px solid #27ae60;
}

.status-message.error {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border-left: 4px solid #e74c3c;
}

/* ==================== TABLES ==================== */
.table-container {
    background: var(--bg-lighter);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

.table-container h3 {
    font-size: 16px;
    color: var(--text-dark);
    font-weight: 700;
    margin-bottom: 16px;
}

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

.data-table thead {
    background: #f0f9ff;
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.data-table tbody tr:hover {
    background: #f8fbff;
}

/* ==================== FORMS ==================== */
.filter-section {
    background: var(--bg-lighter);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.filter-group {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.filter-group input,
.filter-group select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    transition: all 0.3s ease;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* ==================== MODAL ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-dialog {
    background: var(--bg-lighter);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border);
    background: #f0f9ff;
}

.modal-header h3 {
    font-size: 18px;
    color: var(--text-dark);
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    color: var(--text-dark);
}

.modal-body {
    padding: 24px;
}

/* ==================== REPORTS ==================== */
.report-content {
    background: var(--bg-lighter);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow-sm);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 240px;
    }

    .main-container {
        margin-left: 240px;
        width: calc(100% - 240px);
    }

    .content-area {
        padding: 16px;
    }

    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .top-header {
        padding: 12px 16px;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .cards-grid.two-cols {
        grid-template-columns: 1fr;
    }

    .kpi {
        gap: 8px;
    }

    .kpi-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .kpi-label {
        font-size: 11px;
    }

    .kpi-value {
        font-size: 20px;
    }

    .card {
        padding: 12px;
    }

    .card-header h4 {
        font-size: 14px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .btn-large {
        min-width: auto;
        padding: 12px 16px;
    }

    .dash-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .dash-actions .btn {
        flex: 1;
        min-width: 120px;
    }

    .header-sub {
        font-size: 12px;
    }

    .data-table {
        font-size: 13px;
    }

    .data-table th, .data-table td {
        padding: 10px 8px;
    }

    .list-row {
        padding: 8px 0;
        font-size: 13px;
    }

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

    .form-group label {
        font-size: 13px;
    }

    .form-group input, .form-group select, .form-group textarea {
        font-size: 14px;
        padding: 10px;
    }

    .modal-dialog {
        width: 90%;
        max-width: 500px;
        max-height: 85vh;
    }

    .attendance-actions {
        flex-direction: column;
        gap: 10px;
    }

    .attendance-actions .btn-large {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 70px;
        padding: 12px;
    }

    .sidebar-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 4px;
    }

    .sidebar-header h1 {
        display: none;
    }

    /* Show text when sidebar open */
    body.sidebar-open .sidebar {
        width: 260px;
        padding: 20px;
    }

    body.sidebar-open .sidebar-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 4px;
    }

    body.sidebar-open .sidebar-header h1 {
        display: block;
        margin-bottom: 4px;
        font-size: 14px;
    }

    body.sidebar-open .nav-link {
        padding: 12px 16px;
        gap: 12px;
    }

    body.sidebar-open .nav-link span {
        display: inline;
    }

    body.sidebar-open .sidebar-footer {
        padding-top: 16px;
        border-top: 1px solid rgba(52, 152, 219, 0.2);
        display: none;
        margin-top: 0;
    }

    body.sidebar-open .btn-logout {
        padding: 12px 16px;
        font-size: 14px;
        width: 100%;
        display: none !important;
        align-items: center;
        gap: 12px;
    }

    body.sidebar-open .btn-logout span {
        display: none !important;
    }

    .nav-link {
        padding: 10px 8px;
        gap: 0;
    }

    .nav-link span {
        display: none;
    }

    .sidebar-footer {
        padding: 0;
        border: none;
        display: none;
    }

    .btn-logout {
        padding: 8px;
        font-size: 12px;
        display: none;
    }

    .btn-logout span {
        display: none;
    }

    .content-area {
        padding: 10px;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .cards-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .cards-grid.two-cols {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 10px;
    }

    .kpi {
        gap: 8px;
    }

    .kpi-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .kpi-label {
        font-size: 10px;
    }

    .kpi-value {
        font-size: 18px;
    }

    .top-header {
        padding: 10px 12px;
        gap: 6px;
        flex-wrap: wrap;
    }

    .header-title {
        flex: 1;
        min-width: 0;
    }

    .header-title h2 {
        font-size: 18px;
    }

    .header-sub {
        font-size: 11px;
    }

    .user-avatar {
        width: 36px;
        height: 36px;
        font-size: 16px;
        display: none;
    }

    .btn-logout-mobile {
        display: block !important;
    }

    .user-name {
        font-size: 12px;
        display: none;
    }

    .user-role {
        font-size: 11px;
        display: none;
    }

    /* Mobile user details - only show on hover */
    .user-details {
        position: absolute;
        top: 100%;
        right: 0;
        margin-top: 8px;
        background: var(--bg-lighter);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 12px 16px;
        box-shadow: var(--shadow-md);
        z-index: 1000;
        min-width: 200px;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        pointer-events: none;
    }

    .header-user {
        position: relative;
    }

    .header-user:active .user-details {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .menu-toggle {
        padding: 6px 8px;
        font-size: 16px;
        margin-right: 8px;
    }

    .dash-actions {
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }

    .dash-actions .btn {
        width: 100%;
        padding: 12px 12px;
        font-size: 12px;
    }

    .btn {
        padding: 10px 14px;
        font-size: 12px;
    }

    .btn-large {
        padding: 12px 16px;
        font-size: 13px;
        min-width: auto;
        width: 100%;
    }

    .btn-icon {
        font-size: 16px;
    }

    .list-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding: 8px 0;
    }

    .list-value {
        width: 100%;
        text-align: right;
    }

    .card-header h4 {
        font-size: 13px;
    }

    .data-table {
        font-size: 12px;
        border-collapse: collapse;
    }

    .data-table th {
        padding: 8px 6px;
        font-size: 11px;
    }

    .data-table td {
        padding: 8px 6px;
    }

    .table-container h3 {
        font-size: 14px;
        margin-bottom: 10px;
    }

    .section-header {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 16px;
    }

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

    .form-group label {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .form-group input, .form-group select, .form-group textarea {
        font-size: 14px;
        padding: 10px;
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .form-actions {
        flex-direction: column;
        gap: 8px;
    }

    .form-actions .btn {
        width: 100%;
    }

    .modal-dialog {
        width: 95%;
        max-width: 450px;
        max-height: 90vh;
        border-radius: 12px;
    }

    .modal-body {
        padding: 16px;
        max-height: calc(90vh - 60px);
        overflow-y: auto;
    }

    .attendance-actions {
        flex-direction: column;
        gap: 10px;
    }

    .attendance-actions .btn-large {
        width: 100%;
    }

    .filter-group {
        flex-direction: column;
        gap: 8px;
    }

    .filter-group input, .filter-group button {
        width: 100%;
    }
}

/* Overlay for mobile sidebar */
.backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 900;
}

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

/* Mobile sidebar behaviour */
@media (max-width: 980px) {
    .menu-toggle { display: inline-block !important; }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform .25s ease;
        width: 260px;
        box-shadow: 6px 0 16px rgba(0,0,0,0.2);
        z-index: 1001;
    }

    body.sidebar-open .sidebar { 
        transform: translateX(0);
    }
    
    /* Show text when sidebar is open */
    body.sidebar-open .sidebar-header h1 {
        display: block;
    }
    
    body.sidebar-open .nav-link span {
        display: inline;
    }
    
    body.sidebar-open .btn-logout span {
        display: inline;
    }
    
    body.sidebar-collapsed .sidebar { width: 260px; }
    body.sidebar-collapsed .sidebar-header h1 { display: block; }
    body.sidebar-collapsed .nav-link span { display: inline; }
    body.sidebar-collapsed .btn-logout span { display: inline; }

    .main-container {
        margin-left: 0;
        width: 100%;
    }

    .top-header { padding: 12px 16px; }
}

/* Desktop only - always show tooltip on hover */
@media (min-width: 981px) {
    .header-user {
        position: relative;
        cursor: pointer;
    }

    .user-details {
        position: absolute;
        top: 100%;
        right: 0;
        margin-top: 8px;
        background: var(--bg-lighter);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 12px 16px;
        box-shadow: var(--shadow-md);
        z-index: 1000;
        min-width: 220px;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        pointer-events: none;
    }

    .header-user:hover .user-details {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    /* When sidebar is not collapsed, hide user details in header by default */
    body:not(.sidebar-collapsed) .user-details {
        display: none;
        opacity: 0;
        visibility: hidden;
    }

    body:not(.sidebar-collapsed) .header-user:hover .user-details {
        display: flex;
        opacity: 1;
        visibility: visible;
    }
}

/* Mobile only - tap to show tooltip */
@media (max-width: 480px) {
    .user-details {
        position: absolute;
        top: 100%;
        right: 0;
        margin-top: 8px;
        background: var(--bg-lighter);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 12px 16px;
        box-shadow: var(--shadow-md);
        z-index: 1000;
        min-width: 220px;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
    }

    .header-user:active .user-details {
        opacity: 1;
        visibility: visible;
    }

    .menu-toggle {
        display: flex;
    }
}
