/* Shared auth styles v3 — single centred column with brand-driven background */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --brand-colour: #1d8fbd;
  --brand-colour-dark: #0d5275;
  --brand-colour-darker: #07314a;
  --glass-bg: rgba(255, 255, 255, 0.10);
  --glass-bg-hover: rgba(255, 255, 255, 0.16);
  --glass-border: rgba(255, 255, 255, 0.22);
  --glass-border-strong: rgba(255, 255, 255, 0.40);
  --text-on-glass: #ffffff;
  --text-on-glass-muted: rgba(255, 255, 255, 0.72);
  --text-on-glass-faint: rgba(255, 255, 255, 0.45);
}

html {
  background: var(--brand-colour-dark);
  overscroll-behavior: none;
}
html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-on-glass);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.10);
  background:
    radial-gradient(circle at 18% 20%, color-mix(in srgb, var(--brand-colour) 90%, white) 0%, transparent 55%),
    radial-gradient(circle at 82% 80%, var(--brand-colour-darker) 0%, transparent 55%),
    linear-gradient(135deg, var(--brand-colour-darker) 0%, var(--brand-colour-dark) 45%, var(--brand-colour) 100%);
}

/* Decorative blobs in the background */
.bg-shapes {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.bg-shapes svg { width: 100%; height: 100%; }

/* Single centred column shell */
.auth-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  padding: 40px 24px;
}

/* TOP — brand mark + welcome */
.auth-top {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 460px;
}
.auth-top .brand-mark {
  width: 64px;
  height: 64px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 16px 40px -12px rgba(0,0,0,0.45);
  overflow: hidden;
}
.auth-top .brand-mark svg { width: 32px; height: 32px; fill: var(--brand-colour); }

/* When the business has a wordmark logo, drop the white tile and let it breathe */
.auth-top.has-logo .brand-mark {
  background: transparent;
  width: auto;
  height: auto;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}
.auth-top.has-logo .brand-mark img {
  display: block;
  height: 80px;
  width: auto;
  max-width: 320px;
  filter: brightness(0) invert(1) drop-shadow(0 10px 24px rgba(0,0,0,0.35));
}

.auth-top h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: #ffffff;
}
.auth-top p {
  font-size: 15px;
  color: var(--text-on-glass-muted);
  line-height: 1.5;
  max-width: 420px;
}

/* MIDDLE — form card */
.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  align-self: center;
  padding: 30px 30px;
  background: var(--glass-bg);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  box-shadow:
    0 30px 80px -20px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.auth-card.wide { max-width: 480px; }

h1.auth-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
p.auth-subtitle {
  color: var(--text-on-glass-muted);
  font-size: 14px;
  margin-bottom: 22px;
  line-height: 1.5;
}

/* BOTTOM — support footer */
.auth-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.auth-bottom .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-on-glass-faint);
}
.auth-bottom .pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.auth-bottom .pill {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 10px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s, border-color 0.15s;
}
.auth-bottom .pill:hover { background: var(--glass-bg-hover); border-color: var(--glass-border-strong); }
.auth-bottom .pill svg { width: 14px; height: 14px; fill: rgba(255,255,255,0.7); flex-shrink: 0; }
.auth-bottom .pill a { color: var(--text-on-glass); text-decoration: none; font-size: 13px; }

/* Form fields */
.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-on-glass-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.field input {
  width: 100%;
  padding: 13px 16px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text-on-glass);
  outline: none;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.field input::placeholder { color: var(--text-on-glass-faint); }
.field input:hover { background: var(--glass-bg-hover); }
.field input:focus {
  border-color: var(--glass-border-strong);
  background: var(--glass-bg-hover);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-on-glass);
  transition: background-color 5000s ease-in-out 0s;
  -webkit-box-shadow: 0 0 0 1000px var(--glass-bg-hover) inset;
}

