:root {
    --primary-color: #e5a93b;
    /* Kuning Sigi */
    --secondary-color: #ffffff;
    --bg-color: #f4f5f7;
    --text-color: #333333;
    --text-color-th: #333333;
    --text-muted: #6c757d;
    --sidebar-bg: #e5a93b;
    --sidebar-text: #212529;
    --top-bar-bg: #ffffff;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --primary-color: #e5a93b;
    --secondary-color: #1e1e1e;
    --bg-color: #121212;
    --text-color: #333333;
    --text-color: #e0e0e0;
    --text-muted: #aaaaaa;
    --sidebar-bg: #1e1e1e;
    --sidebar-text: #e0e0e0;
    --top-bar-bg: #1e1e1e;
    --card-bg: #1e1e1e;
    --border-color: #333333;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: var(--transition);
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    box-shadow: none; /* Flat design like reference image */
    border-right: 1px solid rgba(0, 0, 0, 0.05); /* Clean border divider */
    z-index: 100;
}

.sidebar-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--sidebar-text);
    opacity: 0.7;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    margin-top: auto;
    transition: var(--transition);
}

.sidebar.collapsed .sidebar-footer,
.sidebar-mini .sidebar .sidebar-footer {
    opacity: 0;
    visibility: hidden;
    padding: 0;
    height: 0;
    overflow: hidden;
    border-top: none;
}

/* Sidebar Collapsed (Mini Sidebar) */
.sidebar.collapsed,
.sidebar-mini .sidebar {
    width: 70px;
}

.sidebar.collapsed .sidebar-header .logo span,
.sidebar-mini .sidebar .sidebar-header .logo span {
    display: none;
}

.sidebar.collapsed .sidebar-nav ul li a,
.sidebar-mini .sidebar .sidebar-nav ul li a,
.sidebar.collapsed .sidebar-nav .submenu-toggle,
.sidebar-mini .sidebar .sidebar-nav .submenu-toggle {
    justify-content: center;
    padding: 12px 0;
    position: relative;
    width: 100%;
    margin-left: 0;
    border-radius: 0;
}

/* Tooltip untuk Sidebar Mini */
.sidebar.collapsed .sidebar-nav ul li a span,
.sidebar-mini .sidebar .sidebar-nav ul li a span,
.sidebar.collapsed .sidebar-nav .submenu-toggle span,
.sidebar-mini .sidebar .sidebar-nav .submenu-toggle span {
    display: block;
    /* Batalkan display: none */
    position: absolute;
    left: 60px;
    background-color: #212529;
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.sidebar.collapsed .sidebar-nav ul li a:hover span,
.sidebar-mini .sidebar .sidebar-nav ul li a:hover span,
.sidebar.collapsed .sidebar-nav .submenu-toggle:hover span,
.sidebar-mini .sidebar .sidebar-nav .submenu-toggle:hover span {
    opacity: 1;
    visibility: visible;
    left: 75px;
    /* Bergeser sedikit ke kanan saat muncul */
}

.sidebar-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 700;
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    transition: var(--transition);
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 20px 0;
}

.sidebar.collapsed .sidebar-header .logo {
    justify-content: center;
    width: 100%;
    gap: 0;
}

/* Branding text colors */
.brand-sim {
    color: #1a2a6c; /* Navy Blue */
    transition: var(--transition);
}

.brand-patik {
    color: #e5a93b; /* Kuning Sigi */
    transition: var(--transition);
}

/* Sidebar specific adjustments for readability on light yellow background */
.sidebar .logo .brand-sim {
    color: #1a2a6c;
    text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.4);
}

.sidebar .logo .brand-patik {
    color: #212529; /* Use dark sidebar-text on yellow background to maintain readability */
    text-shadow: none;
}

/* In dark theme, the sidebar is dark gray, so we can use the true yellow brand color */
[data-theme="dark"] .sidebar .logo .brand-patik {
    color: #e5a93b;
}

[data-theme="dark"] .sidebar .logo .brand-sim {
    color: #4b6cb7; /* Lighter blue for dark background */
    text-shadow: none;
}

[data-theme="dark"] .brand-sim {
    color: #4b6cb7;
}

