/* ============================================================================
   pages/auth.css — Batch 1: auth, onboarding and account-token screens
   ----------------------------------------------------------------------------
   Used by: /login, /register, /forgot-password, /reset-password,
   /check-your-inbox, /welcome (focus shell) and /family/invitation,
   /auditor-invitation, /account/confirm-deletion, /invitations (hybrid/app).
   Harbor tokens only (ds/tokens.css). Logical properties only.
   Breakpoints (min-width): 480 / 768 / 1024.

   Layout idea: on phones the focus pages are a plain white sheet under the
   brand bar (no card chrome, nothing competing with the form). From 480px
   the same content sits in one flat 440px card on the stone page.
   ============================================================================ */

/* ---------------------------------------------------------------------------
   1. Page frame
   --------------------------------------------------------------------------- */
.af-auth {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-width: 0;
  padding-block: var(--af-sp-2) var(--af-sp-6);
}
/* The page scripts toggle states with the `hidden` attribute; it must beat
   every display rule in this file and in the legacy global styles. */
.af-auth [hidden] { display: none !important; }
.af-auth-card {
  width: 100%;
  max-width: 440px;
  min-width: 0;
  padding: var(--af-sp-2) 0 0;
  color: var(--af-ink);
}
.af-auth-card--wide { max-width: 560px; }

/* Phones: focus pages sit directly on a white page. */
@media (max-width: 479.98px) {
  html[data-shell="focus"] body,
  html[data-shell="focus"] .main-content { background: var(--af-surface); }
  html[data-shell="focus"] .main-content { padding-block-start: var(--af-sp-4); }
  /* Token pages keep a card (they share the page with the app shell). */
  .af-auth--card .af-auth-card {
    padding: var(--af-sp-6) var(--af-sp-5);
    background: var(--af-surface);
    border: 1px solid var(--af-border);
    border-radius: var(--af-r-lg);
  }
}
@media (min-width: 480px) {
  .af-auth { padding-block: var(--af-sp-6) var(--af-sp-8); }
  .af-auth-card {
    padding: var(--af-sp-7) var(--af-sp-6) var(--af-sp-6);
    background: var(--af-surface);
    border: 1px solid var(--af-border);
    border-radius: var(--af-r-lg);
  }
}
@media (min-width: 768px) {
  .af-auth { padding-block: var(--af-sp-8) var(--af-sp-9); }
  .af-auth-card { padding: var(--af-sp-7); }
}

/* ---------------------------------------------------------------------------
   2. Heading block
   --------------------------------------------------------------------------- */
.af-auth-head { margin-block-end: var(--af-sp-6); }
.af-auth-head > h1,
.af-auth-card .af-auth-title {
  margin: 0;
  font-family: var(--af-font-display);
  font-size: var(--af-fs-2xl);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--af-ink);
  text-align: start;
}
.af-auth-sub {
  margin: var(--af-sp-2) 0 0;
  color: var(--af-ink-soft);
  font-size: var(--af-fs-md);
  line-height: 1.5;
  text-align: start;
}
/* Icon tile above a status heading (check inbox, done states). */
.af-auth-mark {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-block-end: var(--af-sp-4);
  border-radius: var(--af-r-md);
  background: var(--af-primary-soft);
  color: var(--af-primary-text);
}
.af-auth-mark svg { width: 28px; height: 28px; }
.af-auth-mark--danger { background: var(--af-danger-soft); color: var(--af-danger); }
.af-auth-mark--success { background: var(--af-success-soft); color: var(--af-success); }

/* ---------------------------------------------------------------------------
   3. Fields
   --------------------------------------------------------------------------- */
