/* ElectSub - stylesheet tunggal, tanpa dependensi eksternal (font sistem saja
   supaya halaman tetap cepat dibuka meski jaringan sekolah lambat/terbatas). */

:root {
  --brand: #1f4b8f;
  --brand-dark: #123163;
  --brand-tint: #e8eefb;
  --accent: #0f8f6f;
  --accent-tint: #e2f6ef;
  --warn: #b45309;
  --warn-tint: #fdf1e0;
  --danger: #b3261e;
  --danger-tint: #fbe9e8;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --border: #dde2ea;
  --border-strong: #c3cbd8;
  --ink: #17212e;
  --ink-soft: #57616f;
  --ink-faint: #8892a0;
  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 16px;
  --shadow-sm: 0 1px 2px rgba(20, 30, 50, 0.06);
  --shadow-md: 0 8px 24px rgba(20, 30, 50, 0.10);
  --mipa: #0f8f6f; --mipa-tint: #e2f6ef;
  --ips: #b4790f; --ips-tint: #fbf0dd;
  --bahasa: #a3235f; --bahasa-tint: #fbe7f0;
  --vokasi: #5b3fb0; --vokasi-tint: #ece7fa;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0 0 4px; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15.5px; } h4 { font-size: 14px; }
p { margin: 0 0 8px; color: var(--ink-soft); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
small { color: var(--ink-faint); }
.mono { font-family: var(--font-mono); }

img { max-width: 100%; }

/* ---------- layout shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex: none; background: var(--brand-dark); color: #dce6f7;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand { padding: 20px 20px 14px; border-bottom: 1px solid rgba(255,255,255,0.12); }
.sidebar-brand strong { color: #fff; font-size: 17px; display: block; letter-spacing: -0.02em; }
.sidebar-brand span { color: #9db3d8; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; }
.sidebar-nav { padding: 12px; flex: 1; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-s);
  color: #cbdaf1; font-size: 13.5px; font-weight: 600; margin-bottom: 2px; text-decoration: none;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-nav a.is-active { background: var(--brand); color: #fff; }
.sidebar-nav .nav-group-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: #7f96bf; padding: 14px 12px 6px; }
.sidebar-foot { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,0.12); font-size: 12.5px; color: #9db3d8; }
.sidebar-foot form { margin-top: 6px; }
.sidebar-foot button { background: none; border: none; color: #dce6f7; font-size: 12.5px; font-weight: 700; cursor: pointer; padding: 0; }
.sidebar-foot button:hover { text-decoration: underline; }

.main { flex: 1; min-width: 0; }
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border); padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; position: sticky; top: 0; z-index: 5;
}
.topbar-title { font-size: 17px; font-weight: 700; }
.topbar-sub { color: var(--ink-faint); font-size: 12.5px; }
.topbar-user { font-size: 13px; color: var(--ink-soft); text-align: right; }
.topbar-user strong { color: var(--ink); display: block; }
.sidebar-toggle { display: none; background: none; border: 1px solid var(--border-strong); border-radius: var(--radius-s); padding: 6px 10px; cursor: pointer; }

.content { padding: 24px 28px 60px; max-width: 1320px; }

/* ---------- cards / panels ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l); padding: 20px 22px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.card-desc { color: var(--ink-faint); font-size: 12.75px; margin-bottom: 14px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* ---------- stat tiles ---------- */
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-m); padding: 16px 18px; }
.stat-tile .stat-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-faint); font-weight: 700; }
.stat-tile .stat-value { font-size: 26px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.stat-tile .stat-note { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }

/* ---------- forms ---------- */
label { display: block; font-size: 12.75px; font-weight: 700; color: var(--ink-soft); margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.field .hint { font-size: 12px; color: var(--ink-faint); margin-top: 4px; }
input[type="text"], input[type="number"], input[type="password"], input[type="search"], input[type="file"], select, textarea {
  width: 100%; font-family: var(--font); font-size: 14px; padding: 9px 11px; border-radius: var(--radius-s);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
}
textarea { font-family: var(--font-mono); font-size: 13px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 1px;
}
select:disabled, input:disabled { opacity: 0.6; cursor: not-allowed; background: var(--surface-2); }
.radio-row, .checkbox-row { display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 500; color: var(--ink); padding: 3px 0; }
.radio-row input, .checkbox-row input { width: 16px; height: 16px; accent-color: var(--brand); }
.radio-group { display: flex; gap: 18px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--font); font-size: 13.5px; font-weight: 700;
  padding: 9px 16px; border-radius: var(--radius-s); border: 1px solid transparent; cursor: pointer; line-height: 1.2;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(0.92); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger-tint); color: var(--danger); border-color: #f0c6c3; }
.btn-danger:hover { background: #f7d9d7; }
.btn-small { padding: 6px 11px; font-size: 12.5px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.icon-btn { background: none; border: none; cursor: pointer; color: var(--ink-faint); padding: 4px; border-radius: var(--radius-s); }
.icon-btn:hover { background: var(--surface-2); color: var(--danger); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-m); }
table { width: 100%; border-collapse: collapse; font-size: 13.25px; }
thead th {
  text-align: left; background: var(--surface-2); color: var(--ink-soft); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.04em; font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
  position: sticky; top: 0;
}
tbody td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { font-variant-numeric: tabular-nums; }
.table-empty { padding: 28px; text-align: center; color: var(--ink-faint); }

/* ---------- badges / chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.badge.mipa { background: var(--mipa-tint); color: var(--mipa); }
.badge.ips { background: var(--ips-tint); color: var(--ips); }
.badge.bahasa { background: var(--bahasa-tint); color: var(--bahasa); }
.badge.vokasi { background: var(--vokasi-tint); color: var(--vokasi); }
.badge.gray { background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--border); }
.badge.ok { background: var(--accent-tint); color: var(--accent); }
.badge.warn { background: var(--warn-tint); color: var(--warn); }
.badge.danger { background: var(--danger-tint); color: var(--danger); }
.pill-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--brand-tint); color: var(--brand); font-size: 11.5px; font-weight: 800; }

/* ---------- alerts / flash ---------- */
.alert { border-radius: var(--radius-m); padding: 12px 16px; margin-bottom: 16px; font-size: 13.5px; border: 1px solid transparent; }
.alert-error { background: var(--danger-tint); color: #7c211b; border-color: #f0c6c3; }
.alert-success { background: var(--accent-tint); color: #0a5c47; border-color: #bfe8da; }
.alert-warn { background: var(--warn-tint); color: #7a3c07; border-color: #f2d8ab; }
.alert-info { background: var(--brand-tint); color: var(--brand-dark); border-color: #c7d7f2; }

/* ---------- login ---------- */
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, var(--brand-dark), var(--brand) 60%); padding: 20px; }
.login-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: var(--radius-l); box-shadow: var(--shadow-md); padding: 32px 30px 26px; }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand strong { font-size: 24px; letter-spacing: -0.02em; display: block; color: var(--brand-dark); }
.login-brand span { color: var(--ink-faint); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.08em; }
.login-tabs { display: flex; border: 1px solid var(--border-strong); border-radius: var(--radius-s); overflow: hidden; margin-bottom: 20px; }
.login-tabs a { flex: 1; text-align: center; padding: 9px; font-size: 13px; font-weight: 700; color: var(--ink-soft); background: var(--surface-2); text-decoration: none; }
.login-tabs a.is-active { background: var(--brand); color: #fff; }
.login-tabs a + a { border-left: 1px solid var(--border-strong); }
.login-card .btn-primary { width: 100%; justify-content: center; margin-top: 6px; }
.login-foot { text-align: center; margin-top: 16px; font-size: 12px; color: var(--ink-faint); }

/* ---------- tabs / segmented ---------- */
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-s); overflow: hidden; flex-wrap: wrap; }
.segmented a, .segmented button { border: none; background: var(--surface); padding: 8px 15px; font-size: 13px; color: var(--ink-soft); font-weight: 700; cursor: pointer; text-decoration: none; }
.segmented a + a, .segmented button + button { border-left: 1px solid var(--border-strong); }
.segmented a.is-active, .segmented button.is-active { background: var(--brand); color: #fff; }

.section-title { font-size: 14.5px; font-weight: 800; margin: 26px 0 4px; padding-top: 14px; border-top: 1px solid var(--border); }
.section-title:first-child { margin-top: 0; padding-top: 0; border-top: none; }

.type-choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin: 8px 0 4px; }
.type-choice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border-strong); border-radius: var(--radius-m); padding: 12px 14px; cursor: pointer; background: var(--surface-2); }
.type-choice input { margin-top: 3px; accent-color: var(--brand); width: 16px; height: 16px; flex-shrink: 0; }
.type-choice-body strong { display: block; font-size: 13.5px; margin-bottom: 3px; }
.type-choice-body span { display: block; font-size: 12.5px; color: var(--ink-soft); line-height: 1.4; }
.type-choice:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }

.kv-list { display: flex; flex-direction: column; gap: 8px; }
.kv-list .kv-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.kv-list .kv-row:last-child { border-bottom: none; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--ink-faint); border: 1px dashed var(--border-strong); border-radius: var(--radius-m); }
.empty-state strong { display: block; color: var(--ink); font-size: 14.5px; margin-bottom: 4px; }

.repeat-row { display: grid; grid-template-columns: 1fr 110px 110px auto; gap: 8px; align-items: end; margin-bottom: 8px; }
.repeat-row .field { margin-bottom: 0; }

@media (max-width: 880px) {
  .sidebar { position: fixed; left: -260px; z-index: 30; transition: left 0.2s; box-shadow: var(--shadow-md); }
  .sidebar.is-open { left: 0; }
  .sidebar-toggle { display: inline-flex; }
  .content { padding: 18px 16px 50px; }
  .topbar { padding: 12px 16px; }
  .repeat-row { grid-template-columns: 1fr; }
}
