/* ============================================================
   ABSENSI DIGITAL — REFERENCE LAYER (dimuat paling akhir)
   Menyamakan tampilan 1:1 dengan desain referensi:
   background hitam pekat, kartu kaca gelap dengan neon border,
   glow biru/ungu/hijau/kuning/merah, floating bottom navigation,
   popup notifikasi realtime, dan perbaikan halaman scan (PWA).
   ============================================================ */

:root {
  --bg-0: #000206;
  --bg-1: #04060d;
  --bg-2: #070b16;

  --n-blue: #2f8bff;
  --n-cyan: #22d3ff;
  --n-violet: #a855f7;
  --n-green: #22e07a;
  --n-amber: #ffc528;
  --n-red: #ff3b63;

  --card-1: rgba(9, 14, 30, 0.86);
  --card-2: rgba(5, 8, 18, 0.92);
  --line: rgba(90, 140, 255, 0.22);
  --line-soft: rgba(120, 170, 255, 0.14);

  --txt: #f2f6ff;
  --txt-dim: #94a3c4;
  --txt-mute: #6b7a9e;

  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-xl: 24px;
  --radius: 20px;

  --header-h: 76px;
  --bottomnav-h: 74px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  --font-ui: "Inter", "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
}

html,
body {
  background: #000206;
  color: var(--txt);
  font-family: var(--font-ui);
  font-size: 15px;
  letter-spacing: -0.006em;
  overflow-x: hidden;
}

/* Latar: hanya halo lembut biru/ungu, tanpa grid (sesuai referensi) */
body::before {
  background:
    radial-gradient(48rem 30rem at 6% -8%, rgba(47, 139, 255, 0.16), transparent 62%),
    radial-gradient(44rem 30rem at 104% 2%, rgba(168, 85, 247, 0.14), transparent 62%),
    radial-gradient(40rem 30rem at 50% 120%, rgba(34, 211, 255, 0.08), transparent 60%),
    #000206;
}
body::after { display: none !important; }

/* ---------------- Layout ---------------- */
.app-main { padding: 14px; padding-bottom: calc(var(--bottomnav-h) + 46px + var(--safe-b)); }
@media (min-width: 640px) { .app-main { padding: 20px; padding-bottom: calc(var(--bottomnav-h) + 52px + var(--safe-b)); } }
@media (min-width: 1024px) { .app-main { padding-bottom: 28px; } }
.page { gap: 14px; max-width: 1180px; }
@media (min-width: 640px) { .page { gap: 18px; } }

/* ---------------- Kartu kaca ---------------- */
.glass,
.glass-strong {
  background: linear-gradient(158deg, var(--card-1), var(--card-2));
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(140, 185, 255, 0.09),
    0 0 26px rgba(47, 139, 255, 0.07);
  backdrop-filter: blur(22px);
}
.glass-hover:hover {
  border-color: rgba(120, 175, 255, 0.44);
  box-shadow:
    0 22px 54px rgba(0, 0, 0, 0.66),
    0 0 30px rgba(47, 139, 255, 0.24),
    inset 0 1px 0 rgba(140, 185, 255, 0.12);
  transform: translateY(-3px);
}
.card-pad { padding: 16px; }
@media (min-width: 640px) { .card-pad { padding: 20px; } }

