/* ==========================================================================
   DocTrack — Stylesheet
   ========================================================================== */

/* Zalando Sans — huruf yang dipakai kai.id (lisensi SIL OFL 1.1, lihat fonts/OFL.txt).
   Disimpan lokal karena CSP aplikasi memakai font-src 'self', sekaligus agar
   tampilan tetap benar saat aplikasi dibuka tanpa jaringan.
   Variable font 300–800 supaya bobot antara (550, 620, 650) tetap presisi. */
@font-face {
  font-family: 'Zalando Sans';
  font-style: normal;
  font-weight: 300 800;
  font-stretch: 100%;
  font-display: swap;
  src: url('../fonts/zalando-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Zalando Sans';
  font-style: normal;
  font-weight: 300 800;
  font-stretch: 100%;
  font-display: swap;
  src: url('../fonts/zalando-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Palet mengikuti kai.id: navy indigo sebagai warna utama, oranye sebagai aksen. */
  --bg: #f6f6fc;
  --surface: #ffffff;
  --surface-2: #fcfcfd;
  --surface-3: #f2f2f7;
  --border: #e5e5e5;
  --border-strong: #d1d1d1;
  --text: #18181b;
  --text-2: #4f4f4f;
  --muted: #6a6a6a;
  --primary: #252272;
  --primary-strong: #1a1857;
  --primary-soft: #e9e9fb;
  --primary-contrast: #ffffff;
  --accent: #f06b24;
  --accent-contrast: #18181b;
  --success: #1f7a45;
  --success-soft: #e6f7ee;
  --warning: #a63f16;
  --warning-soft: #fdeee4;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --purple: #4742d7;
  --purple-soft: #e8e7fd;
  --slate: #4f4f4f;
  --slate-soft: #f2f2f7;
  --radius: 12px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --shadow-sm: 0 1px 2px rgba(24, 24, 27, .06);
  --shadow: 0 1px 3px rgba(24, 24, 27, .08), 0 6px 16px -8px rgba(24, 24, 27, .14);
  --shadow-lg: 0 12px 32px -8px rgba(24, 24, 27, .22);
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: "Zalando Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --bg: #0e0e17;
  --surface: #16161f;
  --surface-2: #1b1b26;
  --surface-3: #22222f;
  --border: #2a2a3a;
  --border-strong: #3a3a4d;
  --text: #f2f2f7;
  --text-2: #bcbccb;
  --muted: #8e8e9e;
  --primary: #8f8aff;
  --primary-strong: #a8a4ff;
  --primary-soft: #1e1c3d;
  --primary-contrast: #0e0e17;
  --accent: #ff9a5e;
  --accent-contrast: #0e0e17;
  --success: #4ecb8b;
  --success-soft: #10281d;
  --warning: #f0a06a;
  --warning-soft: #2c1e12;
  --danger: #f28b82;
  --danger-soft: #2d1615;
  --purple: #a5a1ff;
  --purple-soft: #201f3a;
  --slate: #a7a7bb;
  --slate-soft: #1d1d2b;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 8px 20px -10px rgba(0, 0, 0, .6);
  --shadow-lg: 0 16px 40px -10px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::placeholder { color: var(--muted); opacity: 1; }
img { max-width: 100%; display: block; }

/* Ikon inline mengikuti ukuran huruf induknya.
   Tanpa aturan ini, sebuah <svg> tanpa atribut width/height memakai ukuran bawaan
   peramban (300×150 px) lalu diperkecil tidak beraturan oleh flex — itulah sebabnya
   ikon di baris daftar berkas tampak berbeda-beda ukurannya. Aturan yang lebih
   khusus (mis. .btn svg) tetap menang karena lebih spesifik. */
svg { width: 1em; height: 1em; flex: none; }

/* ---------- App bar ---------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(24, 24, 27, .05);
  padding-top: var(--safe-t);
}
.appbar__inner {
  max-width: 1080px;
  margin: 0 auto;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
}
.appbar__logo { width: 24px; height: 24px; flex: none; }
.appbar__titles { flex: 1; min-width: 0; }
.appbar__titles h1 {
  font-size: 1.06rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.appbar__titles p {
  font-size: .78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.appbar__actions { display: flex; align-items: center; gap: 6px; }

.iconbtn {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background .15s;
}
.iconbtn:hover { background: var(--surface-3); }
.iconbtn svg { width: 22px; height: 22px; }
.iconbtn[hidden] { display: none; }

/* ---------- Layout ---------- */
.view {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 14px calc(var(--tabbar-h) + var(--safe-b) + 28px);
  outline: none;
}
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 8px; }
.row--between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.tiny { font-size: .72rem; }
.strong { font-weight: 600; }
.center { text-align: center; }
.right { text-align: right; }
.mono { font-family: var(--mono); }
.hide { display: none !important; }

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.card__head h3 { font-size: .95rem; }
.card__body { padding: 16px; }
.card__body--flush { padding: 0; }

.section-title {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  font-weight: 650;
  margin: 4px 2px 0;
}

/* ---------- Stats ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 620px) { .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat__value { font-size: 1.6rem; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; }
.stat__label { font-size: .76rem; color: var(--muted); font-weight: 550; }
.stat--primary { border-left: 3px solid var(--primary); }
.stat--warning { border-left: 3px solid var(--warning); }
.stat--success { border-left: 3px solid var(--success); }
.stat--danger  { border-left: 3px solid var(--danger); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--surface-3);
  color: var(--text);
  font-weight: 600;
  font-size: .88rem;
  cursor: pointer;
  transition: filter .15s, background .15s;
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { filter: brightness(.97); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--primary); color: var(--primary-contrast); }
.btn--success { background: var(--success); color: #fff; }
.btn--danger { background: var(--danger-soft); color: var(--danger); }
.btn--ghost { background: transparent; border-color: var(--border-strong); }
.btn--sm { padding: 7px 11px; font-size: .8rem; border-radius: var(--radius-xs); }
.btn--block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 100%;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 600;
  transition: color .15s;
  position: relative;
}
.tab svg { width: 23px; height: 23px; }
.tab.is-active { color: var(--primary); }
.tab.is-active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--accent);
}
.tab--add { color: transparent; }
.tab--add svg {
  width: 46px; height: 46px;
  padding: 11px;
  margin-top: -18px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: var(--shadow);
}

/* ---------- Badges / chips ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 650;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--blue { background: var(--primary-soft); color: var(--primary); }
.badge--amber { background: var(--warning-soft); color: var(--warning); }
.badge--green { background: var(--success-soft); color: var(--success); }
.badge--purple { background: var(--purple-soft); color: var(--purple); }
.badge--slate { background: var(--slate-soft); color: var(--slate); }
.badge--red { background: var(--danger-soft); color: var(--danger); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: .8rem;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
}
.chip.is-active { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips--wrap { flex-wrap: wrap; overflow: visible; }

/* ---------- Form ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-2);
}
.field .hint { font-size: .74rem; color: var(--muted); }
.input, .select, .textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 88px; resize: vertical; }

/* ---------- Dikte suara ---------- */
.dictate { position: relative; display: block; }
/* Ruang di kanan supaya teks tidak tertutup tombol mikrofon. */
.dictate .input, .dictate .textarea { padding-right: 44px; }

.dictate__btn {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 30px;
  height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.dictate__btn svg { width: 17px; height: 17px; }
.dictate__btn:hover { color: var(--primary); border-color: var(--primary); }
.dictate__btn:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* Sedang mendengarkan: merah berdenyut, jelas terlihat dari sudut mata. */
.dictate__btn.is-listening {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  animation: dictate-pulse 1.6s ease-in-out infinite;
}
@keyframes dictate-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(180, 35, 24, .5); }
  50% { box-shadow: 0 0 0 7px rgba(180, 35, 24, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .dictate__btn.is-listening { animation: none; }
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.input[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--danger); }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2374839a' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
  padding-right: 34px;
}
.form-grid { display: grid; gap: 14px; }
@media (min-width: 640px) { .form-grid--2 { grid-template-columns: 1fr 1fr; } .form-grid--2 .span-2 { grid-column: 1 / -1; } }

.searchbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
}
.searchbox svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.searchbox input { flex: 1; border: none; background: transparent; padding: 11px 0; min-width: 0; }
.searchbox input:focus { outline: none; }

/* ---------- Berkas list ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }

.berkas-item {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  box-shadow: var(--shadow-sm);
  color: inherit;
  transition: border-color .15s, transform .1s;
}
.berkas-item:hover { border-color: var(--border-strong); }
.berkas-item:active { transform: scale(.994); }
.berkas-item__top { display: flex; align-items: flex-start; gap: 10px; }
.berkas-item__title {
  font-weight: 620;
  font-size: .95rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.berkas-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 7px;
  font-size: .76rem;
  color: var(--muted);
}
.berkas-item__meta span { display: inline-flex; align-items: center; gap: 4px; }
.berkas-item__meta svg { width: 14px; height: 14px; }
.berkas-item__foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px dashed var(--border);
  flex-wrap: wrap;
}
/* Tiap keterangan (lampiran, foto, pemegang) adalah ikon + teks dalam satu baris
   yang sejajar tengah, sehingga ketiganya duduk di garis yang sama. */
.berkas-item__foot > .tiny { display: inline-flex; align-items: center; gap: 4px; }
/* Ukuran ikon disamakan dengan baris meta di atasnya agar kedua baris seimbang. */
.berkas-item__foot svg { width: 14px; height: 14px; }
/* Penanda waktu selalu menempel ke kanan. Dengan margin-left auto, ia tetap rata
   kanan bahkan ketika barisnya membungkus ke baris berikutnya di layar sempit —
   yang tidak terjadi bila jaraknya dipaksakan memakai elemen pengisi. */
.berkas-item__foot .berkas-item__time { margin-left: auto; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 8px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--border);
}
.tl-item { position: relative; padding: 0 0 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -22px; top: 4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 2.5px solid var(--primary);
}
.tl-item--success::before { border-color: var(--success); }
.tl-item--warning::before { border-color: var(--warning); }
.tl-item--danger::before  { border-color: var(--danger); }
.tl-item--muted::before   { border-color: var(--border-strong); background: var(--border-strong); }
.tl-item__title { font-weight: 600; font-size: .88rem; }
.tl-item__time { font-size: .72rem; color: var(--muted); }
.tl-item__detail { font-size: .82rem; color: var(--text-2); margin-top: 2px; white-space: pre-wrap; }

