/* ═══════════════════════════════════════════════════════════
   lte_LoginUi2.css  — Fixed & Production-Ready
   Fixes applied:
   1.  Lock overlay only shows when .on is set by JS (not on load)
   2.  All CAPTCHA panels hidden by default; only .on panel shows
   3.  Process overlay (.proc-ovl) has proper backdrop + pointer-events
   4.  Session overlay (.sess-ovl) same treatment
   5.  Logo dual-image handled correctly per theme (no flicker)
   6.  Registration/back card-face properly hidden until flipped
   7.  Submit button loading/disabled states
   8.  Language switcher active state visible
   9.  Mobile responsive fixes for CAPTCHA, form, overlays
   10. Removed duplicate rule blocks, consolidated cleanly
   11. LINE button moved out of primary flow via CSS
   12. ARIA & focus-visible styles added
   13. proc-box admin/saas role-split fixed
   14. BLANK FLASH FIX: proc-ovl backdrop shown before front hidden
   15. MOBILE SIGNUP FIX: back face uses display swap on mobile
═══════════════════════════════════════════════════════════ */

:root {
  --card-radius: 1.25rem;
  --auth-header-height: 92px;
}

/* ══════════════════════════════════════════════════════════
   SCROLL-LOCK
══════════════════════════════════════════════════════════ */
html {
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

body {
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100dvh;
  background: #f5f5f7;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
}

.container-fluid {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app-header {
  flex-shrink: 0;
}

footer.auth-footer {
  flex-shrink: 0;
}

.card-face.front form {
  display: flex;
  flex-direction: column;
}

.cap-panel#p-grid {
  min-height: 0 !important;
}

.form-group-inline:has(#p-grid.on) {
  margin-bottom: 0;
}

#emojiGrid {
  min-height: 0 !important;
  height: auto !important;
  max-height: 180px;
  overflow: hidden;
}

/* ─────────────────────────────────────────────────────────
   AUTH MAIN
───────────────────────────────────────────────────────── */
.auth-main {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12px 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0));
}

/* ─────────────────────────────────────────────────────────
   AUTH WRAPPER
───────────────────────────────────────────────────────── */
.auth-wrapper {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  perspective: 1200px;
  width: fit-content;
  max-width: calc(100vw - 24px);
}

/* ─────────────────────────────────────────────────────────
   AUTH CARD
───────────────────────────────────────────────────────── */
.auth-card {
  position: relative;
  width: min(480px, calc(100vw - 24px - 52px));
  border-radius: var(--card-radius);
  background: #fff;
  transform-style: preserve-3d;
  transition: transform .4s cubic-bezier(.4, 0, .2, 1);
  flex-shrink: 0;
  overflow: visible;
  max-height: none;
  order: 1;
}

.auth-card.flip {
  transform: rotateY(180deg);
}

/* Both faces */
.card-face {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  width: 100%;
  padding: 2rem;
  border-radius: var(--card-radius);
  box-sizing: border-box;
  overflow-y: visible;
  max-height: none;
}

.card-face.front {
  position: relative;
  z-index: 2;
  background: inherit;
  visibility: visible;
  overflow-y: visible;
  max-height: none;
}

/* FIX #6 + FIX #15 (MOBILE SIGNUP):
   Back face is hidden by default.
   On desktop: standard 3D backface-visibility flip.
   On mobile: JS swaps to display:none / relative to avoid blank card.
   The CSS here covers the desktop default state only.
*/
.card-face.back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 100%;
  transform: rotateY(180deg);
  background: #fff;
  border-radius: var(--card-radius);
  visibility: hidden;
}

/* CSS-managed flip states — no JS inline styles needed */
.auth-card.flip .card-face.back {
  visibility: visible;
}

body.dark-mode .card-face.back {
  background: #1f2933;
}

/* ─────────────────────────────────────────────────────────
   HEADER TOOLS
───────────────────────────────────────────────────────── */
.header-tools {
  position: static !important;
  transform: none !important;
  margin-top: 20px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 7px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 999px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .07);
  width: auto;
  order: 2;
}

body.dark-mode .header-tools {
  background: rgba(17, 24, 39, 0.92);
  border-color: rgba(255, 255, 255, .10);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .30);
}

.header-tools .tools-divider {
  width: 22px;
  height: 1px;
  background: rgba(0, 0, 0, .10);
  border-radius: 1px;
  margin: 2px 0;
}

body.dark-mode .header-tools .tools-divider {
  background: rgba(255, 255, 255, .12);
}

.tool-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #555;
  text-decoration: none;
  font-size: .9rem;
  transition: background .18s, color .18s, transform .15s;
  flex-shrink: 0;
}

.tool-icon:hover {
  background: rgba(0, 0, 0, .07);
  transform: rotate(20deg);
}

.tool-icon:focus-visible {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
  border-radius: 50%;
}

body.dark-mode .tool-icon {
  color: #facc15;
}

body.dark-mode .tool-icon:hover {
  background: rgba(255, 255, 255, .08);
}

