:root {
    --brand: #fba800;
    --brand-rgb: 251, 168, 0;
    --brand-hover: #e09600;
    --brand-active: #c07f00;
    --brand-ink: #1a1a1a;
    --bs-primary: #fba800;
    --bs-primary-rgb: 251, 168, 0;
    --bs-link-color: #c07f00;
    --bs-link-hover-color: #a66d00;
    --bs-link-color-rgb: 192, 127, 0;
    --bs-link-hover-color-rgb: 166, 109, 0;
    --app-bg: #fff8eb;
    --app-surface-soft: #fff3d6;
    --app-text: #1a1a1a;
    --app-code: #a66d00;
    --app-icon: #444;
    --app-topbar-bg: rgba(255, 255, 255, 0.92);
}

:root[data-bs-theme="dark"] {
    color-scheme: dark;
    --bs-body-bg: #1c1c1c;
    --bs-body-bg-rgb: 28, 28, 28;
    --bs-body-color: #e4e4e4;
    --bs-body-color-rgb: 228, 228, 228;
    --bs-emphasis-color: #ffffff;
    --bs-secondary-color: rgba(228, 228, 228, 0.65);
    --bs-secondary-bg: #2a2a2a;
    --bs-tertiary-bg: #242424;
    --bs-tertiary-bg-rgb: 36, 36, 36;
    --bs-border-color: #363636;
    --bs-border-color-translucent: rgba(255, 255, 255, 0.1);
    --bs-link-color: #ffbe3d;
    --bs-link-hover-color: #ffd27a;
    --bs-link-color-rgb: 255, 190, 61;
    --bs-link-hover-color-rgb: 255, 210, 122;
    --app-bg: #121212;
    --app-surface-soft: #1a1a1a;
    --app-text: var(--bs-body-color);
    --app-code: #ffbe3d;
    --app-icon: #cfcfcf;
    --app-topbar-bg: rgba(28, 28, 28, 0.9);
}

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

code {
    color: var(--app-code);
}

.navbar-branded {
    background-color: var(--brand-ink);
}

.navbar-branded .nav-link,
.navbar-branded .navbar-text {
    color: rgba(255, 255, 255, 0.78);
}

.navbar-branded .nav-link:hover,
.navbar-branded .nav-link.active {
    color: var(--brand);
}

.navbar-branded .navbar-toggler {
    border-color: rgba(251, 168, 0, 0.45);
}

.navbar-branded .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23fba800' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.brand-logo {
    display: block;
    height: 44px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
}

.auth-logo {
    display: inline-block;
    height: auto;
    max-height: 80px;
    max-width: min(320px, 85vw);
    object-fit: contain;
}

.auth-body {
    background:
        radial-gradient(circle at top, rgba(251, 168, 0, 0.28), transparent 55%),
        var(--app-bg);
}

.auth-card {
    border: 0;
    border-top: 4px solid var(--brand);
}

.site-footer {
    background-color: var(--app-surface-soft);
    border-top: 1px solid rgba(251, 168, 0, 0.35) !important;
}

.hero-brand {
    background-color: rgba(251, 168, 0, 0.16);
}

.btn-primary {
    --bs-btn-color: #1a1a1a;
    --bs-btn-bg: #fba800;
    --bs-btn-border-color: #fba800;
    --bs-btn-hover-color: #1a1a1a;
    --bs-btn-hover-bg: #e09600;
    --bs-btn-hover-border-color: #e09600;
    --bs-btn-focus-shadow-rgb: 251, 168, 0;
    --bs-btn-active-color: #1a1a1a;
    --bs-btn-active-bg: #c07f00;
    --bs-btn-active-border-color: #c07f00;
    --bs-btn-disabled-color: #1a1a1a;
    --bs-btn-disabled-bg: #fba800;
    --bs-btn-disabled-border-color: #fba800;
}

.form-control:focus {
    border-color: #fba800;
    box-shadow: 0 0 0 0.25rem rgba(251, 168, 0, 0.35);
}

.card {
    border-color: rgba(251, 168, 0, 0.18);
}

/* =========================================================
   Dashboard shell
   ========================================================= */
:root {
    --sidebar-width: 264px;
    --sidebar-width-collapsed: 76px;
    --sidebar-bg: #161616;
    --sidebar-bg-elev: #1f1f1f;
    --sidebar-text: rgba(255, 255, 255, 0.72);
    --sidebar-text-strong: #ffffff;
    --topbar-height: 64px;
}

.dashboard-body {
    background-color: var(--app-bg);
    min-height: 100vh;
}

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

.dashboard-main {
    flex: 1 1 auto;
    min-width: 0;
}

