/* Auth + account area (login, register, MFA, reset, onboarding, settings, company, team).
   Tokens only; dark mode is a token swap; logical properties only. See docs/DESIGN.md. */

/* ---------- Auth card (on the shared .auth-wrap wash) ---------- */
.auth-card { --bs-card-spacer-x: clamp(20px, 5vw, 32px); --bs-card-spacer-y: clamp(20px, 5vw, 32px); }
.auth-wrap > .auth-card-wide, .auth-wrap > .auth-col { max-inline-size: 680px; }
.auth-wrap > .auth-col { margin-inline: auto; }
.auth-col > .card { border-radius: var(--tk-r-lg); box-shadow: var(--tk-shadow-2); }

.auth-head { display: grid; gap: 6px; margin-block-end: 24px; }
.auth-head h1 { font-size: 1.625rem; line-height: 1.2; font-weight: 700; margin: 0; text-wrap: balance; }
:not([dir="rtl"]) > body .auth-head h1 { letter-spacing: -.02em; }
[dir="rtl"] .auth-head h1 { line-height: 1.45; }
.auth-head p { color: var(--tk-ink-2); margin: 0; }
.auth-icon, .acct-icon { display: grid; place-items: center; flex: none; border-radius: 50%; background: var(--tk-accent-soft); color: var(--tk-accent-ink); }
.auth-icon { inline-size: 48px; block-size: 48px; font-size: 1.375rem; margin-block-end: 8px; }

.auth-form { display: grid; gap: 16px; }
.auth-form > * { margin-block-end: 0 !important; min-inline-size: 0; }
.auth-form > .btn { margin-block-start: 4px; min-block-size: 48px; }
.auth-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.auth-label-row a { font-size: .875rem; }

.auth-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; margin-block-start: 24px; padding-block-start: 16px; border-block-start: 1px solid var(--tk-border); font-size: .875rem; color: var(--tk-ink-2); }
.auth-foot a, .auth-label-row a { display: inline-block; padding-block: 4px; }
.auth-email { display: inline-block; max-inline-size: 100%; padding: 6px 12px; border-radius: var(--tk-r-sm); background: var(--tk-surface-2); font-weight: 600; overflow-wrap: anywhere; }
.auth-buttons { display: grid; gap: 8px; }
@media (pointer: coarse) { .auth-foot a, .auth-label-row a { padding-block: 12px; } .auth-foot { padding-block-start: 4px; } .acct-steps summary { min-block-size: var(--tk-touch); align-content: center; } }

/* Company-type choice: the whole card is the radio's hit area */
.auth-choices { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.auth-choice { position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: 2px 12px; align-items: start; padding: 14px; min-block-size: var(--tk-touch);
  border: 1px solid var(--tk-border-strong); border-radius: var(--tk-r-md); background: var(--tk-surface); }
.auth-choice .form-check-input { margin: 2px 0 0; float: none; }
.auth-choice label { font-weight: 600; color: var(--tk-ink); }
.auth-choice label::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }   /* stretch the label over the card */
.auth-choice > .bi { grid-column: 3; grid-row: 1; line-height: 1.2; font-size: 1.25rem; color: var(--tk-ink-3); }
.auth-choice small { grid-column: 2; font-size: .875rem; color: var(--tk-ink-2); }
.auth-choice:has(:checked) { border-color: var(--tk-accent); background: var(--tk-accent-soft); box-shadow: inset 0 0 0 1px var(--tk-accent); }
.auth-choice:has(:checked) > .bi { color: var(--tk-accent-ink); }
.auth-choice:has(:focus-visible) { outline: 3px solid var(--tk-focus); outline-offset: 2px; }
.auth-choice .form-check-input:focus-visible { outline: 0; }
@media (hover: hover) { .auth-choice:hover { background: var(--tk-surface-2); } .auth-choice:has(:checked):hover { background: var(--tk-accent-soft); } }

.auth-fieldset { border: 0; padding: 0; margin: 0; min-inline-size: 0; }
.auth-fieldset > legend, .acct-panel > legend { float: none; inline-size: auto; font-size: .875rem; font-weight: 600; color: var(--tk-ink); margin-block-end: 8px; padding: 0; }

/* Policy acceptance panel */
.auth-policies { border: 0; margin: 0; padding: 16px; border-radius: var(--tk-r-md); background: var(--tk-surface-2); min-inline-size: 0; }
.auth-policies > legend { font-size: .875rem; font-weight: 600; color: var(--tk-ink); padding: 0; margin-block-end: 4px; }
.auth-policies > p { font-size: .875rem; color: var(--tk-ink-2); margin-block-end: 8px; }
.auth-policies .form-check { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; margin: 0; border-block-start: 1px solid var(--tk-border); }
.auth-policies .form-check-input { flex: none; float: none; margin: 2px 0 0; }
.auth-policies .form-check-label { color: var(--tk-ink); }
.auth-policies .auth-version { display: block; font-size: .875rem; color: var(--tk-ink-3); }

