/* ===== Token. Terang & gelap didesain berpasangan; teks >= 4.5:1. ===== */
:root {
  color-scheme: light;
  --bg: #f0edee;
  --surface: #ffffff;
  --surface-2: #e6ecee;
  --border: #d6dfe2;
  --border-strong: #aebfc4;
  --text: #0a090c;
  --text-2: #435459;
  --primary: #2c666e;
  --primary-hover: #07393c;
  --on-primary: #ffffff;
  --primary-soft: #d5eef4;
  --ring: #2c666e;
  --side-bg: #07393c;
  --side-text: #b3dbe3;
  --side-active: rgba(255, 255, 255, .09);
  --danger: #b42323; --danger-soft: #fde4e4;
  --warn: #8a5100;   --warn-soft: #fdf0d2;
  --ok: #17692f;     --ok-soft: #dcf4e3;
  --info: #0b6577;   --info-soft: #d8f1f5;
  --sev-a: #0b6577; --sev-a-bg: #d8f1f5;
  --sev-b: #8a5100; --sev-b-bg: #fdf0d2;
  --sev-c: #b42323; --sev-c-bg: #fde4e4;
  --series: #1690a8;
  --grid: #dde6e9;
  --scrim: rgba(10, 9, 12, .55);
  --shadow: 0 1px 2px rgba(10, 9, 12, .05), 0 4px 14px rgba(10, 9, 12, .06);
  --r: 14px;
  --r-sm: 10px;
  --tap: 48px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a090c;
    --surface: #11181b;
    --surface-2: #182328;
    --border: #243339;
    --border-strong: #3a5158;
    --text: #f0edee;
    --text-2: #9fbcc4;
    --primary: #90ddf0;
    --primary-hover: #c1eef8;
    --on-primary: #04262a;
    --primary-soft: #0d3f45;
    --ring: #90ddf0;
    --side-bg: #06090b;
    --side-text: #9fbcc4;
    --side-active: rgba(255, 255, 255, .07);
    --danger: #ff8f8f; --danger-soft: #3a1b22;
    --warn: #ffc76b;   --warn-soft: #3a2c11;
    --ok: #6fe39b;     --ok-soft: #12352a;
    --info: #6fd6e6;   --info-soft: #10333b;
    --sev-a: #6fd6e6; --sev-a-bg: #10333b;
    --sev-b: #ffc76b; --sev-b-bg: #3a2c11;
    --sev-c: #ff8f8f; --sev-c-bg: #3a1b22;
    --series: #34a1ba;
    --grid: #1d2b30;
    --scrim: rgba(0, 0, 0, .66);
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a090c;
  --surface: #11181b;
  --surface-2: #182328;
  --border: #243339;
  --border-strong: #3a5158;
  --text: #f0edee;
  --text-2: #9fbcc4;
  --primary: #90ddf0;
  --primary-hover: #c1eef8;
  --on-primary: #04262a;
  --primary-soft: #0d3f45;
  --ring: #90ddf0;
  --side-bg: #06090b;
  --side-text: #a7a2a9;
  --side-active: rgba(255, 255, 255, .07);
  --danger: #ff8f8f; --danger-soft: #3a1b22;
  --warn: #ffc76b;   --warn-soft: #3a2c11;
  --ok: #6fe39b;     --ok-soft: #12352a;
  --info: #6fd6e6;   --info-soft: #10333b;
  --sev-a: #6fd6e6; --sev-a-bg: #10333b;
  --sev-b: #ffc76b; --sev-b-bg: #3a2c11;
  --sev-c: #ff8f8f; --sev-c-bg: #3a1b22;
  --series: #34a1ba;
  --grid: #1d2b30;
  --scrim: rgba(0, 0, 0, .66);
  --shadow: none;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 84px; scroll-padding-bottom: 110px; }
