/* Reset & Global Styles */
* {
    box-sizing: border-box;
}

:root {
    --blue: #72a1d7;
    --blue2: #6898ce;
    --blue-dark: #5f8fc8;
    --bg: #edf5fd;
    --text: #111;
    --muted: #777;
    --line: #eaf2fb;
    --card: #fff;
    --danger: #c95555;
}

html, body {
    margin: 0;
    min-height: 100%;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background: linear-gradient(#e8f2fc, #f5f9fd);
}

body {
    overflow-x: hidden;
}

.dashboard {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR — mengikuti warna dan proporsi referensi */
.sidebar {
    width: 240px;
    min-width: 240px;
    background: linear-gradient(160deg, #000429 0%, #384095 100%);
    color: #fff;
    box-shadow: 2px 0 12px rgba(55, 95, 180, .08);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
}

.brand {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 18px;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
    height: 38px;
    width: 38px;
    object-fit: contain;
    transition: transform 0.2s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.sidebar-logo:hover {
    transform: scale(1.08);
}

.brand-text {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #ffffff;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.nav {
    padding-top: 6px;
    text-decoration: none;
}

.nav a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.nav-item {
    height: 45px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    color: rgba(255, 255, 255, .9);
    font-size: 14px;
    cursor: pointer;
    position: relative;
    transition: .2s;
}

.nav-item .icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
    opacity: .95;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, .15);
    color: #fff;
}

.nav-item.active:after {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #fff;
    border-radius: 3px 0 0 3px;
}

.nav-group-title {
    height: 40px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    opacity: .7;
    margin-top: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-group-title .arrow {
    margin-left: auto;
    font-size: 9px;
}

/* CONTENT */
.main {
    margin-left: 240px;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 48px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 22px;
    border-bottom: 1px solid #f0f2f6;
    position: sticky;
    top: 0;
    z-index: 90;
}

.search {
    flex: 1;
    color: #c3cad3;
    font-size: 10px;
}

.search span {
    margin-right: 7px;
    color: #c5ccd6;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 10px;
    color: #8e97a3;
}

.avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6b737c, #d7dce1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
}

.content {
    padding: 28px 35px 40px;
    flex: 1;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

/* Page Header & Grid Layouts */
.page-title {
    font-size: 22px;
    color: #2d3748;
    font-weight: 700;
    letter-spacing: -0.3px;
}

/* Period Selector (Hari Ini / 30 Hari / Ringkasan) */
.period {
    display: flex;
    gap: 8px;
}
.period span {
    padding: 6px 16px;
    border-radius: 18px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: #7090e9;
    background: #ffffff;
    border: 1px solid #eef2f6;
    transition: all 0.2s ease;
}
.period span.selected {
    background: #5b7cf7;
    color: #ffffff;
    border-color: #5b7cf7;
    box-shadow: 0 3px 8px rgba(91,124,247,0.25);
}
.period span:hover:not(.selected) {
    background: #f5f7fc;
    color: #5b7cf7;
}

/* Footer */
.main-footer {
    background: transparent;
    color: #9aa5b4;
    text-align: center;
    padding: 20px;
    font-size: 11px;
    margin-top: auto;
}

/* User Dropdown override for new topbar */
.user-dropdown {
    position: relative;
    display: inline-block;
}
.user-name {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}
.user-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 130%;
    background-color: #ffffff;
    min-width: 150px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.1);
    z-index: 999;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--line);
}
.user-dropdown-content.show-dropdown {
    display: block;
}
.user-dropdown-content a {
    color: var(--text);
    padding: 10px 14px;
    text-decoration: none;
    display: block;
    font-size: 11px;
    border-bottom: 1px solid var(--line);
    transition: background-color 0.2s;
}
.user-dropdown-content a:hover {
    background-color: var(--bg);
}

/* DASHBOARD GRID LAYOUT */
.grid-main {
    display: grid;
    grid-template-columns: minmax(0, 2.15fr) minmax(280px, .85fr);
    gap: 20px;
}

