/* ────────────────────────────────────────
    TSR Auth — white surface, hairline separation.
    Same palette as the landing page so the funnel
    reads as one product. Colour is a signal, never
    decoration: orange for accents, red/green for state.
──────────────────────────────────────── */

:root {
  /* ── Landing palette (shared vocabulary) ── */
  --canvas: #ffffff;
  --ink: #000000;
  --ink-secondary: #3c3c3c;
  --ink-tertiary: #545454;
  --ink-muted: #767676;
  --ink-disabled: #999999;
  --hairline: #e5e7eb;
  --hairline-strong: #cccccc;
  --hairline-mid: #b3b3b3;
  --brand-orange: #f05143;
  --markets-down: #e51503;
  --markets-up: #338736;
  --error-bg: #ffcdca;
  --surface-tint: #f3f4ef;
  --on-primary: #ffffff;

  --bg-image: url("formula-bg.webp");
  --bg-fallback: var(--canvas);

  /* ── Text hierarchy ── */
  --tsr-heading: var(--ink);
  --tsr-body: var(--ink-secondary);
  --tsr-muted: var(--ink-muted);
  --tsr-link: var(--ink);

  /* ── Surfaces / lines ── */
  --tsr-modal-border: var(--hairline);
  --tsr-hairline: var(--hairline);
  --tsr-graphite: var(--canvas);
  --tsr-graphite-deep: var(--surface-tint);

  --tsr-input-bg: var(--canvas);
  --tsr-input-border: var(--hairline-strong);

  /* ── Accent ramp — ink for fills, orange for marks ── */
  --tsr-accent: var(--ink);
  --tsr-accent-deep: var(--ink-secondary);
  --tsr-accent-lt: var(--brand-orange);

  /* ── Legacy --g-* aliases (kept so stray selectors stay in-palette) ── */
  --g-purple: var(--tsr-accent);
  --g-purple-lt: var(--tsr-link);
  --g-purple-xl: var(--tsr-accent-lt);

  --g-text: var(--tsr-heading);
  --g-text-soft: var(--tsr-body);
  --g-text-dim: var(--tsr-muted);
  --g-text-ghost: var(--tsr-muted);

  --g-glass: var(--canvas);
  --g-glass-strong: var(--canvas);
  --g-border: var(--tsr-modal-border);
  --g-border-soft: var(--tsr-hairline);

  --g-input-bg: var(--tsr-input-bg);
  --g-input-border: var(--tsr-input-border);

  --social-btn-bg: var(--tsr-graphite);
  --social-btn-border: var(--tsr-input-border);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  font-family: "Prompt", "Manrope", sans-serif;
  color: var(--tsr-body);
  background-image: var(--bg-image);
  background-color: var(--bg-fallback);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* White veil — the formula pattern is a field, not a photo. Held back
   here rather than with opacity so the content above keeps full contrast. */
.page-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.72);
}

/* ────────────────────────────────────────
    Language toggle — same hairline segmented control as the landing navbar.
    Fixed because body has overflow:hidden here, like .footer-text.
──────────────────────────────────────── */

.lang-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 4;
  display: inline-flex;
  border: 1px solid var(--hairline-strong);
  border-radius: 0;
  background: var(--canvas);
}

.lang-toggle-btn {
  padding: 6px 12px;
  border: 0;
  border-radius: 0;
  background: var(--canvas);
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition:
    background 150ms ease,
    color 150ms ease;
}

.lang-toggle-btn + .lang-toggle-btn {
  border-left: 1px solid var(--hairline-strong);
}

.lang-toggle-btn:hover {
  color: var(--ink);
}

.lang-toggle-btn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--on-primary);
}

/* ────────────────────────────────────────
    Layout
──────────────────────────────────────── */

