/* ================================================================
   TECLUBIN PORTAL — Premium Design System
   ================================================================ */

:root {
  --brand:        #103a67;
  --brand-dark:   #0b2847;
  --brand-deeper: #071d37;
  --gold:         #e8921a;
  --gold-light:   #f5a83a;

  --surface:      #ffffff;
  --surface-alt:  #f8fafc;
  --surface-hover:#f1f5f9;

  --ink:          #0f1e2e;
  --ink-muted:    #52647a;
  --ink-light:    #8499b0;

  --border:       #e2e8f0;
  --border-focus: #7aa6cc;

  --success:      #16a34a;
  --danger:       #dc2626;

  --r-sm: 8px;
  --r:    14px;
  --r-lg: 20px;
  --r-xl: 28px;

  --shadow-card: 0 40px 80px rgba(4,12,28,.55), 0 8px 20px rgba(4,12,28,.3),
                 0 0 0 1px rgba(255,255,255,.06);
  --shadow-input: 0 1px 3px rgba(15,30,50,.07);
  --shadow-btn:   0 6px 22px rgba(16,58,103,.38);
  --shadow-green: 0 6px 22px rgba(22,163,74,.38);
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: #07101e;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Animated Background ─────────────────────────────────────── */
.bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 90% 65% at 5% 0%,   #0e2a4a 0%, transparent 55%),
    radial-gradient(ellipse 60% 80% at 95% 100%, #170d2b 0%, transparent 55%),
    linear-gradient(160deg, #07101e 0%, #0c1628 50%, #070f1b 100%);
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  animation: blobFloat linear infinite;
  pointer-events: none;
}
.blob-1 {
  width: 640px; height: 640px;
  background: radial-gradient(circle, rgba(16,58,103,.65) 0%, transparent 70%);
  top: -220px; right: -160px;
  animation-duration: 28s;
}
.blob-2 {
  width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(232,146,26,.18) 0%, transparent 70%);
  bottom: -120px; left: -100px;
  animation-duration: 34s;
  animation-delay: -9s;
}
.blob-3 {
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(99,102,241,.18) 0%, transparent 70%);
  top: 38%; left: 28%;
  animation-duration: 22s;
  animation-delay: -14s;
}
@keyframes blobFloat {
  0%,100% { transform: translate(0,0) scale(1); }
  33%      { transform: translate(28px,-18px) scale(1.04); }
  66%      { transform: translate(-18px,12px) scale(.97); }
}

/* ── Portal Shell & Card ─────────────────────────────────────── */
.portal-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
}

.portal-card {
  display: flex;
  width: 100%;
  max-width: 980px;
  min-height: 600px;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  animation: cardIn .65s cubic-bezier(.16,1,.3,1) forwards;
}
@keyframes cardIn {
  from { opacity:0; transform: scale(.95) translateY(20px); }
  to   { opacity:1; transform: scale(1)  translateY(0); }
}

/* ── Brand Aside (Left Panel) ────────────────────────────────── */
.portal-aside {
  width: 286px;
  flex-shrink: 0;
  background: linear-gradient(168deg, #1c4a7a 0%, #112f58 44%, #0b2244 100%);
  padding: 38px 28px 32px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
/* subtle golden glow at top */
.portal-aside::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 130% 55% at 50% -5%,
              rgba(232,146,26,.14) 0%, transparent 60%);
  pointer-events: none;
}
/* decorative circle bottom-right */
.portal-aside::after {
  content: '';
  position: absolute;
  bottom: -90px; right: -90px;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: rgba(255,255,255,.025);
  pointer-events: none;
}

.aside-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Brand block */
.brand-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 46px;
}
.brand-logo-ring {
  display: none;
}
.brand-logo-img {
  width: 100%;
  border-radius: 15px;
  object-fit: contain;
}
.brand-wordmark {
  display: none;
}
.brand-tagline {
  font-size: 11px;
  color: rgba(255,255,255,.5);
  letter-spacing: .025em;
  text-align: center;
}

