:root {
  --blue: #2179b5;
  --blue-dark: #1b6496;
  --red: #e53935;
  --teal: #1a9bb5;
  --text: #1f2d3d;
  --muted: #8a96a3;
  --card: #ffffff;
  --bg: #f4f6f8;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #12171d; --card: #1d252e; --text: #e8edf2; --muted: #8b98a6; }
}
:root[data-theme="dark"] { --bg: #12171d; --card: #1d252e; --text: #e8edf2; --muted: #8b98a6; }

* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
}
button, input, textarea { font: inherit; }
.app { max-width: 430px; margin: 0 auto; background: var(--bg); min-height: 100vh; }

/* header */
.top {
  background: var(--blue); color: #fff; padding: 18px 16px 70px;
  display: flex; justify-content: space-between; align-items: flex-start;
  border-radius: 0 0 28px 28px;
}
.nama { font-size: 20px; font-weight: 600; letter-spacing: .3px; }
.nip { font-size: 15px; opacity: .95; margin-top: 4px; word-break: break-all; }
.logout {
  background: var(--red); border-radius: 12px; width: 52px; height: 48px;
  display: flex; align-items: center; justify-content: center; text-decoration: none;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

/* kartu info */
.card {
  background: var(--card); color: var(--text); margin: -56px 16px 0; border-radius: 16px;
  padding: 16px; box-shadow: 0 4px 14px rgba(0,0,0,.08); position: relative;
}
.row { display: flex; justify-content: space-between; font-size: 14px; gap: 8px; }
.sep { border-top: 1px solid #e3e8ee; margin: 14px 0; }
.card h3 { margin: 0 0 8px; font-size: 15px; }
.today { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.today li { padding: 8px 0; border-bottom: 1px dashed #e3e8ee; }
.today li:last-child { border-bottom: 0; }
.today b { color: var(--teal); }
.today small { color: var(--muted); }
.muted { color: var(--muted); }

/* menu */
.menu { padding: 24px 16px; display: flex; justify-content: center; }
.menu-btn {
  background: var(--card); color: var(--text); border: 0; border-radius: 14px;
  padding: 14px 18px; width: 100%; max-width: 180px; display: flex; flex-direction: column;
  align-items: center; gap: 6px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.1);
  font-size: 14px;
}
.menu-btn .ico {
  width: 52px; height: 52px; border-radius: 12px; background: var(--card);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}

/* modal */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal[hidden] { display: none; }
.sheet {
  background: var(--card); color: var(--text); border-radius: 18px; padding: 20px;
  width: 100%; max-width: 380px; position: relative; max-height: 92vh; overflow: auto;
}
.sheet-title { text-align: center; margin: 0 0 14px; font-size: 15px; }
.close {
  position: absolute; top: -10px; right: -10px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: var(--red); color: #fff; font-size: 22px; cursor: pointer;
}
.choice {
  display: block; width: 100%; margin: 10px 0; padding: 18px; border-radius: 12px;
  border: 1px solid #dfe5ec; background: var(--card); color: var(--text); font-size: 16px;
  cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.07);
}
.choice:disabled { opacity: .4; cursor: not-allowed; }
.hint { font-size: 13px; color: var(--muted); text-align: center; margin: 8px 0 0; }

.full { background: #000; padding: 0; }
.cam { width: 100%; height: 100%; position: relative; max-width: 480px; margin: 0 auto; }
.cam video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.cam-bar {
  position: absolute; left: 0; right: 0; bottom: 24px; display: flex;
  justify-content: space-evenly; align-items: center;
}
.round {
  width: 46px; height: 46px; border-radius: 50%; border: 0; background: #fff; color: #333;
  font-size: 22px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.shutter {
  width: 72px; height: 72px; border-radius: 50%; border: 5px solid #fff;
  background: var(--red); cursor: pointer;
}

#preview { width: 100%; border-radius: 12px; display: block; margin-top: 6px; }
.retake {
  margin: 10px 0 14px; background: none; border: 0; color: var(--blue); cursor: pointer;
  padding: 0; font-size: 14px; text-decoration: underline;
}
.field-label { display: block; font-size: 14px; margin-bottom: 6px; }
textarea {
  width: 100%; border: 2px solid #9fd4ec; border-radius: 12px; padding: 10px;
  background: var(--card); color: var(--text); resize: vertical;
}
.counter { text-align: right; font-size: 13px; color: var(--muted); margin: 6px 0 14px; }
.counter span { color: var(--red); font-weight: 600; }
.btn-primary {
  width: 100%; padding: 13px; border: 0; border-radius: 12px; background: #4caf50;
  color: #fff; font-size: 16px; font-weight: 600; cursor: pointer;
}
.btn-primary:disabled { background: #9ccfa0; cursor: not-allowed; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #263238; color: #fff; padding: 12px 18px; border-radius: 10px;
  font-size: 14px; max-width: 90%; z-index: 60; box-shadow: 0 4px 12px rgba(0,0,0,.3);
}
.toast[hidden] { display: none; }

/* login */
.login-page { background: var(--blue); }
.login {
  background: var(--card); color: var(--text); max-width: 380px; margin: 12vh auto 0;
  padding: 26px 22px; border-radius: 18px; box-shadow: 0 6px 20px rgba(0,0,0,.2);
}
.login h1 { font-size: 20px; margin: 0 0 4px; }
.login .sub { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.login label { display: block; font-size: 14px; margin-bottom: 14px; }
.login input {
  display: block; width: 100%; margin-top: 6px; padding: 12px; border-radius: 10px;
  border: 1px solid #cfd8e0; background: var(--card); color: var(--text);
}
.alert {
  background: #fdecea; color: #b71c1c; padding: 10px 12px; border-radius: 10px;
  font-size: 14px; margin-bottom: 14px;
}
.ok { background: #e8f5e9; color: #1b5e20; padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 14px; }
.aktivasi { margin-top: 18px; border-top: 1px solid #e3e8ee; padding-top: 14px; font-size: 14px; }
.aktivasi summary { cursor: pointer; color: var(--blue); margin-bottom: 12px; }
.login .hint { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.sheet.success { text-align: center; max-width: 340px; }
.ok-ico {
  width: 68px; height: 68px; border-radius: 50%; background: #4caf50; color: #fff;
  font-size: 36px; display: flex; align-items: center; justify-content: center; margin: 4px auto 12px;
}
.sheet.success .sheet-title { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.sheet.success .hint { margin-bottom: 18px; }

/* status verifikasi */
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.badge.diajukan { background: #fff3cd; color: #7a5d00; }
.badge.diverifikasi { background: #e8f5e9; color: #1b5e20; }
.badge.ditolak { background: #fdecea; color: #b71c1c; }
.badge.belum { background: #eceff1; color: #455a64; }
.tolak { color: #b71c1c; }

/* admin */
.admin-body { background: #f4f6f8; color: #1f2d3d; }
.admin-top {
  background: var(--blue); color: #fff; padding: 14px 18px; display: flex;
  justify-content: space-between; align-items: center;
}
.admin-title { font-size: 17px; font-weight: 600; }
.admin-sub { font-size: 13px; opacity: .9; }
.admin-logout { color: #fff; border: 1px solid #fff; border-radius: 8px; padding: 6px 12px; text-decoration: none; font-size: 14px; }
.admin-nav { background: #fff; padding: 0 12px; display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid #e3e8ee; }
.admin-nav a { padding: 12px 10px; text-decoration: none; color: #455a64; white-space: nowrap; border-bottom: 3px solid transparent; font-size: 14px; }
.admin-nav a.on { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }
.admin-main { padding: 16px; max-width: 1200px; margin: 0 auto; }
.admin-main h2 { font-size: 18px; margin: 4px 0 10px; }
.flash { background: #e3f2fd; color: #0d47a1; padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; }
.filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; background: #fff; padding: 12px; border-radius: 10px; margin-bottom: 12px; }
.filter label { font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.filter input, .filter select, .inline input { padding: 7px 8px; border: 1px solid #cfd8e0; border-radius: 8px; font: inherit; }
.filter .btn-primary { width: auto; padding: 9px 16px; }
.btn-csv { background: #37474f; color: #fff; text-decoration: none; padding: 9px 14px; border-radius: 8px; font-size: 14px; align-self: flex-end; }
.summary { font-size: 14px; margin: 4px 0 10px; }
.table-wrap { overflow-x: auto; background: #fff; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.admin-main table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-main th, .admin-main td { padding: 9px 10px; border-bottom: 1px solid #eef1f4; text-align: left; vertical-align: top; }
.admin-main th { background: #f7f9fb; font-weight: 600; white-space: nowrap; }
.admin-main td.num { text-align: center; }
.admin-main td.ket { max-width: 240px; }
.aksi { display: flex; flex-direction: column; gap: 6px; min-width: 180px; }
.aksi input { padding: 6px 8px; border: 1px solid #cfd8e0; border-radius: 6px; font: inherit; font-size: 13px; }
.aksi-btn { display: flex; gap: 6px; }
.aksi-btn button, .btn-small, .btn-ok, .btn-no {
  border: 0; border-radius: 6px; padding: 6px 10px; color: #fff; cursor: pointer; font-size: 13px;
}
.btn-ok { background: #2e7d32; }
.btn-no { background: #c62828; }
.btn-small { background: var(--blue); }
.inline { display: inline-flex; gap: 6px; align-items: center; margin: 2px 0; }
.muted { color: #8a96a3; }
.admin-main p.muted { font-size: 14px; }
