/* ===== SIMWARGA DESIGN TOKENS & GENERAL ===== */
:root {
    --primary: #1565c0;
    --primary-light: #1e88e5;
    --primary-dark: #0d47a1;
    --primary-soft: #e3f2fd;
    --secondary: #2e7d32;
    --secondary-light: #43a047;
    --secondary-soft: #e8f5e9;
    --accent: #00acc1;
    --accent-soft: #e0f7fa;
    --warning: #f57c00;
    --warning-soft: #fff3e0;
    --danger: #c62828;
    --danger-soft: #ffebee;
    --surface: #ffffff;
    --surface-2: #f5f7fa;
    --surface-3: #eaeff5;
    --border: #dde3ec;
    --text-primary: #1a2340;
    --text-secondary: #5a6a85;
    --text-muted: #8fa0b8;
    --sidebar-w: 260px;
    --topbar-h: 60px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 12px rgba(21, 101, 192, 0.08);
    --shadow-md: 0 4px 24px rgba(21, 101, 192, 0.13);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --primary: #42a5f5;
    --primary-light: #64b5f6;
    --primary-dark: #1565c0;
    --primary-soft: #0d2137;
    --secondary: #66bb6a;
    --secondary-soft: #0a1f0b;
    --accent: #26c6da;
    --accent-soft: #002b30;
    --warning: #ffa726;
    --warning-soft: #2a1800;
    --danger: #ef5350;
    --danger-soft: #2d0b0b;
    --surface: #111827;
    --surface-2: #1c2536;
    --surface-3: #263147;
    --border: #2e3d55;
    --text-primary: #e8eef8;
    --text-secondary: #8fa0b8;
    --text-muted: #4f6070;
}

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

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Outfit", "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--surface-2);
    color: var(--text-primary);
    transition: background var(--transition), color var(--transition);
}

a {
    color: var(--primary);
    text-decoration: none;
}

/* SIDEBAR */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform var(--transition), box-shadow var(--transition);
    box-shadow: var(--shadow-md);
}

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

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

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

.brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    flex-shrink: 0;
}

.brand-text {
    line-height: 1.2;
}

.brand-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.brand-sub {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.sidebar-scroll::-webkit-scrollbar {
    width: 4px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.sidebar-section {
    padding: 8px 16px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.nav-item-sidebar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    margin: 1px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--transition);
    border: none;
    background: none;
    width: calc(100% - 16px);
    text-align: left;
}

.nav-item-sidebar i {
    font-size: 16px;
    flex-shrink: 0;
}

.nav-item-sidebar:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.nav-item-sidebar.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

.nav-item-sidebar .badge-count {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1039;
}

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

@media (min-width: 992px) {
    .sidebar-overlay {
        display: none !important;
    }
}

.sidebar-user {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

/* APP BODY & TOPBAR */
.app-body {
    transition: margin-left var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

@media (min-width: 992px) {
    .app-body {
        margin-left: var(--sidebar-w);
    }
}

#topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 10px;
    box-shadow: var(--shadow);
}

.topbar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.topbar-toggle:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

@media (min-width: 992px) {
    .topbar-toggle {
        display: none;
    }
}

.topbar-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
}

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

.topbar-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--surface-2);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all var(--transition);
    position: relative;
}

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

.topbar-btn .notif-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    border: 2px solid var(--surface);
}

#content-area {
    flex: 1;
    padding: 16px;
    padding-bottom: 80px;
}

@media (min-width: 992px) {
    #content-area {
        padding: 24px;
        padding-bottom: 24px;
    }
}

/* CARDS */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: box-shadow var(--transition);
    margin-bottom: 16px;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: none;
    border-bottom: 1px solid var(--border);
    padding: 14px 18px;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 18px;
}

/* STAT CARDS */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card::after {
    content: "";
    position: absolute;
    right: -10px;
    bottom: -10px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    opacity: 0.08;
}

.stat-card.blue::after { background: var(--primary); }
.stat-card.green::after { background: var(--secondary); }
.stat-card.orange::after { background: var(--warning); }
.stat-card.cyan::after { background: var(--accent); }
.stat-card.red::after { background: var(--danger); }

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 12px;
}

