/**
 * Custom UI/UX styles for Sistem Logistik
 * Global styles: loading overlay, cards, badges, responsive helpers, animations
 */

/* ===== Loading Overlay ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    flex-direction: column;
    gap: 12px;
}
.loading-overlay.active {
    display: flex;
}
.loading-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
}
.loading-overlay .loading-text {
    font-size: 0.95rem;
    color: #6c757d;
    font-weight: 500;
}

/* ===== Consistent application surfaces ===== */
:root {
    --app-surface-radius: .75rem;
    --app-surface-shadow: 0 .25rem 1rem rgba(15, 23, 42, .06);
    --app-focus-ring: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .2);
}

.app-shell main > .container-fluid {
    max-width: 1800px;
    padding-top: 1.25rem;
    padding-bottom: 2rem;
}

.card,
.dropdown-menu,
.form-control,
.form-select,
.input-group-text {
    border-radius: var(--app-surface-radius);
}

.card {
    box-shadow: var(--app-surface-shadow);
}

.card-header {
    background-color: var(--bs-body-bg);
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus,
.btn:focus-visible,
.nav-link:focus-visible {
    box-shadow: var(--app-focus-ring);
}

.page-header {
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.page-header h1 {
    margin-bottom: .25rem;
}

.page-header .page-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.filter-card {
    border: 1px solid var(--bs-border-color);
    background: var(--bs-tertiary-bg);
}

.table-responsive {
    border-radius: var(--app-surface-radius);
}

.table > :not(caption) > * > * {
    padding: .75rem .85rem;
}

.table thead th {
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .035em;
    text-transform: uppercase;
    white-space: nowrap;
}

.table tbody tr {
    transition: background-color .15s ease;
}

.table tbody tr:hover {
    background: var(--bs-tertiary-bg);
}

.table-empty,
.table-empty-state {
    min-height: 8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: .35rem;
}

.btn-loading {
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
[data-bs-theme="dark"] .loading-overlay {
    background: rgba(15, 23, 42, 0.86);
}

.app-skip-link {
    position: fixed;
    top: .75rem;
    left: .75rem;
    z-index: 10000;
    padding: .5rem .75rem;
    border-radius: .375rem;
    background: var(--bs-primary);
    color: var(--bs-white);
}

/* ===== Page Header ===== */
.page-header {
    min-height: 60px;
}
.page-header h1 {
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.page-header .subtitle {
    font-size: 0.85rem;
    color: #6c757d;
}

/* ===== Metric Cards ===== */
.metric-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08) !important;
}
.metric-card .icon-wrapper {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

/* ===== Card Enhancements ===== */
.card {
    border-radius: 0.5rem;
    transition: box-shadow 0.15s ease;
}
.card-header {
    background: var(--bs-tertiary-bg);
}
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible {
    outline: 3px solid rgba(var(--bs-primary-rgb), .3);
    outline-offset: 2px;
}
.card-header {
    border-bottom-width: 1px;
}
.card-body-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border-radius: 0.75rem;
}

/* ===== Table Enhancements ===== */
.table-compact th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
    border-bottom-width: 1px;
    white-space: nowrap;
}
.table-compact td {
    vertical-align: middle;
    font-size: 0.875rem;
}
.table-compact .action-cell {
    white-space: nowrap;
}
.table-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: #adb5bd;
}
.table-empty i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}
.table-responsive {
    border-radius: .5rem;
}
.table-hover > tbody > tr {
    transition: background-color .15s ease;
}

/* ===== Badge Variants ===== */
.badge-status {
    padding: 0.35em 0.65em;
    font-weight: 500;
    border-radius: 0.375rem;
}

/* ===== Form Enhancements ===== */
.form-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 0.375rem;
    margin-bottom: 1rem;
    margin-top: 1.5rem;
}
.form-section-title:first-child {
    margin-top: 0;
}

