:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-2: #273449;
  --line: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --brand: #2563eb;
  --brand-2: #1d4ed8;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: #60a5fa; }
.hidden { display: none !important; }

/* ---- Layout ---- */
.wrap { max-width: 480px; margin: 0 auto; padding: 16px; }
.wrap-wide { max-width: 1100px; margin: 0 auto; padding: 16px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar .brand { font-weight: 700; letter-spacing: .3px; }
.topbar .brand small { color: var(--muted); font-weight: 400; display: block; font-size: 11px; }
.topbar .user { font-size: 13px; color: var(--muted); text-align: right; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin-bottom: 16px;
}
.card h2 { margin: 0 0 14px; font-size: 16px; }
.card h3 { margin: 0 0 10px; font-size: 14px; color: var(--muted); font-weight: 600; }

/* ---- Form ---- */
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
input, select, textarea {
  width: 100%; padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font-size: 15px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
textarea { font-family: inherit; resize: vertical; min-height: 52px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 10px; padding: 12px 16px; font-size: 15px; font-weight: 600;
  background: var(--brand); color: #fff; cursor: pointer; width: 100%;
  transition: filter .15s, opacity .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ok { background: var(--ok); }
.btn.warn { background: var(--warn); }
.btn.bad { background: var(--bad); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.sm { width: auto; padding: 7px 12px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* ---- Alert ---- */
.alert { padding: 12px 14px; border-radius: 10px; font-size: 14px; margin: 12px 0; line-height: 1.4; }
.alert.ok { background: #052e16; color: #bbf7d0; border: 1px solid #166534; }
.alert.bad { background: #450a0a; color: #fecaca; border: 1px solid #991b1b; }
.alert.warn { background: #451a03; color: #fde68a; border: 1px solid #92400e; }
.alert.info { background: #0c2a4d; color: #bfdbfe; border: 1px solid #1e40af; }

/* ---- Camera & absen ---- */
.cam-box {
  position: relative; width: 100%; aspect-ratio: 3/4; max-height: 380px;
  background: #000; border-radius: var(--radius); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.cam-box video, .cam-box img, .cam-box canvas { width: 100%; height: 100%; object-fit: cover; }
.cam-box .placeholder { color: var(--muted); font-size: 14px; text-align: center; padding: 20px; }

.geo-status {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 10px; background: var(--panel-2);
  border: 1px solid var(--line); font-size: 14px; margin: 12px 0;
}
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 4px #16a34a33; }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 4px #dc262633; }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 4px #d9770633; }

.status-list { list-style: none; padding: 0; margin: 0; }
.status-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.status-list li:last-child { border-bottom: none; }
.badge { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.masuk { background: #052e16; color: #86efac; }
.badge.pulang { background: #451a03; color: #fdba74; }
.badge.late { background: #450a0a; color: #fca5a5; }
.badge.ontime { background: #052e16; color: #86efac; }
.badge.neutral { background: #273449; color: #cbd5e1; }
.badge.offsite { background: #4a1d95; color: #ddd6fe; }

/* ---- Tabel admin ---- */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 9px 16px; border-radius: 999px; background: var(--panel);
  border: 1px solid var(--line); cursor: pointer; font-size: 14px; color: var(--muted);
}
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pill { display: inline-block; min-width: 18px; padding: 1px 6px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; text-align: center; }

.table-scroll { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: var(--panel-2); color: var(--muted); font-weight: 600; position: sticky; top: 0; }
tr:hover td { background: #ffffff08; }
td .thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; cursor: pointer; border: 1px solid var(--line); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .num { font-size: 28px; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: 13px; margin-top: 4px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters > div { flex: 1; min-width: 130px; }
.filters label { margin-top: 0; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.muted { color: var(--muted); font-size: 13px; }
.muted.sm { font-size: 12px; margin-top: 6px; }

/* pemisah bagian pada formulir panjang (mis. halaman daftar) */
.form-sec {
  margin: 22px 0 4px; padding-bottom: 6px; border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
}
.form-sec:first-child { margin-top: 8px; }
.right { text-align: right; }
.center { text-align: center; }

/* modal foto */
.modal { position: fixed; inset: 0; background: #000c; display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal img { max-width: 100%; max-height: 85vh; border-radius: 10px; }
.modal .close { position: absolute; top: 16px; right: 20px; font-size: 30px; color: #fff; cursor: pointer; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 360px; }
.login-card .logo { text-align: center; margin-bottom: 20px; }
.login-card .logo .big { font-size: 22px; font-weight: 700; }
.login-card .logo .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---- Brand / logo (mengganti placeholder emoji lama) ---- */
.topbar .brand .brand-mark { height: 22px; width: 22px; vertical-align: -5px; margin-right: 7px; }
.topbar .topbar-logo { height: 30px; width: auto; display: block; }
.login-card .logo .brand-logo { width: 210px; max-width: 82%; height: auto; margin-bottom: 4px; }
