/* =========================================================
   App Shell — layout di dalam modul
   Sidebar navy (warna gelap logo), aksen merah logo, konten terang.
   Gaya sengaja tenang: tanpa gradien/glow, fokus keterbacaan.
   ========================================================= */
:root {
    --sh-sidebar-w: 260px;
    --sh-sidebar-w-collapsed: 68px;
    --sh-topbar-h: 56px;

    --sh-red: #c8161d;
    --sh-red-hover: #a91218;
    --sh-red-soft: #fdecec;

    --sh-nav-bg: #111827;
    --sh-nav-bg-2: #0b1220;
    --sh-nav-text: #aab4c3;
    --sh-nav-text-strong: #f3f4f6;
    --sh-nav-muted: #6b7686;
    --sh-nav-hover: rgba(255, 255, 255, .05);
    --sh-nav-active: rgba(255, 255, 255, .08);
    --sh-nav-line: rgba(255, 255, 255, .08);

    --sh-bg: #f4f5f7;
    --sh-surface: #ffffff;
    --sh-line: #e5e7eb;
    --sh-text: #111827;
    --sh-text-2: #4b5563;
    --sh-text-3: #6b7280;
}

body { background: var(--sh-bg); }

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

/* ---------- Sidebar ---------- */
.sh-sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 1040;
    width: var(--sh-sidebar-w);
    display: flex; flex-direction: column;
    background: var(--sh-nav-bg);
    color: var(--sh-nav-text);
    border-right: 1px solid var(--sh-nav-bg-2);
    transition: width .18s ease, transform .2s ease;
}