.af-auth .af-field { margin-block-start: var(--af-sp-5); }
.af-auth .af-field:first-child { margin-block-start: 0; }
.af-auth .af-field input:not([type="checkbox"]):not([type="radio"]),
.af-auth .af-field select,
.af-auth .af-field textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font-size: var(--af-fs-md);
}
/* Label row with an inline action at the inline-end ("שכחת סיסמה?"). */
.af-auth-labelrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--af-sp-3);
  margin-block-end: 2px;
}
.af-auth-labelrow > label { margin: 0; }
/* Email / code fields: LTR content, aligned with the label in RTL. */
.af-auth input[dir="ltr"] { unicode-bidi: plaintext; }
[dir="rtl"] .af-auth input[dir="ltr"] { text-align: right; }
[dir="rtl"] .af-auth input[dir="ltr"]::placeholder { text-align: right; }

/* Inline one-time code (reset-password MFA step). */
.af-auth .af-otp-inline { font-family: var(--af-font-display); font-variant-numeric: tabular-nums; letter-spacing: .24em; text-align: center; }
[dir="rtl"] .af-auth input.af-otp-inline { text-align: center; }

/* Password with show/hide toggle at the inline-end. */
.af-pw { position: relative; }
.af-auth .af-pw > input { padding-inline-end: calc(var(--af-target-min) + var(--af-sp-2)); }
.af-pw-toggle {
  position: absolute;
  inset-block: 0;
  inset-inline-end: 2px;
  margin-block: auto;
  display: grid;
  place-items: center;
  width: var(--af-target-min);
  height: var(--af-target-min);
  padding: 0;
  border: 0;
  border-radius: var(--af-r-md);
  background: transparent;
  color: var(--af-ink-soft);
  cursor: pointer;
}
.af-pw-toggle:hover { color: var(--af-ink); background: var(--af-surface-sunken); }
.af-pw-toggle:focus-visible { outline: 2px solid var(--af-focus); outline-offset: -2px; }
.af-pw-toggle svg { width: 20px; height: 20px; }
.af-pw-toggle .af-pw-hide { display: none; }
.af-pw-toggle[aria-pressed="true"] .af-pw-show { display: none; }
.af-pw-toggle[aria-pressed="true"] .af-pw-hide { display: block; }

.af-auth .af-field-hint { margin-block-start: 6px; }
.af-auth-rules {
  margin: var(--af-sp-2) 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
  color: var(--af-ink-faint);
  font-size: var(--af-fs-sm);
}
.af-auth-rules li { display: flex; align-items: center; gap: var(--af-sp-2); }
.af-auth-rules li::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
}
.af-auth-rules li.is-met { color: var(--af-success); }
.af-auth-rules li.is-met::before { background: currentColor; }

/* The form-level message under the last field (#errorMessage & co.). It keeps
   the legacy .error-message class (JS toggles .show); the Harbor look is the
   field-error line: red text with an icon, directly under the field. */
