/* AT-251: tvåstegsverifiering. Steget i inloggningen (webben #login-form, Windows-laddaren .login-form), profilens
   avsnitt och adminens rader. Laddas av index.html och loader.html. */
.atlas-mfa-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  text-align: center;
}
.atlas-mfa-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.atlas-mfa-text {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  opacity: 0.8;
}
.atlas-mfa-panel #atlas-mfa-code {
  text-align: center;
  letter-spacing: 3px;
  font-variant-numeric: tabular-nums;
  /* Tvåstegsrutan har ingen ikon: inloggningsfältets ikonmarginal (52px, login.css) gör texten högerförskjuten.
     Lika marginal på båda sidor, +3px vänster väger upp bokstavsavståndet efter sista tecknet. */
  padding: 0 12px 0 15px !important;
}
.atlas-mfa-panel .atlas-mfa-error:empty { display: none; }
.atlas-mfa-panel .atlas-mfa-error { text-align: center; padding-inline: 0; }
.atlas-mfa-qr {
  display: block;
  align-self: center;
  width: 148px;
  height: 148px;
  padding: 6px;
  background: #fff;
  border-radius: 8px;
  image-rendering: pixelated;
}
.atlas-mfa-secret {
  margin: 0;
  font-size: 10px;
  line-height: 1.4;
  opacity: 0.85;
  word-break: break-word;
}
.atlas-mfa-secret code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  user-select: all;
}
.atlas-mfa-codes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  margin: 0;
  padding: 8px 10px;
  list-style: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  user-select: all;
}
.atlas-mfa-code-box { position: relative; border: 1px solid rgba(127, 127, 127, .35); border-radius: 8px; padding-bottom: 28px; }
.atlas-mfa-key-line { display: flex; align-items: center; justify-content: center; gap: 6px; max-width: 100%; }
html body button.atlas-mfa-copy-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 28px; height: 28px; min-width: 28px; margin: 0; padding: 4px; background: transparent; border: none; border-radius: 0; color: var(--text-primary, inherit); box-shadow: none; cursor: pointer; }
html body button.atlas-mfa-copy-icon:hover { color: var(--accent-primary, currentColor); background: transparent; }
html body button.atlas-mfa-copy-icon:focus-visible { outline: 2px solid var(--accent-primary, currentColor); outline-offset: 2px; }
.atlas-mfa-code-box > .atlas-mfa-copy-icon { position: absolute; right: 4px; bottom: 4px; }
/* Samma färgpar som inloggningens .ln-btn (login.css), oberoende av profilfärgen. */
html body button.atlas-mfa-primary,
html body #atlas-profile-modal button.atlas-mfa-primary { width: 100%; max-width: 240px; min-height: 36px; box-sizing: border-box; padding: 8px 14px; border: none; border-radius: 10px; background: linear-gradient(135deg, #00b89d, #00d4b4) !important; color: #040d12 !important; font-weight: 700; cursor: pointer; }
/* Punkt 6 (Patrik 11-17): .btn-glass-small (flex-start nedan) vann tidigare med samma specificitet. */
html body .atlas-mfa-profile .atlas-mfa-primary { align-self: center; }
html body button.atlas-mfa-primary:hover { opacity: .88; }
.atlas-mfa-link {
  background: none;
  border: none;
  color: inherit;
  font-size: var(--text-micro-size, 11px);
  opacity: var(--text-help-opacity, 0.7);
  cursor: pointer;
  padding: 2px;
}
.atlas-mfa-link:hover { opacity: 1; text-decoration: underline; }

/* Windows-laddaren (300 x 500), body.atlas-mfa-active sätts av loader.js. Kodsteget behåller loggan, rubrikerna och
   Byt företag på samma plats som inloggningen (livedesignrunda 2, Patrik 11-18, L4); bara förloppet göms. När tvåsteg
   slås på första gången (atlas-mfa-setup) göms även loggan och rubrikerna, så att QR-koden, fältet och knappen ryms. */
body.atlas-mfa-setup .card > .logo-wrap,
body.atlas-mfa-setup .card > .app-name,
body.atlas-mfa-setup .card > .tagline,
body.atlas-mfa-setup .card > .loader-company-name,
body.atlas-mfa-setup .card > .login-hint,
body.atlas-mfa-setup .card > .progress-track,
body.atlas-mfa-setup .card > .status-text,
body.atlas-mfa-setup .card > .dot-row { display: none !important; }
/* Kodsteget: förloppet osynligt men kvar i flödet, så att loggans storlek och Byt företag står exakt som i inloggningen. */
body.atlas-mfa-active:not(.atlas-mfa-setup) .card > .progress-track,
body.atlas-mfa-active:not(.atlas-mfa-setup) .card > .status-text,
body.atlas-mfa-active:not(.atlas-mfa-setup) .card > .dot-row { visibility: hidden !important; }
body.atlas-mfa-active .atlas-mfa-qr { width: 128px; height: 128px; }
body.atlas-mfa-active .atlas-mfa-codes { font-size: 11px; gap: 3px 8px; }
body.atlas-mfa-active .atlas-mfa-secret { gap: 3px; }
body.atlas-mfa-active .atlas-mfa-panel { gap: 6px; }

