#wrapper,
body {
    background: #eff6ff;
}

:root {
    --app-blue-50: #eff6ff;
    --app-blue-100: #dbeafe;
    --app-blue-200: #bfdbfe;
    --app-blue-300: #93c5fd;
    --app-blue-500: #3b82f6;
    --app-blue-600: #2563eb;
    --app-blue-700: #1d4ed8;
    --app-blue-800: #1e40af;
    --app-blue-900: #1e3a8a;
}

#sidebar {
    width: 260px;
    min-height: 100vh;
    flex: 0 0 260px;
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 55%, #1e40af 100%) !important;
    transition: transform 0.25s ease;
    z-index: 1040;
}

/* #sidebar .nav-link.active,
#sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0.375rem;
} */

#wrapper {
    min-height: 100vh;
    overflow-x: hidden;
}

.text-primary {
    color: var(--app-blue-700) !important;
}

.bg-primary {
    background-color: var(--app-blue-600) !important;
}

.border-primary {
    border-color: var(--app-blue-600) !important;
}

.btn-primary {
    --bs-btn-bg: var(--app-blue-600);
    --bs-btn-border-color: var(--app-blue-600);
    --bs-btn-hover-bg: var(--app-blue-700);
    --bs-btn-hover-border-color: var(--app-blue-700);
    --bs-btn-active-bg: var(--app-blue-800);
    --bs-btn-active-border-color: var(--app-blue-800);
    --bs-btn-disabled-bg: var(--app-blue-300, #93c5fd);
    --bs-btn-disabled-border-color: var(--app-blue-300, #93c5fd);
}

.btn-outline-primary {
    --bs-btn-color: var(--app-blue-700);
    --bs-btn-border-color: var(--app-blue-600);
    --bs-btn-hover-bg: var(--app-blue-600);
    --bs-btn-hover-border-color: var(--app-blue-600);
    --bs-btn-active-bg: var(--app-blue-700);
    --bs-btn-active-border-color: var(--app-blue-700);
}

.btn-outline-secondary {
    --bs-btn-color: var(--app-blue-800);
    --bs-btn-border-color: var(--app-blue-200);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--app-blue-600);
    --bs-btn-hover-border-color: var(--app-blue-600);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--app-blue-700);
    --bs-btn-active-border-color: var(--app-blue-700);
}

.btn-warning {
    --bs-btn-bg: #f59e0b;
    --bs-btn-border-color: #f59e0b;
    --bs-btn-hover-bg: #d97706;
    --bs-btn-hover-border-color: #d97706;
    --bs-btn-active-bg: #b45309;
    --bs-btn-active-border-color: #b45309;
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--app-blue-500);
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.18);
}

.select2-container--bootstrap-5 .select2-selection {
    border-color: #dee2e6;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: var(--app-blue-500);
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.18);
}

.dropdown-item:active,
.dropdown-item.active {
    background-color: var(--app-blue-600);
}

.page-link {
    color: var(--app-blue-700);
}

.page-link:hover {
    color: var(--app-blue-800);
}

.active > .page-link,
.page-link.active {
    border-color: var(--app-blue-600);
    background-color: var(--app-blue-600);
}

.nav-tabs .nav-link {
    color: var(--app-blue-800);
}

.nav-tabs .nav-link:hover {
    border-color: var(--app-blue-100) var(--app-blue-100) var(--app-blue-200);
    color: var(--app-blue-700);
}

.nav-tabs .nav-link.active {
    border-color: var(--app-blue-200) var(--app-blue-200) #fff;
    color: var(--app-blue-800);
    font-weight: 700;
}

.badge.bg-success {
    background-color: #16a34a !important;
}

.app-topbar {
    background: #eff6ff !important;
}

.card {
    border-color: var(--app-blue-100) !important;
}

.card-header.bg-white {
    background: #eff6ff !important;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-bg-type: rgba(239, 246, 255, 0.7);
}

