/*
  signed-out screens (sign-in, codes, password, invite, phone check).
  Brand values; the four accent variables come from the page (SignInBrand,
  the brand's "any accent" rule). Light first, real dark mode from the system setting.
  The blue accent only marks focus, the logo dot and the next code cell. Buttons are ink, links ink and underlined.
*/
@font-face { font-family: "Geist"; src: url("../../fonts/v3/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("../../fonts/v3/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --canvas: #F7F7F8; --panel: #FFFFFF; --sunken: #F9F9FA; --hover: #0D0D0F0A;
  --line: #0D0D0F14; --line-strong: #0D0D0F26;
  --text: #0D0D0F; --text-2: #4A4C52; --text-3: #686B73;
  --ink: #0D0D0F; --on-ink: #FFFFFF;
  --good: #15803D; --good-bg: #15803D14; --bad: #C42B1C; --bad-bg: #C42B1C14;
  --ease: cubic-bezier(.23, 1, .32, 1);
  color-scheme: light;
}
:root[data-theme="dark"] {
    --canvas: #0A0A0B; --panel: #141416; --sunken: #1A1A1D; --hover: #FFFFFF0D;
    --line: #FFFFFF14; --line-strong: #FFFFFF24;
    --text: #F4F4F5; --text-2: #B4B6BD; --text-3: #8E9099;
    --ink: #F4F4F5; --on-ink: #141416;
    --good: #4ADE80; --good-bg: #4ADE8021; --bad: #F87171; --bad-bg: #F8717121;
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #0A0A0B; --panel: #141416; --sunken: #1A1A1D; --hover: #FFFFFF0D;
    --line: #FFFFFF14; --line-strong: #FFFFFF24;
    --text: #F4F4F5; --text-2: #B4B6BD; --text-3: #8E9099;
    --ink: #F4F4F5; --on-ink: #141416;
    --good: #4ADE80; --good-bg: #4ADE8021; --bad: #F87171; --bad-bg: #F8717121;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh; min-height: 100dvh;
  background: var(--canvas); color: var(--text);
  font: 400 14px/20px "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0; -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-soft); }

/* ---------- frame: one centered column ---------- */
.v2a { min-height: inherit; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 48px; }
.v2a-col { width: 100%; max-width: 400px; }
.v2a-brand { display: flex; justify-content: center; margin: 0 auto 28px; width: fit-content; border-radius: 8px; }
.v2a-logo { display: block; height: 28px; width: auto; }
.v2a-logo--agency { height: 40px; width: auto; max-width: 220px; object-fit: contain; }
.v2a-logo--on-dark { display: none; }
:root[data-theme="dark"] .v2a-logo--on-light { display: none; }
:root[data-theme="dark"] .v2a-logo--on-dark { display: block; }
:root[data-theme="dark"] .v2a-logo--single { background: #FFFFFF; padding: 8px 12px; border-radius: 8px; box-sizing: content-box; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .v2a-logo--on-light { display: none; }
  :root:not([data-theme="light"]) .v2a-logo--on-dark { display: block; }
  :root:not([data-theme="light"]) .v2a-logo--single { background: #FFFFFF; padding: 8px 12px; border-radius: 8px; box-sizing: content-box; }
}
.v2a-wordmark { font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -0.015em; }
.v2a-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 32px; }
.v2a-below { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 20px; color: var(--text-2); font-size: 13px; line-height: 18px; text-align: center; }

/* ---------- type ---------- */
.v2a h1 { margin: 0; font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -0.015em; }
.v2a-sub { margin: 6px 0 0; color: var(--text-2); }
.v2a-sub strong { color: var(--text); font-weight: 500; }
.v2a-head { margin-bottom: 24px; }

/* ---------- links: ink, underlined ---------- */
.v2a a:not(.v2a-btn):not(.v2a-brand) { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; transition: text-decoration-color 100ms var(--ease); border-radius: 4px; }
.v2a a:not(.v2a-btn):not(.v2a-brand):hover { text-decoration-color: currentColor; }
.v2a-linkbtn { appearance: none; background: none; border: 0; padding: 0; font: inherit; color: var(--text); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; cursor: pointer; border-radius: 4px; }
.v2a-linkbtn:hover:not(:disabled) { text-decoration-color: currentColor; }
.v2a-linkbtn:disabled { color: var(--text-3); text-decoration: none; cursor: default; font-variant-numeric: tabular-nums; }

/* ---------- form ---------- */
.v2a-form { display: grid; gap: 16px; margin: 0; }
.v2a-field { display: grid; gap: 6px; }
.v2a-label { font-size: 13px; line-height: 18px; font-weight: 500; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.v2a-label a { font-weight: 400; }
.v2a-input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 8px;
  background: var(--sunken); color: var(--text); border: 1px solid var(--line-strong);
  font: inherit; letter-spacing: inherit; transition: border-color 100ms var(--ease), background-color 100ms var(--ease);
}
.v2a-input::placeholder { color: var(--text-3); }
.v2a-input:hover { border-color: var(--text-3); }
.v2a-input:focus { background: var(--panel); }
.v2a-input[readonly] { color: var(--text-2); }
.v2a-input[aria-invalid="true"] { border-color: var(--bad); }
.v2a-error { margin: 0; color: var(--bad); font-size: 13px; line-height: 18px; }
.v2a-help { margin: 0; color: var(--text-2); font-size: 13px; line-height: 18px; }
.v2a-check { display: flex; align-items: center; gap: 8px; width: fit-content; cursor: pointer; color: var(--text-2); }
.v2a-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); }