.wrapper {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

/* The two halves are not halves. The form side carries three plan cards, a
   terms paragraph and a submit button; the brand side carries a logo and two
   sentences, so it gets less room.

   The sliding transforms below are percentages of each panel's OWN width, so
   they have to be re-derived whenever these two numbers change:
     sign-up-container travel = brand / form  = 42/58 = 72.4138%
     overlay-container travel = form  / brand = 58/42 = 138.0952% */
.container {
  --form-side: 58%;
  --brand-side: 42%;

  position: relative;
  width: min(1040px, calc(100vw - 32px));
  max-width: 100%;
  min-height: 640px;
  overflow: hidden;
  border-radius: 4px;

  background: var(--canvas);
  border: 1px solid var(--hairline);
}

.form-container {
  position: absolute;
  top: 0;
  height: 100%;
  z-index: 2;
  transition: all 0.72s cubic-bezier(0.16, 1, 0.3, 1);
}

.sign-in-container {
  left: 0;
  width: var(--form-side);
  z-index: 3;
}

.sign-up-container {
  left: 0;
  width: var(--form-side);
  z-index: 2;
  opacity: 0;
}

/* Off-screen either way, so the exact distance does not matter. */
.container.active .sign-in-container {
  transform: translateX(100%);
  opacity: 0;
}

/* Lands its left edge on the brand side's width — see .container. */
.container.active .sign-up-container {
  transform: translateX(72.4138%);
  opacity: 1;
  z-index: 5;
}

form {
  height: 100%;
  padding: 34px 50px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  text-align: center;
}

.form-label {
  margin: 0 0 6px;
  color: var(--tsr-muted);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.form-title {
  margin: 0 0 20px;
  color: var(--tsr-heading);
  font-size: clamp(1.55rem, 2.5vw, 2.05rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
  white-space: nowrap;
}

/* ────────────────────────────────────────
    Secondary button (Google)
──────────────────────────────────────── */

.social-btn,
.tsr-auth-secondary {
  width: 100%;
  height: 45px;
  border-radius: 0;
  color: var(--tsr-heading);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  background: var(--canvas);
  border: 1px solid var(--hairline-strong);

  font-family: "Prompt", sans-serif;
  font-size: 0.88rem;
  font-weight: 500;

  transition:
    border-color 0.22s ease,
    background 0.22s ease,
    transform 0.22s ease;
}

.social-btn img {
  width: 18px;
  height: 18px;
}

.social-btn:hover,
.tsr-auth-secondary:hover {
  transform: translateY(-1px);
  background: var(--surface-tint);
  border-color: var(--hairline-mid);
}

.social-btn:active,
.tsr-auth-secondary:active {
  transform: translateY(0) scale(0.99);
}

.divider {
  position: relative;
  margin: 18px 0;
  color: var(--tsr-muted);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 12px;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--tsr-hairline);
}

.divider span {
  flex: 0 0 auto;
}

/* ────────────────────────────────────────
    Inputs
──────────────────────────────────────── */

.input-group {
  margin-bottom: 11px;
}

.input-group input,
.tsr-auth-input {
  width: 100%;
  max-width: 100%;
  height: 45px;
  border-radius: 0;
  color: var(--tsr-heading);

  background: var(--tsr-input-bg);
  border: 1px solid var(--tsr-input-border);
  padding: 0 15px;
  font-family: "Prompt", sans-serif;
  font-size: 0.88rem;
  font-weight: 400;
  outline: none;

  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.input-group input::placeholder,
.tsr-auth-input::placeholder {
  color: var(--tsr-muted);
}

.input-group input:focus,
.tsr-auth-input:focus {
  border-color: var(--ink);
  background: var(--canvas);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.14);
}

/* Password Toggle */
.password-group {
  position: relative;
}

.password-group input {
  padding-right: 52px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  border: 1px solid var(--tsr-input-border);
  background: var(--canvas);
  color: var(--ink-tertiary);
  cursor: pointer;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

.password-toggle:hover {
  background: var(--surface-tint);
  border-color: var(--hairline-mid);
  color: var(--tsr-heading);
}

.password-toggle:active {
  transform: translateY(-50%) scale(0.94);
}

.password-toggle svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.password-toggle .eye-hide {
  display: none;
}

.password-toggle.is-visible .eye-show {
  display: none;
}

.password-toggle.is-visible .eye-hide {
  display: block;
}

.password-toggle.is-visible {
  color: var(--brand-orange);
}

/* ────────────────────────────────────────
    Primary CTA
──────────────────────────────────────── */

.btn-submit,
.tsr-auth-primary {
  position: relative;
  width: 100%;
  height: 46px;
  border-radius: 0;

  color: var(--on-primary);
  cursor: pointer;

  background: var(--tsr-accent);
  border: 1px solid var(--tsr-accent);

  font-family: "Prompt", sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.01em;

  transition:
    transform 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

.btn-submit:hover,
.tsr-auth-primary:hover {
  transform: translateY(-1px);
  background: var(--tsr-accent-deep);
  border-color: var(--tsr-accent-deep);
}

.btn-submit:active,
.tsr-auth-primary:active {
  transform: translateY(0) scale(0.988);
}

/* Disabled doubles as the loading state and keeps a visible label, so the
   fill only dims to --ink-tertiary — white on it is still 7.6:1. */
.btn-submit:disabled,
.tsr-auth-primary:disabled {
  cursor: default;
  background: var(--ink-tertiary);
  border-color: var(--ink-tertiary);
}

/* ────────────────────────────────────────
    Plan Selector
──────────────────────────────────────── */

.signup-plan-block {
  margin: 14px 0 20px;
  text-align: left;
}

/* Three fixed columns, not auto-fit: auto-fit wrapped Annual onto a second row
   the moment the third card arrived. Mobile drops to one column below. */
.signup-plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
}

/* Equal height across the row — the grid stretches the label, and the card
   fills it, so all three bottoms line up however long the note runs. */
.signup-plan-grid .plan-choice-card,
.signup-plan-grid .plan-choice-content {
  height: 100%;
}

/* 2 ใบเรียงข้างกันแล้วแถวเดียว (ชื่อ + ป้ายราคา) แคบเกิน — ซ้อนแนวตั้งในการ์ด
   padding-top เว้นให้พ้นความสูงป้าย "แนะนำ" (~19px): ที่ 360-375px ภาษา
   อังกฤษ "Annual Pro" ยาวจนป้าย BEST VALUE ทับหางตัวอักษร ถ้าเว้นแค่ 10px

   ใส่กับทั้ง 3 ใบเสมอ แม้ใบที่ไม่มีป้าย — ป้ายเป็น position:absolute อยู่แล้ว
   การเว้นเท่ากันทุกใบคือสิ่งที่ทำให้ชื่อและราคาอยู่ระดับเดียวกัน */
.plan-choice-card--compact .plan-choice-content {
  padding-top: 24px;
  display: flex;
  flex-direction: column;
}

.plan-choice-card--compact .plan-choice-top {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.plan-choice-badge {
  position: absolute;
  top: -1px;
  right: -1px;
  padding: 2px 7px;
  border: 1px solid var(--tsr-input-border);
  border-top: 0;
  border-right: 0;
  background: var(--surface-tint);
  color: var(--tsr-muted);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.6;
}

.plan-choice-card input:checked + .plan-choice-content .plan-choice-badge {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--on-primary);
}

.signup-plan-hint {
  margin: 9px 0 0;
  color: var(--tsr-muted);
  font-size: 0.66rem;
  line-height: 1.45;
}

.plan-choice-card {
  position: relative;
  display: block;
  cursor: pointer;
}

.plan-choice-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.plan-choice-content {
  position: relative;
  display: block;
  padding: 13px 15px;
  border-radius: 4px;
  border: 1px solid var(--tsr-input-border);
  background: var(--canvas);

  transition:
    border-color 0.22s ease,
    background 0.22s ease,
    box-shadow 0.22s ease;
}

.plan-choice-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.plan-choice-top strong {
  color: var(--tsr-heading);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
}

.plan-choice-top em {
  color: var(--ink);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  background: var(--canvas);
  padding: 3px 10px;
  border-radius: 0;
  border: 1px solid var(--hairline-strong);
}

/* margin-top:auto pins the note to the bottom of whichever card is tallest,
   which keeps the three price chips on one line above it. */
.plan-choice-content small {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: auto;
  padding-top: 7px;
  color: var(--tsr-muted);
  font-size: 0.66rem;
  font-weight: 400;
  line-height: 1.45;
}

/* Card background stays --canvas in every state: the small print inside
   is --ink-muted, which only clears AA against pure white. */
.plan-choice-card:hover .plan-choice-content {
  border-color: var(--hairline-mid);
}

.plan-choice-card input:checked + .plan-choice-content {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.plan-choice-card input:checked + .plan-choice-content .plan-choice-top strong {
  color: var(--tsr-heading);
}

.plan-choice-card input:checked + .plan-choice-content .plan-choice-top em {
  color: var(--on-primary);
  background: var(--ink);
  border-color: var(--ink);
}

.plan-choice-card input:checked + .plan-choice-content small {
  color: var(--tsr-body);
}

/* ────────────────────────────────────────
    Options / Terms
──────────────────────────────────────── */

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: -2px 0 14px;
}

.check-row,
.terms-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--tsr-body);
  font-size: 0.76rem;
  font-weight: 400;
  line-height: 1.55;
  text-align: left;
}

.check-row {
  align-items: center;
  white-space: nowrap;
}

.check-row input,
.terms-row input {
  width: 15px;
  height: 15px;
  margin: 2px 0 0;
  accent-color: var(--tsr-accent);
  cursor: pointer;
  flex: 0 0 auto;
}

.check-row span,
.terms-row span {
  display: inline-block;
}

.terms-row {
  margin: 0 0 14px;
}

.signup-terms {
  margin-top: 2px;
}

/* Links are ink + underline. No orange hover here — this text is 0.76rem,
   and orange on white is 3.7:1, which fails AA below 18px. */
.terms-row a {
  color: var(--tsr-link);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--hairline-mid);
  transition: text-decoration-color 0.2s ease;
}

