/* 責任: 申込画面固有のレイアウト。設計参照: docs/console-apply-identity-first.md。
 * 共通の進行表示は applyform.css、ブランドの値は brand.css を参照する。 */
body { --checkbox-border: var(--line); }
  /* 色は brand.css を唯一の定義元とする。 */
  * { box-sizing: border-box; }
  body {
    margin: 0; background: #fff; color: var(--ink);
    font: 15px/1.7 system-ui, -apple-system, "Segoe UI", sans-serif;
  }
  .wrap { max-width: 640px; margin: 0 auto; padding: 40px 20px 80px; }
  header h1 { font-size: 22px; margin: 0 0 4px; }
  header p { color: var(--ink-2); margin: 0 0 20px; }
  .card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 24px; margin-bottom: 20px;
  }
  /* フォームは mypage.mysurance.co.jp の申込フォームを参照:
   * 太字ラベル + 必須チップ / 見出しは青の縦棒 */
  label { display: block; font-weight: 700; font-size: 15px; margin: 20px 0 8px; }
  label:first-child { margin-top: 0; }
  .hint { font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 6px; }
  label .req { padding: 1px 6px; margin-left: 6px; }
  .section-label {
    font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: 0;
    margin: 4px 0 18px; padding: 1px 0 1px 10px; border-left: 4px solid var(--accent);
  }
  /* 前ページで入力した会社名のおさらい表示 */
  .company-echo { margin: 0 0 20px; padding: 12px 16px; background: #f5f5f5; border-radius: 8px; }
  .company-echo .k { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
  .company-echo .v { font-weight: 700; font-size: 16px; }
  /* type を持つ欄は個別に挙げる必要がある (input:not([type]) では拾えない) */
  input[type="text"], input[type="email"], input[type="tel"],
  input:not([type]) {
    width: 100%; padding: 12px 14px; font: inherit; color: var(--ink);
    background: var(--page); border: 1px solid var(--line); border-radius: 8px;
  }
  input[type="text"]:focus, input[type="email"]:focus, input[type="tel"]:focus,
  input:not([type]):focus {
    outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent;
  }
  button.primary, a.primary {
    margin-top: 22px; width: 100%; padding: 11px; font: inherit; font-weight: 600;
    color: var(--accent-ink); background: var(--accent); border: 0; border-radius: 8px; cursor: pointer;
  }
  button.primary:hover:enabled, a.primary:hover { filter: brightness(1.08); }
  button.primary:disabled { opacity: .45; cursor: not-allowed; }
  .error { color: var(--bad); font-size: 13px; margin-top: 12px; display: none; }

  /* フィールド単位のエラー — 入力欄の直下に、その欄のことだけを書く。
     背景は塗らず、枠線と文言だけで示す */
  .field-err { color: var(--bad); font-size: 13px; margin: 6px 0 0; display: none; }
  .field-err.show { display: block; }
  /* 予約フォームのタグマネージャ検出の結果 */
  .tagman-status { font-size: 12px; color: var(--muted); margin: 6px 0 0; display: none; }
  .tagman-status.show { display: block; }
  .tagman-status.found { color: var(--good); }
  .tagman-status.warn { color: var(--ink-2); }
  /* 郵便番号からの自動補完の経過 (照会中・補完した住所・見つからなかった旨) */
  .postal-status { font-size: 12px; color: var(--muted); margin: 6px 0 0; display: none; }
  .postal-status.show { display: block; }
  .postal-status.warn { color: var(--ink-2); }
  /* 指摘中の欄の枠線は brand.css の input.invalid が持つ */

  /* すでにアカウントを持っている人の出口 (申込の前に置く) */
  .have-account {
    margin: 0 0 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line);
    font-size: 14px; color: var(--ink-2);
  }
  .have-account a { color: var(--accent); font-weight: 700; }
  .result { display: none; }
  .result h2 { font-size: 17px; margin: 0 0 12px; }
  /* 完了画面のコンソール導線 (button.primary と同じ見た目のリンク) */
  a.primary { display: block; box-sizing: border-box; text-align: center; text-decoration: none; }
  .kv { margin: 14px 0; }
  .kv .k { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
  .kv .v {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px;
    background: var(--page); border: 1px solid var(--line); border-radius: 8px;
    padding: 10px 12px; word-break: break-all; position: relative;
  }
  .note { font-size: 13px; color: var(--ink-2); white-space: pre-line; }
  /* 発行完了の案内。**次にやること**なので、薄い注記 (.note) の顔では出さない */
  .done-lead { font-size: 14px; font-weight: 600; color: var(--ink); white-space: pre-line;
    margin: 0 0 16px; padding: 12px 14px; border-radius: 8px;
    background: var(--page); border: 1px solid var(--line); border-left: 4px solid var(--accent); }
  .note.warn { color: var(--bad); font-weight: 600; }
  .copy {
    position: absolute; top: 6px; right: 6px; font: 12px system-ui; padding: 3px 10px;
    border: 1px solid var(--line); border-radius: 6px; background: var(--surface);
    color: var(--ink-2); cursor: pointer;
  }
  .copy:hover { color: var(--ink); }
  a { color: var(--accent); }
  .console-link { display: inline-block; margin-top: 10px; font-weight: 600; }

  /* 規約本文は公開規約ページと同じ白地・段落間隔で表示する。 */
  /* 前文と全条文を一つの枠にまとめ、同意と操作はスクロールの外に置く。 */
  #page-terms { padding: 0; border: 0; box-shadow: none; }
  .terms-scroll {
    height: clamp(120px, calc(100dvh - 440px), 560px);
    overflow-y: auto; overscroll-behavior: contain;
    padding: 24px; border: 1px solid var(--border); border-radius: 8px; background: #fff;
    scrollbar-gutter: stable;
  }
  .terms-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
  #page-terms .legal-doc { margin-bottom: 0; }
  #page-terms .agree { margin-top: 16px; }
  #page-terms .page-nav { margin-top: 14px; }
  #page-terms .legal-doc h2 {
    font-size: 22px; font-weight: 700; letter-spacing: 0;
    margin: 0 0 10px; padding: 0; border: 0; line-height: 1.6;
  }
  .terms-meta { font-size: 12px; color: var(--muted); margin: 0 0 16px; }
  .terms-lead {
    font-size: 15px; color: var(--ink); margin: 0 0 24px; padding: 0;
    background: none; border: 0; line-height: 2; white-space: pre-wrap;
  }
  .terms-body {
    max-height: none; overflow: visible; padding: 0; margin: 32px 0 8px;
    background: transparent; border: 0; border-radius: 0;
  }
  .terms-body section { margin-bottom: 36px; }
  .terms-body section:last-child { margin-bottom: 0; }
  .terms-body h3 { font-size: 17px; margin: 0 0 16px; line-height: 1.7; }
  .terms-body p { font-size: 15px; color: var(--ink); margin: 0 0 14px; line-height: 2; white-space: pre-wrap; overflow-wrap: anywhere; }
  .terms-body p.clause { padding-left: 2.8em; text-indent: -2.8em; margin-top: 24px; margin-bottom: 12px; }
  .terms-body p.subclause { margin-left: 1.2em; padding-left: 2.5em; text-indent: -2.5em; margin-bottom: 10px; }
  .terms-body p.detail { margin-left: 3.7em; padding-left: 2em; text-indent: -2em; margin-bottom: 10px; }
  .terms-body p:last-child { margin-bottom: 0; }
  @media (max-width: 520px) {
    .terms-scroll { padding: 18px 16px; }
    .terms-body { padding: 0; }
    .terms-body section { margin-bottom: 32px; }
    .terms-body p.detail { margin-left: 1.5em; }
  }
  .legal-doc { margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
  .legal-doc:last-of-type { border-bottom: 0; padding-bottom: 0; }
  .legal-doc h2 { font-size: 17px; margin: 0 0 2px; }

.agree {
    display: flex; gap: 10px; align-items: flex-start; font-size: 14px; font-weight: 600;
    padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
  }
  .agree:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
  .agree input { margin-top: 2px; }
  .agree .req {
    font-size: 11px; font-weight: 700; color: var(--bad); border: 1px solid var(--bad);
    border-radius: 4px; padding: 0 5px; margin-left: 8px; white-space: nowrap;
  }
  /* メール配信のオプトイン (任意) */
  .optin {
    display: flex; gap: 10px; align-items: flex-start; font-size: 14px;
    margin-top: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
  }
  .optin:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
  .optin input { margin-top: 2px; }
  .opt { font-size: 11px; font-weight: 700; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-left: 8px; }
  .optin .sub { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
  .remand-banner {
    border-color: color-mix(in srgb, #b6820a 45%, var(--border));
    background: color-mix(in srgb, #b6820a 8%, var(--surface));
  }
  .remand-banner h2 { font-size: 16px; margin: 0 0 8px; }
  .remand-banner .reason { white-space: pre-wrap; font-weight: 600; margin: 0 0 10px; }
  .remand-banner .note { margin: 0; }
  /* ---- アカウントの発行手続き (確認コード + SNS の連携) ---- */
  .result .code { letter-spacing: .4em; font-size: 20px; font-family: ui-monospace, Menlo, monospace; text-align: center; }
  .verification-support-actions { display: flex; gap: 12px; margin-top: 12px; }
  .verification-support-actions button { flex: 1 1 0; min-width: 0; cursor: pointer; }
  #ac-next, .verification-support-actions button {
    box-sizing: border-box;
    min-height: 48px;
    padding: 12px;
    font-size: 14px;
    font-weight: 700;
    line-height: 22px;
  }
  /* SNS のボタンの体裁は **/federated.css の 1 実装** (2026-09-04)。各社のログイン
     ボタンにはガイドラインがあり、色も寸法も文言も先方の要件で決まる。ここに写しを
     置くとコンソール側 (console.html) と食い違い、**片方だけ直る** (穴 7)。 */
  .ok { color: var(--good); font-size: 13px; margin-top: 10px; display: none; }
  .ok.show { display: block; }

  /* ---- 重要事項 (1 件ずつ図解 + チェック) ---- */
  #page-matters .legal-doc h2 {
    font-size: 17px; font-weight: 700; letter-spacing: 0;
    margin: 4px 0 8px; padding: 1px 0 1px 10px; border-left: 4px solid var(--accent);
  }
  .matter { padding: 20px 0; border-bottom: 1px solid var(--line); }
  .matter:first-child { padding-top: 4px; }
  .matter h3 { font-size: 15px; margin: 0 0 8px; }
  .matter p.body { font-size: 13px; color: var(--ink-2); margin: 0 0 12px; }
  .matter img {
    display: block; width: 100%; height: auto; margin: 0 0 12px;
    border: 1px solid var(--line); border-radius: 8px; background: var(--page);
  }
  .matters-progress { font-size: 12px; color: var(--muted); margin: 14px 0 0; }
  .matters-progress.done { color: var(--good); font-weight: 600; }

  /* ---- 取扱商品 (1 申込 = 1 商品。プルダウンで選ぶ) ---- */
  select {
    width: 100%; padding: 12px 14px; font: inherit; color: var(--ink);
    background: var(--page); border: 1px solid var(--line); border-radius: 8px;
  }
  select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
  select.invalid { border-color: var(--bad); }
  /* ---- 生年月日: テキスト入力 + 補助のカレンダー ----
     ブラウザ既定の input[type=date] は表記・操作・配色がブラウザ任せなので使わず、
     打ちやすいテキスト欄を主にして、カレンダーを補助として横に添える。 */
  .date-field { position: relative; display: flex; gap: 8px; align-items: stretch; }
  .date-field input { flex: 1; min-width: 0; }
  .date-open {
    flex: none; width: 48px; display: grid; place-items: center; cursor: pointer;
    color: var(--ink-2); background: var(--surface);
    /* 隣の入力欄と同じ角丸・枠色 (brand.css: 欄は 12px・#999) */
    border: 1px solid var(--muted); border-radius: 12px;
  }
  .date-open:hover { color: var(--accent); border-color: var(--accent); }
  .date-open[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
  .date-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
  .date-open svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; }

  .date-pop {
    position: absolute; z-index: 20; top: calc(100% + 6px); right: 0; width: min(320px, 100%);
    padding: 12px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: var(--brand-shadow, 0 12px 32px rgba(0,0,0,.16));
  }
  .date-pop[hidden] { display: none; }
  /* 下に入りきらないときは欄の上に出す (画面の外に出さない) */
  .date-pop.above { top: auto; bottom: calc(100% + 6px); }
  .date-pop-head { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; }
  .date-pop-head select {
    flex: 1; min-width: 0; padding: 7px 8px; font: inherit; font-size: 14px; color: var(--ink);
    background: var(--page); border: 1px solid var(--muted); border-radius: 12px;
  }
  .date-nav {
    flex: none; width: 32px; height: 32px; font: inherit; font-size: 18px; line-height: 1;
    color: var(--ink-2); background: var(--page);
    border: 1px solid var(--muted); border-radius: 8px; cursor: pointer;
  }
  .date-nav:hover:enabled { color: var(--accent); border-color: var(--accent); }
  .date-nav:disabled { opacity: .4; cursor: not-allowed; }
  .date-dow, .date-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
  .date-dow { margin-bottom: 4px; font-size: 11px; color: var(--muted); text-align: center; }
  .date-dow span { padding: 2px 0; }
  .date-day {
    padding: 7px 0; font: inherit; font-size: 13px; color: var(--ink); text-align: center;
    background: none; border: 1px solid transparent; border-radius: 6px; cursor: pointer;
  }
  .date-day:hover:enabled { border-color: var(--accent); }
  .date-day:disabled { color: var(--muted); opacity: .4; cursor: not-allowed; }
  .date-day.today { font-weight: 700; color: var(--accent); }
  .date-day.selected { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
  .date-day.blank { visibility: hidden; }
  .date-pop-foot {
    display: flex; justify-content: space-between; gap: 8px;
    margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line);
  }
  .date-pop-foot button {
    font: inherit; font-size: 13px; font-weight: 600; padding: 5px 10px; cursor: pointer;
    color: var(--accent); background: none; border: 1px solid transparent; border-radius: 6px;
  }
  .date-pop-foot button:hover { border-color: var(--accent); }
  .date-clear { color: var(--ink-2) !important; }

  /* ページ送り (戻る + 次へ/送信) */
  .page-nav { display: flex; gap: 10px; margin-top: 22px; }
  .page-nav .back {
    flex: none; padding: 11px 18px; font: inherit; font-weight: 600; cursor: pointer;
    color: var(--accent); background: var(--surface); border: 1px solid var(--accent); border-radius: 8px;
  }
  .page-nav button.primary { flex: 1; margin-top: 0; }
  #page-contact .agree { margin-top: 26px; }

/* 非該当条件と確認操作を一つの領域として示す。 */
.eligibility-panel {
  border: 1.5px solid var(--border); border-radius: 12px;
  background: var(--surface); padding: 22px 24px; margin: 28px 0 20px;
}
.eligibility-panel #eligibility-heading { font-weight: 700; margin: 0 0 12px; line-height: 1.8; }
.eligibility-panel ul { padding-left: 1.4em; margin: 0 0 20px; line-height: 1.85; }
.eligibility-panel li + li { margin-top: 8px; }
#page-contact .eligibility-panel label.agree {
  margin: 0; padding: 16px 0 0; border: 0; border-top: 1px solid var(--border);
  border-radius: 0; background: transparent;
}
.eligibility-panel .field-err:empty { display: none; }
@media (max-width: 520px) {
  .eligibility-panel { padding: 18px 16px; }
  #page-contact .eligibility-panel label.agree { align-items: flex-start; }
}
/* 招待リンクの専用画面はコード入力の通知切替を使わない。 */
#invite-error:not(:empty), #invite-notice:not(:empty) { display: block; }
#step-invitation [hidden] { display: none; }

/* メール未着時の確認事項と問い合わせ導線。設計: console-apply-identity-first.md。 */
.mail-delivery-help {
  margin: 20px 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  line-height: 1.8;
}
.mail-delivery-help h3 { margin: 0 0 8px; font-size: 1rem; }
.mail-delivery-help ul { margin: 0; padding-left: 1.4em; }
.mail-delivery-help li + li { margin-top: 6px; }
.mail-delivery-help p { margin: 12px 0 0; }
