/* ==========================================================================
   admin.css — portal petugas (tema gelap monstransi)
   ========================================================================== */
:root {
  --amber-50: #fffbeb;  --amber-100: #fef3c7; --amber-200: #fde68a; --amber-300: #fcd34d;
  --amber-400: #fbbf24; --amber-500: #f59e0b; --amber-600: #d97706; --amber-700: #b45309;
  --amber-900: #78350f; --amber-950: #451a03;
  --stone-100: #f5f5f4; --stone-200: #e7e5e4; --stone-300: #d6d3d1; --stone-400: #a8a29e;
  --stone-500: #78716c; --stone-600: #57534e; --stone-700: #44403c; --stone-800: #292524;
  --stone-900: #1c1917; --stone-950: #0c0a09;
  --emerald-50: #ecfdf5; --emerald-100: #d1fae5; --emerald-600: #059669; --emerald-700: #047857;
  --red-50: #fef2f2; --red-100: #fee2e2; --red-700: #b91c1c;
  --wa: #1fa855; --wa-dark: #178a45;
  --font-serif: "Playfair Display", Georgia, serif;
  --font-sans: "Geist", Inter, system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--stone-100);
  color: var(--stone-900);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; }
input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.ic, .ic-sm, .ic-xs { display: inline-block; width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.ic-sm { width: 1rem; height: 1rem; }
.ic-xs { width: 0.875rem; height: 0.875rem; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes ray-pulse { 0%, 100% { opacity: 0.65; } 50% { opacity: 1; } }
@keyframes glow-pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.96); transform-origin: 100px 86px; }
  50%      { opacity: 1;   transform: scale(1.05); transform-origin: 100px 86px; }
}
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }

.mono-rays line { animation: ray-pulse 2.6s ease-in-out infinite; animation-delay: var(--rd, 0s); }
.mono-glow { animation: glow-pulse 4.5s ease-in-out infinite; }

.spinner {
  display: block;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  border: 3px solid rgba(251, 191, 36, 0.25);
  border-top-color: var(--amber-400);
  animation: spin 1s linear infinite;
}

/* ------------------------------ Layar tunggu & login ------------------------------ */
.auth-wait {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--stone-950);
}
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: linear-gradient(to bottom right, var(--stone-950), var(--amber-950), var(--stone-900));
}
.login-card {
  width: 100%;
  max-width: 24rem;
  border-radius: 1.5rem;
  border: 1px solid rgba(245, 158, 11, 0.2);
  background: rgba(28, 25, 23, 0.8);
  padding: 2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  animation: fade-up 0.5s ease-out both;
}
.login-head { display: flex; flex-direction: column; align-items: center; text-align: center; }
.login-head h1 { margin-top: 1rem; font-family: var(--font-serif); font-size: 1.5rem; font-weight: 700; color: var(--amber-50); }
.login-head p { margin-top: 0.25rem; font-size: 0.75rem; color: rgba(254, 215, 170, 0.7); }
.login-form { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 0.5rem; }
.login-form label { font-size: 0.875rem; color: rgba(254, 243, 199, 0.8); }
.login-form input {
  height: 2.75rem;
  border-radius: 0.625rem;
  border: 1px solid rgba(245, 158, 11, 0.25);
  background: rgba(41, 37, 36, 0.7);
  color: var(--amber-50);
  padding: 0 0.75rem;
  outline: none;
}
.login-form input::placeholder { color: rgba(254, 215, 170, 0.3); }
.login-form input:focus { border-color: var(--amber-500); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25); }
.btn-login {
  margin-top: 0.25rem;
  height: 2.75rem;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  border-radius: 0.625rem;
  font-weight: 600;
  color: var(--stone-950);
  background: linear-gradient(to right, var(--amber-600), var(--amber-500));
  transition: filter 0.2s;
}
.btn-login:hover { filter: brightness(1.07); }
.btn-login:disabled { opacity: 0.7; cursor: wait; }
.back-link {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: rgba(254, 215, 170, 0.6);
}
.back-link:hover { color: var(--amber-200); }

