/* =========================================================================
   Quality Dashboard - UI Theme
   Modern, interaktif, user-friendly. Dibangun di atas Bootstrap 5.3.
   Semua nama class lama dipertahankan supaya kompatibel dengan seluruh modul.
   ========================================================================= */

/* ---------- DESIGN TOKENS ---------- */
:root {
    --sidebar-width: 264px;
    --sidebar-width-collapsed: 76px;
    --topbar-height: 62px;

    --brand: #2563eb;
    --brand-rgb: 37, 99, 235;
    --brand-600: #1d4ed8;
    --brand-700: #1e40af;
    --accent: #6366f1;

    --ok: #16a34a;
    --warn: #d97706;
    --danger: #dc2626;
    --info: #0891b2;

    --radius: 16px;
    --radius-sm: 11px;
    --radius-pill: 999px;

    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-md: 0 8px 24px -6px rgba(15, 23, 42, .14), 0 3px 8px -4px rgba(15, 23, 42, .08);
    --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, .28);

    --ease: cubic-bezier(.4, 0, .2, 1);
    --t-fast: 130ms var(--ease);
    --t: 220ms var(--ease);

    /* Surfaces & text (light) */
    --app-bg: #eef2f7;
    --app-bg-2: #e2e8f0;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #f1f5f9;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #1e293b;
    --text-muted: #64748b;
    --heading: #0f172a;

    /* Sidebar (constant dark on both themes) */
    --sidebar-bg: #0f172a;
    --sidebar-bg-grad: linear-gradient(185deg, #111b30 0%, #0b1120 100%);
    --sidebar-text: #cbd5e1;
    --sidebar-text-muted: #7c8aa5;
    --sidebar-active: #ffffff;
    --sidebar-active-bg: rgba(var(--brand-rgb), .22);
}

[data-bs-theme="dark"] {
    --app-bg: #0a0f1c;
    --app-bg-2: #0f172a;
    --surface: #131d31;
    --surface-2: #0f1728;
    --surface-3: #1b2942;
    --border: #26324a;
    --border-strong: #33415c;
    --text: #dbe3ef;
    --text-muted: #93a2ba;
    --heading: #f1f5f9;

    --shadow-md: 0 8px 24px -6px rgba(0, 0, 0, .5), 0 3px 8px -4px rgba(0, 0, 0, .4);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .6);
    --sidebar-bg-grad: linear-gradient(185deg, #0e1526 0%, #080d18 100%);
}

/* ---------- BASE ---------- */
* { scrollbar-color: var(--border-strong) transparent; }

body {
    background-color: var(--app-bg);
    background-image: radial-gradient(1200px 600px at 100% 0, rgba(var(--brand-rgb), .06), transparent 60%);
    color: var(--text);
    font-family: "Inter", "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.006em;
}

h1, h2, h3, h4, h5, h6 { color: var(--heading); letter-spacing: -0.02em; }
a { text-decoration: none; }

::selection { background: rgba(var(--brand-rgb), .22); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); background-clip: content-box; }

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 4px;
}

.app-wrapper { display: flex; min-height: 100vh; }

/* =========================================================================
   SIDEBAR
   ========================================================================= */
.app-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg-grad);
    color: var(--sidebar-text);
    position: fixed;
    inset: 0 auto 0 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1045;
    display: flex;
    flex-direction: column;
    transition: width var(--t), transform var(--t);
    scrollbar-width: thin;
}
.app-sidebar::-webkit-scrollbar { width: 6px; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    font-weight: 700;
    font-size: 1.12rem;
    color: #fff;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    position: sticky;
    top: 0;
    background: var(--sidebar-bg);
    z-index: 2;
}
.sidebar-brand:hover { color: #fff; }
.sidebar-brand strong { color: var(--brand); font-weight: 800; }
.sidebar-brand-icon {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    color: #fff;
    background: linear-gradient(145deg, var(--brand), var(--accent));
    border-radius: 12px;
    box-shadow: 0 6px 16px -4px rgba(var(--brand-rgb), .6);
}

.sidebar-nav { padding: 12px 12px 20px; flex: 1; }

.nav-section-title {
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.09em;
    color: var(--sidebar-text-muted);
    padding: 18px 12px 6px;
    font-weight: 700;
    white-space: nowrap;
    transition: opacity var(--t);
}

.app-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin: 2px 0;
    color: var(--sidebar-text);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 10px;
    white-space: nowrap;
    position: relative;
    transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.app-sidebar .nav-link > i {
    flex: 0 0 auto;
    width: 22px;
    font-size: 1.05rem;
    text-align: center;
    opacity: .85;
    transition: transform var(--t-fast);
}
.app-sidebar .nav-link .nav-text { transition: opacity var(--t); }
.app-sidebar .nav-link:hover {
    background: rgba(255, 255, 255, .07);
    color: #fff;
}
.app-sidebar .nav-link:hover > i { transform: scale(1.12); opacity: 1; }
.app-sidebar .nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active);
    font-weight: 600;
}
.app-sidebar .nav-link.active > i { opacity: 1; color: #93b4ff; }
.app-sidebar .nav-link.active::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 8px;
    bottom: 8px;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: linear-gradient(var(--brand), var(--accent));
}