.stat-icon.blue { background: var(--primary-soft); color: var(--primary); }
.stat-icon.green { background: var(--secondary-soft); color: var(--secondary); }
.stat-icon.orange { background: var(--warning-soft); color: var(--warning); }
.stat-icon.cyan { background: var(--accent-soft); color: var(--accent); }
.stat-icon.red { background: var(--danger-soft); color: var(--danger); }

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}

.stat-trend {
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 4px;
}
.stat-trend.up { color: var(--secondary); }
.stat-trend.down { color: var(--danger); }

/* TABLES & BADGES */
.table-custom {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.table-custom th {
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table-custom td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

.table-custom tr:last-child td {
    border-bottom: none;
}

.table-custom tr:hover td {
    background: var(--surface-2);
}

.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.badge-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    display: inline-block;
}

.badge-status.success, .badge-status.lunas, .badge-status.aktif, .badge-status.diverifikasi, .badge-status.Selesai {
    background: var(--secondary-soft);
    color: var(--secondary);
}

.badge-status.danger, .badge-status.belum, .badge-status.nonaktif, .badge-status.Belum, .badge-status.Ditolak {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge-status.warning, .badge-status.sebagian, .badge-status.pending, .badge-status.Sebagian, .badge-status.Pending, .badge-status.Diproses {
    background: var(--warning-soft);
    color: var(--warning);
}

.badge-status.info, .badge-status.dicatat, .badge-status.Masuk {
    background: var(--accent-soft);
    color: var(--accent);
}

/* BUTTONS & FORMS */
.btn-primary-custom {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition);
}

.btn-primary-custom:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-outline-custom {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition);
}

.btn-outline-custom:hover {
    background: var(--primary-soft);
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all var(--transition);
}

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

.form-label-custom {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
    display: block;
}

.form-control-custom {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface) !important;
    color: var(--text-primary) !important;
    font-size: 13.5px;
    transition: border-color var(--transition);
    outline: none;
}

.form-control-custom:focus {
    border-color: var(--primary) !important;
}

[data-theme="dark"] .form-control-custom,
.dark .form-control-custom {
    background: var(--surface-2) !important;
    border-color: var(--border) !important;
}

/* AUTHENTICATION PAGES */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 30px;
}

/* TIMELINE */
.timeline {
    position: relative;
    padding-left: 28px;
}
.timeline::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}
.tl-item {
    position: relative;
    margin-bottom: 20px;
}
.tl-dot {
    position: absolute;
    left: -24px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--surface);
    top: 3px;
    background: var(--primary);
}

/* UTILS & CHIPS */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: var(--surface-2);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.text-mono {
    font-family: monospace;
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

/* BLENDED TOAST */
.toast-wrap {
    position: fixed;
    top: 70px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 320px;
}
.toast-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    box-shadow: var(--shadow-md);
    font-size: 13px;
}

/* DARK TOGGLE */
.dark-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    margin: 4px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: none;
    border: none;
    width: calc(100% - 16px);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}
.dark-toggle:hover {
    background: var(--surface-2);
}
.toggle-switch {
    width: 36px;
    height: 20px;
    border-radius: 10px;
    background: var(--border);
    position: relative;
    flex-shrink: 0;
    transition: background var(--transition);
    margin-left: auto;
}
.toggle-switch.on {
    background: var(--primary);
}
.toggle-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: left var(--transition);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.toggle-switch.on .toggle-thumb {
    left: 19px;
}

/* SEARCH WRAPPERS AND ICON INPUTS */
.search-wrap {
    position: relative;
    width: 100%;
}
.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 15px;
    pointer-events: none;
    z-index: 10;
}
.search-input {
    padding-left: 36px !important;
}

/* REUSABLE TOASTER & TOASTS */
.toaster-container {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    width: 100%;
    max-width: 380px;
    pointer-events: none;
}
.toast-item {
    pointer-events: auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    transition: all 0.3s;
}
.toast-item.success {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}
.toast-item.destructive {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}
.toast-item.warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}
.toast-item.default {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text-primary);
}
.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    font-size: 18px;
    color: inherit;
    opacity: 0.6;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}
.toast-close:hover {
    opacity: 1;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleUp {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ===== REUSABLE MODAL CLASSES ===== */
.modal-backdrop-custom {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn 0.18s ease-out;
}

.modal-card-custom {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.25);
    animation: scaleUp 0.2s ease-out;
}

.modal-card-custom.modal-sm {
    max-width: 400px;
}

.modal-card-custom.modal-lg {
    max-width: 720px;
}