/* ---------- Sidebar ---------- */
.dashboard-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    transition: width 0.2s ease, flex-basis 0.2s ease;
    overflow: hidden;
}

.dashboard-offcanvas {
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    width: var(--sidebar-width);
}

.sidebar-brand {
    height: var(--topbar-height);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.sidebar-logo {
    display: block;
    height: 52px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
}

.sidebar-logo-mark {
    display: none;
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.sidebar-nav {
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.sidebar-group-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.38);
    white-space: nowrap;
}

.sidebar-link {
    color: var(--sidebar-text);
    border-radius: 0.6rem;
    padding: 0.6rem 0.8rem;
    gap: 0.75rem;
    white-space: nowrap;
    position: relative;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-link:hover,
.sidebar-link:focus-visible {
    color: var(--sidebar-text-strong);
    background-color: rgba(255, 255, 255, 0.06);
}

.sidebar-link.active {
    color: var(--brand-ink);
    background-color: var(--brand);
    font-weight: 600;
}

.sidebar-link.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.sidebar-icon {
    font-size: 1.15rem;
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-caret {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.sidebar-link[aria-expanded="true"] .sidebar-caret {
    transform: rotate(180deg);
}

.sidebar-submenu {
    margin: 0.25rem 0 0.25rem 1.1rem;
    padding-left: 0.9rem;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    gap: 0.125rem;
}

.sidebar-sublink {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--sidebar-text);
    font-size: 0.9rem;
    padding: 0.45rem 0.7rem;
    border-radius: 0.5rem;
    white-space: nowrap;
}

.sidebar-sublink:hover,
.sidebar-sublink:focus-visible {
    color: var(--sidebar-text-strong);
    background-color: rgba(255, 255, 255, 0.06);
}

.sidebar-sublink.active {
    color: var(--brand);
    font-weight: 600;
}

.sidebar-sublink.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.sidebar-subicon {
    width: 1.1rem;
    font-size: 0.95rem;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.85;
}

.sidebar-sublink.active .sidebar-subicon {
    opacity: 1;
}

.sidebar-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
    opacity: 0.6;
    flex-shrink: 0;
}

.sidebar-badge {
    background-color: rgba(251, 168, 0, 0.18);
    color: var(--brand);
    font-weight: 600;
    font-size: 0.65rem;
}

.sidebar-link.active .sidebar-badge {
    background-color: rgba(0, 0, 0, 0.15);
    color: var(--brand-ink);
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.sidebar-logout:hover,
.sidebar-logout:focus-visible {
    color: #ff8a80;
    background-color: rgba(255, 82, 82, 0.12);
}

/* Collapsed mode (desktop only) */
@media (min-width: 992px) {
    html.sidebar-collapsed .dashboard-sidebar {
        width: var(--sidebar-width-collapsed);
        flex-basis: var(--sidebar-width-collapsed);
    }

    html.sidebar-collapsed .sidebar-label,
    html.sidebar-collapsed .sidebar-caret,
    html.sidebar-collapsed .sidebar-badge,
    html.sidebar-collapsed .sidebar-group-label,
    html.sidebar-collapsed .sidebar-logo,
    html.sidebar-collapsed .dashboard-sidebar .collapse {
        display: none !important;
    }

    html.sidebar-collapsed .sidebar-logo-mark {
        display: block;
    }

    html.sidebar-collapsed .sidebar-brand {
        justify-content: center;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    html.sidebar-collapsed .sidebar-link {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    html.sidebar-collapsed .sidebar-nav ul + .sidebar-group-label {
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        margin-top: 0.75rem !important;
        padding-top: 0.75rem;
    }
}

/* ---------- Topbar ---------- */
.dashboard-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    height: var(--topbar-height);
    background-color: var(--app-topbar-bg);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(251, 168, 0, 0.28);
}

.btn-icon {
    --bs-btn-padding-x: 0;
    --bs-btn-padding-y: 0;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.6rem;
    color: var(--app-icon);
    font-size: 1.2rem;
}

.btn-icon:hover,
.btn-icon:focus-visible {
    background-color: rgba(251, 168, 0, 0.14);
    color: var(--bs-emphasis-color);
}

.topbar-user {
    color: var(--brand-ink);
    transition: background-color 0.15s ease;
}

.topbar-user:hover,
.topbar-user:focus-visible {
    background-color: rgba(251, 168, 0, 0.14);
}

.dropdown-menu {
    --bs-dropdown-link-active-bg: rgba(251, 168, 0, 0.18);
    --bs-dropdown-link-active-color: var(--bs-emphasis-color);
}

.breadcrumb-item + .breadcrumb-item::before {
    color: #b9ab8a;
}

/* ---------- Content ---------- */
.dashboard-content {
    min-width: 0;
}

.dashboard-footer {
    border-top: 1px solid rgba(251, 168, 0, 0.2);
}

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--brand);
    color: var(--brand-ink);
    font-weight: 700;
    flex-shrink: 0;
}

.avatar-sm {
    width: 34px;
    height: 34px;
    font-size: 0.9rem;
}

.avatar-lg {
    width: 72px;
    height: 72px;
    font-size: 1.75rem;
}

.stat-card {
    border: 1px solid rgba(251, 168, 0, 0.2);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1.25rem rgba(26, 26, 26, 0.08);
}

.text-bg-primary-subtle { background-color: var(--bs-primary-bg-subtle) !important; color: var(--bs-primary-text-emphasis) !important; }
.text-bg-success-subtle { background-color: var(--bs-success-bg-subtle) !important; color: var(--bs-success-text-emphasis) !important; }
.text-bg-warning-subtle { background-color: var(--bs-warning-bg-subtle) !important; color: var(--bs-warning-text-emphasis) !important; }
.text-bg-danger-subtle { background-color: var(--bs-danger-bg-subtle) !important; color: var(--bs-danger-text-emphasis) !important; }
.text-bg-info-subtle { background-color: var(--bs-info-bg-subtle) !important; color: var(--bs-info-text-emphasis) !important; }

.nav-pills .nav-link.active {
    background-color: #fba800;
    border-color: #fba800 !important;
    color: #1a1a1a;
}

button.sync-filter {
    padding: 0;
    background: var(--bs-body-bg);
    color: inherit;
}

a.queue-filter {
    color: inherit;
}

a.queue-filter:hover {
    border-color: rgba(251, 168, 0, 0.6);
}

a.queue-filter.is-active,
button.sync-filter.is-active {
    border-color: #fba800;
    box-shadow: 0 0 0 0.2rem rgba(251, 168, 0, 0.2);
}

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.activity-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.min-w-0 {
    min-width: 0;
}

.balance-card {
    background: linear-gradient(135deg, #fba800 0%, #ffc94d 100%);
    color: var(--brand-ink);
    box-shadow: 0 0.5rem 1.5rem rgba(251, 168, 0, 0.25);
}

.card-header {
    border-bottom-color: rgba(251, 168, 0, 0.18);
}

/* ---------- Card list (pengganti tabel di halaman user) ---------- */
.item-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.item-card:hover {
    transform: translateY(-2px);
    border-color: rgba(251, 168, 0, 0.45);
    box-shadow: 0 0.5rem 1.25rem rgba(26, 26, 26, 0.08);
}

.item-card .card-footer {
    background-color: transparent;
    border-top-color: rgba(251, 168, 0, 0.14);
}

.item-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background-color: rgba(var(--brand-rgb), 0.12);
    color: var(--brand-active);
    font-size: 1.15rem;
    flex-shrink: 0;
}

.item-card-meta {
    font-size: 0.75rem;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.empty-card {
    border-style: dashed;
}

[data-bs-theme="dark"] .item-card-icon {
    color: var(--brand);
}

/* ---------- Settings ---------- */
.settings-card .form-check-input:checked {
    background-color: var(--brand);
    border-color: var(--brand);
}

.settings-card .btn-check:checked + .btn-outline-secondary {
    background-color: var(--brand);
    border-color: var(--brand);
    color: var(--brand-ink);
}

/* Komponen cari & pilih pengguna (form top up) */
.user-picker {
    position: relative;
}

.user-picker-results {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    z-index: 1050;
    max-height: 320px;
    overflow-y: auto;
    border-radius: 0.5rem;
}

.user-picker-results .list-group-item-action.active {
    background-color: rgba(251, 168, 0, 0.14);
    border-color: rgba(251, 168, 0, 0.35);
    color: inherit;
}

.user-picker-selected {
    background-color: rgba(var(--brand-rgb), 0.08);
    border-color: rgba(251, 168, 0, 0.45) !important;
}

.table > :not(caption) > * > * {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.table-light {
    --bs-table-bg: #fff8eb;
}

.order-result-table tbody tr:last-child > * { border-bottom: 0; }
.order-result-table > :not(caption) > * > * { padding: .4rem .5rem; }
.order-result-table > :not(caption) > * > :first-child { padding-left: 0; }
.order-result-scroll { max-height: 320px; overflow-y: auto; }
.order-result-scroll thead th { position: sticky; top: 0; background: var(--bs-body-bg); z-index: 1; box-shadow: inset 0 -1px 0 var(--bs-border-color); }
.topup-method { cursor: pointer; transition: border-color .15s, background-color .15s; }
.topup-method:hover { border-color: #fba800 !important; }
.topup-method.active { border-color: #fba800 !important; background: rgba(251, 168, 0, .08); }
.topup-method .form-check-input:checked { background-color: #fba800; border-color: #fba800; }

/* Halaman error */
.error-code {
    font-size: clamp(4.5rem, 14vw, 6.5rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.04em;
    color: var(--bs-emphasis-color);
}

.error-code-zero {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: .82em;
    height: .82em;
    margin: 0 .04em;
    border-radius: 50%;
    background: rgba(var(--brand-rgb), .15);
    color: var(--brand);
    font-size: 1em;
    vertical-align: -.06em;
}

.error-code-zero .bi {
    font-size: .42em;
}

/* Lonceng notifikasi topbar */
.notif-dot {
    position: absolute;
    top: .35rem;
    right: .4rem;
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
    background-color: #dc3545;
    box-shadow: 0 0 0 2px var(--bs-body-bg);
}

.notif-menu {
    width: min(22rem, calc(100vw - 1.5rem));
    overflow: hidden;
}

.notif-list {
    max-height: 22rem;
    overflow-y: auto;
}

.notif-item {
    border-bottom: 1px solid var(--bs-border-color-translucent);
}

.notif-item:last-child {
    border-bottom: 0;
}

.notif-item:hover,
.notif-item:focus-visible {
    background-color: var(--bs-tertiary-bg);
}

.notif-unread {
    background-color: rgba(var(--brand-rgb), .08);
}

/* Mode gelap / terang */
:root:not([data-bs-theme="dark"]) .theme-icon-dark,
[data-bs-theme="dark"] .theme-icon-light {
    display: none;
}

[data-bs-theme="dark"] .bg-white:not(#qrcode) {
    background-color: var(--bs-body-bg) !important;
}

[data-bs-theme="dark"] .bg-light {
    background-color: var(--bs-tertiary-bg) !important;
}

[data-bs-theme="dark"] .text-bg-light {
    background-color: var(--bs-tertiary-bg) !important;
    color: var(--bs-body-color) !important;
}

[data-bs-theme="dark"] .btn-light {
    --bs-btn-color: var(--bs-body-color);
    --bs-btn-bg: var(--bs-secondary-bg);
    --bs-btn-border-color: var(--bs-border-color);
    --bs-btn-hover-color: var(--bs-emphasis-color);
    --bs-btn-hover-bg: #333;
    --bs-btn-hover-border-color: #444;
    --bs-btn-active-color: var(--bs-emphasis-color);
    --bs-btn-active-bg: #3a3a3a;
    --bs-btn-active-border-color: #4a4a4a;
}

[data-bs-theme="dark"] .table-light {
    --bs-table-color: var(--bs-body-color);
    --bs-table-bg: var(--bs-tertiary-bg);
    --bs-table-border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .card {
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .card-header {
    border-bottom-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .dashboard-topbar {
    border-bottom-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .stat-card {
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .stat-card:hover {
    box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.45);
}

[data-bs-theme="dark"] .auth-logo,
[data-bs-theme="dark"] .brand-logo {
    filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.35));
}
[data-bs-theme="dark"] .btn-outline-secondary {
    --bs-btn-color: #c9c9c9;
    --bs-btn-border-color: #5a5a5a;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #3a3a3a;
    --bs-btn-hover-border-color: #6a6a6a;
    --bs-btn-active-bg: #444;
    --bs-btn-active-border-color: #6a6a6a;
}

[data-bs-theme="dark"] .btn-dark {
    --bs-btn-color: #1a1a1a;
    --bs-btn-bg: #e4e4e4;
    --bs-btn-border-color: #e4e4e4;
    --bs-btn-hover-color: #1a1a1a;
    --bs-btn-hover-bg: #fff;
    --bs-btn-hover-border-color: #fff;
    --bs-btn-active-color: #1a1a1a;
    --bs-btn-active-bg: #cfcfcf;
    --bs-btn-active-border-color: #cfcfcf;
}

[data-bs-theme="dark"] .btn-outline-dark {
    --bs-btn-color: #e4e4e4;
    --bs-btn-border-color: #6a6a6a;
    --bs-btn-hover-color: #1a1a1a;
    --bs-btn-hover-bg: #e4e4e4;
    --bs-btn-hover-border-color: #e4e4e4;
    --bs-btn-active-color: #1a1a1a;
    --bs-btn-active-bg: #cfcfcf;
    --bs-btn-disabled-color: #8a8a8a;
    --bs-btn-disabled-border-color: #4a4a4a;
}