.af-auth .af-form-error {
  display: none;
  margin: var(--af-sp-3) 0 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  color: var(--af-danger);
  font-size: var(--af-fs-sm);
  font-weight: 500;
  line-height: 1.45;
}
.af-auth .af-form-error:not(:empty) {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.af-auth .af-form-error:not(:empty)::before {
  content: "!";
  flex: none;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-block-start: 2px;
  border-radius: 50%;
  background: var(--af-danger);
  color: var(--af-on-danger);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* Inline notes: info / success / warning / error panels inside the card. */
.af-auth-note {
  display: block;
  margin: 0 0 var(--af-sp-5);
  padding: var(--af-sp-3) var(--af-sp-4);
  border-radius: var(--af-r-md);
  border: 1px solid color-mix(in srgb, var(--af-info) 28%, transparent);
  background: var(--af-info-soft);
  color: var(--af-ink);
  font-size: var(--af-fs-sm);
  font-weight: 400;
  line-height: 1.5;
  box-shadow: none;
}
.af-auth-note[hidden], .af-auth-note:empty { display: none; }
.af-auth-note--success { background: var(--af-success-soft); border-color: color-mix(in srgb, var(--af-success) 30%, transparent); }
.af-auth-note--warning { background: var(--af-warning-soft); border-color: color-mix(in srgb, var(--af-warning) 30%, transparent); }
.af-auth-note--error { background: var(--af-danger-soft); border-color: color-mix(in srgb, var(--af-danger) 30%, transparent); }
.af-auth-note strong { font-weight: 600; }
.af-auth-note p { margin: 0; }
.af-auth-note p + p { margin-block-start: var(--af-sp-1); }

/* ---------------------------------------------------------------------------
   4. Actions
   --------------------------------------------------------------------------- */
.af-auth-actions {
  display: grid;
  gap: var(--af-sp-3);
  margin-block-start: var(--af-sp-6);
}
.af-auth-actions > .btn,
.af-auth-actions > .af-btn { width: 100%; }
.af-auth-actions--alt { margin-block-start: 0; }
.af-auth .btn { min-height: var(--af-control-h); }
.af-auth .btn .af-spinner { display: none; }
.af-auth .btn[aria-busy="true"] .af-spinner { display: inline-block; }

/* "או" divider between the primary and the secondary routes. */
.af-auth-or {
  display: flex;
  align-items: center;
  gap: var(--af-sp-3);
  margin: var(--af-sp-6) 0 var(--af-sp-4);
  color: var(--af-ink-faint);
  font-size: var(--af-fs-sm);
}
.af-auth-or::before,
.af-auth-or::after { content: ""; flex: 1; height: 1px; background: var(--af-border); }

.af-auth-hint {
  margin: var(--af-sp-2) 0 0;
  color: var(--af-ink-faint);
  font-size: var(--af-fs-sm);
  text-align: center;
}

.af-auth-hint--start { text-align: start; margin-block-end: 0; }

/* Text links at the bottom of the card. Each link is a 44px target. */
.af-auth-foot {
  margin-block-start: var(--af-sp-6);
  padding-block-start: var(--af-sp-4);
  border-block-start: 1px solid var(--af-border);
  display: grid;
  gap: 0;
  justify-items: center;
  color: var(--af-ink-soft);
  font-size: var(--af-fs-sm);
  text-align: center;
}
.af-auth-foot p { margin: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; column-gap: var(--af-sp-1); }
.af-auth-link,
.af-auth-foot a {
  display: inline-flex;
  align-items: center;
  min-height: var(--af-target-min);
  padding-inline: var(--af-sp-1);
  color: var(--af-primary-text);
  font-weight: 600;
  text-decoration: none;
}
.af-auth-link:hover,
.af-auth-foot a:hover { text-decoration: underline; color: var(--af-primary-text); }
.af-auth-link:focus-visible,
.af-auth-foot a:focus-visible { outline: 2px solid var(--af-focus); outline-offset: 2px; border-radius: var(--af-r-xs); }
.af-auth-labelrow .af-auth-link { font-size: var(--af-fs-sm); font-weight: 500; margin-inline-end: calc(-1 * var(--af-sp-1)); }

/* ---------------------------------------------------------------------------
   5. States: loading / empty / error / done
   --------------------------------------------------------------------------- */
.af-auth-loading {
  display: grid;
  justify-items: center;
  gap: var(--af-sp-3);
  padding-block: var(--af-sp-7);
  color: var(--af-ink-soft);
  font-size: var(--af-fs-sm);
}
.af-auth-loading .af-spinner { width: 28px; height: 28px; border-width: 3px; color: var(--af-primary); }
.af-auth-loading p { margin: 0; }
@media (prefers-reduced-motion: reduce) {
  .af-auth .af-spinner { animation-duration: 2.4s; }
}

/* Details list (invitation facts, consequences). */
.af-auth-facts {
  margin: 0 0 var(--af-sp-5);
  padding: 0;
  list-style: none;
  border: 1px solid var(--af-border);
  border-radius: var(--af-r-md);
}
.af-auth-facts > li,
.af-auth-facts > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--af-sp-3);
  min-height: 48px;
  padding: var(--af-sp-3) var(--af-sp-4);
  font-size: var(--af-fs-sm);
}
.af-auth-facts--spaced { margin-block-start: var(--af-sp-5); }
.af-auth-facts > * + * { border-block-start: 1px solid var(--af-border); }
.af-auth-facts dt, .af-auth-facts .af-k { color: var(--af-ink-soft); margin: 0; }
.af-auth-facts dd, .af-auth-facts .af-v { margin: 0; color: var(--af-ink); font-weight: 500; text-align: end; min-width: 0; overflow-wrap: anywhere; }

