/* SIBUDI SMART — penyesuaian shell admin di atas Dasher (MIT © CodesCandy) */
:root { --sb-gold: #d99f16; --sb-gold-soft: #fdf3d6; --sb-ink: #0c2b28; --sb-shadow: 0 0 2px rgba(145,158,171,.22), 0 12px 24px -6px rgba(145,158,171,.16); }
[data-bs-theme="dark"] { --sb-gold-soft: rgba(217,159,22,.16); --sb-shadow: 0 0 2px rgba(0,0,0,.5), 0 12px 24px -6px rgba(0,0,0,.45); }
body { font-family: 'Public Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
.sb-skip { position: fixed; left: 8px; top: 8px; z-index: 2000; background: var(--ds-primary); color: #fff; padding: 8px 14px; border-radius: 8px; }
.ik { display: block; width: 1em; height: 1em; flex: none; --ik-a: var(--sb-gold); }

/* ---- Sidebar ---- */
#miniSidebar .sb-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
#miniSidebar .sb-brand img { flex: none; object-fit: contain; }
#miniSidebar .site-logo-text strong { display: block; font-size: 15px; font-weight: 800; letter-spacing: .02em; line-height: 1.1; color: var(--ds-primary); }
#miniSidebar .site-logo-text small { display: block; font-size: 10.5px; line-height: 1.25; color: var(--ds-gray-600); margin-top: 2px; max-width: 160px; white-space: normal; }
#miniSidebar .nav-icon { display: inline-flex; width: 22px; justify-content: center; vertical-align: middle; }
#miniSidebar .nav-icon .ik { width: 21px; height: 21px; }
#miniSidebar .nav-link.active { --ik-a: var(--sb-gold); font-weight: 600; }
#miniSidebar .nav-link .badge { font-size: 10px; }
.navbar-nav { padding-bottom: 12px; }
@media (min-width: 992px) {
  html.expanded #miniSidebar { display: flex; flex-direction: column; }
  html.expanded #miniSidebar .navbar-nav { flex: 1 1 auto; overflow-y: auto; }
}
.sb-side-user { display: flex; align-items: center; gap: 10px; margin: 8px 12px 14px; padding: 10px 12px; border-radius: 12px; background: var(--ds-gray-100); }
.sb-side-user .text { min-width: 0; }
.sb-side-user strong { display: block; font-size: 12.5px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-side-user small { display: block; font-size: 11px; color: var(--ds-gray-600); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.collapsed .sb-side-user { margin: 8px 6px; padding: 6px; justify-content: center; }
html.collapsed .sb-side-user .text, html.collapsed #miniSidebar .nav-icon + .text { display: none; }
html.collapsed #miniSidebar .site-logo-text { display: none; }
html.collapsed .sb-flyout-title { display: block !important; font-weight: 700; padding: 6px 20px; }

.sb-avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--ds-primary); color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .02em; box-shadow: 0 0 0 2px var(--ds-body-bg), 0 0 0 3.5px var(--sb-gold); }
.sb-side-user .sb-avatar { width: 32px; height: 32px; font-size: 12px; }

/* ---- Topbar ---- */
.navbar-glass { padding-top: .6rem; padding-bottom: .6rem; border-bottom: 1px dashed var(--ds-border-color); background: color-mix(in srgb, var(--ds-body-bg) 82%, transparent); }
.sb-page-title { font-size: 1.05rem; font-weight: 700; margin: 0 0 0 .25rem; min-width: 0; }
.btn-ghost { background: transparent; border: 0; color: var(--ds-gray-600); }
.btn-ghost:hover, .btn-ghost:focus-visible { background: var(--ds-gray-100); color: var(--ds-gray-800); }
.btn-icon { width: 38px; height: 38px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; }
.sb-date { align-items: center; gap: 6px; font-size: 12.5px; color: var(--ds-gray-600); background: var(--ds-gray-100); border-radius: 999px; padding: 6px 12px; white-space: nowrap; }
.sb-user-btn { display: inline-flex; align-items: center; gap: 10px; padding: 3px 8px 3px 4px; border-radius: 999px; }
.sb-user-text { flex-direction: column; text-align: left; line-height: 1.15; max-width: 190px; }
.sb-user-text strong { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ds-gray-800); }
.sb-user-text small { font-size: 11px; color: var(--ds-gray-600); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user-menu { min-width: 240px; }

.custom-container { min-height: calc(100vh - 20px); display: flex; flex-direction: column; }
.custom-container > .sb-legacy, .custom-container > .sb-native { flex: 1 0 auto; }
.sb-footer { text-align: center; font-size: 12px; color: var(--ds-gray-600); padding: 22px 0 6px; }
.sb-footer a { color: inherit; }
.sb-flash { border-radius: 12px; }
.sb-search-item { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--ds-gray-800); text-decoration: none; }
.sb-search-item:hover, .sb-search-item:focus-visible { background: var(--ds-primary-bg-subtle); color: var(--ds-primary-text-emphasis); }
.sb-search-item small { color: var(--ds-gray-600); font-size: 11.5px; white-space: nowrap; }

/* ---- Mobile: sidebar menjadi drawer ---- */
.sb-nav-overlay { display: none; }
@media (max-width: 991.98px) {
  html.sb-nav-open .sb-nav-overlay { display: block; position: fixed; inset: 0; background: rgba(12,43,40,.45); z-index: 1045; }
  html #miniSidebar, html.expanded #miniSidebar, html.collapsed #miniSidebar { display: none; }
  html.sb-nav-open #miniSidebar, html.expanded.sb-nav-open #miniSidebar, html.collapsed.sb-nav-open #miniSidebar { display: flex !important; background: var(--ds-body-bg); border-right: 1px solid var(--ds-border-color); flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; width: 280px; max-width: 86vw; height: 100%; z-index: 1050; box-shadow: 0 0 40px rgba(0,0,0,.3); overflow: hidden; }
  html.sb-nav-open #miniSidebar .navbar-nav { flex: 1 1 auto; overflow-y: auto; }
  #content, html.expanded #content, html.collapsed #content { margin-left: 0 !important; }
  .navbar-glass, html.expanded #content .navbar-glass, html.collapsed #content .navbar-glass { width: 100% !important; }
}

/* ---- Mode paparan (presentasi) dari dashboard eksekutif ---- */
body.mode-presentasi #miniSidebar, body.mode-presentasi .navbar-glass, body.mode-presentasi .sb-footer { display: none !important; }
body.mode-presentasi #content { margin-left: 0 !important; }
body.mode-presentasi .custom-container { padding-top: 16px !important; max-width: 1600px; margin: 0 auto; }

/* ================= Jembatan halaman lama (.sb-legacy) → gaya kartu Dasher ================= */
.sb-legacy { --radius: 16px; font-size: 14px; color: var(--text); }
.sb-legacy a { color: var(--ds-primary); text-decoration: none; }
.sb-legacy a:hover { text-decoration: underline; }
.sb-legacy .card, .sb-legacy .panel, .sb-legacy .stat-card, .sb-legacy .mini-kpi, .sb-legacy .kpi { border-color: transparent; box-shadow: var(--sb-shadow); }
.sb-legacy .card, .sb-legacy .panel { background: var(--card); color: var(--text); }
.sb-legacy .btn { border-radius: 10px; font-weight: 600; background: var(--navy); color: #fff; }
.sb-legacy .btn.btn-outline { background: transparent; color: var(--navy); border-color: var(--navy); }
.sb-legacy .btn.btn-outline:hover { background: var(--navy); color: #fff; }
.sb-legacy .btn.btn-gold { background: var(--gold); color: #1f1300; }
.sb-legacy .badge { border-radius: 999px; }
.sb-legacy .flash { border-radius: 12px; }
.sb-legacy input[type=text], .sb-legacy input[type=search], .sb-legacy input[type=password], .sb-legacy input[type=number], .sb-legacy input[type=date], .sb-legacy input[type=email], .sb-legacy select, .sb-legacy textarea { border-radius: 10px; }
.sb-legacy thead th { background: var(--gray-bg); }
.sb-legacy .table-wrap { border-radius: 12px; }

/* mode gelap: petakan variabel lama; warna tertanam diperbaiki per komponen */
[data-bs-theme="dark"] {
  --bg: #141a21; --card: #1c252e; --text: #e6edf3; --text-muted: #9fb0bd; --border: #2e3a46; --gray-bg: #232e39;
  --navy: #4db3a6; --navy-dark: #7fd0c4; --green-bg: rgba(34,197,94,.16); --green: #5fd68a; --yellow-bg: rgba(217,159,22,.18); --yellow: #f2c35a;
  --red-bg: rgba(239,68,68,.16); --red: #f58a8a; --blue-bg: rgba(77,179,166,.16); --amber-bg: rgba(217,119,6,.2); --purple-bg: rgba(124,58,237,.2);
}
[data-bs-theme="dark"] .sb-legacy input, [data-bs-theme="dark"] .sb-legacy select, [data-bs-theme="dark"] .sb-legacy textarea { background: #141a21; color: var(--text); border-color: var(--border); }
[data-bs-theme="dark"] .sb-legacy .btn.btn-outline { background: transparent; }

/* hero & gradien biru lama -> keluarga tosca SIBUDI (peran dibedakan lewat garis bawah) */
.sb-legacy .hero { background: linear-gradient(125deg, #022c29 0%, #004a43 55%, #007167 100%); border-radius: 16px; }
.sb-legacy .ig-hero { background: linear-gradient(125deg, #022c29 0%, #004a43 55%, #007167 100%); box-shadow: 0 14px 30px -10px rgba(0,85,78,.45); border-radius: 18px; }
/*role*/ .sb-legacy .ig-hero.role-camat { border-bottom: 3px solid var(--gold); }
.sb-legacy .ig-hero.role-kades { border-bottom: 3px solid #34d399; }
.sb-legacy .ig-hero.role-kasi  { border-bottom: 3px solid #f5c64c; }
.sb-legacy .ig-hero.role-admin { border-bottom: 3px solid #4db3a6; }

.sb-legacy :is(h1, h2, h3, h4, h5, h6) { color: inherit; }
.sb-legacy .ig-hero, .sb-legacy .ig-hero.role-camat, .sb-legacy .ig-hero.role-kades, .sb-legacy .ig-hero.role-kasi, .sb-legacy .ig-hero.role-admin { background: linear-gradient(125deg, #022c29 0%, #004a43 55%, #007167 100%); color: #fff; }
.sb-legacy .ig-hero.role-camat { border-bottom: 3px solid var(--gold); }
.sb-legacy .ig-hero.role-kades { border-bottom: 3px solid #34d399; }
.sb-legacy .ig-hero.role-kasi  { border-bottom: 3px solid #f5c64c; }
.sb-legacy .ig-hero.role-admin { border-bottom: 3px solid #4db3a6; }
/* label menu panjang: teks mengisi ruang, panah selalu di kanan */
html.expanded #miniSidebar .nav-link.dropdown-toggle { display: flex; align-items: center; gap: 4px; }
html.expanded #miniSidebar .nav-link.dropdown-toggle .text { flex: 1 1 auto; min-width: 0; white-space: normal; line-height: 1.25; }
html.expanded #miniSidebar .nav-link.dropdown-toggle::after { margin-left: auto; flex: none; position: static; transform: none; }

/* ================= Halaman login ================= */
.sb-login-body { background: var(--ds-body-bg); }
.sb-login { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
.sb-login-art { display: none; }
.sb-login-form { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.sb-login-box { width: 100%; max-width: 410px; }
@media (min-width: 992px) {
  .sb-login { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
  .sb-login-art { display: block; position: relative; color: #fff; background: #022c29 url('../../img/hero-mekepung.jpg') center / cover no-repeat; }
  .sb-login-art::before { content: ''; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(2,44,41,.94) 0%, rgba(3,59,55,.82) 52%, rgba(0,113,103,.7) 100%); }
  .sb-login-art-inner { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: space-between; padding: 44px 52px; max-width: 640px; }
  .sb-login-brand { display: flex; align-items: center; gap: 14px; font-weight: 800; letter-spacing: .06em; font-size: 13px; line-height: 1.3; }
  .sb-login-brand small { font-weight: 500; letter-spacing: .02em; opacity: .8; font-size: 12px; }
  .sb-login-art h1 { font-size: clamp(2.2rem, 3.6vw, 3.1rem); font-weight: 800; letter-spacing: -.01em; line-height: 1.05; color: #fff; margin: 0 0 14px; }
  .sb-login-art .lead { font-size: 1rem; line-height: 1.6; color: rgba(255,255,255,.82); max-width: 460px; margin-bottom: 28px; }
  .sb-login-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
  .sb-login-points li { display: flex; gap: 14px; align-items: center; }
  .sb-login-points .ik { width: 44px; height: 44px; padding: 9px; border-radius: 12px; background: rgba(255,255,255,.1); border: 1px solid rgba(245,198,76,.35); color: #fff; --ik-a: #f5c64c; }
  .sb-login-points strong { display: block; font-size: 14px; }
  .sb-login-points small { display: block; font-size: 12.5px; color: rgba(255,255,255,.7); }
  .sb-login-foot { opacity: .6; font-size: 11.5px; }
}

/* tint terang di CSS lama -> versi gelap */
[data-bs-theme="dark"] {
  --sb-tint-fbfcfd: #1a232c; --sb-tint-f8fafc: #1a232c; --sb-tint-fafbfc: #1a232c; --sb-tint-fffdf7: #2a2616; --sb-tint-fffbeb: #2a2616;
  --sb-tint-fffafa: #2b1c1d; --sb-tint-fff8f8: #2b1c1d; --sb-tint-fff5f5: #2b1c1d; --sb-tint-fef2f2: #2b1c1d; --sb-tint-fbf9ff: #231f30;
  --sb-tint-f8fbff: #172a30; --sb-tint-f7fef9: #14281f; --sb-tint-f1f5f9: #232e39; --sb-tint-eef2f6: #232e39; --sb-tint-f0fdf4: #14281f;
}
[data-bs-theme="dark"] .sb-legacy :is(strong, b, td, th, li, label) { color: inherit; }
[data-bs-theme="dark"] .sb-legacy { --sb-muted: var(--text-muted); }
[data-bs-theme="dark"] .navbar-glass { background: color-mix(in srgb, var(--ds-body-bg) 80%, transparent); }
/* SVG donut dari EksekutifData memakai fill inline gelap -> ikuti tema */
.sb-legacy .ig-donut text { fill: var(--text) !important; }
.sb-legacy .ig-donut text:nth-of-type(2) { fill: var(--text-muted) !important; }

/* ================= Komponen dashboard bergaya Dasher ================= */
.sb-greet { position: relative; display: flex; justify-content: space-between; gap: 24px; padding: 28px 32px; margin-bottom: 20px; border-radius: 20px; overflow: hidden; color: var(--ds-gray-900);
  background: linear-gradient(118deg, #e4f5f1 0%, #d3eee8 48%, #f8ecc4 130%); }
[data-bs-theme="dark"] .sb-greet { color: #e6edf3; background: linear-gradient(118deg, #0e2b28 0%, #123d38 55%, #3a3015 135%); }
.sb-greet-text { position: relative; z-index: 1; max-width: 640px; }
.sb-greet-where { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ds-primary); }
[data-bs-theme="dark"] .sb-greet-where { color: #6fd0c2; }
.sb-greet h2 { margin: 0 0 4px; font-size: clamp(1.4rem, 2.4vw, 1.9rem); font-weight: 800; letter-spacing: -.01em; color: inherit; }
.sb-greet-sub { margin: 0 0 18px; font-size: 13.5px; opacity: .75; }
.sb-greet-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sb-greet-actions .btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; font-size: 13px; }
.sb-greet-actions .btn-light { background: rgba(255,255,255,.72); color: var(--ds-gray-800); border: 1px solid rgba(0,85,78,.14); }
.sb-greet-actions .btn-light:hover { background: #fff; text-decoration: none; }
[data-bs-theme="dark"] .sb-greet-actions .btn-light { background: rgba(255,255,255,.08); color: #e6edf3; border-color: rgba(255,255,255,.16); }
.sb-greet-motif { position: absolute; right: -18px; bottom: -34px; width: 230px; height: 230px; color: var(--ds-primary); opacity: .13; pointer-events: none; }
.sb-greet-motif { --ik-a: var(--sb-gold); }
@media (max-width: 575.98px) { .sb-greet { padding: 22px 20px; } .sb-greet-motif { width: 150px; height: 150px; } }

.sb-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.sb-kpi { background: var(--card); border-radius: 16px; padding: 18px 20px; box-shadow: var(--sb-shadow); }
.sb-kpi-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sb-kpi-ico { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; border-radius: 50%; font-size: 21px; color: #fff; }
.sb-kpi-ico.tone-teal { background: #007167; } .sb-kpi-ico.tone-gray { background: #637381; } .sb-kpi-ico.tone-amber { background: #c98a0b; }
.sb-kpi-ico.tone-green { background: #1d8f4e; } .sb-kpi-ico.tone-red { background: #cc3a3a; } .sb-kpi-ico.tone-gold { background: #d99f16; color: #1f1300; }
.sb-kpi-lbl { font-size: 13px; font-weight: 600; color: var(--text-muted); line-height: 1.3; }
.sb-kpi-num { display: block; font-size: 1.85rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; color: var(--text); }

.sb-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-bottom: 20px; }
.sb-panel { background: var(--card); border-radius: 16px; padding: 20px 22px 12px; box-shadow: var(--sb-shadow); min-width: 0; }
.sb-panel header { margin-bottom: 8px; }
.sb-panel h3 { margin: 0; font-size: 1rem; font-weight: 700; color: var(--text); }
.sb-panel header p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-muted); }
.sb-chart { min-height: 290px; }
[data-bs-theme="dark"] #miniSidebar .site-logo-text strong { color: #6fd0c2; }

/* ================= Cetak ================= */
@media print {
  #miniSidebar, .navbar-glass, .sb-footer, .sb-nav-overlay, .sb-skip, .sb-greet-actions, .modal { display: none !important; }
  #content, html.expanded #content, html.collapsed #content { margin: 0 !important; }
  .custom-container { padding: 0 !important; min-height: 0 !important; display: block; }
  body { background: #fff !important; }
  .sb-legacy, .sb-native { color: #000; }
  .sb-panel, .sb-kpi, .sb-legacy .card, .sb-legacy .panel { box-shadow: none !important; border: 1px solid #ccc !important; break-inside: avoid; }
}