.sidebar-foot {
    padding: 14px 20px 20px;
    border-top: 1px solid rgba(255, 255, 255, .07);
    font-size: .8rem;
    color: var(--sidebar-text-muted);
    white-space: nowrap;
    transition: opacity var(--t);
}
.sidebar-foot .fw-semibold { color: #e2e8f0; }

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, .55);
    backdrop-filter: blur(2px);
    z-index: 1040;
    opacity: 0;
    transition: opacity var(--t);
}
.sidebar-backdrop.show { display: block; opacity: 1; }

/* ---------- COLLAPSED (desktop mini rail) ---------- */
@media (min-width: 992px) {
    .app-wrapper.sidebar-collapsed .app-sidebar,
    html.pre-sidebar-collapsed .app-sidebar { width: var(--sidebar-width-collapsed); }
    .app-wrapper.sidebar-collapsed .app-main,
    html.pre-sidebar-collapsed .app-main { margin-left: var(--sidebar-width-collapsed); }

    .app-wrapper.sidebar-collapsed .nav-text,
    .app-wrapper.sidebar-collapsed .nav-section-title,
    .app-wrapper.sidebar-collapsed .sidebar-foot,
    html.pre-sidebar-collapsed .nav-text,
    html.pre-sidebar-collapsed .nav-section-title,
    html.pre-sidebar-collapsed .sidebar-foot {
        opacity: 0;
        pointer-events: none;
    }
    .app-wrapper.sidebar-collapsed .app-sidebar .nav-link,
    html.pre-sidebar-collapsed .app-sidebar .nav-link { justify-content: center; }
    .app-wrapper.sidebar-collapsed .sidebar-brand,
    html.pre-sidebar-collapsed .sidebar-brand { justify-content: center; padding-inline: 12px; }

    /* Hover reveals full sidebar as an overlay (content does not shift) */
    .app-wrapper.sidebar-collapsed .app-sidebar:hover {
        width: var(--sidebar-width);
        box-shadow: var(--shadow-lg);
    }
    .app-wrapper.sidebar-collapsed .app-sidebar:hover .nav-text,
    .app-wrapper.sidebar-collapsed .app-sidebar:hover .nav-section-title,
    .app-wrapper.sidebar-collapsed .app-sidebar:hover .sidebar-foot { opacity: 1; pointer-events: auto; }
    .app-wrapper.sidebar-collapsed .app-sidebar:hover .nav-link { justify-content: flex-start; }
    .app-wrapper.sidebar-collapsed .app-sidebar:hover .sidebar-brand { justify-content: flex-start; }
}

/* =========================================================================
   MAIN / TOPBAR
   ========================================================================= */
.app-main {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin var(--t);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--topbar-height);
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}
.topbar-inner {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 clamp(14px, 3vw, 28px);
}
.topbar-title { min-width: 0; }
.topbar-page {
    font-weight: 700;
    font-size: 1.02rem;
    color: var(--heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}
.topbar-date {
    align-items: center;
    gap: 6px;
    font-size: .82rem;
    color: var(--text-muted);
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface);
}