.terms-row a:hover {
  color: var(--ink);
  text-decoration-color: var(--ink);
}

.forgot {
  display: block;
  margin: 0;
  color: var(--tsr-muted);
  font-size: 0.76rem;
  font-weight: 400;
  text-align: right;
  text-decoration: none;
  transition: color 0.2s ease;
  flex: 0 0 auto;
}

.forgot:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ────────────────────────────────────────
    Segmented Tab
──────────────────────────────────────── */

.seg-tab,
.tsr-auth-cta {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 280px;
  margin: 20px auto 0;
  padding: 4px;
  border-radius: 4px;
  background: var(--canvas);
  border: 1px solid var(--hairline-strong);
}

.seg-tab button {
  flex: 1;
  height: 33px;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--tsr-muted);
  font-family: "Prompt", sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    color 0.22s ease,
    background 0.22s ease,
    border-color 0.22s ease;
  white-space: nowrap;
}

/* Active = filled ink. The state has to survive on a white panel. */
.seg-tab button.seg-active {
  background: var(--ink);
  border: 1px solid var(--ink);
  color: var(--on-primary);
}

.seg-tab button:not(.seg-active):hover {
  color: var(--tsr-body);
  background: var(--surface-tint);
}

/* ────────────────────────────────────────
    Overlay (right panel) — graphite, not navy
──────────────────────────────────────── */

