/*
 * Tinubuan sign-in pages (login, signup, password recovery and reset), 2026.
 *
 * A split screen: a navy brand panel with the real app on the left, the form
 * on the right. On phones the panel becomes a navy band and the form card
 * rises over it. Same language as the Android app: Figtree, navy #020C45,
 * sun #F4D54A, inputs with a leading icon, a pill-shaped primary button.
 *
 * It restyles the existing markup (#login-view, .card, label, input, button)
 * so the pages' scripts and ids are untouched. app-v2.css styles these pages
 * by id; everything here is scoped to body.auth-page and switches that off
 * rather than editing app-v2.css, which keeps serving the signed-in product.
 */

body.auth-page {
  --auth-canvas: #f5f6fa;
  --auth-surface: #ffffff;
  --auth-line: #e6e8f0;
  --auth-line-strong: #c7cadc;
  --auth-ink: #020c45;
  --auth-ink-raised: #0e1a5c;
  --auth-ink-soft: #3a4270;
  --auth-muted: #5b6180;
  --auth-sun: #f4d54a;
  --auth-sun-wash: #fdf7da;
  --auth-brand-ink: #6b5410;
  --auth-danger-soft: #fdeceb;
  --auth-positive: #2e6b4d;
  --auth-positive-soft: #e8f3ec;

  color-scheme: light;
  margin: 0;
  background: var(--auth-canvas);
  color: var(--auth-ink);
}

body.auth-page .weave-band { display: none; }

body.auth-page .auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(460px, 0.92fr);
  min-height: 100vh;
  min-height: 100svh;
}

/* Brand panel ------------------------------------------------------------- */

body.auth-page .auth-brand {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100svh;
  padding: clamp(28px, 5vh, 44px) clamp(32px, 4.6vw, 68px) 0;
  overflow: hidden;
  isolation: isolate;
  color: #ffffff;
  background:
    radial-gradient(circle at 92% 104%, rgba(244, 213, 74, 0.34), rgba(244, 213, 74, 0) 42%),
    radial-gradient(circle at 0% 0%, rgba(27, 42, 107, 0.9), rgba(27, 42, 107, 0) 55%),
    var(--auth-ink);
}

body.auth-page .auth-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: linear-gradient(160deg, #000 10%, transparent 70%);
  mask-image: linear-gradient(160deg, #000 10%, transparent 70%);
}

body.auth-page .auth-brand::after {
  content: '';
  position: absolute;
  z-index: -1;
  top: -180px;
  right: -160px;
  width: 460px;
  height: 460px;
  border: 1px solid rgba(244, 213, 74, 0.22);
  border-radius: 50%;
  box-shadow: 0 0 0 56px rgba(244, 213, 74, 0.035), 0 0 0 124px rgba(244, 213, 74, 0.025);
}

body.auth-page .auth-brand-logo {
  align-self: flex-start;
  border-radius: 8px;
}
body.auth-page .auth-brand-logo img {
  display: block;
  width: 156px;
  height: auto;
}
body.auth-page .auth-brand-logo:focus-visible {
  outline: 3px solid rgba(244, 213, 74, 0.6);
  outline-offset: 6px;
}

body.auth-page .auth-brand-copy {
  max-width: 540px;
  margin-top: clamp(32px, 8vh, 88px);
}

body.auth-page .auth-brand-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 7px 13px 7px 11px;
  color: var(--auth-sun);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
body.auth-page .auth-brand-kicker span {
  position: relative;
  width: 7px;
  height: 7px;
  background: var(--auth-sun);
  border-radius: 50%;
}
body.auth-page .auth-brand-kicker span::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 1px solid rgba(244, 213, 74, 0.55);
  border-radius: 50%;
  animation: auth-pulse 2.4s ease-out infinite;
}
@keyframes auth-pulse {
  0% { opacity: 0.8; transform: scale(0.6); }
  75%, 100% { opacity: 0; transform: scale(1.7); }
}

body.auth-page .auth-brand-title {
  margin: 22px 0 0;
  font-size: clamp(36px, 3.5vw, 54px);
  font-weight: 850;
  line-height: 1.02;
  letter-spacing: -0.04em;
}
body.auth-page .auth-brand-title span { color: var(--auth-sun); }

body.auth-page .auth-brand-points {
  display: grid;
  gap: 12px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}
body.auth-page .auth-brand-points li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}
body.auth-page .auth-brand-points li::before {
  content: '';
  flex: none;
  width: 24px;
  height: 24px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23020c45' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 13px no-repeat,
    var(--auth-sun);
  border-radius: 50%;
}

