/* Auth & onboarding shell — split layout with the "Onboarding / Brand panel" (Figma 284:1008).
   Desktop: white rounded page on the app background, form column left, photo panel right (640px at 1440).
   Mobile (≤899, Figma 345:2557): full-bleed white page, top bar with the logo, no brand panel. */

body.auth-body { min-height: 100dvh; padding: 12px; }
.auth [hidden] { display: none !important; }

.auth {
  display: flex;
  height: calc(100dvh - 24px);
  padding: 12px;
  background: var(--vm-surface-page);
  border-radius: var(--vm-radius-2xl);
  box-shadow: var(--vm-shadow-control);
  overflow: hidden;
}

/* ---------- Form column ---------- */
.auth-main {
  position: relative;
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  padding: 20px 36px;
  overflow-y: auto; overflow-x: hidden;
  view-transition-name: auth-main;
}
.auth-top { display: flex; align-items: center; justify-content: space-between; height: 40px; flex-shrink: 0; }
.auth-top .logo { padding-left: 0; }
.auth-center { flex: 1 0 auto; display: flex; align-items: center; justify-content: center; padding: 32px 0; }
.auth-form { width: 400px; max-width: 100%; display: flex; flex-direction: column; gap: 24px; }
.auth-foot { flex-shrink: 0; min-height: 16px; display: flex; justify-content: center; align-items: center; gap: 6px; font-size: 14px; color: var(--vm-text-secondary); }
.auth-foot .link { padding-top: 2px; }

/* Heading block */
.auth-head { display: flex; flex-direction: column; gap: 16px; }
.auth-titles { display: flex; flex-direction: column; gap: 4px; }
.auth-title { font-size: 26px; font-weight: 600; letter-spacing: -0.52px; line-height: normal; }
.auth-sub { font-size: 14px; color: var(--vm-text-secondary); line-height: normal; }
.auth-sub b { font-weight: 500; color: var(--vm-text-primary); }
.step-icon {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--vm-radius-md);
  background: var(--vm-surface-card); color: var(--vm-text-primary);
}
.step-icon .ic { --s: 22px; }
.auth-caption { font-size: 12px; color: var(--vm-text-tertiary); line-height: normal; }
.auth-caption .link { font-size: 12px; }
.auth-caption.is-live { animation: auth-msg-in 260ms var(--ease-out) both; }
.auth-group { display: flex; flex-direction: column; gap: 16px; }
.auth-stack { display: flex; flex-direction: column; gap: 10px; }
.auth-actions { display: flex; align-items: center; gap: 8px; }
.auth-actions .grow { flex: 1; min-width: 0; }
.auth-center-link { display: flex; justify-content: center; }
.auth-center-link .link { padding-top: 2px; }

/* "or" separator */
.or { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--vm-text-tertiary); }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--vm-border-default); }

/* ---------- Buttons in auth screens ---------- */
.auth .btn { border-radius: var(--vm-radius-md); }
.btn .btn-label { display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: opacity var(--dur-2) ease, transform var(--dur-3) var(--ease-out); }
.btn.is-busy { pointer-events: none; }
.btn.is-busy .spinner { width: 15px; height: 15px; border-width: 1.75px; }
.btn.is-done { pointer-events: none; }
.btn .ok-check { width: 16px; height: 16px; }
.btn .ok-check path { stroke-dasharray: 16; stroke-dashoffset: 16; animation: vm-draw 380ms var(--ease-out) 60ms forwards; }
.btn-label.swap-in { animation: auth-label-in 260ms var(--ease-out) both; }
@keyframes auth-label-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.btn.is-dimmed { opacity: 0.4; pointer-events: none; }