/* ─────────────────────────────────────────────────────────
   LANGUAGE SWITCHER  — FIX #8
───────────────────────────────────────────────────────── */
.lang-switcher {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.lang-btn {
  width: 32px;
  height: 28px;
  padding: 0;
  border-radius: 7px;
  font-size: .68rem;
  font-weight: 700;
  line-height: 1;
  border: 1px solid rgba(0, 0, 0, .10);
  background: transparent;
  color: #555;
  cursor: pointer;
  position: relative;
  transition: background .2s ease, color .2s ease, border-color .2s ease,
    box-shadow .2s ease, transform .15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lang-btn:hover {
  background: rgba(13, 110, 253, .08);
  border-color: #0d6efd;
  color: #0d6efd;
}

.lang-btn:focus-visible {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

.lang-btn.active {
  background: linear-gradient(135deg, #0d6efd 0%, #0950c5 100%) !important;
  color: #fff !important;
  border-color: transparent !important;
  font-weight: 800 !important;
  transform: translateY(-1px);
  box-shadow:
    0 0 0 2.5px rgba(13, 110, 253, .22),
    0 4px 12px rgba(13, 110, 253, .38);
}

.lang-btn.active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #0d6efd;
  box-shadow: 0 0 5px rgba(13, 110, 253, .65);
}

body.dark-mode .lang-btn {
  background: transparent;
  color: #9ca3af;
  border-color: rgba(255, 255, 255, .10);
}

body.dark-mode .lang-btn:hover {
  background: rgba(99, 102, 241, .15);
  border-color: #818cf8;
  color: #c7d2fe;
}

body.dark-mode .lang-btn.active {
  background: linear-gradient(135deg, #3b82f6 0%, #1d58d8 100%) !important;
  color: #fff !important;
  border-color: transparent !important;
  font-weight: 800 !important;
  transform: translateY(-1px);
  box-shadow:
    0 0 0 2.5px rgba(59, 130, 246, .28),
    0 4px 14px rgba(59, 130, 246, .48);
}

body.dark-mode .lang-btn.active::after {
  background: #60a5fa;
  box-shadow: 0 0 6px rgba(96, 165, 250, .75);
}

/* ─────────────────────────────────────────────────────────
   MOBILE — tools above card, horizontal bar
   FIX #15: Mobile signup flip — no 3D transform on back face,
   JS handles visibility swap instead so content is never blank.
───────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .auth-main {
    align-items: flex-start;
    padding-top: 10px;
  }

  .auth-wrapper {
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 10px;
  }

  .header-tools {
    order: -1;
    flex-direction: row;
    margin-top: 0;
    padding: 7px 12px;
    gap: 8px;
    border-radius: 999px;
    width: auto;
  }

  .header-tools .tools-divider {
    width: 1px;
    height: 18px;
    margin: 0 2px;
  }

  .lang-switcher {
    flex-direction: row;
    gap: 4px;
  }

  .lang-btn.active::after {
    bottom: auto;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
  }

  /* Card fills full width on mobile */
  .auth-card {
    order: 0;
    width: 100%;
    /* Allow natural height so short screens can scroll to the submit button */
    max-height: none;
    overflow: visible;
  }

  /* ── MOBILE FLIP: disable 3D transforms on the card entirely ──
     JS takes over: it sets front display:none and back to
     position:relative / transform:none when flipping to signup.
     This avoids the blank back-face bug caused by backface-visibility
     interactions on Safari/Chrome mobile.
  */
  .auth-card,
  .auth-card.flip {
    transform: none !important;
    transform-style: flat !important;
  }

  /* Front face on mobile — never 3D transformed */
  .card-face.front {
    backface-visibility: visible !important;
    -webkit-backface-visibility: visible !important;
  }

  /* Back face on mobile — CSS manages display + position via .flip class */
  .card-face.back {
    transform: none !important;
    backface-visibility: visible !important;
    -webkit-backface-visibility: visible !important;
    max-height: none;
    overflow-y: visible;
  }

  /* Mobile flip states: show/hide via display (no 3D transforms) */
  .auth-card:not(.flip) .card-face.back {
    display: none;
  }
  .auth-card.flip .card-face.front {
    display: none;
  }
  .auth-card.flip .card-face.back {
    display: block;
    position: relative;
    visibility: visible;
  }

  /* Text CAPTCHA: stack canvas above input */
  #p-text>div:first-child {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  #p-text>div:first-child canvas#capCanvas {
    width: 100% !important;
    height: 56px !important;
    align-self: stretch;
  }

  /* Math CAPTCHA: stack */
  #p-math>div:first-child {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  #p-math>div:first-child .math-disp {
    min-width: unset !important;
    width: 100%;
    font-size: 26px;
    padding: 12px;
  }

  #mathIn {
    font-size: 1.05rem !important;
    height: 44px !important;
    padding: 0 12px !important;
    flex: 1;
    min-width: 0;
  }

  #txtIn {
    font-size: 1.05rem !important;
    height: 44px !important;
    padding: 0 12px !important;
  }

  #p-math>div:first-child>div:last-child,
  #p-text>div:first-child>div.cap-meta {
    flex-direction: row !important;
    align-items: center;
    gap: 8px;
    align-self: flex-end;
  }

  /* FIX #9: Responsive grid CAPTCHA */
  .emoji-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }

  /* FIX #9: Mobile session grid single column */
  .sess-grid {
    grid-template-columns: 1fr !important;
  }

  /* FIX #9: Mobile form button row stacks */
  .d-flex.gap-2.mt-3 {
    flex-direction: column;
  }

  .d-flex.gap-2.mt-3 .btn {
    width: 100%;
  }
}

/* ─────────────────────────────────────────────────────────
   LOCK OVERLAY  — FIX #1
   Hidden by default; only shown when .on is added by JS
───────────────────────────────────────────────────────── */
.lock-ovl {
  display: none;
  position: absolute;
  inset: 0;
  background: #fff;
  z-index: 60;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  border-radius: var(--card-radius);
  text-align: center;
}

.lock-ovl.on {
  display: flex;
}

body.dark-mode .lock-ovl {
  background: #1f2933;
}

