/* ============================================================
   AbsensiKu — stylesheet utama
   ============================================================ */
:root {
  --bg: #eef1f7;
  --card: #ffffff;
  --line: #e2e8f0;
  --txt: #0f172a;
  --muted: #64748b;
  --pri: #123F36;
  --pri-dark: #0b2a24;
  --pri-soft: #e9f2ef;
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --bad: #dc2626;
  --bad-soft: #fee2e2;
  --info: #0284c7;
  --info-soft: #e0f2fe;
  --purple: #7c3aed;
  --purple-soft: #ede9fe;
  --teal: #0d9488;
  --teal-soft: #ccfbf1;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .07), 0 8px 24px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--txt); font-size: 15px; line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}
img, video { max-width: 100%; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 40;
  background: linear-gradient(180deg, #0b211c 0%, #123f36 100%);
  color: #cfe3de; display: flex; flex-direction: column;
}
.brand {
  display: flex; align-items: center; gap: 10px; padding: 22px 20px 18px;
  font-size: 20px; font-weight: 700; color: #fff; letter-spacing: .3px;
}
.brand-ic { display: inline-flex; align-items: center; }
.nav { display: flex; flex-direction: column; gap: 4px; padding: 8px 12px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 12px; color: #cfe3de; text-decoration: none;
  padding: 11px 14px; border-radius: 10px; font-weight: 500; font-size: 14.5px;
  transition: background .15s, color .15s;
}
.nav a .ic { width: 22px; display: inline-flex; align-items: center; justify-content: center; }
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a.active { background: #e9f2ef; color: #123F36; box-shadow: 0 4px 14px rgba(0, 0, 0, .28); }
.sidebar-foot { padding: 16px 20px; font-size: 12px; color: #8fb3aa; }

/* ---------- Layout utama ---------- */
.main { margin-left: 250px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 30px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.page-title { font-size: 21px; font-weight: 700; }
.topbar-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.jam {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 17px; color: var(--pri);
  background: var(--pri-soft); padding: 7px 14px; border-radius: 10px;
}
.userchip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--pri), #1f6b5c);
  color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.usermeta .nama { font-weight: 600; font-size: 14px; line-height: 1.2; }
.usermeta .role { font-size: 12px; color: var(--muted); }
.btn-logout {
  display: inline-flex; align-items: center; text-decoration: none; color: var(--muted);
  padding: 8px; border-radius: 10px; line-height: 1; transition: background .15s, color .15s;
}
.btn-logout:hover { background: var(--bad-soft); color: var(--bad); }

/* Ikon SVG inline (pengganti emoji) */
.svgi { display: inline-block; vertical-align: -3px; flex: 0 0 auto; }

.content { padding: 28px 30px 40px; max-width: 1240px; width: 100%; margin: 0 auto; flex: 1; }
.foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 18px; }

/* ---------- Kartu & grid ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; border: 1px solid var(--line); margin-bottom: 22px;
}
.card-title { font-size: 16.5px; font-weight: 700; margin-bottom: 4px; }
.card-sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.grid-2.cols-form { grid-template-columns: 1fr 1.6fr; }
.grid-2.cols-wide { grid-template-columns: 1.4fr 1fr; }
.grid-2.cols-schedule { grid-template-columns: 1.35fr 1fr; }
.grid-2 > .card { margin-bottom: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 18px; margin-bottom: 22px; }

/* ---------- Kartu statistik ---------- */
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; display: flex; align-items: center; gap: 14px;
}
.stat .ic {
  width: 46px; height: 46px; border-radius: 12px; flex: 0 0 auto; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
}
.stat .val { font-size: 24px; font-weight: 800; line-height: 1.1; }
.stat .lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.ic-bg-ok { background: var(--ok-soft); }
.ic-bg-warn { background: var(--warn-soft); }
.ic-bg-bad { background: var(--bad-soft); }
.ic-bg-info { background: var(--info-soft); }
.ic-bg-pri { background: var(--pri-soft); }
.ic-bg-purple { background: var(--purple-soft); }
.ic-bg-teal { background: var(--teal-soft); }

/* ---------- Hero (status hari ini) ---------- */
.hero {
  background: linear-gradient(120deg, #0b2a24 0%, #1d5a4d 100%);
  border: none; color: #fff; display: flex; justify-content: space-between; gap: 24px;
  align-items: center; border-radius: 18px; margin-bottom: 22px;
}
.hero-left { flex: 1; }
.hero-hi { font-size: 14px; opacity: .85; }
.hero-nama { font-size: 24px; font-weight: 800; margin: 2px 0 12px; }
.hero-status { font-size: 15px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255,255,255,.25); display: inline-block; padding: 8px 14px; border-radius: 10px; margin-bottom: 14px; }
.hero-status strong { font-size: 17px; }
.hero-note { font-size: 12.5px; opacity: .85; margin-top: 10px; }
.hero-foto { text-align: center; flex: 0 0 auto; }
.hero-foto img {
  width: 150px; height: 150px; object-fit: cover; border-radius: 16px;
  border: 3px solid rgba(255, 255, 255, .5); background: #fff; display: block;
}
.hero-foto .no-foto {
  width: 150px; height: 150px; border-radius: 16px; border: 2px dashed rgba(255, 255, 255, .45);
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  font-size: 44px; gap: 6px; color: rgba(255, 255, 255, .8); background: rgba(255, 255, 255, .08);
}
.hero-foto .cap { font-size: 11.5px; opacity: .8; margin-top: 8px; }

/* ---------- Tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--pri); color: #fff; border: none; cursor: pointer;
  padding: 11px 20px; border-radius: 10px; font-size: 14.5px; font-weight: 600;
  font-family: inherit; text-decoration: none; transition: background .15s, transform .05s, box-shadow .15s;
  box-shadow: 0 2px 8px rgba(18, 63, 54, .35);
}
.btn:hover { background: var(--pri-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { background: #cbd5e1; color: #f8fafc; cursor: not-allowed; box-shadow: none; }
.btn-ghost { background: transparent; color: var(--pri); border: 1.5px solid var(--line); box-shadow: none; }
.btn-ghost:hover { background: var(--pri-soft); }
.btn-light { background: #fff; color: var(--pri); box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.btn-light:hover { background: #e9f2ef; }
.btn-ok { background: var(--ok); box-shadow: 0 2px 8px rgba(22, 163, 74, .35); }
.btn-ok:hover { background: #15803d; }
.btn-bad { background: var(--bad); box-shadow: 0 2px 8px rgba(220, 38, 38, .3); }
.btn-bad:hover { background: #b91c1c; }
.btn-warn { background: var(--warn); box-shadow: 0 2px 8px rgba(217, 119, 6, .3); }
.btn-warn:hover { background: #b45309; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; padding: 14px; font-size: 15.5px; }

/* ---------- Badge status ---------- */
.badge {
  display: inline-block; padding: 4px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.b-hadir { background: var(--ok-soft); color: #15803d; }
.b-terlambat { background: var(--warn-soft); color: #b45309; }
.b-alpha { background: var(--bad-soft); color: #b91c1c; }
.b-izin { background: var(--info-soft); color: #0369a1; }
.b-sakit { background: var(--teal-soft); color: #0f766e; }
.b-cuti { background: var(--purple-soft); color: #6d28d9; }
.b-pending { background: var(--warn-soft); color: #b45309; }
.b-muted { background: #f1f5f9; color: var(--muted); }

/* ---------- Alert ---------- */
.alert {
  padding: 13px 18px; border-radius: 12px; margin-bottom: 18px; font-size: 14px;
  font-weight: 500; border: 1px solid transparent; transition: opacity .5s;
}
.alert-success { background: var(--ok-soft); color: #14532d; border-color: #bbf7d0; }
.alert-error { background: var(--bad-soft); color: #7f1d1d; border-color: #fecaca; }
.alert-info { background: var(--info-soft); color: #0c4a6e; border-color: #bae6fd; }
.alert.fade { opacity: 0; }

/* ---------- Tabel ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { font-variant-numeric: tabular-nums; }
.empty-row td { text-align: center; color: var(--muted); padding: 28px !important; }

/* ---------- Form ---------- */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 4px; }
.field input[type="text"], .field input[type="password"], .field input[type="date"],
.field input[type="time"], .field input[type="number"], .field input[type="file"],
.field select, .field textarea {
  width: 100%; padding: 10px 13px; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 14.5px; font-family: inherit; background: #fff; color: var(--txt);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--pri); box-shadow: 0 0 0 3px rgba(18, 63, 54, .18);
}
.field textarea { resize: vertical; min-height: 90px; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }

/* ---------- Halaman presensi (kamera & lokasi) ---------- */
.cam-box {
  background: #0f172a; border-radius: 14px; overflow: hidden; position: relative;
  aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; margin-bottom: 14px;
}
.cam-box video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cam-box .cam-placeholder { color: #94a3b8; text-align: center; font-size: 13.5px; }
.cam-placeholder .big { font-size: 42px; display: block; margin-bottom: 8px; }
.cam-guide {
  position: absolute; inset: 0; pointer-events: none;
  border: 2px dashed rgba(255, 255, 255, .35); border-radius: 18px; margin: 14px;
}
.selfie-preview { position: relative; margin-bottom: 14px; display: none; }
.selfie-preview img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 14px; border: 3px solid var(--ok);
  display: block;
}
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.lokasi-box {
  border: 1.5px dashed var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px;
  background: #f8fafc;
}
.lokasi-stat { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-top: 10px; }
.lokasi-stat .item .k { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.lokasi-stat .item .v { font-size: 14.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.lokasi-stat .item .v small { color: var(--muted); font-weight: 500; }
.jarak-badge { display: inline-block; padding: 5px 12px; border-radius: 999px; font-weight: 700; font-size: 12.5px; }
.jarak-badge.ok { background: var(--ok-soft); color: #15803d; }
.jarak-badge.bad { background: var(--bad-soft); color: #b91c1c; }
.manual-box { margin-top: 12px; font-size: 13px; color: var(--muted); }
.manual-box .row { display: flex; gap: 8px; margin-top: 6px; }
.manual-box input {
  flex: 1; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 8px; font-size: 13px; font-family: inherit;
}
.submit-hint { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: 10px; }
.step-label { font-size: 12px; font-weight: 800; color: var(--pri); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 10px; display: block; }

/* ---------- Ring kehadiran ---------- */
.ring-wrap { display: flex; align-items: center; gap: 20px; }
.ring {
  --p: 0%;
  width: 110px; height: 110px; border-radius: 50%; flex: 0 0 auto; position: relative;
  background: conic-gradient(var(--ok) calc(var(--p) * 1%), #e2e8f0 0);
  display: flex; align-items: center; justify-content: center;
}
.ring::before {
  content: ""; position: absolute; inset: 11px; border-radius: 50%; background: var(--card);
}
.ring .pct { position: relative; font-size: 22px; font-weight: 800; }
.ring-info .big { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.ring-info .small { font-size: 12.5px; color: var(--muted); }

/* ---------- Progress bar ---------- */
.progress { background: #e2e8f0; height: 10px; border-radius: 999px; overflow: hidden; margin-top: 6px; }
.progress > div { height: 100%; background: var(--ok); border-radius: 999px; transition: width .4s; }
.progress.warn > div { background: var(--warn); }

/* ---------- KV list ---------- */
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; text-align: right; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .55); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: #fff; border-radius: 16px; max-width: 720px; width: 100%; max-height: 88vh;
  overflow: auto; box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff;
}
.modal-head h3 { font-size: 16.5px; }
.modal-close {
  border: none; background: #f1f5f9; width: 32px; height: 32px; border-radius: 8px;
  cursor: pointer; font-size: 14px; font-weight: 700; color: var(--muted);
}
.modal-close:hover { background: var(--bad-soft); color: var(--bad); }
.modal-body { padding: 20px 22px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.detail-col h4 { font-size: 13.5px; margin-bottom: 10px; color: var(--pri); text-transform: uppercase; letter-spacing: .5px; }
.detail-foto {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; border: 1px solid var(--line);
  margin-bottom: 10px; display: block; background: #f1f5f9;
}
.no-foto {
  width: 100%; aspect-ratio: 4 / 3; border-radius: 12px; border: 1.5px dashed var(--line);
  display: flex; align-items: center; justify-content: center; color: var(--muted);
  font-size: 12.5px; margin-bottom: 10px; background: #f8fafc; text-align: center; padding: 10px;
}

/* ---------- Galeri foto presensi (admin) ---------- */
.foto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; margin-bottom: 18px; }
.foto-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.foto-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.foto-head .avatar { width: 34px; height: 34px; font-size: 12px; }
.foto-nama { flex: 1; min-width: 0; line-height: 1.25; }
.foto-nama strong { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.foto-jam { font-size: 14px; font-weight: 700; color: var(--pri); text-align: right; line-height: 1.15; }
.foto-jam span { display: block; font-size: 10.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.foto-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.foto-item { min-width: 0; }
.foto-thumb {
  position: relative; display: block; width: 100%; padding: 0; border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; background: #f1f5f9; cursor: zoom-in; font-family: inherit;
}
.foto-thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; transition: transform .2s; }
.foto-thumb:hover img { transform: scale(1.04); }
.foto-tag {
  position: absolute; left: 8px; top: 8px; background: rgba(18, 63, 54, .85); color: #fff;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  padding: 3px 8px; border-radius: 999px;
}
.foto-zoom {
  position: absolute; right: 8px; bottom: 8px; background: rgba(255, 255, 255, .92); color: var(--pri);
  width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .2);
}
.foto-empty {
  width: 100%; aspect-ratio: 4 / 3; border: 1.5px dashed var(--line); border-radius: 12px;
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 10px;
  color: var(--muted); font-size: 12px; background: #f8fafc;
}
.foto-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.thumb-mini { display: inline-block; border-radius: 8px; overflow: hidden; line-height: 0; border: 1px solid var(--line); }
.thumb-mini img { width: 38px; height: 38px; object-fit: cover; display: block; transition: opacity .15s; }
.thumb-mini:hover img { opacity: .8; }

/* ---------- Halaman login ---------- */
.login-page {
  min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0a1e1a 0%, #123f36 55%, #1f6b5c 100%); padding: 20px;
}
.login-card {
  background: #fff; border-radius: 20px; padding: 38px 34px; width: 100%; max-width: 400px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .35);
}
.login-brand { text-align: center; font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.login-brand .ic { display: inline-flex; align-items: center; justify-content: center; }
.login-sub { text-align: center; color: var(--muted); font-size: 13.5px; margin-bottom: 24px; }

/* ---------- Filter bar ---------- */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 22px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 20px;
}
.filter-bar .field { margin-bottom: 0; min-width: 150px; flex: 0 1 auto; }
.filter-bar .field.grow { flex: 1 1 220px; }
.filter-bar .spacer { flex: 1; }

/* ---------- Lain-lain ---------- */
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mb-0 { margin-bottom: 0; }
.mt-16 { margin-top: 16px; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.tag-libur { color: var(--muted); }

/* ---------- Responsif (mobile first) ---------- */
/* Tablet & HP: sidebar jadi bar atas, grid menumpuk */
@media (max-width: 960px) {
  .sidebar {
    position: sticky; inset: auto; top: 0; width: 100%; z-index: 50;
    flex-direction: row; align-items: center; border-radius: 0;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
  }
  .brand { padding: 12px 14px; font-size: 16px; flex: 0 0 auto; }
  .brand-ic svg { width: 20px; height: 20px; }
  .nav {
    flex-direction: row; overflow-x: auto; padding: 6px 8px; gap: 2px;
    flex: 1; min-width: 0; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; padding: 9px 12px; font-size: 13px; gap: 8px; }
  .nav a .ic { display: none; }
  .sidebar-foot { display: none; }
  .main { margin-left: 0; }
  .topbar { position: static; padding: 12px 14px; }
  .grid-2, .grid-3, .grid-form, .detail-grid,
  .grid-2.cols-form, .grid-2.cols-wide, .grid-2.cols-schedule { grid-template-columns: 1fr; }
  .grid-2 > .card { margin-bottom: 18px; }
  .hero { flex-direction: column-reverse; text-align: center; gap: 16px; }
  .hero-status { display: block; }
  .content { padding: 16px 14px 36px; }
  .jam { display: none; }
  .table-wrap table.table { min-width: 520px; }
  .foto-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

/* HP: rapatkan jarak, target sentuh lebih besar, form satu kolom */
@media (max-width: 720px) {
  .page-title { font-size: 18px; }
  .topbar-sub { font-size: 11.5px; }
  .topbar { gap: 10px; }
  .topbar-right { gap: 8px; }
  .usermeta { display: none; }
  .userchip { gap: 6px; }
  .avatar { width: 34px; height: 34px; font-size: 13px; }

  .content { padding: 14px 12px 32px; }
  .card { padding: 16px; border-radius: 12px; margin-bottom: 16px; }
  .card-title { font-size: 15.5px; }
  .card-sub { font-size: 12.5px; margin-bottom: 14px; }

  .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat { padding: 13px; gap: 10px; }
  .stat .ic { width: 38px; height: 38px; border-radius: 10px; }
  .stat .ic svg { width: 18px; height: 18px; }
  .stat .val { font-size: 20px; }
  .stat .lbl { font-size: 11.5px; }

  .btn { padding: 11px 16px; }
  .btn-sm { padding: 8px 11px; }
  .btn-row { gap: 8px; }
  .btn-row .btn { flex: 1 1 100%; }
  .manual-box .row { flex-wrap: wrap; }
  .manual-box input, .manual-box .btn { flex: 1 1 100%; }

  .filter-bar { padding: 14px; gap: 10px; }
  .filter-bar .field { flex: 1 1 100%; min-width: 0; }
  .filter-bar .spacer { display: none; }
  .filter-bar .btn { flex: 1 1 auto; }

  .field input[type="text"], .field input[type="password"], .field input[type="date"],
  .field input[type="time"], .field input[type="number"], .field input[type="file"],
  .field select, .field textarea, .manual-box input { font-size: 16px; }

  .table-wrap { -webkit-overflow-scrolling: touch; }
  table.table { font-size: 13px; }
  .table th, .table td { padding: 9px 10px; }

  .ring-wrap { gap: 14px; }
  .ring { width: 96px; height: 96px; }
  .ring .pct { font-size: 19px; }

  .kv { flex-wrap: wrap; }
  .kv .v { overflow-wrap: anywhere; }

  .modal-overlay { padding: 12px; align-items: flex-end; }
  .modal { max-height: 92vh; border-radius: 16px 16px 0 0; }

  .foto-card { padding: 14px; }
  .foto-pair { gap: 8px; }

  .login-page { padding: 14px; }
  .login-card { padding: 28px 20px; }
}

/* HP kecil: modal penuh layar, label-nilai menumpuk */
@media (max-width: 480px) {
  body { font-size: 14.5px; }
  .brand { padding: 11px 12px; font-size: 15px; }
  .nav a { padding: 8px 10px; font-size: 12.5px; }
  .content { padding: 12px 10px 30px; }
  .topbar { padding: 10px 12px; }

  .grid-stats { gap: 10px; }
  .stat { padding: 11px; gap: 9px; }
  .stat .ic { width: 34px; height: 34px; }
  .stat .val { font-size: 18px; }

  .hero { padding: 18px 16px; }
  .hero-nama { font-size: 21px; }
  .hero-foto img, .hero-foto .no-foto { width: 120px; height: 120px; }

  .ring-wrap { flex-direction: column; text-align: center; }
  .kv { flex-direction: column; align-items: flex-start; gap: 2px; }
  .kv .v { text-align: left; }

  .table-wrap table.table { min-width: 480px; }

  .modal-overlay { padding: 0; align-items: stretch; }
  .modal { max-height: 100%; height: 100%; border-radius: 0; }
  .modal-body { padding: 16px; }
  .modal-head { padding: 14px 16px; }

  .login-card { padding: 24px 18px; border-radius: 16px; }
  .foto-jam { font-size: 13px; }
}

/* ---------- Cetak ---------- */
@media print {
  .sidebar, .topbar, .foot, .filter-bar, .btn, .alert, .detail-src { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #cbd5e1; }
}