/* Buttons */
.btn-primary {
  width: 100%;
  padding: 14px 16px;
  background: #ffffff;
  color: var(--brand-colour-dark);
  border: none;
  border-radius: 12px;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, opacity 0.15s;
  margin-top: 6px;
  letter-spacing: 0.01em;
}
.btn-primary:hover { box-shadow: 0 10px 28px -10px rgba(0,0,0,0.45); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
  width: 100%;
  padding: 13px 16px;
  background: transparent;
  color: var(--text-on-glass);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-ghost:hover { background: var(--glass-bg-hover); border-color: var(--glass-border-strong); }
.btn-ghost:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-link {
  color: var(--text-on-glass-muted);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.15s;
}
.auth-link:hover { color: var(--text-on-glass); }
.auth-link.primary { color: var(--text-on-glass); font-weight: 500; }

.footer-row { margin-top: 18px; text-align: center; }
.footer-row.split { display: flex; justify-content: space-between; align-items: center; }

/* Identity chip */
.identity-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-on-glass-muted);
  margin-bottom: 16px;
}
.identity-chip button {
  background: none; border: none;
  color: var(--text-on-glass);
  font-size: 12px; cursor: pointer;
  padding: 4px 8px; border-radius: 6px;
  transition: background 0.15s; font-family: inherit;
}
.identity-chip button:hover { background: var(--glass-bg-hover); }

