:root {
  --navy: #0F1B2D;
  --navy-soft: #1B2C45;
  --teal: #14B8A6;
  --teal-dark: #0D8A7C;
  --ink: #1F2430;
  --ink-soft: #6B7280;
  --line: #E5E7EB;
  --surface: #FFFFFF;
  --page: #F4F6F9;
  --green-bg: #E7F7EF;
  --green-text: #1C7C4C;
  --red-bg: #FDEAEA;
  --red-text: #B3261E;
  --amber-bg: #FFF4E0;
  --amber-text: #92620A;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

a { color: inherit; }

/* ---------- Layout dashboard (admin) ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--navy);
  color: #E8ECF3;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
}

.sidebar .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; padding: 0 6px; }
.sidebar .brand img { width: 34px; height: 34px; border-radius: 8px; }
.sidebar .brand-text { font-weight: 600; font-size: 15px; }
.sidebar .brand-text small { display: block; font-weight: 400; font-size: 11px; color: #93A0B4; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #C7D0DE;
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 2px;
}
.nav-link:hover { background: var(--navy-soft); color: #fff; }
.nav-link.active { background: var(--teal); color: #05201C; font-weight: 600; }

.sidebar .spacer { flex: 1; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar h1 { font-size: 18px; margin: 0; }
.topbar .muted { font-size: 12px; color: var(--ink-soft); margin: 2px 0 0; }

.content { flex: 1; padding: 24px 28px 48px; max-width: 1180px; }

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

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-card .label { font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; }
.stat-card .value { font-size: 24px; font-weight: 600; }
.stat-card .delta { font-size: 12px; margin-top: 4px; }
.stat-card .delta.up { color: var(--green-text); }
.stat-card .delta.down { color: var(--red-text); }

.chart-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 20px; }
@media (max-width: 900px) { .chart-grid { grid-template-columns: 1fr; } }

.card h2 { font-size: 14px; font-weight: 600; margin: 0 0 14px; }

table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .02em;
  color: var(--ink-soft); border-bottom: 1px solid var(--line); padding: 8px 10px;
}
table.data-table td { padding: 9px 10px; border-bottom: 1px solid #F0F1F4; }
table.data-table tr:last-child td { border-bottom: none; }

.badge { display: inline-block; font-size: 11px; padding: 3px 9px; border-radius: 20px; font-weight: 500; }
.badge.ok { background: var(--green-bg); color: var(--green-text); }
.badge.late { background: var(--amber-bg); color: var(--amber-text); }
.badge.miss { background: var(--red-bg); color: var(--red-text); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); font-size: 14px; font-family: inherit; cursor: pointer; color: var(--ink);
  text-decoration: none;
}
.btn-primary { background: var(--teal); border-color: var(--teal); color: #05201C; font-weight: 600; }
.btn:active { transform: scale(0.98); }

input, select {
  width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 8px;
  padding: 0 12px; font-size: 14px; font-family: inherit; background: var(--page);
}
label { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 4px; }

/* ---------- Halaman absen (karyawan, mobile) ---------- */
.absen-wrap {
  max-width: 420px; margin: 0 auto; min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 16px;
}
.absen-card {
  width: 100%; background: var(--surface); border-radius: 20px;
  box-shadow: 0 20px 50px rgba(15,27,45,0.18); padding: 22px;
}
.absen-header { text-align: center; margin-bottom: 18px; }
.absen-header img.logo { width: 44px; height: 44px; border-radius: 10px; margin-bottom: 8px; }
.absen-header h1 { font-size: 17px; margin: 0; }
.absen-header p { font-size: 12px; color: var(--ink-soft); margin: 2px 0 0; }

.camera-box {
  position: relative; width: 100%; aspect-ratio: 3/4; min-height: 320px; background: #10121A;
  border-radius: 16px; overflow: hidden; margin-bottom: 14px;
}
.camera-box video, .camera-box img.captured { width: 100%; height: 100%; object-fit: cover; display: block; }
.camera-box .icon-btn {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  width: 56px; height: 56px; border-radius: 50%; background: #fff; border: 4px solid rgba(255,255,255,0.4);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}

.status-line { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 14px; padding: 10px 12px; border-radius: 10px; }
.status-line.searching { background: var(--amber-bg); color: var(--amber-text); }
.status-line.in-range { background: var(--green-bg); color: var(--green-text); }
.status-line.out-of-range { background: var(--red-bg); color: var(--red-text); }

.action-row { display: flex; gap: 10px; }
.icon-round {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer;
}

@media print {
  body { background: #fff; }
  .sidebar, .topbar .btn, .no-print { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: 100%; }
}