.table-hover > tbody > tr:hover > * {
    --bs-table-bg-state: var(--app-blue-50);
}

.table-bordered > :not(caption) > * {
    border-color: var(--app-blue-100);
}

a {
    color: var(--app-blue-700);
}

a:hover {
    color: var(--app-blue-800);
}

.alert-info {
    --bs-alert-color: var(--app-blue-900);
    --bs-alert-bg: var(--app-blue-50);
    --bs-alert-border-color: var(--app-blue-200);
}

.swal2-confirm {
    background-color: var(--app-blue-600) !important;
}

.swal2-confirm:hover {
    background-color: var(--app-blue-700) !important;
}

.min-w-0 {
    min-width: 0;
}

#sidebar .nav-link.active{
    background:#dbeafe;
    color:#1e3a8a !important;
    box-shadow: 0 0.5rem 1rem rgba(30, 58, 138, 0.16);
}

#sidebar .nav-link:hover{
    background:rgba(219,234,254,0.2);
    color:#fff !important;
}

#sidebar .nav-link {
    width: 100%;
}

.sidebar-section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 0;
    background: transparent;
    text-align: left;
}

.sidebar-section-toggle.active,
.sidebar-section-toggle:not(.collapsed) {
    background: #dbeafe;
    color: #1e3a8a !important;
}

.sidebar-section-toggle .sidebar-chevron {
    transition: transform 0.2s ease;
}

#sidebar .nav-link.active i,
.sidebar-section-toggle.active i,
.sidebar-section-toggle:not(.collapsed) i {
    color: #1e40af;
}

.sidebar-section-toggle:not(.collapsed) .sidebar-chevron {
    transform: rotate(180deg);
}

.sidebar-submenu {
    margin: 0.25rem 0 0.5rem 1rem;
    padding-left: 0.5rem;
    border-left: 1px solid rgba(219,234,254,0.6);
}

#sidebar .sidebar-submenu-link {
    padding-left: 0.75rem !important;
    font-size: 0.95rem;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1035;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.sidebar-toggle,
.sidebar-close {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.sidebar-close {
    border-color: rgba(219, 234, 254, 0.28);
    background: rgba(239, 246, 255, 0.12);
    color: #fff;
}

.sidebar-close:hover {
    border-color: rgba(219, 234, 254, 0.5);
    background: rgba(239, 246, 255, 0.2);
    color: #fff;
}

.app-topbar h4 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-toggle {
    max-width: 220px;
}

.user-menu-name {
    display: inline-block;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
    white-space: nowrap;
}

.card-header {
    gap: 0.75rem;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table td,
.table th {
    vertical-align: middle;
    white-space: nowrap;
}

.table td:last-child {
    min-width: 96px;
}

.table td:last-child .btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dataTables_wrapper .row {
    row-gap: 0.75rem;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    max-width: 100%;
}

#permissionRoleList,
#permissionUserList {
    overflow-x: auto;
}

.dashboard-hero {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(37, 99, 235, 0.96), rgba(30, 64, 175, 0.92)),
        radial-gradient(circle at 82% 20%, rgba(219, 234, 254, 0.42), transparent 28%);
    box-shadow: 0 1rem 2.5rem rgba(30, 58, 138, 0.18);
    color: #fff;
}

.dashboard-hero::after {
    position: absolute;
    right: -3rem;
    bottom: -4rem;
    width: 14rem;
    height: 14rem;
    border: 1.5rem solid rgba(255, 255, 255, 0.14);
    border-radius: 50%;
    content: "";
}

.dashboard-hero-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.5rem;
}

.dashboard-kicker {
    display: inline-block;
    margin-bottom: 0.35rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
    opacity: 0.86;
}

.dashboard-hero h2 {
    margin-bottom: 0.35rem;
    font-size: 1.65rem;
    font-weight: 700;
}