.overlay-container {
  position: absolute;
  top: 0;
  left: var(--form-side);
  width: var(--brand-side);
  height: 100%;
  overflow: hidden;
  z-index: 10;
  transition: transform 0.72s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Travels the form side's width, expressed against its own — see .container. */
.container.active .overlay-container {
  transform: translateX(-138.0952%);
}

.overlay {
  position: relative;
  left: -100%;
  width: 200%;
  height: 100%;
  color: var(--tsr-body);
  transform: translateX(0);
  transition: transform 0.72s cubic-bezier(0.16, 1, 0.3, 1);

  /* A tint, not a fill — separates the brand panel from the form
     with one hairline, the way the landing page does it. */
  background: var(--surface-tint);

  border-left: 1px solid var(--hairline);
}

.container.active .overlay {
  transform: translateX(50%);
}

.overlay-panel {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  padding: 0 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 2;
}

.overlay-left {
  transform: translateX(-20%);
}

.container.active .overlay-left {
  transform: translateX(0);
}

.overlay-right {
  right: 0;
  transform: translateX(0);
}

.container.active .overlay-right {
  transform: translateX(20%);
}

/* Logo — wide transparent mark, no plate, no border, no halo */
.logo-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  width: auto;
  animation: logoFloat 5s ease-in-out infinite;
}

