/* ============================================================
   ALTITUDE 2026 — QUANTUM VERIFY SCANNER v9.0
   Phone-Perfect · Cinematic · Enterprise-Grade
   ============================================================ */

/* ==================== ROOT TOKENS ==================== */
:root {
  --scan-green-dark: #0D3B12;
  --scan-green: #1B5E20;
  --scan-green-mid: #2E7D32;
  --scan-green-bright: #4CAF50;
  --scan-green-light: #81C784;
  --scan-green-pale: #A5D6A7;
  --scan-green-wash: #E8F5E9;
  --scan-red: #D32F2F;
  --scan-orange: #F57C00;
  --scan-blue: #1565C0;
  --scan-purple: #7B1FA2;
  --scan-white: #FFFFFF;
  --scan-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --scan-smooth: cubic-bezier(0.25, 1, 0.5, 1);
}

/* ==================== RESET ==================== */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

/* ==================== BODY ==================== */
body.verify-body {
  background: linear-gradient(135deg, #051D08 0%, #0D3B12 40%, #1a1a1a 100%);
  min-height: 100vh;
  color: #fff;
  overflow: hidden;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
}

body.verify-body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(76,175,80,0.1) 0%, transparent 50%),
    radial-gradient(circle at 85% 80%, rgba(129,199,132,0.08) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ==================== LOGIN SCREEN ==================== */
.scanner-login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9999;
  background: linear-gradient(135deg, #051D08 0%, #0D3B12 50%, #1B5E20 100%);
  overflow: hidden;
}

.scanner-login-screen::before,
.scanner-login-screen::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(76,175,80,0.25), transparent 70%);
  animation: loginOrbFloat 10s ease-in-out infinite;
  filter: blur(3px);
  pointer-events: none;
}

.scanner-login-screen::before {
  width: 400px;
  height: 400px;
  top: -100px;
  left: -100px;
}

.scanner-login-screen::after {
  width: 500px;
  height: 500px;
  bottom: -150px;
  right: -150px;
  animation-delay: -5s;
}

@keyframes loginOrbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.6; }
  50% { transform: translate(40px, -30px) scale(1.1); opacity: 0.9; }
}

.scanner-login-card {
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 28px;
  padding: 36px 28px 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 30px 100px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.15);
  position: relative;
  z-index: 2;
  animation: loginCardEntry 0.8s var(--scan-spring);
}

