/* ============================================================
   Premium mobile-first auth (customer + panel login)
   ============================================================ */

.auth-shell,
.auth-panel-app {
  --auth-accent: var(--mp-primary, var(--pp, #5d3fd3));
  --auth-accent-2: var(--pp2, #7c5cff);
  --auth-accent-glow: color-mix(in srgb, var(--auth-accent) 35%, transparent);
  --auth-card-radius: 22px;
  --auth-input-radius: 14px;
  --auth-touch: 48px;
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Ambient background */
.auth-shell-bg,
.auth-panel-app::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(255,255,255,.18), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 20%, rgba(255,255,255,.08), transparent 50%),
    radial-gradient(ellipse 50% 30% at 0% 100%, rgba(0,0,0,.15), transparent 45%);
}

.auth-panel-app::before { opacity: .9; }

.auth-shell > *,
.auth-panel-app > * {
  position: relative;
  z-index: 1;
}

/* Header */
.auth-shell-header,
.auth-panel-header {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: calc(.45rem + env(safe-area-inset-top, 0px)) .85rem .5rem;
  color: #fff;
}

.auth-shell-header:has(.auth-shell-logo) {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 0;
}

.auth-shell-header:has(.auth-shell-logo) .auth-shell-back { grid-column: 1; }
.auth-shell-header:has(.auth-shell-logo) .auth-shell-brand {
  grid-column: 2;
  justify-content: center;
  flex: unset;
}

.auth-shell-back,
.auth-panel-back {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255,255,255,.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 1.15rem;
  flex-shrink: 0;
  transition: background .2s, transform .15s;
}

.auth-shell-back:active,
.auth-panel-back:active { transform: scale(.94); background: rgba(255,255,255,.22); }

.auth-shell-brand,
.auth-panel-brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  min-width: 0;
  flex: 1;
}

.auth-shell-brand:has(.auth-shell-logo) {
  align-items: center;
}

.auth-shell-logo,
.auth-app-logo {
  display: block;
  height: auto;
  max-height: 52px;
  width: auto;
  max-width: min(200px, calc(100vw - 120px));
  object-fit: contain;
  object-position: center;
  background: #fff;
  padding: .35rem .55rem;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
}

.auth-shell-brand-text { min-width: 0; }
.auth-shell-icon,
.auth-panel-icon { font-size: 1.85rem; line-height: 1; filter: drop-shadow(0 2px 8px rgba(0,0,0,.2)); }

.auth-shell-title,
.auth-panel-title {
  font-weight: 900;
  font-size: 1.08rem;
  line-height: 1.15;
  letter-spacing: -.02em;
}

.auth-shell-sub,
.auth-panel-sub {
  font-size: .76rem;
  opacity: .78;
  margin-top: .1rem;
}

/* Main */
.auth-shell-main,
.auth-panel-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 .85rem calc(.5rem + env(safe-area-inset-bottom, 0px));
}

.auth-panel-main {
  justify-content: flex-start;
}

.auth-shell-hero {
  text-align: center;
  color: #fff;
  padding: .15rem .85rem .55rem;
}

.auth-shell-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .28rem .6rem;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.2);
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: .4rem;
}

.auth-shell-hero h2 {
  font-size: 1.35rem;
  font-weight: 900;
  margin: 0 0 .2rem;
  letter-spacing: -.03em;
  line-height: 1.15;
}

.auth-shell-hero p {
  margin: 0;
  font-size: .82rem;
  opacity: .82;
  max-width: 260px;
  margin-inline: auto;
  line-height: 1.4;
}

/* Card */
.auth-shell-card,
.auth-panel-card {
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--auth-card-radius);
  padding: 1.1rem 1.1rem .95rem;
  box-shadow:
    0 4px 6px rgba(0,0,0,.04),
    0 18px 40px rgba(0,0,0,.16),
    inset 0 1px 0 rgba(255,255,255,.8);
  border: 1px solid rgba(255,255,255,.6);
  margin-top: 0;
  animation: authCardIn .45s cubic-bezier(.22,1,.36,1) both;
}