.lock-ico {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(220, 53, 69, .1);
  border: 2px solid rgba(220, 53, 69, .3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.lock-title {
  font-size: 1rem;
  font-weight: 700;
}

.lock-cd {
  font-family: 'DM Mono', monospace;
  font-size: 2.2rem;
  font-weight: 500;
  color: #dc3545;
  letter-spacing: 2px;
}

.lock-sub {
  font-size: 12px;
  color: #9ca3af;
}

body.dark-mode .lock-cd {
  color: #f85149;
}

/* ─────────────────────────────────────────────────────────
   PROCESS OVERLAY  — FIX #3 + FIX #14 (BLANK FLASH)
   The overlay is shown BEFORE the front face is hidden.
   The backdrop covers the card instantly. Proc-boxes are
   revealed only AFTER the server confirms the role, so the
   correct box (admin terminal vs SaaS loader) is always shown.
───────────────────────────────────────────────────────── */
.proc-ovl {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.proc-ovl.on {
  display: flex;
  pointer-events: auto;
  z-index: 9999;
}

/* Ensure everything under overlay is non-interactive */
.proc-ovl.on~* {
  pointer-events: none;
}

/* ─────────────────────────────────────────────────────────
   SESSION OVERLAY  — FIX #3
───────────────────────────────────────────────────────── */
.sess-ovl {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.sess-ovl.on {
  display: flex;
}

/* ─────────────────────────────────────────────────────────
   PROCESS BOX (admin terminal vs SaaS loader)  — FIX #13
───────────────────────────────────────────────────────── */
.proc-box {
  background: #fff;
  border-radius: 1.25rem;
  padding: 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .22);
  animation: boxIn .3s cubic-bezier(.34, 1.56, .64, 1);
}

body.dark-mode .proc-box {
  background: #1f2933;
  border: 1px solid #2d3748;
}

/* Both proc-boxes hidden by default — shown via show-admin / show-saas class on overlay */
.proc-box--admin,
.proc-box--saas {
  display: none;
}

.proc-ovl.show-admin .proc-box--admin {
  display: block;
}

.proc-ovl.show-saas .proc-box--saas {
  display: block;
}

/* Admin terminal-style box */
.proc-box--admin {
  width: 100%;
  max-width: 420px;
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 14px;
  overflow: hidden;
  font-family: 'DM Mono', monospace;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .22);
  animation: boxIn .3s cubic-bezier(.34, 1.56, .64, 1);
}

body:not(.dark-mode) .proc-box--admin {
  background: #fff;
  border-color: #d0d7de;
}

/* SaaS minimal loader */
.proc-box--saas {
  width: 100%;
  max-width: 320px;
  text-align: center;
  background: #fff;
  border-radius: 1.25rem;
  padding: 2rem;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .22);
  animation: boxIn .3s cubic-bezier(.34, 1.56, .64, 1);
}

body.dark-mode .proc-box--saas {
  background: #1f2933;
  border: 1px solid #2d3748;
}

@keyframes boxIn {
  from {
    transform: scale(.88) translateY(20px);
    opacity: 0;
  }

  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* ─────────────────────────────────────────────────────────
   SESSION BOX
───────────────────────────────────────────────────────── */
.sess-box {
  background: #fff;
  border-radius: 1.25rem;
  padding: 2rem;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .22);
  animation: boxIn .35s cubic-bezier(.34, 1.56, .64, 1);
}

body.dark-mode .sess-box {
  background: #1f2933;
  border: 1px solid #2d3748;
}

/* ─────────────────────────────────────────────────────────
   CAPTCHA  — FIX #2
   All panels hidden by default; only .on panel is visible
───────────────────────────────────────────────────────── */
.cap-panel {
  display: none;
}

.cap-panel.on {
  display: block;
}

.cap-tabs {
  display: flex;
  gap: 3px;
  background: #f1f3f5;
  border-radius: 7px;
  padding: 3px;
  margin-bottom: 9px;
}

body.dark-mode .cap-tabs {
  background: #21262d;
}

.cap-tab {
  flex: 1;
  padding: 5px 4px;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  text-align: center;
  font-family: inherit;
}

.cap-tab.on {
  background: #fff;
  color: #1a202c;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
}

.cap-tab:focus-visible {
  outline: 2px solid #0d6efd;
  outline-offset: 1px;
}

body.dark-mode .cap-tab.on {
  background: #30363d;
  color: #e6edf3;
}

.cap-divider {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 2px 0 9px;
}

.cap-divider::before,
.cap-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #dee2e6;
}

.cap-divider span {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #adb5bd;
  white-space: nowrap;
}

body.dark-mode .cap-divider::before,
body.dark-mode .cap-divider::after {
  background: #374151;
}

#capCanvas {
  border-radius: 7px;
  border: 1px solid #dee2e6;
  background: #f8f9fa;
  cursor: pointer;
  flex-shrink: 0;
}

body.dark-mode #capCanvas {
  border-color: #374151;
  filter: brightness(.85) contrast(1.1);
}

.cap-timer-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #9ca3af;
  font-family: 'DM Mono', monospace;
}

.cap-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ring-svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.ring-bg {
  fill: none;
  stroke: #e9ecef;
  stroke-width: 2.5;
}

body.dark-mode .ring-bg {
  stroke: #30363d;
}

.ring-fill {
  fill: none;
  stroke: #0d6efd;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 66;
  stroke-dashoffset: 0;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 1s linear, stroke .3s;
}

.ref-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid #dee2e6;
  background: #f8f9fa;
  color: #6c757d;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}

.ref-btn:hover {
  border-color: #0d6efd;
  color: #0d6efd;
  background: #f0f7ff;
}