.btn-icon {
    --bs-btn-color: var(--text-muted);
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 11px;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.btn-icon:hover {
    background: var(--surface-3);
    color: var(--brand);
    border-color: var(--border);
}
.btn-icon:active { transform: translateY(1px); }

/* Theme toggle icon swap */
#themeToggle .theme-icon-light { display: none; }
[data-bs-theme="dark"] #themeToggle .theme-icon-dark { display: none; }
[data-bs-theme="dark"] #themeToggle .theme-icon-light { display: inline; }

/* User menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px 5px 5px;
    border-radius: var(--radius-pill);
    color: var(--text);
    border: 1px solid transparent;
    transition: background var(--t-fast), border-color var(--t-fast);
}
.user-menu:hover { background: var(--surface-3); border-color: var(--border); color: var(--text); }
.user-menu.dropdown-toggle::after { display: none; }
.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-meta .user-name { font-weight: 600; font-size: .86rem; }
.user-meta small { color: var(--text-muted); font-size: .72rem; }

.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--brand), var(--accent));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: 0 4px 12px -3px rgba(var(--brand-rgb), .5);
    flex: 0 0 auto;
}

/* =========================================================================
   CONTENT
   ========================================================================= */
.content-area {
    flex: 1;
    padding: clamp(16px, 3vw, 30px);
    animation: page-in 340ms var(--ease) both;
}
@keyframes page-in {
    from { opacity: 0; transform: translateY(8px); }
    /* WAJIB `none` (bukan translateY(0)): translateY(0) tetap dihitung sbagai
       "transform" sehingga .content-area jadi containing block + stacking context
       untuk position:fixed di dalamnya -> Bootstrap .modal terjebak di bawah
       .modal-backdrop (layar ter-disable, modal tak bisa diklik). */
    to   { opacity: 1; transform: none; }
}

.app-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: .82rem;
    padding: 16px clamp(16px, 3vw, 30px);
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
    --bs-breadcrumb-divider-color: var(--text-muted);
    font-size: .84rem;
    margin-bottom: 18px;
}
.breadcrumb-item a { color: var(--text-muted); }
.breadcrumb-item a:hover { color: var(--brand); }
.breadcrumb-item.active { color: var(--heading); font-weight: 600; }

/* =========================================================================
   CARDS
   ========================================================================= */
.card {
    --bs-card-bg: var(--surface);
    --bs-card-border-color: var(--border);
    --bs-card-border-radius: var(--radius);
    --bs-card-inner-border-radius: calc(var(--radius) - 1px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--t), transform var(--t), border-color var(--t);
}
.card.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.card:hover { box-shadow: var(--shadow-md); }
.card .card-body { padding: 1.15rem 1.25rem; }
.card-header, .card-footer { background: var(--surface-2); border-color: var(--border); }
.card-footer.bg-white { background: var(--surface-2) !important; }

.card h6.fw-bold, .card h5.fw-bold { color: var(--heading); }

/* ---------- KPI CARDS ---------- */
.kpi-card {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--brand) 6%, transparent), transparent 42%),
        var(--surface);
}
.kpi-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(var(--brand), var(--accent));
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.kpi-label {
    font-size: 0.74rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    margin-bottom: 6px;
}
.kpi-value {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--heading);
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

/* =========================================================================
   TABLES
   ========================================================================= */
.table-responsive {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.card .table-responsive { border: 0; }

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--border);
    --bs-table-hover-bg: color-mix(in srgb, var(--brand) 7%, transparent);
    --bs-table-hover-color: var(--text);
    margin-bottom: 0;
    font-size: .875rem;
}
.table > thead {
    position: sticky;
    top: 0;
    z-index: 1;
}
.table > thead th {
    background: var(--surface-3);
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: .72rem;
    letter-spacing: .05em;
    font-weight: 700;
    border-bottom: 1px solid var(--border-strong);
    white-space: nowrap;
    padding: 11px 12px;
}
.table > tbody td { padding: 10px 12px; vertical-align: middle; border-color: var(--border); }
.table.table-hover > tbody > tr { transition: background var(--t-fast); }
.table-light { --bs-table-bg: var(--surface-3); --bs-table-color: var(--text-muted); }

/* =========================================================================
   BUTTONS / BADGES / FORMS
   ========================================================================= */