@keyframes loginCardEntry {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.scanner-login-header {
  text-align: center;
  margin-bottom: 24px;
}

.scanner-login-logo {
  height: 52px;
  margin: 0 auto 16px;
  display: block;
  filter: drop-shadow(0 8px 24px rgba(76,175,80,0.4));
  animation: logoFloat 4s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.scanner-login-header h1 {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.scanner-login-header p {
  color: rgba(255,255,255,0.65);
  font-size: 0.85rem;
  margin-bottom: 18px;
}

.scanner-event-info {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.scanner-event-info span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: rgba(76,175,80,0.15);
  border: 1px solid rgba(76,175,80,0.25);
  border-radius: 50px;
  font-size: 0.7rem;
  color: var(--scan-green-pale);
  font-weight: 500;
}

.scanner-event-info i { width: 12px; height: 12px; }

/* Login Form */
.scanner-login-form .form-group { margin-bottom: 14px; }

.scanner-login-form label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  margin-bottom: 8px;
}

.scanner-login-form label i {
  width: 15px;
  height: 15px;
  color: var(--scan-green-light);
}

.scanner-login-form input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  color: #fff;
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.25s var(--scan-smooth);
}

.scanner-login-form input::placeholder { color: rgba(255,255,255,0.35); }

.scanner-login-form input:focus {
  border-color: #66BB6A;
  background: rgba(255,255,255,0.1);
  box-shadow: 0 0 0 4px rgba(76,175,80,0.15);
  outline: none;
}

.password-field {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field input {
  flex: 1;
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  padding: 8px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
}

.password-toggle:hover,
.password-toggle:active {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.password-toggle i { width: 18px; height: 18px; }

.login-error {
  background: rgba(211,47,47,0.18);
  border: 1px solid rgba(211,47,47,0.35);
  color: #FFCDD2;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-error::before {
  content: '⚠';
  font-size: 1rem;
  flex-shrink: 0;
}

#scannerLoginBtn {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, var(--scan-green-mid), var(--scan-green-bright), #66BB6A);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s var(--scan-spring);
  box-shadow: 0 8px 24px rgba(76,175,80,0.4);
  margin-top: 6px;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

#scannerLoginBtn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  transition: left 0.6s var(--scan-smooth);
}

#scannerLoginBtn:hover::before { left: 100%; }
#scannerLoginBtn:active { transform: scale(0.98); }
#scannerLoginBtn i { width: 18px; height: 18px; }

.back-to-site {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
  padding: 8px;
  color: rgba(255,255,255,0.5);
  font-size: 0.82rem;
  text-decoration: none;
  transition: color 0.2s;
}

.back-to-site:hover { color: var(--scan-green-light); }
.back-to-site i { width: 14px; height: 14px; }

/* ==================== SCANNER APP LAYOUT ==================== */
.scanner-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

/* ==================== TOP BAR ==================== */
.scanner-topbar {
  background: rgba(10,10,10,0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(76,175,80,0.2);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.scanner-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.topbar-logo {
  height: 32px;
  width: auto;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
  flex-shrink: 0;
}

.topbar-info {
  min-width: 0;
  overflow: hidden;
}

.topbar-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-sub {
  font-size: 0.7rem;
  color: var(--scan-green-light);
  font-weight: 500;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scanner-topbar-right {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.btn-icon-light {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  transition: all 0.2s var(--scan-smooth);
  position: relative;
}

.btn-icon-light:hover,
.btn-icon-light:active {
  background: rgba(76,175,80,0.2);
  color: #fff;
  border-color: rgba(76,175,80,0.4);
}

.btn-icon-light:active { transform: scale(0.95); }
.btn-icon-light i { width: 18px; height: 18px; }

.btn-icon-light.pulse::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--scan-green-bright);
  box-shadow: 0 0 8px var(--scan-green-bright);
  animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* ==================== NETWORK STATUS ==================== */
.network-status {
  padding: 8px 16px;
  background: linear-gradient(90deg, rgba(211,47,47,0.2), rgba(211,47,47,0.1));
  border-bottom: 1px solid rgba(211,47,47,0.3);
  color: #FFCDD2;
  font-size: 0.78rem;
  font-weight: 600;
  display: none;
  align-items: center;
  gap: 8px;
  justify-content: center;
  flex-shrink: 0;
  animation: netSlideDown 0.3s var(--scan-smooth);
}

.network-status.show { display: flex; }
.network-status i { width: 14px; height: 14px; flex-shrink: 0; }

@keyframes netSlideDown {
  from { opacity: 0; transform: translateY(-100%); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== STATS BAR ==================== */
.scanner-stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 14px 16px;
  background: rgba(0,0,0,0.35);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  transition: all 0.4s var(--scan-smooth);
  overflow: hidden;
  flex-shrink: 0;
}

.scanner-stats-bar.hidden {
  max-height: 0;
  padding: 0 16px;
  border-bottom: none;
  opacity: 0;
  pointer-events: none;
}

.scan-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  transition: all 0.3s var(--scan-smooth);
  min-width: 0;
}

.scan-stat:hover {
  background: rgba(255,255,255,0.1);
  transform: translateY(-2px);
}

.scan-stat-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.scan-stat-icon i { width: 16px; height: 16px; }

.scan-stat-icon.green { background: rgba(76,175,80,0.2); color: #66BB6A; border: 1px solid rgba(76,175,80,0.3); }
.scan-stat-icon.blue { background: rgba(21,101,192,0.2); color: #64B5F6; border: 1px solid rgba(21,101,192,0.3); }
.scan-stat-icon.orange { background: rgba(245,124,0,0.2); color: #FFB74D; border: 1px solid rgba(245,124,0,0.3); }
.scan-stat-icon.purple { background: rgba(123,31,162,0.2); color: #BA68C8; border: 1px solid rgba(123,31,162,0.3); }

.scan-stat > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.scan-stat-num {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.scan-stat-lbl {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==================== MAIN CONTENT ==================== */
.scanner-main {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.scanner-main::-webkit-scrollbar { width: 6px; }
.scanner-main::-webkit-scrollbar-track { background: transparent; }
.scanner-main::-webkit-scrollbar-thumb { background: rgba(76,175,80,0.4); border-radius: 3px; }

/* ==================== MODE TOGGLE ==================== */
.scan-mode-toggle {
  display: flex;
  background: rgba(255,255,255,0.05);
  padding: 4px;
  border-radius: 50px;
  border: 1px solid rgba(255,255,255,0.1);
  align-self: center;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 340px;
}

.scan-mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.3s var(--scan-smooth);
  font-family: inherit;
}

.scan-mode-btn i { width: 15px; height: 15px; }

.scan-mode-btn.active {
  background: linear-gradient(135deg, var(--scan-green-mid), var(--scan-green-bright));
  color: #fff;
  box-shadow: 0 4px 12px rgba(76,175,80,0.4);
}

.scan-mode-btn:active { transform: scale(0.97); }

.scan-panel {
  display: none;
  animation: panelFade 0.4s var(--scan-smooth);
}

.scan-panel.active { display: block; }

@keyframes panelFade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== CAMERA SCANNER ==================== */
.scanner-wrapper {
  position: relative;
  max-width: 400px;
  margin: 0 auto;
  border-radius: 24px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 1;
  box-shadow:
    0 30px 80px rgba(0,0,0,0.6),
    0 0 0 1px rgba(76,175,80,0.3),
    inset 0 0 0 1px rgba(255,255,255,0.05);
}

.scanner-wrapper #qrReader {
  width: 100% !important;
  height: 100% !important;
}

.scanner-wrapper #qrReader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 24px;
}

/* Hide default html5-qrcode UI */
#qrReader__dashboard,
#qrReader__scan_region img,
#qrReader__dashboard_section_swaplink,
#qrReader__dashboard_section_csr,
#qrReader__header_message,
#qrReader__filescan_input {
  display: none !important;
}

#qrReader__scan_region {
  background: transparent !important;
  min-height: unset !important;
  padding: 0 !important;
}

/* Scanner Frame Overlay */
.scanner-overlay-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70%;
  height: 70%;
  pointer-events: none;
  z-index: 5;
}

.frame-corner {
  position: absolute;
  width: 34px;
  height: 34px;
  border-color: #66BB6A;
  border-style: solid;
  border-width: 0;
  filter: drop-shadow(0 0 12px rgba(76,175,80,0.8));
  transition: all 0.3s;
}

.frame-corner.tl { top: 0; left: 0; border-top-width: 4px; border-left-width: 4px; border-top-left-radius: 14px; }
.frame-corner.tr { top: 0; right: 0; border-top-width: 4px; border-right-width: 4px; border-top-right-radius: 14px; }
.frame-corner.bl { bottom: 0; left: 0; border-bottom-width: 4px; border-left-width: 4px; border-bottom-left-radius: 14px; }
.frame-corner.br { bottom: 0; right: 0; border-bottom-width: 4px; border-right-width: 4px; border-bottom-right-radius: 14px; }

/* Scan Line */
.scan-line {
  position: absolute;
  top: 5%;
  left: 5%;
  width: 90%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #66BB6A, transparent);
  box-shadow: 0 0 25px #66BB6A, 0 0 50px rgba(76,175,80,0.4);
  animation: scanMove 2.5s ease-in-out infinite;
  border-radius: 2px;
}

@keyframes scanMove {
  0% { top: 5%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 95%; opacity: 0; }
}

/* Dark overlay outside scan region */
.scanner-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)),
    linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5));
  background-position: top, bottom;
  background-size: 100% 15%, 100% 15%;
  background-repeat: no-repeat;
  z-index: 4;
  pointer-events: none;
}

/* Scanning Indicator */
.scanning-indicator {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 6px 14px;
  border-radius: 50px;
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #66BB6A;
  border: 1px solid rgba(76,175,80,0.35);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.scanning-indicator.active { display: flex; }

.scanning-indicator::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #66BB6A;
  box-shadow: 0 0 10px #66BB6A;
  animation: scanPulse 1s ease-in-out infinite;
}

@keyframes scanPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* Scanner Controls */
.scanner-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.scanner-controls .btn {
  padding: 13px 22px;
  font-size: 0.9rem;
  min-width: 120px;
  border-radius: 12px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.3s var(--scan-spring);
  font-family: inherit;
}

.scanner-controls .btn:active { transform: scale(0.96); }
.scanner-controls .btn i { width: 16px; height: 16px; }

.scanner-controls .btn-primary {
  background: linear-gradient(135deg, var(--scan-green-mid), var(--scan-green-bright));
  color: #fff;
  box-shadow: 0 6px 20px rgba(76,175,80,0.4);
}

.scanner-controls .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(76,175,80,0.5);
}