/* ---------- Account pages (inside the app shell) ---------- */
.acct-narrow { max-inline-size: 520px !important; }
.acct-medium { max-inline-size: 760px !important; }
.acct-stack { display: grid; gap: 20px; align-content: start; }
.acct-stack > * { min-inline-size: 0; }
.acct-cols { display: grid; gap: 20px; align-items: start; }
.acct-cols > * { min-inline-size: 0; }
@media (min-width: 992px) {
  .acct-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .acct-cols-rail { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .acct-rail { position: sticky; inset-block-start: calc(var(--tk-topbar-h) + 24px); }
}
@media (max-width: 991.98px) { .acct-rail { order: -1; } }   /* status and documents first on phones */

.acct-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; margin-block-end: 16px; }
.acct-icon { inline-size: 36px; block-size: 36px; font-size: 1.0625rem; }
.acct-icon.is-sky { background: var(--tk-sky-soft); color: var(--tk-sky-ink); }
.acct-icon.is-ok { background: var(--tk-success-soft); color: var(--tk-success-ink); }
.acct-icon.is-warn { background: var(--tk-warning-soft); color: var(--tk-warning-ink); }
.acct-icon.is-neutral { background: var(--tk-neutral-soft); color: var(--tk-neutral-ink); }
.acct-head > div { flex: 1 1 9rem; min-inline-size: 0; }   /* a long action wraps under the title instead of overflowing */
.acct-head h2 { font-size: 1.125rem; line-height: 1.35; font-weight: 600; margin: 0; padding-block-start: 5px; }
[dir="rtl"] .acct-head h2 { font-size: 1.1875rem; line-height: 1.55; padding-block-start: 2px; }
.acct-head p { font-size: .875rem; color: var(--tk-ink-2); margin: 2px 0 0; }
.acct-head > .btn, .acct-head > form { flex: none; }
.acct-sub { font-size: 1rem; font-weight: 600; margin-block: 0 12px; }
.acct-divider { border: 0; block-size: 1px; background: var(--tk-border); opacity: 1; margin-block: 20px; }
.acct-help { font-size: .875rem; color: var(--tk-ink-3); }

/* label / value rows */
.acct-dl { display: grid; margin: 0; }
.acct-dl > div { display: grid; gap: 2px 16px; padding-block: 10px; border-block-start: 1px solid var(--tk-border); }
.acct-dl > div:first-child { border-block-start: 0; padding-block-start: 0; }
.acct-dl > div:last-child { padding-block-end: 0; }
.acct-dl dt { font-size: .875rem; font-weight: 500; color: var(--tk-ink-3); }
.acct-dl dd { margin: 0; color: var(--tk-ink); overflow-wrap: anywhere; }
@media (min-width: 576px) { .acct-dl > div { grid-template-columns: minmax(120px, 34%) 1fr; } }

/* status row inside a card (two-step verification, connections) */
.acct-row { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; padding: 12px 14px; border-radius: var(--tk-r-md); background: var(--tk-surface-2); }
.acct-row > .acct-row-text { flex: 1 1 12rem; min-inline-size: 0; font-size: .875rem; color: var(--tk-ink-2); }
.acct-row-text strong { display: block; font-size: 1rem; font-weight: 600; color: var(--tk-ink); }

/* simple lists: documents, invitations, privacy requests */
.acct-list { list-style: none; margin: 0; padding: 0; }
.acct-list > li { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: space-between; padding-block: 12px; border-block-start: 1px solid var(--tk-border); }
.acct-list > li:first-child { border-block-start: 0; padding-block-start: 0; }
.acct-list .acct-item { flex: 1 1 12rem; min-inline-size: 0; overflow-wrap: anywhere; }
.acct-list .acct-meta, .acct-meta { display: block; font-size: .875rem; color: var(--tk-ink-3); }
.acct-list + form, .acct-list + .acct-sub { margin-block-start: 20px; }

/* private-data panel: quiet tinted box with a lock */
.acct-panel { border: 0; margin: 0; padding: 16px; border-radius: var(--tk-r-md); background: var(--tk-surface-2); min-inline-size: 0; }
/* tinted fieldsets: a floated legend sits inside the box instead of straddling its top edge */
.auth-policies > legend, .acct-panel > legend { float: inline-start; inline-size: 100%; }
.auth-policies > legend + *, .acct-panel > legend + * { clear: both; }
.acct-panel > legend .bi { color: var(--tk-ink-3); margin-inline-end: 4px; }
.acct-note { display: flex; gap: 8px; align-items: flex-start; font-size: .875rem; color: var(--tk-warning-ink); margin: 16px 0 0; }
.acct-note .bi { color: var(--tk-warning); }