.logo-wrap img {
  height: 52px;
  width: auto;
  object-fit: contain;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  display: block;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}

.brand-kicker {
  margin: 14px 0 0;
  font-family: "Cinzel", serif;
  color: var(--ink-tertiary);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.overlay-title {
  margin: 20px 0 10px;
  color: var(--tsr-heading);
  font-size: clamp(1.4rem, 1.8vw, 1.85rem);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.22;
}

.overlay-desc {
  max-width: 300px;
  margin: 0 0 20px;
  color: var(--tsr-body);
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.7;
}

.footer-text {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 3;
  transform: translateX(-50%);
  margin: 0;
  width: max-content;
  max-width: calc(100vw - 32px);
  font-family: "Cinzel", serif;
  /* Sits on the veiled pattern, not on solid white — --ink-muted clears AA
     by 0.04 and would not survive that, so this line goes one step darker. */
  color: var(--ink-tertiary);
  font-size: 0.76rem;
  letter-spacing: 0.22em;
  text-align: center;
  text-transform: uppercase;
}

/* ────────────────────────────────────────
    Toast
──────────────────────────────────────── */

.login-toast {
  position: fixed;
  left: 50%;
  bottom: 74px;
  z-index: 50;
  transform: translateX(-50%) translateY(16px);
  min-width: 280px;
  max-width: calc(100vw - 32px);
  padding: 13px 18px;
  border-radius: 4px;
  color: var(--tsr-heading);

  background: var(--canvas);
  border: 1px solid var(--hairline-strong);

  font-size: 0.84rem;
  font-weight: 500;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: 0.28s ease;
}

.login-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Error tint carries the signal; the message stays ink. --markets-down text
   on --error-bg is only 3.3:1, so the red lives on the border and field. */
.login-toast.error {
  border-color: var(--markets-down);
  background: var(--error-bg);
  color: var(--ink);
}

/* ────────────────────────────────────────
    Legal Modals
──────────────────────────────────────── */

.legal-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.45);
}

.legal-modal {
  width: min(560px, 100%);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
  border: 1px solid var(--hairline-strong);
  border-radius: 4px;
  overflow: hidden;
  color: var(--tsr-body);
}

.legal-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--tsr-hairline);
  flex-shrink: 0;
}

.legal-modal-header h3 {
  margin: 0;
  font-family: "Prompt", sans-serif;
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--tsr-heading);
  letter-spacing: 0.02em;
}

.legal-modal-close {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: var(--canvas);
  border: 1px solid var(--tsr-input-border);
  border-radius: 0;
  color: var(--ink-tertiary);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
  flex-shrink: 0;
}

.legal-modal-close:hover {
  background: var(--surface-tint);
  border-color: var(--hairline-mid);
  color: var(--tsr-heading);
}

.legal-modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px 24px;
  color: var(--tsr-body);
  font-size: 0.82rem;
  line-height: 1.78;
  scrollbar-width: thin;
  scrollbar-color: var(--hairline-mid) transparent;
}

.legal-modal-body::-webkit-scrollbar       { width: 4px; }
.legal-modal-body::-webkit-scrollbar-track { background: transparent; }
.legal-modal-body::-webkit-scrollbar-thumb { background: var(--hairline-mid); border-radius: 4px; }

.legal-modal-body h2 {
  margin: 0 0 6px;
  font-family: "Prompt", sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--tsr-heading);
}

.legal-modal-body p      { margin: 0 0 13px; }
.legal-modal-body strong { color: var(--tsr-heading); font-weight: 600; }
.legal-modal-body a      { color: var(--tsr-link); text-decoration: underline; text-underline-offset: 3px; }

.legal-modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--tsr-hairline);
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}

