:root {
  --ink: #13294b;
  --ink-2: #1f4e8c;
  --paper: #f2f5fa;
  --panel: #ffffff;
  --line: #d7dfeb;
  --muted: #5d6a80;
  --focus: #2f6fd6;
  --danger: #b3261e;
  --ok: #1b6b45;
}
* { box-sizing: border-box; }
html { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--paper); line-height: 1.5; }
body { margin: 0; min-height: 100vh; }
h1, h2 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.15rem; }
a { color: var(--ink-2); }
code { background: #e5eaf2; padding: .1rem .35rem; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); }

label { display: block; font-weight: 600; font-size: .9rem; margin: 1rem 0 .3rem; }
input, select { width: 100%; padding: .65rem .75rem; font: inherit; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: inherit; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.btn { display: inline-block; margin-top: 1.25rem; padding: .7rem 1.2rem; font: inherit; font-weight: 600; color: #fff; background: var(--ink); border: 0; border-radius: 6px; cursor: pointer; }
.btn:hover { background: var(--ink-2); }
.btn.small { margin: 0; padding: .4rem .75rem; font-size: .85rem; }
.btn.danger { background: var(--danger); }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--ink-2); text-decoration: underline; cursor: pointer; }

.alert { padding: .7rem .9rem; border-radius: 6px; margin: 0 0 1rem; border: 1px solid; font-size: .95rem; }
.alert.error { color: var(--danger); background: #fdecea; border-color: #f2b8b5; }
.alert.success { color: var(--ok); background: #e7f5ee; border-color: #a9d8c0; }

/* Login */
.login { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.login-side { background: var(--ink); color: #eaf1fd; display: flex; flex-direction: column; justify-content: flex-end; padding: 3rem; }
.login-side h1 { font-size: clamp(2rem, 4vw, 3.25rem); letter-spacing: -.02em; }
.login-side p { margin: 0; color: #b8c8e6; max-width: 28ch; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.login-form form { width: 100%; max-width: 360px; }
.login-form .btn { width: 100%; }
.pw { position: relative; }
.pw input { padding-right: 6.5rem; }
.pw .link { position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); font-size: .85rem; }

/* App */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .8rem 1.5rem; background: var(--ink); color: #fff; }
.topbar a, .topbar .link { color: #fff; }
.topbar .brand { font-weight: 700; text-decoration: none; }
.topbar nav { display: flex; align-items: center; gap: 1.25rem; }
form.inline { display: inline; margin: 0; }
.page { max-width: 980px; margin: 0 auto; padding: 2rem 1.25rem 3rem; }
.page.narrow { max-width: 460px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 1.25rem; margin-top: 1.25rem; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.grid .full { grid-column: 1 / -1; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.inline-row { display: flex; gap: .4rem; }
.inline-row input { min-width: 150px; padding: .4rem .6rem; }

@media (max-width: 760px) {
  .login { grid-template-columns: 1fr; min-height: 0; }
  .login-side { padding: 2rem 1.5rem; }
  .grid { grid-template-columns: 1fr; }
}

/* ===== Sidebar ===== */
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 1rem; }
.topbar .who { font-size: .9rem; color: #b8c8e6; }
.burger { display: none; background: none; border: 1px solid #4a6390; color: #fff; font-size: 1.1rem; line-height: 1; padding: .35rem .6rem; border-radius: 6px; cursor: pointer; }

.shell { display: flex; align-items: flex-start; min-height: calc(100vh - 56px); }
.sidebar { width: 264px; flex-shrink: 0; position: sticky; top: 0; align-self: flex-start; height: 100vh; max-height: 100vh; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: .75rem 0 2rem; }
.content { flex: 1; min-width: 0; }
.content .page { margin: 0; max-width: 980px; }

.side-top, .side-group > summary { display: block; padding: .65rem 1.25rem; font-weight: 600; color: var(--ink); text-decoration: none; cursor: pointer; }
.side-top:hover, .side-group > summary:hover { background: #edf2fb; }
.side-top.active { background: #e1eafa; box-shadow: inset 3px 0 0 var(--ink); }

.side-group > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; }
.side-group > summary::-webkit-details-marker { display: none; }
.side-group > summary::after { content: ""; width: .5rem; height: .5rem; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; margin-right: .2rem; }
.side-group[open] > summary::after { transform: rotate(-135deg); }
.side-group[open] > summary { color: var(--ink-2); }

.side-group ul { list-style: none; margin: 0 0 .4rem 1.45rem; padding: 0; border-left: 2px solid var(--line); }
.side-group li a { display: block; padding: .45rem 1rem .45rem 1rem; font-size: .92rem; color: var(--muted); text-decoration: none; }
.side-group li a:hover { color: var(--ink); background: #edf2fb; }
.side-group li a.active { color: var(--ink); font-weight: 600; background: #e1eafa; box-shadow: inset 3px 0 0 var(--ink); }
.crumb { margin: 0 0 .25rem; font-size: .9rem; }

.scrim { display: none; }

@media (max-width: 900px) {
  .burger { display: inline-block; }
  .sidebar { position: fixed; z-index: 30; top: 0; left: 0; bottom: 0; height: auto; max-height: none; transform: translateX(-100%); transition: transform .2s; box-shadow: 2px 0 12px rgba(0,0,0,.15); }
  .nav-open .sidebar { transform: none; }
  .nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.35); }
  .topbar .who { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .side-group > summary::after { transition: none; }
}

/* ===== Peran & akses ===== */
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; background: #e1eafa; font-size: .8rem; font-weight: 600; }
.badge.super { background: var(--ink); color: #fff; }
.cols { display: grid; grid-template-columns: 290px 1fr; gap: 1.25rem; align-items: start; margin-top: 1.25rem; }
.rolelist { list-style: none; margin: 0 0 .5rem; padding: 0; }
.rolelist li a { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .6rem .75rem; margin-bottom: .5rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); text-decoration: none; }
.rolelist li a:hover { background: #edf2fb; }
.rolelist li a.active { border-color: var(--ink); box-shadow: inset 3px 0 0 var(--ink); font-weight: 600; }
fieldset.grp { border: 1px solid var(--line); border-radius: 8px; margin: 1rem 0 0; padding: .5rem 1rem .75rem; }
fieldset.grp legend { font-weight: 700; padding: 0 .4rem; }
.check { display: flex; align-items: center; gap: .5rem; margin: .4rem 0; font-weight: 400; font-size: .95rem; cursor: pointer; }
.check input { width: auto; margin: 0; }
.check.all { font-weight: 600; color: var(--ink-2); padding-bottom: .4rem; border-bottom: 1px dashed var(--line); }
.inline-row select { width: auto; min-width: 120px; padding: .4rem .6rem; }
.btn-row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }

/* ===== Dashboard program ===== */
.page.wide { max-width: 1280px; }
.dash-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.dash-head h1 { margin-bottom: .25rem; }
.dash-head p { margin: 0; }
.dash-head .btn { margin-top: .5rem; }
.small-note { font-size: .85rem; margin: .5rem 0 0; }

.filters { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: flex-end; margin-top: 1.25rem; padding: 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.filters > div { min-width: 160px; }
.filters .grow { flex: 1 1 240px; }
.filters label { margin-top: 0; }
.filters .fbtn { display: flex; align-items: center; gap: .9rem; min-width: 0; padding-bottom: .2rem; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.kpi { display: flex; flex-direction: column; gap: .2rem; padding: 1rem 1.1rem; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; color: var(--ink); text-decoration: none; }
.kpi-l { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.kpi strong { font-size: 1.9rem; line-height: 1.15; letter-spacing: -.01em; }
.kpi-s { font-size: .85rem; color: var(--muted); }
.kpi-s b { color: var(--ink); }
.kpi.main { background: var(--ink); border-color: var(--ink); color: #fff; }
.kpi.main .kpi-l, .kpi.main .kpi-s { color: #b8c8e6; }
.kpi.main .kpi-s b { color: #fff; }
.kpi.main .bar { background: #2d4a78; }
.kpi.main .bar > span { background: #8ec0ff; }
.kpi.action { border-style: dashed; border-color: #c9a227; background: #fffaf0; }
.kpi.action:hover { background: #fdf1d6; }
.kpi.action strong { color: #8a5a00; }

.bar { height: 8px; margin-top: .5rem; background: #e2e8f1; border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--ink-2); border-radius: 4px; }
.bar.sm { height: 5px; margin-top: .25rem; min-width: 70px; }

table.num th, table.num td { text-align: right; }
table.num th:first-child, table.num td:first-child, table.num td.txt, table.num th.txt { text-align: left; }
table.num td.c { text-align: center; }
table.num tfoot td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 0; }
table.list td.txt { white-space: normal; min-width: 120px; }
table.num th { font-size: .8rem; color: var(--muted); font-weight: 600; }
.panel h3 { margin: 1.5rem 0 .5rem; font-size: 1rem; }

.list-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.list-head h2 { margin: 0; }
.list-head .btn { margin: 0; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: #edf2fb; }

.st { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.st-ok { background: #e7f5ee; color: var(--ok); }
.st-bad { background: #fdecea; color: var(--danger); }
.st-warn { background: #fdf1d6; color: #8a5a00; }
.st-muted { background: #e8ecf3; color: var(--muted); }

.steps { margin: .75rem 0 1rem; padding-left: 1.25rem; }
.steps li { margin-bottom: .35rem; }
form.upload { max-width: 640px; }
form.upload input[type=file] { padding: .5rem; }
.check.sub { margin-left: 1.6rem; }
.check span { line-height: 1.4; }

/* Program Region: kotak program */
.prog-boxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; margin-top: 1.25rem; }
.prog-box { display: flex; flex-direction: column; gap: .15rem; padding: .8rem .9rem; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; color: var(--ink); text-decoration: none; min-width: 0; }
.prog-box:hover { border-color: var(--ink-2); background: #f6f9fe; }
.prog-box.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.prog-box .pb-t { font-size: .85rem; font-weight: 600; line-height: 1.3; }
.prog-box strong { font-size: 1.35rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.prog-box .pb-s, .prog-box .pb-d { font-size: .78rem; color: var(--muted); }
.prog-box.on .pb-s, .prog-box.on .pb-d { color: #b8c8e6; }
.pb-d { font-size: .78rem; }
.prog-head { margin-top: 1.5rem; }
.prog-head h2 { font-size: 1.5rem; margin: 0 0 .2rem; }
.prog-head p { margin: 0; }
table.num tr.sel td { font-weight: 700; background: #edf2fb; }