.scanner-controls .btn-danger {
  background: linear-gradient(135deg, #B71C1C, var(--scan-red));
  color: #fff;
  box-shadow: 0 6px 20px rgba(211,47,47,0.4);
}

.scanner-controls .btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(211,47,47,0.5);
}

.scanner-controls .btn-outline {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
}

.scanner-controls .btn-outline:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(129,199,132,0.4);
}

.scanner-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  margin-top: 12px;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.75);
  text-align: center;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.scanner-hint i { width: 16px; height: 16px; color: var(--scan-green-light); flex-shrink: 0; }

/* ==================== MANUAL ENTRY ==================== */
.manual-entry-card {
  max-width: 460px;
  margin: 0 auto;
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.manual-entry-card h3 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1.15rem;
  color: #fff;
  margin-bottom: 8px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
}

.manual-entry-card h3 i {
  width: 22px;
  height: 22px;
  color: #66BB6A;
  padding: 8px;
  background: rgba(76,175,80,0.15);
  border-radius: 10px;
  box-sizing: content-box;
}

.manual-entry-card > p {
  text-align: center;
  color: rgba(255,255,255,0.6);
  font-size: 0.88rem;
  margin-bottom: 22px;
}

.manual-entry-card .form-group { margin-bottom: 18px; }