/* ------------------------------ Header dasbor ------------------------------ */
.dash { display: flex; flex-direction: column; min-height: 100vh; }
.dash-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid rgba(120, 53, 15, 0.1);
  background: rgba(28, 25, 23, 0.95);
  backdrop-filter: blur(8px);
}
.dash-header-inner {
  max-width: 72rem;
  margin-inline: auto;
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: 1.25rem;
}
@media (min-width: 640px) { .dash-header-inner { padding-inline: 1.5rem; } }
.dash-brand { display: flex; align-items: center; gap: 0.625rem; }
.dash-brand .t1 { font-family: var(--font-serif); font-size: 0.9375rem; font-weight: 700; color: var(--amber-50); line-height: 1.2; }
@media (min-width: 640px) { .dash-brand .t1 { font-size: 1rem; } }
.dash-brand .t2 { font-size: 10px; color: rgba(254, 215, 170, 0.6); line-height: 1.2; }
.dash-actions { display: flex; align-items: center; gap: 0.5rem; }
.see-site {
  display: none;
  border-radius: 9999px;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(254, 243, 199, 0.7);
}
.see-site:hover { color: var(--amber-100); }
@media (min-width: 640px) { .see-site { display: block; } }
.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 9999px;
  padding: 0.375rem 0.875rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--amber-50);
  border: 1px solid rgba(245, 158, 11, 0.35);
  transition: background 0.2s;
}
.btn-logout:hover { background: rgba(245, 158, 11, 0.15); }

/* ------------------------------ Isi dasbor ------------------------------ */
.dash-main { flex: 1; width: 100%; max-width: 72rem; margin-inline: auto; padding: 1.5rem 1.25rem; }
@media (min-width: 640px) { .dash-main { padding: 2rem 1.5rem; } }

.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
@media (min-width: 640px) { .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; } }
.stat-card {
  border-radius: 1rem;
  border: 1px solid var(--stone-200);
  background: #fff;
  padding: 1rem 1.25rem;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.stat-card .num { font-family: var(--font-serif); font-size: 1.875rem; font-weight: 700; color: var(--amber-800); line-height: 1.2; }
.stat-card.ok .num { color: var(--emerald-700); }
.stat-card .lbl { font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.08em; color: var(--stone-500); }

.tabs {
  margin-top: 1.25rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  border-radius: 9999px;
  border: 1px solid var(--stone-200);
  background: #fff;
  padding: 0.375rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  border-radius: 9999px;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--stone-600);
  transition: background 0.2s, color 0.2s;
}
.tab.active { background: linear-gradient(to right, var(--amber-700), var(--amber-600)); color: #fff; box-shadow: 0 4px 6px rgba(69, 26, 3, 0.2); }

.panel {
  margin-top: 1.25rem;
  border-radius: 1.5rem;
  border: 1px solid var(--stone-200);
  background: #fff;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
@media (min-width: 640px) { .panel { padding: 1.5rem; } }
.panel-title { font-family: var(--font-serif); font-size: 1.125rem; font-weight: 700; color: var(--stone-900); margin-bottom: 0.75rem; }

.scan-grid { display: grid; gap: 1.5rem; }
@media (min-width: 768px) { .scan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.qr-reader {
  overflow: hidden;
  border-radius: 1rem;
  border: 2px dashed rgba(180, 83, 9, 0.35);
  background: var(--stone-950);
  min-height: 260px;
  display: grid;
  place-items: center;
}
.qr-reader video { border-radius: 1rem; width: 100% !important; }
.qr-reader::before {
  content: "Kamera aktif akan tampil di sini";
  grid-area: 1/1;
  color: var(--stone-500);
  font-size: 0.8125rem;
}
.qr-reader.has-video::before { content: none; }

.scan-ctl { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.875rem; }
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--stone-700);
  border: 1px solid var(--stone-200);
  border-radius: 0.75rem;
  padding: 0.625rem 0.875rem;
}
.switch { position: relative; display: inline-block; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.switch i {
  display: block;
  width: 2.5rem;
  height: 1.375rem;
  border-radius: 9999px;
  background: var(--stone-300);
  transition: background 0.2s;
  position: relative;
}
.switch i::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.375rem - 4px);
  height: calc(1.375rem - 4px);
  border-radius: 9999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s;
}
.switch input:checked + i { background: var(--amber-600); }
.switch input:checked + i::after { transform: translateX(1.125rem); }