.ref-btn:focus-visible {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

body.dark-mode .ref-btn {
  border-color: #374151;
  background: #21262d;
  color: #8b949e;
}

body.dark-mode .ref-btn:hover {
  border-color: #388bfd;
  color: #58a6ff;
}

.cc-counter {
  font-size: 11px;
  color: #9ca3af;
  text-align: right;
  margin-top: 2px;
  font-family: 'DM Mono', monospace;
}

.cap-digit-hint {
  font-size: 10px;
  color: #6b7280;
  margin-top: 2px;
  margin-bottom: 4px;
}

.math-disp {
  font-family: 'DM Mono', monospace;
  font-size: 22px;
  font-weight: 500;
  text-align: center;
  padding: 14px 10px;
  border-radius: 8px;
  border: 1px solid #dee2e6;
  background: #f8f9fa;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

body.dark-mode .math-disp {
  background: #21262d;
  border-color: #374151;
  color: #e6edf3;
}

.grid-prompt {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 7px;
  padding: 6px 10px;
  background: #f8f9fa;
  border-radius: 7px;
  border: 1px solid #dee2e6;
}

.grid-prompt span {
  color: #0d6efd;
}

body.dark-mode .grid-prompt {
  background: #21262d;
  border-color: #374151;
}

body.dark-mode .grid-prompt span {
  color: #58a6ff;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: clamp(4px, 1.2vw, 7px);
  margin-bottom: 7px;
  height: auto;
  min-height: 0;
  align-content: start;
}

.grid-cell {
  aspect-ratio: 1;
  font-size: clamp(18px, 4.5vw, 26px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  background: rgba(13, 110, 253, .06);
  transition: background .15s, border-color .15s, transform .1s;
  user-select: none;
  position: relative;
}

.grid-cell:hover {
  background: rgba(13, 110, 253, .14);
  transform: scale(1.06);
}

.grid-cell:focus-visible {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

.grid-cell.sel {
  border-color: #0d6efd;
  background: rgba(13, 110, 253, .22);
}

.grid-cell.sel::after {
  content: '✓';
  position: absolute;
  top: 2px;
  right: 5px;
  font-size: 10px;
  color: #0d6efd;
  font-weight: 700;
}

body.dark-mode .grid-cell {
  border-color: #374151;
  background: #21262d;
}

body.dark-mode .grid-cell:hover {
  border-color: #388bfd;
}

body.dark-mode .grid-cell.sel {
  border-color: #388bfd;
  background: rgba(56, 139, 253, .12);
  box-shadow: inset 0 0 0 2px #388bfd;
}

body.dark-mode .grid-cell.sel::after {
  color: #58a6ff;
}

.cap-ok {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #198754;
  padding: 7px 10px;
  margin-top: 5px;
  background: rgba(25, 135, 84, .08);
  border: 1px solid rgba(25, 135, 84, .25);
  border-radius: 7px;
}

.cap-ok.on {
  display: flex;
}

.ok-circle {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #198754;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: popIn .4s cubic-bezier(.34, 1.56, .64, 1);
  flex-shrink: 0;
}

@keyframes popIn {
  0% {
    transform: scale(0);
    opacity: 0
  }

  100% {
    transform: scale(1);
    opacity: 1
  }
}

body.dark-mode .cap-ok {
  color: #3fb950;
  background: rgba(63, 185, 80, .08);
  border-color: rgba(63, 185, 80, .25);
}

body.dark-mode .ok-circle {
  background: #3fb950;
}

.cap-err {
  font-size: 12px;
  color: #dc3545;
  margin-top: 3px;
  display: none;
  font-weight: 500;
}

.cap-err.on {
  display: block;
}

body.dark-mode .cap-err {
  color: #f85149;
}

/* ─────────────────────────────────────────────────────────
   SUBMIT BUTTON STATES  — FIX #7
───────────────────────────────────────────────────────── */
.btn-success[data-lang="submit"] {
  position: relative;
  transition: opacity .15s, transform .1s;
}

.btn-success[data-lang="submit"]:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  pointer-events: none;
}

.btn-success[data-lang="submit"].btn-loading {
  color: transparent !important;
  pointer-events: none;
}

.btn-success[data-lang="submit"].btn-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btnSpin .6s linear infinite;
}

@keyframes btnSpin {
  to {
    transform: rotate(360deg);
  }
}

/* ─────────────────────────────────────────────────────────
   FORM GROUPS
───────────────────────────────────────────────────────── */
.form-group-inline {
  margin-bottom: 0.9rem;
}

.form-group-inline label {
  font-size: .85rem;
  font-weight: 500;
  margin-bottom: .25rem;
  color: #333;
  display: block;
}

@media(min-width:576px) {
  .form-group-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
  }

  .form-group-inline label {
    margin-bottom: 0;
    min-width: 6rem;
    flex-shrink: 0;
  }

  .form-group-inline input,
  .form-group-inline select,
  .form-group-inline textarea,
  .form-group-inline .form-control {
    flex: 1;
    min-width: 0;
  }
}

.form-group-inline.modern {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
}

.form-group-inline.modern label {
  font-size: .85rem;
  font-weight: 500;
  margin-bottom: .25rem;
}

.form-group-inline.modern input,
.form-group-inline.modern select,
.form-group-inline.modern textarea {
  width: 100%;
  padding: .65rem;
  border-radius: .5rem;
  border: 1px solid #ddd;
  outline: none;
  transition: border .2s ease;
  font-size: .875rem;
  box-sizing: border-box;
}

.form-group-inline.modern input:focus,
.form-group-inline.modern select:focus,
.form-group-inline.modern textarea:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, .15);
}

@media(min-width:576px) {
  .form-group-inline.modern {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem 0.75rem;
  }

  .form-group-inline.modern label {
    margin-bottom: 0;
    min-width: 6rem;
    flex-shrink: 0;
  }

  .form-group-inline.modern input,
  .form-group-inline.modern select,
  .form-group-inline.modern textarea {
    flex: 1;
    min-width: 0;
  }
}

.pwd-eye {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #adb5bd;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color .15s;
}

.pwd-eye:hover {
  color: #6c757d;
}

.pwd-eye:focus-visible {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

/* ─────────────────────────────────────────────────────────
   GENERAL ERROR
───────────────────────────────────────────────────────── */
#genErr {
  display: none;
  font-size: 12px;
  color: #dc3545;
  font-weight: 500;
  text-align: center;
  margin-top: 6px;
  padding: 7px 10px;
  background: rgba(220, 53, 69, .07);
  border-radius: 6px;
  border: 1px solid rgba(220, 53, 69, .2);
  border-left: 3px solid #dc3545;
}

#genErr.on {
  display: block;
}

body.dark-mode #genErr {
  color: #f85149;
  background: rgba(248, 81, 73, .08);
  border-color: rgba(248, 81, 73, .3);
  border-left-color: #f85149;
}

/* ─────────────────────────────────────────────────────────
   ATTEMPT METER
───────────────────────────────────────────────────────── */
.susp-banner {
  display: none;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border-radius: 7px;
  background: rgba(220, 53, 69, .07);
  border: 1px solid rgba(220, 53, 69, .25);
  font-size: 12px;
  color: #dc3545;
  font-weight: 500;
  margin-bottom: 9px;
}

.susp-banner.on {
  display: flex;
}

body.dark-mode .susp-banner {
  color: #f85149;
  background: rgba(248, 81, 73, .09);
  border-color: rgba(248, 81, 73, .3);
}

.att-meter {
  display: none;
  padding: 7px 11px;
  border-radius: 7px;
  border: 1px solid #f59e0b;
  background: rgba(245, 158, 11, .07);
  margin-bottom: 9px;
}

.att-meter.on {
  display: block;
}

.att-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.att-txt {
  font-size: 12px;
  font-weight: 600;
  color: #d97706;
}

.att-pips {
  display: flex;
  gap: 4px;
}

.pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid #dee2e6;
  background: #f8f9fa;
  transition: all .3s;
}

.pip.used {
  background: #dc3545;
  border-color: #dc3545;
}

.pip.warn {
  background: #f59e0b;
  border-color: #f59e0b;
}

body.dark-mode .att-meter {
  background: rgba(210, 153, 34, .1);
  border-color: #d29922;
}

body.dark-mode .att-txt {
  color: #d29922;
}

body.dark-mode .pip {
  border-color: #374151;
  background: #21262d;
}

/* ─────────────────────────────────────────────────────────
   SIGNIN PROGRESS (2-step)
───────────────────────────────────────────────────────── */
.signin-prog-track {
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid #e9ecef;
}

body.dark-mode .signin-prog-track {
  border-bottom-color: #2d3748;
}

.signin-step-bar {
  display: flex;
  align-items: center;
  margin-bottom: 5px;
}

.sn-node {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #dee2e6;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #adb5bd;
  flex-shrink: 0;
  transition: all .3s;
}

.sn-node.active {
  border-color: #0d6efd;
  background: #0d6efd;
  color: #fff;
}

