:root {
  --brand: #4f46e5;
  --brand-dark: #3730a3;
  --brand-soft: #eef2ff;
  --brand-2: #7c3aed;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-primary: #4f46e5;
  --bs-primary-rgb: 79, 70, 229;
  --bs-link-color-rgb: 79, 70, 229;
}

body { background: #f1f5f9; color: var(--ink); }

.app-hero {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
  padding: 1.1rem 0 3.6rem;
}
.app-hero .brand-icon {
  width: 42px; height: 42px; border-radius: 12px;
  background: rgba(255,255,255,.18);
  display: grid; place-items: center; font-size: 1.3rem;
}
.app-hero .clock { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.6rem; line-height: 1; }
.app-hero .btn-hero { white-space: nowrap; }
.app-hero a.btn-hero {
  background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.25);
}
.app-hero a.btn-hero:hover { background: rgba(255,255,255,.28); }

.app-main { margin-top: -2.8rem; }

.card-soft {
  border: 0; border-radius: 1.1rem;
  box-shadow: 0 1px 2px rgba(15,23,42,.05), 0 8px 24px rgba(15,23,42,.06);
}

.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark); --bs-btn-active-bg: var(--brand-dark); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }

/* Kamera */
.cam-wrap {
  position: relative; aspect-ratio: 3 / 4; max-height: 62vh;
  background: #0b1020; border-radius: 1rem; overflow: hidden; margin-inline: auto;
}
@media (min-width: 576px) { .cam-wrap { aspect-ratio: 4 / 3; } }
.cam-wrap video, .cam-wrap canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1);
}
.cam-guide {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%);
  width: 58%; aspect-ratio: 3 / 4; border-radius: 50%;
  border: 3px dashed rgba(255,255,255,.45); pointer-events: none; transition: border-color .2s;
}
.cam-guide.ok { border-color: rgba(34,197,94,.95); border-style: solid; }
.cam-guide.bad { border-color: rgba(239,68,68,.9); }
.cam-hint {
  position: absolute; left: 0; right: 0; bottom: 0; padding: .7rem .9rem;
  background: linear-gradient(transparent, rgba(0,0,0,.75)); color: #fff;
  font-size: .9rem; font-weight: 500; text-align: center;
}
.cam-loading {
  position: absolute; inset: 0; display: grid; place-items: center; color: #cbd5e1;
  text-align: center; font-size: .9rem; padding: 1rem;
}

/* Chip status */
.chips { display: flex; gap: .4rem; }
.chips > .chip { flex: 1 1 0; min-width: 0; }
.chip {
  display: flex; flex-direction: column; align-items: center; gap: .1rem;
  padding: .45rem .3rem; border-radius: .75rem; font-size: .72rem; font-weight: 600;
  background: #f1f5f9; color: var(--muted); border: 1px solid var(--line); text-align: center; line-height: 1.15;
}
.chip i { font-size: 1.05rem; }
.chip.ok { background: #f0fdf4; color: var(--ok); border-color: #bbf7d0; }
.chip.warn { background: #fffbeb; color: var(--warn); border-color: #fde68a; }
.chip.bad { background: #fef2f2; color: var(--bad); border-color: #fecaca; }

/* Identitas */
.identity {
  display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; border-radius: 1rem;
  background: #f8fafc; border: 1px solid var(--line);
}
.identity .avatar {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 1.1rem;
  background: #e2e8f0; color: var(--muted);
}
.identity.matched { background: #f0fdf4; border-color: #bbf7d0; }
.identity.matched .avatar { background: var(--ok); color: #fff; }

.btn-absen { padding: .95rem .5rem; border-radius: .9rem; font-weight: 700; font-size: 1.02rem; }
.btn-absen i { font-size: 1.3rem; display: block; margin-bottom: .1rem; }

/* Statistik */
.stat { border-radius: 1rem; padding: .9rem 1rem; background: #fff; border: 1px solid var(--line); height: 100%; }
.stat .label { font-size: .78rem; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.stat .ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 1.1rem; }

/* Tabel */
.table-modern { --bs-table-bg: transparent; font-size: .88rem; }
.table-modern thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  background: #f8fafc; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table-modern tbody tr.row-late { background: #fffbeb; }
.table-modern tbody tr.row-out-radius { background: #fef2f2; }
.addr-cell { max-width: 260px; white-space: normal; line-height: 1.25; font-size: .78rem; color: var(--muted); }
.thumb { width: 42px; height: 42px; object-fit: cover; border-radius: 10px; cursor: zoom-in; background: #e2e8f0; }

.badge-soft { font-weight: 600; padding: .38em .65em; border-radius: 999px; }
.badge-soft.ok { background: #dcfce7; color: #15803d; }
.badge-soft.warn { background: #fef3c7; color: #b45309; }
.badge-soft.bad { background: #fee2e2; color: #b91c1c; }
.badge-soft.info { background: var(--brand-soft); color: var(--brand-dark); }
.badge-soft.muted { background: #f1f5f9; color: var(--muted); }

.nav-pills-modern .nav-link { color: var(--muted); font-weight: 600; border-radius: .75rem; }
.nav-pills-modern .nav-link.active { background: var(--brand); color: #fff; }

.toast-container { z-index: 2000; }
.small-muted { font-size: .8rem; color: var(--muted); }
.form-label { font-weight: 600; font-size: .82rem; margin-bottom: .25rem; }

.btn-outline-primary { --bs-btn-disabled-color: var(--brand); --bs-btn-disabled-border-color: var(--brand); --bs-btn-active-color: #fff; --bs-btn-hover-color: #fff; --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand-dark); --bs-btn-active-border-color: var(--brand-dark); }
.text-primary { color: var(--brand) !important; }
.progress-bar { background-color: var(--brand); }

.btn-primary:disabled, .btn-primary.disabled { opacity: .45; }
.swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .6rem; }
.swatch { border: 2px solid var(--line); border-radius: .9rem; padding: .5rem; cursor: pointer; background: #fff; text-align: center; font-size: .8rem; font-weight: 600; }
.swatch .bar { height: 34px; border-radius: .6rem; margin-bottom: .35rem; }
.swatch.active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.sched-row.off { opacity: .55; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus, .form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem var(--brand-soft); }
.min-w-0 { min-width: 0; }
.btn-outline-primary:disabled { opacity: .5; }