.btn-scan {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  height: 2.75rem;
  border-radius: 0.75rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(to right, var(--amber-700), var(--amber-600));
  box-shadow: 0 4px 6px rgba(69, 26, 3, 0.2);
}
.btn-scan:hover { filter: brightness(1.06); }
.cam-note {
  margin-top: 0.75rem;
  border-radius: 0.5rem;
  background: var(--red-50);
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  color: var(--red-700);
}
.cam-note:empty { display: none; }

.manual-row { display: flex; gap: 0.5rem; }
.manual-row input {
  flex: 1;
  min-width: 0;
  height: 2.75rem;
  border-radius: 0.75rem;
  border: 1px solid var(--stone-300);
  padding: 0 0.75rem;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  outline: none;
  text-transform: uppercase;
}
.manual-row input:focus { border-color: var(--amber-600); box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.25); }
.btn-manual {
  height: 2.75rem;
  padding: 0 1rem;
  border-radius: 0.75rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(to right, var(--amber-700), var(--amber-600));
}
.btn-manual:disabled { opacity: 0.5; cursor: not-allowed; }

.verify-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  border-radius: 1rem;
  border: 1px dashed var(--stone-300);
  padding: 2.5rem 1rem;
  color: var(--stone-500);
  text-align: center;
  font-size: 0.8125rem;
}