.af-auth-quote {
  margin: 0 0 var(--af-sp-5);
  padding: var(--af-sp-3) var(--af-sp-4);
  border-inline-start: 3px solid var(--af-primary);
  background: var(--af-surface-sunken);
  border-radius: 0 var(--af-r-sm) var(--af-r-sm) 0;
  color: var(--af-ink);
  font-size: var(--af-fs-md);
  overflow-wrap: anywhere;
}
[dir="rtl"] .af-auth-quote { border-radius: var(--af-r-sm) 0 0 var(--af-r-sm); }

.af-auth-list {
  margin: var(--af-sp-2) 0 0;
  padding-inline-start: var(--af-sp-5);
  display: grid;
  gap: var(--af-sp-2);
}
.af-auth-body { margin: 0 0 var(--af-sp-4); color: var(--af-ink-soft); line-height: 1.6; }

/* Masked / echoed e-mail: LTR isolate, never wraps mid-address. */
.af-auth-email {
  display: inline-block;
  max-width: 100%;
  direction: ltr;
  unicode-bidi: isolate;
  overflow-wrap: anywhere;
  font-weight: 600;
  color: var(--af-ink);
}

/* ---------------------------------------------------------------------------
   6. MFA step: full-screen sheet on phones, centered dialog from 768px
   --------------------------------------------------------------------------- */
.modal.af-mfa {
  position: fixed;
  inset: 0;
  z-index: var(--af-z-sheet);
  display: none;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  background: var(--af-surface);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.modal.af-mfa.active { display: flex; }
.modal.af-mfa .modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  max-height: none;
  height: 100%;
  margin: 0;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--af-surface);
  color: var(--af-ink);
  padding: calc(var(--af-safe-top) + var(--af-sp-6)) var(--af-sp-5) calc(var(--af-safe-bottom) + var(--af-sp-6));
}
.af-mfa .modal-header {
  padding: 0;
  margin: 0 0 var(--af-sp-2);
  border: 0;
  background: none;
  text-align: start;
}
.af-mfa .modal-header h2 {
  margin: 0;
  font-family: var(--af-font-display);
  font-size: var(--af-fs-2xl);
  font-weight: 600;
  color: var(--af-ink);
  text-align: start;
}
.af-mfa .modal-body { padding: 0; display: flex; flex-direction: column; flex: 1; }
.af-mfa #mfaInstructions { margin: 0 0 var(--af-sp-6); color: var(--af-ink-soft); text-align: start; line-height: 1.5; }
.af-mfa .af-otp {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 64px;
  padding-inline: var(--af-sp-4);
  font-family: var(--af-font-display);
  font-size: var(--af-fs-2xl);
  font-variant-numeric: tabular-nums;
  letter-spacing: .32em;
  text-align: center;
}
[dir="rtl"] .af-mfa .af-otp, [dir="rtl"] .af-mfa .af-otp::placeholder { text-align: center; }
.af-mfa .af-otp::placeholder { letter-spacing: .32em; color: var(--af-ink-faint); }
.af-mfa .af-otp.is-backup { letter-spacing: .08em; font-size: var(--af-fs-xl); text-transform: uppercase; }
.af-mfa .af-otp.is-backup::placeholder { letter-spacing: .08em; }