/* Hamburger Button Kustom */
.hamburger-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 5px;
    align-items: center;
    justify-content: center;
}

.hamburger-btn span {
    display: block;
    width: 20px;
    height: 3px;
    background-color: var(--text-color);
    border-radius: 3px;
    transition: var(--transition);
}

.sidebar-nav ul {
    list-style: none;
    padding: 20px 0 20px 0; /* Align items flush to the right edge */
}

.sidebar-nav ul li {
    position: relative;
    margin-bottom: 6px;
}

.sidebar-nav ul li a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px 20px 14px 25px; /* Comfortable padding */
    color: var(--sidebar-text);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
    border-radius: 30px 0 0 30px; /* Round left corners only */
    margin-left: 15px; /* Offset slightly from left edge */
    position: relative;
    z-index: 102; /* Position above curve shadows */
}

.sidebar-nav ul li a:hover {
    background-color: rgba(255, 255, 255, 0.15); /* Light hover overlay */
}

.sidebar-nav ul li a.active {
    background-color: var(--bg-color); /* Connects to content page background */
    color: var(--primary-color) !important;
    font-weight: 600;
    margin-right: -1px; /* Overlaps sidebar right border */
    border-right: 1px solid var(--bg-color); /* Clean blend */
}

/* In light theme, active menu text & icons should be dark navy for high readability */
body:not([data-theme="dark"]) .sidebar-nav ul li a.active {
    color: #1a2a6c !important;
}

/* Curved cutout top-right */
.sidebar-nav ul li a.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: -20px;
    width: 20px;
    height: 20px;
    background-color: transparent;
    border-bottom-right-radius: 20px;
    box-shadow: 0 10px 0 0 var(--bg-color);
    pointer-events: none;
    z-index: 101;
}

/* Curved cutout bottom-right */
.sidebar-nav ul li a.active::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: -20px;
    width: 20px;
    height: 20px;
    background-color: transparent;
    border-top-right-radius: 20px;
    box-shadow: 0 -10px 0 0 var(--bg-color);
    pointer-events: none;
    z-index: 101;
}

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

.top-bar {
    height: 70px;
    background-color: var(--top-bar-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar-title h2 {
    font-size: 1.3rem;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.notif-btn {
    position: relative;
    color: var(--text-color);
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    transition: var(--transition);
}

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

.notif-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--primary-color);
    color: #212529;
    font-size: 0.65rem;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    border: 1px solid var(--top-bar-bg); /* Premium border separation from the bell icon */
}

#theme-toggle-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
}

.content-body {
    padding: 30px;
    flex: 1;
    position: relative;
}

.content-body::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url('../../image/taiganja.png');
    background-repeat: repeat;
    background-size: 60px;
    opacity: 0.1;
    pointer-events: none;
    z-index: 0;
}

[data-theme="dark"] .content-body::before {
    filter: invert(1);
}

.content-body > * {
    position: relative;
    z-index: 1;
}