.dashboard-hero p {
    max-width: 34rem;
    margin-bottom: 0;
    color: rgba(255, 255, 255, 0.86);
}

.dashboard-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 0 auto;
    padding: 0.65rem 0.85rem;
    border: 1px solid rgba(219, 234, 254, 0.36);
    border-radius: 8px;
    background: rgba(219, 234, 254, 0.16);
    font-weight: 600;
}

.dashboard-stat-card {
    position: relative;
    height: 100%;
    min-height: 170px;
    overflow: hidden;
    padding: 1.25rem;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 0.75rem 2rem rgba(30, 58, 138, 0.07);
}

.dashboard-stat-card::before {
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    content: "";
}

.dashboard-stat-card .stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-bottom: 1rem;
    border-radius: 8px;
    color: #fff;
    font-size: 1.2rem;
}

.stat-label {
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
}

.stat-value {
    margin-top: 0.15rem;
    color: #0f172a;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.05;
}

.stat-name {
    max-width: 100%;
    overflow: hidden;
    font-size: 1.35rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-money {
    font-size: 1.45rem;
    line-height: 1.18;
    overflow-wrap: anywhere;
}

.stat-caption {
    margin-top: 0.65rem;
    color: #94a3b8;
    font-size: 0.9rem;
}

.stat-user::before,
.stat-user .stat-icon {
    background: #2563eb;
}

.stat-role::before,
.stat-role .stat-icon {
    background: #1d4ed8;
}

.stat-session::before,
.stat-session .stat-icon {
    background: #1e40af;
}

.stat-keluar::before,
.stat-keluar .stat-icon {
    background: #0369a1;
}

.stat-masuk::before,
.stat-masuk .stat-icon {
    background: #2563eb;
}

.stat-saldo::before,
.stat-saldo .stat-icon {
    background: #ca8a04;
}

.dashboard-quick-panel {
    padding: 1.25rem;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 0.75rem 2rem rgba(30, 58, 138, 0.05);
}

.dashboard-transaction-panel {
    height: 100%;
    padding: 1.25rem;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 0.75rem 2rem rgba(30, 58, 138, 0.05);
}

.dashboard-transaction-table {
    --bs-table-bg: transparent;
}

.dashboard-transaction-table th {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.dashboard-transaction-table td,
.dashboard-transaction-table th {
    padding: 0.75rem 0.65rem;
    border-color: #dbeafe;
}

.dashboard-transaction-table td:nth-child(2),
.dashboard-transaction-table td:nth-child(3) {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

.dashboard-action-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 54px;
    padding: 0.85rem 1rem;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    color: #1e293b;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.dashboard-action-link i {
    color: #2563eb;
    font-size: 1.15rem;
}

.dashboard-action-link:hover {
    border-color: #bfdbfe;
    box-shadow: 0 0.75rem 1.5rem rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
    transform: translateY(-1px);
}

.barang-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}

.barang-image-item {
    overflow: hidden;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #fff;
}

.barang-image-item img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.barang-image-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    padding: 0.5rem;
}

.pending-image-preview .barang-image-item {
    position: relative;
}

.barang-view-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
}

.barang-view-image {
    position: relative;
    overflow: hidden;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #fff;
}

.barang-view-image img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.barang-view-image .badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
}

.cropper-wrap {
    max-height: 65vh;
    overflow: hidden;
}

#barangCropPreview {
    display: block;
    max-width: 100%;
}

.login-page {
    min-height: 100vh;
    background:
        linear-gradient(135deg, rgba(30, 58, 138, 0.95), rgba(37, 99, 235, 0.86)),
        radial-gradient(circle at 18% 15%, rgba(255, 255, 255, 0.28), transparent 32%),
        #1d4ed8;
}

.login-shell {
    width: min(1040px, 100%);
}

.login-card {
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1.5rem 4rem rgba(15, 23, 42, 0.22);
}

