/* =====================================================================
   KPZ FACESCAN — Liquid Glass Design System
   Premium white + blue. Shared by login.html / index.html / admin.html
   ===================================================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  /* ---- Surface ---- */
  --bg-0:        #eef4ff;
  --bg-1:        #f7fbff;
  --bg-2:        #e4edfb;

  /* ---- Blue ramp ---- */
  --blue-50:     #eff6ff;
  --blue-100:    #dbeafe;
  --blue-200:    #bfdbfe;
  --blue-300:    #93c5fd;
  --blue-400:    #60a5fa;
  --blue-500:    #3b82f6;
  --blue-600:    #2563eb;
  --blue-700:    #1d4ed8;
  --blue-800:    #1e40af;

  --accent:      #0a6cff;
  --accent-soft: #4f9bff;
  --accent-deep: #0b4fd0;
  --cyan:        #06b6d4;

  /* ---- Status ---- */
  --ok:          #0d9f6e;
  --warn:        #d97706;
  --danger:      #e11d48;

  /* ---- Ink ---- */
  --ink-900:     #0a1a33;
  --ink-700:     #1e3255;
  --ink-500:     #55688a;
  --ink-400:     #7d8fac;
  --ink-300:     #a6b4c9;

  /* ---- Glass ---- */
  --glass:        rgba(255, 255, 255, 0.60);
  --glass-strong: rgba(255, 255, 255, 0.80);
  --glass-thin:   rgba(255, 255, 255, 0.38);
  --glass-line:   rgba(255, 255, 255, 0.85);
  --glass-edge:   rgba(10, 108, 255, 0.14);

  --blur:        22px;

  /* ---- Shadow ---- */
  --sh-sm:  0 1px 2px rgba(16, 42, 82, .05), 0 2px 8px rgba(16, 42, 82, .05);
  --sh-md:  0 2px 6px rgba(16, 42, 82, .06), 0 12px 28px rgba(16, 42, 82, .09);
  --sh-lg:  0 4px 12px rgba(16, 42, 82, .07), 0 24px 60px rgba(16, 42, 82, .13);
  --sh-xl:  0 8px 20px rgba(16, 42, 82, .08), 0 40px 90px rgba(16, 42, 82, .16);
  --sh-blue: 0 8px 26px rgba(10, 108, 255, .28);

  /* ---- Geometry ---- */
  --r-sm: 10px;
  --r:    16px;
  --r-lg: 22px;
  --r-xl: 28px;

  --font-display: 'Space Grotesk', 'Noto Sans Lao', system-ui, sans-serif;
  --font-body:    'Noto Sans Lao', 'IBM Plex Sans Thai', system-ui, -apple-system, sans-serif;
  --font-mono:    ui-monospace, 'SFMono-Regular', 'JetBrains Mono', Menlo, monospace;
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink-900);
  background: var(--bg-1);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ---------------------------------------------------------------
   Ambient light field — soft drifting colour, the "liquid" bed
   --------------------------------------------------------------- */
.aurora {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(1200px 800px at 12% -8%,  rgba(10, 108, 255, .20), transparent 62%),
    radial-gradient(1000px 700px at 92% 4%,   rgba(6, 182, 212, .16),  transparent 60%),
    radial-gradient(900px 800px  at 78% 102%, rgba(59, 130, 246, .20), transparent 62%),
    radial-gradient(700px 600px  at 4% 88%,   rgba(147, 197, 253, .28), transparent 60%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 45%, var(--bg-2) 100%);
}
.aurora::after {
  content: ""; position: absolute; inset: -20%;
  background:
    radial-gradient(560px 560px at 30% 30%, rgba(10, 108, 255, .13), transparent 60%),
    radial-gradient(520px 520px at 70% 65%, rgba(6, 182, 212, .11), transparent 60%);
  filter: blur(28px);
  animation: drift 26s ease-in-out infinite alternate;
}
@keyframes drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(3%, -2.5%, 0) scale(1.07); }
  100% { transform: translate3d(-2.5%, 3%, 0) scale(1.03); }
}

/* Fine mesh — reads as precision instrumentation, very low contrast */
.mesh {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(10, 108, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(10, 108, 255, .045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, #000 30%, transparent 78%);
}

.container { max-width: 1140px; margin: 0 auto; padding: 0 22px; position: relative; z-index: 1; }

/* ---------------------------------------------------------------
   Glass primitives
   --------------------------------------------------------------- */
.glass {
  position: relative;
  background: var(--glass);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-md), inset 0 1px 0 rgba(255, 255, 255, .95);
}
/* Specular sheen along the top edge — what sells the "liquid" read */
.glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(160deg, rgba(255,255,255,.75) 0%, rgba(255,255,255,.16) 30%, transparent 58%);
  opacity: .85;
}
.glass > * { position: relative; z-index: 1; }

.panel {
  position: relative;
  background: var(--glass);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-md), inset 0 1px 0 rgba(255, 255, 255, .95);
  padding: 20px 22px;
}