/* Cards & UI Elements */
.card {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

/* Bottom Nav default */
.bottom-nav {
    display: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        height: 100%;
        z-index: 1001; /* Overlay on top of bottom nav and header */
    }

    .sidebar.active {
        left: 0;
    }

    .top-bar {
        position: sticky;
        top: 0;
        z-index: 999;
        height: 60px;
        padding: 0 15px;
        background-color: var(--top-bar-bg);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    }

    .typing-container {
        display: none !important;
    }

    .mobile-logo-title {
        display: inline-flex !important;
        align-items: center;
    }

    .mobile-logo {
        width: 28px;
        height: 28px;
        object-fit: contain;
        margin-right: 8px;
    }

    .user-info .username-text {
        display: inline-flex !important;
        align-items: center;
        gap: 5px;
    }

    .user-info .username-text .username-val {
        max-width: 70px; /* Constrain text width on mobile to avoid overflow */
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: inline-block;
        vertical-align: middle;
    }

    .content-body {
        padding: 15px 15px 85px 15px; /* Add bottom padding for mobile bottom nav */
    }

    .card {
        padding: 15px;
        overflow-x: auto;
        /* Membuat tabel lebar bisa di-scroll */
    }

    /* Outer card containing table transparent on mobile */
    .card:has(#spt-table),
    .card:has(#hasil-table),
    .card:has(#pegawai-table),
    .card:has(#dasar-hukum-table) {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }

    .table-responsive {
        padding-bottom: 0 !important;
    }

    /* SPT, Pegawai, & Dasar Hukum Table lists styled as Mobile App Cards */
    #spt-table,
    #hasil-table,
    #pegawai-table,
    #dasar-hukum-table {
        display: block;
        width: 100%;
        border: none;
    }

    #spt-table thead,
    #hasil-table thead,
    #pegawai-table thead,
    #dasar-hukum-table thead {
        display: none;
    }

    #spt-table tbody,
    #hasil-table tbody,
    #pegawai-table tbody,
    #dasar-hukum-table tbody {
        display: block;
        width: 100%;
    }

    #spt-table tbody tr,
    #hasil-table tbody tr,
    #pegawai-table tbody tr,
    #dasar-hukum-table tbody tr {
        display: block;
        background-color: var(--card-bg);
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius);
        padding: 15px;
        margin-bottom: 15px;
        box-shadow: var(--shadow);
        transition: var(--transition);
        position: relative;
    }

    #spt-table tbody tr.no-data,
    #hasil-table tbody tr.no-data,
    #pegawai-table tbody tr.no-data,
    #dasar-hukum-table tbody tr.no-data {
        text-align: center;
        padding: 20px;
    }

    #spt-table tbody td,
    #hasil-table tbody td,
    #pegawai-table tbody td,
    #dasar-hukum-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0;
        border-bottom: 1px dashed var(--border-color);
        font-size: 0.9rem;
        text-align: right;
    }

    #spt-table tbody td:last-child,
    #hasil-table tbody td:last-child,
    #pegawai-table tbody td:last-child,
    #dasar-hukum-table tbody td:last-child {
        border-bottom: none;
        padding-top: 15px;
        justify-content: flex-end;
    }

    #spt-table tbody td::before,
    #hasil-table tbody td::before,
    #pegawai-table tbody td::before,
    #dasar-hukum-table tbody td::before {
        content: attr(data-label);
        font-weight: bold;
        color: var(--text-muted);
        text-align: left;
        margin-right: 15px;
        flex-shrink: 0;
    }

    #spt-table tbody td[data-label="Aksi"]::before,
    #hasil-table tbody td[data-label="Aksi"]::before,
    #pegawai-table tbody td[data-label="Aksi"]::before,
    #dasar-hukum-table tbody td[data-label="Aksi"]::before {
        content: ""; /* Hide text prefix for Action row */
    }

    /* Long multi-line text should stack vertically */
    #spt-table tbody td[data-label="Maksud Tugas"],
    #hasil-table tbody td[data-label="Maksud Tugas"],
    #dasar-hukum-table tbody td[data-label="Deskripsi"] {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    #spt-table tbody td[data-label="Maksud Tugas"]::before,
    #hasil-table tbody td[data-label="Maksud Tugas"]::before,
    #dasar-hukum-table tbody td[data-label="Deskripsi"]::before {
        margin-bottom: 5px;
    }

    .form-row {
        flex-direction: column;
        gap: 10px;
    }

    .form-row-2,
    .form-row-3 {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }

    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .btn {
        justify-content: center;
    }

    /* Bottom Nav Bar styling for Mobile App UI */
    .bottom-nav {
        display: grid;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 65px;
        background-color: var(--top-bar-bg);
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
        grid-template-columns: repeat(5, 1fr);
        z-index: 1000;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .bottom-nav a,
    .bottom-nav button {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--text-muted);
        text-decoration: none;
        font-size: 0.7rem;
        font-weight: 600;
        gap: 4px;
        transition: var(--transition);
    }

    .bottom-nav a i,
    .bottom-nav button i {
        font-size: 1.25rem;
    }

    .bottom-nav a:hover,
    .bottom-nav a.active,
    .bottom-nav button:hover,
    .bottom-nav button.active {
        color: var(--primary-color);
    }

    body:not([data-theme="dark"]) .bottom-nav a.active,
    body:not([data-theme="dark"]) .bottom-nav button.active {
        color: #1a2a6c; /* Premium high contrast active color for light theme */
    }
}