.sn-node.done {
  border-color: #198754;
  background: #198754;
  color: #fff;
}

body.dark-mode .sn-node {
  border-color: #374151;
  background: #21262d;
  color: #6b7280;
}

body.dark-mode .sn-node.active {
  border-color: #388bfd;
  background: #388bfd;
}

body.dark-mode .sn-node.done {
  border-color: #3fb950;
  background: #3fb950;
}

.sn-conn {
  flex: 1;
  height: 2px;
  background: #e9ecef;
}

.sn-conn-fill {
  height: 100%;
  width: 0%;
  background: #198754;
  transition: width .5s ease;
}

body.dark-mode .sn-conn {
  background: #30363d;
}

body.dark-mode .sn-conn-fill {
  background: #3fb950;
}

.sn-labels {
  display: flex;
  justify-content: space-between;
  padding: 0 2px;
}

.sn-lbl {
  font-size: 10px;
  font-weight: 600;
  color: #adb5bd;
  text-transform: uppercase;
  letter-spacing: .4px;
  flex: 1;
  text-align: center;
  transition: color .3s;
}

.sn-lbl:first-child {
  text-align: left;
}

.sn-lbl:last-child {
  text-align: right;
}

.sn-lbl.active {
  color: #0d6efd;
}

.sn-lbl.done {
  color: #198754;
}

body.dark-mode .sn-lbl {
  color: #6b7280;
}

body.dark-mode .sn-lbl.active {
  color: #58a6ff;
}

body.dark-mode .sn-lbl.done {
  color: #3fb950;
}

/* ─────────────────────────────────────────────────────────
   PROCESS STEPS (admin)
───────────────────────────────────────────────────────── */
.proc-titlebar {
  background: #161b22;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 7px;
  border-bottom: 1px solid #21262d;
}

body:not(.dark-mode) .proc-titlebar {
  background: #f6f8fa;
  border-color: #d0d7de;
}

.proc-tb-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.proc-tb-filename {
  font-size: 11px;
  color: #8b949e;
  margin-left: 8px;
  letter-spacing: .02em;
}

body:not(.dark-mode) .proc-tb-filename {
  color: #57606a;
}

.proc-body {
  padding: 20px;
}

.proc-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 3px;
  color: #e6edf3;
}

body:not(.dark-mode) .proc-title {
  color: #1a202c;
}

.proc-sub {
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 12px;
}

.proc-steps {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ps-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  background: #21262d;
  border: 1px solid #30363d;
  font-size: 13px;
  font-weight: 500;
  transition: all .3s;
  color: #e6edf3;
}

body:not(.dark-mode) .ps-row {
  background: #f8f9fa;
  border-color: #e9ecef;
  color: #1a202c;
}

.ps-row.run {
  border-color: #388bfd;
  background: rgba(56, 139, 253, .06);
}

body:not(.dark-mode) .ps-row.run {
  border-color: #0d6efd;
  background: rgba(13, 110, 253, .04);
}

.ps-row.done {
  border-color: #3fb950;
  background: rgba(63, 185, 80, .06);
}

body:not(.dark-mode) .ps-row.done {
  border-color: #198754;
  background: rgba(25, 135, 84, .04);
}

.ps-ico {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.mini-spin {
  width: 14px;
  height: 14px;
  border: 2px solid #374151;
  border-top-color: #388bfd;
  border-radius: 50%;
  animation: _mspin .6s linear infinite;
}

body:not(.dark-mode) .mini-spin {
  border-color: #dee2e6;
  border-top-color: #0d6efd;
}

@keyframes _mspin {
  to {
    transform: rotate(360deg);
  }
}

.proc-prog-track {
  height: 2px;
  background: #21262d;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 14px;
}

body:not(.dark-mode) .proc-prog-track {
  background: #e5e7eb;
}

.proc-prog-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #388bfd, #56d364);
  border-radius: 2px;
  transition: width .4s ease;
}

body:not(.dark-mode) .proc-prog-fill {
  background: linear-gradient(90deg, #0d6efd, #198754);
}

/* ─────────────────────────────────────────────────────────
   SAAS LOADER COMPONENTS
───────────────────────────────────────────────────────── */
.saas-role-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.saas-role-ring::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: currentColor;
  animation: procSpin .9s linear infinite;
  opacity: .55;
}

@keyframes procSpin {
  to {
    transform: rotate(360deg);
  }
}

.saas-ring-inner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.saas-role-badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.saas-loader-title {
  font-size: 18px;
  font-weight: 500;
  color: #111;
  margin-bottom: 6px;
}

body.dark-mode .saas-loader-title {
  color: #e6edf3;
}

.saas-loader-sub {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 20px;
}

body.dark-mode .saas-loader-sub {
  color: #8b949e;
}

.saas-bar-track {
  height: 3px;
  background: rgba(0, 0, 0, .08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}

body.dark-mode .saas-bar-track {
  background: rgba(255, 255, 255, .1);
}

.saas-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  transition: width .25s linear;
}

.saas-loader-status {
  font-size: 11px;
  color: #9ca3af;
  letter-spacing: .03em;
}

.role--staff .saas-role-ring {
  background: #e1f5ee;
  color: #0F6E56;
}

.role--staff .saas-ring-inner {
  color: #0F6E56;
}

.role--staff .saas-role-badge {
  background: #e1f5ee;
  color: #0F6E56;
}

.role--staff .saas-bar-fill {
  background: #1D9E75;
}

.role--warehouse .saas-role-ring {
  background: #faeeda;
  color: #854F0B;
}

.role--warehouse .saas-ring-inner {
  color: #854F0B;
}

.role--warehouse .saas-role-badge {
  background: #faeeda;
  color: #854F0B;
}

.role--warehouse .saas-bar-fill {
  background: #BA7517;
}

.role--manager .saas-role-ring {
  background: #EEEDFE;
  color: #534AB7;
}

.role--manager .saas-ring-inner {
  color: #534AB7;
}

.role--manager .saas-role-badge {
  background: #EEEDFE;
  color: #534AB7;
}

.role--manager .saas-bar-fill {
  background: #534AB7;
}

.role--viewer .saas-role-ring {
  background: #e6f1fb;
  color: #185FA5;
}

.role--viewer .saas-ring-inner {
  color: #185FA5;
}

.role--viewer .saas-role-badge {
  background: #e6f1fb;
  color: #185FA5;
}

.role--viewer .saas-bar-fill {
  background: #185FA5;
}