@keyframes authCardIn {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.auth-shell-alert,
.auth-panel-alert {
  border-radius: 14px;
  padding: .6rem .8rem;
  font-size: .82rem;
  margin-bottom: .65rem;
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  font-weight: 600;
}

.auth-shell-alert-danger,
.auth-panel-alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.auth-shell-alert-success,
.auth-panel-alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* Footer */
.auth-shell-footer,
.auth-panel-footer {
  padding: .55rem .85rem calc(.55rem + env(safe-area-inset-bottom, 0px));
  display: flex !important;
  justify-content: center;
  gap: .45rem;
  flex-wrap: wrap;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.auth-shell-footer a,
.auth-panel-footer a {
  color: rgba(255,255,255,.9);
  font-size: .78rem;
  font-weight: 700;
  text-decoration: none;
  padding: .45rem .85rem;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  transition: background .2s;
}

.auth-shell-footer a:active,
.auth-panel-footer a:active { background: rgba(255,255,255,.2); }

/* ---- OTP flow ---- */
.auth-flow { position: relative; }

.auth-flow-progress {
  height: 3px;
  background: #f3f4f6;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: .85rem;
}

.auth-flow-progress-bar {
  height: 100%;
  width: 33.33%;
  background: linear-gradient(90deg, var(--auth-accent), var(--auth-accent-2));
  border-radius: 999px;
  transition: width .35s cubic-bezier(.22,1,.36,1);
}

.auth-flow[data-step="2"] .auth-flow-progress-bar { width: 66.66%; }
.auth-flow[data-step="3"] .auth-flow-progress-bar { width: 100%; }

.auth-flow-steps {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: .75rem;
  padding: 0 .1rem;
}

.auth-flow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  flex: 1;
  position: relative;
}

.auth-flow-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 800;
  background: #f3f4f6;
  color: #9ca3af;
  border: 2px solid #e5e7eb;
  transition: all .3s cubic-bezier(.22,1,.36,1);
}

.auth-flow-step-label {
  font-size: .65rem;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: .05em;
  text-align: center;
}

.auth-flow-step.active .auth-flow-step-num {
  background: linear-gradient(135deg, var(--auth-accent), var(--auth-accent-2));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 16px var(--auth-accent-glow);
  transform: scale(1.05);
}

.auth-flow-step.active .auth-flow-step-label { color: var(--auth-accent); }

.auth-flow-step.done .auth-flow-step-num {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}

.auth-flow-step-line { display: none; }

.auth-flow-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--auth-accent) 12%, #fff), #fff);
  border: 1px solid color-mix(in srgb, var(--auth-accent) 20%, #e5e7eb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--auth-accent);
  margin-bottom: .6rem;
  box-shadow: 0 6px 16px var(--auth-accent-glow);
}

.auth-form-heading {
  font-size: 1.25rem;
  font-weight: 900;
  margin: 0 0 .2rem;
  color: #0f172a;
  letter-spacing: -.03em;
  line-height: 1.2;
}

.auth-form-lead {
  font-size: .84rem;
  color: #64748b;
  margin: 0 0 .85rem;
  line-height: 1.45;
}

.auth-flow-panel {
  animation: authStepIn .35s cubic-bezier(.22,1,.36,1) both;
}

.auth-flow-panel[hidden] { display: none !important; }