body { -webkit-tap-highlight-color: transparent; margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); min-height: 100dvh; touch-action: manipulation; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.05rem; } h3 { font-size: .95rem; }
p { margin: 0 0 .75rem; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.skip { position: absolute; left: -999px; top: 0; background: var(--primary); color: var(--on-primary); padding: .6rem 1rem; z-index: 1000; border-radius: 0 0 8px 0; }
.skip:focus { left: 0; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--text-2); } .small { font-size: .85rem; } .xs { font-size: .78rem; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.right { text-align: right; } .grow { flex: 1 1 auto; min-width: 0; }
.row-flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.ic { display: inline-flex; flex: none; } .icon { width: 20px; height: 20px; }

/* ===== Shell ===== */
.app { min-height: 100dvh; }
aside.side { display: none; }
.content { min-width: 0; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
.top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.top .logo { width: 34px; height: 34px; flex: none; }
.search { position: relative; flex: 1; max-width: 460px; }
.search input[type="search"] { padding-left: 46px; min-height: 42px; border-radius: 999px; background: var(--surface); }
.search .ic { position: absolute; left: 13px; top: 0; bottom: 0; align-items: center; color: var(--text-2); pointer-events: none; }
.chip { display: none; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: .83rem; font-weight: 600; white-space: nowrap; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.avatar-btn { margin-left: auto; text-decoration: none !important; }
.top-end { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.top-end .avatar-btn { margin-left: 0; }
.theme-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; padding: 0; }
.theme-btn:hover { background: var(--surface-2); color: var(--text); }
main:focus { outline: none; }
main { padding: 18px 16px 24px; width: 100%; outline: none; }
.tabbar {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; display: flex;
  background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px; color: var(--text-2); font-size: .7rem; font-weight: 600; text-decoration: none; min-height: 60px; justify-content: center; }
.tabbar a[aria-current="page"] { color: var(--primary); }
.tabbar a[aria-current="page"] .ind { background: var(--primary-soft); }
.tabbar .ind { display: flex; padding: 3px 16px; border-radius: 999px; }
.tabbar a.cta .ind { background: var(--primary); color: var(--on-primary); padding: 6px 18px; }
@media (min-width: 1024px) {
  .app { display: grid; grid-template-columns: 252px minmax(0, 1fr); }
  aside.side { display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; background: var(--side-bg); color: var(--side-text); padding: 18px 12px 14px; }
  .content { padding-bottom: 0; }
  .tabbar { display: none; }
  .top { padding: 12px 28px; }
  .top .logo { display: none; }
  .chip { display: inline-flex; }
  main { padding: 26px 28px 40px; }
  .avatar-btn { margin-left: 0; }
}
.brandrow { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; font-weight: 700; font-size: 1.02rem; text-decoration: none !important; }
.brandrow img { width: 34px; height: 34px; }
.brandrow small { display: block; font-weight: 500; font-size: .72rem; color: var(--side-text); }
.side .grp { padding: 14px 10px 6px; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #8ec3cf; font-weight: 700; }
.side nav a { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: 10px; color: var(--side-text); font-weight: 550; text-decoration: none; margin-bottom: 2px; }
.side nav a:hover { background: var(--side-active); color: #fff; }
.side nav a[aria-current="page"] { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 #90ddf0; }
.side .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; border-top: 1px solid rgba(255,255,255,.08); color: #fff; }
.side .me .who { min-width: 0; line-height: 1.25; }
.side .me .who div:last-child { color: var(--side-text); font-size: .78rem; }
.side .me a { color: var(--side-text); margin-left: auto; padding: 8px; border-radius: 8px; }
.side .me a:hover { background: var(--side-active); color: #fff; }

/* ===== Komponen dasar ===== */
.avatar { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-weight: 700; font-size: .85rem; color: var(--primary); background: var(--primary-soft); letter-spacing: .02em; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.35rem; }
.avatar.sm { width: 32px; height: 32px; font-size: .75rem; }
.ph { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.ph .t { flex: 1 1 260px; min-width: 0; }
.ph p { margin: 4px 0 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-h { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.card-h h2 { flex: 1; } .card.flush .card-h { padding: 16px 18px 0; }
.card-h a.more { font-size: .85rem; font-weight: 600; }
.g { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); margin-bottom: 14px; }
.g.top-align { align-items: start; }
.card.grow-col { display: flex; flex-direction: column; }
@media (min-width: 720px) { .g.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.g.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.g.c4 .card { padding: 14px; }
.g.c4 .stat .val { font-size: 1.6rem; }
.top .btn { display: none; }
@media (min-width: 1024px) {
  .g.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  .g.c4 .card { padding: 18px; }
  .g.c4 .stat .val { font-size: 1.95rem; }
  .top .btn { display: inline-flex; }
  .g.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g.w21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .g.w12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
  .g.aside { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
}
.btn { appearance: none; border: 1px solid transparent; border-radius: var(--r-sm); min-height: 44px; padding: 0 16px; font: inherit; font-weight: 650; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none !important; background: var(--primary); color: var(--on-primary); transition: background-color .15s, box-shadow .15s, opacity .15s; }
.btn:hover { background: var(--primary-hover); }
.btn:active { opacity: .88; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); color: var(--surface); }
.btn.ghost { background: transparent; color: var(--primary); }
.btn.ghost:hover { background: var(--primary-soft); }
.btn.block { width: 100%; } .btn.sm { min-height: 38px; padding: 0 12px; font-size: .88rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn .icon { width: 18px; height: 18px; }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.field { margin-bottom: 14px; }
.field > label, .field > .lbl { display: block; font-weight: 600; margin-bottom: 5px; font-size: .9rem; }
.req { color: var(--danger); } .help { color: var(--text-2); font-size: .82rem; margin-top: 4px; }
input[type="text"], input[type="search"], input[type="password"], input[type="number"], input[type="datetime-local"], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 13px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
}
textarea { min-height: 96px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--ring); outline-offset: 1px; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.check input { width: 20px; height: 20px; }
.err { color: var(--danger); background: var(--danger-soft); border-radius: var(--r-sm); padding: 10px 12px; margin: 0 0 12px; display: flex; gap: 8px; }
.notice { background: var(--warn-soft); color: var(--warn); border-radius: var(--r-sm); padding: 11px 14px; margin-bottom: 14px; display: flex; gap: 10px; }
.notice.info { background: var(--info-soft); color: var(--info); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.bad { background: var(--danger-soft); color: var(--danger); }
.notice .ic { margin-top: 2px; }
.notice strong { color: inherit; }

/* pill / badge */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700; background: var(--surface-2); color: var(--text-2); white-space: nowrap; line-height: 1.6; }
.pill .icon { width: 13px; height: 13px; }
.pill.a { background: var(--sev-a-bg); color: var(--sev-a); } .pill.b { background: var(--sev-b-bg); color: var(--sev-b); }
.pill.c { background: var(--sev-c-bg); color: var(--sev-c); } .pill.tppk { background: var(--sev-c-bg); color: var(--sev-c); }
.pill.pri { background: var(--primary-soft); color: var(--primary); } .pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--danger-soft); color: var(--danger); } .pill.warn { background: var(--warn-soft); color: var(--warn); }

/* ===== Statistik ===== */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .lbl { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-weight: 600; font-size: .85rem; }
.stat .lbl .ic { width: 30px; height: 30px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); align-items: center; justify-content: center; }
.stat .lbl .ic .icon { width: 17px; height: 17px; }
.stat .val { font-size: 1.95rem; font-weight: 750; letter-spacing: -.02em; line-height: 1.15; margin-top: 6px; }
.stat .val small { font-size: .9rem; font-weight: 600; color: var(--text-2); letter-spacing: 0; margin-left: 4px; }
.stat .sub { font-size: .82rem; color: var(--text-2); }
.delta { font-weight: 700; } .delta.up { color: var(--warn); } .delta.down { color: var(--ok); } .delta.flat { color: var(--text-2); }

/* ===== Grafik ===== */
.chartbox { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chart { position: relative; flex: 1; min-height: 190px; margin: 6px 0 24px 30px; }
.chart .gl { position: absolute; left: 0; right: 0; border-top: 1px solid var(--grid); }
.chart .gl span { position: absolute; left: -30px; top: -9px; width: 24px; text-align: right; font-size: .72rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.chart .cols { position: absolute; inset: 0; display: flex; align-items: stretch; }
.chart .col { flex: 1; min-width: 0; display: flex; align-items: flex-end; justify-content: center; cursor: default; }
.chart .col i { display: block; width: min(60%, 18px); min-height: 0; background: var(--series); border-radius: 4px 4px 0 0; transition: opacity .12s; }
.chart .col:hover i, .chart .col.on i { opacity: .8; }
.chart .col.zero i { background: transparent; }
.chart .xl { position: absolute; top: calc(100% + 6px); font-size: .72rem; color: var(--text-2); transform: translateX(-50%); white-space: nowrap; }
.tip { position: fixed; z-index: 3000; pointer-events: none; background: var(--text); color: var(--bg); padding: 6px 10px; border-radius: 8px; font-size: .8rem; font-weight: 600; box-shadow: 0 6px 18px rgba(0,0,0,.25); transform: translate(-50%, -100%); white-space: nowrap; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; margin-bottom: 12px; }
.hbar .top2 { display: flex; gap: 8px; align-items: baseline; }
.hbar .top2 .l { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.hbar .top2 .v { font-variant-numeric: tabular-nums; font-weight: 700; }
.hbar .track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--series); border-radius: 0 999px 999px 0; min-width: 4px; }
.hbar a.l { color: var(--text); }
.viewswitch { font-size: .82rem; }
.tbl-mini { width: 100%; border-collapse: collapse; font-size: .85rem; }
.tbl-mini th, .tbl-mini td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.tbl-mini td:last-child, .tbl-mini th:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* ===== Daftar & tabel responsif ===== */
.rows { display: flex; flex-direction: column; }
.trow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface); color: inherit; text-decoration: none !important; cursor: pointer; text-align: left; font: inherit; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; }
.trow:first-child { border-top: 0; }
button.trow:hover, a.trow:hover, .trow.click:hover { background: var(--surface-2); }
.trow .main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.trow .main .tx { min-width: 0; }
.trow .title { font-weight: 650; overflow-wrap: anywhere; }
.trow .end { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.trow.head { display: none; cursor: default; background: var(--surface-2); font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; color: var(--text-2); padding-top: 9px; padding-bottom: 9px; }
.trow.cancelled .title { text-decoration: line-through; color: var(--text-2); }
.trow .cell-d { display: none; }
@media (min-width: 860px) {
  .trow.cols-siswa { grid-template-columns: minmax(0, 3fr) minmax(0, .9fr) minmax(0, 1.1fr) minmax(0, 1.7fr) 96px; }
  .trow.cols-riwayat { grid-template-columns: minmax(0, 1.1fr) minmax(0, 2.2fr) minmax(0, 2.6fr) minmax(0, .9fr) minmax(0, 1.3fr) minmax(0, .9fr); }
  .trow.head { display: grid; }
  .trow .cell-d { display: block; min-width: 0; }
  .trow .cell-m { display: none; }
  .trow .end { flex-wrap: nowrap; }
}
.poinbar { display: flex; align-items: center; gap: 8px; }
.poinbar .b { flex: 1; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; min-width: 40px; }
.poinbar .b i { display: block; height: 100%; background: var(--series); }
.poinbar .n { font-weight: 700; min-width: 28px; text-align: right; font-variant-numeric: tabular-nums; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.filters .field { margin: 0; flex: 1 1 180px; }
.filters .field.w2 { flex: 2 1 260px; }
.seg { display: inline-flex; background: var(--surface-2); padding: 3px; border-radius: 11px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--text-2); font: inherit; font-weight: 650; font-size: .85rem; min-height: 38px; padding: 0 14px; border-radius: 9px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.empty { text-align: center; padding: 22px 16px; color: var(--text-2); }
.empty .ic { color: var(--border-strong); } .empty .icon { width: 42px; height: 42px; }
.empty p { margin: 8px 0 0; }
.sk { border-radius: 8px; background: linear-gradient(90deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 55%, var(--surface)), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ===== Profil siswa ===== */
.prof { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.prof .pinfo { flex: 1 1 240px; min-width: 0; }
.prof h1 { overflow-wrap: anywhere; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.meter { margin-top: 14px; }
.meter .bar { position: relative; height: 12px; background: var(--surface-2); border-radius: 99px; }
.meter .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--series); border-radius: 99px; }
.meter .tick { position: absolute; top: -3px; width: 2px; height: 18px; background: var(--border-strong); }
.meter .tick.hit { background: var(--warn); }
.meter .tl { position: relative; height: 22px; margin-top: 8px; font-size: .72rem; color: var(--text-2); }
.meter .tl span { position: absolute; transform: translateX(-50%); font-variant-numeric: tabular-nums; }
.tline { position: relative; margin: 0; padding: 0 0 0 26px; list-style: none; }
.tline::before { content: ""; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.tline li { position: relative; margin-bottom: 10px; }
.tline .dot { position: absolute; left: -24px; top: 16px; width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--surface); background: var(--border-strong); box-shadow: 0 0 0 2px var(--border); }
.tline .dot.a { background: var(--sev-a); } .tline .dot.b { background: var(--sev-b); } .tline .dot.c { background: var(--sev-c); }
.tline button { display: block; width: 100%; text-align: left; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; cursor: pointer; }
.tline button:hover { border-color: var(--border-strong); background: var(--surface-2); }
.tline .cancelled .title { text-decoration: line-through; color: var(--text-2); }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.kv dt { color: var(--text-2); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb-btn, .th-open { padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 10px; line-height: 0; }
.thumb-btn:hover img, .th-open:hover img { filter: brightness(.9); }
.thumbs img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); }

/* ===== Catat ===== */
.picks { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr)); }
.pick { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 2px solid var(--border); border-radius: var(--r); background: var(--surface); cursor: pointer; min-height: 62px; }
.pick:hover { border-color: var(--border-strong); }
.pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pick:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.pick:has(input:focus-visible) { outline: 3px solid var(--ring); outline-offset: 2px; }
.pick .name { font-weight: 650; overflow-wrap: anywhere; }
.summary { position: sticky; top: 84px; }
.summary .big { font-size: 2.2rem; font-weight: 750; line-height: 1.1; letter-spacing: -.02em; }
.cta-bar { position: sticky; bottom: calc(68px + env(safe-area-inset-bottom)); background: var(--bg); padding: 8px 0; z-index: 5; }
@media (min-width: 1024px) { .cta-bar { bottom: 0; } }
.step { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.step .n { width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-size: .8rem; font-weight: 750; flex: none; }
.step h2 { margin: 0; }

/* ===== Tab & dialog & toast ===== */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 0 0 16px; padding: 4px; background: var(--surface-2); border-radius: 12px; scrollbar-width: none; width: fit-content; max-width: 100%; }
.tabs a { padding: 0 14px; min-height: 40px; display: inline-flex; align-items: center; text-decoration: none !important; color: var(--text-2); font-weight: 650; font-size: .88rem; white-space: nowrap; border-radius: 9px; }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.grp { margin: 16px 0 6px; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); font-weight: 700; }
dialog { overscroll-behavior: contain; border: 0; border-radius: 18px; padding: 0; width: min(580px, calc(100vw - 20px)); max-height: calc(100dvh - 20px); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog::backdrop { background: var(--scrim); backdrop-filter: blur(2px); }
.dlg { overscroll-behavior: contain; padding: 20px; overflow-y: auto; max-height: calc(100dvh - 20px); }
.dlg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.dlg-head h2 { flex: 1; font-size: 1.15rem; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; flex-wrap: wrap; }
.toasts { position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
@media (min-width: 1024px) { .toasts { bottom: 20px; } }
.toast { background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.28); max-width: 480px; pointer-events: auto; animation: rise .2s ease-out; font-weight: 550; }
.toast.err { background: var(--danger); color: var(--surface); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* ===== Login ===== */
.login { min-height: 100dvh; display: grid; }
.login .hero { display: none; }
.login .formwrap { display: grid; place-items: center; padding: 24px 16px; }
.login .panel { width: min(400px, 100%); }
.login .panel .logo { width: 52px; height: 52px; margin-bottom: 14px; }
.pw { position: relative; } .pw button { position: absolute; right: 3px; top: 3px; height: 40px; }
@media (min-width: 900px) {
  .login { grid-template-columns: 1.1fr 1fr; }
  .login .hero { display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 56px; color: #fff; background: radial-gradient(1200px 600px at 10% -10%, #2c666e 0%, transparent 60%), linear-gradient(160deg, #0a090c, #07393c); }
  .login .hero .hero-title { color: #fff; } .login .hero p { color: #cfe6ec; max-width: 460px; }
  .login .hero ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
  .login .hero li { display: flex; gap: 12px; align-items: flex-start; color: #e3f3f7; }
  .login .hero li .ic { background: rgba(255,255,255,.12); border-radius: 9px; padding: 6px; color: #fff; }
}
.noscript { padding: 1rem; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ===== Kompatibilitas: daftar/badge lama dipakai halaman Kelola & dialog ===== */
.card .rows { margin: 0 -18px -18px; }
.card .rows .trow:last-child { border-radius: 0 0 var(--r) var(--r); }
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.row-flex + .list, .row-flex + .card { margin-top: 12px; }
.list > .grp { margin: 0; padding: 9px 16px; background: var(--surface-2); }
.item { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); min-height: 60px; }
.list > .item:first-child, .list > .grp + .item { border-top: 0; }
.item > .main, .item > a.main, .item > button.main { flex: 1; min-width: 0; padding: 10px 14px; text-decoration: none; color: inherit; background: none; border: 0; font: inherit; text-align: left; }
.item .title { font-weight: 650; overflow-wrap: anywhere; }
.item .side { display: flex; gap: 6px; align-items: center; padding-right: 10px; flex-wrap: wrap; justify-content: flex-end; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge.pts { background: var(--primary-soft); color: var(--primary); }
.badge.a { background: var(--sev-a-bg); color: var(--sev-a); } .badge.b { background: var(--sev-b-bg); color: var(--sev-b); }
.badge.c, .badge.bad { background: var(--danger-soft); color: var(--danger); } .badge.off { background: var(--surface-2); color: var(--text-2); }
.info { background: var(--primary-soft); border-radius: var(--r-sm); padding: 10px 12px; margin-bottom: 12px; }
.scrollx { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }

.rows > p { padding: 12px 18px; margin: 0; }
.card + .card, form > .card + .card { margin-top: 14px; }
.card .card.flush { margin-top: 10px; }
.card.flush .rows, .card .card.flush .rows { margin: 0; }
form > .card { margin-bottom: 0; }

/* ===== Alur Catat: langkah berurutan ===== */
.stepcard { transition: opacity .15s; scroll-margin-top: 84px; }
.stepcard.locked { opacity: .5; }
.stepcard.locked .step h2 { color: var(--text-2); }
.stepcard.locked .step .n { background: var(--surface-2); color: var(--text-2); }
.stepcard.done .step .n { background: var(--ok); }
.stepcard .step { margin-bottom: 14px; }
.stepcard .step .st { margin-left: auto; }
.stepcard.current { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow); }
.cta-hint { margin: 0 0 6px; font-size: .85rem; color: var(--text-2); min-height: 1.3em; }
.cta-hint.ready { color: var(--ok); font-weight: 600; }
.cta-sum { display: block; }
.summary-wrap { display: none; }
@media (min-width: 1024px) { .cta-sum { display: none; } .summary-wrap { display: block; } }
.pfoto { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pfoto .th { position: relative; }
.pfoto .th img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); display: block; }
.pfoto .th button { position: absolute; top: -8px; right: -8px; width: 28px; height: 28px; padding: 0; border-radius: 50%; border: 2px solid var(--surface); background: var(--danger); color: var(--surface); cursor: pointer; display: grid; place-items: center; }
.pfoto .th button .icon { width: 14px; height: 14px; }
.next { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.mt { margin-top: 10px; }
.done-card { max-width: 820px; }
.g > .card + .card, .g > .stack + .card, .g > .card + .stack, .g > * { margin-top: 0; }
@media (min-width: 1024px) { .mob-only { display: none !important; } }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.seg button:hover:not([aria-pressed="true"]) { color: var(--text); background: color-mix(in srgb, var(--surface) 55%, transparent); }
.tabs a:hover:not([aria-current="page"]), .tabbar a:hover { color: var(--text); }
.tabs a:hover:not([aria-current="page"]) { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.hero-title { font-size: 2rem; line-height: 1.2; font-weight: 650; margin: 0; text-wrap: balance; }
/* Baris daftar dengan tautan utama + aksi terpisah (tanpa elemen interaktif bersarang) */
.trow.rel { position: relative; }
.trow.rel a.main-link { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 12px; min-width: 0; }
.trow.rel a.main-link::after { content: ""; position: absolute; inset: 0; }
.trow.rel .btn, .trow.rel .end a { position: relative; z-index: 1; }
/* Sisi layar (notch / landscape) */
.top, .tabbar { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.tabbar { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
main { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.trow.rel:hover { background: var(--surface-2); }
.chart:focus-visible { outline-offset: 6px; }

.prewrap { white-space: pre-wrap; }
.nbadge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--danger); color: var(--surface); font-size: .74rem; font-weight: 750; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.side nav a .nbadge { color: #fff; }

/* ===== Surat (layar & cetak) ===== */
.paper { background: #fff; color: #111; border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); padding: clamp(18px, 4vw, 48px); max-width: 860px; margin: 0 auto 24px; }
.letter { font: 12pt/1.55 "Times New Roman", Times, serif; color: #111; }
.letter .kop { text-align: center; border-bottom: 3px double #111; padding-bottom: 8px; margin-bottom: 14px; }
.letter .kop-nama { font-weight: 700; font-size: 14pt; letter-spacing: .02em; }
.letter .kop-alamat { font-size: 10pt; }
.letter .meta { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.letter table { border-collapse: collapse; }
.letter .meta td { padding: 0 8px 0 0; vertical-align: top; }
.letter .tujuan { margin-bottom: 12px; }
.letter .ed { margin: 0 0 10px; white-space: pre-wrap; outline-offset: 3px; text-align: justify; }
.letter .ed:hover { background: #ebf5f8; }
.letter .jadwal { margin: 0 0 10px 24px; } .letter .jadwal td { padding: 1px 10px 1px 0; vertical-align: top; }
.letter .rekap { margin: 8px 0 12px; }
.letter .lt { width: 100%; font-size: 10.5pt; } .letter .lt th, .letter .lt td { border: 1px solid #333; padding: 3px 8px; text-align: left; } .letter .lt .r { text-align: right; }
.letter .ttd { margin: 24px 0 0 auto; width: 260px; text-align: left; } .letter .ttd-ruang { height: 70px; } .letter .ttd-nama { font-weight: 700; text-decoration: underline; }
@media print {
  @page { size: A4; margin: 16mm 18mm; }
  html, body { background: #fff !important; }
  .side, .top, .tabbar, .toasts, .noprint, .skip, dialog { display: none !important; }
  .app { display: block !important; } .content { padding: 0 !important; }
  main { padding: 0 !important; max-width: none !important; }
  .paper { border: 0; box-shadow: none; padding: 0; max-width: none; margin: 0; }
  .letter .ed:hover { background: none; }
}

/* ===== Penampil foto (modal layar penuh) ===== */
dialog.viewer { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; background: #0a090c; color: #f0edee; display: none; flex-direction: column; }
dialog.viewer[open] { display: flex; }
dialog.viewer::backdrop { background: #0a090c; backdrop-filter: none; }
.v-top { display: flex; align-items: center; gap: 12px; padding: 10px max(12px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); font-size: .9rem; }
.v-level { color: #9fbcc4; font-size: .85rem; }
.v-body { position: relative; flex: 1; min-height: 0; display: flex; align-items: stretch; }
.v-stage { position: relative; flex: 1; overflow: hidden; touch-action: none; cursor: grab; user-select: none; }
.v-stage.zoomed { cursor: move; }
.v-img { position: absolute; left: 50%; top: 50%; max-width: none; transform-origin: center; will-change: transform; -webkit-user-drag: none; }
.v-bar { display: flex; justify-content: center; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
.v-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 1px solid rgba(240,237,238,.2); background: rgba(240,237,238,.08); color: #f0edee; cursor: pointer; padding: 0; }
.v-btn:hover { background: rgba(144,221,240,.22); }
.v-btn:focus-visible { outline: 3px solid #90ddf0; outline-offset: 2px; }
.v-btn[hidden] { display: none; }
.v-btn.flip .icon { transform: scaleX(-1); }
.v-body > .v-btn { position: absolute; top: 50%; translate: 0 -50%; z-index: 2; }
.v-body > .v-btn.flip { left: 8px; }
.v-body > .v-btn:not(.flip) { right: 8px; }

/* ===== Detail pelanggaran ===== */
.dt-hero { --acc: var(--primary); --acc-bg: var(--primary-soft); display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: var(--r); background: var(--acc-bg); box-shadow: inset 4px 0 0 var(--acc); }
.dt-hero.a { --acc: var(--sev-a); --acc-bg: var(--sev-a-bg); }
.dt-hero.b { --acc: var(--sev-b); --acc-bg: var(--sev-b-bg); }
.dt-hero.c { --acc: var(--sev-c); --acc-bg: var(--sev-c-bg); }
.dt-hero-main { flex: 1; min-width: 0; }
.dt-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.dt-hero .pill { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.dt-title { font-size: 1.12rem; line-height: 1.3; text-wrap: pretty; }
.dt-poin { flex: none; text-align: center; min-width: 64px; padding: 8px 12px; border-radius: 12px; background: var(--surface); color: var(--acc); line-height: 1.1; }
.dt-poin strong { display: block; font-size: 1.7rem; font-weight: 750; }
.dt-poin span { font-size: .72rem; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
.dt-hero.batal .dt-title, .dt-hero.batal .dt-poin strong { text-decoration: line-through; opacity: .7; }
.dt-siswa { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--r); color: var(--text); text-decoration: none !important; background: var(--surface); }
.dt-siswa:hover { border-color: var(--border-strong); background: var(--surface-2); }
.dt-siswa > .grow { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.dt-siswa > .ic { color: var(--text-2); }
.dt-lbl { font-size: .74rem; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.dt-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.dt-fact { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); }
.dt-fic { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--surface); color: var(--primary); }
.dt-fic .icon { width: 16px; height: 16px; }
.dt-val { font-weight: 550; overflow-wrap: anywhere; font-size: .92rem; }
.dt-sec h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.dt-count { background: var(--primary-soft); color: var(--primary); border-radius: 999px; padding: 0 8px; font-size: .74rem; line-height: 1.5; }
.dt-note { margin: 0; padding: 10px 14px; border-left: 3px solid var(--border-strong); background: var(--surface-2); border-radius: 0 var(--r-sm) var(--r-sm) 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.dt-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.dt-shot { position: relative; padding: 0; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; cursor: zoom-in; background: var(--surface-2); aspect-ratio: 4 / 3; line-height: 0; }
.dt-shot img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.dt-shot:hover img { transform: scale(1.05); }
.dt-zoom { position: absolute; right: 6px; bottom: 6px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: rgba(10, 9, 12, .65); color: #f0edee; opacity: 0; transition: opacity .15s; }
.dt-shot:hover .dt-zoom, .dt-shot:focus-visible .dt-zoom { opacity: 1; }
.dt-zoom .icon { width: 15px; height: 15px; }
.dt-nofoto { display: flex; align-items: center; gap: 8px; padding: 14px; border: 1px dashed var(--border-strong); border-radius: var(--r-sm); color: var(--text-2); font-size: .9rem; }
.dt-actions { padding-top: 12px; border-top: 1px solid var(--border); }
@media (max-width: 480px) { .dt-facts { grid-template-columns: 1fr; } .dt-hero { padding: 14px; } }
@media (prefers-reduced-motion: reduce) { .dt-shot img { transition: none; } }

/* ===== Gerbang (catat cepat) ===== */
.gb-search { display: flex; align-items: center; gap: 10px; padding: 6px 14px; margin-bottom: 14px; }
.gb-search input { flex: 1; border: 0; background: transparent; font-size: 1.1rem; padding: 12px 0; min-height: var(--tap); }
.gb-search input:focus { outline: none; }
.gb-search:focus-within { box-shadow: 0 0 0 3px var(--ring); }
.gb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 18px 4px; }
.gb-btn { min-width: 132px; min-height: 44px; }
.gb-btn.done { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.gb-batal { text-decoration: line-through; color: var(--text-2); }
.gb-list { margin-top: 14px; }

/* ===== Barang sitaan ===== */
.sitaan { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); }
.sitaan.row-flex { display: flex; }
.sitaan-aksi { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.sitaan-form { display: grid; gap: 8px; grid-template-columns: minmax(0, 2fr) 84px minmax(0, 2fr) auto; align-items: center; margin-top: 8px; }
@media (max-width: 640px) { .sitaan-form { grid-template-columns: 1fr 84px; } .sitaan-form input:nth-child(3), .sitaan-form .btn { grid-column: 1 / -1; } }

/* ===== Kelola ===== */
.kl-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.kl-tools .btn { margin-left: auto; }
.kl-search { display: flex; align-items: center; gap: 8px; flex: 1 1 240px; min-width: 0; padding: 0 12px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm); }
.kl-search input { flex: 1; min-width: 0; border: 0; background: transparent; min-height: 44px; }
.kl-search input:focus { outline: none; }
.kl-search:focus-within { box-shadow: 0 0 0 3px var(--ring); }
.kl-tools + .small { display: block; margin: 4px 0 10px; }
.kl-link { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none !important; }
.kl-link:hover { border-color: var(--border-strong); background: var(--surface-2); }
.kl-link > .ic { color: var(--text-2); }
.kl-sitaan .main { text-align: left; cursor: pointer; }
.kl-sitaan .main:hover { background: var(--surface-2); }
.kl-val { font-size: 1.3rem !important; line-height: 1.5 !important; }