body.auth-page .auth-brand-visual {
  position: relative;
  flex: 1 1 auto;
  min-height: 200px;
  margin-top: clamp(28px, 5vh, 52px);
}
body.auth-page .auth-shot-desktop {
  position: absolute;
  top: 0;
  left: 9%;
  width: 124%;
  max-width: none;
  height: auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  box-shadow: 0 44px 90px rgba(0, 0, 0, 0.42);
  transform: perspective(1800px) rotateY(-12deg) rotateX(7deg) rotateZ(1.5deg);
  transform-origin: left top;
}
body.auth-page .auth-shot-phone {
  position: absolute;
  top: 16%;
  left: 0;
  width: min(24%, 172px);
  height: auto;
  border: 5px solid #1b2a6b;
  border-radius: 26px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.12);
}

/* Form column ------------------------------------------------------------- */

body.auth-page #login-view {
  position: relative;
  isolation: auto;
  overflow: visible;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding:
    max(32px, env(safe-area-inset-top, 0px)) clamp(20px, 4vw, 56px)
    max(32px, env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(circle at 100% 0%, rgba(244, 213, 74, 0.16), rgba(244, 213, 74, 0) 38%),
    var(--auth-canvas);
}

body.auth-page #login-view::before,
body.auth-page #login-view::after { content: none; display: none; }

body.auth-page #login-view .card {
  width: min(448px, 100%);
  max-width: 448px;
  margin: 0;
  padding: 40px 36px 32px;
  background: var(--auth-surface);
  border: 1px solid var(--auth-line);
  border-radius: 26px;
  box-shadow: 0 1px 2px rgba(2, 12, 69, 0.04), 0 24px 64px rgba(2, 12, 69, 0.09);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.auth-page #login-view .auth-logo-wrap { display: none; }

body.auth-page #login-view .auth-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  color: var(--auth-brand-ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
body.auth-page #login-view .auth-eyebrow::before {
  content: '';
  width: 22px;
  height: 3px;
  background: var(--auth-sun);
  border-radius: 99px;
}

body.auth-page #login-view .auth-title {
  margin: 0 0 8px;
  color: var(--auth-ink);
  font-size: 34px;
  font-weight: 850;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

body.auth-page #login-view .auth-sub,
body.auth-page #login-view .tagline {
  margin: 0 0 26px;
  color: var(--auth-muted);
  font-size: 15px;
  line-height: 1.55;
  text-align: left;
}

/* Fields ------------------------------------------------------------------ */

/* The reset page hides its status line once the link is checked, so the form
   must not end up flush against the heading. */
body.auth-page #login-view .auth-title + form,
body.auth-page #login-view .auth-sub[hidden] + form { margin-top: 24px; }

body.auth-page #login-view label {
  display: block;
  margin-bottom: 16px;
  color: var(--auth-ink-soft);
  font-size: 13px;
  font-weight: 700;
}

body.auth-page #login-view input[type="email"],
body.auth-page #login-view input[type="password"],
body.auth-page #login-view input[type="text"] {
  box-sizing: border-box;
  width: 100%;
  min-height: 54px;
  margin-top: 7px;
  padding: 14px 16px 14px 46px;
  color: var(--auth-ink);
  background-color: var(--auth-surface);
  background-position: 16px center;
  background-repeat: no-repeat;
  background-size: 18px;
  border: 1.5px solid var(--auth-line);
  border-radius: 14px;
  box-shadow: none;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
body.auth-page #login-view input[type="email"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6180' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='4' width='20' height='16' rx='3'/%3E%3Cpath d='m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7'/%3E%3C/svg%3E");
}
body.auth-page #login-view input[type="password"],
body.auth-page #login-view .auth-password input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6180' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2.5'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E");
}
body.auth-page #login-view #invite-code {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6180' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v2a2 2 0 0 0 0 4v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2a2 2 0 0 0 0-4z'/%3E%3Cpath d='M14 6v12' stroke-dasharray='2 2.5'/%3E%3C/svg%3E");
  font-weight: 750;
  letter-spacing: 0.1em;
}
body.auth-page #login-view input::placeholder {
  color: #8a8fab;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
}

body.auth-page #login-view input[type="email"]:hover,
body.auth-page #login-view input[type="password"]:hover,
body.auth-page #login-view input[type="text"]:hover { border-color: var(--auth-line-strong); }

body.auth-page #login-view input[type="email"]:focus,
body.auth-page #login-view input[type="password"]:focus,
body.auth-page #login-view input[type="text"]:focus,
body.auth-page #login-view input:focus-visible {
  outline: none;
  border-color: var(--auth-ink);
  box-shadow: 0 0 0 4px rgba(244, 213, 74, 0.42);
}