/* focus: a 2px gap in the page color, then a 2px accent ring */
.v2a :is(a, button, input, .v2a-cells):focus-visible,
.v2a-input:focus, .v2a-code.is-cells:focus-within .v2a-cell.is-next {
  outline: none; box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent);
}
.v2a-brand:focus-visible { box-shadow: 0 0 0 2px var(--canvas), 0 0 0 4px var(--accent); }

/* ---------- buttons: ink primary, quiet secondary ---------- */
.v2a-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 40px; padding: 0 16px;
  border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 500; text-decoration: none; cursor: pointer;
  transition: background-color 100ms var(--ease), opacity 100ms var(--ease);
}
.v2a-btn--primary { background: var(--ink); color: var(--on-ink); }
.v2a-btn--primary:hover { opacity: .88; }
.v2a-btn--secondary { background: var(--panel); color: var(--text); border-color: var(--line-strong); }
.v2a-btn--secondary:hover { background: var(--hover); }
.v2a-btn:disabled { opacity: .55; cursor: default; }
.v2a-btn svg { flex: none; }
/* the account picker after a texted code: name over company and email */
.v2a-account { flex-direction: column; align-items: flex-start; gap: 2px; height: auto; padding: 10px 14px; text-align: left; }
.v2a-account__sub { font-size: 12px; font-weight: 400; color: var(--text-2); }
.v2a-or { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-3); font-size: 12px; line-height: 16px; font-weight: 500; }
.v2a-or::before, .v2a-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- notices ---------- */
.v2a-note { margin: 0 0 20px; padding: 10px 12px; border-radius: 8px; font-size: 13px; line-height: 18px; background: var(--sunken); border: 1px solid var(--line); color: var(--text); }
.v2a-note--good { background: var(--good-bg); border-color: transparent; color: var(--text); }
.v2a-note--good::before { content: "✓ "; color: var(--good); font-weight: 600; }
.v2a-note--bad { background: var(--bad-bg); border-color: transparent; }

/* ---------- 6-digit code: one real field behind six cells (signed-out.js) ---------- */
.v2a-code { position: relative; }
.v2a-code .v2a-input { height: 48px; text-align: center; font: 500 20px/1 "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .3em; }
/* Kept visible but see-through (not opacity 0), so iOS and Android still offer the texted code. */
.v2a-code.is-cells .v2a-input {
  position: absolute; inset: 0; height: 100%; z-index: 1; cursor: text;
  color: transparent; caret-color: transparent; background: transparent; border-color: transparent; box-shadow: none;
}
.v2a-code.is-cells .v2a-input::selection { background: transparent; }
.v2a-cells { display: none; grid-template-columns: repeat(6, 1fr); gap: 8px; border-radius: 8px; }
.v2a-code.is-cells .v2a-cells { display: grid; }
.v2a-cell {
  height: 48px; display: grid; place-items: center; border-radius: 8px;
  background: var(--sunken); border: 1px solid var(--line-strong);
  font: 500 20px/1 "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-variant-numeric: tabular-nums;
  transition: border-color 100ms var(--ease), background-color 100ms var(--ease);
}
.v2a-cell.is-filled { background: var(--panel); border-color: var(--text-3); }
.v2a-code.has-error .v2a-cell { border-color: var(--bad); }
.v2a-code.is-cells .v2a-cell.is-next::after { content: ""; width: 1.5px; height: 22px; background: var(--text); animation: v2a-caret 1s steps(1) infinite; }
@keyframes v2a-caret { 50% { opacity: 0; } }
.v2a-resend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin-top: 20px; font-size: 13px; line-height: 18px; color: var(--text-2); }
.v2a-resend form { margin: 0; }

/* ---------- reCAPTCHA (when the site uses it) ---------- */
.v2a-recaptcha { min-height: 78px; display: flex; justify-content: center; }

/* ---------- small screens ---------- */
@media (max-width: 480px) {
  .v2a { padding-top: 40px; }
  .v2a-card { padding: 24px 20px; }
  .v2a-input { font-size: 16px; } /* iOS doesn't zoom into 16px fields */
  .v2a-cells { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .v2a-code.is-cells .v2a-cell.is-next::after { animation: none; }
}

.v2a-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Light / dark switch, top right: the icon shows the mode on screen (moon in light, sun in dark). */
.v2a-mode { position: fixed; top: 16px; right: 16px; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text-2); cursor: pointer; z-index: 2; }
.v2a-mode:hover { color: var(--text); }
.v2a-mode svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.v2a-mode-sun { display: none; }
:root[data-theme="dark"] .v2a-mode-moon { display: none; }
:root[data-theme="dark"] .v2a-mode-sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .v2a-mode-moon { display: none; }
  :root:not([data-theme="light"]) .v2a-mode-sun { display: block; }
}
