/* =============================================================
   SIAKAD-EDU — lembar gaya utama
   Palet: tinta #16202B, kertas #F1F3F5, biru lembaga #1B4F91,
          emas dokumen #8C6B1F, lulus #1B7A4B, gagal #B02A2A
   ============================================================= */

:root {
  --ink: #16202b;
  --ink-soft: #33465a;
  --paper: #f1f3f5;
  --surface: #ffffff;
  --line: #d9dee4;
  --line-soft: #e8ecef;
  --primary: #1b4f91;
  --primary-dark: #143b6d;
  --primary-tint: #e8eff8;
  --gold: #8c6b1f;
  --ok: #1b7a4b;
  --ok-tint: #e4f2ea;
  --warn: #a9631a;
  --warn-tint: #fbeee0;
  --bad: #b02a2a;
  --bad-tint: #f9e6e6;
  --mute: #6b7a89;
  --radius: 4px;
  --sidebar: 236px;
  --sans: "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0 0 .8em; }
small { font-size: 12px; }

/* ---------- Kerangka halaman ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  background: var(--ink);
  color: #c3ced9;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand {
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(255,255,255,.09);
}
.brand b { color: #fff; font-size: 16px; display: block; letter-spacing: .01em; }
.brand span { font-size: 11.5px; color: #8b9cad; }

.nav { padding: 10px 0 28px; }
.nav-group { padding: 14px 18px 5px; font-size: 10.5px; letter-spacing: .09em; color: #7b8c9e; text-transform: uppercase; }
.nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 18px; color: #c3ced9; font-size: 13.5px; border-left: 3px solid transparent;
}
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(27,79,145,.35); border-left-color: #5f9bea; color: #fff; }
.nav svg { width: 15px; height: 15px; flex: 0 0 15px; opacity: .85; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 10px 22px;
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .crumb { font-size: 13px; color: var(--mute); flex: 1; min-width: 0; }
.topbar .crumb b { color: var(--ink); font-weight: 600; }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.who .avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--primary-tint);
  color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 12px;
}
.who .role { color: var(--mute); font-size: 11.5px; }

.content { padding: 20px 22px 48px; max-width: 1240px; width: 100%; }

.page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 240px; }
.page-head p { color: var(--mute); margin: 0; font-size: 13px; }

/* ---------- Panel & kartu ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 18px;
}
.panel-head {
  padding: 12px 16px; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.panel-head h2, .panel-head h3 { margin: 0; }
.panel-head .grow { flex: 1; }
.panel-body { padding: 16px; }
.panel-foot { padding: 12px 16px; border-top: 1px solid var(--line-soft); background: #fbfcfd; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 15px; display: flex; flex-direction: column; gap: 2px;
}
.stat .n { font-size: 25px; font-weight: 600; letter-spacing: -.02em; }
.stat .k { font-size: 12.5px; color: var(--mute); }
.stat .sub { font-size: 11.5px; color: var(--mute); }
.stat.is-primary { border-top: 3px solid var(--primary); }
.stat.is-ok { border-top: 3px solid var(--ok); }
.stat.is-gold { border-top: 3px solid var(--gold); }
.stat.is-warn { border-top: 3px solid var(--warn); }

/* ---------- Tabel ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
table.data thead th {
  background: #f7f9fa; font-size: 11.5px; letter-spacing: .04em; color: var(--ink-soft);
  text-transform: uppercase; font-weight: 600; position: sticky; top: 0; border-bottom: 1px solid var(--line);
}
table.data tbody tr:hover { background: #f9fbfc; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.actions { white-space: nowrap; text-align: right; }
.empty { padding: 34px 16px; text-align: center; color: var(--mute); }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; }

/* ---------- Lencana & label ---------- */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11.5px;
  font-weight: 600; text-transform: capitalize; line-height: 1.6;
}
.badge-ok { background: var(--ok-tint); color: var(--ok); }
.badge-bad { background: var(--bad-tint); color: var(--bad); }
.badge-warn { background: var(--warn-tint); color: var(--warn); }
.badge-info { background: var(--primary-tint); color: var(--primary); }
.badge-mute { background: #eceff1; color: var(--mute); }
.pill { font-size: 11.5px; color: var(--mute); background: #f2f4f6; padding: 1px 7px; border-radius: 3px; }

/* ---------- Tombol ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 7px 14px; font-size: 13.5px; font-family: inherit; font-weight: 500;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: var(--radius); cursor: pointer; text-decoration: none;
}
.btn:hover { background: #f6f8f9; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #8f2020; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: #15603b; }
.btn-sm { padding: 4px 9px; font-size: 12.5px; }
.btn-link { border: 0; background: none; color: var(--primary); padding: 4px 6px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Formulir ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.span-2 { grid-column: 1 / -1; }
label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
label .req { color: var(--bad); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=datetime-local], input[type=search], input[type=file], select, textarea {
  font-family: inherit; font-size: 13.5px; color: var(--ink);
  padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; width: 100%;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(27,79,145,.12); }
.hint { font-size: 11.5px; color: var(--mute); }
.check { display: flex; align-items: center; gap: 7px; font-size: 13.5px; }
.check input { width: auto; }
fieldset { border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 14px; margin: 0 0 16px; }
legend { font-size: 12px; font-weight: 700; color: var(--ink-soft); padding: 0 6px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 150px; }

/* ---------- Pesan ---------- */
.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13.5px; border: 1px solid; }
.alert-ok { background: var(--ok-tint); border-color: #bfdfcd; color: #14603a; }
.alert-error { background: var(--bad-tint); border-color: #eec5c5; color: #8f2222; }
.alert-info { background: var(--primary-tint); border-color: #cadcf1; color: var(--primary-dark); }
.alert-warn { background: var(--warn-tint); border-color: #f0d6b4; color: #854d13; }
.alert ul { margin: 6px 0 0 18px; padding: 0; }

/* ---------- Navigasi halaman ---------- */
.pager { display: flex; align-items: center; gap: 4px; padding: 12px 16px; flex-wrap: wrap; }
.pager a { padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 13px; }
.pager a.is-current { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager-info { margin-left: auto; font-size: 12.5px; color: var(--mute); }

/* ---------- Masuk sistem ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.auth-side {
  background: var(--ink); color: #cfd9e3; padding: 46px 44px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-side h1 { color: #fff; font-size: 27px; max-width: 15ch; }
.auth-side .lead { color: #9fb0c1; max-width: 42ch; font-size: 14.5px; }
.auth-side ul { list-style: none; padding: 0; margin: 22px 0 0; font-size: 13.5px; }
.auth-side ul li { padding: 6px 0 6px 20px; position: relative; color: #b6c3cf; }
.auth-side ul li::before { content: ""; position: absolute; left: 0; top: 13px; width: 9px; height: 2px; background: #5f9bea; }
.auth-main { display: grid; place-items: center; padding: 32px; background: var(--paper); }
.auth-card { width: 100%; max-width: 384px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 26px; }
.auth-card h2 { margin-bottom: 2px; }
.auth-card .sub { color: var(--mute); font-size: 13px; margin-bottom: 18px; }

.captcha-row { display: flex; gap: 10px; align-items: flex-end; }
.captcha-row .field { flex: 1; }
.captcha-box { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.captcha-box img { border: 1px solid var(--line); border-radius: var(--radius); display: block; background: #fff; }
.captcha-box button { font-size: 11.5px; }

/* ---------- Ujian ---------- */
.exam-bar {
  position: sticky; top: 0; z-index: 30; background: var(--ink); color: #fff;
  padding: 10px 18px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.exam-bar .timer { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.exam-bar .timer.warning { color: #ffc98a; }
.exam-bar .timer.danger { color: #ff9b9b; }
.exam-bar .meta { font-size: 12.5px; color: #a9b8c6; }
.exam-layout { display: grid; grid-template-columns: 1fr 208px; gap: 18px; align-items: start; }
.q-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.q-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 10px; }
.q-num { font-weight: 700; color: var(--primary); }
.q-text { font-size: 15px; margin-bottom: 12px; white-space: pre-line; }
.opt { display: flex; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 7px; cursor: pointer; }
.opt:hover { background: #f7f9fb; }
.opt input { margin-top: 3px; }
.opt.is-picked { border-color: var(--primary); background: var(--primary-tint); }
.opt.is-correct { border-color: var(--ok); background: var(--ok-tint); }
.opt.is-wrong { border-color: var(--bad); background: var(--bad-tint); }
.opt .letter { font-weight: 700; color: var(--ink-soft); }
.q-nav { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; position: sticky; top: 62px; }
.q-nav .grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-bottom: 10px; }
.q-nav a { display: grid; place-items: center; height: 30px; border: 1px solid var(--line); border-radius: 3px; font-size: 12.5px; color: var(--ink); }
.q-nav a.done { background: var(--primary); border-color: var(--primary); color: #fff; }
.q-nav a:hover { text-decoration: none; border-color: var(--primary); }

/* ---------- Dokumen (sertifikat & transkrip) ---------- */
.doc-toolbar { display: flex; gap: 8px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; align-items: center; }
.doc-sheet {
  width: 297mm; max-width: 100%; min-height: 210mm; margin: 22px auto; background: #fff;
  padding: 16mm; position: relative; font-family: var(--serif); color: #1c1a15;
  box-shadow: 0 2px 18px rgba(20,30,40,.14);
}
.doc-sheet.portrait { width: 210mm; min-height: 297mm; }
.doc-frame {
  position: absolute; inset: 8mm;
  border: 2px solid var(--gold);
  outline: 1px solid var(--gold); outline-offset: 3px;
  pointer-events: none;
}
.doc-frame::before {
  content: ""; position: absolute; inset: 4px;
  background:
    repeating-linear-gradient(45deg, rgba(140,107,31,.10) 0 2px, transparent 2px 7px) top/100% 7px no-repeat,
    repeating-linear-gradient(45deg, rgba(140,107,31,.10) 0 2px, transparent 2px 7px) bottom/100% 7px no-repeat,
    repeating-linear-gradient(45deg, rgba(140,107,31,.10) 0 2px, transparent 2px 7px) left/7px 100% no-repeat,
    repeating-linear-gradient(45deg, rgba(140,107,31,.10) 0 2px, transparent 2px 7px) right/7px 100% no-repeat;
}
.doc-inner { position: relative; z-index: 2; padding: 6mm 8mm; text-align: center; }
.doc-org { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 6mm; }
.doc-org img { height: 58px; }
.doc-org .org-name { font-size: 19px; font-weight: 700; letter-spacing: .04em; }
.doc-org .org-meta { font-size: 11.5px; color: #6a6350; font-family: var(--sans); }
.doc-kind { font-size: 30px; letter-spacing: .22em; margin: 2mm 0 1mm; color: var(--gold); font-variant: small-caps; }
.doc-number { font-family: var(--sans); font-size: 12px; color: #5f5949; letter-spacing: .04em; }
.doc-given { margin-top: 7mm; font-size: 14px; color: #4a4638; }
.doc-name { font-size: 30px; margin: 2mm 0; font-weight: 700; letter-spacing: .01em; }
.doc-id { font-family: var(--sans); font-size: 12px; color: #5f5949; }
.doc-body { margin: 5mm auto 0; max-width: 76ch; font-size: 14.5px; line-height: 1.7; }
.doc-course { font-size: 19px; font-weight: 700; margin: 3mm 0 2mm; }
.doc-score { font-family: var(--sans); font-size: 13px; color: #4a4638; }
.doc-foot { display: flex; align-items: flex-end; justify-content: space-between; margin-top: 9mm; gap: 20px; }
.doc-qr { text-align: center; font-family: var(--sans); font-size: 10.5px; color: #5f5949; width: 40mm; }
.doc-qr img { width: 32mm; height: 32mm; display: block; margin: 0 auto 3px; }
.doc-sign { text-align: center; font-family: var(--sans); font-size: 12.5px; min-width: 58mm; }
.doc-sign .space { height: 17mm; }
.doc-sign .name { font-weight: 700; border-top: 1px solid #b8ac8b; padding-top: 4px; }
.doc-watermark {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  font-size: 130px; color: rgba(140,107,31,.05); font-weight: 700; letter-spacing: .2em; z-index: 1;
}
.doc-revoked {
  position: absolute; top: 44%; left: 50%; transform: translate(-50%,-50%) rotate(-16deg);
  border: 5px solid var(--bad); color: var(--bad); font-family: var(--sans); font-weight: 800;
  font-size: 46px; padding: 8px 26px; letter-spacing: .1em; opacity: .78; z-index: 5;
}

table.doc-table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 12px; margin-top: 4mm; }
table.doc-table th, table.doc-table td { border: 1px solid #cdc6b2; padding: 5px 8px; text-align: left; }
table.doc-table th { background: #f6f2e8; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
table.doc-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Halaman verifikasi publik ---------- */
.public-wrap { min-height: 100vh; background: var(--paper); display: flex; flex-direction: column; }
.public-head { background: var(--ink); color: #fff; padding: 14px 22px; display: flex; align-items: center; gap: 12px; }
.public-head b { font-size: 16px; }
.public-head span { color: #93a4b5; font-size: 12.5px; }
.public-body { flex: 1; display: grid; place-items: start center; padding: 34px 18px 60px; }
.verify-card { width: 100%; max-width: 720px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.verify-status { padding: 20px 24px; display: flex; gap: 16px; align-items: center; }
.verify-status.ok { background: var(--ok-tint); border-bottom: 1px solid #bfdfcd; }
.verify-status.bad { background: var(--bad-tint); border-bottom: 1px solid #eec5c5; }
.verify-status .mark { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; color: #fff; }
.verify-status.ok .mark { background: var(--ok); }
.verify-status.bad .mark { background: var(--bad); }
.verify-status h2 { margin: 0; font-size: 17px; }
.verify-status p { margin: 0; font-size: 13px; color: var(--ink-soft); }
dl.kv { display: grid; grid-template-columns: 190px 1fr; gap: 0; margin: 0; font-size: 13.5px; }
dl.kv dt { padding: 9px 24px; color: var(--mute); border-bottom: 1px solid var(--line-soft); font-size: 12.5px; }
dl.kv dd { padding: 9px 24px; margin: 0; border-bottom: 1px solid var(--line-soft); font-weight: 500; }

/* ---------- Cetak ---------- */
@media print {
  .sidebar, .topbar, .doc-toolbar, .no-print, .public-head { display: none !important; }
  body { background: #fff; }
  .doc-sheet { box-shadow: none; margin: 0; width: auto; min-height: auto; padding: 10mm; }
  @page { size: A4 landscape; margin: 8mm; }
  .doc-sheet.portrait ~ * , .portrait { page-break-after: auto; }
}

/* ---------- Responsif ---------- */
@media (max-width: 980px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .exam-layout { grid-template-columns: 1fr; }
  .q-nav { position: static; }
}
@media (max-width: 820px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex: none; }
  .nav { display: flex; flex-wrap: wrap; padding: 6px; }
  .nav a { border-left: 0; border-radius: 3px; padding: 6px 10px; }
  .nav-group { display: none; }
  dl.kv { grid-template-columns: 1fr; }
  dl.kv dt { padding-bottom: 0; border-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