/* ── Vertical Stepper ────────────────────────────────────────── */
.v-stepper {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* .step class used by app.js — keep it on .v-step */
.v-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.v-step-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}
.v-step-dot {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .35s cubic-bezier(.16,1,.3,1);
  position: relative;
  flex-shrink: 0;
}
.v-step-dot span {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,.35);
  transition: color .3s;
}
.v-step-connector {
  width: 2px;
  height: 44px;
  background: rgba(255,255,255,.1);
  margin: 7px 0;
  border-radius: 1px;
  position: relative;
  overflow: hidden;
}
.v-step-connector::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 0;
  background: linear-gradient(180deg, var(--gold), rgba(232,146,26,.4));
  border-radius: 1px;
  transition: height .45s cubic-bezier(.16,1,.3,1);
}
.v-step-content {
  padding-top: 6px;
  padding-bottom: 32px;
}
.v-step-content strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: rgba(255,255,255,.3);
  line-height: 1.3;
  transition: color .3s;
}
.v-step-content span {
  display: block;
  font-size: 12px;
  color: rgba(255,255,255,.22);
  margin-top: 3px;
  transition: color .3s;
}

/* Active step */
.v-step.is-active .v-step-dot {
  border-color: var(--gold);
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  box-shadow: 0 0 0 5px rgba(232,146,26,.22), 0 4px 14px rgba(232,146,26,.35);
}
.v-step.is-active .v-step-dot span { color: #fff; }
.v-step.is-active .v-step-content strong { color: rgba(255,255,255,.95); }
.v-step.is-active .v-step-content span  { color: rgba(255,255,255,.58); }

/* Done step */
.v-step.is-done .v-step-dot {
  border-color: #22c55e;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(34,197,94,.18);
}
.v-step.is-done .v-step-dot span { display: none; }
.v-step.is-done .v-step-dot::after {
  content: '';
  display: block;
  width: 11px; height: 6px;
  border-left: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff;
  transform: rotate(-45deg) translate(1px,-1px);
}
.v-step.is-done .v-step-connector { background: rgba(34,197,94,.3); }
.v-step.is-done .v-step-connector::after { height: 100%; }
.v-step.is-done .v-step-content strong { color: rgba(255,255,255,.6); }
.v-step.is-done .v-step-content span   { color: rgba(255,255,255,.3); }

/* Aside footer */
.aside-footer {
  margin-top: auto;
  padding-top: 22px;
  border-top: 1px solid rgba(255,255,255,.09);
}
.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,.65);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 999px;
  padding: 5px 11px;
  margin-bottom: 10px;
}
.aside-footer p {
  font-size: 11px;
  color: rgba(255,255,255,.3);
  line-height: 1.55;
  margin: 0;
}
.help-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  background: rgba(232, 93, 28, 0.12);
  border: 1px solid rgba(232, 93, 28, 0.32);
  border-radius: 10px;
  color: #ffb48a;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  transition: background .18s, color .18s, border-color .18s, transform .18s;
}
.help-link span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.help-link:hover {
  background: rgba(232, 93, 28, 0.22);
  border-color: rgba(232, 93, 28, 0.55);
  color: #ffd2b3;
  transform: translateY(-1px);
}
.help-link svg { flex: 0 0 auto; }