/* ---------- Fields ---------- */
.auth .input { height: 42px; padding: 0 14px; border-radius: var(--vm-radius-md); }
.auth .vm-select { padding-right: 12px; }
.auth .label { line-height: normal; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.label-row .link { padding-top: 2px; }
.field-row { display: flex; gap: 12px; }
.field-row > .field { flex: 1; min-width: 0; }
.field-msg { display: none; font-size: 12px; line-height: 1.4; color: var(--vm-text-danger); margin-top: -2px; }
.field.has-error .field-msg { display: block; animation: auth-msg-in 240ms var(--ease-out) both; }
.field.has-error .input, .field.has-error .input-group { border-color: var(--vm-text-danger); background-color: var(--vm-surface-page); }
.field .hint { line-height: normal; color: var(--vm-text-tertiary); transition: color var(--dur-2) ease; display: flex; align-items: center; gap: 6px; }
.field .hint.is-ok { color: var(--vm-text-positive); }
.field .hint .ic { --s: 12px; }
@keyframes auth-msg-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.is-shaking { animation: auth-shake 360ms var(--ease-out); }
@keyframes auth-shake { 20% { transform: translateX(-5px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

/* Input with trailing button (show password) */
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 44px; }
.input-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  color: var(--vm-text-secondary); transition: background-color var(--dur-2) ease, color var(--dur-2) ease;
}
.input-btn:hover { color: var(--vm-text-primary); background: rgba(26, 25, 23, 0.05); }
.input-btn .ic { --s: 16px; }
.input-btn .ic.swap { animation: auth-eye 260ms var(--ease-out); }
@keyframes auth-eye { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: none; } }

/* Phone: country code + number in one control */
.input-group {
  display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 12px 0 0;
  background: var(--vm-surface-card); border: 1px solid transparent; border-radius: var(--vm-radius-md);
  transition: border-color var(--dur-2) ease, background-color var(--dur-2) ease, box-shadow var(--dur-2) ease;
}
.input-group:hover { background-color: #efeeeb; }
.input-group:focus-within, .input-group:has(.vm-select.is-active) { background-color: var(--vm-surface-page); border-color: var(--vm-text-primary); box-shadow: 0 0 0 3px rgba(26, 25, 23, 0.06); }
/* Country code: flag + dial code + chevron, opens the same dropdown as the other selects */
.input-group .code-select {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  height: 100%; padding: 0 4px 0 12px; border: 0; background: transparent; font-size: 14px; font-weight: 500;
  cursor: pointer; outline: none; border-radius: var(--vm-radius-md) 0 0 var(--vm-radius-md);
}
.input-group .code-select .vs-value { gap: 8px; }
.input-group .code-select .vs-flag { width: 16px; height: 16px; }
.input-group .code-select:focus-visible .vs-text { text-decoration: underline; text-underline-offset: 3px; }
.input-group .sep { width: 1px; height: 18px; background: var(--vm-border-default); flex-shrink: 0; }
.input-group input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; outline: none; font-size: 14px; }
.input-group input::placeholder { color: var(--vm-text-tertiary); }

/* Locked (prefilled from BankID) */
.input[readonly] { color: var(--vm-text-secondary); cursor: default; }
.input[readonly]:hover { background: var(--vm-surface-card); }
.input[readonly]:focus { background: var(--vm-surface-card); border-color: transparent; box-shadow: none; }
.from-eid { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; color: var(--vm-text-positive); }
.from-eid .ic { --s: 12px; }

/* Checkbox rows */
.check-row { display: flex; align-items: flex-start; gap: 12px; font-size: 14px; line-height: 20px; cursor: pointer; user-select: none; }
.check-row .check { width: 20px; height: 20px; border-radius: var(--vm-radius-xs); }
.check-row:hover .check:not(.is-on) { border-color: #c9cace; }
.check-row input:focus-visible + .check { outline: 2px solid var(--vm-accent-primary); outline-offset: 2px; }
.check-row a { text-decoration: underline; text-decoration-color: rgba(26, 25, 23, 0.3); text-underline-offset: 2px; transition: text-decoration-color var(--dur-2) ease; }
.check-row a:hover { text-decoration-color: currentColor; }
.check-row.has-error .check { border-color: var(--vm-text-danger); }
.checks { display: flex; flex-direction: column; gap: 12px; }
.checks.has-error .field-msg { display: block; animation: auth-msg-in 240ms var(--ease-out) both; }
.check-row.has-error .check { animation: auth-shake 360ms var(--ease-out); }

/* Choice cards with 20px radios (Figma "Radio" 20px, 6px ring when on) */
.auth .choice .radio { width: 20px; height: 20px; }
.auth .choice .radio::after { width: 8px; height: 8px; }
.auth .choice { padding: 16px; }

/* ---------- Brand panel (Figma 284:1008, in the website-hero "daylight grid" treatment) ----------
   The photo panel on every sign-in / onboarding screen. Copy at the top on the sky, thin white grid strokes that
   draw in (the text starts on the left vertical and hangs from its own horizontal stroke — auth.js places the
   strokes from the real cap heights), and the building proof at the bottom: round building faces + "+27" + two
   lines, rising in a wave and floating gently, as on vestmark-website.vercel.app. */
.brand {
  --pad: 40px;
  --draw: cubic-bezier(0.45, 0.05, 0.2, 1);
  position: relative; isolation: isolate;
  width: clamp(380px, 44.5vw, 640px); flex-shrink: 0;
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  padding: var(--pad); border-radius: var(--vm-radius-xl); overflow: hidden;
  color: var(--vm-text-on-inverse); background: #59626b;
  container-type: inline-size;
  view-transition-name: brand;
}
.brand-photo { position: absolute; inset: 0; z-index: -1; }
.brand-photo img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transform: scale(1.04);
  transition: opacity 800ms ease, transform 1600ms var(--ease-out);
}
.brand-photo img.is-on { opacity: 1; transform: none; }
/* light scrims: the sky behind the copy at the top, and the photo behind the proof at the bottom */
.brand-photo::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 18, 33, 0.3) 0%, rgba(8, 18, 33, 0) 34%),
    linear-gradient(180deg, rgba(8, 18, 33, 0) 60%, rgba(8, 18, 33, 0.22) 80%, rgba(8, 18, 33, 0.56) 100%);
}

