/* =========================================================
   IBPR Check — branding PPA, navigasi, dashboard, grid departemen
   ========================================================= */
:root { --series: #4b5563; --k3: #008000; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --series: #a1a8b3; --k3: #2fb344; } }
:root[data-theme="dark"] { --series: #a1a8b3; --k3: #2fb344; }

/* ---------- Brand ---------- */
.brand { min-width: 0; }
.brand__logos { display: inline-flex; align-items: center; gap: 4px; background: #fff; border-radius: 12px; padding: 4px 6px; flex: none; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.brand__logos img { width: 30px; height: 30px; object-fit: contain; display: block; }
.brand__text { min-width: 0; }
.brand__text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__inner { gap: 12px; }
.topbar { border-bottom: 2px solid var(--accent); }

/* ---------- Main navigation ---------- */
.mainnav { display: flex; gap: 4px; margin-left: auto; }
.mainnav__link { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 10px; color: rgba(255,255,255,.72); text-decoration: none; font-weight: 700; font-size: 14px; transition: background .15s, color .15s; white-space: nowrap; }
.mainnav__link svg { font-size: 17px; }
.mainnav__link:hover { color: #fff; background: rgba(255,255,255,.08); }
.mainnav__link.is-on { color: #fff; background: var(--accent); box-shadow: 0 4px 14px rgba(227,6,19,.35); }
.topbar__actions { margin-left: 8px; }

@media (max-width: 859px) {
  /* backdrop-filter membuat topbar jadi containing block untuk elemen fixed → matikan agar tab bar menempel di layar */
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--brand); }
  .mainnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; margin: 0; gap: 0; background: var(--surface); border-top: 1px solid var(--line);
    box-shadow: 0 -6px 20px rgba(0,0,0,.08); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
  .mainnav__link { flex: 1; flex-direction: column; gap: 2px; height: 52px; justify-content: center; font-size: 11.5px; color: var(--muted); border-radius: 12px; }
  .mainnav__link svg { font-size: 21px; }
  .mainnav__link:hover { background: var(--surface-2); color: var(--text); }
  .mainnav__link.is-on { background: transparent; box-shadow: none; color: var(--accent); }
  .mainnav__link.is-on svg { filter: drop-shadow(0 2px 6px rgba(227,6,19,.35)); }
  .topbar__actions { margin-left: auto; }
  body.has-tabbar { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  body.has-tabbar .to-top { bottom: calc(80px + env(safe-area-inset-bottom)); }
  body.has-tabbar .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
}

/* ---------- Footer ---------- */
.footer__inner { display: grid; gap: 12px; }
@media (min-width: 760px) { .footer__inner { grid-template-columns: auto 1fr; align-items: center; gap: 24px; } }
.footer__brand { display: flex; align-items: center; gap: 8px; }
.footer__brand img { width: 34px; height: 34px; object-fit: contain; }
.footer__brand b { display: block; color: var(--text); font-size: 13px; }
.footer__brand small { font-size: 12px; }
.footer p { font-size: 12.5px; }

/* ---------- Check IBPR: departemen ---------- */
.dept-badge { display: inline-block; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .04em; padding: 2px 8px; border-radius: 6px; margin-right: 8px; vertical-align: 1px; }
.dcard { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: grid; gap: 12px; transition: border-color .15s, transform .15s, box-shadow .15s; }
.dcard:hover { border-color: var(--accent); transform: translateY(-2px); }
.dcard__head { display: flex; align-items: center; justify-content: space-between; }
.dcard__code { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.dcard__go { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent); font-size: 16px; }
.dcard__nums { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.dcard__nums b { color: var(--text); font-size: 15px; margin-right: 3px; }
.dcard .bar { height: 10px; }
.dcard__secs { display: flex; flex-wrap: wrap; gap: 5px; }
.dcard__secs i { font-style: normal; font-size: 11.5px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); padding: 2px 8px; border-radius: 6px; }

/* ---------- Dashboard ---------- */
.hero--dash { padding-bottom: 28px; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 22px; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1040px) { .kpis { grid-template-columns: repeat(5, 1fr); } }
.kpi { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: 16px; padding: 14px 16px; display: grid; gap: 2px; min-height: 104px; align-content: start; }
.kpi__label { font-size: 12px; font-weight: 600; color: rgba(255,255,255,.65); }
.kpi__val { font-size: 30px; font-weight: 800; line-height: 1.15; }
.kpi__val small { font-size: 16px; color: rgba(255,255,255,.55); font-weight: 700; }
.kpi__sub { font-size: 12px; color: rgba(255,255,255,.6); }
.kpis > .kpi:first-child { background: linear-gradient(135deg, rgba(227,6,19,.35), rgba(227,6,19,.12)); border-color: rgba(255,90,79,.35); }

.dash { padding-top: 24px; padding-bottom: 32px; }
.dash__grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .dash__grid { grid-template-columns: 1fr 1fr; } .chart--wide { grid-column: 1 / -1; } }
.chart__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.chart__head h2 { font-size: 16px; font-weight: 800; }
.chart__head p { font-size: 12.5px; margin-top: 2px; }
.card.chart--wide { padding: 20px; }

.hbars { display: grid; gap: 8px; }
.hbar { display: grid; grid-template-columns: 88px 1fr; align-items: center; gap: 10px; min-height: 26px; cursor: default; }
.hbar--wide-lbl { grid-template-columns: minmax(96px, 150px) 1fr; }
.hbar__lbl { font-size: 12.5px; font-weight: 700; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar__lbl small { display: block; font-size: 10.5px; font-weight: 600; color: var(--muted); }
.hbar__track { display: flex; align-items: center; gap: 8px; min-width: 0; border-left: 1px solid var(--line); padding: 3px 0; }
.hbar__fill { display: block; height: 18px; background: var(--series); border-radius: 0 4px 4px 0; transform-origin: left; transform: scaleX(0); transition: transform .7s cubic-bezier(.2,.8,.2,1); }
.hbar__val { font-size: 12.5px; font-weight: 700; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.hbar:hover .hbar__fill { filter: brightness(1.15); }
.hbar.is-empty .hbar__none { font-size: 12px; color: var(--muted); font-style: italic; border-left: 1px solid var(--line); padding-left: 10px; }
.is-drawn .hbar__fill, .is-drawn .stack { transform: scaleX(1); }

.stack { flex: 1; display: flex; gap: 2px; height: 18px; min-width: 0; transform-origin: left; transform: scaleX(0); transition: transform .7s cubic-bezier(.2,.8,.2,1); }
.stack .seg { min-width: 3px; height: 100%; }
.stack .seg:last-child { border-radius: 0 4px 4px 0; }
.stack .seg:hover { filter: brightness(1.12); }
.seg.crit, .sw.crit { background: var(--crit); } .seg.high, .sw.high { background: var(--high); }
.seg.mid, .sw.mid { background: var(--mid); } .seg.low, .sw.low { background: var(--low); }
.hbars--stack .hbar__track { gap: 10px; }
.hbars--stack .hbar__val { min-width: 58px; text-align: right; color: var(--text-2); font-weight: 600; }
.hbars--big .hbar { grid-template-columns: 78px 1fr; }
.hbars--big .stack { height: 24px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart .legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend--row { margin-top: 12px; display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.effect { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.effect > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.effect b { display: block; font-size: 24px; font-weight: 800; }
.effect span { font-size: 12px; color: var(--muted); }

.tip { position: fixed; z-index: 90; pointer-events: none; background: var(--brand); color: #fff; font-size: 12.5px; line-height: 1.45; padding: 8px 11px; border-radius: 9px; box-shadow: var(--shadow-lg); max-width: 240px; }
.tip[hidden] { display: none; }

.table--dash { min-width: 860px; font-size: 13.5px; }
.table--dash th, .table--dash td { padding: 10px; }
.table--dash .num { text-align: right; font-variant-numeric: tabular-nums; }
.table--dash th.num { white-space: nowrap; }
.table--dash tr.total td { border-top: 2px solid var(--line); border-bottom: 0; font-weight: 800; }
.table--dash tr.is-off td { opacity: .6; }
@media (max-width: 700px) {
  .table--dash, .table--dash tbody, .table--dash tr, .table--dash td { display: revert; width: auto; }
  .table--dash thead { display: table-header-group; }
  .table--dash tr { border: 0; padding: 0; margin: 0; background: none; }
  .table--dash td { display: table-cell; }
}
.btn--sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; text-decoration: none; }
.btn--sm svg { font-size: 15px; }

/* ---------- Admin: grid departemen ---------- */
.info-note { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; color: var(--text-2); }
.info-note svg { font-size: 20px; color: var(--accent); margin-top: 1px; }
.dept-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .dept-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .dept-grid { grid-template-columns: repeat(3, 1fr); } }
.dept { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--low); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dept.is-empty { border-top-color: var(--line); background: var(--surface-2); box-shadow: none; border-style: dashed; border-top-style: solid; }
.dept__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dept__code { font-size: 19px; font-weight: 800; }
.dept__nums { display: flex; gap: 18px; }
.dept__nums span { font-size: 12px; color: var(--muted); }
.dept__nums b { display: block; font-size: 22px; color: var(--text); font-weight: 800; line-height: 1.1; }
.dept__meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--text-2); }
.dept__file { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); min-width: 0; }
.dept__file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dept__by { font-size: 11.5px; color: var(--muted); }
.dept__empty { font-size: 13px; color: var(--muted); flex: 1; }
.dept__act { display: flex; gap: 6px; align-items: center; margin-top: auto; padding-top: 8px; }
.dept__act .btn { margin-right: auto; }
.linkbtn { border: 0; background: none; color: inherit; text-decoration: underline; font-weight: 800; padding: 0; margin-left: 4px; }

/* ---------- Login ---------- */
.auth__logos { display: inline-flex; gap: 10px; background: #fff; border-radius: 18px; padding: 10px 14px; margin-bottom: 18px; box-shadow: 0 8px 30px rgba(0,0,0,.3); }
.auth__logos img { width: 56px; height: 56px; object-fit: contain; }
.auth__back { display: inline-flex; align-items: center; gap: 8px; margin-top: 20px; color: #fff; text-decoration: none; font-weight: 700; font-size: 14px; padding: 9px 14px; border-radius: 10px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.06); }
.auth__back:hover { background: rgba(255,255,255,.12); }
.auth__back svg { font-size: 16px; }
.auth__foot a { color: var(--accent); font-weight: 700; }

/* =========================================================
   Section (sub-departemen)
   ========================================================= */
/* status chip tambahan */
.status.part { color: var(--mid); } .status.part::before { background: var(--mid); }

/* --- Admin: kartu departemen yang bisa diklik --- */
.dept--btn { text-align: left; font: inherit; color: inherit; cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; }
.dept--btn:hover { border-color: var(--accent); transform: translateY(-2px); }
.dept--btn.is-empty:hover { border-color: var(--accent); }
.dept.is-sections { border-top-color: #2563eb; }
.dept__go { margin-top: auto; padding-top: 8px; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; color: var(--accent); }
.dept__go svg { font-size: 15px; }
.sec-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.sec-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.sec-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.sec-chip.has-file { color: var(--text-2); }
.sec-chip.has-file::before { background: var(--low); }

/* --- Admin: detail departemen --- */
.dd-head { display: flex; align-items: center; gap: 14px 18px; flex-wrap: wrap; margin-bottom: 16px; }
.dd-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dd-title h2 { font-size: 26px; font-weight: 800; }
.dd-head .dept__nums { margin-left: auto; }
.opt-grid { display: grid; gap: 14px; }
@media (min-width: 700px) { .opt-grid { grid-template-columns: 1fr 1fr; } }
.opt { text-align: left; display: grid; gap: 6px; padding: 22px; border-radius: 18px; border: 2px dashed var(--line); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; font: inherit; color: inherit; }
.opt:hover { border-color: var(--accent); border-style: solid; background: rgba(227,6,19,.03); }
.opt__ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 22px; margin-bottom: 6px; }
.opt b { font-size: 17px; }
.opt small { color: var(--muted); font-size: 13.5px; }
.dd-file { display: grid; gap: 10px; }
.dd-file__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.dd-file__head h3, .h3 { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; }
.dd-file__head h3 svg { color: var(--accent); font-size: 18px; }
.info-note--soft { margin-top: 14px; border-left-color: #2563eb; }
.info-note--soft svg { color: #2563eb; }
.fmeta { display: grid; gap: 4px; }
.fmeta__nums { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--text-2); }
.fmeta__nums b { color: var(--text); }
.sec-list { display: grid; gap: 10px; }
.sec-row { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-left: 4px solid var(--low); border-radius: 14px; background: var(--surface-2); }
.sec-row.is-empty { border-left-color: var(--line); }
@media (min-width: 760px) { .sec-row { grid-template-columns: 1fr auto; align-items: center; } }
.sec-row__main { min-width: 0; display: grid; gap: 6px; }
.sec-row__name { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sec-row__name b { font-size: 16px; }
.sec-row__act { display: flex; gap: 6px; align-items: center; }
@media (max-width: 759px) { .sec-row__act .btn { margin-right: auto; } }

/* modal section: pilihan radio */
.choice { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.choice[hidden] { display: none; }
.radio { position: relative; cursor: pointer; }
.radio input { position: absolute; opacity: 0; }
.radio span { display: block; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px 10px 38px; background: var(--surface-2); position: relative; }
.radio span::before { content: ""; position: absolute; left: 12px; top: 13px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); }
.radio input:checked + span { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.radio input:checked + span::before { border-color: var(--accent); background: radial-gradient(var(--accent) 45%, transparent 50%); }
.radio input:focus-visible + span { outline: 3px solid var(--focus); }
.radio b { display: block; font-size: 14px; }
.radio small { color: var(--muted); font-size: 12px; }
.drop--sm { padding: 14px; }
.drop--sm svg { font-size: 22px; }

/* --- Check IBPR: chip section --- */
.chips--sub { margin-top: 10px; align-items: center; }
.chips--sub[hidden] { display: none; }
.chips__lbl { flex: none; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: rgba(255,255,255,.55); margin-right: 2px; }
.chip--sm { padding: 5px 12px; font-size: 12.5px; }
.dept-badge--sect { background: #2563eb; }

/* --- Dashboard: baris yang bisa diklik & modal rincian --- */
.dash__hint { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); margin-bottom: 14px; }
.dash__hint svg { font-size: 18px; color: var(--accent); }
.hbar[data-dept] { cursor: pointer; border-radius: 8px; margin: 0 -6px; padding: 0 6px; transition: background .15s; }
.hbar[data-dept]:hover, .hbar[data-dept]:focus-visible { background: var(--surface-2); }
.hbar[data-dept]:hover .hbar__lbl { color: var(--accent); }
.table--dash tr.is-link { cursor: pointer; }
.table--dash tr.is-link:hover td { background: var(--surface-2); }
.table--dash tr.is-link:hover .btn { border-color: var(--accent); color: var(--accent); }
.modal__dialog--wide { max-width: 1040px; }
@media (max-width: 640px) {
  .modal:has(.modal__dialog--wide) { padding: 0; place-items: stretch; }
  .modal__dialog--wide { max-height: 100vh; height: 100%; border-radius: 0; padding: 18px 16px 28px; }
}
#deptModalBody { margin-top: 14px; display: grid; gap: 16px; }
.mkpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 760px) { .mkpis { grid-template-columns: repeat(4, 1fr); } }
.mkpi { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 2px; }
.mkpi span { font-size: 12px; font-weight: 600; color: var(--muted); }
.mkpi b { font-size: 24px; font-weight: 800; line-height: 1.15; }
.mkpi b small { font-size: 14px; color: var(--muted); }
.mkpi small { font-size: 12px; color: var(--muted); }
.mgrid { display: grid; gap: 16px; }
@media (min-width: 820px) { .mgrid { grid-template-columns: 1fr 1fr; } .mchart--wide { grid-column: 1 / -1; } }
.mchart { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; min-width: 0; }
.mchart h3 { font-size: 14.5px; font-weight: 800; margin-bottom: 12px; }
.mchart__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.mchart__head h3 { margin: 0; }
.mchart .legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.hbars--sec .hbar { grid-template-columns: minmax(80px, 130px) 1fr; }
.table--mini { min-width: 780px; }
.mchart .muted.small { margin-top: 8px; }

/* =========================================================
   Role PIC Departemen & kelola departemen
   ========================================================= */
.role--pic { background: rgba(37,99,235,.12); color: #2563eb; }
:root[data-theme="dark"] .role--pic { color: #7aa7ff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .role--pic { color: #7aa7ff; } }
.dept__name { font-size: 12.5px; color: var(--muted); margin-top: -4px; }
.dd-title .muted { font-size: 14px; }
.ibtn:disabled { opacity: .35; cursor: default; pointer-events: none; }
#deptTable td:first-child { width: 96px; }
.tabs[hidden] { display: none; }