/* ── Help modal overlay ────────────────────────────────────── */
.help-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .26s cubic-bezier(.22,.61,.36,1), visibility 0s linear .26s;
}
.help-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .3s cubic-bezier(.22,.61,.36,1), visibility 0s;
}
.help-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 14, 24, 0.62);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.help-modal-card {
  position: relative;
  width: 100%;
  max-width: 1180px;
  height: 92vh;
  max-height: 92vh;
  background: #ffffff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.45), 0 10px 32px rgba(0,0,0,0.25);
  transform: translateY(14px) scale(0.975);
  opacity: 0;
  transition: transform .34s cubic-bezier(.22,.61,.36,1), opacity .28s cubic-bezier(.22,.61,.36,1);
}
.help-modal.is-open .help-modal-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.help-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 30, 50, 0.72);
  color: #ffffff;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  z-index: 3;
  transition: background .18s, transform .18s;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.help-modal-close:hover {
  background: rgba(15, 30, 50, 0.92);
  transform: scale(1.06);
}
.help-modal-close:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.help-modal-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
body.help-modal-open {
  overflow: hidden;
}
@media (max-width: 720px) {
  .help-modal { padding: 0; }
  .help-modal-card {
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .help-modal-close {
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
    background: rgba(15, 30, 50, 0.82);
  }
}
@media (prefers-reduced-motion: reduce) {
  .help-modal, .help-modal-card { transition: opacity .15s linear, visibility 0s; }
  .help-modal-card { transform: none; }
}

/* ── Portal Main (Right Panel) ───────────────────────────────── */
.portal-main {
  flex: 1;
  background: var(--surface);
  padding: 44px 48px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* ── Step Panels ─────────────────────────────────────────────── */
.step-panel { flex: 1; }

.step-panel:not(.hidden) {
  animation: panelIn .4s cubic-bezier(.16,1,.3,1);
}
@keyframes panelIn {
  from { opacity:0; transform: translateY(14px); }
  to   { opacity:1; transform: translateY(0); }
}

.panel-header { margin-bottom: 28px; }
.panel-header h2 {
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 8px;
  letter-spacing: -.025em;
}
.panel-header p {
  color: var(--ink-muted);
  font-size: 14px;
  margin: 0;
  line-height: 1.55;
}

/* ── Global Alert ────────────────────────────────────────────── */
.alert {
  border-radius: var(--r);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 20px;
  border: 1.5px solid;
  animation: alertIn .25s ease;
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
}
.alert.success {
  background: #f0fdf4;
  border-color: #86efac;
  color: #15803d;
}
@keyframes alertIn {
  from { opacity:0; transform: translateY(-6px); }
  to   { opacity:1; transform: translateY(0); }
}

/* ── Fields ──────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  margin-bottom: 4px;
}
.field-label {
  font-size: 13px;
  font-weight: 600;
  color: #2b3f5c;
  margin-bottom: 7px;
  letter-spacing: .01em;
}
.input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-family: inherit;
  padding: 11px 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
  box-shadow: var(--shadow-input);
  appearance: none;
  -webkit-appearance: none;
}
select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='7' viewBox='0 0 11 7'%3E%3Cpath d='M1 1l4.5 4.5L10 1' stroke='%2352647a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}
.input:hover:not(:disabled) { border-color: #b8c9dc; }
.input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3.5px rgba(122,166,204,.18), var(--shadow-input);
}
.input:disabled {
  background: var(--surface-alt);
  color: var(--ink-muted);
  cursor: not-allowed;
  opacity: .7;
}
.input.is-valid {
  /* no visual feedback for format-only validation */
}
.input.is-invalid {
  border-color: #f0a0a0;
  background: #fff8f8;
  box-shadow: 0 0 0 3.5px rgba(240,160,160,.13), var(--shadow-input);
}
.field-help {
  min-height: 18px;
  margin: 6px 2px 0;
  font-size: 12px;
  color: var(--ink-light);
}
.field-help.is-error { color: var(--danger); }
.field-help.is-ok    { visibility: hidden; }

/* Prefix $ */
.input-prefix-wrap { position: relative; }
.input-prefix {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  font-size: 15px; font-weight: 600;
  color: var(--ink-muted);
  pointer-events: none;
  z-index: 1;
}
.input-prefixed { padding-left: 28px; }

/* Form grid */
.form-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}
.field-group { margin-bottom: 24px; }

/* ── Choice Cards ────────────────────────────────────────────── */
.choice-row {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}
.choice-card {
  display: block;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-alt);
  cursor: pointer;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.choice-card:hover {
  border-color: #b8c9dc;
  background: var(--surface-hover);
}
.choice-card input[type="radio"] {
  position: absolute;
  opacity: 0; width: 0; height: 0;
  pointer-events: none;
}
.choice-card-body {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}
.choice-icon {
  width: 42px; height: 42px;
  border-radius: 11px;
  background: rgba(16,58,103,.07);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  flex-shrink: 0;
  transition: background .2s, color .2s;
}
.choice-text { display: flex; flex-direction: column; }
.choice-text strong {
  font-size: 14px; font-weight: 700;
  color: var(--ink); line-height: 1.3;
}
.choice-text span {
  font-size: 12px; color: var(--ink-muted); margin-top: 2px;
}
/* checked state — :has works in all modern browsers */
.choice-card:has(input:checked) {
  border-color: var(--brand);
  background: #eef4ff;
  box-shadow: 0 0 0 3.5px rgba(16,58,103,.09);
}
.choice-card:has(input:checked) .choice-icon {
  background: var(--brand);
  color: #fff;
}