/* PANELS (Dashboard Cards) */
.panel {
    background: #ffffff;
    border-radius: 27px;
    padding: 22px 24px;
    border: 0;
    box-shadow: 0 10px 24px rgba(70, 105, 145, 0.16);
}

.panel-title {
    font-size: 15px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 4px;
}

.panel-subtitle {
    font-size: 12px;
    color: #a0aec0;
    margin-bottom: 20px;
}

/* STATISTICS */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 13px;
    margin-bottom: 13px;
}

.stat {
    height: 116px;
    border-radius: 16px;
    color: white;
    padding: 17px 15px 12px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 24px rgba(70, 105, 145, 0.16);
}

.stat:before {
    content: "";
    position: absolute;
    width: 70px;
    height: 70px;
    border: 2px solid rgba(255, 255, 255, .10);
    border-radius: 50%;
    right: -5px;
    top: 10px;
}

.stat:after {
    content: "";
    position: absolute;
    width: 35px;
    height: 35px;
    border: 2px solid rgba(255, 255, 255, .08);
    border-radius: 50%;
    right: 15px;
    top: 27px;
}

.stat.blue {
    background: linear-gradient(105deg, #5278f4, #b45ff4);
}

.stat.cyan {
    background: linear-gradient(105deg, #2da9db, #587cf3);
}

.stat.orange {
    background: linear-gradient(105deg, #ef607f, #f6a24c);
}

.stat.green {
    background: linear-gradient(105deg, #38c99d, #91dc4d);
}

.stat .stat-label {
    font-size: 11px;
    opacity: .92;
    color: #ffffff;
}

.stat .stat-number {
    font-size: 24px;
    line-height: 1.25;
    margin-top: 4px;
    font-weight: 400;
    color: #ffffff;
}

.stat .stat-number small {
    font-size: 11px;
    color: #ffffff;
}

.progress {
    height: 4px;
    background: rgba(255, 255, 255, .27);
    border-radius: 10px;
    margin-top: 13px;
    position: relative;
}

.progress i {
    display: block;
    height: 100%;
    background: rgba(255, 255, 255, .95);
    border-radius: 10px;
}

.stat .stat-percent {
    position: absolute;
    right: 15px;
    bottom: 10px;
    font-size: 9px;
    opacity: .92;
    color: #ffffff;
}

/* Cards & UI Components */
.card {
    background-color: #ffffff;
    border-radius: 27px;
    box-shadow: 0 10px 24px rgba(70, 105, 145, 0.16);
    padding: 20px;
    margin-bottom: 25px;
    border: 0;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 8px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-left: 5px solid #5b7cf7;
}

.stat-card.hadir { border-left-color: #2e7d32; }
.stat-card.terlambat { border-left-color: #f57f17; }
.stat-card.izin { border-left-color: #00695c; }

.stat-num {
    font-size: 28px;
    font-weight: 700;
    color: #333;
}

.stat-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #4a5568;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    font-family: inherit;
    font-size: 14px;
    border: 1px solid #cccccc;
    border-radius: 4px;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: #5b7cf7;
    outline: none;
    box-shadow: 0 0 0 3px rgba(91,124,247,0.1);
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: #e3f2fd; /* Light Blue */
    color: #1565c0; /* Darker blue text */
}

.btn-primary:hover {
    background-color: #bbdefb;
    color: #0d47a1;
}

.btn-accent {
    background-color: #f5c842;
    color: #333333;
}

.btn-accent:hover {
    background-color: #c9a800;
    color: #ffffff;
}

.btn-danger {
    background-color: #ffebee; /* Light Red/Pink */
    color: #c62828; /* Darker red text */
}

.btn-danger:hover {
    background-color: #ffcdd2;
    color: #b71c1c;
}

.btn-secondary {
    background-color: #6c757d;
    color: #ffffff;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-outline-gold {
    background-color: transparent;
    color: #f5c842;
    border-color: #f5c842;
}

.btn-outline-gold:hover {
    background-color: #f5c842;
    color: #1a237e;
}

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

.btn-group {
    display: flex;
    gap: 10px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background-color: #ffffff;
}

.table th, .table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eeeeee;
}

.table th {
    background-color: #f8fafc;
    color: #1a237e;
    font-weight: 600;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: #fcfdfe;
}

.table-hover tbody tr:hover {
    background-color: #f1f5f9;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
}

.badge-hadir {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.badge-terlambat {
    background-color: #fff3e0;
    color: #f57f17;
}

.badge-izin {
    background-color: #e0f2f1;
    color: #00695c;
}

/* Attendance Photo Thumbnail */
.img-thumbnail {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: transform 0.2s;
}

.img-thumbnail:hover {
    transform: scale(1.1);
}

/* Login Page Specific Layout */
.login-body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #1a237e 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 10px;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    padding: 40px 35px;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    height: 80px;
    object-fit: contain;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.08));
    transition: transform 0.3s ease;
}

.login-logo:hover {
    transform: scale(1.05);
}

.login-header h2 {
    color: #1e293b;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.login-header p {
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
}

/* Glassmorphism Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #ffffff;
    margin: auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #333;
}

.alert {
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-danger {
    background-color: #fde8e8;
    color: #c62828;
    border: 1px solid #f8b4b4;
}

.alert-success {
    background-color: #eafaf1;
    color: #2e7d32;
    border: 1px solid #b2ecd2;
}

/* Charts Wrapper */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

/* RESPONSIVE LAYOUT MEDIA QUERIES */
@media(max-width:992px) {
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

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

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

@media(max-width:768px) {
    /* Set Dashboard to Column so Main stretches 100% */
    .dashboard {
        flex-direction: column !important;
    }    /* Sembunyikan Sidebar asli di Mobile, digantikan oleh Bottom Navbar baru */
    .sidebar {
        display: none !important;
    }

    /* Main Content adjustments for mobile */
    .main {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px)) !important; /* Space for bottom navbar */
    }

    .content {
        padding: 16px 14px 25px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .topbar {
        padding: 0 16px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .top-actions {
        gap: 10px !important;
    }

    .form-row {
        flex-direction: column !important;
        gap: 12px !important;
    }

    .form-row .form-group {
        width: 100% !important;
    }

    .page-head, .page-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }

    /* CRITICAL: Overriding all inline min-widths that break layout on mobile */
    .card, .panel {
        padding: 18px 16px !important;
        min-width: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
        word-wrap: break-word !important;
        word-break: break-word !important;
    }

    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100% !important;
        display: block !important;
    }

    .table-responsive .table,
    .table-responsive .table-premium:not(.table-mobile-cards) {
        min-width: 850px !important; /* Force min-width to enable smooth horizontal scroll on mobile */
    }

    /* Table to Card View on Mobile */
    .table-responsive .table-mobile-cards {
        min-width: 100% !important;
        border: 0 !important;
        display: block !important;
    }
    .table-mobile-cards thead {
        border: none !important;
        clip: rect(0 0 0 0) !important;
        height: 1px !important;
        margin: -1px !important;
        overflow: hidden !important;
        padding: 0 !important;
        position: absolute !important;
        width: 1px !important;
        display: block !important;
    }
    .table-mobile-cards tbody {
        display: block !important;
        width: 100% !important;
    }
    .table-mobile-cards tr {
        display: flex !important;
        flex-direction: column !important;
        margin-bottom: 12px !important;
        background-color: #a1c2e73b !important;
        border-radius: 12px !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.06) !important;
        padding: 10px 12px !important;
        border: 1px solid #eef2f6 !important;
    }
    .table-mobile-cards td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: flex-start !important;
        font-size: 13px !important;
        text-align: right !important;
        padding: 5px 4px !important;
        border-bottom: 1px dashed #e2e8f0 !important;
        border-top: none !important;
        border-left: none !important;
        border-right: none !important;
        order: 3;
    }
    .table-mobile-cards td[data-label="No"] {
        order: 1 !important;
    }
    .table-mobile-cards td[data-label="Foto"],
    .table-mobile-cards td[data-label="Bukti Foto"] {
        order: 2 !important;
        justify-content: flex-start !important;
        padding: 8px 4px !important;
    }
    .table-mobile-cards td[data-label="Foto"]::before,
    .table-mobile-cards td[data-label="Bukti Foto"]::before {
        display: none !important;
    }
    .table-mobile-cards td[data-label="Foto"] img,
    .table-mobile-cards td[data-label="Bukti Foto"] img {
        width: 65px !important;
        height: 65px !important;
        border-radius: 8px !important;
        object-fit: cover !important;
    }
    .table-mobile-cards td[data-label="Bukti Foto"] div {
        display: flex !important;
        flex-direction: row !important;
        justify-content: flex-start !important;
        gap: 12px !important;
    }
    .table-mobile-cards td:last-child {
        border-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    .table-mobile-cards td:first-child {
        padding-top: 0 !important;
    }
    .table-mobile-cards td::before {
        content: attr(data-label) !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
        color: #64748b !important;
        text-align: left !important;
        margin-right: 15px !important;
        flex-shrink: 0;
        font-size: 11px !important;
        letter-spacing: 0.5px !important;
    }
    .table-mobile-cards td > * {
        text-align: right;
    }
    .table-mobile-cards td .badge {
        font-size: 11px !important;
        padding: 5px 10px !important;
    }
    .table-mobile-cards td .absen-photo {
        margin: 0 !important;
    }
    /* Ensure action buttons don't stretch fully if not needed */
    .table-mobile-cards td form {
        margin: 0 !important;
        display: inline-block;
    }

    .table th, .table td, .table-premium th, .table-premium td {
        padding: 10px 12px !important;
        font-size: 11.5px !important;
    }

    /* Mobile improvements for absensi.php pegawai table */
    @media(max-width:768px) {
        /* Sticky header during horizontal scroll */
        .table-responsive {
            position: relative;
        }
        .table-responsive thead {
            position: sticky;
            left: 0;
            z-index: 10;
            box-shadow: 2px 0 8px rgba(0,0,0,0.08);
        }
        .table-responsive th:first-child {
            left: 0;
            z-index: 11;
        }
        .table-responsive th:last-child {
            right: 0;
        }

        /* Removed legacy inline photo overrides since we are using order and flex now */

        /* Waktu Pulang - compact badge */
        .table-responsive .table-premium td:nth-child(5) .badge-warning {
            font-size: 9px !important;
            padding: 2px 6px !important;
            white-space: nowrap;
        }

        /* Catatan Pulang - truncate long text */
        .table-responsive .table-premium td:nth-child(8) {
            max-width: 120px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        /* Aksi column - larger touch target */
        .table-responsive .table-premium td:last-child .btn-sm {
            padding: 8px 12px !important;
            font-size: 12px !important;
            min-height: 40px;
        }

        /* Row numbering - keep visible */
        .table-responsive .table-premium td:first-child {
            position: sticky;
            left: 0;
            background: #fff;
            z-index: 5;
            border-left: 2px solid #5b7cf7;
        }
        .table-responsive .table-premium th:first-child {
            position: sticky;
            left: 0;
            z-index: 12;
            border-left: 2px solid #5b7cf7;
        }

        /* Prevent header text wrapping on mobile - keep horizontal */
        .table-responsive thead th {
            white-space: nowrap !important;
        }

        /* Catatan Pulang header - ensure horizontal display */
        .table-responsive .table-premium th:nth-child(8) {
            min-width: 120px;
        }

        /* Improve filter form on mobile */
        .card .form-row {
            flex-direction: column;
        }
        .card .form-row .form-group {
            width: 100%;
        }
        
        /* Search input full width */
        #tableSearch {
            width: 100%;
            margin-bottom: 10px;
        }

        /* Pagination - larger touch targets */
        .pagination .btn-sm {
            padding: 10px 16px !important;
            font-size: 13px !important;
            min-height: 44px;
            min-width: 44px;
        }
        .pagination span {
            padding: 0 10px;
            font-size: 12px;
        }
    }

    .stats {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .stat {
        padding: 14px 12px 10px !important;
        height: auto !important;
        min-height: 102px !important;
    }

    .stat .stat-number {
        font-size: 20px !important;
    }

    .stat .stat-label {
        font-size: 10px !important;
    }

    .tab-container {
        gap: 8px !important;
        flex-wrap: nowrap !important;
    }
    
    .tab-link {
        font-size: 11px !important;
        padding: 0 10px !important;
        height: 38px !important;
        flex: 1 !important;
        text-align: center !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .btn-pill {
        font-size: 11px !important;
        padding: 0 14px !important;
        height: 34px !important;
    }
    /* Collapsible Filter Logic */
    .mobile-filter-toggle {
        display: inline-flex !important;
        align-items: center;
        gap: 6px;
        padding: 8px 16px;
        font-size: 12px;
        border: 1px solid #e3f2fd;
        color: #1565c0;
        background: #e3f2fd;
        border-radius: 20px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    .mobile-filter-toggle.active {
        background: #1565c0;
        color: #ffffff;
        border-color: #1565c0;
    }
    .filter-form-wrapper {
        display: none;
        margin-top: 15px;
        border-top: 1px dashed #e2e8f0;
        padding-top: 15px;
    }
    .filter-form-wrapper.show {
        display: block;
    }
}

/* Hide mobile toggle button on desktop */
.mobile-filter-toggle {
    display: none;
}

/* Print styling for QR code cards */
@media print {
    body * {
        visibility: hidden;
    }
    .print-area, .print-area * {
        visibility: visible;
    }
    .print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 40px;
    }
    .print-card {
        border: 2px solid #0d47a1 !important;
        padding: 30px !important;
        border-radius: 8px !important;
        text-align: center !important;
        width: 350px !important;
    }
    .print-card img {
        width: 250px !important;
        height: 250px !important;
    }
}

/* Password toggle utility */
.password-wrapper {
    position: relative;
    width: 100%;
}
.password-wrapper .form-control {
    padding-right: 40px;
}
.btn-toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #666666;
    padding: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-toggle-password:hover {
    color: #0d47a1;
}

/* Input group utility for aligning inputs and buttons inline */
.input-group {
    display: flex;
    gap: 8px;
    width: 100%;
}
.input-group .form-control {
    flex: 1;
}
.input-group .btn {
    white-space: nowrap;
    padding: 10px 15px;
}


/* Table Modern / Accordion Grid */
.table-modern {
  margin-top: 12px;
  border-radius: 7px;
  overflow: hidden;
}
.thead-modern, .row-modern {
  display: grid;
  /* 4 columns: Waktu, Siswa, Status, Aksi(arrow) */
  grid-template-columns: 1fr 2fr 1fr 0.3fr;
  align-items: center;
}
.thead-modern {
  height: 40px;
  background: #5b7cf7;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2px;
  padding: 0 15px;
  border-radius: 7px 7px 0 0;
}
.thead-modern > div { padding-left: 22px; }
.row-modern {
  min-height: 55px;
  margin-top: 8px;
  padding: 0 15px;
  border-radius: 7px;
  background: #fff;
  color: #4d5159;
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 2px 5px rgba(0,0,0,0.03);
  border: 1px solid #eef2f6;
  transition: all 0.2s ease;
}
.row-modern:hover {
  background: #fcfdfd;
}
.row-modern.expanded {
  align-items: flex-start;
  padding-top: 15px;
  padding-bottom: 15px;
  background: #e6eef8;
  border-color: #d1e0f0;
}
.row-modern > div { padding-left: 22px; }
.row-modern .arrow { text-align: right; padding-left: 0; font-size: 15px; cursor: pointer; color: #5b7cf7; font-weight: bold; }
.row-modern .expanded-content {
    display: none;
    grid-column: 1 / -1;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #d1e0f0;
    gap: 25px;
    width: 100%;
}
.row-modern.expanded .expanded-content {
    display: flex;
    justify-content: flex-start;
    align-items: center;
}
.row-modern .expanded-content .detail-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.row-modern .expanded-content .detail-label {
    font-size: 10px;
    color: #69717c;
    font-weight: 600;
    text-transform: uppercase;
}

/* Status Badges for Modern Table */
.badge-modern {
    display: inline-flex;
    align-items: center;
    border-radius: 15px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 700;
}
.badge-modern.hadir { background: #38c99d; color: #fff; }
.badge-modern.terlambat { background: #f57f17; color: #fff; }
.badge-modern.izin { background: #00695c; color: #fff; }
.badge-modern.sakit { background: #ef607f; color: #fff; }
.badge-modern.alpa { background: #d32f2f; color: #fff; }

@media(max-width: 650px) {
  .table-modern { overflow-x: hidden; }
  .thead-modern { display: none; } /* Hide thead on mobile to save space */
  .row-modern { 
      display: flex;
      flex-direction: column;
      position: relative;
      padding: 15px;
      min-height: auto;
      gap: 5px;
  }
  .row-modern > div { padding-left: 0; }
  .row-modern > div:nth-child(1) { /* Waktu */
      font-size: 11px;
      color: #64748b;
      order: 1;
  }
  .row-modern > div:nth-child(2) { /* Siswa */
      order: 2;
      padding-right: 90px; /* Space for status badge */
  }
  .row-modern > div:nth-child(3) { /* Status */
      position: absolute;
      top: 15px;
      right: 40px;
  }
  .row-modern .arrow {
      position: absolute;
      top: 18px;
      right: 15px;
      font-size: 14px;
  }
  .row-modern.expanded .expanded-content {
      order: 4;
      flex-direction: column;
      align-items: flex-start;
      gap: 15px;
  }
}
/* Override all table styles to match dashboard modern look */
.table, .table-premium {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 8px !important;
    background-color: transparent !important;
    border: none !important;
    margin-top: 12px !important;
}

.table th, .table-premium th {
    background-color: #5b7cf7 !important;
    color: #fff !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: .2px !important;
    padding: 12px 15px !important;
    border: none !important;
    text-transform: uppercase !important;
    text-align: left !important;
}

/* Rounded corners for thead */
.table th:first-child, .table-premium th:first-child {
    border-top-left-radius: 7px !important;
    border-bottom-left-radius: 7px !important;
}
.table th:last-child, .table-premium th:last-child {
    border-top-right-radius: 7px !important;
    border-bottom-right-radius: 7px !important;
}

.table td, .table-premium td {
    background-color: #fff !important;
    color: #4d5159 !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    padding: 1px 1px !important;
    border: none !important;
    border-top: 1px solid #eef2f6 !important;
    border-bottom: 1px solid #eef2f6 !important;
    vertical-align: middle !important;
}

/* Row borders */
.table td:first-child, .table-premium td:first-child {
    border-left: 1px solid #eef2f6 !important;
    border-top-left-radius: 7px !important;
    border-bottom-left-radius: 7px !important;
}
.table td:last-child, .table-premium td:last-child {
    border-right: 1px solid #eef2f6 !important;
    border-top-right-radius: 7px !important;
    border-bottom-right-radius: 7px !important;
}

.table tbody tr:hover td, .table-premium tbody tr:hover td {
    background-color: #f6f8fb !important;
}

.table tbody tr, .table-premium tbody tr {
    box-shadow: 0 2px 5px rgba(0,0,0,0.02) !important;
}

/* Pill Buttons (senada dengan tab absensi) */
.btn-pill {
    border: 1px solid #eef2f6;
    background: #ffffff;
    color: #7090e9;
    height: 38px;
    padding: 0 20px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(83,105,167,0.04);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.btn-pill:hover {
    background: #f5f7fc;
    color: #5b7cf7;
}
.btn-pill-primary {
    background: #5b7cf7;
    color: #ffffff;
    border-color: #5b7cf7;
    box-shadow: 0 4px 10px rgba(91,124,247,0.3);
}
.btn-pill-primary:hover {
    background: #4a6ce2;
    color: #ffffff;
}
.btn-pill-accent {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}
.btn-pill-accent:hover {
    background: #fde68a;
    color: #78350f;
}

/* Tab Container (Pill Navigation) */
.tab-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}
.tab-link {
    border: 1px solid #eef2f6;
    background: #ffffff;
    color: #7090e9;
    height: 38px;
    padding: 0 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(83,105,167,0.04);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.tab-active {
    background: #5b7cf7 !important;
    color: #ffffff !important;
    border-color: #5b7cf7 !important;
    box-shadow: 0 4px 10px rgba(91,124,247,0.3) !important;
}
.tab-inactive:hover {
    background: #f5f7fc;
    color: #5b7cf7;
}

/* Badge styling for inline use */
.badge-premium-role {
    background-color: #eef2ff;
    color: #5b7cf7;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 15px;
    border: 1px solid #dbeafe;
    display: inline-block;
    font-size: 11px;
}

/* =========================================
   DASHBOARD GURU PAMONG SPECIFIC STYLES 
   ========================================= */

.dashboard-stats {
    margin-bottom: 25px;
}

.dashboard-grid-main {
    margin-top: 25px;
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
    gap: 20px;
}

.dashboard-logs-panel {
    margin-bottom: 20px;
}

.dashboard-lower-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.dashboard-chart-container {
    height: 250px; 
    position: relative;
}

/* Action Buttons Grid */
.action-buttons-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    height: 100%;
    align-content: center;
}

.action-btn {
    display: flex;
    align-items: center;
    padding: 16px;
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.12);
    color: #fff;
}

.action-btn.blue { background: linear-gradient(135deg, #4b80f2, #3265d6); }
.action-btn.cyan { background: linear-gradient(135deg, #2da9db, #1d91c0); }

.action-icon {
    font-size: 24px;
    margin-right: 15px;
    background: rgba(255,255,255,0.2);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.action-text {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

/* Mentorship Notes */
.mentorship-notes-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

.mentorship-note-card {
    padding: 14px;
    background: #f8fafc;
    border-left: 4px solid #4b80f2;
    border-radius: 6px;
    font-size: 12px;
    transition: background 0.2s;
}

.mentorship-note-card:hover {
    background: #f1f5f9;
}

.note-header {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    margin-bottom: 6px;
    color: #334155;
    align-items: center;
}

.note-name {
    font-size: 13px;
}

.note-date {
    font-size: 10px;
    color: #94a3b8;
    font-weight: normal;
}

.note-content {
    color: #475569;
    line-height: 1.5;
}

.empty-note-text {
    text-align: center;
    color: #94a3b8;
    padding: 20px 0;
    font-size: 12px;
    margin: 0;
}

/* RESPONSIVE QUERIES */
@media (max-width: 1024px) {
    .dashboard-grid-main {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .stats.dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-lower-grid {
        grid-template-columns: 1fr;
    }

    .table-modern-wrapper .thead-modern {
        display: none;
    }

    .table-modern-wrapper .row-modern {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 15px;
        position: relative;
        border: 1px solid #eef2f6;
        border-radius: 8px;
        margin-bottom: 10px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    }

    .table-modern-wrapper .row-modern > div {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    .table-modern-wrapper .row-modern > div::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
        font-size: 11px;
    }

    .table-modern-wrapper .arrow {
        position: absolute;
        top: 15px;
        right: 15px;
        width: auto;
    }
}

@media (max-width: 480px) {
    .stats.dashboard-stats {
        grid-template-columns: 1fr;
    }
}