/* photos with a pale sky (tone "light", set by auth.js) get a soft dark wash behind the copy, like the darker top of
   the website's sky — it fades with the photo, so previewing that building from another screen gets it too */
.brand-shade {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(8, 18, 33, 0.52) 0%, rgba(8, 18, 33, 0.36) 26%, rgba(8, 18, 33, 0.12) 42%, rgba(8, 18, 33, 0) 56%);
  opacity: 0; transition: opacity 800ms ease;
}
.brand[data-tone="light"] .brand-shade { opacity: 1; }
.brand[data-tone="light"] .brand-copy { text-shadow: 0 1px 14px rgba(8, 18, 33, 0.24); }

/* strokes: white at 20%, fading out at their ends (horizontals run edge to edge, verticals fade downwards) */
.brand-grid { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.brand-grid i { position: absolute; display: block; }
.bg-h {
  left: 0; right: 0; top: 0; height: 1px;
  background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.2) 6%, rgba(255, 255, 255, 0.2) 94%, rgba(255, 255, 255, 0));
  transform-origin: left; animation: bg-draw-x 2.6s var(--draw) calc(var(--li, 0) * 0.14s) both;
}
.bg-v {
  top: 0; left: var(--pad); width: 1px; height: 74%;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2) 55%, rgba(255, 255, 255, 0));
  transform-origin: top; animation: bg-draw-y 2.6s var(--draw) calc(var(--li, 0) * 0.14s) both;
}
.bg-v.is-right { left: auto; right: var(--pad); }
@keyframes bg-draw-x { from { transform: scaleX(0); } }
@keyframes bg-draw-y { from { transform: scaleY(0); } }

/* copy at the top — a little lower than the panel padding so it reads centred in the sky above the building;
   scales with the window height (≈36px at 900px), the strokes follow the text */