/* ==========================================================================
   Modul SPT (Surat Perintah Tugas)
   ========================================================================== */

.page-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
    text-decoration: none;
}

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

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

.btn:hover {
    filter: brightness(0.9);
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 12px 12px 12px 45px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--card-bg);
    color: var(--text-color);
    transition: var(--transition);
}

.search-box input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.mt-20 {
    margin-top: 20px;
}

.card:has(.table-responsive),
.card:has(.table) {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.table {
    width: 100%;
    border-collapse: separate !important;
    border-spacing: 0 12px !important; /* Spacing between rows */
    margin-top: 10px;
}

.table th {
    background-color: #1a2a6c !important; /* Solid Premium Navy Blue */
    color: #ffffff !important; /* High contrast white text */
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 20px !important;
    border: none !important;
}

[data-theme="dark"] .table th {
    background-color: #111a45 !important; /* Darker navy blue for dark theme */
}

.table thead tr th:first-child {
    border-top-left-radius: 8px !important;
    border-bottom-left-radius: 8px !important;
}

.table thead tr th:last-child {
    border-top-right-radius: 8px !important;
    border-bottom-right-radius: 8px !important;
}

.table td {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
    padding: 16px 20px !important;
    border: none !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.01), 0 1px 3px rgba(0, 0, 0, 0.04) !important; /* Soft card shadow */
    transition: var(--transition);
    font-size: 0.95rem;
    vertical-align: middle;
}

/* Rounded corners for the cells on the left and right ends of each row card */
.table tr td:first-child {
    border-top-left-radius: 12px !important;
    border-bottom-left-radius: 12px !important;
}

.table tr td:last-child {
    border-top-right-radius: 12px !important;
    border-bottom-right-radius: 12px !important;
}

/* Pastikan stacking context: baris yang di-hover di atas */
.table tbody tr {
    position: relative;
    z-index: 1;
}
.table tbody tr:hover {
    z-index: 3;
}

/* Soft hover & drop shadow elevation */
.table tbody tr:hover td {
    background-color: var(--card-bg) !important;
    margin-top: -2px;
    margin-bottom: 2px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08) !important;
}

[data-theme="dark"] .table tbody tr:hover td {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4) !important;
}

/* Active selected row - premium yellow background with dark text & glowing shadow */
.table tbody tr.active td,
.table tbody tr.highlighted td {
    background-color: var(--primary-color) !important;
    color: #212529 !important;
    box-shadow: 0 8px 25px rgba(229, 169, 59, 0.35) !important;
}

.table tbody tr.active td a,
.table tbody tr.highlighted td a {
    color: #212529 !important;
}