@keyframes authStepIn {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

.auth-field { margin-bottom: .8rem; }

.auth-field label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .72rem;
  font-weight: 800;
  color: #475569;
  margin-bottom: .4rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.auth-field label i { color: var(--auth-accent); font-size: 1rem; }

.auth-field .form-control {
  border: 1.5px solid #e2e8f0;
  border-radius: var(--auth-input-radius);
  padding: .7rem .9rem;
  font-size: 1rem;
  height: var(--auth-touch);
  background: #fafafa;
  transition: border-color .2s, box-shadow .2s, background .2s;
}

.auth-field .form-control:focus {
  border-color: var(--auth-accent);
  background: #fff;
  box-shadow: 0 0 0 4px var(--auth-accent-glow);
}

.auth-input-wrap { display: flex; align-items: stretch; }

.auth-input-prefix {
  display: flex;
  align-items: center;
  padding: 0 1rem;
  font-weight: 800;
  font-size: 1rem;
  color: #64748b;
  background: #f1f5f9;
  border: 1.5px solid #e2e8f0;
  border-right: 0;
  border-radius: var(--auth-input-radius) 0 0 var(--auth-input-radius);
}

.auth-input-prefixed {
  border-radius: 0 var(--auth-input-radius) var(--auth-input-radius) 0 !important;
  flex: 1;
  letter-spacing: .04em;
}

.auth-input-wrap:focus-within .auth-input-prefix {
  border-color: var(--auth-accent);
  color: var(--auth-accent);
  background: color-mix(in srgb, var(--auth-accent) 8%, #fff);
}

.auth-input-wrap:focus-within .auth-input-prefixed { border-color: var(--auth-accent); }

/* OTP boxes */
.auth-otp-inputs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(.35rem, 2vw, .6rem);
  margin: .85rem 0 1.1rem;
  max-width: 340px;
  margin-inline: auto;
}

.otp-digit {
  width: 100%;
  aspect-ratio: 1;
  max-height: 58px;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  text-align: center;
  font-size: clamp(1.2rem, 5vw, 1.5rem);
  font-weight: 800;
  color: #0f172a;
  background: #f8fafc;
  transition: border-color .2s, box-shadow .2s, transform .15s, background .2s;
  padding: 0;
}

.otp-digit:focus {
  border-color: var(--auth-accent);
  background: #fff;
  box-shadow: 0 0 0 4px var(--auth-accent-glow);
  outline: none;
  transform: translateY(-2px);
}

.otp-digit:not(:placeholder-shown) {
  border-color: color-mix(in srgb, var(--auth-accent) 50%, #e2e8f0);
  background: #fff;
}

/* Banners */
.auth-otp-sent {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .7rem .85rem;
  border-radius: 14px;
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: .8rem;
  line-height: 1.45;
  border: 1px solid transparent;
}

.auth-otp-sent i { font-size: 1.25rem; flex-shrink: 0; margin-top: .05rem; }

.auth-otp-sent-success {
  background: linear-gradient(135deg, #eff6ff, #ecfdf5);
  color: #1e40af;
  border-color: #bfdbfe;
}

.auth-otp-sent-new {
  background: linear-gradient(135deg, #faf5ff, #eff6ff);
  color: #6d28d9;
  border-color: #ddd6fe;
}

/* Buttons */
.auth-submit-btn {
  width: 100%;
  min-height: var(--auth-touch);
  border: 0;
  border-radius: var(--auth-input-radius);
  padding: .75rem 1.1rem;
  background: linear-gradient(135deg, var(--auth-accent) 0%, var(--auth-accent-2) 100%);
  color: #fff;
  font-weight: 800;
  font-size: .98rem;
  letter-spacing: -.01em;
  box-shadow: 0 8px 24px var(--auth-accent-glow), inset 0 1px 0 rgba(255,255,255,.2);
  transition: transform .15s, box-shadow .2s, opacity .2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
}

.auth-submit-btn:hover { box-shadow: 0 12px 28px var(--auth-accent-glow); }

.auth-submit-btn:active:not(:disabled) { transform: scale(.98); }

.auth-submit-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none !important;
}

.auth-submit-btn.is-loading {
  pointer-events: none;
  opacity: .75;
}

.auth-otp-resend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  font-size: .82rem;
  color: #64748b;
}

.auth-link-btn {
  border: 0;
  background: transparent;
  color: var(--auth-accent);
  font-weight: 700;
  font-size: .82rem;
  padding: .25rem .35rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  margin-top: .75rem;
  padding-top: .65rem;
  border-top: 1px solid #f1f5f9;
  font-size: .68rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.auth-trust i { color: #22c55e; font-size: .9rem; }

/* Tablet */
@media (min-width: 640px) {
  .auth-shell-main:has(.auth-shell-hero:not(.auth-panel-hero)),
  .auth-panel-main {
    align-items: center;
    padding: 1.5rem;
  }

  .auth-shell-main:has(.auth-shell-hero:not(.auth-panel-hero)) {
    justify-content: center;
  }

  .auth-panel-main {
    justify-content: flex-start;
    padding: 0 .85rem 1rem;
  }

  .auth-shell-card,
  .auth-panel-card {
    width: 100%;
    max-width: 420px;
    border-radius: var(--auth-card-radius);
    margin-top: 0;
    padding: 1.35rem 1.25rem 1.15rem;
  }

  .auth-shell-hero:not(.auth-panel-hero) { padding-bottom: 1.75rem; }
  .auth-shell-hero:not(.auth-panel-hero) h2 { font-size: 1.85rem; }
}

.auth-panel-hero {
  padding: .1rem .85rem .45rem;
}

.auth-panel-hero h2 {
  font-size: 1.2rem;
  margin-bottom: .15rem;
}

.auth-panel-hero p {
  font-size: .78rem;
  max-width: 240px;
}

/* Desktop — split layout only when customer hero present */
@media (min-width: 992px) {
  .auth-shell:has(.auth-shell-hero:not(.auth-panel-hero)) {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr auto;
  }

  .auth-shell:has(.auth-shell-hero:not(.auth-panel-hero)) .auth-shell-header,
  .auth-shell:has(.auth-shell-hero:not(.auth-panel-hero)) .auth-panel-header { grid-column: 1 / -1; }

  .auth-shell:has(.auth-shell-hero:not(.auth-panel-hero)) .auth-shell-main,
  .auth-shell:has(.auth-shell-hero:not(.auth-panel-hero)) .auth-panel-main {
    grid-column: 2;
    grid-row: 2;
    justify-content: center;
    padding: 2rem;
  }

  .auth-shell:has(.auth-shell-hero:not(.auth-panel-hero)) .auth-shell-footer,
  .auth-shell:has(.auth-shell-hero:not(.auth-panel-hero)) .auth-panel-footer { grid-column: 1 / -1; }

  .auth-shell-hero:not(.auth-panel-hero) {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    text-align: left;
    padding: 3rem 2.5rem 3rem 3rem;
  }

  .auth-shell-hero:not(.auth-panel-hero) p { margin-inline: 0; max-width: 340px; font-size: 1rem; }
  .auth-shell-hero:not(.auth-panel-hero) h2 { font-size: 2.35rem; }
}

@media (min-width: 992px) {
  .auth-shell-card,
  .auth-panel-card { max-width: 400px; }
}

@media (max-width: 380px) {
  .auth-flow-step-label { font-size: .58rem; }
  .auth-flow-step-num { width: 32px; height: 32px; font-size: .75rem; }
  .auth-form-heading { font-size: 1.35rem; }
}
