@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #0A1128;
  --surface: #131B3D;
  --surface-2: #1A2450;
  --line: #2B3568;
  --teal: #4C6EF5;
  --violet: #6C63FF;
  --success: #3DDC97;
  --warning: #FFB020;
  --text: #E8ECF4;
  --text-muted: #8892A6;
  --radius: 20px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-image:
    radial-gradient(circle at 50% 0%, rgba(76, 110, 245, 0.08), transparent 60%);
}

h1, h2, h3, .display {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  margin: 0;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Layout umum ---------- */
.screen {
  max-width: 420px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 20px 40px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.topbar .brand-logo {
  height: 26px;
  width: auto;
  display: block;
}

.topbar .logo-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 12px var(--teal);
}

.topbar span {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------- Jam & tanggal (hero) ---------- */
.clock-wrap {
  text-align: center;
  margin-bottom: 24px;
}

.clock {
  font-size: 56px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  line-height: 1;
}

.date {
  color: var(--text-muted);
  font-size: 15px;
  margin-top: 8px;
}

/* ---------- Radar visual ---------- */
.radar-zone {
  position: relative;
  width: 240px;
  height: 240px;
  margin: 8px auto 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radar-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(76, 110, 245, 0.25);
}
.radar-ring.r1 { width: 100%; height: 100%; }
.radar-ring.r2 { width: 70%; height: 70%; }
.radar-ring.r3 { width: 42%; height: 42%; }

.radar-sweep {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(76,110,245,0.35), transparent 35%);
  animation: spin 3s linear infinite;
}

.radar-sweep.idle { animation-play-state: paused; opacity: 0.35; }

@keyframes spin { to { transform: rotate(360deg); } }

.radar-center {
  position: relative;
  z-index: 2;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 15px;
}

/* ---------- Kartu & elemen ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

select, input[type="password"], input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
}

.pin-dots {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 6px 0 4px;
}
.pin-dots .dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  transition: background 0.15s, border-color 0.15s;
}
.pin-dots .dot.filled { background: var(--teal); border-color: var(--teal); }

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
}
.keypad button {
  padding: 16px 0;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 20px;
  font-family: 'Space Grotesk', sans-serif;
}
.keypad button:active { background: var(--line); }
.keypad button.wide { grid-column: span 1; }

.btn-primary {
  width: 100%;
  padding: 17px;
  border-radius: 14px;
  background: var(--teal);
  color: #FFFFFF;
  font-weight: 600;
  font-size: 16px;
  font-family: 'Space Grotesk', sans-serif;
  transition: transform 0.1s, opacity 0.15s;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.4; }

.btn-secondary {
  width: 100%;
  padding: 15px;
  border-radius: 14px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 15px;
  margin-top: 10px;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 10px;
  font-size: 14px;
}

/* ---------- Status list ---------- */
.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.status-row:last-child { border-bottom: none; }
.status-row .label { color: var(--text-muted); font-size: 14px; }
.status-row .value { font-family: 'Space Grotesk', sans-serif; font-weight: 600; }
.status-row .value.done { color: var(--success); }
.status-row .value.pending { color: var(--text-muted); }

/* ---------- Overlay kamera ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 16, 0.92);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
}

.overlay.hidden { display: none; }

.gps-frame {
  width: 84px;
  height: 84px;
  margin-bottom: 24px;
}

.gps-spinner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid var(--line);
  border-top-color: var(--teal);
  animation: spin 1s linear infinite;
}

.overlay-text {
  color: var(--text-muted);
  text-align: center;
  font-size: 14px;
  margin-bottom: 20px;
  max-width: 280px;
}

.overlay-actions {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 280px;
}
.overlay-actions button { flex: 1; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 14px 20px;
  border-radius: 14px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 60;
  max-width: 320px;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.toast.error { border-color: var(--warning); }
.toast.success { border-color: var(--success); }

/* ---------- Admin ---------- */
.admin-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}
.stat-card .num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 600;
}
.stat-card .lbl {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}
.stat-card.accent .num { color: var(--teal); }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 16px;
  overflow: hidden;
}
th, td {
  text-align: left;
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
}
th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
}
tr:last-child td { border-bottom: none; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  background: rgba(61, 220, 151, 0.12);
  color: var(--success);
}
.badge.out {
  background: rgba(255, 176, 32, 0.12);
  color: var(--warning);
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.toolbar input, .toolbar select {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}
.toolbar button {
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 14px;
}

.recap-grid-wrap { overflow-x: auto; border-radius: 16px; }
table.recap-grid { min-width: 700px; }
table.recap-grid th, table.recap-grid td { text-align: center; padding: 8px 10px; font-size: 12px; }
table.recap-grid th:first-child, table.recap-grid td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); min-width: 140px; }
.cell-hadir { color: var(--success); font-weight: 600; }
.cell-luar { color: var(--warning); font-weight: 600; }
.cell-cuti { color: var(--violet); font-weight: 600; }
.cell-sakit { color: #ff7aa8; font-weight: 600; }
.cell-izin { color: #ffcf5c; font-weight: 600; }
.cell-kosong { color: var(--line); }