body.dark-mode .role--staff .saas-role-ring {
  background: #085041;
  color: #5DCAA5;
}

body.dark-mode .role--staff .saas-role-badge {
  background: #085041;
  color: #9FE1CB;
}

body.dark-mode .role--warehouse .saas-role-ring {
  background: #412402;
  color: #EF9F27;
}

body.dark-mode .role--warehouse .saas-role-badge {
  background: #412402;
  color: #FAC775;
}

body.dark-mode .role--manager .saas-role-ring {
  background: #26215C;
  color: #AFA9EC;
}

body.dark-mode .role--manager .saas-role-badge {
  background: #26215C;
  color: #CEC8F6;
}

body.dark-mode .role--viewer .saas-role-ring {
  background: #042C53;
  color: #85B7EB;
}

body.dark-mode .role--viewer .saas-role-badge {
  background: #042C53;
  color: #B5D4F4;
}

/* ─────────────────────────────────────────────────────────
   SESSION INFO  — FIX #12
───────────────────────────────────────────────────────── */
.sess-hdr {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.sess-ico {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(25, 135, 84, .1);
  border: 1px solid rgba(25, 135, 84, .25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.sess-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.sess-ok-tag {
  font-size: 11px;
  color: #198754;
  font-weight: 700;
  margin: 0;
}

body.dark-mode .sess-ico {
  background: rgba(63, 185, 80, .08);
  border-color: rgba(63, 185, 80, .2);
}

body.dark-mode .sess-ok-tag {
  color: #3fb950;
}

.sess-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 9px;
}

.si[data-dev-only] {
  display: none;
}

body[data-user-role="admin"] .si[data-dev-only] {
  display: block;
}

.si {
  padding: 8px 11px;
  border-radius: 8px;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
}

.si-lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .4px;
  font-weight: 700;
  color: #9ca3af;
  margin-bottom: 2px;
}

.si-val {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  color: #1a202c;
  word-break: break-all;
}

.si-val.ok {
  color: #198754;
}

.si-val.ac {
  color: #0d6efd;
}

body.dark-mode .si {
  background: #21262d;
  border-color: #30363d;
}

body.dark-mode .si-val {
  color: #e6edf3;
}

body.dark-mode .si-val.ok {
  color: #3fb950;
}

body.dark-mode .si-val.ac {
  color: #58a6ff;
}

.sec-checks {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.sec-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 7px;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
}

.sec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #198754;
  flex-shrink: 0;
  animation: pdot 2s ease infinite;
}

@keyframes pdot {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: .4
  }
}

body.dark-mode .sec-row {
  background: #21262d;
  border-color: #30363d;
}

body.dark-mode .sec-dot {
  background: #3fb950;
}

/* ─────────────────────────────────────────────────────────
   REDIRECT STRIP
───────────────────────────────────────────────────────── */
.redirect-strip {
  margin-top: 1rem;
  padding: 14px 16px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(13, 110, 253, .07), rgba(25, 135, 84, .05));
  border: 1px solid rgba(13, 110, 253, .2);
  display: flex;
  align-items: center;
  gap: 12px;
}

body.dark-mode .redirect-strip {
  background: linear-gradient(135deg, rgba(56, 139, 253, .1), rgba(63, 185, 80, .07));
  border-color: rgba(56, 139, 253, .25);
}

.redirect-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #0d6efd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  animation: pulseIcon 1.4s ease infinite;
}

@keyframes pulseIcon {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(13, 110, 253, .45);
  }

  50% {
    box-shadow: 0 0 0 9px rgba(13, 110, 253, 0);
  }
}

.redirect-text {
  flex: 1;
}

.rd-label {
  font-size: 12px;
  font-weight: 700;
  color: #0d6efd;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 5px;
}

body.dark-mode .rd-label {
  color: #58a6ff;
}

.redirect-bar-track {
  height: 5px;
  background: #e9ecef;
  border-radius: 99px;
  overflow: hidden;
}

body.dark-mode .redirect-bar-track {
  background: #30363d;
}

.redirect-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0d6efd, #198754);
  border-radius: 99px;
  transition: width .15s linear;
}

.redirect-counter {
  font-size: 11px;
  color: #9ca3af;
  font-family: 'DM Mono', monospace;
  margin-top: 4px;
}

/* ─────────────────────────────────────────────────────────
   OAUTH SCREEN
───────────────────────────────────────────────────────── */
.oauth-screen {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) translateX(120vw);
  width: min(520px, calc(100vw - 24px));
  max-height: 90vh;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, .09);
  border-radius: var(--card-radius);
  padding: 2rem;
  z-index: 8001;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .12), 0 1.5px 6px rgba(0, 0, 0, .07);
  transition: transform .45s cubic-bezier(.4, 0, .2, 1);
  transform-style: flat;
  isolation: isolate;
}

.oauth-screen.show {
  transform: translate(-50%, -50%) translateX(0);
}

.oauth-screen::before {
  display: none;
}

.oauth-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 8000;
  background: rgba(0, 0, 0, .35);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.oauth-backdrop.show {
  display: block;
}

.oauth-header {
  position: relative;
  height: 36px;
  margin-bottom: .5rem;
}

.oauth-back {
  position: relative;
  z-index: 2;
  background: none;
  border: none;
  padding: 0;
  font-size: .9rem;
  font-weight: 500;
  color: #0d6efd;
  cursor: pointer;
}

.oauth-back:focus-visible {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
  border-radius: 3px;
}

.auth-provider {
  text-decoration: none;
  color: #111827;
  font-weight: 500;
  background: #ffffff;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem;
  border-radius: .5rem;
  border: 1px solid #e2e5ea;
  width: 100%;
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
  box-sizing: border-box;
}

.auth-provider:hover {
  background: #f4f6fb;
  border-color: #c8cdd6;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .07);
}

.auth-provider .provider-icon {
  width: 20px;
  height: 20px;
  font-size: 20px;
}

.auth-provider.line {
  border-color: #c2edd9;
}

.auth-provider.line:hover {
  background: #edfaf4;
  border-color: #6fcca3;
  box-shadow: 0 1px 4px rgba(22, 163, 74, .10);
}

body.dark-mode .oauth-screen {
  background: #1f2933;
  border: 1px solid #2d3748;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .45);
}

body.dark-mode .oauth-backdrop {
  background: rgba(0, 0, 0, .65);
}

body.dark-mode .auth-provider {
  background: #111827;
  border: 1px solid #374151;
  color: #e5e7eb;
}