/* ---------- Gallery ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
}
.thumb {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  overflow: hidden;
  background: var(--surface-2);
  aspect-ratio: 1;
  cursor: pointer;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb__file {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; height: 100%; padding: 10px; text-align: center; color: var(--text-2);
}
.thumb__file svg { width: 30px; height: 30px; color: var(--muted); }
.thumb__name { font-size: .68rem; word-break: break-word; line-height: 1.25; }
.thumb__del {
  position: absolute; top: 4px; right: 4px;
  width: 26px; height: 26px; border: none; border-radius: 50%;
  background: rgba(15, 23, 42, .68); color: #fff;
  display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity .15s;
}
.thumb:hover .thumb__del, .thumb:focus-within .thumb__del { opacity: 1; }
.thumb__del svg { width: 15px; height: 15px; }
.thumb__cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 12px 6px 4px;
  font-size: .66rem; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .72));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 18px;
  text-align: center;
  color: var(--muted);
  background: var(--surface-2);
}
.dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); }

/* ---------- Key-value ---------- */
.kv { display: grid; gap: 12px; }
@media (min-width: 640px) { .kv { grid-template-columns: 1fr 1fr; } }
.kv__row { min-width: 0; }
.kv__k { font-size: .74rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kv__v { font-size: .92rem; margin-top: 2px; word-break: break-word; }
.kv__row--full { grid-column: 1 / -1; }

/* ---------- Tabs (in-page) ---------- */
/* Bilah tab detail berkas. Dibiarkan membungkus agar seluruh tab tetap terlihat di layar HP. */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--border);
}