.vf-card { border-radius: 1rem; border: 2px solid var(--amber-500); background: rgba(255, 251, 235, 0.6); padding: 1.25rem; animation: fade-up 0.25s ease-out both; }
.vf-card.ok { border-color: rgba(16, 185, 129, 0.5); background: rgba(236, 253, 245, 0.6); }
.vf-head { display: flex; align-items: center; gap: 0.75rem; }
.vf-head .ic { width: 2.5rem; height: 2.5rem; flex-shrink: 0; }
.vf-head .ic.ok { color: var(--emerald-600); }
.vf-head .ic.warn { color: var(--amber-600); }
.vf-name { font-family: var(--font-serif); font-size: 1.25rem; font-weight: 700; color: var(--stone-900); }
.vf-code { font-family: var(--font-mono); font-size: 0.875rem; font-weight: 600; letter-spacing: 0.05em; color: var(--stone-600); }
.vf-grid { margin-top: 1rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; font-size: 0.875rem; }
.vf-cell { border-radius: 0.75rem; background: rgba(255, 255, 255, 0.8); padding: 0.75rem; }
.vf-cell .lbl { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--stone-400); }
.vf-cell .val { font-weight: 700; color: var(--stone-800); }
.vf-cell .val.ok { color: var(--emerald-700); }
.vf-cell .val.warn { color: var(--amber-700); }
.vf-dup {
  margin-top: 0.75rem;
  border-radius: 0.5rem;
  background: var(--red-100);
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--red-700);
}
.vf-actions { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.btn-vf {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  height: 2.25rem;
  padding: 0 0.875rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
}
.btn-vf.checkin { background: var(--emerald-600); color: #fff; }
.btn-vf.checkin:hover { background: var(--emerald-700); }
.btn-vf.undo { border: 1px solid var(--stone-300); color: var(--stone-600); background: #fff; }
.btn-vf.undo:hover { background: var(--stone-100); }
.btn-vf.wa { background: var(--wa); color: #fff; }
.btn-vf.wa:hover { background: var(--wa-dark); }
.next-hint { margin-top: 0.75rem; font-size: 0.75rem; color: var(--stone-500); }

/* ------------------------------ Tab daftar ------------------------------ */
.list-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.search-wrap { position: relative; flex: 1; min-width: 12rem; }
.search-wrap .ic { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--stone-400); }
.search-wrap input {
  width: 100%;
  height: 2.5rem;
  border-radius: 0.75rem;
  border: 1px solid var(--stone-300);
  padding: 0 0.75rem 0 2.25rem;
  font-size: 0.875rem;
  outline: none;
}
.search-wrap input:focus { border-color: var(--amber-600); box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.25); }
.btn-search {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  height: 2.5rem;
  padding: 0 1rem;
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: #fff;
  background: linear-gradient(to right, var(--amber-700), var(--amber-600));
}
.btn-refresh {
  display: inline-grid;
  place-items: center;
  height: 2.5rem;
  width: 2.5rem;
  border-radius: 0.75rem;
  border: 1px solid var(--stone-300);
  color: var(--stone-600);
  background: #fff;
}
.btn-refresh:hover { background: var(--stone-100); }

.table-scroll { margin-top: 1.25rem; max-height: 60vh; overflow: auto; border-radius: 0.75rem; border: 1px solid var(--stone-200); }
.reg-table { width: 100%; min-width: 720px; border-collapse: collapse; text-align: left; font-size: 0.875rem; background: #fff; }
.reg-table thead th {
  position: sticky;
  top: 0;
  background: var(--amber-50);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--amber-900);
  padding: 0.75rem 1rem;
}
.reg-table tbody td { padding: 0.75rem 1rem; border-top: 1px solid var(--stone-100); vertical-align: top; }
.reg-table tbody tr:hover { background: rgba(255, 251, 235, 0.4); }
.reg-table .code { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; color: var(--stone-800); }
.reg-table .name { font-weight: 600; color: var(--stone-800); }
.reg-table .sub { font-size: 0.75rem; color: var(--stone-500); }
.reg-table .phone { font-size: 0.75rem; color: var(--stone-600); }
.reg-table .qty { text-align: center; font-weight: 600; color: var(--stone-800); }
.reg-table .date { font-size: 0.75rem; color: var(--stone-500); }
.reg-table .ta-c { text-align: center; }
.reg-table .ta-r { text-align: right; }
.badge-mini {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 9999px;
  padding: 0.25rem 0.625rem;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-mini.ok { background: var(--emerald-100); color: var(--emerald-700); }
.badge-mini.wait { background: var(--stone-100); color: var(--stone-600); }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.375rem; }
.btn-row {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  height: 2rem;
  padding: 0 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
}
.btn-row.checkin { background: var(--emerald-600); color: #fff; }
.btn-row.checkin:hover { background: var(--emerald-700); }
.btn-row.undo { border: 1px solid var(--stone-300); color: var(--stone-600); background: #fff; }
.btn-row.undo:hover { background: var(--stone-100); }
.btn-row.wa { display: grid; place-items: center; width: 2rem; padding: 0; background: var(--wa); color: #fff; }
.btn-row.wa:hover { background: var(--wa-dark); }
.empty-row { text-align: center; padding: 2.5rem 1rem !important; color: var(--stone-500); font-size: 0.875rem; }
.list-note { margin-top: 0.75rem; font-size: 0.75rem; color: var(--stone-500); }

.dash-footer {
  margin-top: auto;
  background: var(--stone-900);
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: rgba(254, 243, 199, 0.5);
}

/* ------------------------------ Toast ------------------------------ */
.toast-stack {
  position: fixed;
  z-index: 100;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(22rem, calc(100vw - 2rem));
}
.toast {
  display: flex;
  gap: 0.625rem;
  border-radius: 0.75rem;
  border: 1px solid var(--stone-200);
  background: #fff;
  padding: 0.875rem 1rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
  animation: toast-in 0.25s ease-out both;
}
.toast .dot { flex-shrink: 0; margin-top: 2px; width: 0.5rem; height: 0.5rem; border-radius: 9999px; background: var(--amber-600); }
.toast.error .dot { background: var(--red-700); }
.toast .tt { font-size: 0.875rem; font-weight: 600; color: var(--stone-900); }
.toast .td { margin-top: 0.125rem; font-size: 0.8125rem; color: var(--stone-600); }
