:root {
  --green: #158557;
  --green-dark: #0d6b43;
  --green-soft: #d8f3e4;
  --ink: #10281d;
  --muted: #5a7466;
  --line: #b8ddc9;
  --canvas: #f3fbf6;
  --white: #fff;
  --danger: #b42318;
  --shadow: 0 18px 55px rgba(16, 40, 29, .1);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
a { color: var(--green-dark); }
button, input { font: inherit; }
button, a { transition: background-color .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid rgba(21, 133, 87, .28);
  outline-offset: 3px;
}
.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  padding: 10px 14px; border-radius: 10px; background: #0f172a; color: #fff;
  font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 16px; }
.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(400px, .95fr) minmax(480px, 1.05fr);
}
.auth-layout.single { grid-template-columns: 1fr; }
.auth-story {
  --story-pad-x: clamp(40px, 6vw, 72px);
  --story-pad-y: clamp(40px, 7vh, 72px);
  --story-gap: 32px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--story-gap);
  min-height: 100vh;
  padding: var(--story-pad-y) var(--story-pad-x);
  color: #fff;
  background:
    linear-gradient(160deg, #074a30 0%, #0d6b43 38%, #158557 72%, #1f9a66 100%);
}
.auth-story-aura,
.auth-story-aura::before,
.auth-story-aura::after {
  position: absolute;
  pointer-events: none;
  z-index: 0;
}
.auth-story-aura {
  inset: 0;
}
.auth-story-aura::before {
  content: "";
  width: min(520px, 90vw);
  height: min(520px, 90vw);
  top: -18%;
  right: -22%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.12), transparent 62%);
}
.auth-story-aura::after {
  content: "";
  width: min(360px, 70vw);
  height: min(360px, 70vw);
  left: -18%;
  bottom: -16%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: radial-gradient(circle at 55% 45%, rgba(255, 255, 255, 0.08), transparent 65%);
}
.auth-story-brand,
.auth-story-main,
.auth-story-body,
.auth-story-foot,
.story-quote {
  position: relative;
  z-index: 1;
}
.auth-story-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: auth-story-in 420ms ease-out both;
}
.auth-story-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  animation: auth-story-in 480ms ease-out 80ms both;
}
.portal-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 360px;
  margin: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  text-decoration: none;
  line-height: 0;
  cursor: pointer;
}
.portal-brand img {
  display: block;
  width: min(100%, 320px);
  height: auto;
  max-height: 128px;
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 10px 28px rgba(0, 0, 0, 0.2));
}
.portal-brand-rule {
  display: block;
  width: min(100%, 220px);
  height: 0;
  margin: 0;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.7);
}
.auth-story-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
}
.auth-story-kicker {
  margin: 0 0 16px;
  color: rgba(184, 240, 208, 0.95);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.auth-story h1 {
  margin: 0 0 28px;
  max-width: 14ch;
  font-size: clamp(2.25rem, 4.2vw, 3.5rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.04em;
  color: #ffffff;
  text-wrap: balance;
}
.story-quote {
  margin: 0;
  padding: 0;
  max-width: 32em;
  text-align: center;
}
.story-quote-rule {
  display: block;
  width: 64px;
  height: 0;
  margin: 0 auto 20px;
  border: 0;
  border-top: 2px solid rgba(255, 255, 255, 0.88);
}
.story-quote blockquote {
  margin: 0;
  padding: 0;
  border: 0;
  color: rgba(243, 255, 248, 0.96);
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  font-style: italic;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}
.story-quote figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  margin-top: 16px;
}
.story-quote-label {
  color: rgba(216, 243, 228, 0.9);
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.story-quote-author {
  color: #b8f0d0;
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.auth-story-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: rgba(224, 243, 231, 0.78);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  animation: auth-story-in 520ms ease-out 140ms both;
}
@keyframes auth-story-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .auth-story-brand,
  .auth-story-main,
  .auth-story-foot {
    animation: none;
  }
}
.eyebrow {
  margin: 0 0 9px; color: #b8f0d0; font-size: 12px; font-weight: 700;
  letter-spacing: .13em; text-transform: uppercase;
}
.auth-story p:not(.eyebrow):not(.auth-story-kicker) { color: #e0f3e7; font-size: 18px; line-height: 1.65; }
.auth-workspace {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 48px 24px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(ellipse 62% 48% at 92% 4%, rgba(21, 133, 87, .16), transparent 60%),
    radial-gradient(ellipse 50% 42% at 4% 96%, rgba(13, 107, 67, .12), transparent 58%),
    radial-gradient(ellipse 40% 36% at 70% 70%, rgba(36, 169, 112, .08), transparent 65%),
    linear-gradient(168deg, #f7fcf9 0%, #eef8f2 48%, #e6f4ec 100%);
}
.auth-workspace::before {
  content: "";
  position: absolute;
  inset: -20% auto auto -12%;
  width: min(520px, 70vw);
  height: min(520px, 70vw);
  border-radius: 40%;
  background: linear-gradient(145deg, rgba(255, 255, 255, .55), rgba(216, 243, 228, .35));
  filter: blur(2px);
  opacity: .85;
  z-index: 0;
  pointer-events: none;
  transform: rotate(-18deg);
}
.auth-workspace::after {
  content: "";
  position: absolute;
  right: -8%;
  bottom: -18%;
  width: min(460px, 62vw);
  height: min(460px, 62vw);
  border-radius: 36%;
  background: linear-gradient(160deg, rgba(21, 133, 87, .12), rgba(255, 255, 255, .4));
  filter: blur(1.5px);
  opacity: .7;
  z-index: 0;
  pointer-events: none;
  transform: rotate(12deg);
}
.auth-card {
  position: relative;
  z-index: 1;
  width: min(100%, 470px); padding: 40px;
  border: 1px solid rgba(255, 255, 255, .72); border-radius: 24px;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  box-shadow: 0 22px 60px rgba(16, 40, 29, .12), 0 1px 0 rgba(255, 255, 255, .85) inset;
}
.icon-tile {
  --tile-size: 64px;
  display: inline-grid;
  place-items: center;
  width: var(--tile-size);
  height: var(--tile-size);
  margin: 0 0 22px;
  border-radius: 18px;
  color: var(--green-dark);
  background: linear-gradient(165deg, #eefaf3 0%, var(--green-soft) 55%, #c8ecd9 100%);
  border: 1px solid rgba(21, 133, 87, .16);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .75) inset,
    0 10px 24px rgba(16, 40, 29, .08),
    0 2px 6px rgba(21, 133, 87, .12);
  position: relative;
  overflow: hidden;
}
.icon-tile::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 17px;
  background: radial-gradient(circle at 30% 22%, rgba(255, 255, 255, .72), transparent 55%);
  pointer-events: none;
}
.icon-tile svg {
  position: relative;
  z-index: 1;
  width: 28px;
  height: 28px;
  display: block;
}
@media (prefers-reduced-motion: no-preference) {
  .icon-tile {
    animation: auth-tile-in .42s cubic-bezier(.22, 1, .36, 1) both;
  }
  @keyframes auth-tile-in {
    from { opacity: 0; transform: translateY(8px) scale(.94); }
    to { opacity: 1; transform: none; }
  }
}
.auth-card .eyebrow { color: var(--green); }
.auth-card h2 { margin: 0; font-size: 30px; letter-spacing: -.025em; }
.lead { margin: 12px 0 27px; color: var(--muted); line-height: 1.55; }
.auth-card label { display: block; margin-bottom: 7px; font-size: 14px; font-weight: 700; }
.auth-card input:not([type=hidden]) {
  width: 100%; min-height: 52px; padding: 12px 14px;
  border: 1px solid #aacaba; border-radius: 11px; color: var(--ink); background: #fff;
}
.auth-card input:focus {
  border-color: var(--green); outline: 0; box-shadow: 0 0 0 4px rgba(21, 133, 87, .12);
}
.field { margin-bottom: 18px; }
.field-help { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.field-actions {
  display: flex; align-items: center; justify-content: center; margin: 14px 0 0;
}
.field-actions a { font-weight: 600; text-decoration: none; }
.field-actions a:hover { text-decoration: underline; }
.primary-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; min-height: 48px; padding: 11px 22px; border-radius: 999px;
  border: 1px solid var(--green); color: #fff; background: var(--green);
  box-shadow: 0 9px 22px rgba(21, 133, 87, .22); font-weight: 700;
}
.primary-button:hover { background: var(--green-dark); }
.primary-button:disabled { cursor: wait; opacity: .7; }
.trust-row {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 16px;
  margin-top: 20px; padding-top: 17px;
  border-top: 1px solid #e1eee7; color: var(--muted); font-size: 12px;
  text-align: center;
}
.auth-powered {
  margin: 22px 0 0; color: var(--muted); font-size: 12px; text-align: center; line-height: 1.55;
}
.auth-powered a { font-weight: 700; text-decoration: none; }
.auth-powered a:hover { text-decoration: underline; }
.back-link {
  display: inline-flex; margin: 0 0 18px; font-weight: 600; text-decoration: none;
}
.back-link:hover { text-decoration: underline; }
.auth-alert {
  margin: 0 0 18px; padding: 12px 14px; border-radius: 12px; font-size: 14px; line-height: 1.45;
}
.auth-alert.success { background: #e8f7ee; color: #0d6b43; border: 1px solid #b8ddc9; }
.auth-alert.danger { background: #fef3f2; color: var(--danger); border: 1px solid #fecdca; }
.dev-code {
  margin: 0 0 18px; padding: 12px 14px; border-radius: 12px;
  background: #fff8e6; border: 1px solid #f5d78e; color: #7a5a00; font-size: 14px;
}
.otp-input { letter-spacing: .35em; font-weight: 700; text-align: center; }
@media (max-width: 900px) {
  .auth-layout {
    position: relative;
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    min-height: 100vh;
    min-height: 100dvh;
    background:
      linear-gradient(160deg, #074a30 0%, #0d6b43 38%, #158557 72%, #1f9a66 100%);
    overflow-x: hidden;
  }
  .auth-story {
    display: contents;
  }
  .auth-story-aura {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
  }
  .auth-story-aura::before {
    width: min(380px, 95vw);
    height: min(380px, 95vw);
    top: -18%;
    right: -34%;
  }
  .auth-story-aura::after {
    width: min(280px, 78vw);
    height: min(280px, 78vw);
    left: -32%;
    bottom: 8%;
  }
  .auth-story-brand,
  .auth-story-main,
  .auth-story-body,
  .story-quote,
  .auth-story-foot,
  .auth-workspace,
  .auth-card {
    position: relative;
    z-index: 1;
  }
  .auth-story-brand {
    order: 1;
    gap: 10px;
    padding:
      max(22px, env(safe-area-inset-top))
      24px
      0;
    animation: auth-story-in 360ms ease-out both;
  }
  .portal-brand {
    max-width: 200px;
  }
  .portal-brand img {
    width: min(100%, 188px);
    max-height: 72px;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.22));
  }
  .portal-brand-rule {
    width: 96px;
    border-top-color: rgba(255, 255, 255, 0.65);
  }
  .auth-story-main {
    display: contents;
  }
  .auth-story-body {
    order: 2;
    padding: 12px 24px 0;
    animation: auth-story-in 400ms ease-out 40ms both;
  }
  .auth-story-kicker {
    margin: 0;
    font-size: 11px;
    letter-spacing: 0.16em;
  }
  .auth-story h1 {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .auth-workspace {
    order: 3;
    align-items: stretch;
    justify-content: flex-start;
    min-height: auto;
    margin: 0;
    padding: 18px 16px 8px;
    background: transparent;
    overflow: visible;
  }
  .auth-workspace::before,
  .auth-workspace::after {
    display: none;
  }
  .auth-card {
    width: 100%;
    max-width: 470px;
    margin: 0 auto;
    padding: 24px 20px 22px;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.82);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    box-shadow:
      0 24px 56px rgba(7, 40, 26, 0.28),
      0 1px 0 rgba(255, 255, 255, 0.95) inset;
    animation: auth-story-in 440ms ease-out 80ms both;
  }
  .icon-tile {
    --tile-size: 52px;
    margin-bottom: 14px;
    border-radius: 15px;
  }
  .icon-tile::before { border-radius: 14px; }
  .icon-tile svg { width: 22px; height: 22px; }
  .auth-card .eyebrow { margin-bottom: 6px; }
  .auth-card h2 {
    margin: 0;
    font-size: 24px;
    letter-spacing: -0.03em;
  }
  .lead {
    margin: 8px 0 18px;
    font-size: 14px;
    line-height: 1.5;
  }
  .field { margin-bottom: 14px; }
  .auth-card input:not([type=hidden]) {
    min-height: 48px;
    border-radius: 12px;
  }
  .field-actions { margin: 12px 0 0; }
  .primary-button {
    min-height: 48px;
    box-shadow: 0 12px 28px rgba(21, 133, 87, 0.28);
  }
  .trust-row {
    margin-top: 16px;
    padding-top: 14px;
    flex-direction: row;
    justify-content: center;
    gap: 12px 16px;
  }
  .auth-powered { margin-top: 16px; }
  .story-quote {
    order: 4;
    width: 100%;
    max-width: 34em;
    margin: 0 auto;
    padding: 8px 28px 4px;
    text-align: center;
    animation: auth-story-in 480ms ease-out 120ms both;
  }
  .story-quote-rule {
    width: 40px;
    margin: 0 auto 12px;
    border-top-width: 1.5px;
    border-top-color: rgba(255, 255, 255, 0.55);
  }
  .story-quote blockquote {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    color: rgba(243, 255, 248, 0.92);
    font-size: 0.9rem;
    line-height: 1.5;
  }
  .story-quote figcaption {
    margin-top: 10px;
    gap: 6px 10px;
  }
  .story-quote-label { display: none; }
  .story-quote-author {
    font-size: 11px;
    letter-spacing: 0.08em;
  }
  .auth-story-foot {
    order: 5;
    padding: 10px 24px max(22px, env(safe-area-inset-bottom));
    color: rgba(224, 243, 231, 0.72);
    font-size: 11px;
    animation: auth-story-in 500ms ease-out 140ms both;
  }
}
@media (max-width: 420px) {
  .auth-story-brand,
  .auth-story-body {
    padding-left: 20px;
    padding-right: 20px;
  }
  .auth-workspace { padding-left: 12px; padding-right: 12px; }
  .auth-card { padding: 22px 16px 20px; border-radius: 20px; }
  .story-quote { padding-left: 20px; padding-right: 20px; }
  .trust-row {
    flex-direction: column;
    gap: 6px;
  }
}
@media (max-width: 900px) and (prefers-reduced-motion: reduce) {
  .auth-card,
  .story-quote {
    animation: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}
