:root {
    --primary:       #FF2E6F;
    --primary-2:     #FF1E5A;
    --primary-deep:  #C4144A;
    --primary-tint:  #FFF1F5;
    --primary-line:  #FFD3E0;
    --white:         #FFFFFF;
    --ink:           #2B0E1C;
    --ink-soft:      #6E4A56;
    --muted:         #9C7E88;
    --danger:        #C6284D;
    --danger-bg:     #FDE9EE;
    --success-bg:    #E9F8F0;
    --success-text:  #128A55;
    --font-display:  'Baloo 2', 'Inter', sans-serif;
    --font-body:     'Inter', sans-serif;
    --radius-card:   28px;
    --radius-field:  14px;
  }

  * { box-sizing: border-box; }

  html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: var(--font-body);
    color: var(--ink);
  }

  body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
    overflow-x: hidden;
    background: radial-gradient(120% 140% at 15% -10%, #FF5C8A 0%, var(--primary) 42%, var(--primary-2) 78%, #E0104C 100%);
  }

  /* ---- soft decorative blobs, echoing the swash under the ServeUp wordmark ---- */
  body::before, body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    background: rgba(255,255,255,0.10);
    filter: blur(2px);
    pointer-events: none;
    z-index: 0;
  }
  body::before { width: 420px; height: 420px; top: -160px; right: -140px; }
  body::after  { width: 320px; height: 320px; bottom: -140px; left: -120px; background: rgba(255,255,255,0.08); }

  .curve-decor {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.5;
  }

  :focus-visible {
    outline: 2px solid var(--white);
    outline-offset: 2px;
  }

  button { font-family: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

  /* ---------------------------------- brand header ---------------------------------- */

  .brand-header {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 26px;
    text-align: center;
  }

  .brand-header img {
    width: 190px;
    height: auto;
    filter: drop-shadow(0 6px 18px rgba(0,0,0,0.14));
  }

  .brand-header .brand-fallback {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 42px;
    color: var(--white);
    letter-spacing: -0.01em;
  }

  .brand-tagline {
    margin: 8px 0 0;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255,255,255,0.92);
    letter-spacing: 0.01em;
  }

  /* ---------------------------------- card ---------------------------------- */

  .auth-card {
    position: relative;
    z-index: 1;
    width: min(420px, 100%);
    background: var(--white);
    border-radius: var(--radius-card);
    box-shadow: 0 30px 60px -18px rgba(120, 0, 40, 0.45), 0 4px 14px rgba(120,0,40,0.12);
    padding: 36px 30px 30px;
  }

  /* pill tab switcher */
  .tab-switch {
    position: relative;
    display: flex;
    background: var(--primary-tint);
    border-radius: 999px;
    padding: 4px;
    margin-bottom: 26px;
  }
  .tab-switch__indicator {
    position: absolute;
    top: 4px; left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
    border-radius: 999px;
    box-shadow: 0 6px 14px -4px rgba(255,30,90,0.55);
    transition: transform 0.32s cubic-bezier(0.65,0,0.2,1);
  }
  .tab-switch[data-active="signup"] .tab-switch__indicator { transform: translateX(100%); }
  .tab-switch button {
    position: relative;
    z-index: 1;
    width: 50%;
    padding: 10px 0;
    background: transparent;
    border: none;
    border-radius: 999px;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-soft);
    transition: color 0.3s;
  }
  .tab-switch button[aria-selected="true"] { color: var(--white); }

  h1.form-title {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--ink);
    letter-spacing: -0.01em;
  }

  .form-sub {
    margin: 0 0 22px;
    font-size: 13.5px;
    color: var(--muted);
    line-height: 1.5;
  }

  .view { display: none; }
  .view.is-active {
    display: block;
    animation: view-fade-in 0.28s ease;
  }
  @keyframes view-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  @media (prefers-reduced-motion: reduce) {
    .view.is-active { animation: none; }
  }

  /* ---------------------------------- fields ---------------------------------- */

  .field { display: block; margin-bottom: 15px; }

  .field__label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 6px;
  }

  .field__control {
    position: relative;
    display: flex;
    align-items: center;
  }

  .field__icon {
    position: absolute;
    left: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    pointer-events: none;
  }

  .field input,
  .field textarea {
    width: 100%;
    padding: 12px 14px;
    font-size: 14.5px;
    font-family: inherit;
    border: 1.5px solid var(--primary-line);
    background: var(--primary-tint);
    border-radius: var(--radius-field);
    color: var(--ink);
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  }

  .field.has-icon input,
  .field.has-icon textarea { padding-left: 42px; }

  .field input:focus,
  .field textarea:focus {
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(255,46,111,0.14);
    outline: none;
  }

  .field input::placeholder,
  .field textarea::placeholder { color: var(--muted); opacity: 0.85; }

  .pw-field input { padding-right: 42px; }

  .eye-toggle {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    padding: 7px;
    color: var(--muted);
    display: flex;
    border-radius: 8px;
  }
  .eye-toggle:hover { color: var(--primary); }
  .eye-toggle .icon-closed { display: none; }
  .eye-toggle[data-visible="true"] .icon-open { display: none; }
  .eye-toggle[data-visible="true"] .icon-closed { display: block; }

  .pw-hint {
    display: block;
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--muted);
  }

  /* ---------------------------------- buttons ---------------------------------- */

  .btn-primary {
    width: 100%;
    padding: 14px;
    margin-top: 8px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
    color: var(--white);
    border: none;
    border-radius: var(--radius-field);
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: 0 12px 24px -8px rgba(255,30,90,0.55);
    transition: transform 0.12s ease, box-shadow 0.15s ease, opacity 0.15s;
  }
  .btn-primary:hover { box-shadow: 0 14px 28px -8px rgba(255,30,90,0.68); }
  .btn-primary:active { transform: scale(0.985); }
  .btn-primary:disabled { opacity: 0.65; cursor: default; transform: none; }

  .btn-secondary {
    width: 100%;
    padding: 13px;
    margin-top: 10px;
    background: var(--white);
    color: var(--primary-deep);
    border: 1.5px solid var(--primary-line);
    border-radius: var(--radius-field);
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s;
  }
  .btn-secondary:hover { background: var(--primary-tint); border-color: var(--primary); }

  .link-btn {
    display: block;
    margin: 16px auto 0;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 13px;
    text-decoration: underline;
    text-underline-offset: 2px;
  }
  .link-btn:hover { color: var(--primary-deep); }

  /* ---------------------------------- banners ---------------------------------- */

  .banner {
    margin-bottom: 16px;
    padding: 11px 14px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.5;
  }
  .banner.error { background: var(--danger-bg); color: var(--danger); }
  .banner.success { background: var(--success-bg); color: var(--success-text); }
  .banner.hidden { display: none; }

  .resend-countdown {
    margin: 8px 0 0;
    text-align: center;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    min-height: 16px;
  }
  .btn-secondary:disabled {
    opacity: 0.55;
    cursor: default;
  }

  /* ---------------------------------- field validation messages ---------------------------------- */

  .field-msg {
    display: block;
    min-height: 15px;
    margin-top: 6px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--danger);
  }
  .field-msg.is-ok { color: var(--success-text); }
  .field-msg:empty { min-height: 0; margin-top: 0; }

  .field.has-error input { border-color: var(--danger) !important; }
  .field.has-success input { border-color: var(--success-text); }

  /* ---------------------------------- primary button loading state ---------------------------------- */

  .btn-primary {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
  }
  .btn-primary__spinner {
    display: none;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    border: 2.5px solid rgba(255,255,255,0.4);
    border-top-color: var(--white);
    animation: btn-spin 0.7s linear infinite;
  }
  .btn-primary.is-loading .btn-primary__spinner { display: inline-block; }
  .btn-primary.is-loading { cursor: default; }
  @keyframes btn-spin { to { transform: rotate(360deg); } }
  @media (prefers-reduced-motion: reduce) {
    .btn-primary__spinner { animation-duration: 1.4s; }
  }

  /* ---------------------------------- OTP digit boxes ---------------------------------- */

  .otp-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 6px 0 22px;
  }
  .otp-box {
    width: 44px;
    height: 52px;
    text-align: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 21px;
    padding: 0 !important;
    border: 1.5px solid var(--primary-line);
    background: var(--primary-tint);
    border-radius: var(--radius-field);
    color: var(--ink);
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  }
  .otp-box:focus {
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(255,46,111,0.14);
    outline: none;
  }
  .otp-box.is-filled { border-color: var(--primary); }
  @media (max-width: 380px) {
    .otp-row { gap: 6px; }
    .otp-box { width: 38px; height: 48px; font-size: 19px; }
  }

  /* ---------------------------------- footer ---------------------------------- */

  .auth-footer {
    position: relative;
    z-index: 1;
    margin-top: 22px;
    text-align: center;
    font-size: 12.5px;
    font-weight: 500;
    color: rgba(255,255,255,0.85);
  }

  /* ---------------------------------- responsive: phone ---------------------------------- */

  @media (max-width: 480px) {
    body { padding: 0; justify-content: flex-start; }

    .curve-decor, body::before, body::after { display: none; }

    .brand-header {
      padding: calc(28px + env(safe-area-inset-top, 0px)) 20px 18px;
      margin-bottom: 0;
    }

    .brand-header img { width: 150px; }

    body { overflow: hidden; } /* the card scrolls internally instead of the page */

    .auth-card {
      width: 100%;
      flex: 1;
      min-height: 0; /* let the flex item shrink below its content so overflow-y can kick in */
      border-radius: 26px 26px 0 0;
      box-shadow: 0 -10px 30px rgba(120,0,40,0.18);
      padding: 30px 22px calc(26px + env(safe-area-inset-bottom, 0px));
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }

    .auth-footer { padding-bottom: 18px; }
  }