.tabs button {
  padding: 10px 13px;
  border: none;
  background: none;
  color: var(--muted);
  font-weight: 600;
  font-size: .86rem;
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  white-space: nowrap;
}
.tabs button.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs button .count {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-3);
  font-size: .7rem;
}

/* ---------- Empty / loading ---------- */
.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--muted);
}
.empty svg { width: 58px; height: 58px; color: var(--border-strong); margin-bottom: 10px; }
.empty h3 { color: var(--text); font-size: 1rem; margin-bottom: 4px; }
.empty p { font-size: .85rem; max-width: 320px; margin: 0 auto 14px; }

.spinner {
  width: 26px; height: 26px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---------- Bars (simple chart) ---------- */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar { display: grid; grid-template-columns: 96px 1fr 42px; align-items: center; gap: 10px; font-size: .8rem; }
.bar__track { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar__fill { height: 100%; border-radius: 999px; background: var(--primary); transition: width .4s ease; }
.bar__label { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar__val { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }

.spark { display: flex; align-items: flex-end; gap: 5px; height: 120px; padding-top: 8px; }
.spark__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.spark__bar { width: 100%; max-width: 34px; border-radius: 6px 6px 2px 2px; background: var(--primary); min-height: 3px; }
.spark__bar--soft { background: var(--primary-soft); }
.spark__lbl { font-size: .64rem; color: var(--muted); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade .16s ease;
}
@media (min-width: 640px) { .modal-backdrop { align-items: center; } }
@keyframes fade { from { opacity: 0; } }

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow-lg);
  animation: sheet .22s cubic-bezier(.2, .8, .3, 1);
  padding-bottom: var(--safe-b);
}
@media (min-width: 640px) { .modal { border-radius: var(--radius); max-height: 86vh; } }
@keyframes sheet { from { transform: translateY(24px); opacity: .6; } }
.modal__head {
  position: sticky; top: 0;
  background: var(--surface);
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 15px 16px; border-bottom: 1px solid var(--border);
}
.modal__head h3 { font-size: 1rem; }
.modal__body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.modal__foot {
  position: sticky; bottom: 0;
  background: var(--surface);
  display: flex; gap: 8px; padding: 13px 16px; border-top: 1px solid var(--border);
}
.modal__foot .btn { flex: 1; }
.grabber {
  width: 38px; height: 4px; border-radius: 999px; background: var(--border-strong);
  margin: 8px auto -4px;
}

/* ---------- Toast ---------- */
.toast-root {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px);
  z-index: 90;
  display: flex; flex-direction: column; gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: #18181b;
  color: #fff;
  font-size: .85rem;
  box-shadow: var(--shadow-lg);
  animation: toastIn .2s ease;
}
.toast svg { width: 18px; height: 18px; flex: none; }
.toast--success { background: #1f7a45; }
.toast--error { background: #b42318; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 95;
  background: rgba(8, 12, 20, .94);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.lightbox__close {
  position: absolute; top: calc(var(--safe-t) + 12px); right: 14px;
  width: 42px; height: 42px; border: none; border-radius: 50%;
  background: rgba(255, 255, 255, .16); color: #fff;
  display: grid; place-items: center; cursor: pointer;
}
.lightbox__close svg { width: 22px; height: 22px; }
.lightbox__nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border: none; border-radius: 50%;
  background: rgba(255, 255, 255, .16); color: #fff;
  display: grid; place-items: center; cursor: pointer;
}
.lightbox__nav svg { width: 24px; height: 24px; }
.lightbox__nav--prev { left: 12px; }
.lightbox__nav--next { right: 12px; }
.lightbox__cap {
  position: absolute; left: 0; right: 0; bottom: calc(var(--safe-b) + 16px);
  text-align: center; color: #cbd5e1; font-size: .82rem; padding: 0 20px;
}

/* ---------- Banner ---------- */
.banner {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: .84rem;
  border: 1px solid;
}
.banner svg { width: 19px; height: 19px; flex: none; margin-top: 1px; }
.banner--warn { background: var(--warning-soft); border-color: transparent; color: var(--warning); }
.banner--info { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.banner--danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }

/* ---------- Details/summary ---------- */
details.acc {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}
details.acc > summary {
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: .86rem;
  list-style: none;
  display: flex; align-items: center; justify-content: space-between;
}
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::after { content: "+"; color: var(--muted); font-size: 1.1rem; }
details.acc[open] > summary::after { content: "−"; }
details.acc > .acc__body { padding: 0 14px 14px; }

/* ---------- Boot ---------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  background: var(--bg);
}
.boot[hidden] { display: none; }
.boot__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  padding: 24px;
}

/* ---------- Login ---------- */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-t)) 16px calc(24px + var(--safe-b));
  background: linear-gradient(170deg, var(--surface-2), var(--bg) 55%);
}
.login__card {
  width: 100%;
  max-width: 430px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login__brand { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.login__brand h1 { font-size: 1.25rem; }
.login form { display: flex; flex-direction: column; gap: 14px; }
.login__foot { border-top: 1px solid var(--border); padding-top: 14px; }
.login__foot svg { width: 18px; height: 18px; color: var(--muted); flex: none; margin-top: 2px; }

.captcha { display: grid; gap: 10px; }
@media (min-width: 420px) {
  .captcha { grid-template-columns: 190px 1fr; align-items: start; }
}
.captcha__image {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  overflow: hidden;
  background: var(--surface-2);
  min-height: 66px;
  display: grid;
  place-items: center;
}
.captcha__image svg { display: block; width: 100%; height: auto; }
.captcha__side { display: flex; flex-direction: column; gap: 8px; }

/* ---------- Avatar ---------- */
.avatar {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .8rem;
  letter-spacing: .02em;
  background: var(--slate-soft);
  color: var(--slate);
}
/* Avatar karakter (SVG) dan foto unggahan sama-sama berupa <img> di dalam lingkaran. */
img.avatar { object-fit: cover; display: block; padding: 0; }

.avatar--admin { background: var(--purple-soft); color: var(--purple); }
.avatar--ketua_penguji { background: var(--primary-soft); color: var(--primary); }
.avatar--anggota_penguji { background: var(--success-soft); color: var(--success); }
.avatar--guest { background: var(--slate-soft); color: var(--slate); }

/* ---------- Foto profil & pilihan avatar ---------- */
.avatar--foto { background: var(--surface-3); border: 1px solid var(--border); }
.avatar--lg { width: 74px; height: 74px; font-size: 1.35rem; }

/* ---------- Login biometri & keamanan akun ---------- */
.login__atau {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 10px;
  color: var(--muted);
  font-size: .74rem;
}
.login__atau::before, .login__atau::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.biometri-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
}

.avatar-picker { display: grid; grid-template-columns: repeat(4, max-content); gap: 8px 10px; }
.avatar-choice {
  padding: 3px;
  border: 2px solid transparent;
  border-radius: 50%;
  background: none;
  line-height: 0;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.avatar-choice:hover { transform: scale(1.07); }
.avatar-choice.is-active { border-color: var(--primary); }

/* ---------- User list ---------- */
.user-list { display: flex; flex-direction: column; }
.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.user-row:last-child { border-bottom: none; }

/* ---------- Sign steps ---------- */
.sign-steps { display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 700px) {
  .sign-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }
}
.sign-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.sign-step__mark {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--muted);
}
.sign-step__mark svg { width: 16px; height: 16px; }
.sign-step__title { font-weight: 650; font-size: .86rem; }
.sign-step__name { font-size: .84rem; color: var(--text-2); }
.sign-step.is-done { border-color: var(--success); background: var(--success-soft); }
.sign-step.is-done .sign-step__mark { background: var(--success); color: #fff; }

/* ---------- Misc ---------- */
.divider { height: 1px; background: var(--border); margin: 4px 0; }
.secret {
  font-family: var(--mono);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary);
  text-align: center;
  word-break: break-all;
  user-select: all;
}
.tab span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Tanda tangan langsung (bypass) ---------- */
.bypass {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  margin: 10px 0;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
}
.bypass input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  flex: none;
  accent-color: var(--danger);
  cursor: pointer;
}
.bypass b { display: block; font-size: .86rem; }
.bypass .tiny { display: block; margin-top: 3px; line-height: 1.45; }

/* ---------- Ikon semantik ---------- */
.icon--warn { color: var(--warning); }

/* ---------- Logo perusahaan ---------- */
.brand-logo { width: 168px; height: auto; }
.about-logo { width: 150px; height: auto; margin: 0 auto 10px; }
.boot__logo { width: 190px; height: auto; }

/* Logo sudah berlatar putih; pada tema gelap sudutnya dibulatkan agar tampak sebagai kartu putih. */
html[data-theme="dark"] .appbar__logo,
html[data-theme="dark"] .brand-logo,
html[data-theme="dark"] .about-logo,
html[data-theme="dark"] .boot__logo {
  border-radius: 8px;
}

/* ---------- Print ---------- */
@media print {
  .appbar, .tabbar, .toast-root, .login, .boot, .no-print { display: none !important; }
  .view { padding: 0; max-width: none; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
}