/* ===== Button Group Actions ===== */
.btn-group-actions {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

/* ===== Quick Actions Sidebar ===== */
.quick-action-btn {
    display: block;
    width: 100%;
    text-align: left;
    margin-bottom: 0.375rem;
}

/* ===== Floating Action Button (Quick Actions) ===== */
.app-fab {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1030;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .75rem;
}
.app-fab-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(.5rem);
    transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
.app-fab.open .app-fab-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.app-fab-item {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    max-width: 16rem;
    padding: .375rem .875rem .375rem .375rem;
    border-radius: 2rem;
    text-decoration: none;
    font-size: .875rem;
    font-weight: 500;
    color: var(--bs-body-color);
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    box-shadow: 0 .35rem 1rem rgba(0, 0, 0, .12);
    transition: color .15s ease, border-color .15s ease, transform .15s ease;
}
.app-fab-item:hover {
    color: var(--bs-primary);
    border-color: var(--bs-primary);
    transform: translateX(-.15rem);
}
.app-fab-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--bs-primary);
    color: #fff;
    font-size: 1rem;
    flex: 0 0 auto;
}
.app-fab-item-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-fab-toggle {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    background: var(--bs-primary);
    box-shadow: 0 .5rem 1.25rem rgba(13, 110, 253, .35);
    transition: background .15s ease, filter .15s ease;
}
.app-fab-toggle:hover {
    filter: brightness(1.08);
}
.app-fab-toggle .app-fab-icon-close {
    display: none;
}
.app-fab.open .app-fab-toggle .app-fab-icon-open {
    display: none;
}
.app-fab.open .app-fab-toggle .app-fab-icon-close {
    display: inline-block;
}

/* ===== Build Info (version & server ID) ===== */
.app-build-info {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    margin-left: .5rem;
    vertical-align: middle;
}
.app-build-info .badge {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .72rem;
    font-weight: 500;
    color: var(--bs-secondary-color);
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
}
button.app-server-id-badge {
    cursor: pointer;
    padding: .25em .6em;
    transition: color .15s ease, border-color .15s ease;
}
button.app-server-id-badge:hover {
    color: var(--bs-primary);
    border-color: var(--bs-primary);
}

/* ===== Responsive Utilities ===== */
@media (max-width: 767.98px) {
    .page-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem;
    }
    .page-header .d-flex.gap-2 {
        width: 100%;
    }
    .page-header .d-flex.gap-2 .btn {
        flex: 1;
    }
    /* Page header tanpa wrapper .page-header (pola umum view modul):
       title + tombol aksi ditumpuk & tombol boleh wrap agar tidak overflow. */
    .container-fluid > .d-flex.justify-content-between:has(.btn) {
        flex-direction: column;
        align-items: flex-start !important;
        gap: .75rem;
    }
    .container-fluid > .d-flex.justify-content-between:has(.btn) > .d-flex {
        flex-wrap: wrap;
        width: 100%;
    }
    .container-fluid > .d-flex.justify-content-between:has(.btn) > .d-flex .btn {
        flex: 1 1 auto;
    }
    .metric-card {
        margin-bottom: 0.75rem;
    }
    .app-fab {
        right: .75rem;
        bottom: .75rem;
    }
    .app-fab-toggle {
        width: 3rem;
        height: 3rem;
        font-size: 1.25rem;
    }
    .app-fab-item {
        max-width: 13rem;
    }
    .container-fluid {
        padding-left: .85rem;
        padding-right: .85rem;
    }
    .card-body {
        padding: 1rem;
    }
    .table-responsive {
        margin-right: -.25rem;
        margin-left: -.25rem;
    }
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fadeIn {
    animation: fadeIn 0.3s ease-out;
}

/* ===== Print Styles ===== */
@media print {
    .no-print { display: none !important; }
    .card { break-inside: avoid; }
}

/* ===== Scrollbar Styling ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f3f5;
}
::-webkit-scrollbar-thumb {
    background: #c1c9d0;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #a1a9b0;
}
/* ===== Notification Bell Dropdown ===== */
.app-navbar-dropdown .app-navbar-action .bi-bell,
.app-navbar-dropdown .app-navbar-action .bi-bell-fill {
    font-size: 1.15rem;
    line-height: 1;
}
.notification-badge {
    font-size: .62rem;
    min-width: 1.05rem;
    padding: .18rem .35rem;
    position: absolute;
    top: .28rem;
    right: .28rem;
    z-index: 1;
}
.notification-dropdown .notification-dropdown-header {
    background-color: var(--bs-tertiary-bg);
    font-size: .95rem;
    padding: .6rem .9rem;
}
.notification-list {
    max-height: 330px;
    overflow-y: auto;
}
.notification-item {
    white-space: normal;
    padding: .6rem .9rem;
    border-bottom: 1px solid var(--bs-border-color);
}
.notification-item:last-child {
    border-bottom: none;
}
.notification-item-title {
    font-weight: 600;
    font-size: .88rem;
    line-height: 1.3;
}
.notification-item-message {
    color: var(--bs-secondary-color);
    font-size: .82rem;
    line-height: 1.35;
    margin-top: .15rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.notification-item-time {
    color: var(--bs-secondary-color);
    font-size: .75rem;
    margin-top: .25rem;
}
.notification-empty {
    color: var(--bs-secondary-color);
    font-size: .88rem;
    padding: 1.25rem .9rem;
    text-align: center;
}
.notification-dropdown-footer {
    background-color: var(--bs-tertiary-bg);
    padding: .5rem .9rem;
    font-size: .82rem;
}
.notification-dropdown-footer .btn-link {
    font-size: .82rem;
    text-decoration: none;
}
.notification-dropdown-footer .btn-link:hover {
    text-decoration: underline;
}

/* ===== Breadcrumb Bar ===== */
.app-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin: 0 0 1.1rem;
    padding: .4rem .85rem;
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--app-surface-radius);
    font-size: .875rem;
}