.af-mfa-trust {
  display: flex;
  align-items: center;
  gap: var(--af-sp-3);
  min-height: var(--af-target-min);
  margin-block-start: var(--af-sp-4);
  padding-block: var(--af-sp-1);
  cursor: pointer;
  color: var(--af-ink);
  font-size: var(--af-fs-md);
}
.af-mfa-trust input { flex: none; margin: 0; }
.af-mfa .af-form-error { margin-block-start: var(--af-sp-3); }
.modal.af-mfa .modal-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch; /* aurora's flex-end would shrink the track */
  gap: var(--af-sp-3);
  margin-block-start: auto;
  padding-block-start: var(--af-sp-6);
}
.modal.af-mfa .modal-actions .btn { width: 100%; }
/* Primary first in reading order on phones (thumb zone = bottom). */
.modal.af-mfa .modal-actions #mfaVerifyBtn { order: -1; }
.af-mfa .mfa-btn-spinner { display: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent; animation: afSpin .8s linear infinite; }
.af-mfa #mfaVerifyBtn[aria-busy="true"] .mfa-btn-spinner { display: inline-block; }
.af-mfa-help {
  display: grid;
  justify-items: center;
  margin-block-start: var(--af-sp-4);
  color: var(--af-ink-soft);
  font-size: var(--af-fs-sm);
  text-align: center;
}
.af-mfa-help p { margin: 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; column-gap: var(--af-sp-1); }
.af-mfa-help button.af-auth-link {
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
@media (min-width: 768px) {
  .modal.af-mfa { align-items: center; padding: var(--af-sp-6); background: var(--af-scrim); }
  .modal.af-mfa .modal-content {
    max-width: 440px;
    height: auto;
    max-height: calc(100dvh - 64px);
    padding: var(--af-sp-7);
    border: 1px solid var(--af-border);
    border-radius: var(--af-r-lg);
    box-shadow: var(--af-shadow-3);
  }
  .modal.af-mfa .modal-actions { grid-template-columns: 1fr 1fr; margin-block-start: var(--af-sp-6); padding-block-start: 0; }
  .modal.af-mfa .modal-actions #mfaVerifyBtn { order: 1; }
}

/* ---------------------------------------------------------------------------
   7. Welcome (interstitial): segmented language, choice chips, sticky submit
   --------------------------------------------------------------------------- */
.af-welcome fieldset { margin: 0 0 var(--af-sp-6); padding: 0; border: 0; min-width: 0; }
.af-welcome legend {
  padding: 0;
  margin: 0 0 var(--af-sp-3);
  font-size: var(--af-fs-md);
  font-weight: 600;
  color: var(--af-ink);
}
.af-welcome .af-field > label { font-size: var(--af-fs-sm); }
.af-welcome-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: var(--af-r-md);
  background: var(--af-surface-sunken);
}
/* `hidden` must win over the display rules above and the global select style
   (welcome.js swaps the select for the segmented control). */
.af-welcome-seg[hidden],
.af-welcome select[hidden] { display: none; }
.af-welcome-seg label {
  position: relative;
  display: grid;
  place-items: center;
  min-height: var(--af-target-min);
  border-radius: calc(var(--af-r-md) - 4px);
  color: var(--af-ink-soft);
  font-weight: 500;
  cursor: pointer;
  margin: 0;
}
.af-welcome-seg input,
.af-welcome-choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}
.af-welcome-seg label:has(input:checked) {
  background: var(--af-surface);
  color: var(--af-ink);
  font-weight: 600;
  box-shadow: var(--af-shadow-1);
}
.af-welcome-seg label:has(input:focus-visible),
.af-welcome-choice:has(input:focus-visible) { outline: 2px solid var(--af-focus); outline-offset: 2px; }
.af-welcome-choices { display: grid; gap: var(--af-sp-2); }
@media (min-width: 480px) { .af-welcome-choices { grid-template-columns: repeat(3, 1fr); } }
.af-welcome-choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--af-sp-3);
  min-height: 56px;
  padding: var(--af-sp-3) var(--af-sp-4);
  border: 1px solid var(--af-border-strong);
  border-radius: var(--af-r-md);
  background: var(--af-surface);
  color: var(--af-ink);
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--af-dur-fast) var(--af-ease), background-color var(--af-dur-fast) var(--af-ease);
}
@media (min-width: 480px) {
  .af-welcome-choice { flex-direction: column; justify-content: center; text-align: center; min-height: 96px; gap: var(--af-sp-2); }
}
.af-welcome-choice svg { flex: none; width: 24px; height: 24px; color: var(--af-ink-soft); }
.af-welcome-choice:has(input:checked) {
  border-color: var(--af-primary);
  box-shadow: 0 0 0 1px var(--af-primary);
  background: var(--af-primary-soft);
}
.af-welcome-choice:has(input:checked) svg { color: var(--af-primary-text); }
.af-welcome fieldset[aria-invalid="true"] .af-welcome-choice { border-color: var(--af-danger); }
.af-welcome-submit {
  position: sticky;
  bottom: 0;
  z-index: var(--af-z-raised);
  margin-inline: calc(-1 * var(--af-sp-5));
  padding: var(--af-sp-3) var(--af-sp-5) calc(var(--af-sp-3) + var(--af-safe-bottom));
  background: var(--af-surface);
  border-block-start: 1px solid var(--af-border);
}
.af-welcome-submit .btn { width: 100%; }
@media (min-width: 480px) {
  .af-welcome-submit { position: static; margin: var(--af-sp-2) 0 0; padding: 0; border: 0; background: none; }
}