.manual-entry-card label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  margin-bottom: 8px;
}

.manual-entry-card input {
  width: 100%;
  padding: 14px 18px;
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  color: #fff;
  font-size: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  text-align: center;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: all 0.25s var(--scan-smooth);
}

.manual-entry-card input::placeholder {
  color: rgba(255,255,255,0.3);
  letter-spacing: normal;
  font-family: 'Inter', sans-serif;
  text-transform: none;
  font-weight: 400;
}

.manual-entry-card input:focus {
  border-color: #66BB6A;
  background: rgba(255,255,255,0.1);
  box-shadow: 0 0 0 4px rgba(76,175,80,0.2);
  outline: none;
}

.manual-entry-card button[type="submit"] {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--scan-green-mid), var(--scan-green-bright));
  color: #fff;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s var(--scan-spring);
  box-shadow: 0 6px 20px rgba(76,175,80,0.35);
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.manual-entry-card button[type="submit"]::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  transition: left 0.6s var(--scan-smooth);
}

.manual-entry-card button[type="submit"]:hover::before { left: 100%; }
.manual-entry-card button[type="submit"]:active { transform: scale(0.97); }
.manual-entry-card button[type="submit"] i { width: 18px; height: 18px; }

/* ==================== RESULT PANEL ==================== */
.result-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.result-panel.active {
  display: flex;
  animation: overlayFade 0.3s;
}

@keyframes overlayFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.result-card {
  background: #fff;
  border-radius: 24px;
  max-width: 460px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 28px 24px;
  position: relative;
  text-align: center;
  box-shadow: 0 40px 100px rgba(0,0,0,0.5);
  animation: resultSlideUp 0.5s var(--scan-spring);
  color: #2d2d2d;
}

