/*
 * AFX Auth Screens sign-in (AFX Partners). Ported from the Hub web kit theme (afx-auth-theme.css): the design's
 * surfaces as scoped --auth-* variables, defined once here; rules below use var(--auth-*) only.
 * Dark surfaces are the design's values. Light values are derived (INFERRED, not drawn in the design) and follow
 * the site theme toggle or the OS. Accent is AFX yellow, mirroring afx-brand-system/tokens.json primary.
 * Logical properties only, so RTL needs no extra rules.
 */
.afx-auth {
  --auth-focus-w: 2px;
  --auth-touch: 44px;
  --auth-radius-field: 12px;
  --auth-radius-pill: 9999px;
  --auth-bg: #10141a;
  --auth-surface-2: #1e242c;
  --auth-border: #303a46;
  --auth-text: #ffffff;
  --auth-text-2: #94a3b8;
  --auth-text-3: #8191a5;
  --auth-demo-bg: #382c1d;
  --auth-demo-text: #f4b860;
  --auth-danger: #ff8f88;
  --auth-accent: #fac819;
  --auth-accent-fg: #000000;
  --auth-accent-text: #fac819;
  --auth-focus: var(--auth-accent-text);
  box-sizing: border-box;
  display: flex;
  min-block-size: calc(100vh - 220px);
  margin-block: -8px;
  border-radius: 20px;
  background: var(--auth-bg);
  color: var(--auth-text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
.afx-auth *, .afx-auth *::before, .afx-auth *::after { box-sizing: border-box; }
:root[data-theme="light"] .afx-auth {
  --auth-bg: #f7f5ed; --auth-surface-2: #ffffff; --auth-border: #d9d4c8; --auth-text: #17140f;
  --auth-text-2: #54504a; --auth-text-3: #6b665c; --auth-demo-bg: #fbe9cc; --auth-demo-text: #7a4a07;
  --auth-danger: #b3261e; --auth-accent-fg: #241a03; --auth-accent-text: #7a5410;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .afx-auth {
    --auth-bg: #f7f5ed; --auth-surface-2: #ffffff; --auth-border: #d9d4c8; --auth-text: #17140f;
    --auth-text-2: #54504a; --auth-text-3: #6b665c; --auth-demo-bg: #fbe9cc; --auth-demo-text: #7a4a07;
    --auth-danger: #b3261e; --auth-accent-fg: #241a03; --auth-accent-text: #7a5410;
  }
}
@media (prefers-contrast: more) {
  .afx-auth { --auth-focus-w: 3px; --auth-border: var(--auth-text-2); --auth-text-3: var(--auth-text-2); }
}

.afx-auth__pane {
  flex: 0 1 560px; inline-size: 100%; max-inline-size: 560px; margin-inline: auto;
  padding-block: 38px 24px; padding-inline: 16px;
  display: flex; flex-direction: column; align-items: stretch; gap: 18px; text-align: center;
}
@media (min-width: 960px) { .afx-auth__pane { padding-inline: 52px; } }

.afx-auth h1, .afx-auth h2, .afx-auth p { margin: 0; font-family: inherit; }
.afx-auth h1 { font-size: 1.875rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1.2; }
.afx-auth__wordmark { display: flex; justify-content: center; }
.afx-auth__wordmark-text { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.afx-auth__headline { display: flex; flex-direction: column; gap: 8px; }
.afx-auth__headline p, .afx-auth__helper, .afx-auth__statement, .afx-auth__links, .afx-auth__trust { color: var(--auth-text-2); }
.afx-auth__helper { font-size: 0.8125rem; line-height: 1.5; margin-block-start: 8px; }
.afx-auth__statement { font-size: 0.75rem; line-height: 1.5; }
.afx-auth__legal { font-size: 0.6875rem; line-height: 1.6; color: var(--auth-text-3); }
.afx-auth__brand { color: var(--auth-accent-text); font-weight: 600; text-decoration: none; }
.afx-auth__trust { display: flex; justify-content: center; align-items: center; gap: 8px; font-size: 0.75rem; }
.afx-auth__overline { color: var(--auth-text-2); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.11em; text-transform: uppercase; }

.afx-auth button, .afx-auth input { font: inherit; }
.afx-auth button { min-block-size: var(--auth-touch); border-radius: var(--auth-radius-field); cursor: pointer; transform: none; }
.afx-auth button:disabled { opacity: 0.55; cursor: not-allowed; }
.afx-auth button:focus-visible, .afx-auth a:focus-visible, .afx-auth input:focus-visible, .afx-auth [tabindex="-1"]:focus-visible {
  outline: var(--auth-focus-w) solid var(--auth-focus); outline-offset: 2px;
}

.afx-auth__primary, .afx-auth__submit {
  display: inline-flex; align-items: center; justify-content: center; inline-size: 100%; min-block-size: 48px;
  border: 1px solid var(--auth-accent); border-radius: var(--auth-radius-field);
  background: var(--auth-accent); color: var(--auth-accent-fg);
  font-weight: 600; text-decoration: none; transition: filter 120ms ease;
}
.afx-auth__primary:hover, .afx-auth__submit:hover:not(:disabled) { filter: brightness(1.06); }
.afx-auth__primary[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; pointer-events: none; }
.afx-auth__primary[aria-busy="true"], .afx-auth__submit[aria-busy="true"] { cursor: progress; }
.afx-auth__divider { display: flex; align-items: center; gap: 14px; min-block-size: 24px; color: var(--auth-text-2); font-size: 0.75rem; }
.afx-auth__divider::before, .afx-auth__divider::after { content: ""; flex: 1; border-block-start: 1px solid var(--auth-border); }

.afx-auth__notice { padding: 10px 12px; border: 1px solid var(--auth-border); border-radius: var(--auth-radius-field); font-size: 0.875rem; text-align: start; }
.afx-auth__notice--offline { border-color: var(--auth-demo-text); background: var(--auth-demo-bg); color: var(--auth-demo-text); }
.afx-auth__error-summary { padding: 10px 14px; border: 1px solid var(--auth-danger); border-radius: var(--auth-radius-field); color: var(--auth-danger); font-size: 0.8125rem; text-align: start; }
.afx-auth__error-summary ul { margin: 6px 0 0; padding-inline-start: 18px; }
.afx-auth__error-summary a { color: inherit; text-decoration: underline; }
.afx-auth__field-error { margin-block-start: 6px; padding-inline: 4px; color: var(--auth-danger); font-size: 0.75rem; text-align: start; }

.afx-auth__form { display: flex; flex-direction: column; gap: 20px; padding-block-start: 8px; }
.afx-auth__form .afx-auth__helper { margin-block-start: 0; }
.afx-auth__form .afx-auth__overline { text-align: start; }
.afx-auth__field {
  position: relative; display: flex; align-items: center; min-block-size: 56px; padding-inline: 16px;
  border: 1px solid var(--auth-border); border-radius: var(--auth-radius-field); background: var(--auth-bg);
}
.afx-auth__field:focus-within { border-color: var(--auth-accent-text); box-shadow: 0 0 0 1px var(--auth-accent-text); }
.afx-auth__field[data-invalid="true"] { border-color: var(--auth-danger); box-shadow: 0 0 0 1px var(--auth-danger); }
.afx-auth__field input {
  flex: 1; min-inline-size: 0; min-block-size: var(--auth-touch); margin: 0; padding: 0; border: 0; border-radius: 0;
  background: transparent; color: var(--auth-text); font-size: 0.875rem; text-align: start; box-shadow: none;
}
.afx-auth__field input::placeholder { color: var(--auth-text-3); }
.afx-auth__field input:focus-visible { outline: none; }
.afx-auth__field label {
  position: absolute; inset-inline-start: 11px; inset-block-start: -9px; display: block; padding-inline: 4px;
  background: var(--auth-bg); color: var(--auth-text-2); font-size: 0.6875rem;
}
.afx-auth__field:focus-within label { color: var(--auth-accent-text); }
.afx-auth__field[data-invalid="true"] label { color: var(--auth-danger); }

.afx-auth__links { display: flex; justify-content: center; align-items: center; gap: 4px; font-size: 0.8125rem; }
.afx-auth__links a { display: inline-flex; align-items: center; min-block-size: var(--auth-touch); padding-inline: 8px; color: inherit; }

@media (prefers-reduced-motion: reduce) {
  .afx-auth *, .afx-auth *::before, .afx-auth *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Demo persona picker (shown only when the server reports demo on). */
.afx-auth__demo { display: grid; gap: 0.5rem; }
.afx-auth__secondary { min-block-size: var(--auth-touch); border-radius: 0.5rem; border: 1px solid var(--auth-border); background: var(--auth-surface-2); color: var(--auth-text); font: inherit; font-weight: 600; cursor: pointer; }
.afx-auth__secondary:focus-visible, .afx-auth__persona:focus-visible { outline: 2px solid var(--auth-text); outline-offset: 2px; }
.afx-auth__personas { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.afx-auth__persona { inline-size: 100%; min-block-size: var(--auth-touch); display: grid; gap: 0.125rem; text-align: start; padding-block: 0.5rem; padding-inline: 0.75rem; border-radius: 0.5rem; border: 1px solid var(--auth-border); background: var(--auth-surface-2); color: var(--auth-text); font: inherit; cursor: pointer; }
.afx-auth__persona span { font-size: 0.8125rem; color: var(--auth-text-2); }
