/* Risk Management Portal - topbar + global night mode */
.topbar-enterprise{
    background:#fff !important;
    border-bottom:1px solid rgba(11,46,90,.08);
    padding:8px 18px;
    min-height:64px;
    display:flex;
    align-items:center;
    position:relative;
    z-index:1030;
    box-shadow:0 4px 18px rgba(15,23,42,.035);
}
.topbar-left,.topbar-right{position:relative;z-index:2;}
.brand-title{font-weight:700;font-size:15px;display:flex;align-items:center;gap:10px;color:#0B2E5A !important;text-decoration:none !important;}
.brand-dot{width:9px;height:9px;border-radius:50%;background:#F2B705;box-shadow:0 0 0 4px rgba(242,183,5,.15);}
.topbar-middle{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);z-index:1;max-width:44%;min-width:240px;pointer-events:none;}
.unit-center-box{display:flex;flex-direction:column;align-items:center;justify-content:center;background:linear-gradient(135deg,#0B2E5A 0%,#174a8b 100%);color:#fff;padding:8px 16px;border-radius:12px;box-shadow:0 8px 18px rgba(11,46,90,.18);text-align:center;max-width:100%;}
.unit-empty{background:linear-gradient(135deg,#6c757d 0%,#8a929a 100%);}
.unit-title{display:flex;align-items:center;justify-content:center;gap:4px;font-size:12px;font-weight:700;line-height:1.2;max-width:100%;}
.unit-title span,.unit-desc{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;}
.unit-desc{margin-top:3px;font-size:11px;font-weight:500;opacity:.9;line-height:1.2;}
.toggle-btn,.icon-btn,.notif-bell{color:#0B2E5A !important;border-radius:9px;padding:7px 10px !important;transition:background-color .18s ease,color .18s ease,transform .18s ease;position:relative;}
.toggle-btn:hover,.icon-btn:hover,.notif-bell:hover{background:rgba(11,46,90,.08);transform:translateY(-1px);}
.theme-toggle{cursor:pointer;outline:none !important;}
.theme-toggle:focus-visible,.notif-mark-read:focus-visible,.notif-footer .btn-link:focus-visible{box-shadow:0 0 0 3px rgba(23,74,139,.18);}
.notif-count{position:absolute;top:1px;right:0;min-width:17px;height:17px;padding:0 4px;border-radius:9px;background:#e53935;color:#fff;border:2px solid #fff;font-size:9px;font-weight:800;line-height:13px;text-align:center;box-shadow:0 3px 8px rgba(229,57,53,.28);}
.notif-bell.has-unread i{animation:notif-ring .7s ease 1;}
@keyframes notif-ring{0%,100%{transform:rotate(0)}20%{transform:rotate(14deg)}40%{transform:rotate(-12deg)}60%{transform:rotate(8deg)}80%{transform:rotate(-5deg)}}
.avatar-wrapper{position:relative;display:flex;align-items:center;justify-content:center;}
.user-link{border-radius:10px;}
.user-avatar{display:flex;align-items:center;justify-content:center;width:34px;height:34px;border-radius:50%;background:#0B2E5A;color:#fff;font-weight:700;}
.user-avatar-img{width:34px;height:34px;border-radius:50%;object-fit:cover;border:2px solid #F2B705;}
.status-dot{position:absolute;right:-2px;bottom:-2px;width:10px;height:10px;border-radius:50%;background:#28a745;border:2px solid #fff;}
.user-name{font-weight:600;font-size:14px;color:#0B2E5A;}
.user-menu,.notif-menu{border:none;border-radius:14px;overflow:hidden;}
.user-menu{min-width:260px;}
.user-header{padding:14px;background:#f4f7fb;text-align:center;color:#0B2E5A;}
.user-header strong{display:block;font-size:15px;font-weight:700;margin-bottom:3px;}
.user-header small{display:block;color:#6c757d;font-size:12px;font-weight:500;}

/* Notification center */
.notification-dropdown .notif-menu{width:380px;max-width:calc(100vw - 24px);padding:0;margin-top:8px;}
.notif-header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 16px 12px;border-bottom:1px solid #e9eef5;background:#fff;}
.notif-header strong{display:block;color:#0f172a;font-size:15px;line-height:1.2;}
.notif-header small{display:block;color:#7b8797;font-size:11px;margin-top:3px;}
.notif-mark-read{font-size:11px;font-weight:700;padding:4px 6px;color:#174a8b;white-space:nowrap;text-decoration:none !important;}
.notif-mark-read:disabled{color:#a0a9b5;cursor:default;}
.notif-list{max-height:390px;overflow-y:auto;background:#fff;}
.notif-loading,.notif-empty,.notif-error{min-height:120px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:9px;padding:22px;color:#7b8797;text-align:center;font-size:12px;}
.notif-error i{color:#dc3545;}
.notif-item{display:flex;gap:11px;padding:12px 14px;border-bottom:1px solid #eef2f7;color:inherit;text-decoration:none !important;background:#fff;transition:background .16s ease;position:relative;}
.notif-item:hover{background:#f7faff;}
.notif-item.unread{background:#f2f7ff;}
.notif-item.unread::after{content:"";position:absolute;right:10px;top:17px;width:7px;height:7px;border-radius:50%;background:#174a8b;}
.notif-icon{width:35px;height:35px;flex:0 0 35px;border-radius:11px;display:flex;align-items:center;justify-content:center;font-size:13px;}
.notif-icon.tone-primary{background:#eaf1fb;color:#174a8b;}
.notif-icon.tone-info{background:#e7f6fb;color:#1380a1;}
.notif-icon.tone-success{background:#e9f7ef;color:#198754;}
.notif-icon.tone-warning{background:#fff5dc;color:#b77900;}
.notif-icon.tone-danger{background:#fdecec;color:#dc3545;}
.notif-copy{min-width:0;flex:1;padding-right:7px;}
.notif-title{color:#172033;font-size:12.5px;font-weight:700;line-height:1.25;margin-bottom:3px;}
.notif-message{color:#667085;font-size:11.5px;line-height:1.35;white-space:normal;}
.notif-time{display:block;color:#98a2b3;font-size:10.5px;margin-top:5px;}
.notif-footer{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:9px 13px;background:#f8fafc;border-top:1px solid #e9eef5;}
.notif-footer .btn-link,.notif-footer a{font-size:11px;font-weight:700;color:#174a8b;text-decoration:none !important;padding:3px;}
.notif-list::-webkit-scrollbar{width:5px;}
.notif-list::-webkit-scrollbar-thumb{background:#c8d2df;border-radius:6px;}

/* Night mode - AdminLTE dark-mode plus application-specific surfaces. */
html.risk-theme-dark{background:#0b1120;color-scheme:dark;}
body.dark-mode{background:#0b1120;color:#d9e2ef;}
body.dark-mode .topbar-enterprise{background:#101827 !important;border-bottom-color:rgba(148,163,184,.16);box-shadow:0 4px 20px rgba(0,0,0,.22);}
body.dark-mode .brand-title,body.dark-mode .toggle-btn,body.dark-mode .icon-btn,body.dark-mode .notif-bell,body.dark-mode .user-name{color:#e8eef7 !important;}
body.dark-mode .toggle-btn:hover,body.dark-mode .icon-btn:hover,body.dark-mode .notif-bell:hover{background:rgba(255,255,255,.08);}
body.dark-mode .notif-count{border-color:#101827;}
body.dark-mode .status-dot{border-color:#101827;}
body.dark-mode .content-wrapper{background:#0b1120 !important;color:#d9e2ef;}
body.dark-mode .content-header hr{border-color:#263349 !important;}
body.dark-mode .main-footer{background:#101827 !important;border-top-color:#263349 !important;color:#aebbd0 !important;}
body.dark-mode .main-footer a{color:#f2c84b;}
body.dark-mode .card,body.dark-mode .modal-content{background:#111c2e;border-color:#263349;color:#d9e2ef;}
body.dark-mode .card-header,body.dark-mode .modal-header,body.dark-mode .modal-footer{border-color:#263349;}
body.dark-mode .table{color:#d9e2ef;}
body.dark-mode .table td,body.dark-mode .table th{border-color:#263349;}
body.dark-mode .table-hover tbody tr:hover{color:#fff;background:rgba(255,255,255,.035);}
body.dark-mode .form-control,body.dark-mode .custom-select,body.dark-mode select.form-control,body.dark-mode textarea.form-control{background:#0f1929 !important;border-color:#334155 !important;color:#e5edf8 !important;}
body.dark-mode .form-control:focus,body.dark-mode .custom-select:focus{border-color:#517bb0 !important;box-shadow:0 0 0 .2rem rgba(81,123,176,.15) !important;}
body.dark-mode .input-group-text{background:#162238;border-color:#334155;color:#cbd5e1;}
body.dark-mode .dropdown-menu,body.dark-mode .user-menu,body.dark-mode .notif-menu{background:#111c2e;color:#d9e2ef;border:1px solid #263349;}
body.dark-mode .dropdown-divider{border-color:#263349;}
body.dark-mode .dropdown-item{color:#d9e2ef;}
body.dark-mode .dropdown-item:hover,body.dark-mode .dropdown-item:focus{background:#17243a;color:#fff;}
body.dark-mode .user-header{background:#162238;color:#eef4fb;}
body.dark-mode .user-header small{color:#95a5ba;}
body.dark-mode .notif-header,body.dark-mode .notif-list,body.dark-mode .notif-item{background:#111c2e;border-color:#263349;}
body.dark-mode .notif-header strong,body.dark-mode .notif-title{color:#eef4fb;}
body.dark-mode .notif-header small,body.dark-mode .notif-message{color:#9fadc1;}
body.dark-mode .notif-time{color:#7788a1;}
body.dark-mode .notif-item:hover{background:#16243a;}
body.dark-mode .notif-item.unread{background:#142844;}
body.dark-mode .notif-item.unread::after{background:#f2b705;}
body.dark-mode .notif-footer{background:#0f1929;border-color:#263349;}
body.dark-mode .notif-mark-read,body.dark-mode .notif-footer .btn-link,body.dark-mode .notif-footer a{color:#8db8ec;}
body.dark-mode .text-muted{color:#96a3b5 !important;}
body.dark-mode .bg-light{background:#162238 !important;color:#d9e2ef !important;}
body.dark-mode .border,body.dark-mode .border-top,body.dark-mode .border-bottom{border-color:#2b3b54 !important;}
body.dark-mode .pagination .page-link{background:#111c2e;border-color:#334155;color:#b9c9dc;}
body.dark-mode .pagination .page-item.active .page-link{background:#174a8b;border-color:#174a8b;color:#fff;}
body.dark-mode .dataTables_wrapper .dataTables_info,body.dark-mode .dataTables_wrapper .dataTables_length,body.dark-mode .dataTables_wrapper .dataTables_filter{color:#aebbd0 !important;}
body.dark-mode .select2-container--bootstrap4 .select2-selection{background:#0f1929;border-color:#334155;color:#e5edf8;}
body.dark-mode .select2-dropdown{background:#111c2e;border-color:#334155;color:#e5edf8;}
body.dark-mode .select2-container--bootstrap4 .select2-results__option--highlighted{background:#174a8b;color:#fff;}

/* Custom dashboard surfaces that are not standard AdminLTE cards. */
body.dark-mode .mini-stat,body.dark-mode .data-scope-buttons,body.dark-mode .kpi-card,body.dark-mode .table-shell,body.dark-mode .priority-meta-item,body.dark-mode .dash-readonly-section{background:#111c2e !important;border-color:#263349 !important;color:#d9e2ef !important;box-shadow:0 10px 25px rgba(0,0,0,.16) !important;}
body.dark-mode #heatModal .modal-body,body.dark-mode #kategoriDetailModal .modal-body{background:#111c2e !important;color:#d9e2ef !important;}
body.dark-mode .dashboard-shell,body.dark-mode .dashboard-page{color:#d9e2ef;}

@media (max-width:991.98px){
    .topbar-middle{max-width:36%;min-width:200px;}
    .unit-center-box{padding:7px 12px;}
    .unit-title{font-size:11px;}
    .unit-desc{font-size:10px;}
    .brand-text{display:none;}
}
@media (max-width:767.98px){
    .topbar-enterprise{padding-left:8px;padding-right:8px;}
    .topbar-middle{display:none;}
    .notification-dropdown .notif-menu{position:fixed !important;left:12px !important;right:12px !important;top:58px !important;width:auto;max-width:none;transform:none !important;}
    .notif-list{max-height:55vh;}
}
@media (prefers-reduced-motion:reduce){
    .toggle-btn,.icon-btn,.notif-bell{transition:none;}
    .notif-bell.has-unread i{animation:none;}
}

/* Dashboard night-mode refinements (high specificity so page-level light CSS cannot override them). */
body.dark-mode{
    --dash-bg:#0b1120;
    --dash-card:#111c2e;
    --dash-line:#263349;
    --dash-text:#eef4fb;
    --dash-muted:#9fadc1;
    --dash-shadow:0 16px 38px rgba(0,0,0,.18);
    --dash-shadow-lg:0 24px 60px rgba(0,0,0,.25);
}
body.dark-mode .dashboard-card,body.dark-mode .hero-card,body.dark-mode .risk-flow-item,body.dark-mode .rank-item,body.dark-mode .priority-item,body.dark-mode .heatmap-shell{background:#111c2e !important;border-color:#263349 !important;}
body.dark-mode .dashboard-card-header,body.dark-mode #heatModal .modal-header,body.dark-mode #kategoriDetailModal .modal-header,body.dark-mode .dash-readonly-head{background:linear-gradient(135deg,#162238,#111c2e) !important;border-color:#263349 !important;}
body.dark-mode .data-scope-panel{background:linear-gradient(135deg,#12213a,#142844) !important;border-color:#29466d !important;}
body.dark-mode .data-scope-title,body.dark-mode .filter-label,body.dark-mode .rank-title,body.dark-mode .priority-desc,body.dark-mode .pie-caption,body.dark-mode .heatmap-caption,body.dark-mode .dash-readonly-title,body.dark-mode .dash-field-value{color:#e8eef7 !important;}
body.dark-mode .data-scope-sub,body.dark-mode .rank-value,body.dark-mode .priority-meta-label,body.dark-mode .chart-note,body.dark-mode .risk-flow-arrow-label,body.dark-mode .heatmap-flow-arrow-label,body.dark-mode .dash-field-label{color:#9fadc1 !important;}
body.dark-mode .data-scope-btn{color:#b8c5d7 !important;}
body.dark-mode .data-scope-btn:hover{background:#1a2941 !important;color:#fff !important;}
body.dark-mode .btn-dash-light,body.dark-mode .kpi-note,body.dark-mode .chart-note span,body.dark-mode .legend-box{background:#162238 !important;border-color:#31415a !important;color:#c9d4e3 !important;}
body.dark-mode .table-modern thead th,body.dark-mode .heatmap-table thead th,body.dark-mode .heatmap-table tbody th{background:#162238 !important;border-color:#263349 !important;color:#cbd5e1 !important;}
body.dark-mode .table-modern tbody td,body.dark-mode .heatmap-table th,body.dark-mode .heatmap-table td{border-color:#263349 !important;}
body.dark-mode .table-modern tbody tr:hover{background:#142138 !important;}
body.dark-mode .risk-code,body.dark-mode .btn-kategori-detail,body.dark-mode .heatmap-caption span,body.dark-mode .risk-flow-arrow-icon,body.dark-mode .heatmap-flow-arrow-icon{background:#142844 !important;border-color:#294d7b !important;color:#8db8ec !important;}
body.dark-mode .risk-desc,body.dark-mode .priority-meta-value{color:#cbd5e1 !important;}
body.dark-mode .priority-meta-item,body.dark-mode .dash-field-value{background:#0f1929 !important;border-color:#2b3b54 !important;}
body.dark-mode .rank-progress,body.dark-mode .subkategori-progress{background:#263349 !important;}
body.dark-mode .empty-state{background:#111c2e !important;border-color:#3b4b63 !important;color:#9fadc1 !important;}
body.dark-mode .dashboard-modal .modal-body{background:#0f1929 !important;}
body.dark-mode .unit-chart-scroll{scrollbar-color:#50627c transparent;}
body.dark-mode .unit-chart-scroll::-webkit-scrollbar-thumb{background:#50627c;}