.legal-modal-accept {
  height: 40px;
  padding: 0 26px;
  border-radius: 0;
  background: var(--tsr-accent);
  border: 1px solid var(--tsr-accent);
  color: var(--on-primary);
  font-family: "Prompt", sans-serif;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

.legal-modal-accept:hover {
  transform: translateY(-1px);
  background: var(--tsr-accent-deep);
  border-color: var(--tsr-accent-deep);
}

.legal-modal-accept:active {
  transform: translateY(0) scale(0.988);
}

/* ── Forgot-password field ──
   Its border colour is driven by inline onfocus/onblur handlers in
   login.html that were written for the dark theme. Those are JS and
   stay untouched, so !important here wins over what they set inline. */
#forgotEmail {
  border-color: var(--hairline-strong) !important;
}

#forgotEmail:focus {
  border-color: var(--ink) !important;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.14);
}

/* ────────────────────────────────────────
    Responsive
──────────────────────────────────────── */

@media (max-width: 820px) {
  /* fixed attachment janks badly on iOS Safari once the page can scroll */
  body { overflow: auto; background-attachment: scroll; }

  .wrapper {
    min-height: auto;
    padding: 28px 16px 92px;
  }

  .container {
    width: 100%;
    min-height: auto;
    display: flex;
    flex-direction: column;
  }

  .form-container,
  .sign-in-container,
  .sign-up-container {
    position: relative;
    width: 100%;
    height: auto;
    min-height: 460px;
    left: auto;
    opacity: 1;
    transform: none !important;
  }

  .sign-up-container { display: none; }

  .container.active .sign-in-container { display: none; }
  .container.active .sign-up-container { display: block; }

  .overlay-container {
    position: relative;
    left: auto;
    width: 100%;
    height: 300px;
    transform: none !important;
  }

  .overlay {
    left: auto;
    width: 100%;
    transform: none !important;
    border-left: none;
    border-top: 1px solid var(--hairline);
    background: var(--surface-tint);
  }

  .overlay-panel {
    width: 100%;
    padding: 32px 24px;
    transform: none !important;
  }

  .overlay-left { display: none; }
  .container.active .overlay-left  { display: flex; }
  .container.active .overlay-right { display: none; }

  form { padding: 38px 24px; }

  .form-title    { white-space: normal; font-size: 1.65rem; }
  .overlay-title { white-space: normal; font-size: 1.45rem; }

  .seg-tab { max-width: 240px; }

  .footer-text {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    margin: -58px auto 24px;
    font-size: 0.62rem;
    line-height: 1.6;
  }

  .signup-plan-block { margin: 10px 0 16px; }
  .plan-choice-content { padding: 11px 12px; }
  .plan-choice-top strong { font-size: 0.78rem; }
  .plan-choice-content small { font-size: 0.66rem; }
  .signup-plan-hint { font-size: 0.62rem; }

  /* Stacked once the modal is a single column: three cards side by side put
     "Annual Pro" and its badge on top of each other at phone widths. */
  .signup-plan-grid { grid-template-columns: minmax(0, 1fr); }

  /* The note sits directly under the price again — there is no neighbouring
     card left to line its bottom up with. */
  .plan-choice-content small { margin-top: 0; padding-top: 5px; }
}

@media (max-width: 460px) {
  .wrapper { padding: 24px 12px 92px; }

  .container {
    width: calc(100vw - 24px);
    border-radius: 4px;
  }

  .form-title    { font-size: 1.55rem; }
  .overlay-title { font-size: 1.4rem; }

  .logo-wrap {
    height: 44px;
  }
  .logo-wrap img { height: 44px; }

  .login-options {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .terms-row { font-size: 0.7rem; }
}

/* Signup compact */
.sign-up-container form {
  padding-top: 26px;
  padding-bottom: 26px;
}

.sign-up-container .form-title {
  margin-bottom: 14px;
  font-size: clamp(1.4rem, 2.1vw, 1.85rem);
}

.sign-up-container .social-btn    { height: 42px; }
.sign-up-container .divider       { margin: 13px 0; }
.sign-up-container .input-group   { margin-bottom: 9px; }
.sign-up-container .input-group input { height: 43px; }
/* Wider modal buys a one-row plan grid, which buys the room to let the last
   three controls breathe without making the card any taller. */
.sign-up-container .terms-row     { margin-bottom: 18px; }