/* action bar that bleeds to the card edges; sticky comes from the shared .form-actions-sticky */
.acct-actions { margin-inline: calc(var(--bs-card-spacer-x) * -1); margin-block-end: calc(var(--bs-card-spacer-y) * -1); padding-inline: var(--bs-card-spacer-x);
  border-end-start-radius: var(--bs-card-inner-border-radius); border-end-end-radius: var(--bs-card-inner-border-radius); }
.acct-actions .btn-primary { margin-inline-start: auto; }
@media (max-width: 575.98px) { .acct-actions { flex-wrap: nowrap; } .acct-actions .btn { flex: 1 1 auto; min-inline-size: 0; padding-inline: 12px; min-block-size: 48px; align-content: center; } .acct-actions .btn-outline-secondary { flex: 0 0 auto; }   /* Previous + primary stay on one row */ .acct-btn { inline-size: 100%; min-block-size: 48px; } }

/* member / device cell */
.acct-who { display: flex; gap: 10px; align-items: center; min-inline-size: 0; }
.acct-who > .bi { flex: none; font-size: 1.125rem; color: var(--tk-ink-3); }
.acct-avatar { display: grid; place-items: center; flex: none; inline-size: 32px; block-size: 32px; border-radius: 50%; background: var(--tk-sky-soft); color: var(--tk-sky-ink); font-size: .875rem; font-weight: 600; }
.acct-ua { overflow-wrap: anywhere; }
@media (max-width: 639.98px) {
  /* stacked tables: first cell is the card title, action cell spans the row */
  .acct-table[data-stack] tr { padding: 12px 0; }
  .acct-table[data-stack] tr:last-child { border-block-end: 0; padding-block-end: 0; }
  .acct-table[data-stack] td { padding-inline: 0; }
  .acct-table[data-stack] td:first-child { justify-content: flex-start; text-align: start; font-weight: 600; }
  .acct-table[data-stack] td:first-child::before, .acct-table[data-stack] td:last-child::before { content: none; }
  .acct-table[data-stack] td:last-child:empty { display: none; }
  .acct-table[data-stack] td:last-child form, .acct-table[data-stack] td:last-child .btn { inline-size: 100%; }
}

/* two-step verification set-up */
.acct-steps { list-style: none; counter-reset: acct; margin: 0 0 20px; padding: 0; display: grid; gap: 16px; }
.acct-steps > li { counter-increment: acct; position: relative; padding-inline-start: 40px; min-block-size: 28px; min-inline-size: 0; }
.acct-steps > li::before { content: counter(acct); position: absolute; inset-inline-start: 0; inset-block-start: 0; inline-size: 28px; block-size: 28px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--tk-border-strong); background: var(--tk-surface); color: var(--tk-ink-2); font-size: .8125rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.acct-steps > li:not(:last-child)::after { content: ""; position: absolute; inset-inline-start: 13.5px; inset-block: 32px -12px; border-inline-start: 1px dashed var(--tk-border-strong); }
.acct-secret { margin-block: 10px 8px; padding: 14px 16px; border-radius: var(--tk-r-md); background: var(--tk-surface-2); border: 1px dashed var(--tk-border-strong); text-align: center; }
.acct-secret code { font-size: 1.125rem; font-weight: 600; color: var(--tk-ink); white-space: normal; overflow-wrap: anywhere; letter-spacing: .06em; }
.acct-steps details { font-size: .875rem; }
.acct-steps summary { color: var(--tk-accent); cursor: pointer; padding-block: 6px; }
.acct-steps details code { display: block; white-space: normal; overflow-wrap: anywhere; color: var(--tk-ink-2); }
.acct-inline-form { display: grid; gap: 12px; align-items: end; }
.acct-inline-form > * { min-inline-size: 0; }
@media (min-width: 576px) { .acct-inline-form { grid-template-columns: minmax(0, 1fr) auto; } .acct-inline-form:has(.invalid-feedback) { align-items: start; } .acct-inline-form:has(.invalid-feedback) > .btn { margin-block-start: 27px; } }

/* policy document to re-accept */
.acct-doc { max-block-size: 16rem; overflow: auto; padding: 14px 16px; margin-block-end: 16px; border-radius: var(--tk-r-sm); background: var(--tk-surface-2); border: 1px solid var(--tk-border); font-size: .875rem; color: var(--tk-ink-2); max-inline-size: none; }
.acct-doc-check { display: flex; gap: 12px; align-items: flex-start; padding: 0; margin: 0; min-block-size: var(--tk-touch); align-items: center; }
.acct-doc-check .form-check-input { flex: none; float: none; margin: 0; }

@media (forced-colors: active) { .auth-choice:has(:checked) { outline: 2px solid Highlight; } .acct-row, .acct-panel, .auth-policies, .acct-secret, .acct-doc { border: 1px solid CanvasText; } }
.acct-ua { font-weight: 400; }