/* Status badges matching reference image style (rounded pills) */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-badge.belum,
.status-badge.pending {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.status-badge.belum::before,
.status-badge.pending::before {
    content: "•";
    font-size: 1.1rem;
    line-height: 1;
}

.status-badge.sudah,
.status-badge.dispatch,
.status-badge.completed {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.status-badge.sudah::before,
.status-badge.dispatch::before,
.status-badge.completed::before {
    content: "•";
    font-size: 1.1rem;
    line-height: 1;
}

/* Custom Tabs matching reference image style */
.tabs-container {
    display: flex;
    gap: 25px;
    border-bottom: 2px solid var(--border-color);
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 5px !important;
    margin-bottom: 25px;
}

.tab-btn {
    background: none !important;
    border: none !important;
    padding: 10px 0 12px 0 !important; /* Visual height */
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: -2px; /* Overlap container's border-bottom */
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    color: var(--text-color);
}

.tab-btn.active {
    color: var(--primary-color) !important;
    border-bottom-color: var(--primary-color) !important;
}

body:not([data-theme="dark"]) .tab-btn.active {
    color: #1a2a6c !important;
    border-bottom-color: #1a2a6c !important; /* Premium Navy Blue active line */
}

/* Dropdown Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.btn-dropdown {
    padding: 8px 15px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: var(--card-bg);
    min-width: 160px;
    box-shadow: var(--shadow);
    z-index: 9999;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.dropdown-content a {
    color: var(--text-color);
    padding: 12px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.dropdown-content a:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* Pastikan dropdown muncul di lapisan teratas */
.table {
    overflow: visible !important;
}
.table tbody tr {
    overflow: visible !important;
}
.table td {
    overflow: visible !important;
}
.table td .dropdown-content {
    z-index: 10000;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    overflow-y: auto;
}

.modal-content {
    background-color: var(--card-bg);
    margin: 5% auto;
    padding: 25px;
    border-radius: var(--border-radius);
    width: 600px;
    max-width: 90%;
    box-shadow: var(--shadow);
    animation: slideDown 0.3s ease;
}

.modal-large {
    width: 850px;
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.close-modal {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

/* Form Layouts */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-weight: 600;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 10px;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
}

.form-row-2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 15px;
    margin-bottom: 15px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 15px;
    margin-bottom: 15px;
}

.rute-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 10px;
}

.pengikut-row {
    display: grid;
    grid-template-columns: 1.5fr 1.2fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

@media (max-width: 768px) {
    .modal-content {
        width: 95% !important;
        margin: 20px auto !important;
        padding: 15px !important;
    }
    .modal-large {
        width: 95% !important;
    }
    .form-row-2, .form-row-3 {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    .rute-row {
        grid-template-columns: 1fr !important;
        border-bottom: 1px dashed var(--border-color);
        padding-bottom: 15px;
        margin-bottom: 15px;
    }
    .rute-row button.btn-danger,
    .rute-row .btn-hapus-rute {
        width: 100% !important;
        margin-top: 5px;
    }
    .pengikut-row {
        grid-template-columns: 1fr !important;
        border-bottom: 1px dashed var(--border-color);
        padding-bottom: 15px;
        margin-bottom: 15px;
        align-items: stretch !important;
    }
    #modal-pengikut {
        align-items: flex-start !important;
        overflow-y: auto !important;
    }
}

/* Tom Select Customization */
.ts-control {
    border-radius: 6px;
    padding: 10px;
    border-color: var(--border-color);
    background-color: var(--bg-color);
}

.ts-control .item {
    background-color: var(--primary-color);
    color: var(--sidebar-text);
    border-radius: 4px;
}

/* Typing Effect */
.typing-container {
    display: flex;
    align-items: center;
    margin-left: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
    height: 30px;
}

.typing-cursor {
    animation: blink 0.7s infinite;
    color: var(--primary-color);
    font-weight: bold;
    margin-left: 2px;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Responsive Table Wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 110px;
}

/* Tom Select Width Correction */
.ts-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Mobile responsive layout fixes */
@media (max-width: 768px) {
    .responsive-flex-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }
    .responsive-flex-header button {
        width: 100% !important;
    }
    .form-control, select.form-control {
        width: 100% !important;
        box-sizing: border-box !important;
    }
}

/* ==========================================================================
   Sidebar Submenu
   ========================================================================== */
.sidebar-nav ul li.has-submenu {
    position: relative;
}

.sidebar-nav .submenu-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px 20px 14px 25px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 500;
    border-radius: 30px 0 0 30px;
    margin-left: 15px;
    position: relative;
    z-index: 102;
    background: none;
    border: none;
    font: inherit;
    width: calc(100% - 15px);
    text-align: left;
    transition: var(--transition);
}

.sidebar-nav .submenu-toggle:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.sidebar-nav .submenu-toggle.active {
    background-color: var(--bg-color);
    color: var(--primary-color) !important;
    font-weight: 600;
    margin-right: -1px;
    border-right: 1px solid var(--bg-color);
}

body:not([data-theme="dark"]) .sidebar-nav .submenu-toggle.active {
    color: #1a2a6c !important;
}

.sidebar-nav .submenu-toggle.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: -20px;
    width: 20px;
    height: 20px;
    background-color: transparent;
    border-bottom-right-radius: 20px;
    box-shadow: 0 10px 0 0 var(--bg-color);
    pointer-events: none;
    z-index: 101;
}

.sidebar-nav .submenu-toggle.active::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: -20px;
    width: 20px;
    height: 20px;
    background-color: transparent;
    border-top-right-radius: 20px;
    box-shadow: 0 -10px 0 0 var(--bg-color);
    pointer-events: none;
    z-index: 101;
}

