:root {
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-2: #eef2ee;
  --border: #dde3dc;
  --text: #17231b;
  --muted: #5d6b61;
  --primary: #15693f;
  --primary-strong: #0e4f2f;
  --primary-soft: #e3f1e8;
  --accent: #c48a12;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --success: #15803d;
  --chart-1: #15693f;
  --chart-2: #c48a12;
  --chart-3: #8fb9a0;
  --shadow: 0 1px 2px rgba(16, 32, 20, .06), 0 4px 16px rgba(16, 32, 20, .06);
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1511;
    --surface: #17201a;
    --surface-2: #1e2a22;
    --border: #2b3a30;
    --text: #e6eee8;
    --muted: #9aab9f;
    --primary: #4cbb7f;
    --primary-strong: #6fd09a;
    --primary-soft: #1d3326;
    --accent: #e3b04b;
    --danger: #f97066;
    --danger-soft: #3a1f1c;
    --success: #4ade80;
    --chart-1: #4cbb7f;
    --chart-2: #e3b04b;
    --chart-3: #3f6b52;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.tersembunyi { display: none !important; }

/* ---------- Tombol & form ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px;
  padding: 11px 18px; font-weight: 600; cursor: pointer;
  background: var(--primary); color: #fff;
  transition: background .15s, opacity .15s;
}
.btn:hover { background: var(--primary-strong); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 7px 12px; font-size: 14px; }
.btn-block { width: 100%; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn:not(.btn-ghost) { color: #0f1511; } }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 14px; }
.field .bantu { color: var(--muted); font-size: 13px; }
input[type="text"], input[type="password"], input[type="date"], input[type="tel"], select, textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { min-height: 96px; resize: vertical; }

.pesan { padding: 10px 13px; border-radius: 10px; font-size: 14px; margin-bottom: 14px; }
.pesan.error { background: var(--danger-soft); color: var(--danger); }
.pesan.sukses { background: var(--primary-soft); color: var(--primary-strong); }

/* ---------- Halaman masuk ---------- */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr;
}
.auth-brand {
  background: linear-gradient(160deg, #0e4f2f 0%, #15693f 55%, #1d7d4c 100%);
  color: #f3faf5; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.auth-brand::after {
  content: ""; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px;
  border-radius: 50%; border: 60px solid rgba(255, 255, 255, .06);
}
.logo { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 18px; }
.logo-mark {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .14); font-weight: 800;
}
.logo-img { width: 34px; height: auto; display: block; flex: none; }
.logo-besar { flex-direction: column; align-items: flex-start; gap: 14px; font-size: 24px; font-weight: 800; letter-spacing: .01em; position: relative; z-index: 1; }
.logo-badge { background: #fff; border-radius: 22px; padding: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.logo-besar .logo-img { width: 84px; }
.kaki { text-align: center; color: var(--muted); font-size: 13px; padding: 18px 16px 24px; }
.auth-panel .kaki { padding-bottom: 0; margin-top: 28px; }
.aksi-mhs { white-space: nowrap; }
.auth-brand h1 { font-size: 38px; margin: 0 0 14px; max-width: 460px; }
.auth-brand p { color: rgba(243, 250, 245, .82); max-width: 440px; margin: 0; }
.fitur { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.fitur li { display: flex; gap: 10px; align-items: flex-start; color: rgba(243, 250, 245, .9); }
.fitur li::before { content: "✓"; font-weight: 800; color: #f2c96b; }
.auth-brand small { color: rgba(243, 250, 245, .6); position: relative; z-index: 1; }

.auth-panel { display: grid; place-items: center; padding: 40px 20px; }
.kartu-auth { width: 100%; max-width: 420px; }
.kartu-auth h2 { font-size: 24px; margin-bottom: 6px; }
.kartu-auth .sub { color: var(--muted); margin: 0 0 22px; }
.tab-auth {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; padding: 4px;
  background: var(--surface-2); border-radius: 12px; margin-bottom: 24px;
}
.tab-auth button {
  border: 0; background: transparent; padding: 9px; border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.tab-auth button.aktif { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tautan-kecil { background: none; border: 0; padding: 0; color: var(--primary); font-weight: 600; cursor: pointer; font-size: 14px; }
.baris-antara { display: flex; justify-content: space-between; align-items: center; margin: -4px 0 16px; }

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 28px 20px; }
  .auth-brand h1 { font-size: 26px; margin-top: 22px; }
  .logo-besar { flex-direction: row; align-items: center; font-size: 20px; }
  .logo-badge { padding: 8px; border-radius: 14px; }
  .logo-besar .logo-img { width: 44px; }
  .auth-brand .fitur, .auth-brand small { display: none; }
}

/* ---------- Dashboard ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar-isi {
  max-width: 1180px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.topbar .logo { color: var(--text); font-size: 16px; }
.topbar .logo-mark { background: var(--primary); color: #fff; width: 34px; height: 34px; font-size: 14px; }
.topbar-aksi { display: flex; gap: 8px; align-items: center; }
.nama-pengguna { font-weight: 600; font-size: 14px; color: var(--muted); }

.wadah { max-width: 1180px; margin: 0 auto; padding: 28px 20px 60px; }
.profil {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px;
}
.profil h1 { font-size: 26px; }
.profil .meta { color: var(--muted); margin-top: 4px; display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; }
.profil .meta span::before { content: "•"; margin-right: 14px; color: var(--border); }
.profil .meta span:first-child::before { display: none; }
.diperbarui { color: var(--muted); font-size: 13px; }

.grid-kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.kpi .label { color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi .angka { font-size: 32px; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .angka.teks { font-size: 20px; padding-top: 8px; }
.kpi .ket { font-size: 13px; color: var(--muted); margin-top: 2px; }
.naik { color: var(--success); font-weight: 700; }
.turun { color: var(--danger); font-weight: 700; }

.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; margin-bottom: 14px; }
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0;
}
.panel h2 { font-size: 16px; margin-bottom: 4px; }
.panel .sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.kanvas { position: relative; height: 280px; }
.kanvas.pendek { height: 220px; }

.daftar-mk { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.daftar-mk li { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 14px; }
.daftar-mk .smt { color: var(--muted); font-size: 12px; }
.lencana {
  display: inline-grid; place-items: center; min-width: 36px; padding: 2px 8px; border-radius: 999px;
  font-weight: 700; font-size: 13px; background: var(--primary-soft); color: var(--primary-strong);
}
.lencana.rendah { background: var(--danger-soft); color: var(--danger); }
.lencana.sedang { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.judul-kecil { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 16px 0 10px; }
.judul-kecil:first-of-type { margin-top: 0; }

.tab-semester { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; }
.tab-semester button {
  flex: 0 0 auto; border: 1px solid var(--border); background: var(--surface); border-radius: 999px;
  padding: 7px 14px; font-weight: 600; font-size: 14px; cursor: pointer; color: var(--muted);
}
.tab-semester button.aktif { background: var(--primary); border-color: var(--primary); color: #fff; }
.ringkas-semester { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.ringkas-semester b { color: var(--text); }
.tabel-wadah { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td.mk { white-space: normal; min-width: 220px; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; background: var(--surface-2); }
td.angka, th.angka { text-align: right; font-variant-numeric: tabular-nums; }

.kosong { text-align: center; padding: 60px 20px; color: var(--muted); }
.kosong h2 { color: var(--text); margin-bottom: 8px; }
.memuat { text-align: center; padding: 80px 20px; color: var(--muted); }

@media (max-width: 960px) {
  .grid-kpi { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .nama-pengguna { display: none; }
  .kpi .angka { font-size: 26px; }
  .wadah { padding: 20px 16px 48px; }
  .topbar-isi { padding: 10px 16px; }
}

/* ---------- Modal survei (tidak bisa dilewati) ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(10, 20, 14, .62);
  display: grid; place-items: center; padding: 16px; backdrop-filter: blur(3px);
}
.modal {
  width: 100%; max-width: 640px; max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--surface); border-radius: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.modal-kepala { padding: 22px 24px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-kepala .langkah { font-size: 12px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .05em; }
.modal-kepala h2 { font-size: 20px; margin-top: 4px; }
.modal-kepala p { color: var(--muted); margin: 6px 0 0; font-size: 14px; }
.progres { height: 4px; background: var(--surface-2); border-radius: 4px; margin-top: 14px; overflow: hidden; }
.progres > div { height: 100%; background: var(--primary); width: 0; transition: width .2s; }
.modal-isi { padding: 18px 24px; }
.modal-kaki { padding: 14px 24px 22px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--surface); }

.soal { padding: 16px 0; border-bottom: 1px dashed var(--border); }
.soal:last-child { border-bottom: 0; }
.soal.salah .soal-teks { color: var(--danger); }
.soal-teks { font-weight: 600; margin-bottom: 10px; }
.soal-teks .wajib { color: var(--danger); }
.skala { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.skala label, .opsi label {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px; cursor: pointer; font-weight: 600;
  transition: border-color .15s, background .15s;
}
.skala input, .opsi input { position: absolute; opacity: 0; pointer-events: none; }
.skala label:has(input:checked), .opsi label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-strong); }
.skala label:has(input:focus-visible), .opsi label:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--primary-soft); }
.skala-label { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 6px; }
.opsi { display: grid; gap: 8px; }
.opsi label { justify-content: flex-start; font-weight: 500; }
.opsi label::before {
  content: ""; width: 16px; height: 16px; border: 2px solid var(--border); border-radius: 50%; flex: 0 0 auto;
}
.opsi.ceklis label::before { border-radius: 4px; }
.opsi label:has(input:checked)::before { border-color: var(--primary); background: var(--primary); box-shadow: inset 0 0 0 3px var(--surface); }
.hitung-karakter { font-size: 12px; color: var(--muted); text-align: right; margin-top: 4px; }

/* ---------- Dialog biasa ---------- */
.dialog-kartu { width: 100%; max-width: 420px; background: var(--surface); border-radius: 16px; padding: 24px; }
.dialog-kartu h2 { font-size: 18px; margin-bottom: 16px; }
.dialog-aksi { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }

/* ---------- Admin ---------- */
.status-baris { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.status-baris:last-child { border-bottom: 0; }
.titik { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; background: var(--success); }
.titik.gagal { background: var(--danger); }
.peringatan-list { max-height: 240px; overflow-y: auto; font-size: 13px; color: var(--muted); padding-left: 18px; margin: 8px 0 0; }
.cari { max-width: 280px; }
.tengah { text-align: center; margin-top: 14px; }
#layar-masuk { min-height: 100vh; }
.btn { white-space: nowrap; }
@media (max-width: 520px) {
  .topbar .logo { font-size: 14px; gap: 8px; }
  .topbar-aksi .btn-sm { padding: 6px 9px; font-size: 13px; }
}
.input-kode { text-transform: uppercase; letter-spacing: .2em; font-weight: 700; }
code.kode { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; letter-spacing: .08em; }
a.btn { text-decoration: none; }
.field .bantu a { font-weight: 600; }
.blok { margin-bottom: 14px; }