.brand-copy { position: relative; display: flex; flex-direction: column; gap: 24px; margin-top: clamp(20px, 4vh, 48px); }
.brand-copy.is-out { animation: brand-out 260ms ease forwards; }
.brand-copy.is-in { animation: vm-rise 520ms var(--ease-out) both; }
@keyframes brand-out { to { opacity: 0; transform: translateY(-6px); } }
.brand-title { max-width: 560px; font-size: clamp(30px, 7.4cqi, 50px); font-weight: 600; line-height: 1.02; letter-spacing: -0.04em; }
.brand-body {
  max-width: 400px; font-size: 16px; font-weight: 500; line-height: 1.4; letter-spacing: -0.01em; opacity: 0.9;
  animation: bt-rise 1s var(--ease-out) 0.7s both;
}
/* headline: each word rises out of its own mask, slightly tilted, one after another */
.brand-title .hw { display: inline-block; overflow: hidden; vertical-align: top; padding: 0.14em 0 0.12em; margin: -0.14em 0 -0.12em; }
.brand-title .hw > span { display: inline-block; transform-origin: 0 100%; animation: bt-word 1.3s var(--ease-out) both; animation-delay: calc(0.1s + var(--i) * 75ms); }
@keyframes bt-word { from { transform: translateY(115%) rotate(6deg); } }
@keyframes bt-rise { from { opacity: 0; transform: translateY(16px); } }

/* proof at the bottom */
.brand-proof { position: relative; display: flex; align-items: center; gap: 18px; }
.brand-faces { display: flex; flex-shrink: 0; }
.brand-face {
  position: relative; width: 48px; height: 48px; margin-left: -12px; flex: none;
  border-radius: 50%; border: 1px solid var(--vm-text-on-inverse); overflow: hidden; padding: 0;
  animation: bf-in 1.3s cubic-bezier(0.25, 1.25, 0.45, 1) calc(0.55s + var(--i) * 80ms) both, bf-float 3.6s ease-in-out calc(var(--i) * -0.7s) infinite;
  transition: box-shadow var(--dur-2) ease;
}
.brand-face:first-child { margin-left: 0; }
.brand-face img { width: 100%; height: 100%; object-fit: cover; }
.brand-face.is-more {
  display: grid; place-items: center; background: var(--vm-surface-page); border-color: var(--vm-surface-page);
  color: var(--vm-text-primary); font-size: 15px; font-weight: 500; letter-spacing: -0.01em;
}
/* hover / focus lifts the face above its neighbours and previews that building in the big photo */
button.brand-face:hover, button.brand-face:focus-visible, button.brand-face.is-peek { z-index: 1; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 10px 22px -8px rgba(0, 0, 0, 0.55); }
button.brand-face:focus-visible { outline: none; }
@keyframes bf-in { from { transform: translateY(160px); } }
@keyframes bf-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }
.brand-proof-text { display: grid; gap: 2px; min-width: 0; animation: bt-rise 0.9s var(--ease-out) 1.1s both; }
.brand-proof-title { font-size: 16px; font-weight: 500; line-height: 1.35; letter-spacing: -0.005em; }
.brand-proof-sub { font-size: 13px; line-height: 1.4; color: rgba(255, 255, 255, 0.82); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-proof-sub.is-swap { animation: bt-swap 320ms var(--ease-out); }
@keyframes bt-swap { from { opacity: 0; transform: translateY(4px); } }
@media (max-width: 1100px) { .brand { --pad: 32px; } }
@media (prefers-reduced-motion: reduce) {
  .bg-h, .bg-v, .brand-title .hw > span, .brand-body, .brand-face, .brand-proof-text { animation: none; }
}

/* ---------- Page transitions between auth screens (cross-document View Transitions) ---------- */
/* The form column fades (its children rise in via [data-reveal]); the photo panel crossfades. */
::view-transition-old(auth-main) { animation: vm-vt-out 160ms ease both; }
::view-transition-new(auth-main) { animation: vm-fade 240ms ease both; }
::view-transition-group(auth-main) { animation: none; }
::view-transition-old(brand) { animation: vm-vt-out 560ms ease both; }
::view-transition-new(brand) { animation: vm-fade 560ms ease both; }

/* ---------- Small dialogs (Forgot password …) ---------- */
.auth-modal-body { display: flex; flex-direction: column; gap: 20px; padding: 24px; }
.auth-modal-head { display: flex; align-items: flex-start; justify-content: space-between; }
.auth-modal .input { height: 42px; border-radius: var(--vm-radius-md); padding: 0 14px; }
.auth-modal-done { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 12px 0 0; text-align: center; }
.legal-list { display: flex; flex-direction: column; gap: 10px; font-size: 14px; line-height: 1.45; color: var(--vm-text-secondary); }
.legal-list li { display: flex; gap: 10px; }
.legal-list .ic { margin-top: 4px; color: var(--vm-text-positive); }
.u-link { text-decoration: underline; text-decoration-color: rgba(96, 99, 106, 0.4); text-underline-offset: 2px; transition: color var(--dur-2) ease, text-decoration-color var(--dur-2) ease; }
.u-link:hover { color: var(--vm-text-primary); text-decoration-color: currentColor; }

/* ---------- Simulated phone/email notification (demo helper) ---------- */
.notif {
  position: fixed; z-index: 90; top: 24px; right: 24px; width: min(360px, calc(100vw - 24px));
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 12px 12px 12px;
  background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-radius: 18px; box-shadow: var(--vm-shadow-pop); border: 1px solid rgba(26, 23, 18, 0.05);
  text-align: left; cursor: pointer;
  animation: notif-in 560ms var(--ease-spring) both;
  transition: transform var(--dur-3) var(--ease-out), box-shadow var(--dur-3) ease;
}
.notif:hover { transform: translateY(2px); box-shadow: 0 2px 4px rgba(26, 23, 18, 0.05), 0 10px 24px -8px rgba(26, 23, 18, 0.14), 0 20px 40px -18px rgba(26, 23, 18, 0.18); }
.notif.is-closing { animation: notif-out 280ms ease forwards; }
@keyframes notif-in { from { opacity: 0; transform: translateY(-24px) scale(0.96); } }
@keyframes notif-out { to { opacity: 0; transform: translateY(-16px) scale(0.97); } }
.notif-app { width: 36px; height: 36px; border-radius: 10px; background: var(--vm-surface-inverse); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.notif-app .ic { --s: 20px; }
.notif-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--vm-text-tertiary); }
.notif-meta b { font-weight: 500; color: var(--vm-text-secondary); }
.notif-title { font-size: 14px; font-weight: 500; }
.notif-body { font-size: 12px; color: var(--vm-text-secondary); }
.notif-cta { align-self: center; flex-shrink: 0; }