.btn {
    --bs-btn-border-radius: 10px;
    --bs-btn-font-weight: 600;
    --bs-btn-focus-shadow-rgb: var(--brand-rgb);
    transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast), color var(--t-fast);
}
.btn:active { transform: translateY(1px); }
.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-600);
    --bs-btn-hover-border-color: var(--brand-600);
    --bs-btn-active-bg: var(--brand-700);
    box-shadow: 0 8px 18px -8px rgba(var(--brand-rgb), .65);
}
.btn-outline-primary {
    --bs-btn-color: var(--brand);
    --bs-btn-border-color: color-mix(in srgb, var(--brand) 45%, var(--border));
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
}
.btn-sm { --bs-btn-border-radius: 8px; }
.btn.is-loading { pointer-events: none; opacity: .75; position: relative; }
.btn.is-loading::after {
    content: "";
    width: 14px; height: 14px;
    margin-left: 8px;
    display: inline-block;
    vertical-align: -2px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btn-spin .6s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

.badge {
    --bs-badge-font-weight: 600;
    --bs-badge-padding-x: .6em;
    --bs-badge-padding-y: .4em;
    border-radius: var(--radius-pill);
    letter-spacing: .01em;
}

.form-control, .form-select {
    --bs-body-bg: var(--surface);
    background-color: var(--surface);
    border-color: var(--border-strong);
    color: var(--text);
    border-radius: 10px;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .2rem rgba(var(--brand-rgb), .18);
}
.form-label { font-weight: 600; color: var(--text); font-size: .85rem; }
.form-label.small { font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }

.input-group-text {
    background: var(--surface-3);
    border-color: var(--border-strong);
    color: var(--text-muted);
    border-radius: 10px;
}

/* ---------- Dropdown / Alerts / Pagination ---------- */
.dropdown-menu {
    --bs-dropdown-bg: var(--surface);
    --bs-dropdown-border-color: var(--border);
    --bs-dropdown-link-color: var(--text);
    --bs-dropdown-link-hover-bg: var(--surface-3);
    --bs-dropdown-link-active-bg: var(--brand);
    --bs-dropdown-border-radius: 14px;
    box-shadow: var(--shadow-md);
    padding: 8px;
    animation: dd-in 150ms var(--ease);
}
.dropdown-menu .dropdown-item { border-radius: 9px; padding: 8px 12px; font-size: .88rem; }
@keyframes dd-in { from { opacity: 0; transform: translateY(-6px); } }

.alert {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    animation: alert-in 260ms var(--ease);
}
@keyframes alert-in { from { opacity: 0; transform: translateY(-10px); } }
.alert-success { border-left: 4px solid var(--ok); }
.alert-danger  { border-left: 4px solid var(--danger); }
.alert-warning { border-left: 4px solid var(--warn); }
.alert-info    { border-left: 4px solid var(--info); }

.pagination {
    --bs-pagination-color: var(--text-muted);
    --bs-pagination-bg: var(--surface);
    --bs-pagination-border-color: var(--border);
    --bs-pagination-hover-bg: var(--surface-3);
    --bs-pagination-hover-color: var(--brand);
    --bs-pagination-active-bg: var(--brand);
    --bs-pagination-active-border-color: var(--brand);
    --bs-pagination-border-radius: 9px;
    gap: 4px;
}
.page-link { border-radius: 9px !important; transition: background var(--t-fast), color var(--t-fast); }

/* =========================================================================
   SCROLL-TO-TOP
   ========================================================================= */
.scroll-top {
    position: fixed;
    right: 22px;
    bottom: 22px;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    font-size: 1.2rem;
    color: #fff;
    background: linear-gradient(145deg, var(--brand), var(--accent));
    border: 0;
    border-radius: 50%;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(16px) scale(.9);
    pointer-events: none;
    transition: opacity var(--t), transform var(--t);
    z-index: 1035;
}
.scroll-top.show { opacity: 1; transform: none; pointer-events: auto; }
.scroll-top:hover { transform: translateY(-3px); }

/* =========================================================================
   LOGIN PAGE
   ========================================================================= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #0b1120;
    background-image:
        radial-gradient(60rem 40rem at 10% -10%, rgba(var(--brand-rgb), .35), transparent 55%),
        radial-gradient(50rem 40rem at 110% 110%, rgba(99, 102, 241, .32), transparent 55%),
        linear-gradient(160deg, #0b1120, #111b30);
    position: relative;
    overflow: hidden;
}
.login-page::before,
.login-page::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: .5;
    animation: float 14s var(--ease) infinite alternate;
}
.login-page::before { width: 360px; height: 360px; background: rgba(var(--brand-rgb), .5); top: -80px; left: -60px; }
.login-page::after  { width: 420px; height: 420px; background: rgba(99, 102, 241, .45); bottom: -120px; right: -80px; animation-delay: -6s; }
@keyframes float { to { transform: translate3d(30px, 40px, 0) scale(1.08); } }

.login-wrapper { width: 100%; max-width: 410px; position: relative; z-index: 1; }
.login-card {
    border-radius: 22px !important;
    border: 1px solid rgba(255, 255, 255, .14) !important;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .55);
    backdrop-filter: blur(10px);
    animation: page-in 400ms var(--ease) both;
}
[data-bs-theme="dark"] .login-card { background: rgba(19, 29, 49, .92); }
.login-icon {
    font-size: 2rem;
    color: #fff;
    width: 64px;
    height: 64px;
    display: inline-grid;
    place-items: center;
    background: linear-gradient(145deg, var(--brand), var(--accent));
    border-radius: 18px;
    box-shadow: 0 14px 30px -8px rgba(var(--brand-rgb), .7);
}
.login-card .btn-primary { padding-block: .6rem; font-size: 1rem; }
.pw-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--text-muted);
    width: 34px;
    height: 34px;
    border-radius: 8px;
}
.pw-toggle:hover { color: var(--brand); background: var(--surface-3); }

/* =========================================================================
   UTILITIES / RESPONSIVE
   ========================================================================= */
.text-muted { color: var(--text-muted) !important; }
hr { border-color: var(--border); opacity: 1; }
code { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); padding: .1em .4em; border-radius: 6px; }

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .app-sidebar.show { transform: translateX(0); }
    .app-main { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

/* =========================================================================
   SELECT2 - dropdown searchable/auto-suggest pada filter bar
   (Customer, Proses, Operator, Fasilitator, Part Number). Disamakan 1:1
   dengan token & look form-select / dropdown-menu bawaan tema ini, jadi
   otomatis ikut terang/gelap tanpa styling terpisah.
   ========================================================================= */
.select2-container { font-size: .875rem; }

/* Kotak tertutup (belum diklik) - meniru .form-select persis. */
.select2-container .select2-selection--single {
    height: auto;
    min-height: calc(1.5em + .5rem + 2px);
    display: flex;
    align-items: center;
    background-color: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text);
    line-height: normal;
    padding-left: .5rem;
    padding-right: 1.75rem;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder { color: var(--text-muted); }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 100%; right: 6px; }