@keyframes resultSlideUp {
  from { opacity: 0; transform: translateY(50px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.result-card.success { border-top: 6px solid var(--scan-green-bright); }
.result-card.warning { border-top: 6px solid var(--scan-orange); }
.result-card.error { border-top: 6px solid var(--scan-red); }

.result-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(0,0,0,0.06);
  border: none;
  color: #717171;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 10;
}

.result-close:hover,
.result-close:active {
  background: rgba(0,0,0,0.12);
  color: #1a1a1a;
  transform: rotate(90deg);
}

.result-close i { width: 20px; height: 20px; }

.result-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  position: relative;
}

.result-icon::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.15;
  animation: iconRing 2s ease-in-out infinite;
}

@keyframes iconRing {
  0%, 100% { transform: scale(1); opacity: 0.15; }
  50% { transform: scale(1.15); opacity: 0.05; }
}

.result-icon i { width: 44px; height: 44px; }

.result-content h3 {
  font-size: 1.35rem;
  margin-bottom: 10px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.result-content p {
  font-size: 0.92rem;
  color: #555;
  margin-bottom: 10px;
  line-height: 1.6;
}

.result-query {
  font-size: 0.8rem;
  color: #999;
  margin-top: 12px;
}

.result-query code {
  background: #f0f2f5;
  padding: 3px 10px;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--scan-green-mid);
}

/* Result Details */
.result-details {
  margin-top: 20px;
  text-align: left;
}

.result-name {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: #1B5E20;
  text-align: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px dashed #C8E6C9;
}

.result-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  background: linear-gradient(135deg, #E8F5E9, #f8fff8);
  border: 1px solid #C8E6C9;
  border-radius: 14px;
  padding: 14px;
}

.result-info-grid > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.result-info-grid .lbl {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #999;
}

.result-info-grid .val {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1a1a1a;
  word-break: break-word;
}

.result-actions {
  margin-top: 20px;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.result-actions button {
  padding: 11px 22px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  font-family: inherit;
}

.result-actions button:active { transform: scale(0.96); }

.result-actions .btn-continue {
  background: linear-gradient(135deg, var(--scan-green-mid), var(--scan-green-bright));
  color: #fff;
  box-shadow: 0 4px 12px rgba(76,175,80,0.35);
}

.result-actions .btn-continue:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(76,175,80,0.5);
}

.result-actions i { width: 15px; height: 15px; }

/* ==================== RECENT DRAWER ==================== */
.recent-drawer {
  background: rgba(10,10,10,0.98);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid rgba(76,175,80,0.25);
  box-shadow: 0 -12px 40px rgba(0,0,0,0.5);
  max-height: 60px;
  transition: max-height 0.4s var(--scan-smooth);
  overflow: hidden;
  position: sticky;
  bottom: 0;
  z-index: 50;
  flex-shrink: 0;
}

.recent-drawer.open { max-height: 420px; }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.drawer-header:hover,
.drawer-header:active { background: rgba(76,175,80,0.1); }

.drawer-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
}

.drawer-title > i { width: 20px; height: 20px; color: #66BB6A; }

.drawer-count {
  background: linear-gradient(135deg, var(--scan-green-mid), var(--scan-green-bright));
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
  min-width: 26px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(76,175,80,0.4);
}

#drawerIcon {
  width: 22px;
  height: 22px;
  color: rgba(255,255,255,0.5);
  transition: transform 0.3s;
}

.recent-drawer.open #drawerIcon { transform: rotate(180deg); }

.drawer-content {
  max-height: 340px;
  overflow-y: auto;
  padding: 0 20px 8px;
  -webkit-overflow-scrolling: touch;
}

.drawer-content::-webkit-scrollbar { width: 5px; }
.drawer-content::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); }
.drawer-content::-webkit-scrollbar-thumb { background: rgba(76,175,80,0.4); border-radius: 3px; }

.recent-scan-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  animation: scanItemSlide 0.3s;
}