/* Profilen och adminen */
.atlas-mfa-profile { display: flex; flex-direction: column; gap: 8px; }
.atlas-mfa-profile .atlas-mfa-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.atlas-mfa-profile .atlas-mfa-row input:not([type="checkbox"]) { flex: 1 1 140px; min-width: 0; }
.atlas-mfa-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; white-space: nowrap; cursor: pointer; }
.atlas-mfa-profile input.atlas-mfa-checkbox {
  appearance: auto;
  -webkit-appearance: checkbox;
  width: 16px;
  height: 16px;
  min-width: 16px;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  accent-color: var(--accent-primary, #0071e3);
}
.atlas-mfa-admin-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.atlas-mfa-admin-row .atlas-mfa-note { flex: 1 1 auto; }
.atlas-mfa-profile .atlas-mfa-panel { text-align: left; }
.atlas-mfa-profile .atlas-mfa-qr { align-self: center; margin-inline: auto; }
.atlas-mfa-status-on { color: var(--success-text, #30d158); font-weight: 700; }
.atlas-mfa-status-off { opacity: 0.75; }
.atlas-mfa-note { margin: 0; font-size: 11px; opacity: 0.75; }
.atlas-mfa-message { margin: 0; font-size: 11px; }
.atlas-mfa-message:empty { display: none; }
.atlas-mfa-message.is-error { color: #ff453a; }
.atlas-mfa-login-notice { margin: 8px 0; color: inherit; font-size: 11px; line-height: 1.45; text-align: center; }
.atlas-mfa-profile [hidden] { display: none; }
.atlas-mfa-profile form { margin: 0; }
.atlas-mfa-profile .btn-glass-small { align-self: flex-start; }
.atlas-mfa-secret { display: flex; flex-direction: column; align-items: center; gap: 8px; }
html body #view-admin #agent-detail-mfa-btn[data-mfa-state="on"] { color: var(--success-text, #30d158) !important; }
html body #view-admin #agent-detail-mfa-btn[data-mfa-state="on"] svg { stroke: currentColor !important; }
html body #view-admin #agent-detail-mfa-btn[aria-expanded="true"] { background: transparent !important; box-shadow: none !important; }
.atlas-mfa-user-icon[data-mfa-state="off"] { color: var(--text-secondary); opacity: .5; }
.atlas-mfa-confirm-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.atlas-mfa-confirm-row input { min-width: 0; max-width: 220px; }
#view-admin .atlas-mfa-confirm-row input[data-mfa-reset-password] { min-width: min(100%, 126px) !important; }
#view-admin .atlas-mfa-confirm-row input[data-mfa-reset-code] { min-width: min(100%, 190px) !important; }
html body .atlas-mfa-setting [hidden] { display: none !important; }
html body .atlas-mfa-profile p { margin-block: 0; }
html body .atlas-mfa-profile .atlas-segment.atlas-segment--toggle { align-self: flex-start; }
/* Punkt 5 (Patrik 11-17): profilens Aktivera/Bekräfta/Avbryt som ramlösa ikoner bredvid varandra, ingen textknapp. */
html body button.atlas-mfa-icon-action { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 30px; height: 30px; min-width: 30px; margin: 0; padding: 4px; background: transparent !important; border: none !important; border-radius: 0; box-shadow: none !important; color: var(--text-primary, inherit); cursor: pointer; }
html body button.atlas-mfa-icon-action svg { width: 20px; height: 20px; stroke: currentColor; }
html body button.atlas-mfa-icon-action[data-tone="ok"] { color: var(--success-text, #30d158); }
html body button.atlas-mfa-icon-action[data-tone="cancel"] { color: #ff453a; }
html body button.atlas-mfa-icon-action:hover:not(:disabled) { opacity: .75; }
html body button.atlas-mfa-icon-action:disabled { opacity: .4; cursor: default; }
html body button.atlas-mfa-icon-action:focus-visible { outline: 2px solid var(--accent-primary, currentColor); outline-offset: 2px; }
.atlas-mfa-profile .atlas-mfa-action-row { flex-wrap: nowrap; gap: 6px; }
.atlas-mfa-profile .atlas-mfa-action-row input { flex: 1 1 auto !important; min-width: 0; margin: 0; }
/* Punkt 2 och 3 (Patrik 11-17): enheten efter raderingens månadsfält; företagskravets förklaring under den ramade raden. */
html body .ticket-retention-unit { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
html body .ticket-retention-unit[hidden] { display: none !important; }
html body .atlas-mfa-profile p.atlas-mfa-policy-help { margin: -14px 0 18px 0; font-size: var(--text-micro-size, 11px); color: var(--text-secondary); opacity: var(--text-help-opacity, .7); }
html body .atlas-mfa-policy-count { white-space: nowrap; }
/* Laddaren: felraden tar plats även tom (som inloggningens), så att loggan och Byt företag inte hoppar när ett fel visas. */
body.atlas-mfa-active:not(.atlas-mfa-setup) .atlas-mfa-panel .atlas-mfa-error:empty { display: block; visibility: hidden; }
/* Laddaren i mörka teman: steget ärvde svart text från body. Kortets egen textfärg gäller (livedesignrunda 2). */
body.atlas-mfa-active .card .atlas-mfa-panel { color: var(--loader-text, inherit); }