.app-breadcrumb .breadcrumb {
    --bs-breadcrumb-divider: '›';
    --bs-breadcrumb-divider-color: var(--bs-secondary-color);
    --bs-breadcrumb-item-active-color: var(--bs-body-color);
    margin-bottom: 0;
    flex-wrap: wrap;
    row-gap: .15rem;
}

.app-breadcrumb .breadcrumb-item a {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    color: var(--bs-secondary-color);
    font-weight: 500;
    text-decoration: none;
    padding: .18rem .5rem;
    border-radius: .45rem;
    transition: color .15s ease, background-color .15s ease;
}

.app-breadcrumb .breadcrumb-item a:hover,
.app-breadcrumb .breadcrumb-item a:focus {
    color: var(--bs-primary-text-emphasis);
    background: rgba(var(--bs-primary-rgb), .1);
    text-decoration: none;
}

.app-breadcrumb .breadcrumb-item.active {
    color: var(--bs-body-color);
    font-weight: 600;
}

.app-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    content: var(--bs-breadcrumb-divider, '›');
    color: var(--bs-breadcrumb-divider-color);
    font-weight: 600;
    opacity: .65;
}

@media (max-width: 575.98px) {
    .app-breadcrumb {
        padding: .35rem .65rem;
    }
}

/* ===== Semantic Button System =====
 * Buttons are color-coded by intent (create/edit/view/delete/export/print)
 * and get a consistent, polished look that matches the brand.
 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    white-space: nowrap;
    border-radius: .55rem;
    font-weight: 500;
    letter-spacing: .01em;
    transition:
        transform .15s ease,
        box-shadow .15s ease,
        background-color .15s ease,
        border-color .15s ease,
        color .15s ease,
        filter .15s ease;
}

.btn:not(.btn-link):hover {
    transform: translateY(-1px);
    box-shadow: 0 .3rem .9rem rgba(15, 23, 42, .14);
}

.btn:not(.btn-link):active {
    transform: translateY(0) scale(.97);
    box-shadow: none;
}

.btn:disabled,
.btn.disabled {
    transform: none !important;
    box-shadow: none !important;
}

/* Icons inside buttons: align to text baseline and keep consistent spacing */
.btn .bi {
    vertical-align: -0.125em;
}

.btn.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .375rem .55rem;
}
.btn.btn-icon .bi {
    font-size: 1rem;
}

/* Neutralize legacy margin utilities on icons inside buttons: spacing is
   handled by the flex `gap` above so icon+text stays consistent everywhere. */
.btn > .bi.me-1,
.btn > .bi.me-2 {
    margin-right: 0 !important;
}

/* Small buttons align with small form controls (form-control-sm is 31px) */
.btn-sm {
    min-height: 1.9375rem;
    line-height: 1.5;
}

/* When a small button shares an action row with a normal-size button
   (e.g. "Create" + "Export"), equalize heights so the row looks aligned. */
@supports selector(.d-flex:has(> .btn)) {
    .d-flex:has(> .btn:not(.btn-sm)) > .btn-sm,
    .btn-group:has(> .btn:not(.btn-sm)) > .btn-sm {
        height: 2.375rem;
        padding-top: 0;
        padding-bottom: 0;
        font-size: 1rem;
    }

    /* ...but keep them small next to small inputs in filter rows */
    .d-flex:has(> .form-control-sm, > .form-select-sm, > .input-group) > .btn-sm {
        height: auto;
        min-height: 1.9375rem;
        padding: .25rem .5rem;
        font-size: .875rem;
    }
}