/* ---------------------------------------------------------------
   Buttons
   --------------------------------------------------------------- */
.btn {
  font-family: var(--font-body);
  font-size: 14px; font-weight: 600; letter-spacing: .2px;
  padding: 12px 20px;
  border-radius: 14px;
  border: 1px solid rgba(10, 108, 255, .16);
  background: var(--glass-strong);
  backdrop-filter: blur(14px) saturate(170%);
  -webkit-backdrop-filter: blur(14px) saturate(170%);
  color: var(--ink-700);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  box-shadow: var(--sh-sm), inset 0 1px 0 rgba(255,255,255,.9);
  transition: transform .16s cubic-bezier(.2,.8,.3,1), box-shadow .16s ease, background .16s ease, border-color .16s ease;
  position: relative; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--sh-md), inset 0 1px 0 rgba(255,255,255,.95); border-color: rgba(10,108,255,.32); }
.btn:active:not(:disabled)  { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--accent) 45%, var(--accent-deep) 100%);
  border-color: rgba(10, 108, 255, .5);
  color: #fff;
  box-shadow: var(--sh-blue), inset 0 1px 0 rgba(255,255,255,.42);
  text-shadow: 0 1px 2px rgba(0, 30, 90, .22);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 12px 34px rgba(10,108,255,.38), inset 0 1px 0 rgba(255,255,255,.5); }