.sidebar-nav .submenu-toggle .submenu-arrow {
    margin-left: auto;
}

.submenu-arrow {
    margin-left: auto;
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.has-submenu.open .submenu-arrow {
    transform: rotate(180deg);
}

.sidebar-nav .submenu {
    list-style: none;
    padding: 5px 0 5px 15px;
    background-color: rgba(0, 0, 0, 0.03);
    display: none;
}

.has-submenu.open .submenu {
    display: block;
}

.sidebar-nav .submenu li a {
    margin-left: 0 !important;
    border-radius: 0 !important;
    padding: 10px 20px 10px 40px !important; /* Indent more on the left */
    background-color: transparent !important;
    border-left: none !important;
    color: var(--sidebar-text) !important;
    font-size: 0.9rem;
    font-weight: 450;
}

.sidebar-nav .submenu li a i {
    font-size: 0.8rem;
}

.sidebar-nav .submenu li a:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

.sidebar-nav .submenu li a.active {
    background-color: rgba(255, 255, 255, 0.2) !important;
    color: var(--sidebar-text) !important;
    font-weight: 600 !important;
    border-left: 4px solid var(--sidebar-text) !important; /* simple indicator inside submenu */
    margin-right: 0 !important;
    border-right: none !important;
}

/* Remove pseudo-elements curve cutout for submenu active links */
.sidebar-nav .submenu li a.active::before,
.sidebar-nav .submenu li a.active::after {
    display: none !important;
}

/* Submenu on Collapsed Sidebar (desktop hover dropdown) */
.sidebar.collapsed .sidebar-nav ul li.has-submenu:hover .submenu,
.sidebar-mini .sidebar .sidebar-nav ul li.has-submenu:hover .submenu {
    display: block;
    position: absolute;
    left: 70px;
    top: 0;
    background-color: var(--sidebar-bg);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
    border-radius: 0 8px 8px 0;
    min-width: 220px;
    padding: 5px 0;
    border: 1px solid var(--border-color);
    z-index: 9999;
}

.sidebar.collapsed .sidebar-nav ul li.has-submenu:hover .submenu li a,
.sidebar-mini .sidebar .sidebar-nav ul li.has-submenu:hover .submenu li a {
    display: flex;
    justify-content: flex-start;
    padding: 12px 20px;
    border-left: none;
}

.sidebar.collapsed .sidebar-nav ul li.has-submenu:hover .submenu li a span,
.sidebar-mini .sidebar .sidebar-nav ul li.has-submenu:hover .submenu li a span {
    display: inline;
    position: static;
    opacity: 1;
    visibility: visible;
    background: none;
    color: var(--sidebar-text);
    box-shadow: none;
    padding: 0;
}

.sidebar.collapsed .sidebar-nav ul li.has-submenu:hover .submenu li a:hover,
.sidebar-mini .sidebar .sidebar-nav ul li.has-submenu:hover .submenu li a:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.sidebar.collapsed .submenu-arrow,
.sidebar-mini .sidebar .submenu-arrow {
    display: none !important;
}

/* Pagination Styles */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.9rem;
    color: var(--text-color);
}

.pagination-limit {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pagination-select {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
    outline: none;
    font-weight: 500;
}

.pagination-nav {
    display: flex;
    gap: 5px;
    align-items: center;
}

.btn-page {
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
}

.btn-page:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: var(--sidebar-text);
    border-color: var(--primary-color);
}

.btn-page.active {
    background-color: var(--primary-color);
    color: var(--sidebar-text);
    border-color: var(--primary-color);
}

.btn-page:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.skip-link {
    position: absolute;
    top: -9999px;
    left: -9999px;
    z-index: 9999;
    background: #e5a93b;
    color: #212529;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0 0 4px 4px;
}

.skip-link:focus {
    top: 0;
    left: 0;
    position: fixed;
}

@media (max-width: 768px) {
    .pagination-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
        width: 100%;
    }
}

/* Focus visible outline for accessibility */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .login-card:hover {
        transform: none;
    }
    .btn-login:hover {
        transform: none;
    }
}