body.dark-mode .auth-provider:hover {
  background: #1f2933;
  border-color: #4b5563;
}

@media(max-width:420px) {
  .oauth-screen {
    padding: 1.5rem 1.25rem;
  }

  .oauth-header {
    height: 40px;
  }
}

/* ─────────────────────────────────────────────────────────
   PASSKEY
───────────────────────────────────────────────────────── */
#passkeyBtn {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .65rem;
  border-radius: 50px;
  font-weight: 500;
  background: #0d6efd;
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
}

#passkeyBtn:hover {
  background: #0b5ed7;
}

#passkeyBtn:focus-visible {
  outline: 2px solid #0d6efd;
  outline-offset: 3px;
}

body.dark-mode #passkeyBtn {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  border: none;
}

body.dark-mode #passkeyBtn:hover {
  opacity: .95;
}

#noPasskeyPanel,
#passkeyAccountPanel {
  background-color: #f8f9fa !important;
  border-color: #dee2e6 !important;
  color: #212529;
}

#noPasskeyPanel .text-warning,
#passkeyAccountPanel .text-warning {
  color: #c78200 !important;
}

#noPasskeyPanel .text-muted,
#passkeyAccountPanel .text-muted {
  color: #6c757d !important;
}

#noPasskeyPanel .form-control,
#passkeyAccountPanel .form-control {
  background-color: #fff;
  border-color: #ced4da;
  color: #212529;
}

#noPasskeyPanel .form-control::placeholder,
#passkeyAccountPanel .form-control::placeholder {
  color: #adb5bd;
}

#noPasskeyPanel .form-control:focus,
#passkeyAccountPanel .form-control:focus {
  background-color: #fff;
  border-color: #86b7fe;
  color: #212529;
  box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .25);
}

#noPasskeyPanel .btn-outline-secondary,
#passkeyAccountPanel .btn-outline-secondary {
  color: #6c757d;
  border-color: #6c757d;
}

#noPasskeyPanel .btn-outline-secondary:hover,
#passkeyAccountPanel .btn-outline-secondary:hover {
  background-color: #6c757d;
  color: #fff;
}

#noPasskeyPanel .btn-primary,
#passkeyAccountPanel .btn-primary {
  background-color: #0d6efd;
  border-color: #0d6efd;
  color: #fff;
}

#noPasskeyPanel .btn-primary:hover,
#passkeyAccountPanel .btn-primary:hover {
  background-color: #0b5ed7;
  border-color: #0a58ca;
}

#noPasskeyPanel .text-danger,
#passkeyAccountPanel .text-danger {
  color: #dc3545 !important;
}

body.dark-mode #noPasskeyPanel,
body.dark-mode #passkeyAccountPanel {
  background-color: #111827 !important;
  border-color: #374151 !important;
  color: #e5e7eb;
}

body.dark-mode #noPasskeyPanel .text-warning,
body.dark-mode #passkeyAccountPanel .text-warning {
  color: #fbbf24 !important;
}

body.dark-mode #noPasskeyPanel .text-muted,
body.dark-mode #passkeyAccountPanel .text-muted {
  color: #9ca3af !important;
}

body.dark-mode #noPasskeyPanel .form-label,
body.dark-mode #passkeyAccountPanel .form-label {
  color: #d1d5db;
}

body.dark-mode #noPasskeyPanel .form-control,
body.dark-mode #passkeyAccountPanel .form-control {
  background-color: #0d1117;
  border-color: #374151;
  color: #f9fafb;
}

body.dark-mode #noPasskeyPanel .form-control::placeholder,
body.dark-mode #passkeyAccountPanel .form-control::placeholder {
  color: #4b5563;
}

body.dark-mode #noPasskeyPanel .form-control:focus,
body.dark-mode #passkeyAccountPanel .form-control:focus {
  background-color: #0d1117;
  border-color: #3b82f6;
  color: #fff;
  box-shadow: 0 0 0 .25rem rgba(59, 130, 246, .25);
}

body.dark-mode #noPasskeyPanel .btn-outline-secondary,
body.dark-mode #passkeyAccountPanel .btn-outline-secondary {
  color: #9ca3af;
  border-color: #4b5563;
  background-color: transparent;
}

body.dark-mode #noPasskeyPanel .btn-outline-secondary:hover,
body.dark-mode #passkeyAccountPanel .btn-outline-secondary:hover {
  background-color: #374151;
  color: #e5e7eb;
  border-color: #6b7280;
}

body.dark-mode #noPasskeyPanel .btn-primary,
body.dark-mode #passkeyAccountPanel .btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border: none;
  color: #fff;
}

body.dark-mode #noPasskeyPanel .btn-primary:hover,
body.dark-mode #passkeyAccountPanel .btn-primary:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: none;
}

body.dark-mode #noPasskeyPanel .text-danger,
body.dark-mode #passkeyAccountPanel .text-danger {
  color: #f87171 !important;
}

/* ─────────────────────────────────────────────────────────
   SIGNUP STEPPER
───────────────────────────────────────────────────────── */
.stepper-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
  position: relative;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: .75rem;
  color: #888;
  z-index: 1;
}

.step-item.active,
.step-item.completed {
  color: #0d6efd;
}

.step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 600;
  margin-bottom: .25rem;
  background: #fff;
  transition: all 0.3s ease;
}

.step-item.active .step-circle,
.step-item.completed .step-circle {
  border-color: #0d6efd;
  background: #0d6efd;
  color: #fff;
}

.step-line {
  flex: 1;
  height: 2px;
  background: #ddd;
  margin: 0 .25rem;
}

.step {
  display: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  position: relative;
  width: 100%;
}

.step.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
  z-index: 2;
}

.role-options {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
}

.role-card {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: .75rem;
  text-align: center;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.25s ease;
  background: #fff;
}

.role-card i {
  font-size: 1.5rem;
  margin-bottom: .5rem;
  display: block;
  color: #555;
}

.role-card span {
  font-size: .85rem;
  display: block;
}

.role-card:hover {
  background: #f8fafc;
  border-color: #0d6efd;
}

.role-card input[type="radio"] {
  display: none;
}

.role-card input:checked+i,
.role-card input:checked+span,
.role-card.selected {
  color: #0d6efd;
  font-weight: 600;
  border-color: #0d6efd;
}

body.dark-mode .role-card {
  background: #111827;
  border: 1px solid #374151;
  color: #e5e7eb;
}

