/* FLUXBOT chat app: 2-step login — Settings → Account section (#twofaMount) and the #twofaModal wizard. Owner: E6.
   Prefix: .tfa-*. Dark + light themes through the style.css tokens; the QR code stays black on white in both (scanners
   need the contrast). No animation of its own (the shared spinner stops under prefers-reduced-motion); 360 px and up. */

/* the section (alone in #twofaMount, so the shared .section:first-child / :last-child rules must not strip its spacing) */
#twofaMount > .tfa-section { padding: 14px 0; border-bottom: 1px solid var(--border); }
.tfa-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.tfa-head h3 { margin-bottom: 0; }
.tfa-section .hint { margin-top: 4px; }
.tfa-chip-warn { background: rgba(245, 158, 11, 0.16); color: #b45309; }
[data-theme="dark"] .tfa-chip-warn { color: #fbbf24; }
.tfa-status { font-size: 14px; line-height: 1.5; margin: 6px 0 12px; color: var(--muted); }
.tfa-status .tfa-on { color: var(--text); font-weight: 600; }
.tfa-status.low .tfa-low, .tfa-status.low span:nth-child(2) { color: #b45309; }
[data-theme="dark"] .tfa-status.low .tfa-low, [data-theme="dark"] .tfa-status.low span:nth-child(2) { color: #fbbf24; }
.tfa-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tfa-acts .btn svg { width: 16px; height: 16px; flex: none; }
.tfa-note { font-size: 12.5px; color: var(--dim); }
.tfa-off-btn:hover { color: var(--danger); border-color: var(--danger); }

/* the wizard */
.tfa-modal-bg { z-index: 71; } /* above Settings, which it opens from */
.tfa-modal .modal-head .icon-btn[hidden] { display: none; }
.tfa-body { display: grid; gap: 12px; }
.tfa-lead { font-size: 15px; font-weight: 600; line-height: 1.4; margin: 0; color: var(--text); }
.tfa-hint { font-size: 13px; line-height: 1.5; color: var(--dim); margin: 0; }
.tfa-intro { margin: 0; }
.tfa-field .field-label { margin-bottom: 6px; }
.tfa-field[hidden] { display: none; }
.tfa-msg { margin: 0; }
.tfa-msg:empty { display: none; }
.tfa-foot { flex-wrap: wrap; }
.tfa-foot .btn[aria-busy="true"] { cursor: progress; }

.tfa-qr {
  width: 232px; height: 232px; margin: 2px auto; padding: 12px; border-radius: 16px; background: #fff;
  display: grid; place-items: center; box-shadow: 0 0 0 1px var(--border-strong);
}
.tfa-qr svg { width: 208px; height: 208px; display: block; }
.tfa-qr .spinner { border-color: rgba(0, 0, 0, 0.18); border-top-color: #0a1428; }
.tfa-qr.failed { background: var(--surface); color: var(--muted); font-size: 13px; line-height: 1.5; text-align: center; padding: 18px; height: auto; min-height: 120px; }
.tfa-keylabel { margin-top: 2px; }
.tfa-keyrow { display: flex; align-items: center; gap: 8px; }
.tfa-key {
  flex: 1; min-width: 0; font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px;
  letter-spacing: .04em; line-height: 1.5; padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border);
  color: var(--text); overflow-wrap: anywhere; user-select: all; -webkit-user-select: all;
}
.tfa-copy svg, .tfa-openapp svg, .tfa-acts .btn-sm svg { width: 15px; height: 15px; }
.tfa-openapp { justify-self: start; text-decoration: none; color: var(--text); }

.tfa-code {
  font-size: 20px; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; height: 52px;
}

.tfa-codes {
  list-style: none; margin: 0; padding: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--border);
}
.tfa-codes code {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14.5px; letter-spacing: .03em;
  color: var(--text); user-select: all; -webkit-user-select: all;
}
.tfa-check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; cursor: pointer; padding: 4px 0; }
.tfa-check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }

.tfa-link {
  font-size: 13px; color: var(--accent); background: none; border: 0; padding: 2px 0; cursor: pointer;
  text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px;
}
.tfa-link:hover { text-decoration-color: currentColor; }
.tfa-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

@media (max-width: 420px) {
  .tfa-codes { grid-template-columns: minmax(0, 1fr); }
  .tfa-foot .btn { flex: 1 1 auto; }
  .tfa-keyrow { flex-direction: column; align-items: stretch; }
  .tfa-qr { width: 216px; height: 216px; padding: 8px; }
  .tfa-qr svg { width: 200px; height: 200px; }
}
@media (forced-colors: active) {
  .tfa-qr { forced-color-adjust: none; }
}
