/* 二段階認証の画面の部品（会社側 mfa.html・運営側 operator/mfa.html で共用）。
   枠と、見出し・説明・ボタン・エラーはそれぞれのログイン画面の部品を使う。ここは二段階認証で増えた部品だけ。
   色と角丸は枠ごとに変数で渡す（.mfa-company / .mfa-operator）。 */
.mfa-company {
  --mfa-accent: #0F766E; --mfa-accent-dark: #0B3B36; --mfa-tint: #ecf6f4;
  --mfa-text: #212529; --mfa-sub: #5f6b6a; --mfa-line: #e3e6e8; --mfa-soft: #f7f9f9;
  --mfa-radius: 10px; --mfa-radius-btn: 1000px; --mfa-error: #ef4444;
}
.mfa-operator {
  --mfa-accent: #174e3d; --mfa-accent-dark: #0d3e2f; --mfa-tint: #edf5f0;
  --mfa-text: #142e25; --mfa-sub: #68746f; --mfa-line: #e3e9e6; --mfa-soft: #f7faf8;
  --mfa-radius: 10px; --mfa-radius-btn: 9px; --mfa-error: #a51c30;
}

#mfa-root { width: 100%; display: flex; flex-direction: column; line-break: strict; overflow-wrap: anywhere; }

/* リンクで作るボタン（既存のボタンの見た目のまま <a> でも使えるように） */
a.mfa-action { display: flex; align-items: center; justify-content: center; text-decoration: none; text-align: center; }
.mfa-operator a.mfa-action { display: block; color: #fff; }
.mfa-action[aria-disabled="true"] { opacity: .6; pointer-events: none; }

/* 下のリンク（縦に並べる） */
.mfa-links { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.mfa-operator .mfa-links { margin-top: 28px; }
.mfa-link { font-size: 14px; font-weight: 700; color: var(--mfa-accent); text-decoration: none; }
.mfa-link:hover, .mfa-links .login-link:hover { text-decoration: underline; }
.mfa-links .login-link { text-decoration: none; }

/* 運営の枠の見出し・説明（運営ログインの h1 / 説明と同じ） */
.mfa-op-title { margin: 0 0 12px; }
.mfa-op-desc { margin: 0 0 28px; }

/* お知らせ（エラーはログイン画面のエラー部品。案内はここ） */
.mfa-msg-area:empty { display: none; }
.mfa-msg { margin: 20px 0 0; line-height: 1.8; }
.mfa-alert-info {
  width: 100%; padding: 10px 14px; border-radius: 5px; font-size: 13px; font-weight: 500; text-align: center;
  color: var(--mfa-accent-dark); background: var(--mfa-tint); border: 1px solid #cfe6e0;
}
.mfa-operator .mfa-alert-info { border-radius: 6px; text-align: left; }
.mfa-company .login-error.mfa-msg { margin-bottom: 0; }

/* ── ① 方法を選ぶカード ── */
.mfa-options { display: grid; gap: 16px; }
.mfa-option { border: 1px solid var(--mfa-line); border-radius: var(--mfa-radius); padding: 20px; background: #fff; }
.mfa-option-head { display: flex; gap: 14px; align-items: flex-start; }
.mfa-option-icon {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  border-radius: 50%; background: var(--mfa-tint); color: var(--mfa-accent);
}
.mfa-option-icon svg { width: 24px; height: 24px; }
.mfa-option-title { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.5; color: var(--mfa-text); }
.mfa-option-desc { margin: 2px 0 0; font-size: 13px; line-height: 1.8; color: var(--mfa-sub); }
.mfa-option .mfa-points { margin: 14px 0 18px; }
.mfa-option-button {
  display: flex; align-items: center; justify-content: center; height: 44px; padding: 0 16px;
  border: 1px solid var(--mfa-accent); border-radius: var(--mfa-radius-btn); background: #fff;
  color: var(--mfa-accent); font-size: 14px; font-weight: 700; text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
}
.mfa-option-button:hover { background: var(--mfa-accent); color: #fff; }

/* 特徴の箇条書き（チェックつき） */
.mfa-points { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 8px; }
.mfa-points li { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.8; color: var(--mfa-text); }
.mfa-points svg { flex: none; width: 16px; height: 16px; margin-top: 4px; color: var(--mfa-accent); }

/* ── ② 認証アプリの設定（番号つきの手順） ── */
.mfa-steps { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 24px; }
.mfa-step { display: flex; gap: 14px; align-items: flex-start; }
.mfa-step-no {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  border-radius: 50%; background: var(--mfa-accent); color: #fff; font-size: 14px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.mfa-step-body { min-width: 0; flex: 1; }
.mfa-step-title { margin: 2px 0 4px; font-size: 16px; font-weight: 700; line-height: 1.5; color: var(--mfa-text); }
.mfa-step-desc { margin: 0; font-size: 13px; line-height: 1.8; color: var(--mfa-sub); }
.mfa-sublabel { margin: 16px 0 2px; font-size: 13px; font-weight: 700; line-height: 1.8; color: var(--mfa-text); }
.mfa-store-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 8px 0 0; }
.mfa-store-links a { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; color: var(--mfa-accent); text-decoration: none; }
.mfa-store-links a:hover { text-decoration: underline; }
.mfa-store-links svg, .mfa-store svg { width: 14px; height: 14px; }

.mfa-qr { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin: 12px 0 0; }
.mfa-qr-image { width: 160px; height: 160px; padding: 8px; border: 1px solid var(--mfa-line); border-radius: 8px; background: #fff; }
.mfa-qr-note { font-size: 12px; line-height: 1.8; color: var(--mfa-sub); }

.mfa-key {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px;
  padding: 10px 10px 10px 14px; border: 1px solid var(--mfa-line); border-radius: 8px; background: var(--mfa-soft);
}
.mfa-key-value {
  min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px;
  font-weight: 500; letter-spacing: .04em; line-height: 1.8; color: var(--mfa-text); word-spacing: .2em;
}
.mfa-key-value span { display: block; white-space: nowrap; }
.mfa-copy {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid var(--mfa-line); border-radius: 6px; background: #fff; color: var(--mfa-accent);
  font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.mfa-copy svg { width: 14px; height: 14px; }
.mfa-copy:hover { border-color: var(--mfa-accent); }
.mfa-copy.is-done { background: var(--mfa-tint); border-color: var(--mfa-accent); }

/* スマホ */
.mfa-stores { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.mfa-store, .mfa-open-app {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 44px; padding: 0 16px;
  border: 1px solid var(--mfa-accent); border-radius: var(--mfa-radius-btn); background: #fff;
  color: var(--mfa-accent); font-size: 14px; font-weight: 700; text-decoration: none;
}
.mfa-open-app { margin-top: 10px; background: var(--mfa-accent); color: #fff; }
.mfa-open-app svg { width: 18px; height: 18px; }
.mfa-open-app[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.mfa-meta { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 2px; font-size: 13px; line-height: 1.8; color: var(--mfa-sub); }
.mfa-meta b { color: var(--mfa-text); font-weight: 700; }

/* PC とスマホで手順を出し分ける */
.mfa-sp { display: none; }
@media (max-width: 768px) {
  .mfa-pc { display: none; }
  .mfa-sp { display: grid; }
  p.mfa-sp { display: block; }
}

/* ── ③ 6桁の入力欄 ── */
.mfa-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.mfa-fieldset legend { padding: 0; margin-bottom: 10px; }
.mfa-legend { font-size: 14px; font-weight: 700; color: #35463e; }
.mfa-code { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; max-width: 360px; }
.mfa-company .mfa-code { margin: 0 auto; }
.mfa-company .mfa-fieldset legend { width: 100%; max-width: 360px; margin-left: auto; margin-right: auto; }
#mfa-root .mfa-code-input {
  width: 100%; min-width: 0; height: 56px; padding: 0; text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 24px; font-weight: 700;
  color: var(--mfa-text); background: #fff; border: 1px solid #cccbcc; border-radius: 8px; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.mfa-operator #mfa-root .mfa-code-input { border-color: #dce3df; background: #fafcfb; min-height: 0; }
#mfa-root .mfa-code-input:focus { border-color: var(--mfa-accent); box-shadow: 0 0 0 3px rgba(15,118,110,.15); background: #fff; }
#mfa-root .mfa-code.is-error .mfa-code-input { border-color: var(--mfa-error); }
.mfa-code-form { display: flex; flex-direction: column; margin: 0; }
.mfa-company .mfa-code-form .login-submit { margin-top: 32px; }

/* ── ④⑤⑦ 注記・アイコン ── */
.mfa-note { margin: 0 0 4px; font-size: 13px; line-height: 1.8; color: var(--mfa-sub); }
.mfa-company .mfa-note { text-align: center; }
.mfa-hero-icon, .mfa-done-icon { display: flex; justify-content: center; margin: 0 auto 16px; color: var(--mfa-accent); }
.mfa-hero-icon { width: 64px; height: 64px; align-items: center; border-radius: 50%; background: var(--mfa-tint); }
.mfa-hero-icon svg { width: 32px; height: 32px; }
.mfa-done-icon svg { width: 64px; height: 64px; }
.mfa-operator .mfa-hero-icon, .mfa-operator .mfa-done-icon { margin-left: 0; }

/* ── ⑥⑦⑧ 枠つきの案内 ── */
.mfa-boxes { display: grid; gap: 12px; }
.mfa-box { padding: 16px 18px; border: 1px solid var(--mfa-line); border-radius: var(--mfa-radius); background: var(--mfa-soft); text-align: left; }
.mfa-msg + .mfa-box, #mfa-root > .mfa-box { margin-top: 20px; }
.mfa-box-title { margin: 0 0 4px; font-size: 14px; font-weight: 700; line-height: 1.6; color: var(--mfa-text); }
.mfa-box-text { margin: 0; font-size: 13px; line-height: 1.8; color: var(--mfa-sub); }
.mfa-box-label { margin: 0 0 8px; font-size: 13px; font-weight: 500; color: var(--mfa-sub); }
.mfa-current { margin-bottom: 16px; }
#mfa-root > .mfa-current { margin-top: 0; }
.mfa-current-method { display: flex; align-items: center; gap: 12px; margin: 0; font-size: 16px; font-weight: 700; color: var(--mfa-text); }
.mfa-contact { margin: 8px 0 0; font-size: 14px; font-weight: 700; }
.mfa-contact a { color: var(--mfa-accent); }

/* ── ログイン画面の「パスキーでログイン」（パスキーを使った端末だけ） ── */
.mfa-passkey-login[hidden] { display: none !important; }
.mfa-passkey-login { display: flex; flex-direction: column; width: 100%; }
.mfa-passkey-button {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 52px;
  border: 1px solid var(--mfa-accent); border-radius: var(--mfa-radius-btn); background: #fff; color: var(--mfa-accent);
  font-family: inherit; font-size: 16px; font-weight: 700; cursor: pointer;
}
.mfa-passkey-button svg { width: 22px; height: 22px; }
.mfa-passkey-button:hover { background: var(--mfa-tint); }
.mfa-passkey-button:disabled { opacity: .6; cursor: wait; }
.mfa-divider { display: flex; align-items: center; gap: 12px; margin: 30px 0; font-size: 13px; color: var(--mfa-sub); }
.mfa-divider::before, .mfa-divider::after { content: ""; flex: 1; height: 1px; background: var(--mfa-line); }
.mfa-passkey-login .mfa-msg { margin: 12px 0 0; }
/* 運営ログインでは説明文とフォームのあいだに入る */
.mfa-op-login { margin-top: 32px; }
.mfa-op-login .mfa-divider { margin-bottom: 0; }
/* 会社側は見出し・説明が中央揃えなので、単独の箇条書きもかたまりごと中央に置く */
.mfa-company #mfa-root > .mfa-points { width: fit-content; max-width: 100%; margin-left: auto; margin-right: auto; }
/* 運営ログインの form の余白（32px 0 22px）を、入力欄のフォームでは使わない */
.mfa-operator #mfa-root .mfa-code-form { margin: 0; }

/* ── ③⑫ 入力の制限（あとN回・止まっているあいだ） ── */
.mfa-left { margin: 8px 0 0; font-size: 13px; font-weight: 500; line-height: 1.8; color: var(--mfa-error); }
.mfa-company .mfa-left { text-align: center; }
#mfa-root .mfa-code-input:disabled, #mfa-root .mfa-recovery-input:disabled { background: var(--mfa-soft); color: var(--mfa-sub); cursor: not-allowed; }

/* ── ⑧ 枠の中のリンク ── */
.mfa-box-link { margin: 8px 0 0; font-size: 14px; font-weight: 700; }
.mfa-box-link a { color: var(--mfa-accent); text-decoration: none; }
.mfa-box-link a:hover { text-decoration: underline; }

/* ── ⑪ 復旧コードの表示 ── */
.mfa-recovery-codes {
  list-style: none; margin: 0; padding: 16px 20px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px;
  border: 1px solid var(--mfa-line); border-radius: var(--mfa-radius); background: var(--mfa-soft); width: 100%;
}
.mfa-recovery-codes li {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 16px; font-weight: 700; line-height: 1.8;
  letter-spacing: .08em; color: var(--mfa-text); text-align: center; font-variant-numeric: tabular-nums;
}
.mfa-code-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.mfa-operator .mfa-code-actions { justify-content: flex-start; }
.mfa-caution {
  margin: 20px 0 0; padding: 12px 14px; border: 1px solid var(--mfa-error); border-radius: 6px;
  background: #fff5f5; color: var(--mfa-text); font-size: 13px; line-height: 1.8; text-align: left; width: 100%;
}
.mfa-saved { display: flex; align-items: flex-start; gap: 10px; margin: 20px 0 0; font-size: 14px; font-weight: 700; line-height: 1.6; color: var(--mfa-text); cursor: pointer; }
.mfa-company .mfa-saved { align-self: center; }
.mfa-saved input { flex: none; width: 18px; height: 18px; min-height: 0; margin: 2px 0 0; padding: 0; accent-color: var(--mfa-accent); cursor: pointer; }
.mfa-operator .mfa-saved { font-weight: 650; }

/* ── ⑫ 復旧コードの入力 ── */
.mfa-recovery-label { display: block; margin-bottom: 10px; }
.mfa-operator .mfa-recovery-label { margin-top: 0; }
.mfa-company .mfa-recovery-label { width: 100%; max-width: 360px; margin-left: auto; margin-right: auto; }
.mfa-recovery { width: 100%; max-width: 360px; }
.mfa-company .mfa-recovery { margin: 0 auto; }
#mfa-root .mfa-recovery-input {
  display: block; width: 100%; height: 56px; padding: 0 16px; text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 20px; font-weight: 700; letter-spacing: .12em;
  color: var(--mfa-text); background: #fff; border: 1px solid #cccbcc; border-radius: 8px; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
#mfa-root .mfa-recovery-input::placeholder { color: #b4b8bb; font-weight: 500; }
.mfa-operator #mfa-root .mfa-recovery-input { border-color: #dce3df; background: #fafcfb; }
#mfa-root .mfa-recovery-input:focus { border-color: var(--mfa-accent); box-shadow: 0 0 0 3px rgba(15,118,110,.15); background: #fff; }
#mfa-root .mfa-recovery.is-error .mfa-recovery-input { border-color: var(--mfa-error); }

/* ── ⑬ 残りの数（3個以下は赤） ── */
.mfa-remaining { font-variant-numeric: tabular-nums; }
.mfa-remaining.is-low { color: var(--mfa-error); }
#mfa-root > .mfa-current + .mfa-msg { margin-top: 0; margin-bottom: 4px; }

/* ── ⑭ ログイン画面の時間切れのお知らせ（?timeout=1 のときだけ） ── */
.mfa-timeout b { display: block; margin-bottom: 2px; font-weight: 700; }
.mfa-timeout { line-height: 1.8; }
.mfa-op-timeout { margin: 24px 0 0; }
.mfa-op-timeout[hidden] { display: none; }

/* ── ⑩ 設定画面の「二段階認証」の欄（各自設定・運営のアカウント設定） ── */
.mfa-set-notice { margin: 4px 0 18px; padding: 12px 14px; border-radius: 8px; font-size: 14px; line-height: 1.8; }
.mfa-set-notice b { display: block; }
.mfa-set-notice.is-ok { color: var(--mfa-accent-dark); background: var(--mfa-tint); border: 1px solid #cfe6e0; font-weight: 700; }
.mfa-set-notice.is-bad { color: var(--mfa-error); background: #fff5f5; border: 1px solid rgba(239,68,68,.25); }
.mfa-set-block { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--mfa-line); }
.mfa-set-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mfa-set-title { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.5; color: var(--mfa-text); }
.mfa-set-button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 16px;
  border: 1px solid var(--mfa-accent); border-radius: 8px; background: #fff; color: var(--mfa-accent);
  font-size: 14px; font-weight: 700; text-decoration: none; white-space: nowrap;
}
.mfa-set-button:hover { background: var(--mfa-tint); }
p.mfa-set-hint { margin-top: 6px; }
.mfa-set-count { margin: 10px 0 0; font-size: 15px; color: var(--mfa-text); font-variant-numeric: tabular-nums; }
.mfa-set-count b { font-size: 20px; font-weight: 700; }
.mfa-set-count.is-low { color: var(--mfa-error); }
.mfa-set-warn { margin: 4px 0 0; font-size: 13px; font-weight: 700; line-height: 1.8; color: var(--mfa-error); }
.mfa-set-table-wrap { margin-top: 14px; overflow-x: auto; }
.mfa-set-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.mfa-set-table th { padding: 8px 10px; border-bottom: 1px solid var(--mfa-line); font-size: 13px; font-weight: 500; color: var(--mfa-sub); text-align: left; white-space: nowrap; }
.mfa-set-table td { padding: 12px 10px; border-bottom: 1px solid var(--mfa-line); color: var(--mfa-text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mfa-set-table td.mfa-set-device { font-weight: 700; white-space: normal; }
.mfa-set-table td.mfa-set-ops { text-align: right; }
.mfa-set-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mfa-set-delete, .mfa-set-cancel, .mfa-set-danger {
  min-height: 34px; padding: 0 12px; border-radius: 6px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.mfa-set-delete, .mfa-set-cancel { border: 1px solid var(--mfa-line); background: #fff; color: var(--mfa-text); }
.mfa-set-delete { color: var(--mfa-error); }
.mfa-set-delete:hover:not(:disabled), .mfa-set-cancel:hover { background: var(--mfa-soft); }
.mfa-set-delete:disabled { opacity: .45; cursor: not-allowed; }
.mfa-set-danger { border: 1px solid var(--mfa-error); background: var(--mfa-error); color: #fff; }
.mfa-set-table tr.is-confirm td { background: #fff8f8; white-space: normal; }
.mfa-set-confirm { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mfa-set-confirm p { margin: 0; font-size: 13px; line-height: 1.8; color: var(--mfa-text); }
.mfa-set-confirm-actions { display: flex; gap: 8px; }

/* 手続きから戻ってきたとき（#mfa）、上の固定ヘッダーにお知らせが隠れないようにする */
#mfa { scroll-margin-top: 88px; }
