:root {
  --navy: #0b2a6b; --navy2: #0f3d99; --blue: #1d4fb8; --gold: #d4a72c; --gold2: #f3d27a;
  --bg: #eef3fb; --card: #fff; --txt: #16315f; --mut: #6b7a99; --line: #dfe6f3;
  --green: #1f9d63; --red: #d64545; --side: 248px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'Poppins', system-ui, sans-serif; font-size: 13px; color: var(--txt); background: var(--bg); }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }

/* Sidebar */
.side { position: fixed; inset: 0 auto 0 0; width: var(--side); background: linear-gradient(180deg, #0b2a6b, #0f3d99 60%, #0a2c78); color: #fff; z-index: 30; display: flex; flex-direction: column; overflow: hidden; }
.brand { text-align: center; padding: 22px 14px 16px; border-bottom: 1px solid rgba(212, 167, 44, .5); }
.brand i { font-size: 40px; color: var(--gold2); display: block; }
.brand h1 { font-size: 19px; font-weight: 700; line-height: 1.25; margin-top: 6px; }
#nav { padding: 14px 8px; position: relative; z-index: 2; }
.nav-i { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 9px; margin-bottom: 4px; font-weight: 500; cursor: pointer; }
.nav-i i:first-child { font-size: 17px; width: 20px; }
.nav-i span { flex: 1; }
.nav-i:hover { background: rgba(255, 255, 255, .1); }
.nav-i.on { background: linear-gradient(90deg, #f3d27a, #d4a72c); color: #14285a; font-weight: 600; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
.nav-i.on-g { background: rgba(255, 255, 255, .12); }
.chev { font-size: 11px; transition: transform .2s; }
.nav-g.open .chev { transform: rotate(180deg); }
.sub { display: none; margin: 0 0 6px 34px; }
.nav-g.open .sub { display: block; }
.sub a { display: block; padding: 7px 12px; border-radius: 7px; opacity: .85; }
.sub a:hover { background: rgba(255, 255, 255, .1); opacity: 1; }
.sub a.on { color: var(--gold2); font-weight: 600; opacity: 1; }
.side-art { flex: 1; min-height: 120px; background:
  radial-gradient(circle at 20% 110%, rgba(243, 210, 122, .55) 0 38%, transparent 39%),
  radial-gradient(circle at 80% 120%, rgba(243, 210, 122, .35) 0 30%, transparent 31%); opacity: .6; }

/* Top + main */
.main { margin-left: var(--side); min-height: 100vh; }
.top { display: flex; align-items: center; gap: 12px; background: #fff; padding: 10px 26px; border-bottom: 3px solid var(--gold); position: sticky; top: 0; z-index: 20; }
.logo { font-size: 34px; color: var(--gold); }
.top-t b { font-size: 17px; font-weight: 700; }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.bell { position: relative; background: none; border: 0; font-size: 22px; color: var(--navy); cursor: pointer; }
.bell span { position: absolute; top: -4px; right: -8px; background: var(--red); color: #fff; font: 600 10px/1 'Poppins'; border-radius: 9px; padding: 3px 5px; }
.user { display: flex; align-items: center; gap: 10px; border-left: 1px solid var(--line); padding-left: 18px; }
.user > i { font-size: 34px; color: var(--blue); }
.user b { display: block; font-size: 13px; } .user small { color: var(--mut); }
.menu-btn { display: none; background: none; border: 0; font-size: 26px; color: var(--navy); cursor: pointer; }
.view { padding: 20px 26px 40px; }

/* Page head */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.ph-title { display: flex; align-items: center; gap: 14px; }
.big-ico { font-size: 46px; color: var(--gold); line-height: 1; }
.ph-title h1 { font-size: 27px; font-weight: 700; line-height: 1.15; }
.ph-title p { color: var(--mut); font-size: 14px; }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.filters label, .fgrid label, .modal-b > label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 12px; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--txt); border: 1px solid #c9d4ea; border-radius: 8px; padding: 8px 11px; background: #fff; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(29, 79, 184, .35); border-color: var(--blue); }
.filters select { min-width: 160px; }
.search { position: relative; } .search i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--mut); }
.search input { padding-left: 32px; width: 210px; }

/* Buttons */
.btn { font: 600 12.5px 'Poppins'; border: 1px solid #c9d4ea; background: #fff; color: var(--txt); border-radius: 8px; padding: 9px 14px; cursor: pointer; display: inline-flex; gap: 7px; align-items: center; }
.btn:hover { background: #f1f5fd; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; } .btn.primary:hover { background: #163f94; }
.btn.gold { background: linear-gradient(90deg, #f3d27a, #d4a72c); border-color: var(--gold); color: #14285a; }
.btn.danger-o { color: var(--red); border-color: #efb4b4; } .btn.danger-o:hover { background: #fdf0f0; }
.btn.ghost { border-color: transparent; }
.ib { border: 0; background: #eef3fb; color: var(--blue); width: 30px; height: 30px; border-radius: 7px; cursor: pointer; margin: 0 2px; }
.ib.del { color: var(--red); background: #fdf0f0; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 16px; }
.kpis.k3 { grid-template-columns: repeat(3, 1fr); }
.kpi { background: var(--card); border-radius: 12px; padding: 16px; display: flex; gap: 14px; align-items: center; box-shadow: 0 2px 8px rgba(15, 40, 100, .08); position: relative; overflow: hidden; border: 1px solid var(--line); }
.kpi::after { content: ''; position: absolute; right: 0; bottom: 0; border-style: solid; border-width: 0 0 28px 28px; border-color: transparent transparent var(--gold) transparent; opacity: .85; }
.kpi .ico { width: 58px; height: 58px; flex: none; border-radius: 50%; background: #f8e6b0; color: #b8860b; display: grid; place-items: center; font-size: 26px; }
.kpi.warn .ico { background: #fde2e2; color: var(--red); }
.kpi span { display: block; font-weight: 600; font-size: 14px; }
.kpi b { font-size: 34px; line-height: 1.1; font-weight: 700; display: block; }
.kpi b.sm { font-size: 17px; margin-top: 4px; }
.kpi small { color: var(--mut); font-size: 12.5px; }
.green { color: var(--green); } .red { color: var(--red); } .up { color: var(--green); font-weight: 600; } .down { color: var(--red); font-weight: 600; }

/* Panels */
.panel { background: var(--card); border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(15, 40, 100, .06); margin-bottom: 16px; overflow: hidden; }
.panel > h2 { background: linear-gradient(90deg, #0f3d99, #1d4fb8); color: #fff; font-size: 15px; font-weight: 600; padding: 10px 16px; display: flex; align-items: center; gap: 9px; }
.panel > h2 span { font-weight: 400; font-size: 12.5px; opacity: .9; } .panel > h2 .right { margin-left: auto; }
.panel.warnp > h2 { background: linear-gradient(90deg, #8a6a12, #d4a72c); }
form.panel { padding: 16px; overflow: visible; }
.grid3 { display: grid; grid-template-columns: 1.25fr 1fr 1.1fr; gap: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-main { display: grid; grid-template-columns: 1.7fr 1fr; gap: 14px; align-items: start; }
.grid-main.k { grid-template-columns: 2.2fr 1fr; }
.stack > .panel:last-child { margin-bottom: 16px; }
.chart-box { height: 230px; padding: 12px; position: relative; }
.donut-wrap { display: flex; align-items: center; justify-content: space-around; padding: 14px 10px; gap: 8px; min-height: 230px; }
.donut { position: relative; width: 190px; height: 190px; flex: none; }
.donut-c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.donut-c b { font-size: 32px; line-height: 1; } .donut-c span { font-weight: 600; }
.legend > div { margin: 10px 0; display: grid; grid-template-columns: 14px auto; gap: 2px 8px; align-items: center; }
.legend i { width: 14px; height: 14px; border-radius: 3px; } .legend small { grid-column: 2; color: var(--mut); }
.legend b { font-size: 15px; }

/* Tables */
.tbl-wrap { overflow: auto; } .tbl-wrap.tall { max-height: 440px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { background: #f3f6fc; color: var(--navy); text-align: left; padding: 8px 9px; position: sticky; top: 0; z-index: 1; border-bottom: 2px solid var(--gold); font-weight: 600; white-space: nowrap; }
.tbl td { padding: 7px 9px; border-bottom: 1px solid var(--line); }
.tbl tbody tr:hover { background: #f8faff; }
.tbl .c, .tbl th.c { text-align: center; }
.tbl.small { font-size: 12px; }
.tbl td input, .tbl td select { padding: 5px 7px; width: 100%; font-size: 12px; }
.tbl td input:disabled, .tbl td select:disabled { background: #f1f3f8; opacity: .6; }
.tbl tr.click { cursor: pointer; } .tbl tr.sel { background: #fff7de !important; }
.act { white-space: nowrap; }
.pct { padding: 2px 7px; border-radius: 6px; font-weight: 600; font-size: 12px; }
.pct.hi { background: #e3f6ec; color: #17794d; } .pct.mid { background: #fff4d6; color: #8a6a12; } .pct.lo { background: #fde2e2; color: #b42f2f; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 6px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.st-up { background: #e3f6ec; color: #17794d; } .st-ok { background: #e3edfd; color: #1d4fb8; } .st-bad { background: #fde2e2; color: #b42f2f; } .st-na { background: #eceff5; color: #6b7a99; } .st-done { background: #fff1c9; color: #8a6a12; }
.tag { padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; } .tag.on { background: #e3f6ec; color: #17794d; } .tag.off { background: #eee; color: #777; }
.more { display: block; text-align: right; padding: 8px 14px; color: var(--blue); font-weight: 500; }
.summ { list-style: none; margin: 0; padding: 4px 14px 8px; }
.summ li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.summ li:last-child { border: 0; } .summ li i { font-size: 20px; color: var(--gold); width: 24px; } .summ li.w i { color: var(--red); }
.summ li span { flex: 1; } .summ li b { font-size: 14px; }
.muted { color: var(--mut); } .pad { padding: 16px; }
.empty { text-align: center; padding: 50px 20px; color: var(--mut); } .empty i { font-size: 44px; color: #b9c6e2; display: block; margin-bottom: 8px; }

/* Forms / modal */
.fgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.fgrid .span2 { grid-column: span 2; } .fgrid .end { display: flex; align-items: flex-end; }
.modal-bg { position: fixed; inset: 0; background: rgba(8, 20, 50, .55); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: 440px; max-width: 100%; max-height: 92vh; overflow: auto; box-shadow: 0 10px 40px rgba(0, 0, 0, .35); }
.modal.wide { width: 700px; }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; background: linear-gradient(90deg, #0f3d99, #1d4fb8); color: #fff; border-radius: 14px 14px 0 0; }
.modal-h h3 { font-size: 16px; } .modal-h .x { background: none; border: 0; color: #fff; font-size: 24px; cursor: pointer; }
.modal-b { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #17794d; color: #fff; padding: 10px 16px; border-radius: 9px; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); transition: opacity .4s; } .toast.err { background: var(--red); } .toast.hide { opacity: 0; }

/* Tetapan */
.set-info { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; padding: 16px; }
.set-info div { background: #f3f6fc; border-radius: 10px; padding: 12px; } .set-info span { display: block; color: var(--mut); font-size: 12px; } .set-info b { font-size: 16px; }
.set-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 16px; }
.set-btns p { color: var(--mut); margin-top: 8px; line-height: 1.5; } code { background: #eef3fb; padding: 1px 5px; border-radius: 4px; }

/* Laporan */
.print-area { padding: 22px 26px; }
.print-head { display: flex; align-items: center; gap: 12px; justify-content: center; border-bottom: 3px double var(--gold); padding-bottom: 10px; }
.print-head i { font-size: 40px; color: var(--gold); } .print-head h2 { font-size: 20px; } .print-head p { color: var(--mut); }
.rp-title { text-align: center; margin-top: 14px; font-size: 17px; } .rp-sub { text-align: center; color: var(--mut); margin-bottom: 12px; }
.rp-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 12px 0; }
.rp-stats div { border: 1px solid var(--line); border-radius: 8px; text-align: center; padding: 8px 4px; } .rp-stats b { display: block; font-size: 18px; } .rp-stats span { font-size: 11px; color: var(--mut); }
.rp-ulasan { margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.sign { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; margin-top: 40px; text-align: center; }
.sign .line { border-bottom: 1px solid #000; height: 50px; margin: 0 20px 6px; } .sign small { display: block; color: var(--mut); }
.rp-date { margin-top: 18px; }
.print-area .tbl th { position: static; }

/* Responsif */
@media (max-width: 1200px) { .kpis { grid-template-columns: repeat(3, 1fr); } .grid3 { grid-template-columns: 1fr 1fr; } .grid-main, .grid-main.k { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .side { transform: translateX(-100%); transition: transform .25s; } .side.show { transform: none; }
  .main { margin-left: 0; } .menu-btn { display: block; }
  .kpis, .kpis.k3, .grid3, .grid2, .set-info, .set-btns, .fgrid { grid-template-columns: 1fr; } .fgrid .span2 { grid-column: auto; }
  .view { padding: 14px; } .top { padding: 10px 14px; } .top-t b { font-size: 13px; } .user div { display: none; }
  .rp-stats { grid-template-columns: repeat(3, 1fr); }
}

/* Cetak */
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; font-size: 11px; }
  .no-print, .side, .top, #toasts { display: none !important; }
  .main { margin: 0; } .view { padding: 0; }
  .panel { box-shadow: none; border: 0; }
  .print-area { padding: 0; }
  .tbl th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tbl tr { page-break-inside: avoid; }
  .sign { page-break-inside: avoid; }
}

.set-btns.two { grid-template-columns: repeat(2, 1fr); }
.errbox { background: #fdf0f0; color: #b42f2f; padding: 10px; border-radius: 8px; white-space: pre-wrap; font: 12px/1.5 monospace; max-height: 260px; overflow: auto; margin: 0; }
@media (max-width: 860px) { .set-btns.two { grid-template-columns: 1fr; } }
.auth { display:none; }
.locked > :is(.side,.main,#toasts) { display:none!important; }
.locked .auth { min-height:100dvh; display:grid; place-items:center; padding:24px; background:radial-gradient(ellipse at 8% 12%,#32796c 0,transparent 52%),radial-gradient(ellipse at 98% 90%,#214f5d 0,transparent 48%),#0c302e; color:#163c36; }
.auth-card { width:min(100%,450px); padding:clamp(24px,6vw,44px); background:#fbfcf8; border-radius:28px; box-shadow:0 24px 90px #0628259c; }
.auth-icon { display:grid; place-items:center; width:58px; height:58px; border-radius:18px; font-size:26px; background:#dceee3; }
.auth-school { font-size:12px; font-weight:700; letter-spacing:.15em; margin:18px 0 4px; }
.auth-card h1 { margin:0; font-size:clamp(32px,8vw,46px); line-height:1.1; }
.auth-intro { color:#48645c; margin:8px 0 24px; }
.auth form { border-top:1px solid #dbe6de; padding-top:14px; }
.auth [hidden] { display:none!important; }
.auth label,.auth input { display:block; width:100%; }
.auth label { margin:12px 0; font-size:14px; font-weight:600; }
.auth input { padding:12px; margin-top:5px; border:1px solid #b9cec3; border-radius:10px; background:white; font:inherit; color:inherit; }
.auth button { border:0; border-radius:10px; padding:12px; width:100%; font:inherit; cursor:pointer; }
#auth-submit { margin-top:6px; background:#176454; color:white; font-weight:600; }
#auth-back { background:none; color:#176454; }
#auth-message { color:#704124; font-size:14px; margin:12px 0 0; }