.section-title { font-size: 1.02rem; font-weight: 700; letter-spacing: -0.015em; color: #fff; }
.card-head { margin-bottom: 14px; }
.text-dim { color: var(--txt-dim); }

/* ---------------- Header ---------------- */
.app-header {
  gap: 10px;
  min-height: var(--header-h);
  padding: 10px 12px calc(10px);
  padding-top: calc(10px + var(--safe-t));
  background: rgba(2, 4, 10, 0.86);
  border-bottom: 1px solid rgba(90, 140, 255, 0.14);
  backdrop-filter: blur(22px);
}
@media (min-width: 640px) { .app-header { padding-inline: 20px; } }

.hd-brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; flex: 1 1 auto; }
.hd-logo {
  width: 50px; height: 50px; flex: none; display: grid; place-items: center;
  border-radius: 15px;
  background: linear-gradient(160deg, rgba(20, 34, 70, 0.95), rgba(6, 10, 24, 0.95));
  border: 1px solid rgba(90, 150, 255, 0.4);
  box-shadow: 0 0 20px rgba(47, 139, 255, 0.28), inset 0 0 16px rgba(47, 139, 255, 0.12);
  overflow: hidden;
}
.hd-logo img { width: 34px; height: 34px; object-fit: contain; }
.hd-name {
  display: block; font-size: 1.02rem; font-weight: 800; color: #fff; line-height: 1.15;
  letter-spacing: -0.01em; text-transform: uppercase;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hd-sub {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--n-blue); text-shadow: 0 0 12px rgba(47, 139, 255, 0.5);
}
.hd-clock {
  display: none; align-items: center; gap: 10px; flex: none;
  padding: 8px 14px; border-radius: 16px;
  background: linear-gradient(160deg, rgba(11, 18, 40, 0.92), rgba(5, 8, 18, 0.95));
  border: 1px solid rgba(90, 140, 255, 0.26);
  box-shadow: 0 0 22px rgba(47, 139, 255, 0.12);
}
@media (min-width: 560px) { .hd-clock { display: inline-flex; } }
.hd-clock .ico {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: none;
  color: var(--n-blue); background: rgba(47, 139, 255, 0.12); border: 1px solid rgba(47, 139, 255, 0.32);
}
.hd-clock .ico svg { width: 19px; height: 19px; }
.hd-clock .d { font-size: 0.78rem; font-weight: 600; color: #e7eeff; }
.hd-clock .t { font-size: 0.82rem; font-weight: 800; color: var(--n-cyan); text-shadow: 0 0 12px rgba(34, 211, 255, 0.5); }

.hd-bell {
  position: relative; width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  border-radius: 14px; color: #cfe0ff;
  background: rgba(11, 18, 40, 0.85); border: 1px solid rgba(90, 140, 255, 0.26);
  transition: box-shadow 0.24s, border-color 0.24s, transform 0.18s;
}
.hd-bell:hover { border-color: rgba(120, 175, 255, 0.5); box-shadow: 0 0 22px rgba(47, 139, 255, 0.3); }
.hd-bell svg { width: 21px; height: 21px; }
.hd-bell .dot {
  position: absolute; top: -6px; right: -6px; min-width: 21px; height: 21px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 999px;
  background: var(--n-red); color: #fff; font-size: 0.66rem; font-weight: 800;
  box-shadow: 0 0 14px rgba(255, 59, 99, 0.75); border: 2px solid #04060d;
}

/* ---------------- Hero ---------------- */
.hero-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 18px;
  border-radius: 26px;
  border: 1px solid rgba(110, 160, 255, 0.24);
  background:
    radial-gradient(130% 150% at 100% 0%, rgba(120, 60, 255, 0.3), transparent 58%),
    radial-gradient(100% 130% at 0% 100%, rgba(47, 139, 255, 0.16), transparent 60%),
    linear-gradient(158deg, rgba(10, 16, 36, 0.92), rgba(4, 7, 16, 0.95));
  box-shadow: 0 20px 52px rgba(0, 0, 0, 0.6), 0 0 34px rgba(88, 80, 255, 0.14);
}
@media (min-width: 640px) { .hero-card { padding: 24px 26px; } }
.hero-card h2 { font-size: clamp(1.45rem, 6vw, 2rem); font-weight: 800; color: #fff; line-height: 1.18; }
.hero-card p { margin-top: 8px; font-size: 0.92rem; color: var(--txt-dim); max-width: 30ch; }
.hero-art { width: clamp(120px, 38vw, 210px); height: auto; justify-self: end; border: 0; background: none; box-shadow: none; }
.hero-art img { width: 100%; height: auto; }
.hero-chips { margin-top: 14px; }
.chip {
  border-radius: 999px; padding: 5px 11px; font-size: 0.7rem; font-weight: 600;
  color: #c9d8ff; background: rgba(47, 139, 255, 0.1); border: 1px solid rgba(90, 150, 255, 0.28);
}

/* ---------------- Kartu statistik ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; } }
@media (min-width: 1024px) { .stat-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.stat-card {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 2px; padding: 16px 10px 14px; border-radius: 20px;
  background: linear-gradient(160deg, rgba(8, 13, 28, 0.9), rgba(3, 5, 12, 0.94));
}
.stat-card .stat-ico {
  width: 44px; height: 44px; border-radius: 50%; margin: 0 0 10px;
  display: grid; place-items: center;
  border: 1.5px solid currentColor; background: rgba(255, 255, 255, 0.03);
  box-shadow: 0 0 18px -2px currentColor, inset 0 0 14px -6px currentColor;
}
.stat-card .stat-ico svg { width: 22px; height: 22px; }
.stat-card .stat-value { font-size: clamp(1.35rem, 5.5vw, 1.65rem); font-weight: 800; color: #fff; line-height: 1.1; }
.stat-card .stat-label { font-size: 0.76rem; font-weight: 500; color: var(--txt-dim); }
.stat-card .stat-sub { font-size: 0.82rem; font-weight: 700; margin-top: 2px; }

.stat-c-blue   { border-color: rgba(47, 139, 255, 0.5);  box-shadow: 0 0 26px -6px rgba(47, 139, 255, 0.7),  inset 0 0 30px -18px rgba(47, 139, 255, 0.9); }
.stat-c-lime   { border-color: rgba(34, 224, 122, 0.45); box-shadow: 0 0 26px -6px rgba(34, 224, 122, 0.6),  inset 0 0 30px -18px rgba(34, 224, 122, 0.9); }
.stat-c-amber  { border-color: rgba(255, 197, 40, 0.45); box-shadow: 0 0 26px -6px rgba(255, 197, 40, 0.6),  inset 0 0 30px -18px rgba(255, 197, 40, 0.9); }
.stat-c-violet { border-color: rgba(168, 85, 247, 0.5);  box-shadow: 0 0 26px -6px rgba(168, 85, 247, 0.65), inset 0 0 30px -18px rgba(168, 85, 247, 0.9); }
.stat-c-red    { border-color: rgba(255, 59, 99, 0.45);  box-shadow: 0 0 26px -6px rgba(255, 59, 99, 0.6),   inset 0 0 30px -18px rgba(255, 59, 99, 0.9); }

.ico-blue { color: var(--n-blue); } .ico-lime { color: var(--n-green); }
.ico-amber { color: var(--n-amber); } .ico-violet { color: var(--n-violet); }
.ico-red { color: var(--n-red); } .ico-cyan { color: var(--n-cyan); }

.neon-blue { color: var(--n-blue); text-shadow: 0 0 12px rgba(47, 139, 255, 0.55); }
.neon-lime { color: var(--n-green); text-shadow: 0 0 12px rgba(34, 224, 122, 0.5); }
.neon-amber { color: var(--n-amber); text-shadow: 0 0 12px rgba(255, 197, 40, 0.5); }
.neon-violet, .neon-magenta { color: var(--n-violet); text-shadow: 0 0 12px rgba(168, 85, 247, 0.55); }
.neon-red { color: var(--n-red); text-shadow: 0 0 12px rgba(255, 59, 99, 0.5); }
.neon-cyan { color: var(--n-cyan); text-shadow: 0 0 12px rgba(34, 211, 255, 0.5); }

/* ---------------- Grafik & donut ---------------- */
.chart-box { height: 240px; }
@media (min-width: 640px) { .chart-box { height: 300px; } }
.donut-center b { font-size: 1.6rem; font-weight: 800; color: #fff; }
.donut-center span { font-size: 0.72rem; color: var(--txt-dim); }
.legend-row { font-size: 0.88rem; }
.legend-row b { color: #fff; font-weight: 700; }

/* ---------------- Kartu scan ---------------- */
.scan-cta { gap: 14px; padding: 22px 16px; }
.scan-cta .scan-ring {
  width: 116px; height: 116px; border-radius: 50%;
  border: 2px solid rgba(47, 139, 255, 0.75);
  background: radial-gradient(circle at 50% 50%, rgba(47, 139, 255, 0.2), transparent 72%);
  box-shadow: 0 0 42px rgba(47, 139, 255, 0.45), inset 0 0 34px rgba(47, 139, 255, 0.24);
}
.scan-cta .scan-ring svg { width: 54px; height: 54px; color: #9ecbff; }

/* ---------------- Baris absensi ---------------- */
.row-item {
  grid-template-columns: 40px minmax(0, 1fr) auto;
  padding: 10px 12px; border-radius: 16px;
  background: rgba(255, 255, 255, 0.022); border: 1px solid rgba(90, 140, 255, 0.12);
}
.row-item + .row-item { margin-top: 8px; }
.row-item .row-avatar { width: 40px; height: 40px; border: 1px solid rgba(120, 170, 255, 0.3); }
.row-item .row-title { font-size: 0.9rem; font-weight: 600; color: #fff; }
.row-time { font-size: 0.8rem; color: var(--txt-dim); font-variant-numeric: tabular-nums; }

/* ---------------- Badge ---------------- */
.badge {
  padding: 5px 12px; border-radius: 999px; font-size: 0.72rem; font-weight: 700;
  text-transform: none; letter-spacing: 0.01em; border-width: 1px;
}
.badge-hadir  { color: var(--n-green);  background: rgba(34, 224, 122, 0.12); border-color: rgba(34, 224, 122, 0.45); box-shadow: 0 0 16px -4px rgba(34, 224, 122, 0.7); }
.badge-telat  { color: var(--n-amber);  background: rgba(255, 197, 40, 0.12); border-color: rgba(255, 197, 40, 0.45); box-shadow: 0 0 16px -4px rgba(255, 197, 40, 0.7); }
.badge-izin   { color: var(--n-violet); background: rgba(168, 85, 247, 0.14); border-color: rgba(168, 85, 247, 0.5);  box-shadow: 0 0 16px -4px rgba(168, 85, 247, 0.7); }
.badge-sakit  { color: var(--n-blue);   background: rgba(47, 139, 255, 0.14); border-color: rgba(47, 139, 255, 0.5);  box-shadow: 0 0 16px -4px rgba(47, 139, 255, 0.7); }
.badge-alfa   { color: var(--n-red);    background: rgba(255, 59, 99, 0.14);  border-color: rgba(255, 59, 99, 0.5);   box-shadow: 0 0 16px -4px rgba(255, 59, 99, 0.7); }
.badge-pulang { color: var(--n-cyan);   background: rgba(34, 211, 255, 0.14); border-color: rgba(34, 211, 255, 0.5);  box-shadow: 0 0 16px -4px rgba(34, 211, 255, 0.7); }

/* ---------------- Tombol ---------------- */
.btn {
  border-radius: 14px; font-weight: 600; min-height: 44px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(120, 170, 255, 0.2);
}
.btn:hover { background: rgba(47, 139, 255, 0.12); border-color: rgba(120, 175, 255, 0.42); }
.btn-sm { min-height: 36px; border-radius: 12px; }
.btn-icon { width: 44px; min-height: 44px; border-radius: 14px; }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #2f8bff, #7a4dff);
  border-color: rgba(140, 180, 255, 0.55);
  box-shadow: 0 8px 26px -8px rgba(47, 139, 255, 0.9);
}
.btn-primary:hover { box-shadow: 0 0 30px rgba(47, 139, 255, 0.6); }
.btn-neon { color: #9ecbff; border-color: rgba(47, 139, 255, 0.5); background: rgba(47, 139, 255, 0.08); }
.btn-neon:hover { box-shadow: 0 0 26px rgba(47, 139, 255, 0.4); }
.btn-lime { color: var(--n-green); border-color: rgba(34, 224, 122, 0.45); }
.btn-magenta { color: var(--n-violet); border-color: rgba(168, 85, 247, 0.45); }
.btn-danger { color: var(--n-red); border-color: rgba(255, 59, 99, 0.45); }
.link-more { color: var(--n-blue); font-size: 0.82rem; font-weight: 600; }

/* ---------------- Form ---------------- */
.input, select.input, textarea.input {
  min-height: 46px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(90, 140, 255, 0.22);
  color: var(--txt);
}
.input:focus { border-color: var(--n-blue); box-shadow: 0 0 0 3px rgba(47, 139, 255, 0.18), 0 0 22px rgba(47, 139, 255, 0.22); background: rgba(47, 139, 255, 0.06); }
.input:disabled, .input[readonly] { opacity: 0.75; cursor: not-allowed; background: rgba(255, 255, 255, 0.02); }
select.input option { background: #060a16; }
.label { color: var(--txt-dim); }

/* ---------------- Tabel ---------------- */
.table-wrap { border: 1px solid rgba(90, 140, 255, 0.16); border-radius: var(--r-xl); }
.tbl thead th { background: rgba(6, 10, 22, 0.95); color: var(--txt-dim); border-bottom: 1px solid rgba(90, 140, 255, 0.2); }
.tbl tbody td { border-bottom: 1px solid rgba(120, 170, 255, 0.08); }
.tbl tbody tr:hover { background: rgba(47, 139, 255, 0.07); }

/* ---------------- Sidebar ---------------- */
.sidebar { background: linear-gradient(180deg, rgba(6, 10, 22, 0.96), rgba(2, 4, 10, 0.98)); border-right: 1px solid rgba(90, 140, 255, 0.16); }
.nav-item { border-radius: 14px; font-weight: 600; }
.nav-item.active {
  color: #fff;
  background: linear-gradient(120deg, rgba(47, 139, 255, 0.26), rgba(168, 85, 247, 0.16));
  border: 1px solid rgba(120, 170, 255, 0.42);
  box-shadow: inset 0 0 26px rgba(47, 139, 255, 0.16), 0 0 20px rgba(47, 139, 255, 0.2);
}

/* ============================================================
   FLOATING BOTTOM NAVIGATION (identik referensi)
   ============================================================ */
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(10px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 50;
  width: calc(100% - 20px);
  max-width: 460px;
  height: var(--bottomnav-h);
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(10, 18, 42, 0.86), rgba(3, 6, 16, 0.92));
  border: 1px solid rgba(90, 150, 255, 0.34);
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.7),
    0 0 34px rgba(47, 139, 255, 0.24),
    inset 0 1px 0 rgba(150, 195, 255, 0.16);
  backdrop-filter: blur(26px) saturate(140%);
  overflow: visible;
}
@media (min-width: 1024px) { .bottom-nav { display: none; } }

.bn-item {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 6px 2px; min-height: 58px; border-radius: 22px;
  color: #8ea0c6; font-size: 0.66rem; font-weight: 600; text-decoration: none;
  position: relative; overflow: hidden;
  transition: color 0.22s, transform 0.18s, background 0.22s;
  -webkit-tap-highlight-color: transparent;
}
.bn-item svg { width: 24px; height: 24px; transition: transform 0.22s, filter 0.22s; }
.bn-item:hover { color: #cfe1ff; }
.bn-item:active { transform: scale(0.93); }
.bn-item.active { color: var(--n-blue); background: rgba(47, 139, 255, 0.1); }
.bn-item.active svg { transform: translateY(-1px); filter: drop-shadow(0 0 9px rgba(47, 139, 255, 0.95)); }
.bn-item.active::after {
  content: ""; position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--n-blue); box-shadow: 0 0 12px var(--n-blue);
  animation: bnDot 0.35s ease both;
}
@keyframes bnDot { from { opacity: 0; transform: translateX(-50%) scale(0.2); } }

/* Ripple */
.bn-item .bn-ripple {
  position: absolute; border-radius: 50%; transform: scale(0); pointer-events: none;
  background: rgba(120, 180, 255, 0.32); animation: bnRipple 0.62s ease-out forwards;
}
@keyframes bnRipple { to { transform: scale(2.8); opacity: 0; } }

/* Tombol Scan mengambang di tengah */
.bn-item.bn-scan { overflow: visible; color: #cfe6ff; }
.bn-item.bn-scan::after { display: none; }
.bn-item.bn-scan .bn-fab {
  width: 68px; height: 68px; margin-top: -40px; margin-bottom: 2px;
  border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: radial-gradient(circle at 50% 32%, #4a9dff, #0b3fa0 78%);
  border: 4px solid #03060f;
  box-shadow:
    0 0 0 1px rgba(120, 180, 255, 0.6),
    0 0 34px rgba(47, 139, 255, 0.85),
    0 12px 26px rgba(0, 0, 0, 0.6);
  animation: fabGlow 2.6s ease-in-out infinite;
  transition: transform 0.18s ease;
}
.bn-item.bn-scan .bn-fab svg { width: 30px; height: 30px; }
.bn-item.bn-scan:hover .bn-fab { transform: translateY(-2px) scale(1.04); }
.bn-item.bn-scan:active .bn-fab { transform: scale(0.92); }
.bn-item.bn-scan.active .bn-fab { box-shadow: 0 0 0 1px rgba(150, 200, 255, 0.8), 0 0 48px rgba(47, 139, 255, 1), 0 12px 26px rgba(0, 0, 0, 0.6); }
.bn-item.bn-scan > span:last-child { color: #9fc4ff; }
@keyframes fabGlow {
  50% { box-shadow: 0 0 0 1px rgba(150, 200, 255, 0.75), 0 0 52px rgba(47, 139, 255, 1), 0 12px 26px rgba(0, 0, 0, 0.6); }
}
@media (prefers-reduced-motion: reduce) { .bn-item.bn-scan .bn-fab { animation: none; } }

/* ============================================================
   POPUP NOTIFIKASI REALTIME
   ============================================================ */
#notif-stack {
  position: fixed;
  top: calc(12px + var(--safe-t));
  right: 12px; left: 12px;
  z-index: 95;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  pointer-events: none;
}
@media (min-width: 640px) { #notif-stack { left: auto; width: 360px; align-items: flex-end; } }

.notif-pop {
  pointer-events: auto;
  position: relative;
  width: 100%; max-width: 380px;
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 12px 14px 14px;
  border-radius: 20px;
  background: linear-gradient(158deg, rgba(10, 16, 34, 0.95), rgba(4, 7, 16, 0.97));
  border: 1px solid var(--nc, rgba(47, 139, 255, 0.55));
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.65), 0 0 28px -6px var(--nc, rgba(47, 139, 255, 0.7));
  backdrop-filter: blur(22px);
  overflow: hidden;
  animation: notifIn 0.42s cubic-bezier(0.16, 0.84, 0.44, 1) both;
}
.notif-pop.out { animation: notifOut 0.3s ease forwards; }
@keyframes notifIn { from { opacity: 0; transform: translateY(-18px) scale(0.96); } }
@keyframes notifOut { to { opacity: 0; transform: translateY(-14px) scale(0.96); } }

.notif-pop .np-foto {
  width: 48px; height: 48px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--nc); box-shadow: 0 0 16px -3px var(--nc); background: rgba(255, 255, 255, 0.06);
}
.notif-pop .np-nama { font-size: 0.92rem; font-weight: 700; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-pop .np-meta { font-size: 0.74rem; color: var(--txt-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-pop .np-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.notif-pop .np-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px; font-size: 0.68rem; font-weight: 800;
  color: var(--nc); background: color-mix(in srgb, var(--nc) 14%, transparent);
  border: 1px solid var(--nc); box-shadow: 0 0 14px -4px var(--nc);
}
.notif-pop .np-badge svg { width: 13px; height: 13px; }
.notif-pop .np-jam { font-size: 0.72rem; color: var(--txt-dim); font-variant-numeric: tabular-nums; }
.notif-pop .np-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--nc); box-shadow: 0 0 12px var(--nc); transform-origin: left; animation: npBar linear forwards; }
@keyframes npBar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.notif-pop .np-close {
  position: absolute; top: 6px; right: 8px; width: 22px; height: 22px; border-radius: 50%;
  border: 0; background: transparent; color: var(--txt-mute); cursor: pointer; font-size: 13px; line-height: 1;
}

/* ---------------- Toast ---------------- */
.toast {
  border-radius: 16px;
  background: linear-gradient(158deg, rgba(10, 16, 34, 0.95), rgba(4, 7, 16, 0.97));
  border: 1px solid rgba(90, 150, 255, 0.32);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}
.toast.success { border-color: rgba(34, 224, 122, 0.55); box-shadow: 0 0 26px -8px rgba(34, 224, 122, 0.9); }
.toast.error { border-color: rgba(255, 59, 99, 0.55); box-shadow: 0 0 26px -8px rgba(255, 59, 99, 0.9); }
.toast.info { border-color: rgba(47, 139, 255, 0.55); box-shadow: 0 0 26px -8px rgba(47, 139, 255, 0.9); }

/* ---------------- Modal / dialog / sheet ---------------- */
.modal-card, .sheet, .result-card, dialog {
  background: linear-gradient(158deg, rgba(10, 16, 34, 0.97), rgba(4, 7, 16, 0.98)) !important;
  border: 1px solid rgba(110, 165, 255, 0.3) !important;
  border-radius: 26px !important;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.75), 0 0 40px rgba(47, 139, 255, 0.16) !important;
}
.modal-backdrop { background: rgba(0, 2, 8, 0.76); backdrop-filter: blur(8px); }

/* ---------------- Login ---------------- */
.auth-card {
  border-radius: 30px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.75), 0 0 60px rgba(47, 139, 255, 0.2);
  border: 1px solid rgba(110, 165, 255, 0.28);
}

/* ============================================================
   HALAMAN SCAN — PWA SAFE AREA & VIEWPORT MODERN
   ============================================================ */
.scan-body {
  min-height: 100svh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: var(--font-ui);
}

.scan-stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100svh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  padding: 0;
  background: #000;
}
@supports (height: 100dvh) { .scan-stage { height: 100dvh; } }

.scan-video,
.scan-video video,
.scan-video canvas,
#reader video {
  position: absolute; inset: 0;
  width: 100% !important; height: 100% !important;
  object-fit: cover !important;
  transform: none !important;
}
#reader { position: absolute; inset: 0; min-height: 0; border-radius: 0; }
#reader__scan_region { height: 100% !important; }
#reader__dashboard, #reader img[alt="Info icon"] { display: none !important; }

.scan-topbar {
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: calc(12px + env(safe-area-inset-left, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
}
.scan-status-pill { top: calc(70px + env(safe-area-inset-top, 0px)); }

.scan-brand {
  bottom: calc(var(--dock-h, 158px) + 10px + env(safe-area-inset-bottom, 0px));
  padding-inline: 16px;
}

.scan-dock {
  left: env(safe-area-inset-left, 0px);
  right: env(safe-area-inset-right, 0px);
  bottom: 0;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  max-height: 46dvh;
  overflow: auto;
  overscroll-behavior: contain;
  background: linear-gradient(180deg, rgba(8, 12, 24, 0.86), rgba(2, 4, 10, 0.96));
  border-top: 1px solid rgba(90, 150, 255, 0.26);
  box-shadow: 0 -14px 40px rgba(0, 0, 0, 0.6);
}
.dock-item { padding: 12px 6px; }
.dock-item > span:last-child { font-size: 12.5px; }

/* Layar pendek / landscape: rapatkan dock agar tidak terpotong */
@media (max-height: 680px), (orientation: landscape) {
  .scan-brand { display: none; }
  .dock-handle { margin-bottom: 8px; }
  .dock-item { flex-direction: row; justify-content: center; gap: 8px; padding: 10px 8px; }
  .dock-ico svg { width: 20px; height: 20px; }
  .ico-fill { width: 32px; height: 32px; }
  .ico-fill svg { width: 18px; height: 18px; }
  .scan-status-pill { top: calc(64px + env(safe-area-inset-top, 0px)); }
}
@media (orientation: landscape) and (max-height: 520px) {
  .dock-item > span:last-child { display: none; }
  .scan-dock { padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
}

.sheet { padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); max-height: 86dvh; }
.result-backdrop { padding: 14px; }

/* ---------------- Anti overflow global ---------------- */
* { min-width: 0; }
.page, .app-main, .app-shell, .glass, .table-wrap { max-width: 100%; }
img, canvas, svg, video { max-width: 100%; }


/* Kamera depan: cerminkan video agar terasa natural (harus setelah aturan
   transform:none pada #reader video di atas). */
#reader.cam-mirror video,
#reader.cam-mirror canvas {
  transform: scaleX(-1) !important;
}