/* ---------------------------------------------------------------------------
   8. /invitations (app shell)
   --------------------------------------------------------------------------- */
.af-inv { max-width: 1040px; margin-inline: auto; min-width: 0; }
.af-inv-head { margin-block-end: var(--af-sp-5); }
.af-inv-head h1 { margin: 0; font-family: var(--af-font-display); font-size: var(--af-fs-2xl); font-weight: 600; color: var(--af-ink); text-align: start; }
.af-inv-head p { margin: var(--af-sp-1) 0 0; color: var(--af-ink-soft); text-align: start; }
.af-inv-grid { display: grid; gap: var(--af-sp-4); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1024px) { .af-inv-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--af-sp-5); } }
.af-inv .af-card + .af-card { margin-block-start: 0; }
.af-inv-col { display: grid; gap: var(--af-sp-4); min-width: 0; }

.af-inv-quota { display: flex; align-items: center; gap: var(--af-sp-4); flex-wrap: wrap; }
.af-inv-quota-main { flex: 1 1 10rem; min-width: 0; }
.af-inv-quota-num {
  display: block;
  font-family: var(--af-font-display);
  font-size: var(--af-fs-3xl);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: var(--af-ink);
}
.af-inv-quota-label { color: var(--af-ink-soft); font-size: var(--af-fs-sm); }
.af-inv-quota-detail { margin-block-start: var(--af-sp-1); color: var(--af-ink-faint); font-size: var(--af-fs-xs); }
.af-inv-stats { display: flex; gap: var(--af-sp-2); }
.af-inv-stat {
  display: grid;
  justify-items: center;
  min-width: 4.5rem;
  padding: var(--af-sp-2) var(--af-sp-3);
  border-radius: var(--af-r-md);
  background: var(--af-surface-sunken);
}
.af-inv-stat .stat-value { font-family: var(--af-font-display); font-size: var(--af-fs-xl); font-weight: 500; font-variant-numeric: tabular-nums; color: var(--af-ink); }
.af-inv-stat .stat-label { font-size: var(--af-fs-xs); color: var(--af-ink-soft); }

.af-inv .af-field { margin-block-start: var(--af-sp-4); }
.af-inv .af-field:first-child { margin-block-start: 0; }
.af-inv .af-field :is(input, textarea) { display: block; width: 100%; box-sizing: border-box; }
.af-inv-form-actions { margin-block-start: var(--af-sp-5); }
@media (max-width: 767.98px) {
  .af-inv-form-actions .btn { width: 100%; }
}
.af-inv .af-form-error {
  display: none;
  margin: var(--af-sp-3) 0 0;
  padding: 0;
  background: none;
  border: 0;
  color: var(--af-danger);
  font-size: var(--af-fs-sm);
  font-weight: 500;
}
.af-inv .af-form-error:not(:empty) { display: block; }