.btn-cyan {
  background: linear-gradient(135deg, #22d3ee 0%, var(--cyan) 50%, #0891b2 100%);
  border-color: rgba(6, 182, 212, .5);
  color: #04252c;
  box-shadow: 0 8px 26px rgba(6, 182, 212, .30), inset 0 1px 0 rgba(255,255,255,.5);
}
.btn-ghost { background: var(--glass-thin); color: var(--ink-500); }
.btn-ghost:hover:not(:disabled) { color: var(--ink-900); }

.btn-danger {
  background: linear-gradient(135deg, #fb7185, var(--danger));
  border-color: rgba(225, 29, 72, .45); color: #fff;
  box-shadow: 0 6px 20px rgba(225, 29, 72, .26), inset 0 1px 0 rgba(255,255,255,.35);
}
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 11px; }

/* Google button — must stay recognisably Google */
.btn-google {
  background: #fff;
  border: 1px solid rgba(10, 27, 51, .14);
  color: #1f2937;
  font-weight: 600;
  box-shadow: var(--sh-sm);
}
.btn-google:hover:not(:disabled) { box-shadow: var(--sh-md); border-color: rgba(10, 27, 51, .22); }
.btn-google .g-logo { width: 19px; height: 19px; flex-shrink: 0; }

/* ---------------------------------------------------------------
   Form fields
   --------------------------------------------------------------- */
.field { display: block; margin: 0 0 15px; }
.field > span {
  display: block; font-size: 12px; font-weight: 600; letter-spacing: .3px;
  color: var(--ink-500); margin-bottom: 7px;
}
.field input, .field textarea, .field select, input[type=text], input[type=email], input[type=password], textarea {
  width: 100%;
  font-family: var(--font-body); font-size: 14.5px; color: var(--ink-900);
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(10, 27, 51, .12);
  border-radius: 13px;
  padding: 12px 15px;
  outline: none;
  box-shadow: inset 0 1px 3px rgba(16, 42, 82, .05);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.field input:focus, .field textarea:focus, input:focus, textarea:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(10, 108, 255, .13), inset 0 1px 3px rgba(16, 42, 82, .04);
}
input::placeholder, textarea::placeholder { color: var(--ink-300); }

/* ---------------------------------------------------------------
   Brand mark
   --------------------------------------------------------------- */
.brand { display: flex; align-items: center; gap: 9px; }
.brand-box {
  font-family: var(--font-display);
  font-size: 19px; font-weight: 700; letter-spacing: 1.6px;
  padding: 6px 13px; border-radius: 11px; white-space: nowrap;
}
.brand-face {
  background: linear-gradient(135deg, var(--accent-soft), var(--accent) 60%, var(--accent-deep));
  color: #fff;
  box-shadow: var(--sh-blue), inset 0 1px 0 rgba(255,255,255,.42);
}
.brand-scan {
  background: var(--glass-strong);
  backdrop-filter: blur(12px);
  color: var(--accent);
  border: 1px solid rgba(10, 108, 255, .26);
  box-shadow: var(--sh-sm), inset 0 1px 0 rgba(255,255,255,.9);
}

/* ---------------------------------------------------------------
   Header
   --------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, .62);
  backdrop-filter: blur(24px) saturate(190%);
  -webkit-backdrop-filter: blur(24px) saturate(190%);
  border-bottom: 1px solid rgba(255, 255, 255, .85);
  box-shadow: 0 1px 0 rgba(10, 108, 255, .07), 0 6px 26px rgba(16, 42, 82, .07);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 22px; flex-wrap: wrap; }

.user-chip {
  display: flex; align-items: center; gap: 11px; font-size: 13.5px; color: var(--ink-500);
  background: var(--glass-strong);
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 999px; padding: 5px 6px 5px 16px;
  box-shadow: var(--sh-sm), inset 0 1px 0 rgba(255,255,255,.95);
  backdrop-filter: blur(14px);
}
.user-chip b { color: var(--ink-900); font-weight: 600; }
.logout-btn {
  font-size: 12.5px; font-weight: 600; font-family: var(--font-body);
  border: 1px solid rgba(225, 29, 72, .2);
  background: rgba(255, 241, 244, .9); color: var(--danger);
  border-radius: 999px; padding: 7px 15px; cursor: pointer;
  transition: all .15s ease;
}
.logout-btn:hover { background: var(--danger); color: #fff; border-color: var(--danger); box-shadow: 0 4px 14px rgba(225,29,72,.28); }

/* ---------------------------------------------------------------
   Alerts / toast / modal
   --------------------------------------------------------------- */
.alert {
  display: none; margin: 0 0 16px; padding: 13px 16px; border-radius: 14px;
  font-size: 13.5px; font-weight: 500; line-height: 1.55;
  backdrop-filter: blur(10px);
}
.alert.show { display: block; animation: alertIn .22s cubic-bezier(.2,.8,.3,1); }
@keyframes alertIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
.alert-error { border: 1px solid rgba(225,29,72,.24); background: rgba(255, 241, 244, .88); color: #9f1239; }
.alert-info  { border: 1px solid rgba(10,108,255,.22); background: rgba(239, 246, 255, .9); color: var(--accent-deep); }
.alert-ok    { border: 1px solid rgba(13,159,110,.24); background: rgba(236, 253, 245, .9); color: #065f46; }

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  z-index: 200;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  color: var(--ink-900);
  border: 1px solid rgba(255,255,255,.95);
  border-radius: 16px;
  box-shadow: var(--sh-lg), inset 0 1px 0 rgba(255,255,255,.95);
  padding: 13px 24px; font-weight: 600; font-size: 13.5px;
  max-width: 92vw; text-align: center;
  animation: toastIn .24s cubic-bezier(.2,.8,.3,1);
}
@keyframes toastIn { from { transform: translateX(-50%) translateY(14px); opacity: 0; } to { transform: translateX(-50%) translateY(0); opacity: 1; } }

.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(190, 210, 240, .48);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: modalFade .2s ease;
}
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  position: relative; width: 100%; max-width: 560px;
  background: rgba(255, 255, 255, .84);
  backdrop-filter: blur(30px) saturate(190%);
  -webkit-backdrop-filter: blur(30px) saturate(190%);
  border: 1px solid rgba(255,255,255,.95);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-xl), inset 0 1px 0 rgba(255,255,255,.95);
  padding: 28px;
  max-height: 90vh; overflow-y: auto;
  animation: modalPop .26s cubic-bezier(.2,.9,.3,1);
}
@keyframes modalPop { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-card.wide { max-width: 720px; }
.modal-card h3 { font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: .2px; margin-bottom: 16px; }

.icon-btn {
  position: absolute; top: 14px; right: 14px; width: 36px; height: 36px;
  border-radius: 11px; border: 1px solid rgba(10,27,51,.1);
  background: rgba(255,255,255,.8); color: var(--ink-500);
  font-size: 15px; font-weight: 600; cursor: pointer; line-height: 1;
  box-shadow: var(--sh-sm);
  transition: all .14s ease;
}
.icon-btn:hover { background: var(--danger); color: #fff; border-color: var(--danger); transform: rotate(90deg); }

/* ---------------------------------------------------------------
   Spinner
   --------------------------------------------------------------- */
.spinner {
  display: inline-block; width: 15px; height: 15px; flex-shrink: 0;
  border: 2.5px solid rgba(255, 255, 255, .4);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -2px;
}
.spinner-blue { border-color: rgba(10,108,255,.2); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------
   Footer
   --------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid rgba(255,255,255,.85);
  background: rgba(255, 255, 255, .5);
  backdrop-filter: blur(18px);
  margin-top: 44px; padding: 26px 0; text-align: center;
}
.site-footer p { font-size: 13px; color: var(--ink-500); }
.site-footer .foot-sub { font-size: 11.5px; color: var(--ink-400); margin-top: 4px; }

/* ---------------------------------------------------------------
   Utility
   --------------------------------------------------------------- */
.section-title { font-family: var(--font-display); font-size: 15px; font-weight: 700; letter-spacing: .2px; margin-bottom: 15px; color: var(--ink-900); }
.muted { color: var(--ink-500); }
.mono  { font-family: var(--font-mono); font-size: 12px; }

@media (max-width: 640px) {
  .brand-box { font-size: 16px; padding: 5px 11px; }
  .btn { padding: 11px 16px; font-size: 13px; }
  .modal-card { padding: 22px; }
  .container { padding: 0 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