/* Primary = brand gradient (main navigation / primary action) */
.btn-primary {
    background: linear-gradient(135deg, #40B3D8 0%, #3a9cbd 100%);
    border-color: transparent;
    color: #fff;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary:disabled {
    background: linear-gradient(135deg, #38a6cb 0%, #348dab 100%);
    border-color: transparent;
    color: #fff;
}
.btn-primary:disabled,
.btn-primary.disabled {
    opacity: .55;
}

/* Success = create / approve / save (green, matches brand accent) */
.btn-success {
    background: linear-gradient(135deg, #83C933 0%, #6daf28 100%);
    border-color: transparent;
    color: #fff;
}
.btn-success:hover,
.btn-success:focus,
.btn-success:active,
.btn-success:disabled {
    background: linear-gradient(135deg, #76ba28 0%, #5f9c21 100%);
    border-color: transparent;
    color: #fff;
}

/* Danger = delete / destructive action */
.btn-danger {
    background: linear-gradient(135deg, #e35d6a 0%, #d63341 100%);
    border-color: transparent;
    color: #fff;
}
.btn-danger:hover,
.btn-danger:focus,
.btn-danger:active,
.btn-danger:disabled {
    background: linear-gradient(135deg, #dc4b59 0%, #c22c3a 100%);
    border-color: transparent;
    color: #fff;
}

/* Info = view / investigate (muted cyan, not competing with primary) */
.btn-info {
    color: #fff;
    background: linear-gradient(135deg, #3bb8c9 0%, #2b9fb0 100%);
    border-color: transparent;
}
.btn-info:hover,
.btn-info:focus,
.btn-info:active {
    color: #fff;
    background: linear-gradient(135deg, #33adbe 0%, #268f9f 100%);
    border-color: transparent;
}

/* Warning = attention / pending */
.btn-warning {
    color: #fff;
    background: linear-gradient(135deg, #f2a93b 0%, #e08f1f 100%);
    border-color: transparent;
}
.btn-warning:hover,
.btn-warning:focus,
.btn-warning:active {
    color: #fff;
    background: linear-gradient(135deg, #ee9f26 0%, #d4821a 100%);
    border-color: transparent;
}

/* Outline buttons: stronger hover fill so the intent is readable */
.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background: rgba(var(--bs-primary-rgb), .08);
    border-color: var(--bs-primary);
}
.btn-outline-success:hover,
.btn-outline-success:focus {
    background: rgba(var(--bs-success-rgb), .08);
    border-color: var(--bs-success);
}
.btn-outline-danger:hover,
.btn-outline-danger:focus {
    background: rgba(var(--bs-danger-rgb), .08);
    border-color: var(--bs-danger);
}
.btn-outline-info:hover,
.btn-outline-info:focus {
    background: rgba(var(--bs-info-rgb), .08);
    border-color: var(--bs-info);
}
.btn-outline-warning:hover,
.btn-outline-warning:focus {
    background: rgba(var(--bs-warning-rgb), .08);
    border-color: var(--bs-warning);
}

/* Secondary / neutral actions (back, cancel, reset) stay quiet */
.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    background: var(--bs-tertiary-bg);
    border-color: var(--bs-secondary);
}

/* ===== Workflow card buttons ("Buka {label}") =====
 * Signal "opens the menu/workflow" with an arrow affordance; the whole
 * card is clickable-feeling so the action is obvious.
 */
.workflow-card .btn-open,
.btn-open {
    background: linear-gradient(135deg, #40B3D8 0%, #3a9cbd 100%);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}
.btn-open:hover,
.btn-open:focus,
.btn-open:active {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, #38a6cb 0%, #348dab 100%);
}
.btn-open .bi {
    transition: transform .15s ease;
}
.btn-open:hover .bi {
    transform: translateX(2px);
}

/* ===== Page-header primary actions ===== */
.page-header .btn-primary,
.page-actions .btn-primary {
    padding-left: 1rem;
    padding-right: 1rem;
}

/* ===== Table row action buttons ===== */
.table .btn-sm {
    padding: .25rem .5rem;
}
.table .btn-sm .bi {
    font-size: .9rem;
}

/* Space out multiple action buttons inside a row cell (incl. delete form) */
.table td .btn + .btn,
.table td .btn + form,
.table td form + .btn,
.table td form + form {
    margin-left: .3rem;
}
.table td form .btn {
    margin-left: 0;
}

/* Action cells (containing only icon buttons / delete form) stay on one line
   and let the column size itself instead of wrapping to multiple rows. */
.table td:has(> .btn, > .btn-group, > form) {
    white-space: nowrap;
}

/* Dark theme: soften heavy gradients */
[data-bs-theme="dark"] .btn-primary,
[data-bs-theme="dark"] .btn-open {
    background: linear-gradient(135deg, #3f97b5 0%, #33788f 100%);
}
[data-bs-theme="dark"] .btn-primary:hover,
[data-bs-theme="dark"] .btn-open:hover {
    background: linear-gradient(135deg, #3789a6 0%, #2b6c82 100%);
}
[data-bs-theme="dark"] .btn-success {
    background: linear-gradient(135deg, #5f9c21 0%, #4d8018 100%);
}
[data-bs-theme="dark"] .btn-success:hover {
    background: linear-gradient(135deg, #568e1d 0%, #447114 100%);
}

/* ============================================================
 * UI/UX Polish — breadcrumb lega, dark mode konsisten,
 * tabel & form terlihat jelas (light & dark).
 * ============================================================ */

/* --- Breadcrumb: lebih lega, tidak mepet --- */
.app-breadcrumb {
    padding: .7rem 1.05rem;
    margin: 0 0 1.3rem;
}
.app-breadcrumb .breadcrumb {
    row-gap: .3rem;
}
.app-breadcrumb .breadcrumb-item a {
    padding: .38rem .65rem;
}
.app-breadcrumb .breadcrumb-item + .breadcrumb-item {
    padding-left: .15rem;
}
.app-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    padding-right: .15rem;
}
@media (max-width: 575.98px) {
    .app-breadcrumb {
        padding: .55rem .8rem;
    }
}

/* --- Light mode: tabel & field form jelas (border tegas) --- */
:root[data-bs-theme="light"] .table {
    --bs-table-border-color: #d0d7e2;
}
:root[data-bs-theme="light"] .table thead th {
    background-color: #f2f5f9;
    color: #334155;
    border-bottom-width: 2px;
    border-bottom-color: #cbd5e1;
}
:root[data-bs-theme="light"] .form-control,
:root[data-bs-theme="light"] .form-select,
:root[data-bs-theme="light"] .input-group-text {
    border-color: #c3cdd9;
    background-color: #ffffff;
}
:root[data-bs-theme="light"] .form-control:focus,
:root[data-bs-theme="light"] .form-select:focus {
    border-color: #7c9cff;
    box-shadow: 0 0 0 .2rem rgba(63, 151, 181, .18);
}
:root[data-bs-theme="light"] .detail-view th {
    background-color: #f6f8fb;
    color: #334155;
}
:root[data-bs-theme="light"] .grid-view th {
    background-color: #f2f5f9;
    color: #334155;
}

/* --- Dark mode: hilangkan background putih yang menyisakan
 *     teks abu-abu tak terbaca; semua permukaan ikut tema gelap. --- */
[data-bs-theme="dark"] .bg-white {
    background-color: var(--bs-body-bg) !important;
}
[data-bs-theme="dark"] .bg-light {
    background-color: var(--bs-tertiary-bg) !important;
}
[data-bs-theme="dark"] .badge.bg-light.text-dark,
[data-bs-theme="dark"] .badge.text-bg-light {
    background-color: var(--bs-tertiary-bg) !important;
    color: var(--bs-body-color) !important;
}
[data-bs-theme="dark"] .table {
    --bs-table-border-color: rgba(255, 255, 255, .13);
}
[data-bs-theme="dark"] .table thead th {
    background-color: #232d3d;
    color: #e2e8f0;
    border-bottom-width: 2px;
    border-bottom-color: #3a4659;
}
[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-bg-type: rgba(255, 255, 255, .035);
}
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .input-group-text {
    border-color: #45536b;
    background-color: #1a2233;
    color: #e2e8f0;
}
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    border-color: #5f9db8;
    box-shadow: 0 0 0 .2rem rgba(63, 151, 181, .22);
}
[data-bs-theme="dark"] .detail-view th,
[data-bs-theme="dark"] .kv-detail-view th {
    background-color: #232d3d;
    color: #e2e8f0;
}
[data-bs-theme="dark"] .grid-view th {
    background-color: #232d3d;
    color: #e2e8f0;
}
[data-bs-theme="dark"] .card-header,
[data-bs-theme="dark"] .card-footer {
    border-color: rgba(255, 255, 255, .1);
}
[data-bs-theme="dark"] .text-muted,
[data-bs-theme="dark"] .text-secondary {
    color: #9aa7bd !important;
}
