:root {
  --purple: #2563eb;
  --purple-dark: #1e3a8a;
  --purple-bg: rgba(37, 99, 235, .16);
  --cyan: #22d3ee;
  --green: #34d399;
  --green-bg: rgba(52, 211, 153, .16);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, .16);
  --amber: #fbbf24;
  --amber-bg: rgba(251, 191, 36, .16);
  --gray: #97a0c3;
  --border: rgba(255, 255, 255, .10);
  --text: #eef1fb;
  --bg: #090c16;
  --surface: rgba(255, 255, 255, .045);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 8% -10%, rgba(37, 99, 235, .16), transparent 35%),
    radial-gradient(circle at 100% 0%, rgba(34, 211, 238, .10), transparent 32%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cyan); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .24); }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--purple), var(--purple-dark));
  color: #fff;
  box-shadow: 0 4px 16px rgba(37, 99, 235, .32);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, opacity .15s ease;
}
button:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(37, 99, 235, .45); }
button:active { transform: translateY(0); }
button.secondary { background: rgba(255, 255, 255, .06); color: var(--text); border: 1.5px solid var(--border); box-shadow: none; }
button.secondary:hover { background: rgba(255, 255, 255, .10); border-color: var(--purple); box-shadow: none; }
button.danger { background: linear-gradient(135deg, #f87171, #dc2626); box-shadow: 0 4px 16px rgba(248, 113, 113, .32); }
button.danger:hover { box-shadow: 0 8px 22px rgba(248, 113, 113, .45); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  background: rgba(255, 255, 255, .045);
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input::placeholder, textarea::placeholder { color: rgba(238, 241, 251, .34); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--purple);
  background: rgba(255, 255, 255, .07);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .20);
}
input:disabled { opacity: .55; }
input[type="checkbox"], input[type="radio"] {
  width: auto; padding: 0; background: none; border: none; box-shadow: none;
  accent-color: var(--purple);
}
label { font-size: 12.5px; font-weight: 600; color: var(--gray); text-transform: uppercase; letter-spacing: .04em; display: block; margin: 10px 0 4px; }

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.center-screen::before {
  content: '';
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 20% 20%, rgba(37, 99, 235, .38), transparent 40%),
    radial-gradient(circle at 85% 15%, rgba(34, 211, 238, .26), transparent 35%),
    radial-gradient(circle at 50% 100%, rgba(37, 99, 235, .20), transparent 45%);
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
}
.center-screen > * { position: relative; z-index: 1; }

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .025));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .06);
  border: 1px solid var(--border);
  padding: 24px;
}
.brand { text-align: center; margin-bottom: 18px; }
.brand h1 {
  font-size: 21px; margin: 4px 0 0; font-weight: 800;
  background: linear-gradient(120deg, #fff, var(--cyan) 120%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand .tag { font-size: 11.5px; color: var(--gray); text-transform: uppercase; letter-spacing: .14em; }
.pin-dots { display: flex; gap: 10px; justify-content: center; margin: 16px 0; }
.pin-dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--purple); transition: background .15s ease, box-shadow .15s ease; }
.pin-dots span.filled { background: var(--purple); box-shadow: 0 0 12px rgba(37, 99, 235, .7); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button { background: rgba(255, 255, 255, .05); color: var(--text); border: 1px solid var(--border); box-shadow: none; font-size: 20px; padding: 16px 0; }
.keypad button:hover { background: rgba(255, 255, 255, .09); transform: none; }

.topbar {
  background: rgba(9, 12, 22, .78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
}
.topbar::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, var(--purple), var(--cyan));
  opacity: .55;
}
.topbar .who { font-size: 13px; opacity: .75; }
.topbar h2 { margin: 0; font-size: 16px; }