.sh-brand {
    height: var(--sh-topbar-h);
    display: flex; align-items: center; gap: 10px;
    padding: 0 16px;
    border-bottom: 1px solid var(--sh-nav-line);
    text-decoration: none;
    flex-shrink: 0;
}
.sh-brand:hover { text-decoration: none; }
.sh-brand-logo {
    width: 32px; height: 32px; border-radius: 6px; background: #fff;
    padding: 2px; flex-shrink: 0; object-fit: contain;
}
.sh-brand-text { min-width: 0; line-height: 1.15; }
.sh-brand-name { color: var(--sh-nav-text-strong); font-weight: 600; font-size: .9rem; white-space: nowrap; }
.sh-brand-sub { color: var(--sh-nav-muted); font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sh-workspace {
    margin: 12px 12px 4px;
    padding: 10px 12px;
    border: 1px solid var(--sh-nav-line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .02);
}
.sh-workspace-label { font-size: .66rem; letter-spacing: .06em; text-transform: uppercase; color: var(--sh-nav-muted); }
.sh-workspace-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.sh-workspace-name {
    color: var(--sh-nav-text-strong); font-size: .84rem; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sh-workspace-switch {
    flex-shrink: 0; font-size: .74rem; color: #f19ca0; text-decoration: none;
}
.sh-workspace-switch:hover { color: #fff; text-decoration: underline; }

.sh-search { position: relative; margin: 8px 12px 6px; }
.sh-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--sh-nav-muted); }
.sh-search input {
    width: 100%; height: 34px; padding: 0 10px 0 32px;
    border-radius: 6px; border: 1px solid var(--sh-nav-line);
    background: var(--sh-nav-bg-2); color: var(--sh-nav-text-strong); font-size: .82rem;
    outline: none;
}
.sh-search input::placeholder { color: var(--sh-nav-muted); }
.sh-search input:focus { border-color: #4b5563; }

.sh-nav { flex: 1; overflow-y: auto; padding: 6px 8px 16px; scrollbar-width: thin; scrollbar-color: #374151 transparent; }
.sh-nav-section {
    padding: 14px 10px 6px; font-size: .66rem; letter-spacing: .06em; text-transform: uppercase;
    color: var(--sh-nav-muted);
}
.sh-nav-link {
    position: relative;
    display: flex; align-items: center; gap: 10px; width: 100%;
    min-height: 36px; padding: 7px 10px;
    border: 0; border-radius: 6px; background: transparent;
    color: var(--sh-nav-text); font-size: .86rem; text-align: left; text-decoration: none;
    cursor: pointer;
}
.sh-nav-link:hover { background: var(--sh-nav-hover); color: var(--sh-nav-text-strong); text-decoration: none; }
.sh-nav-link:focus-visible { outline: 2px solid #9ca3af; outline-offset: -2px; }
.sh-nav-link.is-active { background: var(--sh-nav-active); color: #fff; font-weight: 500; }
.sh-nav-link.is-active::before {
    content: ''; position: absolute; left: -8px; top: 6px; bottom: 6px; width: 3px;
    border-radius: 0 3px 3px 0; background: var(--sh-red);
}
.sh-nav-link.has-active-child { color: var(--sh-nav-text-strong); }
.sh-nav-icon { flex-shrink: 0; opacity: .85; }
.sh-nav-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-nav-chevron { flex-shrink: 0; transition: transform .15s ease; opacity: .6; }
.sh-nav-group.is-open > .sh-nav-link .sh-nav-chevron { transform: rotate(90deg); }

.sh-nav-children { margin: 2px 0 4px 21px; padding-left: 10px; border-left: 1px solid var(--sh-nav-line); }
.sh-nav-children .sh-nav-link { min-height: 32px; padding: 6px 10px; font-size: .83rem; }
.sh-nav-children .sh-nav-link.is-active::before { left: -11px; }

.sh-nav-empty { padding: 12px 10px; font-size: .8rem; color: var(--sh-nav-muted); }

.sh-sidebar-foot {
    flex-shrink: 0; border-top: 1px solid var(--sh-nav-line);
    padding: 8px;
}

/* Collapsed (desktop) */
.sh-app.is-collapsed .sh-sidebar { width: var(--sh-sidebar-w-collapsed); }
.sh-app.is-collapsed .sh-brand { justify-content: center; padding: 0; }
.sh-app.is-collapsed .sh-brand-text,
.sh-app.is-collapsed .sh-workspace,
.sh-app.is-collapsed .sh-search,
.sh-app.is-collapsed .sh-nav-section,
.sh-app.is-collapsed .sh-nav-label,
.sh-app.is-collapsed .sh-nav-chevron,
.sh-app.is-collapsed .sh-nav-children { display: none; }
.sh-app.is-collapsed .sh-nav-link { justify-content: center; padding: 8px 0; }

/* ---------- Main ---------- */
.sh-main {
    flex: 1; min-width: 0;
    margin-left: var(--sh-sidebar-w);
    display: flex; flex-direction: column; min-height: 100vh;
    transition: margin-left .18s ease;
}
.sh-app.is-collapsed .sh-main { margin-left: var(--sh-sidebar-w-collapsed); }

/* Halaman di luar modul (profil, pemantauan): tanpa sidebar */
.sh-app.is-tanpa-menu .sh-main { margin-left: 0; }
.sh-merek { display: flex; align-items: center; gap: 8px; padding-right: 14px; margin-right: 2px; border-right: 1px solid var(--sh-line); font-weight: 600; font-size: .9rem; color: var(--sh-text); white-space: nowrap; }
.sh-merek:hover { color: var(--sh-text); text-decoration: none; }
.sh-merek img { width: 28px; height: 28px; object-fit: contain; }
@media (max-width: 575px) { .sh-merek span { display: none; } }

.sh-topbar {
    position: sticky; top: 0; z-index: 1030;
    height: var(--sh-topbar-h);
    display: flex; align-items: center; gap: 12px;
    padding: 0 20px;
    background: var(--sh-surface);
    border-bottom: 1px solid var(--sh-line);
}
.sh-icon-btn {
    width: 34px; height: 34px; flex-shrink: 0;
    display: inline-grid; place-items: center;
    border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--sh-text-2);
    cursor: pointer;
}
.sh-icon-btn:hover { background: #f3f4f6; color: var(--sh-text); }

.sh-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; font-size: .84rem; color: #64748b; }
.sh-crumbs a { color: #475569; text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center; transition: color .15s ease; }
.sh-crumbs a:hover { color: #206bc4; text-decoration: underline; }
.sh-crumbs .sh-crumb-sep { color: #94a3b8; user-select: none; font-size: .82rem; }
.sh-crumbs .sh-crumb-current { color: #0f172a; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sh-topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.sh-date { font-size: .8rem; color: var(--sh-text-3); padding-right: 10px; margin-right: 4px; border-right: 1px solid var(--sh-line); white-space: nowrap; }

.sh-user { position: relative; }
.sh-user-btn {
    display: flex; align-items: center; gap: 10px;
    padding: 5px 12px 5px 6px; border-radius: 10px; border: 1px solid #e2e8f0; background: #ffffff;
    cursor: pointer; color: var(--sh-text); transition: all 0.18s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.sh-user-btn:hover, .sh-user-btn[aria-expanded="true"] {
    background: #f8fafc; border-color: #cbd5e1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}
.sh-avatar {
    width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #4f46e5 0%, #312e81 100%); color: #fff; font-size: .82rem; font-weight: 700;
}
.sh-avatar-img {
    width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
    object-fit: cover; border: 2px solid #ffffff; box-shadow: 0 0 0 1px #cbd5e1;
}
.sh-user-meta { text-align: left; line-height: 1.2; }
.sh-user-name { font-size: .86rem; font-weight: 700; color: #0f172a; max-width: 170px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-user-role { font-size: .72rem; color: #64748b; font-weight: 500; text-transform: capitalize; }

/* Modern User Dropdown */
.sh-menu {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 1050;
    width: 285px; padding: 8px;
    background: #ffffff; border: 1px solid #e2e8f0; border-radius: 14px;
    box-shadow: 0 16px 36px -4px rgba(15, 23, 42, 0.14), 0 4px 12px -2px rgba(15, 23, 42, 0.06);
    animation: sh-menu-pop .18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes sh-menu-pop {
    from { opacity: 0; transform: translateY(-8px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.sh-menu-head {
    padding: 12px 14px 14px; border-radius: 10px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0; margin-bottom: 8px;
}
.sh-menu-head-avatar {
    width: 42px; height: 42px; border-radius: 50%; object-fit: cover;
    border: 2px solid #ffffff; box-shadow: 0 2px 6px rgba(0,0,0,0.1); flex-shrink: 0;
}
.sh-menu-head-init {
    width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
    background: linear-gradient(135deg, #4f46e5 0%, #312e81 100%);
    color: #ffffff; font-weight: 700; font-size: 1rem; flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.sh-menu-head-name { font-size: .94rem; font-weight: 700; color: #0f172a; line-height: 1.25; }
.sh-menu-head-email { font-size: .78rem; color: #64748b; margin-top: 1px; }
.sh-menu-head-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 6px; font-size: .69rem; font-weight: 600;
    background: #e0e7ff; color: #4338ca; margin-top: 5px;
}

.sh-menu-item {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 8px 10px; border: 0; border-radius: 9px; background: transparent;
    color: #1e293b; font-size: .84rem; text-align: left; text-decoration: none; cursor: pointer;
    transition: all 0.15s ease;
}
.sh-menu-item:hover { background: #f1f5f9; color: #0f172a; text-decoration: none; }
.sh-menu-item-icon {
    width: 32px; height: 32px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sh-menu-item-text { flex: 1; min-width: 0; }
.sh-menu-item-title { font-weight: 600; font-size: .84rem; color: #1e293b; line-height: 1.2; }
.sh-menu-item-sub { font-size: .73rem; color: #64748b; margin-top: 2px; }
.sh-menu-item.is-danger { color: #dc2626; margin-top: 2px; }
.sh-menu-item.is-danger:hover { background: #fef2f2; color: #b91c1c; }
.sh-menu-sep { height: 1px; background: #f1f5f9; margin: 6px 0; }

.sh-impersonate {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 8px 20px; background: #fff7ed; border-bottom: 1px solid #fed7aa; color: #9a3412; font-size: .84rem;
}
.sh-impersonate a { color: #9a3412; font-weight: 600; }

.sh-content { flex: 1; padding: 24px; width: 100%; max-width: 1440px; margin: 0 auto; }

.sh-footer {
    padding: 14px 24px; border-top: 1px solid var(--sh-line);
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
    font-size: .76rem; color: var(--sh-text-3); background: var(--sh-surface);
}

.sh-backdrop { display: none; }

/* ---------- Mobile ---------- */
@media (max-width: 991.98px) {
    .sh-sidebar { transform: translateX(-100%); width: 280px; box-shadow: none; }
    .sh-app.is-mobile-open .sh-sidebar { transform: translateX(0); box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
    .sh-app.is-collapsed .sh-sidebar { width: 280px; }
    .sh-main, .sh-app.is-collapsed .sh-main { margin-left: 0; }
    .sh-backdrop {
        display: block; position: fixed; inset: 0; z-index: 1035;
        background: rgba(17, 24, 39, .45); opacity: 0; pointer-events: none; transition: opacity .2s ease;
    }
    .sh-app.is-mobile-open .sh-backdrop { opacity: 1; pointer-events: auto; }
    .sh-content { padding: 16px; }
    .sh-topbar { padding: 0 12px; }
    .sh-date { display: none; }
}
@media (max-width: 575.98px) {
    .sh-user-meta { display: none; }
    .sh-crumbs .sh-crumb-hide-sm { display: none; }
}

/* ---------- Penyelarasan komponen halaman lama ---------- */
.sh-content .erp-page-header { margin-bottom: 20px !important; }
.sh-content .erp-page-title { font-size: 1.25rem; font-weight: 600; color: var(--sh-text); letter-spacing: -.01em; }
.sh-content .erp-page-subtitle { font-size: .85rem; color: var(--sh-text-3); }
.sh-content .card,
.sh-content .erp-card {
    border: 1px solid var(--sh-line);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(17, 24, 39, .04);
}
.sh-content .btn-primary { background: var(--sh-red); border-color: var(--sh-red); }
.sh-content .btn-primary:hover, .sh-content .btn-primary:focus { background: var(--sh-red-hover); border-color: var(--sh-red-hover); }
.sh-content .btn-outline-primary { color: var(--sh-red); border-color: #f1b5b8; }
.sh-content .btn-outline-primary:hover { background: var(--sh-red); border-color: var(--sh-red); color: #fff; }
.sh-content .page-item.active .page-link { background: var(--sh-red); border-color: var(--sh-red); }
.sh-content .form-control:focus, .sh-content .form-select:focus {
    border-color: #e58a8e; box-shadow: 0 0 0 3px rgba(200, 22, 29, .10);
}
.sh-content .form-check-input:checked { background-color: var(--sh-red); border-color: var(--sh-red); }
.sh-content .table thead th {
    font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; color: var(--sh-text-3);
    background: #f9fafb;
}

/* ---------- Cetak (berita acara / bukti transaksi) ---------- */
@media print {
    .sh-sidebar, .sh-topbar, .sh-footer, .sh-backdrop, .ui-page-actions, .ui-back, .ui-toolbar, .ui-pager, .erp-toast-container { display: none !important; }
    .sh-main { margin-left: 0 !important; }
    .sh-content { padding: 0 !important; max-width: none !important; }
    body, .sh-app { background: #fff !important; }
    .ui-card, .db-kpi { box-shadow: none !important; break-inside: avoid; }
}

/* ---------- Lonceng notifikasi ---------- */
.notif { position: relative; }
.notif-btn { position: relative; width: 40px; height: 40px; border-radius: 10px; border: 1px solid #e2e8f0; background: #fff; color: #475569; display: grid; place-items: center; cursor: pointer; }
.notif-btn:hover, .notif-btn[aria-expanded="true"] { background: #f8fafc; border-color: #cbd5e1; color: #0f172a; }
.notif-badge { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: #c8161d; color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.notif-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 1060; width: 320px; max-height: 70vh; overflow-y: auto; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 16px 40px rgba(15, 23, 42, .16); }
.notif-head { padding: 12px 14px; font-weight: 600; border-bottom: 1px solid #eef0f3; }
.notif-grup { padding: 10px 14px 4px; font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #94a3b8; }
.notif-item { display: flex; align-items: center; gap: 10px; padding: 8px 14px; color: #0f172a; text-decoration: none; }
.notif-item:hover { background: #f8fafc; color: #0f172a; text-decoration: none; }
.notif-teks { flex: 1; min-width: 0; line-height: 1.3; }
.notif-teks strong { display: block; font-size: .86rem; font-weight: 600; }
.notif-teks small { display: block; font-size: .74rem; color: #64748b; }
.notif-jumlah { background: #fdecec; color: #9b1116; font-size: .76rem; font-weight: 700; border-radius: 999px; padding: 2px 8px; }
.notif-kosong { padding: 24px 16px; text-align: center; color: #64748b; font-size: .84rem; }
.notif-kosong svg { color: #16a34a; margin-bottom: 6px; }
@media (max-width: 575px) { .notif-menu { position: fixed; left: 8px; right: 8px; top: calc(var(--sh-topbar-h) + 6px); width: auto; } }