.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--text-muted) transparent transparent transparent;
}
.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: var(--brand);
    box-shadow: 0 0 0 .2rem rgba(var(--brand-rgb), .18);
}
.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-width: 0 4px 5px 4px;
    border-color: transparent transparent var(--brand) transparent;
}

/* Panel hasil pencarian - meniru .dropdown-menu (radius, shadow, animasi). */
.select2-dropdown {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    z-index: 1060;
    animation: dd-in 150ms var(--ease);
}
.select2-search--dropdown { padding: 8px; background-color: var(--surface); }
.select2-search--dropdown .select2-search__field {
    background-color: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text);
    padding: 6px 10px;
    outline: none;
}
.select2-results__options { padding: 0 8px 8px; max-height: 260px; }
.select2-results__option {
    color: var(--text);
    border-radius: 9px;
    padding: 8px 12px;
    font-size: .88rem;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--surface-3);
    color: var(--heading);
}
.select2-container--default .select2-results__option[aria-selected="true"] {
    background-color: var(--brand);
    color: #fff;
}
.select2-container--default .select2-results__option[aria-selected="true"].select2-results__option--highlighted {
    background-color: var(--brand-600);
}
.select2-results__message { color: var(--text-muted); padding: 8px 12px; font-style: italic; }

/* ============================================================================
   Dashboard - tabel Data Part & Data NG Manpower
   Sel "Qty NG" bergaya bar + sel kode NG / proses bergaya pil "KODE xN".
   ========================================================================= */
.yd-ngqty { white-space: nowrap; }
.yd-ngqty-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}
.yd-ngbar {
    position: relative;
    flex: 0 0 88px;
    width: 88px;
    height: 6px;
    border-radius: 999px;
    background: var(--surface-3);
    overflow: hidden;
}
.yd-ngbar-fill {
    position: absolute;
    inset: 0 auto 0 0;
    min-width: 3px;
    border-radius: 999px;
    background: var(--border-strong);
}
.yd-ngbar.is-hi  .yd-ngbar-fill { background: #ef4444; }
.yd-ngbar.is-mid .yd-ngbar-fill { background: #f97316; }
.yd-ngbar.is-lo  .yd-ngbar-fill { background: #94a3b8; }
.yd-ngqty-val {
    min-width: 46px;
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--heading);
}

.yd-ngpills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 460px;
}
.yd-ngpill {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: .74rem;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text);
    white-space: nowrap;
}
.yd-ngpill-n {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--brand);
}
.yd-ngpill-more {
    background: transparent;
    border-style: dashed;
    color: var(--text-muted);
}