.app-shell { max-width: 480px; margin: 0 auto; padding: 16px; padding-bottom: 90px; }
.wide-shell { max-width: 1100px; margin: 0 auto; padding: 20px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px 4px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 700; border: 1px solid transparent;
}
.badge.ok, .badge.done, .badge.OK, .badge.DONE { background: var(--green-bg); color: var(--green); border-color: rgba(52, 211, 153, .3); }
.badge.mismatch, .badge.at_risk, .badge.MISMATCH, .badge.AT_RISK { background: var(--red-bg); color: var(--red); border-color: rgba(248, 113, 113, .3); }
.badge.pending, .badge.PENDING { background: var(--amber-bg); color: var(--amber); border-color: rgba(251, 191, 36, .3); }
.badge.no_gps, .badge.NO_GPS, .badge.no_shift, .badge.NO_SHIFT { background: rgba(255, 255, 255, .06); color: var(--gray); border-color: var(--border); }

.scan-box {
  border: 2px dashed rgba(37, 99, 235, .5);
  border-radius: 18px;
  padding: 22px;
  text-align: center;
  background: var(--purple-bg);
  margin-bottom: 16px;
  transition: box-shadow .2s ease;
}
.scan-box.scanned { border-style: solid; border-color: rgba(52, 211, 153, .55); background: var(--green-bg); box-shadow: 0 0 34px rgba(52, 211, 153, .22); }
.scan-box.mismatch-box { border-style: solid; border-color: rgba(248, 113, 113, .55); background: var(--red-bg); box-shadow: 0 0 34px rgba(248, 113, 113, .22); }
.scan-box .loc { font-size: 18px; font-weight: 700; margin: 6px 0; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border-bottom: 1px solid var(--border); padding: 8px; text-align: left; }
th { color: var(--gray); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr { transition: background-color .12s ease; }
tbody tr:hover { background: rgba(255, 255, 255, .03); }
tr.unsynced td { color: var(--gray); }
tr.synced td { color: var(--green); }

.modules-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 8px; }
.modules-picker .dept-group { background: rgba(255,255,255,.03); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.modules-picker .dept-group .dept-name { font-weight: 700; font-size: 13px; margin-bottom: 6px; color: var(--text); }
.modules-picker label.mod-check { display: flex; align-items: center; gap: 8px; font-size: 13px; text-transform: none; margin: 4px 0; color: var(--gray); font-weight: 400; cursor: pointer; }
.modules-picker label.mod-check input[type="checkbox"] { width: auto; }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 700px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

.photo-preview { max-width: 100%; border-radius: 12px; margin-top: 8px; border: 1px solid var(--border); }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: rgba(18, 22, 40, .95); backdrop-filter: blur(12px);
  border: 1px solid var(--border); color: var(--text);
  padding: 10px 18px; border-radius: 12px;
  font-size: 14px; z-index: 100; opacity: 0; transition: opacity .2s;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  pointer-events: none; /* never let the (invisible-but-still-in-the-DOM) toast box
    swallow taps meant for whatever sits underneath it — e.g. the fixed
    "Kirim ke Server" bar at the bottom of the officer screen. */
}
.toast.show { opacity: 1; }
.muted { color: var(--gray); font-size: 13px; }
.offline-banner {
  background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(251, 191, 36, .3);
  padding: 8px 14px; border-radius: 12px;
  font-size: 13px; text-align: center; margin-bottom: 12px; font-weight: 600;
}
.section-title { font-weight: 700; margin: 22px 0 10px; font-size: 15px; color: var(--text); letter-spacing: .01em; }
.footer-actions {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(9, 12, 22, .85); backdrop-filter: blur(16px);
  border-top: 1px solid var(--border); padding: 12px 16px; display: flex; gap: 10px;
}
.footer-actions .app-shell-inner { max-width: 480px; margin: 0 auto; display: flex; gap: 10px; width: 100%; }

/* ---- Icons & icon-forward components ---- */
svg { display: block; flex-shrink: 0; }
button svg, .btn-icon svg { vertical-align: middle; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }

.icon-badge {
  width: 42px; height: 42px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  background: var(--purple-bg); color: var(--purple);
  border: 1px solid rgba(37, 99, 235, .28);
  flex-shrink: 0;
}
.icon-badge.green { background: var(--green-bg); color: var(--green); border-color: rgba(52, 211, 153, .3); }
.icon-badge.red { background: var(--red-bg); color: var(--red); border-color: rgba(248, 113, 113, .3); }
.icon-badge.amber { background: var(--amber-bg); color: var(--amber); border-color: rgba(251, 191, 36, .3); }
.icon-badge.gray { background: rgba(255, 255, 255, .06); color: var(--gray); border-color: var(--border); }

.brand-mark {
  width: 54px; height: 54px; border-radius: 17px; margin: 0 auto 10px;
  background: linear-gradient(155deg, var(--purple), var(--cyan));
  display: flex; align-items: center; justify-content: center; color: #fff;
  box-shadow: 0 10px 28px rgba(37, 99, 235, .45), 0 0 0 1px rgba(255, 255, 255, .08) inset;
}

/* Module list: icon + title + one-line helper text, easier for non-technical staff to scan */
.module-list button {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, .035);
  color: var(--text);
  border: 1.5px solid var(--border);
  margin-bottom: 10px;
  font-weight: 600;
  padding: 14px 16px;
  box-shadow: none;
}
.module-list button:hover { border-color: var(--purple); background: rgba(37, 99, 235, .10); box-shadow: 0 8px 24px rgba(37, 99, 235, .18); }
.module-list button .module-copy { flex: 1; min-width: 0; }
.module-list button .module-title { display: block; font-size: 15px; font-weight: 700; color: var(--text); }
.module-list button .module-desc { display: block; font-size: 12.5px; font-weight: 400; color: var(--gray); margin-top: 2px; }
.module-list button .chev { color: var(--gray); }

.scan-box .scan-icon { width: 44px; height: 44px; margin: 0 auto 8px; }

.stat-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02));
  border: 1px solid var(--border); border-radius: 16px; padding: 16px;
  display: flex; align-items: flex-start; gap: 12px;
  transition: transform .15s ease, border-color .15s ease;
}
.stat-card:hover { transform: translateY(-2px); border-color: rgba(37, 99, 235, .3); }
.stat-card .stat-body { min-width: 0; }
.stat-card .num { font-size: 25px; font-weight: 800; color: var(--text); line-height: 1.1; }
.stat-card .lbl { font-size: 11.5px; color: var(--gray); text-transform: uppercase; letter-spacing: .04em; margin-top: 3px; }
.stat-card.alert .num { color: var(--red); }
.stat-card.alert .icon-badge { background: var(--red-bg); color: var(--red); border-color: rgba(248, 113, 113, .35); }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1.5px solid var(--border); flex-wrap: wrap; }
.tabs button { background: transparent; color: var(--gray); border-radius: 10px 10px 0 0; padding: 10px 16px; box-shadow: none; display: inline-flex; align-items: center; gap: 7px; }
.tabs button:hover { background: rgba(255, 255, 255, .04); transform: none; box-shadow: none; }
.tabs button.active { color: var(--text); background: var(--purple-bg); box-shadow: inset 0 -2px 0 var(--purple); }

.empty-state { text-align: center; padding: 32px 16px; color: var(--gray); }
.empty-state svg { margin: 0 auto 10px; opacity: .45; }
.empty-state .empty-title { font-weight: 700; color: var(--text); margin-bottom: 4px; }
.empty-state .empty-hint { font-size: 13px; }

.hint-banner {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--purple-bg); color: var(--text);
  border: 1px solid rgba(37, 99, 235, .25);
  border-radius: 13px; padding: 12px 14px; font-size: 13px; margin-bottom: 14px;
}
.hint-banner svg { margin-top: 1px; color: var(--purple); }

.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  color: #fff; font-size: 11px; font-weight: 800; margin-right: 6px; flex-shrink: 0;
}