/* ── Info Box (Customer Lookup) ──────────────────────────────── */
.info-box {
  border-radius: var(--r);
  border: 1.5px solid #cde2f5;
  background: #eef6ff;
  padding: 14px 16px;
  margin-bottom: 20px;
  transition: border-color .25s ease, background .25s ease;
}
.info-box[data-state="success"] {
  border-color: #b6e1c5;
  background: #ecfaf0;
}
.info-box[data-state="error"] {
  border-color: #f5c6c6;
  background: #fdecec;
}
.info-box .lookup-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}
.info-box #customerLookupMessage {
  margin: 0;
  flex: 1;
}
.lookup-icon {
  position: relative;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lookup-icon .lookup-spinner,
.lookup-icon .lookup-success,
.lookup-icon .lookup-warn { display: none; }
.info-box[data-state="loading"] .lookup-spinner { display: inline-block; }
.info-box[data-state="success"] .lookup-success { display: inline-block; color: #16a34a; animation: lookupPop .4s cubic-bezier(.16,1,.3,1); }
.info-box[data-state="error"] .lookup-warn { display: inline-block; color: #b91c1c; animation: lookupPop .4s cubic-bezier(.16,1,.3,1); }
.lookup-spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(16,58,103,.18);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: lookupSpin .8s linear infinite;
}
@keyframes lookupSpin {
  to { transform: rotate(360deg); }
}
@keyframes lookupPop {
  0% { transform: scale(.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.muted {
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 12px;
}
.compact { margin: 0 0 12px; }
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Order Summary ───────────────────────────────────────────── */
.order-summary {
  border-radius: var(--r);
  background: var(--surface-alt);
  border: 1.5px solid var(--border);
  padding: 14px 16px;
  font-size: 13px;
  color: #3a5570;
  margin-bottom: 20px;
  display: grid;
  gap: 5px;
}
.order-summary ul {
  margin: 4px 0 0;
  padding-left: 18px;
  color: var(--ink-muted);
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--r);
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: .01em;
  cursor: pointer;
  transition: transform .15s, box-shadow .2s, opacity .15s, background .2s;
  white-space: nowrap;
}
.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}
.btn-primary {
  background: linear-gradient(130deg, #1e5291, var(--brand));
  color: #fff;
  box-shadow: var(--shadow-btn);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(16,58,103,.48);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-success {
  background: linear-gradient(130deg, #1aad4e, var(--success));
  color: #fff;
  box-shadow: var(--shadow-green);
}
.btn-success:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(22,163,74,.48);
}

.btn-secondary {
  background: var(--surface-alt);
  color: #334e6a;
  border: 1.5px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: #b8c9dc;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--brand);
  border: none;
  padding: 8px 12px;
  font-size: 13px;
}
.btn-ghost:hover:not(:disabled) { background: rgba(16,58,103,.07); }

.btn-outline {
  background: transparent;
  color: var(--brand);
  border: 1.5px solid var(--brand);
}
.btn-outline:hover:not(:disabled) {
  background: var(--brand);
  color: #fff;
  transform: translateY(-1px);
}

.btn-sm  { padding: 8px 14px; font-size: 13px; border-radius: var(--r-sm); }
.btn-full { width: 100%; margin-top: 8px; }

/* ── Actions Row ─────────────────────────────────────────────── */
.actions { display: grid; gap: 10px; margin-top: 8px; }

/* ── Step 3 — Review Card ────────────────────────────────────── */
.review-card {
  display: flex;
  align-items: center;
  gap: 18px;
  border-radius: var(--r-lg);
  border: 1.5px solid #cde2f5;
  background: linear-gradient(135deg, #f4f9ff 0%, #ecf3ff 100%);
  padding: 22px 26px;
  margin-bottom: 28px;
  animation: panelIn .4s cubic-bezier(.16,1,.3,1);
}
.review-card-icon {
  width: 54px; height: 54px;
  border-radius: 15px;
  background: linear-gradient(135deg, #1e5291, var(--brand));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(16,58,103,.32);
}
.review-card-body  { display: flex; flex-direction: column; gap: 4px; }
.review-card-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.review-card-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: .02em;
}

/* ── Step 3 — Success State ──────────────────────────────────── */
.success-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 0 8px;
}
.success-container:not(.hidden) {
  animation: panelIn .45s cubic-bezier(.16,1,.3,1);
}

.success-anim {
  position: relative;
  width: 96px; height: 96px;
  margin-bottom: 26px;
}
.success-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(135deg, #22c55e, #16a34a) border-box;
  animation: ringPop .5s cubic-bezier(.16,1,.3,1) forwards;
}
.success-icon {
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 8px 28px rgba(22,197,94,.42);
  animation: iconBounce .65s .1s cubic-bezier(.16,1,.3,1) both;
}
@keyframes ringPop {
  0%   { transform: scale(.4); opacity:0; }
  100% { transform: scale(1);  opacity:1; }
}
@keyframes iconBounce {
  0%  { transform: scale(0) rotate(-20deg); opacity:0; }
  65% { transform: scale(1.1) rotate(4deg); }
  100%{ transform: scale(1)  rotate(0deg); opacity:1; }
}

.success-container h2 {
  font-size: 27px;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 10px;
  letter-spacing: -.025em;
}
.success-container .muted {
  max-width: 330px;
  margin: 0 auto 26px;
}

.invoice-folio {
  border-radius: var(--r-lg);
  border: 2px solid #cde2f5;
  background: linear-gradient(135deg, #f4f9ff, #ecf3ff);
  padding: 18px 36px;
  text-align: center;
  margin-bottom: 16px;
}
.folio-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 6px;
}
.folio-number {
  display: block;
  font-size: 30px;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: .03em;
}

.email-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-muted);
  margin: 0 0 26px;
}

.resend-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.resend-status {
  font-size: 13px;
  color: var(--ink-muted);
}

.resend-status.ok { color: var(--green, #22a45d); }
.resend-status.err { color: var(--red, #d93025); }

/* ── Resend toggle & panel (step 1) ──────────────────────────── */
.resend-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 20px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-light);
  font-size: 12px;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: .06em;
  position: relative;
}
.resend-toggle-btn::before,
.resend-toggle-btn::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.resend-toggle-btn:hover { color: var(--ink-muted); }
.resend-toggle-btn svg { transition: transform .2s; flex-shrink: 0; }
.resend-toggle-btn.open svg { transform: rotate(180deg); }

.resend-panel {
  margin-top: 12px;
  padding: 16px 18px 18px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--r);
}

.resend-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-muted);
  font-size: 13px;
  font-family: inherit;
  padding: 0;
  margin-bottom: 14px;
}
.resend-back-btn:hover { color: var(--brand); }

.resend-panel-desc {
  font-size: 13px;
  color: var(--ink-muted);
  margin: 0 0 16px;
}

.resend-panel-status {
  font-size: 13px;
  margin: 10px 0 0;
  color: var(--ink-muted);
}
.resend-panel-status.ok  { color: var(--success); }
.resend-panel-status.err { color: var(--danger); }

/* ── Utility ─────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Mobile-only elements: hidden by default (desktop-first) ─── */
.mobile-topbar,
.mobile-progress,
.mobile-footer {
  display: none;
}

/* ── Responsive: tablet / desktop ───────────────────────────── */
@media (min-width: 769px) {
  .form-grid          { grid-template-columns: 1fr 1fr; }
  .field-full         { grid-column: span 2; }
  .choice-row         { grid-template-columns: 1fr 1fr; }
  .actions            { grid-template-columns: 1fr 1fr; }
}

/* ════════════════════════════════════════════════════════════════
   MOBILE (< 720px) — full redesign, phone-native feel
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 720px) {

  /* Shell: remove side gutters, let card fill viewport */
  body { font-size: 15px; }

  .portal-shell {
    flex-direction: column;
    padding: 0;
    align-items: stretch;
    justify-content: flex-start;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .portal-card {
    flex-direction: column;
    border-radius: 0;
    box-shadow: none;
    min-height: 100vh;
    min-height: 100dvh;
    max-width: 100%;
    background: var(--surface);
  }

  /* Hide the desktop aside entirely on mobile — we replace it with
     the mobile-topbar + mobile-progress + mobile-footer. */
  .portal-aside { display: none; }

  /* ── Mobile top bar ───────────────────────────────────────── */
  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    background: linear-gradient(168deg, #1c4a7a 0%, #112f58 60%, #0b2244 100%);
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid rgba(255,255,255,.08);
  }
  .mobile-topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }
  .mobile-topbar-logo {
    height: 32px;
    width: auto;
    max-width: 120px;
    border-radius: 6px;
    object-fit: contain;
    background: #fff;
    padding: 3px 6px;
  }
  .mobile-topbar-tagline {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    color: rgba(255,255,255,.72);
    text-transform: uppercase;
    white-space: nowrap;
  }
  .mobile-help-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 13px;
    background: rgba(232, 93, 28, 0.18);
    border: 1px solid rgba(232, 93, 28, 0.45);
    border-radius: 999px;
    color: #ffd2b3;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    min-height: 36px;
    transition: background .15s, transform .15s;
  }
  .mobile-help-pill:active { transform: scale(.96); background: rgba(232, 93, 28, 0.28); }
  .mobile-help-pill svg { flex-shrink: 0; }

  /* ── Mobile progress (horizontal) ────────────────────────── */
  .mobile-progress {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 20px 6px;
    background: var(--surface);
  }
  .mobile-progress-label {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-family: inherit;
  }
  .mobile-progress-current {
    font-size: 13px;
    font-weight: 700;
    color: var(--brand);
    letter-spacing: .02em;
  }
  .mobile-progress-total {
    font-size: 13px;
    color: var(--ink-muted);
    font-weight: 500;
  }
  .mobile-progress-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    margin-left: auto;
    letter-spacing: -.005em;
  }
  .mobile-progress-track {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
  }
  .mobile-progress-fill {
    position: absolute;
    inset: 0;
    width: 33%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand), var(--gold));
    transition: width .45s cubic-bezier(.16,1,.3,1);
  }

  /* Drive the progress fill from the hidden v-stepper state.
     The aside is display:none but still in the DOM, so :has() works. */
  .portal-card:has(.v-step:nth-child(2).is-active) .mobile-progress-fill { width: 66%; }
  .portal-card:has(.v-step:nth-child(3).is-active) .mobile-progress-fill { width: 100%; }

  /* Replace static text ("Paso 1" / "Verificación") with dynamic text
     via pseudo-elements, driven by which v-step has .is-active. */
  .mobile-progress-current,
  .mobile-progress-title {
    font-size: 0;               /* hide original inline text */
    position: relative;
  }
  .mobile-progress-current::after,
  .mobile-progress-title::after {
    font-size: 13px;
    letter-spacing: inherit;
    color: inherit;
    font-weight: inherit;
  }
  /* Default (step 1 active) */
  .mobile-progress-current::after { content: "Paso 1"; }
  .mobile-progress-title::after   { content: "Verificación"; }
  /* Step 2 active */
  .portal-card:has(.v-step:nth-child(2).is-active) .mobile-progress-current::after { content: "Paso 2"; }
  .portal-card:has(.v-step:nth-child(2).is-active) .mobile-progress-title::after   { content: "Datos fiscales"; }
  /* Step 3 active */
  .portal-card:has(.v-step:nth-child(3).is-active) .mobile-progress-current::after { content: "Paso 3"; color: var(--success); }
  .portal-card:has(.v-step:nth-child(3).is-active) .mobile-progress-title::after   { content: "Confirmación"; }

  /* "de 3" stays visible always */
  .mobile-progress-total { font-size: 13px; }

  /* ── Portal main (form) ──────────────────────────────────── */
  .portal-main {
    padding: 20px 20px 28px;
    overflow-y: visible;
  }

  /* Global alert near top of scroll */
  .alert { margin-bottom: 16px; font-size: 14px; }

  /* Panel header: tighter but readable */
  .panel-header { margin-bottom: 22px; }
  .panel-header h2 {
    font-size: clamp(22px, 6.2vw, 26px);
    letter-spacing: -.02em;
  }
  .panel-header p { font-size: 14px; }

  /* Fields: full-width, 16px font to prevent iOS zoom, larger tap target */
  .input {
    font-size: 16px;              /* prevents iOS zoom on focus */
    padding: 14px 16px;
    min-height: 48px;
    border-radius: 12px;
  }
  select.input {
    background-position: right 16px center;
    padding-right: 40px;
  }
  .input-prefix { font-size: 16px; left: 16px; }
  .input-prefixed { padding-left: 32px; }
  .field-label { font-size: 13px; margin-bottom: 8px; }
  .field-help  { font-size: 12px; }

  /* Form grid: single column */
  .form-grid { grid-template-columns: 1fr; gap: 14px; margin-bottom: 20px; }

  /* Choice cards: stack vertically, full width, big tap targets */
  .choice-row { grid-template-columns: 1fr; gap: 10px; }
  .choice-card-body { gap: 14px; padding: 16px 16px; min-height: 64px; }
  .choice-icon { width: 40px; height: 40px; border-radius: 10px; }
  .choice-text strong { font-size: 15px; }
  .choice-text span { font-size: 12px; }

  /* Buttons: generous vertical, full-width for primary CTAs */
  .btn {
    padding: 15px 22px;
    font-size: 15px;
    min-height: 52px;
    border-radius: 12px;
  }
  .btn-full { margin-top: 10px; }
  .btn-sm { min-height: 40px; padding: 10px 14px; font-size: 13px; }
  .btn-ghost { min-height: 40px; padding: 10px 12px; }

  /* Actions row: stack on phones for breathing room */
  .actions { grid-template-columns: 1fr; gap: 10px; }
  .actions .btn-secondary { order: 2; }
  .actions .btn-primary, .actions .btn-success { order: 1; }

  /* Info / order summary */
  .info-box, .order-summary { padding: 14px 16px; border-radius: 12px; }

  /* Review card (step 3) */
  .review-card {
    flex-direction: row;
    gap: 14px;
    padding: 18px 20px;
    border-radius: 14px;
  }
  .review-card-icon { width: 46px; height: 46px; border-radius: 12px; }
  .review-card-value { font-size: 20px; }

  /* Success state */
  .success-container { padding: 12px 0 8px; }
  .success-container h2 { font-size: 24px; }
  .invoice-folio { padding: 18px 24px; }
  .folio-number  { font-size: 26px; }

  /* Resend toggle / panel */
  .resend-panel { padding: 16px; border-radius: 12px; }

  /* ── Mobile footer (below card) ─────────────────────────── */
  .mobile-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 20px 28px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    text-align: center;
  }
  .mobile-footer-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-muted);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px 11px;
  }
  .mobile-footer-note {
    font-size: 11px;
    color: var(--ink-light);
    line-height: 1.55;
    margin: 0;
    max-width: 280px;
  }
}

