:root {
    --navy: #0f2d5e;
    --navy-mid: #163a78;
    --navy-light: #1e4d9a;
    --blue-accent: #2563eb;
    --blue-soft: #dbeafe;
    --blue-border: #bfdbfe;
    --purple-accent: #7c3aed;
    --purple-soft: #ede9fe;
    --white: #ffffff;
    --surface: #f8fafc;
    --surface-2: #f1f5f9;
    --border: #e2e8f0;
    --border-dark: #cbd5e1;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --sidebar-w: 248px;
    --success: #16a34a;
    --success-bg: #dcfce7;
    --warning: #d97706;
    --warning-bg: #fef3c7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --info: #0284c7;
    --info-bg: #e0f2fe;
    --radius: 8px;
    --radius-lg: 12px;
    --bs-border-radius: var(--radius);
    --bs-border-radius-lg: var(--radius-lg);
    --bs-border-radius-sm: 6px;
    /* Satu warna biru: selaraskan Bootstrap dgn brand */
    --bs-primary: #2563eb;
    --bs-primary-rgb: 37, 99, 235;
    --bs-primary-text-emphasis: #1d4ed8;
    --bs-primary-bg-subtle: #dbeafe;
    --bs-primary-border-subtle: #bfdbfe;
    --bs-link-color: #2563eb;
    --bs-link-hover-color: #1d4ed8;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family:
        "Plus Jakarta Sans",
        system-ui,
        -apple-system,
        sans-serif;
    font-size: 14px;
    background: var(--surface);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

/* =========================================
   APP WRAP
   ========================================= */
.app-wrap {
    min-height: 100vh;
}

/* =========================================
   SIDEBAR
   ========================================= */
.sidebar {
    width: var(--sidebar-w);
    background: var(--navy);
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.25s ease;
}

@media (min-width: 992px) {
    .sidebar {
        transform: translateX(0);
    }
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.sidebar-brand {
    padding: 20px 18px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.sidebar-brand .brand-icon {
    width: 34px;
    height: 34px;
    background: var(--blue-accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.2;
}

.sidebar-brand .brand-sub {
    color: rgba(255, 255, 255, 0.45);
    font-size: 11px;
    font-weight: 400;
}

.sidebar-close {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    z-index: 1;
}
.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
}

/* ── Nav ── */
.sidebar-nav {
    flex: 1;
    padding: 8px 6px;
}

.sidebar-section {
    padding: 14px 12px 4px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.07em;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-item {
    position: relative;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    color: rgba(255, 255, 255, 0.65);
    border-radius: 6px;
    margin: 1px 6px;
    cursor: pointer;
    text-decoration: none;
    font-size: 13.5px;
    transition:
        background 0.15s,
        color 0.15s;
}

.menu-link:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
}

.menu-link i {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.menu-link .nav-chevron {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.2s;
}

.menu-link.expanded .nav-chevron {
    transform: rotate(90deg);
}

.menu-item.active > .menu-link {
    background: var(--blue-accent);
    color: #fff;
}

.menu-item .nav-badge {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.75);
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 20px;
}

.menu-item.active .nav-badge {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* Sub-nav */
.sub-nav {
    display: none;
    padding: 0 6px;
}

.sub-nav.open {
    display: block;
}

.sub-nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 34px;
    color: rgba(255, 255, 255, 0.5);
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition:
        background 0.15s,
        color 0.15s;
    font-size: 13px;
}

.sub-nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
}

.sub-nav-link.active {
    color: #93c5fd;
}

.sub-nav-link::before {
    content: "";
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

/* ── Sidebar footer / user card ── */
.sidebar-footer {
    margin-top: auto;
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
}

.user-card:hover {
    background: rgba(255, 255, 255, 0.07);
}

.user-avatar-sm {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--blue-accent);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-name-sm {
    color: #fff;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.2;
}

.user-role-sm {
    color: rgba(255, 255, 255, 0.4);
    font-size: 11px;
}

.user-card .logout-icon {
    margin-left: auto;
    color: rgba(255, 255, 255, 0.35);
    font-size: 15px;
}

/* =========================================
   MAIN WRAP
   ========================================= */
.main-wrap {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.25s ease;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.main-wrap.collapsed {
    margin-left: 0;
}

/* =========================================
   TOPBAR
   ========================================= */
.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 71px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.topbar-toggler {
    display: block;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px;
}

.topbar-info {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-info strong {
    color: var(--text-primary);
}

.topbar-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.topbar-breadcrumb {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 4px;
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-user .btn-user {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: background 0.15s;
}

.topbar-user .btn-user:hover {
    background: var(--surface-2);
}

/* =========================================
   CONTENT
   ========================================= */
.content {
    padding: 24px;
    flex: 1;
}

/* =========================================
   AUTH PAGE
   ========================================= */
.auth-page {
    background: #f1f5f9;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-container {
    display: flex;
    max-width: 960px;
    width: 100%;
    background: #fff;
    border-radius: 20px;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.06),
        0 1px 2px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    min-height: 560px;
}

.auth-left {
    flex: 1.2;
    background: var(--navy);
    padding: 48px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-left-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 32px;
}

.auth-left-brand-icon {
    width: 40px;
    height: 40px;
    background: var(--blue-accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
}

.auth-left-brand-text {
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
}

.auth-left h2 {
    color: #fff;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 12px;
}

.auth-left-features {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-left-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.85rem;
}

.auth-left-feature i {
    color: var(--blue-accent);
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.auth-right {
    flex: 1;
    padding: 48px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-right-header {
    margin-bottom: 28px;
}

.auth-right-header h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.auth-right-header p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.auth-field {
    margin-bottom: 18px;
}

.auth-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input-wrap > i:first-child {
    position: absolute;
    left: 12px;
    font-size: 1rem;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}

.auth-input {
    width: 100%;
    height: 44px;
    padding: 0 38px 0 38px;
    font-size: 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: var(--white);
    color: var(--text-primary);
    outline: none;
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}

.auth-input:focus {
    border-color: var(--blue-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.auth-input.is-invalid {
    border-color: var(--danger);
}

.auth-pw-toggle {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    padding: 6px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    z-index: 1;
}

.auth-pw-toggle:hover {
    color: var(--text-primary);
}

.auth-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: 4px;
}

.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-remember input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--blue-accent);
    cursor: pointer;
}

.auth-remember label {
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.auth-forgot {
    font-size: 13px;
    color: var(--blue-accent);
    text-decoration: none;
    font-weight: 500;
}

.auth-forgot:hover {
    text-decoration: underline;
}

.auth-btn {
    width: 100%;
    height: 44px;
    background: var(--blue-accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.auth-btn:hover {
    background: #1d4ed8;
}

.auth-btn:active {
    transform: scale(0.98);
}

@media (max-width: 768px) {
    .auth-page {
        padding: 0;
        align-items: flex-start;
    }
    .auth-container {
        flex-direction: column;
        border-radius: 0;
        min-height: auto;
        box-shadow: none;
    }
    .auth-left {
        padding: 32px 24px;
    }
    .auth-left-features {
        margin-top: 16px;
    }
    .auth-right {
        padding: 32px 24px;
    }
}

/* =========================================
   CARDS
   ========================================= */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* =========================================
   TABLES (Bootstrap .table dipakai di semua halaman)
   ========================================= */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table thead th {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    white-space: nowrap;
    border-bottom-width: 1px;
}

.table td {
    vertical-align: middle;
}

/* =========================================
   BUTTONS
   =========================================
   Tinggi .btn diset 34px agar SEJAJAR dgn .form-control (34px).
   Bootstrap default .btn = 38px → tidak sejajar. */
.btn {
    --bs-btn-padding-y: 0.390625rem; /* 6.25px → 34px total: 6.25*2 + 13*1.5 + 2(border) */
    --bs-btn-padding-x: 0.75rem;
    font-size: 0.8125rem; /* 13px = sama dgn form-control */
    line-height: 1.5;
    border-radius: var(--radius);
}

.btn-sm {
    --bs-btn-padding-y: 0.25rem;
    --bs-btn-padding-x: 0.5rem;
    font-size: 0.75rem;
}

.btn-lg {
    --bs-btn-padding-y: 0.5rem;
    --bs-btn-padding-x: 1rem;
    font-size: 0.9rem;
}

/* Satu warna biru: tombol primary & outline ikut brand #2563eb */
.btn-primary {
    --bs-btn-bg: #2563eb;
    --bs-btn-border-color: #2563eb;
    --bs-btn-hover-bg: #1d4ed8;
    --bs-btn-hover-border-color: #1d4ed8;
    --bs-btn-active-bg: #1e40af;
    --bs-btn-active-border-color: #1e40af;
    --bs-btn-disabled-bg: #2563eb;
    --bs-btn-disabled-border-color: #2563eb;
}

.btn-outline-primary {
    --bs-btn-color: #2563eb;
    --bs-btn-border-color: #2563eb;
    --bs-btn-hover-bg: #2563eb;
    --bs-btn-hover-border-color: #2563eb;
    --bs-btn-active-bg: #2563eb;
    --bs-btn-active-border-color: #2563eb;
}

/* =========================================
   FORMS
   ========================================= */
.form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    display: block;
}

.form-control,
.form-select {
    height: 34px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 10px;
    background: var(--white);
    color: var(--text-primary);
    outline: none;
    transition:
        border-color 0.15s,
        box-shadow 0.15s;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--blue-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.form-control {
    height: auto;
    padding: 8px 10px;
}

/* =========================================
   PAGINATION
   ========================================= */
.pagination {
    margin-top: 16px;
}

.page-link {
    color: var(--text-primary);
    border-color: var(--border);
    font-size: 13px;
    padding: 6px 12px;
}

.page-item.active .page-link {
    background: var(--blue-accent);
    border-color: var(--blue-accent);
}

/* =========================================
   SIDEBAR OVERLAY (mobile)
   ========================================= */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1035;
}

.sidebar-overlay.show {
    display: block;
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-close {
        display: block;
    }

    .main-wrap {
        margin-left: 0;
    }

    .topbar-toggler {
        display: block;
    }
}

@media (max-width: 575.98px) {
    .topbar {
        padding: 0 12px;
    }

    .content {
        padding: 16px 12px;
    }

    /* Form elements full-width on mobile */
    .toolbar .form-control,
    .toolbar .form-select {
        width: 100% !important;
        min-width: 0;
    }
    form .btn-primary,
    form .btn-outline-primary,
    form .btn-outline-secondary {
        width: 100%;
    }
    .toolbar .reset-link,
    .reset-link {
        margin-left: 0;
    }
}

/* =========================================
   CUSTOM SCROLLBAR
   ========================================= */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-thumb {
    background: var(--border-dark);
    border-radius: 4px;
}

.text-meta {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* =========================================
   RESET / FILTER LINK
   ========================================= */
/* =========================================
   BORDER BOX (content card variant)
   ========================================= */
.border-box {
    border: 1px solid var(--border);
    padding: 14px 16px;
    border-radius: var(--radius);
    font-size: 13.5px;
    line-height: 1.6;
}

/* =========================================
   EMPTY STATE
   ========================================= */
/* =========================================
   SECTION TITLE
   ========================================= */
/* =========================================
   COLOR UTILITIES
   ========================================= */