@keyframes scanItemSlide {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

.recent-scan-item:last-child { border-bottom: none; }

.recent-scan-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(76,175,80,0.2), rgba(76,175,80,0.1));
  border: 1px solid rgba(76,175,80,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.recent-scan-icon i { width: 18px; height: 18px; color: #66BB6A; }

.recent-scan-info { flex: 1; min-width: 0; }

.recent-scan-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-scan-meta {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-scan-time {
  font-size: 0.72rem;
  font-weight: 700;
  color: #66BB6A;
  flex-shrink: 0;
  padding: 4px 10px;
  background: rgba(76,175,80,0.1);
  border-radius: 20px;
  white-space: nowrap;
}

.no-scans {
  text-align: center;
  padding: 28px 20px;
  color: rgba(255,255,255,0.4);
}

.no-scans i {
  width: 40px;
  height: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.no-scans p { font-size: 0.88rem; }

.drawer-actions {
  padding: 12px 0 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  gap: 8px;
  justify-content: center;
}

.drawer-action-btn {
  padding: 8px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: rgba(255,255,255,0.75);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}

.drawer-action-btn:hover,
.drawer-action-btn:active {
  background: rgba(76,175,80,0.15);
  color: #fff;
}

.drawer-action-btn i { width: 13px; height: 13px; }

/* ==================== TOAST ==================== */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 14px 22px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
  border: 1px solid rgba(76,175,80,0.3);
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  z-index: 10000;
  opacity: 0;
  transition: all 0.3s var(--scan-spring);
  max-width: 90%;
  text-align: left;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success { border-left: 4px solid var(--scan-green-bright); }
.toast.success .toast-icon { color: #66BB6A; }
.toast.error { border-left: 4px solid var(--scan-red); }
.toast.error .toast-icon { color: #EF5350; }
.toast.warning { border-left: 4px solid var(--scan-orange); }
.toast.warning .toast-icon { color: #FFB74D; }

.toast-icon { width: 20px; height: 20px; flex-shrink: 0; }

/* ==================== LOADING ==================== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}

.loading-overlay.active { display: flex; }

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(76,175,80,0.2);
  border-top: 4px solid #66BB6A;
  border-right: 4px solid var(--scan-green-bright);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay p { color: #fff; font-size: 0.95rem; font-weight: 500; }

/* ==================== RESPONSIVE: TABLET ==================== */
@media (max-width: 768px) {
  .scanner-topbar { padding: 10px 14px; min-height: 56px; }
  .topbar-logo { height: 28px; }
  .topbar-title { font-size: 0.85rem; }
  .topbar-sub { font-size: 0.65rem; }

  .scanner-stats-bar {
    grid-template-columns: repeat(2, 1fr);
    padding: 12px 14px;
    gap: 8px;
  }

  .scan-stat { padding: 10px; }
  .scan-stat-icon { width: 30px; height: 30px; }
  .scan-stat-icon i { width: 15px; height: 15px; }
  .scan-stat-num { font-size: 1rem; }
  .scan-stat-lbl { font-size: 0.58rem; letter-spacing: 0.5px; }

  .scanner-main { padding: 14px; gap: 14px; }
  .scanner-wrapper { max-width: 340px; }
  .scan-mode-toggle { max-width: 320px; }
  .scan-mode-btn { padding: 10px 14px; font-size: 0.82rem; }

  .scanner-controls { gap: 8px; }
  .scanner-controls .btn { min-width: unset; flex: 1; padding: 11px 14px; font-size: 0.85rem; }

  .result-card { padding: 24px 20px; border-radius: 20px; }
  .result-info-grid { padding: 12px; gap: 8px; }
  .result-icon { width: 70px; height: 70px; }
  .result-icon i { width: 38px; height: 38px; }
  .result-content h3 { font-size: 1.2rem; }
  .result-name { font-size: 1.1rem; }

  .toast { bottom: 80px; padding: 12px 18px; font-size: 0.85rem; }
  .btn-icon-light { width: 38px; height: 38px; }
  .btn-icon-light i { width: 17px; height: 17px; }
}

/* ==================== RESPONSIVE: MOBILE ==================== */
@media (max-width: 480px) {
  .scanner-wrapper { max-width: 300px; border-radius: 20px; }
  .scanner-wrapper #qrReader video { border-radius: 20px; }
  .manual-entry-card { padding: 24px 20px; }
  .result-info-grid { grid-template-columns: 1fr; }
  .result-name { font-size: 1.05rem; }
  .scanner-login-card { padding: 32px 22px 20px; border-radius: 22px; }
  .scanner-login-header h1 { font-size: 1.3rem; }
  .scanner-login-logo { height: 44px; }
  .drawer-header { padding: 14px 16px; }
  .drawer-content { padding: 0 16px 6px; }
  .recent-scan-name { font-size: 0.85rem; }
  .scan-mode-btn { padding: 9px 10px; font-size: 0.8rem; }
  .frame-corner { width: 28px; height: 28px; }
  .result-card { padding: 22px 18px; border-radius: 18px; }
  .result-actions { flex-direction: column; align-items: stretch; }
  .result-actions button { width: 100%; justify-content: center; }
  .scanner-event-info { gap: 6px; }
  .scanner-event-info span { padding: 4px 10px; font-size: 0.65rem; }
}

/* ==================== RESPONSIVE: TINY MOBILE ==================== */
@media (max-width: 380px) {
  .scanner-topbar { padding: 8px 12px; }
  .topbar-info .topbar-sub { display: none; }
  .btn-icon-light { width: 36px; height: 36px; }
  .scanner-stats-bar { grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 12px; }
  .scan-stat { padding: 8px; }
  .scan-stat-num { font-size: 0.95rem; }
  .scan-stat-icon { width: 28px; height: 28px; }
  .scanner-wrapper { max-width: 280px; border-radius: 18px; }
  .scanner-wrapper #qrReader video { border-radius: 18px; }
  .scanner-login-card { padding: 28px 18px; border-radius: 20px; }
  .frame-corner { width: 24px; height: 24px; border-width: 3px; }
}

/* ==================== LANDSCAPE MOBILE ==================== */
@media (max-height: 500px) and (orientation: landscape) {
  .scanner-stats-bar { display: none; }
  .scanner-wrapper { max-width: 240px; }
  .scanner-main { flex-direction: row; align-items: flex-start; padding: 10px; }
  .scan-panel.active { flex: 1; }
  .recent-drawer { display: none; }
  .network-status { font-size: 0.72rem; padding: 6px 12px; }
  .toast { bottom: 20px; }
}

/* ==================== iOS SAFE AREA ==================== */
@supports (padding: max(0px)) {
  .scanner-topbar {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .scanner-main {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .recent-drawer {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .toast {
    bottom: max(90px, calc(90px + env(safe-area-inset-bottom)));
  }
}

/* ==================== ACCESSIBILITY ==================== */
@media (prefers-reduced-motion: reduce) {
  .scan-line,
  .result-icon::before,
  .scanner-login-screen::before,
  .scanner-login-screen::after,
  .scanner-login-logo,
  .scanning-indicator::before,
  .btn-icon-light.pulse::after,
  .recent-scan-item,
  .network-status,
  #scannerLoginBtn::before,
  .manual-entry-card button[type="submit"]::before {
    animation: none !important;
    transition: none !important;
  }
}

@media (prefers-contrast: high) {
  .frame-corner { border-width: 6px; }
  .scan-line { height: 5px; }
  .result-card { border-top-width: 8px; }
  .scan-stat { border-width: 2px; }
  .scanner-wrapper { border: 3px solid #66BB6A; }
}

/* ==================== FOCUS STATES ==================== */
button:focus-visible,
input:focus-visible {
  outline: 2px solid #66BB6A;
  outline-offset: 2px;
}

/* ==================== OVERSCROLL ==================== */
.scanner-app,
.scanner-main,
.drawer-content,
.result-card {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* ==================== PRINT ==================== */
@media print {
  body.verify-body,
  .scanner-login-screen,
  .scanner-app { display: none !important; }
}