/* ── Extra-small phones (≤ 380px) ─────────────────────────── */
@media (max-width: 380px) {
  .portal-main       { padding: 18px 16px 24px; }
  .mobile-topbar     { padding: 12px 14px; }
  .mobile-topbar-logo { height: 28px; }
  .mobile-topbar-tagline { display: none; }
  .mobile-help-pill  { padding: 8px 11px; font-size: 11px; }
  .mobile-progress   { padding: 16px 16px 4px; }
  .panel-header h2   { font-size: 21px; }
  .choice-card-body  { padding: 14px; }
}

/* ── Tablet transition (720–1024px) ──────────────────────── */
@media (min-width: 721px) and (max-width: 1024px) {
  .portal-shell { padding: 20px 16px; }
  .portal-card { max-width: 100%; min-height: 580px; }
  .portal-aside { width: 240px; padding: 32px 22px 26px; }
  .portal-main { padding: 36px 32px; }
  .brand-block { margin-bottom: 32px; }
  .v-step-content strong { font-size: 13px; }
  .v-step-content span { font-size: 11px; }
}

/* ── Hover states only on devices that truly support hover ── */
@media (hover: none) {
  .btn:hover:not(:disabled) { transform: none !important; }
  .choice-card:hover { border-color: var(--border); background: var(--surface-alt); }
  .help-link:hover { transform: none; }
}

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

/* ── Focus-visible polish ────────────────────────────────── */
.btn:focus-visible,
.input:focus-visible,
.choice-card:focus-within,
.mobile-help-pill:focus-visible,
.help-link:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