/* ---------- Mobile (Figma "Mobile — Log in" 345:2557) ---------- */
@media (max-width: 1100px) {
  .auth-main { padding: 20px 28px; }
  .brand { padding: 32px; }
}
@media (max-width: 899px) {
  body.auth-body { background: var(--vm-surface-page); padding: 0; }
  .auth { display: block; height: auto; min-height: 100dvh; margin: 0; padding: 0; border-radius: 0; box-shadow: none; overflow: visible; }
  .auth-main { min-height: 100dvh; padding: 0; overflow: visible; }
  .auth-top {
    position: sticky; top: 0; z-index: 20; height: var(--topbar-h); padding: 0 20px;
    background: rgba(255, 255, 255, 0.88); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
    border-bottom: 1px solid var(--vm-border-default);
  }
  .auth-center { padding: 24px 20px; }
  .auth-form { width: 100%; }
  .auth-foot { padding: 0 20px calc(24px + env(safe-area-inset-bottom)); min-height: 0; }
  .auth-foot:empty { display: none; }
  .brand { display: none; }
  .auth .btn { height: 48px; }
  .auth .btn.btn-sm { height: 36px; }
  .auth .input, .input-group { height: 44px; }
  .auth .input { font-size: 16px; }
  .input-group input, .input-group .code-select { font-size: 16px; }
  .notif { top: 12px; right: 12px; left: 12px; width: auto; }
}
@media (max-width: 420px) {
  .field-row.wrap-sm { flex-direction: column; gap: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .brand-photo img { transition: opacity 1ms; transform: none; }
}