.login-brand-panel {
    position: relative;
    min-height: 100%;
    padding: 2.5rem;
    background:
        linear-gradient(160deg, rgba(30, 64, 175, 0.96), rgba(14, 165, 233, 0.9)),
        #1d4ed8;
    color: #fff;
}

.login-brand-panel::after {
    position: absolute;
    right: -4.5rem;
    bottom: -4.5rem;
    width: 13rem;
    height: 13rem;
    border: 1.75rem solid rgba(255, 255, 255, 0.14);
    border-radius: 50%;
    content: "";
}

.login-brand-content {
    position: relative;
    z-index: 1;
}

.login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 1.25rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 1.65rem;
}

.login-brand-panel h1 {
    margin-bottom: 0.75rem;
    font-size: 2rem;
    font-weight: 800;
}

.login-brand-panel p {
    max-width: 25rem;
    color: rgba(255, 255, 255, 0.86);
}

.login-feature-list {
    display: grid;
    gap: 0.85rem;
    margin-top: 2rem;
}

.login-feature-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    font-weight: 600;
}

.login-form-panel {
    padding: 2.5rem;
}

.login-form-panel h2 {
    margin-bottom: 0.4rem;
    color: #0f172a;
    font-size: 1.55rem;
    font-weight: 800;
}

.login-input-group {
    position: relative;
}

.login-input-group i {
    position: absolute;
    top: 50%;
    left: 1rem;
    color: #64748b;
    transform: translateY(-50%);
}

.login-input-group .form-control {
    min-height: 48px;
    padding-left: 2.75rem;
}

.login-submit {
    min-height: 48px;
    font-weight: 700;
}

.login-default {
    color: rgba(255, 255, 255, 0.72);
}

@media (max-width: 991.98px) {
    #wrapper {
        display: block !important;
    }

    #sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 260px;
        min-height: 100dvh;
        transform: translateX(-100%);
        box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.35);
    }

    body.sidebar-open {
        overflow: hidden;
    }

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

    body.sidebar-open .sidebar-backdrop {
        opacity: 1;
        visibility: visible;
    }

    main {
        min-width: 0;
        width: 100%;
    }

    .login-brand-panel,
    .login-form-panel {
        padding: 2rem;
    }
}

@media (max-width: 767.98px) {
    .app-topbar {
        padding: 0.75rem 1rem !important;
    }

    .app-topbar h4 {
        font-size: 1.1rem;
    }

    .app-content {
        padding: 1rem !important;
    }

    .dashboard-hero-content {
        align-items: flex-start;
        flex-direction: column;
        padding: 1.25rem;
    }

    .dashboard-hero h2 {
        font-size: 1.35rem;
    }

    .dashboard-hero-badge {
        width: 100%;
        justify-content: center;
    }

    .card-header {
        align-items: stretch !important;
        flex-direction: column;
    }

    .card-header .btn {
        width: 100%;
    }

    .card-body {
        padding: 1rem;
    }

    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .nav-tabs .nav-link {
        white-space: nowrap;
    }

    .modal-dialog {
        margin: 0.75rem;
    }

    .modal-footer {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .modal-footer > * {
        margin: 0;
        width: 100%;
    }

    .user-menu-toggle {
        max-width: 52px;
        width: 44px;
        padding-left: 0;
        padding-right: 0;
    }

    .user-menu-name,
    .user-menu-toggle::after {
        display: none;
    }
}

@media (max-width: 575.98px) {
    body {
        font-size: 0.95rem;
    }

    #sidebar {
        width: min(86vw, 280px);
        flex-basis: min(86vw, 280px);
    }

    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        float: none;
        text-align: left;
    }

    .dataTables_wrapper .dataTables_filter label,
    .dataTables_wrapper .dataTables_filter input {
        display: block;
        width: 100%;
    }

    .dataTables_wrapper .dataTables_paginate .pagination {
        flex-wrap: wrap;
        justify-content: flex-start;
    }
}