/* Filter chips (role="tablist"-free toggle group; aria-pressed). */
.af-inv-filters { display: flex; gap: var(--af-sp-2); flex-wrap: wrap; margin-block-end: var(--af-sp-2); }
.af-inv .filter-tab {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 var(--af-sp-4);
  border: 1px solid var(--af-border-strong);
  border-radius: var(--af-r-pill);
  background: var(--af-surface);
  color: var(--af-ink);
  font-size: var(--af-fs-sm);
  font-weight: 500;
  cursor: pointer;
  position: relative;
}
.af-inv .filter-tab::after { content: ""; position: absolute; inset: -5px 0; z-index: 1; } /* 44px incl. the 1px border (Q1-07) */
.af-inv .filter-tab.active,
.af-inv .filter-tab[aria-pressed="true"] { background: var(--af-ink); border-color: var(--af-ink); color: var(--af-bg); }
/* Dark: the ink fill becomes a pale block; use the primary-soft pair (Q3-D6). */
:root:is([data-theme="dark"], [data-ac-contrast="dark"]) .af-inv .filter-tab:is(.active, [aria-pressed="true"]) { background: var(--af-primary-soft); border-color: var(--af-primary-text); color: var(--af-primary-text); }
.af-inv .filter-tab:focus-visible { outline: 2px solid var(--af-focus); outline-offset: 2px; }

.af-inv .invitations-list { margin-inline: calc(-1 * var(--af-sp-4)); }
@media (min-width: 1024px) { .af-inv .invitations-list { margin-inline: calc(-1 * var(--af-sp-6)); } }
.af-inv .invitation-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "info status" "actions actions";
  gap: var(--af-sp-2) var(--af-sp-3);
  align-items: start;
  min-height: var(--af-row-min-h);
  padding: var(--af-sp-3) var(--af-sp-4);
}
@media (min-width: 1024px) { .af-inv .invitation-item { padding-inline: var(--af-sp-6); } }
.af-inv .invitation-item + .invitation-item { border-block-start: 1px solid var(--af-border); }
.af-inv .invitation-info { grid-area: info; min-width: 0; }
.af-inv .invitation-email { direction: ltr; unicode-bidi: isolate; font-weight: 500; color: var(--af-ink); overflow-wrap: anywhere; text-align: start; }
[dir="rtl"] .af-inv .invitation-email { text-align: right; }
.af-inv .invitation-name { color: var(--af-ink-soft); font-size: var(--af-fs-sm); }
.af-inv .invitation-meta { margin-block-start: 2px; color: var(--af-ink-faint); font-size: var(--af-fs-xs); }
.af-inv .invitation-status { grid-area: status; }
.af-inv .invitation-actions { grid-area: actions; display: flex; gap: var(--af-sp-2); flex-wrap: wrap; }
.af-inv .invitation-actions:empty { display: none; }
.af-inv .invitation-actions .btn { min-height: var(--af-target-min); }
@media (min-width: 768px) {
  .af-inv .invitation-item { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "info status actions"; align-items: center; }
}
.af-inv .af-empty { padding: var(--af-sp-6) var(--af-sp-2); text-align: center; color: var(--af-ink-soft); }
.af-inv .af-empty p { margin: 0; }
.af-inv .af-inv-noquota-text { margin: var(--af-sp-2) 0 0; }
.af-inv .af-empty .af-auth-mark { margin-inline: auto; }
.af-inv #loadingState .btn { margin-block-start: var(--af-sp-2); }

/* ACC-4: accountant invitation - explicit permission choice (nothing pre-ticked) */
.af-auth-perms { border: 0; padding: 0; margin: var(--af-sp-3) 0; display: flex; flex-direction: column; gap: var(--af-sp-1); }
.af-auth-perms > legend { padding: 0; margin-block-end: var(--af-sp-2); }
.af-auth-check { display: flex; align-items: center; gap: var(--af-sp-2); min-height: 44px; cursor: pointer; color: var(--af-ink); }
.af-auth-check input { width: 20px; height: 20px; flex: none; }