body.dark-mode .role-card:hover {
  border-color: #3b82f6;
}

.service-card {
  border: 1px solid #ddd;
  border-radius: .5rem;
  cursor: pointer;
  transition: all 0.25s ease;
  padding: 1rem 0;
  text-align: center;
}

.service-card.selected {
  background: #e7f1ff;
  border-color: #0d6efd;
}

.service-card i {
  font-size: 1.5rem;
  display: block;
  margin-bottom: .5rem;
}

.service-card span {
  font-size: .85rem;
  font-weight: 500;
}

.signup-nav {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding: 1rem 0 0.5rem;
  margin-top: auto;
  border-top: 1px solid #eee;
  z-index: 10;
}

body.dark-mode .signup-nav {
  background: #1f2933;
  border-top: 1px solid #374151;
}

button#nextBtn,
button#prevBtn {
  min-width: 100px;
  padding: .55rem 1.25rem;
  font-size: .875rem;
}

textarea {
  resize: none;
  border-radius: .5rem;
  padding: .75rem;
  font-size: .875rem;
}

/* ─────────────────────────────────────────────────────────
   LINE BUTTON
───────────────────────────────────────────────────────── */
.card-face.front #line-btn,
.card-face.back #line-btn {
  display: block;
  margin-top: 1rem;
  text-align: center;
}

/* ─────────────────────────────────────────────────────────
   LOGO — FIX #5
───────────────────────────────────────────────────────── */
.app-header {
  position: relative;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  border-bottom: 1px solid #d9d9d9;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.app-header-inner {
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top));
}

body.dark-mode .app-header {
  background: rgba(17, 24, 39, 0.96);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.brand-logo-img {
  height: 64px;
  display: none;
  margin-top: 2px;
}

.logo-light {
  display: block;
  height: 64px;
  max-height: 64px;
  width: auto;
}

.logo-dark {
  display: none;
  height: 64px;
  max-height: 64px;
  width: auto;
}

body.dark-mode .logo-light {
  display: none;
}

body.dark-mode .logo-dark {
  display: block;
}

@media(max-width:768px) {
  .brand-logo-img {
    height: 64px;
    max-height: 82px;
  }

  .logo-light,
  .logo-dark {
    height: 64px;
    max-height: 64px;
    width: auto;
  }
}

/* ─────────────────────────────────────────────────────────
   FOOTER
───────────────────────────────────────────────────────── */
.auth-footer {
  width: 100%;
  font-size: 13px;
  color: #6b7280;
  background: transparent;
  padding: 12px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-footer-inner {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-brand {
  white-space: nowrap;
}

.footer-links {
  display: flex;
  gap: 18px;
}

.footer-links a {
  color: #6b7280;
  text-decoration: none;
  transition: color .2s ease;
}

.footer-links a:hover {
  color: #111827;
  text-decoration: underline;
}

.auth-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-link {
  font-size: 14px;
  color: #8b8f98;
  cursor: pointer;
  transition: color .2s ease;
}

.auth-link:hover {
  text-decoration: underline;
}

body.dark-mode .auth-footer {
  color: #9ca3af;
}

body.dark-mode .footer-links a {
  color: #9ca3af;
}

body.dark-mode .footer-links a:hover {
  color: #e5e7eb;
}

@media(max-width:640px) {
  .auth-footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .footer-links {
    order: 2;
  }
}

/* ─────────────────────────────────────────────────────────
   DARK MODE
───────────────────────────────────────────────────────── */
body.dark-mode {
  background: #0f2027;
  color: #e5e7eb;
}

body.dark-mode .auth-card {
  background: #1f2933;
  border: 1px solid #2d3748;
}

body.dark-mode h1,
body.dark-mode h4,
body.dark-mode p,
body.dark-mode label {
  color: #e5e7eb;
}

body.dark-mode .text-muted {
  color: #9ca3af !important;
}

body.dark-mode .form-control {
  background: #111827;
  border: 1px solid #374151;
  color: #f9fafb;
}

body.dark-mode .form-control::placeholder {
  color: #6b7280;
}

body.dark-mode .form-control:focus {
  background: #111827;
  border-color: #3b82f6;
  color: #fff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
}

body.dark-mode .error {
  color: #f87171;
}

body.dark-mode .btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border: none;
}

body.dark-mode .btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  border: none;
}

body.dark-mode .btn-outline-info,
body.dark-mode .btn-outline-secondary {
  color: #e5e7eb;
  border-color: #4b5563;
}

body.dark-mode .btn-outline-info:hover,
body.dark-mode .btn-outline-secondary:hover {
  background: #374151;
}

body.dark-mode .divider span {
  background: #1f2933;
  color: #9ca3af;
}

body.dark-mode .divider::before,
body.dark-mode .divider::after {
  background: #374151;
}

body.dark-mode .form-check-label {
  color: #d1d5db;
}

body.dark-mode .form-check-input {
  background-color: #111827;
  border-color: #4b5563;
}

body.dark-mode #darkModeToggle {
  color: #facc15;
}

body.dark-mode .stepper-indicator {
  color: #9ca3af;
}

body.dark-mode .step-circle {
  background: #374151;
  color: #9ca3af;
}

body.dark-mode .step-item.active .step-circle {
  background: #3b82f6;
  color: #fff;
}

body.dark-mode .step-line {
  background: #374151;
}

body.dark-mode .signup-progress {
  background: #111827;
}

body.dark-mode .progress-bar {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

/* ─────────────────────────────────────────────────────────
   MISC
───────────────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  font-size: .85rem;
  color: #888;
  margin: 1rem 0;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #ddd;
}

.divider span {
  margin: 0 .75rem;
}

.swal2-container {
  z-index: 99999 !important;
}

.swal2-popup {
  z-index: 99999 !important;
}

.toast-stack {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toast-item {
  padding: 8px 13px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e9ecef;
  border-left: 3px solid #0d6efd;
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .09);
  animation: tIn .3s ease, tOut .3s ease 2.7s forwards;
  max-width: 250px;
}

body.dark-mode .toast-item {
  background: #21262d;
  border-color: #30363d;
  border-left-color: #388bfd;
  color: #e6edf3;
}

@keyframes tIn {
  from {
    transform: translateX(100%);
    opacity: 0
  }

  to {
    transform: none;
    opacity: 1
  }
}

@keyframes tOut {
  to {
    transform: translateX(110%);
    opacity: 0
  }
}

.spin-icon {
  animation: btnSpin .8s linear infinite;
}