/* Show / Hide on password fields (auth-ui.js adds the wrapper and button). */
body.auth-page #login-view .auth-password {
  position: relative;
  display: block;
  margin-top: 7px;
}
body.auth-page #login-view .auth-password input {
  margin-top: 0;
  padding-right: 78px;
}
body.auth-page #login-view .auth-password .auth-password-toggle {
  all: unset;
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  place-items: center;
  min-width: 56px;
  height: 38px;
  padding: 0 10px;
  box-sizing: border-box;
  color: var(--auth-ink);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  transform: translateY(-50%);
}
body.auth-page #login-view .auth-password .auth-password-toggle:hover { background: #eef0f5; }
body.auth-page #login-view .auth-password .auth-password-toggle:focus-visible {
  outline: 3px solid rgba(244, 213, 74, 0.6);
  outline-offset: 1px;
}

/* Two dates side by side: the cycle a new group starts with (register). */
body.auth-page #login-view .auth-dates {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}
body.auth-page #login-view .auth-dates label { margin-bottom: 0; }
body.auth-page #login-view input[type="date"] {
  box-sizing: border-box;
  width: 100%;
  min-height: 54px;
  margin-top: 7px;
  padding: 14px 12px;
  color: var(--auth-ink);
  background: var(--auth-surface);
  border: 1.5px solid var(--auth-line);
  border-radius: 14px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
}
body.auth-page #login-view input[type="date"]:hover { border-color: var(--auth-line-strong); }

/* A tick the treasurer gives before the group starts (register: the cycle). */
body.auth-page #login-view label.auth-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 14px 0 18px;
  padding: 12px 14px;
  color: var(--auth-ink);
  background: var(--auth-surface);
  border: 1.5px solid var(--auth-line);
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  cursor: pointer;
}
body.auth-page #login-view label.auth-check input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--auth-ink);
}
body.auth-page #login-view button[type="submit"]:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

body.auth-page #login-view .field-help {
  display: block;
  margin-top: 8px;
  color: var(--auth-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

/* Actions ----------------------------------------------------------------- */

body.auth-page #login-view button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  margin-top: 6px;
  padding: 0 22px;
  color: #ffffff;
  background: var(--auth-ink);
  border: 1px solid var(--auth-ink);
  border-radius: 999px;
  box-shadow: 0 14px 30px rgba(2, 12, 69, 0.22);
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.2s ease, transform 0.1s ease;
}
body.auth-page #login-view button[type="submit"]::after {
  content: '';
  width: 18px;
  height: 18px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f4d54a' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 0.2s ease;
}
body.auth-page #login-view button[type="submit"]:hover {
  color: #ffffff;
  background: var(--auth-ink-raised);
  border-color: var(--auth-ink-raised);
  box-shadow: 0 18px 36px rgba(2, 12, 69, 0.28);
}
body.auth-page #login-view button[type="submit"]:hover::after { transform: translateX(3px); }
body.auth-page #login-view button[type="submit"]:active { transform: translateY(1px); }
body.auth-page #login-view button[type="submit"]:disabled { opacity: 0.6; cursor: not-allowed; }
body.auth-page #login-view button[type="submit"]:focus-visible {
  outline: 3px solid rgba(244, 213, 74, 0.6);
  outline-offset: 3px;
}

body.auth-page #login-view .auth-inline-link {
  margin: -6px 0 20px;
  text-align: right;
  font-size: 13.5px;
}

body.auth-page #login-view .muted {
  color: var(--auth-muted);
  font-size: 14px;
  line-height: 1.55;
}

body.auth-page #login-view .auth-foot {
  margin: 26px 0 0;
  padding: 16px 18px;
  color: var(--auth-ink-soft);
  background: var(--auth-sun-wash);
  border: 0;
  border-radius: 16px;
  text-align: center;
  font-size: 14px;
}

body.auth-page #login-view a {
  color: var(--auth-ink);
  font-weight: 750;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}
body.auth-page #login-view a:hover { text-decoration-color: var(--auth-sun); }

/* Messages ---------------------------------------------------------------- */

body.auth-page #login-view .error,
body.auth-page #login-view .feedback {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  text-align: left;
}
body.auth-page #login-view .error,
body.auth-page #login-view .feedback.error {
  color: #8f2f27;
  background: var(--auth-danger-soft);
  border: 1px solid #f2c4c0;
}
body.auth-page #login-view .feedback.success {
  color: var(--auth-positive);
  background: var(--auth-positive-soft);
  border: 1px solid #bcd9c7;
}

/* After signing up, members and borrowers are walked to the Android app:
   there is no member workspace in the browser. --------------------------- */

body.auth-page #login-view .app-handoff {
  margin: 16px 0 0;
  padding: 16px 18px;
  background: var(--auth-sun-wash);
  border-radius: 16px;
  text-align: center;
}
body.auth-page #login-view .app-handoff[hidden] { display: none; }
body.auth-page #login-view .app-handoff-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 14px;
  background: var(--auth-ink);
  color: #fff;
  font-size: 14.5px;
  font-weight: 800;
  text-decoration: none;
}
body.auth-page #login-view .app-handoff-button:hover { background: #0e1a5c; }
body.auth-page #login-view .app-handoff .muted { margin: 10px 0 0; font-size: 13px; }