/* Messages */
.msg { display: none; padding: 11px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 14px; text-align: center; line-height: 1.45; }
.msg.show { display: block; }
.msg.error { background: rgba(255, 80, 80, 0.18); color: #ffe0e0; border: 1px solid rgba(255, 80, 80, 0.35); }
.msg.info { background: rgba(80, 230, 160, 0.16); color: #d8ffec; border: 1px solid rgba(80, 230, 160, 0.30); }

.step { display: none; }
.step.active { display: block; animation: fade-up 0.25s ease-out; }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.strength-meter { height: 3px; background: rgba(255,255,255,0.12); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.strength-meter-fill { height: 100%; width: 0%; background: var(--brand-colour); transition: width 0.2s, background 0.2s; }

.field-error {
  font-size: 12px;
  color: #ff8a8a;
  margin-top: 5px;
  display: none;
  line-height: 1.4;
}
.field-error.show { display: block; }
.field input.invalid { border-color: rgba(255, 138, 138, 0.55); }

.strength-text { font-size: 12px; color: var(--text-on-glass-faint); margin-top: 4px; min-height: 0; }

.code-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  font-size: 26px;
  letter-spacing: 12px;
  text-align: center;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  color: var(--text-on-glass);
  outline: none;
}
.code-input:focus { border-color: var(--glass-border-strong); background: var(--glass-bg-hover); }


.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.field-row .field { margin-bottom: 0; }
@media (max-width: 480px) {
  .field-row { grid-template-columns: 1fr; gap: 0; margin-bottom: 0; }
  .field-row .field { margin-bottom: 12px; }
}

.role-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-on-glass);
  margin: 16px 0 6px;
  letter-spacing: 0.01em;
}
.role-card {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  cursor: pointer;
  margin-bottom: 6px;
  transition: background 0.15s, border-color 0.15s;
}
.role-card:hover { background: var(--glass-bg-hover); border-color: var(--glass-border-strong); }
.role-card.selected { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.55); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.10); }
.role-card input[type="radio"] { margin: 0; flex-shrink: 0; accent-color: #ffffff; }
.role-card .label { font-size: 14px; font-weight: 500; flex: 1; cursor: pointer; }

.method-card { border: 1px solid var(--glass-border); background: var(--glass-bg); border-radius: 14px; padding: 18px; margin-bottom: 12px; transition: background 0.15s, border-color 0.15s; }
.method-card.recommended { border-color: rgba(255, 255, 255, 0.45); background: rgba(255, 255, 255, 0.16); }
.method-card .method-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.method-card .method-icon { width: 38px; height: 38px; border-radius: 10px; background: rgba(255, 255, 255, 0.15); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.method-card .method-icon svg { width: 20px; height: 20px; fill: var(--text-on-glass); }
.method-card.recommended .method-icon { background: #ffffff; }
.method-card.recommended .method-icon svg { fill: var(--brand-colour); }
.method-card .method-title { font-size: 15px; font-weight: 600; }
.method-card .method-badge { display:inline-block; background:#ffffff; color:var(--brand-colour-dark); font-size:10.5px; font-weight:600; padding:3px 8px; border-radius:8px; margin-left:8px; vertical-align:middle; text-transform:uppercase; letter-spacing:0.04em; }
.method-card .method-desc { font-size: 13px; color: var(--text-on-glass-muted); line-height: 1.5; margin-bottom: 12px; }
.method-card .enrolled-tick { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: rgba(80, 230, 160, 0.16); color: #d8ffec; border-radius: 8px; font-size: 13px; margin-bottom: 8px; }

.info-box { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 10px; padding: 11px 14px; margin-bottom: 14px; font-size: 13px; color: var(--text-on-glass-muted); line-height: 1.5; }
.info-box strong { color: var(--text-on-glass); }

/* Secondary CTA inside the form card. Sits below the primary button with
   a subtle top divider, making it part of the card rather than floating
   below it. */
.card-cta {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-on-glass-muted);
}
.card-cta a {
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.4);
  padding-bottom: 1px;
  transition: border-color 0.15s;
}
.card-cta a:hover { border-bottom-color: #ffffff; }

/* In-card brand area — used now that the logo lives inside the card. */
.card-brand {
  text-align: center;
  margin-bottom: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.card-brand .brand-mark {
  width: 56px;
  height: 56px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 28px -10px rgba(0,0,0,0.40);
  overflow: hidden;
}
.card-brand .brand-mark svg { width: 28px; height: 28px; fill: var(--brand-colour); }

/* Wordmark logo: drop the white tile, let it breathe */
.card-brand.has-logo .brand-mark {
  background: transparent;
  width: auto;
  height: auto;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}
.card-brand.has-logo .brand-mark img {
  display: block;
  height: 64px;
  width: auto;
  max-width: 280px;
  filter: brightness(0) invert(1) drop-shadow(0 8px 18px rgba(0,0,0,0.30));
}
.card-brand.has-logo.brand-ye .brand-mark img {
  transform: scale(1.22);
  transform-origin: center;
}
.auth-card .auth-title {
  text-align: center;
  font-size: 24px;
}
.auth-card .auth-subtitle {
  text-align: center;
  margin-bottom: 24px;
}

/* Tablet — slightly tighter shell padding */
@media (max-width: 768px) {
  .auth-shell { padding: 32px 20px; }
}

/* Mobile (≤480px) — narrow phones */
@media (max-width: 480px) {
  .auth-shell { padding: 24px 16px; }
  .auth-card { padding: 26px 22px; border-radius: 18px; }
  .auth-card .auth-title { font-size: 22px; }
  .auth-card .auth-subtitle { font-size: 13px; margin-bottom: 20px; }
  .auth-top h1 { font-size: 26px; }
  .auth-top.has-logo .brand-mark img { height: 56px; }
  .card-brand.has-logo .brand-mark img { height: 56px; }
  .card-brand.has-logo.brand-ye .brand-mark img { height: 60px; transform: none; }
  /* Touch targets: bump role cards to ≥44px tall */
  .role-card { padding: 13px 14px; }
  /* Submit button has more breathing room above */
  .btn-primary { padding: 15px 16px; }
  /* Tighter CTA divider */
  .card-cta { margin-top: 20px; padding-top: 16px; font-size: 13px; }
}

/* Very small phones (≤360px, iPhone SE etc.) */
@media (max-width: 360px) {
  .auth-shell { padding: 16px 12px; }
  .auth-card { padding: 22px 18px; border-radius: 16px; }
  .auth-card .auth-title { font-size: 20px; }
  .auth-top.has-logo .brand-mark img { height: 48px; }
  .card-brand.has-logo .brand-mark img { height: 48px; }
  .card-brand.has-logo.brand-ye .brand-mark img { height: 52px; }
  .role-card { padding: 12px 12px; font-size: 13px; }
  .role-card .label { font-size: 13px; }
}

/* Landscape on short phones — let content scroll naturally, drop excessive padding */
@media (max-height: 600px) and (orientation: landscape) {
  .auth-shell { padding: 16px 16px; }
  .auth-card { padding: 22px 26px; }
  .card-brand { margin-bottom: 12px; }
  .card-brand.has-logo .brand-mark img { height: 44px; }
}

/* Reduce motion — respect user preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