/* Secondary panels (invite claim, recovery sent, reset outcome) ------------ */

body.auth-page #login-view #claim-panel h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 850;
  letter-spacing: -0.02em;
}
body.auth-page #login-view #claim-panel .muted,
body.auth-page #login-view #recovery-success .muted,
body.auth-page #login-view #reset-invalid .muted,
body.auth-page #login-view #reset-success .muted { margin: 0 0 14px; }
body.auth-page #login-view #recovery-success .auth-title,
body.auth-page #login-view #reset-success .auth-title { margin-top: 4px; font-size: 24px; }

/* Narrower desktops -------------------------------------------------------- */

@media (max-width: 1180px) and (min-width: 961px) {
  body.auth-page .auth-shell { grid-template-columns: minmax(0, 1fr) minmax(430px, 1fr); }
  body.auth-page .auth-brand-title { font-size: clamp(32px, 3.4vw, 44px); }
}

@media (min-width: 961px) and (max-height: 760px) {
  body.auth-page .auth-brand-points { display: none; }
  body.auth-page .auth-brand-copy { margin-top: 28px; }
}

/* Phones and tablets: the panel becomes a navy band above the form ---------- */

@media (max-width: 960px) {
  body.auth-page .auth-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  body.auth-page .auth-brand {
    position: relative;
    height: auto;
    padding:
      max(20px, env(safe-area-inset-top, 0px)) 22px 92px;
  }
  body.auth-page .auth-brand::after { top: -220px; right: -220px; }
  body.auth-page .auth-brand-logo img { width: 128px; }
  body.auth-page .auth-brand-copy { max-width: 560px; margin-top: 26px; }
  body.auth-page .auth-brand-kicker { padding: 5px 11px 5px 9px; font-size: 12px; }
  body.auth-page .auth-brand-title { margin-top: 14px; font-size: clamp(28px, 7.4vw, 40px); }
  body.auth-page .auth-brand-points,
  body.auth-page .auth-brand-visual { display: none; }

  body.auth-page #login-view {
    place-items: start center;
    min-height: 0;
    margin-top: -64px;
    padding: 0 14px max(28px, env(safe-area-inset-bottom, 0px));
    background: transparent;
  }
  body.auth-page #login-view .card {
    padding: 30px 22px 24px;
    border-radius: 24px;
    box-shadow: 0 1px 2px rgba(2, 12, 69, 0.05), 0 20px 50px rgba(2, 12, 69, 0.14);
  }
  body.auth-page #login-view .auth-title { font-size: 30px; }
}

@media (max-width: 380px) {
  body.auth-page #login-view .card { padding: 26px 18px 20px; }
  body.auth-page #login-view .auth-title { font-size: 27px; }
}

/* Preferences --------------------------------------------------------------- */

@media (prefers-contrast: more) {
  body.auth-page #login-view .card { border-color: #9196b2; }
  body.auth-page #login-view input[type="email"],
  body.auth-page #login-view input[type="password"],
  body.auth-page #login-view input[type="text"] { border-color: #5b6180; }
  body.auth-page #login-view .auth-sub,
  body.auth-page #login-view .tagline,
  body.auth-page #login-view .muted { color: #3a4270; }
  body.auth-page .auth-brand-points li { color: #ffffff; }
}

@media (prefers-reduced-transparency: reduce) {
  body.auth-page #login-view { background: var(--auth-canvas); }
  body.auth-page .auth-brand-kicker { background: #0e1a5c; }
}

@media (prefers-reduced-motion: reduce) {
  body.auth-page .auth-brand-kicker span::after { animation: none; }
  body.auth-page #login-view input,
  body.auth-page #login-view button[type="submit"],
  body.auth-page #login-view button[type="submit"]::after { transition: none; }
  body.auth-page #login-view button[type="submit"]:active { transform: none; }
}

/* ---- Starting a group: three steps, a six-digit code -------------------- */

body.auth-page #login-view .auth-step {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--auth-muted, #6B7288);
}

/* The code is read off a phone and typed once, so it is set wide and large
   enough to check a digit at a glance. */
body.auth-page #login-view input.auth-code {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.42em;
  text-align: center;
  padding-left: 12px;
  padding-right: 0;
  font-variant-numeric: tabular-nums;
}

body.auth-page #login-view input.auth-code::placeholder {
  letter-spacing: 0.42em;
  font-weight: 600;
}

body.auth-page #login-view .auth-resend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 16px;
  font-size: 13px;
}

body.auth-page #login-view .auth-resend [hidden] { display: none; }
