/* ============================================================
   Miniiku FE — スマホ / タブレット 共通レスポンシブCSS（mockups/fe-mobile）
   読み込み順: PC版CSS（各HTML内 <style> と fc-theme.css）→ 本ファイル → css/pages/<画面>.css
   方針: PC版の HTML 構造・クラス名・文言・コントロールは一切変更しない（CSSのみで上書き）。
   ブレークポイント: スマホ ≤767px ／ タブレット 768〜1024px ／ PC 1025px〜（PC版のまま）
   ============================================================ */

/* ---------- 共通（スマホ＋タブレット ≤1024px） ---------- */
@media (max-width: 1024px) {
    html, body { overflow-x: hidden; }
    img, video, canvas, svg { max-width: 100%; }
    input, select, textarea, button { max-width: 100%; }

    /* ヘッダー（ログイン後）: ロゴ＋「探す」 */
    .site-header { padding-left: 12px !important; }
    .header-logo-box { font-size: 18px; }
    .header-search-btn { padding: 0 16px; }

    /* ロールタブ（探す／申込管理／見学募集）: 3等分のタブ */
    .role-nav-bar { height: auto !important; min-height: 48px; padding: 8px 8px 0 !important; gap: 6px; overflow-x: auto; align-items: flex-end; }
    .role-nav-tab { flex: 1 1 0; min-width: 0; justify-content: center; text-align: center; height: 40px; padding: 0 4px; font-size: 12px; line-height: 1.2; border-radius: 12px 12px 0 0; white-space: normal; background: rgba(255, 255, 255, 0.18); }
    .role-nav-tab.is-active { background: #f0f4f8; color: var(--fc-main, #1b75bb); }
    .role-nav-tab.is-active::after { background: var(--fc-main, #1b75bb); bottom: 4px; width: 24px; }

    /* ページシェル: サイドバーはハンバーガーメニュー（末尾の「SP ハンバーガーメニュー」ブロック）で表示 */
    .page-shell { display: block !important; padding: 0 16px !important; margin: 16px 0 40px !important; }
    .main-content { gap: 16px !important; min-width: 0; padding-left: 0; padding-right: 0; }
    .main-content > h1, .main-title { font-size: 28px !important; }
    .card { padding: 16px !important; }

    /* テーブルは枠内で横スクロール（列数は維持） */
    table:not(.cal-grid-tbl):not([class*="cal"]) { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* フッター（共通） */
    .fc-footer-inner { gap: 24px; }
}

/* ---------- スマホ（≤767px） ---------- */
@media (max-width: 767px) {
    body { font-size: 14px; }
    .main-content > h1, .main-title { font-size: 26px !important; }

    /* 2〜3カラムのフォーム／グリッドは1カラムへ（カレンダー等の7列は除外） */
    .form-row, .form-row.two-col, .form-row.three-col { flex-direction: column !important; align-items: stretch !important; }
    [style*="grid-template-columns"]:not([style*="repeat(7"]):not([style*="repeat(5"]) { grid-template-columns: 1fr !important; }
    [style*="display:flex"], [style*="display: flex"] { flex-wrap: wrap; }
    [style*="flex-direction:column"], [style*="flex-direction: column"] { flex-wrap: nowrap; }
    .controls-row, .controls-left { flex-direction: column; align-items: stretch !important; gap: 10px; }

    /* ボタン行・ステップ表示 */
    .btn-row, .button-row, .form-actions { flex-wrap: wrap; justify-content: center; gap: 12px; }

    /* モーダル/ダイアログは画面幅に収める */
    [class*="modal-card"], [class*="modal-box"], [class*="modal-content"], [class*="modal-dialog"], [class*="dialog-box"], .fc-dlg { width: calc(100vw - 24px) !important; max-width: calc(100vw - 24px) !important; max-height: 90vh; overflow-y: auto; }
}

/* ---------- タブレット（768〜1024px） ---------- */
@media (min-width: 768px) and (max-width: 1024px) {
    .main-content > h1, .main-title { font-size: 26px !important; }
    .page-shell { padding: 0 24px !important; }
    [style*="grid-template-columns"][style*="repeat(4"], [style*="grid-template-columns"][style*="repeat(3"] { grid-template-columns: repeat(2, 1fr) !important; }
    [class*="modal-card"], [class*="modal-box"], [class*="modal-content"], [class*="modal-dialog"] { max-width: calc(100vw - 48px) !important; }
}

/* ---------- スマホ（≤767px）: 画面共通パーツの横幅調整 ---------- */
@media (max-width: 767px) {
    /* ステップバー（申込・登録・決済のステップ表示）は等分にして1行に収める */
    .stepper-chevron, [class*="stepper"], [class*="step-bar"], [class*="chevron-wrap"], [class*="chevron-stepper"] { flex-wrap: nowrap !important; gap: 4px !important; width: 100%; }
    .step-item, .chevron-step { flex: 1 1 0; min-width: 0 !important; padding: 8px 6px !important; font-size: 11px !important; text-align: center; line-height: 1.3; }
    .chevron-step { padding-left: 14px !important; padding-right: 14px !important; }
    .step-item.is-active::after { display: none; }

    /* 単独画面（登録・決済・問い合わせ等）の外枠 */
    .reg-container, .page-container { margin: 16px auto 40px !important; padding: 0 16px !important; }

    /* 項目名＋入力欄の行は縦積み */
    .form-row { display: flex !important; flex-direction: column !important; align-items: stretch !important; gap: 6px !important; }
    .form-row .fields-col, .fields-col { min-width: 0; width: 100%; }
    .info-row { grid-template-columns: 1fr !important; gap: 2px !important; }
    .info-value select, .info-value input { max-width: 100% !important; }
    .info-label { padding-top: 0; }

    /* 検索・絞り込み行 */
    .control-group { flex-wrap: wrap; width: 100%; gap: 8px; }
    .control-group select, .control-group input { flex: 1 1 140px; min-width: 0; }
    .sort-search-row { flex-wrap: wrap; width: 100%; }
    .search-box, .search-input { width: 100% !important; }
    .select-gray, .select-input { max-width: 100%; min-width: 0; }

    /* KPI カードは1カラム */
    .kpi-row-4, .kpi-row-2, .kpi-grid { grid-template-columns: 1fr !important; }
    .kpi-card, .kpi-card-wide, .kpi-box, .kpi-box-wide { min-width: 0; }

    /* プログラム検索: 絞り込み → 結果 の縦積み */
    .search-page-shell { display: block !important; padding: 0 16px !important; margin: 16px 0 40px !important; }
    .filter-sidebar { margin-bottom: 20px; }
    .results-title-row { flex-wrap: wrap; gap: 6px; }

    /* プログラム詳細: 企業ヒーロー */
    .company-hero-card { grid-template-columns: 1fr !important; padding: 20px 16px !important; gap: 16px !important; }
    .company-hero-name { font-size: 22px !important; flex-wrap: wrap; gap: 8px !important; }

    /* 入力欄は幅いっぱい */
    .input-text-bank, .input-field { width: 100% !important; min-width: 0; }
}

@media (max-width: 767px) {
    /* 確認画面の定義リスト（項目名／値）は縦積み */
    .confirm-dl { grid-template-columns: 1fr !important; row-gap: 2px !important; }
    .confirm-dl dd { margin-bottom: 12px; overflow-wrap: anywhere; }
    .postal-input-row { flex-wrap: wrap; }

    /* 2カレンダー並びは1カラム */
    .cal-double-container { grid-template-columns: 1fr !important; }

    /* ダッシュボード／一覧のカード */
    .dash-card { padding: 16px !important; }
    .card-header-row { flex-wrap: wrap; }
    .company-tag-row { flex-wrap: wrap; }
    .company-info { min-width: 0; }

    /* プログラム詳細: コースカード */
    .course-card { padding: 20px 16px !important; }
    .course-card-head { flex-direction: column; align-items: stretch !important; gap: 12px !important; }
    .course-booking-box { align-items: flex-start !important; text-align: left !important; min-width: 0 !important; }

    .select-input, .select-bank { width: 100% !important; max-width: 100%; }
}

@media (max-width: 767px) {
    /* 単独カード画面（ログイン・仮登録・パスワード再発行・メール認証 等） */
    .page-main-container { padding: 24px 16px 40px !important; align-items: stretch !important; }
    .login-card, .reg-card, .reset-card, .verify-card, .form-card, .withdraw-card { padding: 28px 18px 24px !important; border-radius: 16px; max-width: 100% !important; width: 100% !important; }
    .login-card h1, .reg-card h1, .reg-card h2, .reset-card h1, .verify-card h1, .form-card h1, .withdraw-card h1 { font-size: 22px !important; line-height: 1.4 !important; }
    .input-row, .reg-input-row { flex-direction: column !important; gap: 12px !important; align-items: stretch !important; }
    .register-box { flex-direction: column; align-items: center; gap: 10px; text-align: center; }
    .btn-new-reg { white-space: nowrap; }
    .login-card .btn-login, .reset-card button[type="submit"], .reg-card button[type="submit"] { max-width: 100%; }

    /* モーダル（予約・見学票・レビュー等）を画面幅に収める */
    .booking-modal-card, .ticket-paper-card, .ticket-modal-card, .pdf-sheet-card, .custom-modal-dialog { width: calc(100vw - 24px) !important; max-width: calc(100vw - 24px) !important; max-height: 92vh; overflow-y: auto; }
}

@media (max-width: 767px) {
    /* 登録フォーム: セクション見出しと入力欄を縦積み（見出し → 項目） */
    .reg-section { display: block !important; grid-template-columns: 1fr !important; }
    .reg-section .section-label-col { padding-top: 0; margin-bottom: 12px; }
    .reg-section .fields-col { gap: 12px; }
}

@media (max-width: 767px) {
    /* 申込モーダル（スケジュール選択〜申込完了）: ステッパー・カレンダー・2カラムを画面幅に収める */
    .modal-stepper-header { padding: 16px 12px 14px !important; }
    .stepper-step-item { width: auto !important; flex: 1 1 0; min-width: 0; }
    .stepper-step-title { white-space: normal !important; font-size: 11px !important; }
    .modal-step-title { font-size: 20px !important; margin-bottom: 16px !important; }
    .step1-content { grid-template-columns: 1fr !important; gap: 20px !important; }
    .booking-cal-box { width: 100% !important; }
    .booking-cal-table td { width: auto !important; height: 44px !important; }
    .btn-booking-orange { width: 100%; text-align: center; }
    .course-steps-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 20px 12px !important; }
}

@media (max-width: 767px) {
    /* 申込モーダルはスマホでは全画面表示（参考デザイン: 画面いっぱいのシート） */
    .booking-modal-card { width: 100vw !important; max-width: 100vw !important; height: 100vh; max-height: 100vh !important; border-radius: 0 !important; overflow-x: hidden; }
    .booking-info-table { grid-template-columns: 1fr !important; row-gap: 4px !important; }
    .booking-info-table > * { min-width: 0; overflow-wrap: anywhere; }
    .recruit-note { padding: 12px !important; }
    .completion-box { padding: 24px 8px !important; }
}

@media (max-width: 767px) {
    .grid-2col-bottom, [class*="grid-2col"], [class*="two-col-grid"] { grid-template-columns: 1fr !important; gap: 16px !important; }
}

/* ---------- チャット（FE-C08-A/B/P 共通）: 3ペイン → 縦積み ---------- */
@media (max-width: 1024px) {
    .chat-shell { flex-wrap: wrap; height: auto !important; overflow: visible; }
    .info-panel { width: 100%; flex: 1 0 100%; border-top: 1px solid #e5e9ee; }
}
@media (max-width: 767px) {
    .chat-shell { display: flex; flex-direction: column; flex-wrap: nowrap; }
    .conversation-panel { order: 1; border-right: none !important; min-height: 70vh; max-height: 90vh; }   /* 参考デザイン: 会話画面を先頭に */
    .thread-list-panel { order: 2; width: 100% !important; max-height: 320px; border-right: none !important; border-top: 1px solid #e5e9ee; }
    .info-panel { order: 3; }
    .info-dl { grid-template-columns: 90px 1fr; }
    .convo-header { padding: 10px 14px; }
    .chat-messages { padding: 12px 14px; }
    .msg-row { max-width: 88%; }
}

@media (max-width: 767px) {
    /* 一覧テーブル: 列が潰れて1文字ずつ折り返さないよう最小幅を確保し、枠内を横スクロール */
    :where(table) :where(th, td) { min-width: 88px; }
    .cal-grid-tbl th, .cal-grid-tbl td, [class*="cal"] th, [class*="cal"] td { min-width: 0; }
}

@media (max-width: 767px) {
    /* ラベルの固定幅(flex-basis)を縦積み時に無効化 */
    .form-label { flex: 0 0 auto !important; width: auto !important; }
    /* タブナビ: 横スクロールで1行に維持 */
    .tab-nav { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
    .tab-btn { flex: 0 0 auto; white-space: nowrap; padding: 12px 14px; font-size: 14px; }
    /* ボタンの縦書き化防止・合計バー */
    .btn-view-details { white-space: nowrap; align-self: flex-start; }
    *:has(> .btn-view-details) { flex-wrap: wrap; gap: 12px; }
    .summary-total-bar { flex-wrap: wrap; gap: 8px; }
    .total-values { flex-wrap: wrap; gap: 6px 16px; }
    .postal-input-group { flex-wrap: wrap; }
    .postal-input-group input { width: 80px !important; flex: 0 0 80px; }
    .btn-postal-auto { white-space: nowrap; flex-shrink: 0; }
}

@media (max-width: 767px) {
    /* 固定列幅（table-layout:fixed / width指定）を解除し、列が潰れないようにする */
    table:not(.cal-grid-tbl):not([class*="cal"]) { table-layout: auto !important; }
    table:not(.cal-grid-tbl):not([class*="cal"]) th[style*="width"], table:not(.cal-grid-tbl):not([class*="cal"]) td[style*="width"] { width: auto !important; }
}

/* ===== Header: マイページ + 探す (SP design) ===== */
.header-mypage-btn { white-space: nowrap; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0 10px; color: var(--fc-main-d, #1b75bb); font-size: 10px; font-weight: 700; text-decoration: none; background: #fff; }
.header-mypage-btn svg { display: block; }
@media (min-width: 1025px) { .header-mypage-btn { display: none; } }

/* ===== Chevron stepper (A04/A04b, SP design: equal width, bold, bigger) ===== */
@media (max-width: 767px) {
  .stepper-wrap { gap: 0 !important; margin-bottom: 16px !important; justify-content: stretch !important; }
  .chevron-step { flex: 1 1 0 !important; min-width: 0 !important; height: 48px; padding: 0 10px 0 18px !important; font-size: 15px !important; font-weight: 800 !important; white-space: nowrap; line-height: 1; clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%) !important; margin-left: -6px; text-decoration: none; }
  .chevron-step:first-child { margin-left: 0; padding-left: 14px !important; clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%) !important; }
  .chevron-step.is-active { background: var(--fc-main, #2389d7) !important; color: #fff !important; }
  .chevron-step.is-passed { background: #fff !important; color: var(--fc-main, #2389d7) !important; }
}

/* ===== A02a〜d 申込モーダル: SP design (banner title + chevron stepper, demo switcher hidden) ===== */
@media (max-width: 767px) {
  .modal-overlay:has(.booking-modal-card) { background: #ecf3f8 !important; }
  .booking-modal-card { background: #ecf3f8 !important; box-shadow: none !important; border-radius: 0 !important; }
  .modal-stepper-header { background: #ecf3f8 !important; padding: 12px 12px 4px !important; position: relative; }
  .modal-close-icon { position: absolute !important; top: 6px !important; right: 8px !important; z-index: 5; background: #b5b5b5 !important; color: #fff !important; width: 28px !important; height: 28px !important; }
  .stepper-track-wrap { max-width: none !important; margin-top: 30px !important; }
  .stepper-line, .stepper-dot { display: none !important; }
  .stepper-steps-row { gap: 0 !important; justify-content: stretch !important; }
  .stepper-step-item { flex: 1 1 0 !important; width: auto !important; height: 40px; justify-content: center; background: #fff; margin-left: -6px; clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); padding: 0 12px; }
  .stepper-step-item:first-child { margin-left: 0; clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); }
  .stepper-step-title { color: #8fb9dc !important; font-size: 11px !important; font-weight: 700 !important; white-space: normal !important; line-height: 1.15; }
  .stepper-step-item.is-active { background: var(--fc-main, #2389d7) !important; }
  .stepper-step-item.is-active .stepper-step-title { color: #fff !important; font-weight: 800 !important; }
  .modal-body { background: transparent !important; padding: 12px 12px 24px !important; }
  .modal-step-heading { background: var(--fc-main, #2389d7) !important; color: #fff !important; text-align: center; border-radius: 10px; padding: 18px 12px !important; margin: 0 0 14px !important; font-size: 20px !important; line-height: 1.4; }
  .demo-switcher, [data-demo-only="true"] { display: none !important; }
}
@media (max-width: 767px) {
  .modal-step-heading { text-align: center !important; justify-content: center !important; }
  .info-label { width: auto !important; text-align: left !important; padding-left: 0 !important; margin: 10px 0 2px !important; }
  .info-row, .info-item { display: block !important; }
}

/* ===== C08 チャット: SP design (conversation first, bubbles, pill send button; demo bars hidden) ===== */
@media (max-width: 767px) {
  .demo-scenario-bar, .floating-demo-bar, .demo-switcher { display: none !important; }
  .header-nav-link { font-size: 11px !important; padding: 0 8px !important; line-height: 1.2; text-align: center; display: flex; align-items: center; }
  .convo-header { background: #ecf3f8 !important; padding: 16px 16px 14px !important; border-bottom: 0 !important; }
  .convo-title-wrap h2 { font-size: 20px !important; font-weight: 900 !important; color: var(--fc-main-d, #1b75bb) !important; line-height: 1.3; }
  .convo-subtitle { font-size: 16px !important; font-weight: 800 !important; color: var(--fc-main-d, #1b75bb) !important; }
  .chat-messages { background: #fff !important; padding: 16px 14px !important; gap: 18px !important; }
  .msg-row { display: flex !important; flex-direction: column-reverse !important; max-width: 100% !important; }
  .msg-row.outgoing { align-items: flex-end; padding-left: 18%; }
  .msg-row.incoming { align-items: flex-start; padding-right: 12%; }
  .msg-bubble { border-radius: 14px !important; padding: 14px 16px !important; font-size: 14px !important; line-height: 1.7 !important; }
  .msg-row.incoming .msg-bubble { background: #dceef8 !important; color: #222 !important; border: 0 !important; }
  .msg-row.outgoing .msg-bubble { background: var(--fc-main, #2a88d4) !important; color: #fff !important; }
  .msg-meta { margin: 6px 0 0 !important; font-size: 11px !important; color: #aaa !important; font-weight: 700; display: flex; gap: 10px; flex-wrap: wrap; }
  .msg-row.outgoing .msg-meta { flex-direction: row-reverse; justify-content: flex-end; }
  .chat-composer { background: #fff !important; border-top: 14px solid #ecf3f8 !important; padding: 12px 16px 16px !important; }
  .composer-box { border: 0 !important; box-shadow: none !important; padding: 0 !important; }
  .composer-textarea { min-height: 70px !important; font-size: 14px !important; }
  .composer-footer { align-items: flex-end !important; }
  .btn-send { border-radius: 999px !important; background: var(--fc-main, #2a88d4) !important; padding: 12px 30px !important; font-size: 14px !important; font-weight: 800 !important; white-space: nowrap; }
}
@media (max-width: 767px) {
  .page-main-container { flex: 1 0 auto; align-items: center !important; padding-top: 24px !important; padding-bottom: 32px !important; }
}

/* ===== デモ用 UI（状態切替・シミュレーション・テストバー）は SP/タブレットでは非表示 ===== */
@media (max-width: 1024px) {
  .demo-switcher, [data-demo-only="true"], .floating-demo-bar, .demo-bar, .demo-scenario-bar, .demo-auth-bar,
  .cancel-simulation-card, .btn-open-modal-demo, .top-switcher-bar, .role-switch-box { display: none !important; }
}


/* ===== 視覚チェックで見つかった崩れの修正（SP） ===== */
@media (max-width: 767px) {
  /* 下部アクションボタン: 折返し禁止・縦積み */
  .btn-actions-row, .modal-action-bar, .report-btn-row, .btn-row { flex-wrap: wrap !important; gap: 10px !important; }
  .btn-actions-row > a, .btn-actions-row > button, .modal-action-bar > a, .modal-action-bar > button { white-space: nowrap; flex: 1 1 auto; justify-content: center; text-align: center; }
  .modal-action-bar > button, .modal-action-bar > a { padding-left: 14px !important; padding-right: 14px !important; font-size: 14px !important; min-width: 0; }
  .report-btn-row { flex-direction: column; align-items: stretch; }
  .report-btn-row > button { width: 100% !important; white-space: nowrap; }
  /* chevron stepper（C09/B10 など）: 文字を小さく、折返し可 */
  .chevron-step { font-size: 12px !important; white-space: normal !important; text-align: center; line-height: 1.25; padding: 0 8px 0 16px !important; }
  /* 見出しバー（左ライン付き）の折返し防止 */
  .section-title-bar { flex-wrap: wrap; gap: 2px 8px; }
  .section-title-text { white-space: nowrap; }
  /* 完了ページ/モーダル見出し: はみ出さず折返し */
  .modal-step-heading, .done-title, h1, h2 { overflow-wrap: anywhere; }
}
@media (max-width: 767px) {
  .completion-actions { flex-wrap: wrap; }
  .custom-modal-close, .modal-close-btn, .modal-close { z-index: 5; }
}

/* ===== 全モーダル共通 (SP): 縦に長いモーダルは上が切れないようスクロール可・ボタンは縦積み ===== */
@media (max-width: 767px) {
  .modal-overlay, .custom-modal-overlay, .edit-modal-overlay { overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .modal-overlay > *, .custom-modal-overlay > *, .edit-modal-overlay > * { margin-top: auto; margin-bottom: auto; }
  .modal-container { padding: 32px 18px 24px !important; width: 100% !important; }
  .custom-modal-dialog { padding: 28px 16px 20px !important; max-width: 100% !important; }
  .custom-modal-title { font-size: 20px !important; word-break: keep-all; overflow-wrap: anywhere; text-wrap: balance; padding-left: 24px; padding-right: 24px; }
  .modal-btn-row { display: flex !important; flex-direction: column !important; align-items: stretch; gap: 10px !important; }
  .modal-btn-row > button, .modal-btn-row > a,
  .custom-modal-dialog .btn-modal-gray, .custom-modal-dialog .btn-modal-orange, .custom-modal-dialog .btn-modal-blue, .custom-modal-dialog .btn-modal-teal, .custom-modal-dialog .btn-modal-red { width: 100% !important; max-width: 280px; height: auto !important; min-height: 44px; margin-left: auto; margin-right: auto; border-radius: 9999px !important; padding: 11px 20px !important; white-space: normal; }
}
@media (max-width: 767px) { .modal-container .report-section-title { font-size: 19px !important; padding-right: 32px; word-break: keep-all; overflow-wrap: anywhere; text-wrap: balance; } }

/* ===== フッターを常に画面下端へ（コンテンツが短い画面でフッターが浮かないようにする） ===== */
@media (max-width: 1024px) {
  body { min-height: 100dvh; display: flex; flex-direction: column; }
  body > *:not(script):not(style) { width: -webkit-fill-available; width: stretch; }
  body > footer, body > .fc-footer, body > .site-footer { margin-top: auto; }
  /* 内容が短い画面（登録完了など）は、パンくずとフッターの間で本文を上下中央に配置 */
  body:has(> .reg-container, > .page-container) > footer,
  body:has(> .reg-container, > .page-container) > .fc-footer { margin-top: 0; }
  body > .reg-container, body > .page-container { margin-top: auto !important; margin-bottom: auto !important; }
}

/* ===== 新規会員申請フォーム（A01a/B01a/P01a ほか reg-card 共通）: ラベル左｜入力右・左寄せ大見出し・シェブロンのステップ（design: 法人 本登録画面） ===== */
@media (max-width: 767px) {
  .reg-container { padding-left: 12px !important; padding-right: 12px !important; }
  .reg-container .page-title { text-align: left !important; font-size: 30px !important; font-weight: 900 !important; color: var(--fc-main-d, #1b75bb) !important; margin: 18px 0 14px !important; }
  .stepper-chevron { display: flex !important; gap: 0 !important; margin: 0 0 14px !important; background: transparent !important; }
  .stepper-chevron .step-item { flex: 1 1 0; height: 42px; display: flex !important; align-items: center; justify-content: center; background: #fff !important; color: var(--fc-main, #2a89d6) !important; font-size: 15px !important; font-weight: 800 !important; border: 0 !important; border-radius: 0 !important; margin-left: -8px; clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%); white-space: nowrap; }
  .stepper-chevron .step-item:first-child { margin-left: 0; clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); }
  .stepper-chevron .step-item.is-active { background: var(--fc-main, #2a89d6) !important; color: #fff !important; }
  .reg-card { padding: 18px 14px 20px !important; border-radius: 6px !important; }
  .reg-card .reg-section { display: block !important; padding: 0 0 6px !important; border: 0 !important; margin: 0 !important; }
  .reg-card .section-label-col { display: flex !important; align-items: center; gap: 8px; margin: 14px 0 10px !important; width: auto !important; font-size: 16px !important; font-weight: 800 !important; color: var(--fc-main-d, #1b75bb) !important; }
  .reg-card .fields-col { width: 100% !important; }
  .reg-card .form-row { display: flex !important; flex-direction: row !important; align-items: center !important; gap: 8px !important; margin: 0 0 10px !important; }
  .reg-card .form-row.is-top { align-items: flex-start !important; }
  .reg-card .field-label { flex: 0 0 84px !important; width: 84px !important; font-size: 11px !important; font-weight: 800 !important; color: var(--fc-main-d, #1b75bb) !important; line-height: 1.35; }
  .reg-card .field-input-box { flex: 1 1 0 !important; min-width: 0; font-size: 12px; }
  .reg-card .input-text, .reg-card select, .reg-card textarea { height: 34px !important; border-radius: 4px !important; background: #eef1f5 !important; border: 0 !important; font-size: 12px !important; padding: 0 10px !important; }
  .reg-card textarea { height: auto !important; padding: 8px 10px !important; }
}
@media (max-width: 767px) { .reg-card label { font-size: 11.5px !important; } .reg-card .input-text::placeholder { font-size: 11px; } }
/* ページ見出し（design: 左寄せ・30px・太字の青） */
@media (max-width: 767px) { h1.page-title { font-size: 30px !important; font-weight: 900 !important; color: var(--fc-main-d, #1b75bb); text-align: left; } }

/* 「さま」の後ろの改行は SP のみ */
.sp-br { display: none; }
@media (max-width: 767px) {
  .sp-br { display: inline; }
  .step-header { justify-content: flex-start !important; }
  .step-header .step-btn-orange, .step-header .step-btn-outline { margin-left: 0 !important; }
}

/* A02 申込モーダル: ボタンは左右2つのアウトラインpill（design: 仮申込入力）／見出しは語の途中で折り返さない */
@media (max-width: 767px) {
  .booking-modal-card .modal-action-bar { display: flex !important; flex-wrap: nowrap !important; gap: 10px !important; justify-content: center; }
  .booking-modal-card .modal-action-bar > a, .booking-modal-card .modal-action-bar > button { flex: 1 1 0 !important; min-width: 0 !important; height: 44px; display: flex !important; align-items: center; justify-content: center; border-radius: 999px !important; font-size: 13px !important; font-weight: 800 !important; padding: 0 8px !important; background: #fff !important; box-shadow: none !important; white-space: nowrap; }
  .booking-modal-card .modal-action-bar > a { border: 1.5px solid #9a9a9a !important; color: #777 !important; }
  .booking-modal-card .modal-action-bar > button { border: 1.5px solid var(--fc-main, #2a89d6) !important; color: var(--fc-main-d, #1b75bb) !important; }
  .booking-modal-card [class*="banner"], .booking-modal-card .modal-title-banner, .booking-modal-card h2 { word-break: keep-all; overflow-wrap: anywhere; text-wrap: balance; }
}

/* 画面下の固定デモバーを非表示 */
@media (max-width: 1024px) {
  .demo-bar-row[style*="position:fixed"], .demo-bar-row[style*="position: fixed"] { display: none !important; }
}

/* 1〜2文字だけ次行に残る折返し（孤立文字）を避ける */
@media (max-width: 767px) { h1, h2, h3, h4, p, li, td, th, a, label, .course-title, .card-heading { text-wrap: pretty; } }

/* 一覧テーブル（A06/B07/P04ほか table.data）: 先頭列は日時を2行に、2列目(企業/コース)を広く確保 → 列は spec のまま、枠内を横スクロール */
@media (max-width: 767px) {
  table.data thead th:nth-child(1), table.data tbody td:nth-child(1) { min-width: 88px; max-width: 100px; white-space: normal !important; word-break: keep-all; }
  table.data thead th:nth-child(2), table.data tbody td:nth-child(2) { min-width: 190px; }
}

/* B07 受信申込一覧: コース列を広く確保（列は spec のまま・枠内横スクロール） */
@media (max-width: 767px) {
  table.app-table th:nth-child(1), table.app-table td:nth-child(1) { min-width: 88px; max-width: 100px; white-space: normal; word-break: keep-all; }
  table.app-table th:nth-child(2), table.app-table td:nth-child(2) { min-width: 200px; }
  table.app-table th:nth-child(3), table.app-table td:nth-child(3) { min-width: 130px; }
}

/* タブレット(768-1024)でも1文字ずつ縦に割れないよう、ボタン・バッジは折返さず、表の主要列に最小幅を確保 */
@media (max-width: 1024px) {
  .btn-postal-auto, .timeslot-remain-badge, .badge-cat, .badge-btob, .badge-reply-waiting { white-space: nowrap; }
  table.app-table th:nth-child(1), table.app-table td:nth-child(1) { min-width: 92px; }
  table.app-table th:nth-child(2), table.app-table td:nth-child(2) { min-width: 180px; }
  table.app-table th:nth-child(3), table.app-table td:nth-child(3) { min-width: 120px; }
  table.data th:nth-child(2), table.data td:nth-child(2) { min-width: 160px; }
}

/* --- 2026-11-15 追補 --- */
@media (max-width: 767px) {
  /* A02a カレンダー：曜日列を等幅にする（月曜列だけ広がる不具合の修正） */
  .booking-cal-table { table-layout: fixed !important; width: 100% !important; }
  /* パンくずとタイトルが詰まる画面の余白 */
  .page-container > h1.page-title:first-child { margin-top: 14px !important; }
  /* 本文の最後とフッターの間に余白（フッターへ密着させない） */
  body > *:has(+ footer), body > *:has(+ script + footer), body > *:has(+ script + script + footer) { margin-bottom: 32px; }
  body > .reg-container, body > .page-container { margin-bottom: auto !important; padding-bottom: 32px !important; }
}
@media (max-width: 767px) {
  .site-header .header-icon-link { white-space: nowrap !important; font-size: 9px !important; padding: 0 3px !important; }
  .site-header:has(.header-icon-link) .header-mypage-btn { padding: 0 6px !important; }
  .site-header:has(.header-icon-link) .header-logo-box img, .site-header:has(.header-icon-link) .header-logo-box svg { max-height: 30px; width: auto; }
}
@media (max-width: 767px) {
  /* 項目エラーは入力欄の直下に余白を空けて左揃え（PC 用の負マージンで入力欄に重なる不具合の修正） */
  .fc-field-error, .reset-card .fc-field-error, .login-card .fc-field-error { margin: 6px 0 0 !important; text-align: left !important; width: 100%; }
}
@media (max-width: 767px) {
  .reset-card .input-row .input-field, .login-card .input-row .input-field { max-width: none !important; width: 100%; }
}

/* --- チャット（C08 a/b/p）SP: 申込詳細ボタン／ページ送り／入力欄 --- */
@media (max-width: 767px) {
  .convo-header { position: relative; }
  .sp-detail-btn { flex: none; margin-left: auto; align-self: center; white-space: nowrap; background: #fff; color: var(--fc-main-d, #1b75bb); border: 1.5px solid var(--fc-main, #2a8ad4); border-radius: 9999px; padding: 7px 14px; font-size: 12px; font-weight: 800; text-decoration: none; }
  .sp-pager { flex: none; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 16px; background: #fff; border-top: 1px solid #e5e9ee; }
  .sp-pg-arrow { background: #fff; border: 1px solid #cbd5e1; color: #64748b; font-size: 14px; font-weight: 700; padding: 4px 12px; border-radius: 6px; }
  .sp-pg-arrow:disabled { opacity: .4; }
  .sp-pg-num { background: none; border: 0; font-size: 13px; font-weight: 700; color: #64748b; padding: 4px 12px; border-radius: 6px; }
  .sp-pg-num.active { background: var(--fc-main, #2a8ad4); color: #fff; }
  /* 入力欄: テキストエリアを高く、送信ボタンは枠の右側・上下中央 */
  .composer-box { display: grid !important; grid-template-columns: minmax(0, 1fr) 76px; grid-template-areas: "ta btn" "tip tip"; align-items: center; column-gap: 10px; }
  .composer-box > .composer-footer { display: contents !important; }
  .composer-textarea { grid-area: ta; min-height: 104px !important; height: 104px; width: 100% !important; min-width: 0; }
  .composer-footer .btn-send { grid-area: btn; align-self: center !important; justify-self: stretch; padding: 9px 0 !important; }
  .composer-box .composer-footer .composer-tip { grid-area: tip; margin-top: 6px; }
}
@media (max-width: 767px) {
  .thread-list-panel { max-height: none !important; height: 100%; }
}

/* ヘッダーロゴもロール別テーマ色に（提供企業=teal）。他の提供企業画面（B03/B04/B07/B13）のロゴ色 #2a8b8b に統一 */
html[data-fc-role="b"] .header-logo-box { color: #2a8b8b !important; }
html[data-fc-role="b"] .header-logo-badge { background: #2a8b8b !important; }

/* 絞り込みのプルダウン（ラベル＋セレクト）は同じ長さに揃える：ラベル列を固定し、セレクトは残り幅いっぱい */
@media (max-width: 767px) {
  .control-group:has(> .control-label + select:last-child) { display: grid !important; grid-template-columns: 84px minmax(0, 1fr); align-items: center; gap: 8px; width: 100%; }
  .control-group:has(> .control-label + select:last-child) > select { width: 100% !important; min-width: 0; }
}
@media (max-width: 767px) {
  /* A10/B14 並び替え、B11b 対象月、C11 既読状態 も同じ長さ（残り幅いっぱい）に揃える */
  .sort-box:has(> span + select) { display: grid !important; grid-template-columns: 84px minmax(0, 1fr); align-items: center; gap: 8px; width: 100%; }
  .sort-box > select { width: 100% !important; min-width: 0; }
  div:has(> span + select.month-select) { display: grid !important; grid-template-columns: 84px minmax(0, 1fr); align-items: center; gap: 8px; width: 100%; }
  select.month-select { width: 100% !important; min-width: 0; }
  .notif-toolbar-bar > select.filter-select { width: 100% !important; }
}
@media (max-width: 767px) {
  .search-input-box, .search-input-wrap { width: 100% !important; max-width: none !important; }
}

/* お問い合わせ一覧（A12）件名セル: 未読の赤点は件名1行目の高さに、📎[画像あり]は件名の下に1行のバッジで */
@media (max-width: 767px) {
  .subject-link { display: flex !important; align-items: flex-start !important; flex-wrap: wrap !important; gap: 4px 6px !important; }
  .subject-link > .unread-dot { flex: none; margin-top: 7px; }
  .subject-link > span:not(.unread-dot):not([style*="font-size:11px"]) { flex: 1 1 0; min-width: 120px; }
  .subject-link > span[style*="font-size:11px"] { flex: 0 0 auto; white-space: nowrap !important; margin-left: 0; font-size: 10.5px !important; background: #f1f5f9; border-radius: 9999px; padding: 2px 8px; line-height: 1.5; }
  .subject-link > .unread-dot ~ span[style*="font-size:11px"] { margin-left: 12px; }
}


/* ===== SP ハンバーガーメニュー（PC サイドメニュー → スマホ／タブレット）=====
   デザイン: mockups/html_design/SP Hamburger（img179 提供企業 / img181 申込企業・個人）
   - 画面下中央の「MENU」ボタンで全画面メニューを開き、「CLOSE」で閉じる
   - 親項目はアコーディオン（▼ 閉 / ▲ 開）。現在地を含むグループを開いた状態にする
   - メニュー項目はPC版サイドメニューと同一（リンク先・文言は変更しない）。表示形式のみ変更 */
@media (max-width: 1024px) {
  .app-sidebar { display: none !important; }
  html.sp-menu-open, html.sp-menu-open body { overflow: hidden !important; }
  html.sp-menu-open .app-sidebar {
    display: block !important; position: fixed !important; inset: 0 !important; z-index: 2147483000;
    background: #fff; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 56px 24px 130px !important; margin: 0 !important; box-sizing: border-box;
  }
  .app-sidebar .sidebar-btn-group {
    position: relative; display: block !important; width: 100%; max-width: 480px; margin: 0 auto 16px !important;
    background: #fff; border: 1px solid #d9dee4 !important; border-radius: 8px !important; overflow: visible !important;
    box-shadow: none !important; padding: 0 !important; height: auto !important;
  }
  .app-sidebar .sidebar-main-btn {
    position: relative; display: flex !important; align-items: center; justify-content: center; width: 100% !important; box-sizing: border-box;
    min-height: 54px; padding: 12px 40px !important; margin: 0 !important; border: 0 !important; border-radius: 8px !important;
    background: #fff !important; color: var(--fc-main-d, var(--fc-main, #1b75bb)) !important; font-size: 17px !important; font-weight: 700 !important;
    text-align: center; cursor: pointer; font-family: inherit; text-decoration: none;
  }
  .app-sidebar .sidebar-main-btn.is-active, .app-sidebar .sp-open > .sidebar-main-btn {
    background: var(--fc-main, #1b75bb) !important; color: #fff !important; border-radius: 7px 7px 0 0 !important;
  }
  .app-sidebar .sp-plain > .sidebar-main-btn.is-active { border-radius: 7px !important; }
  .app-sidebar .sp-plain > .sidebar-main-btn > span:not(:first-child) { display: none !important; }
  .app-sidebar .sidebar-main-btn .arrow { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 11px; line-height: 1; }
  .app-sidebar .sidebar-sub-menu { display: none !important; padding: 8px 0 12px !important; margin: 0 !important; border: 0 !important; background: #fff !important; }
  .app-sidebar .sp-open > .sidebar-sub-menu { display: block !important; }
  .app-sidebar .sidebar-sub-item {
    position: relative; display: flex !important; align-items: center; justify-content: space-between; width: 100% !important; box-sizing: border-box;
    padding: 12px 24px !important; margin: 0 !important; border: 0 !important; border-radius: 0 !important; height: auto !important;
    background: #fff !important; color: var(--fc-main-d, var(--fc-main, #1b75bb)) !important; font-size: 16px !important; font-weight: 700 !important; text-decoration: none;
  }
  .app-sidebar .sidebar-sub-item.is-active { background: color-mix(in srgb, var(--fc-main, #1b75bb) 10%, #fff) !important; }
  .app-sidebar .sidebar-sub-item > span:last-child { margin-left: 12px; font-size: 18px; }
  /* 未読ドット: 項目の先頭（サブ項目）／カード左上（親）に赤丸で表示 */
  .app-sidebar .sidebar-sub-item > span[style*="ef4444"] { display: none !important; }
  .app-sidebar .sidebar-sub-item.sp-unread::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #e53935; margin-right: 8px; flex: 0 0 auto; }
  .app-sidebar .sidebar-sub-item > span:first-child, .app-sidebar .sidebar-sub-item.sp-nospan { flex: 1 1 auto; }
  .app-sidebar .sidebar-sub-item.sp-unread > span:first-child { flex: 1 1 auto; }
  .app-sidebar .sidebar-btn-group.sp-has-unread::after { content: ""; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #e53935; z-index: 2; }

  /* MENU / CLOSE ボタン（画面下中央・共通） */
  .sp-menu-fab {
    position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 2147483001;
    width: 70px; height: 60px; padding: 8px 0 6px; box-sizing: border-box; border-radius: 35px 35px 0 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    font: 700 10px/1 inherit; font-family: inherit; letter-spacing: .02em; cursor: pointer;
    background: #fff; color: var(--fc-main, #1b75bb); border: 2px solid var(--fc-main, #1b75bb); border-bottom: 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,.12);
  }
  .sp-menu-fab .sp-bars { width: 26px; height: 18px; background: linear-gradient(currentColor 0 0) 0 0/100% 3px no-repeat, linear-gradient(currentColor 0 0) 0 50%/100% 3px no-repeat, linear-gradient(currentColor 0 0) 0 100%/100% 3px no-repeat; }
  .sp-menu-fab .sp-x { display: none; width: 26px; height: 18px; position: relative; }
  .sp-menu-fab .sp-x::before, .sp-menu-fab .sp-x::after { content: ""; position: absolute; left: 50%; top: 50%; width: 26px; height: 3px; background: currentColor; transform: translate(-50%, -50%) rotate(45deg); }
  .sp-menu-fab .sp-x::after { transform: translate(-50%, -50%) rotate(-45deg); }
  html.sp-menu-open .sp-menu-fab { background: var(--fc-main, #1b75bb); color: #fff; }
  html.sp-menu-open .sp-menu-fab .sp-bars { display: none; }
  html.sp-menu-open .sp-menu-fab .sp-x { display: block; }
  .sp-menu-fab .sp-lbl-close { display: none; }
  html.sp-menu-open .sp-menu-fab .sp-lbl-menu { display: none; }
  html.sp-menu-open .sp-menu-fab .sp-lbl-close { display: inline; }
}
@media (min-width: 1025px) { .sp-menu-fab { display: none !important; } }

/* メニュー（旧サイドバー）がハンバーガー化されたため、ロールタブ〜画面タイトルの間隔を約32pxに統一 */
@media (max-width: 1024px) {
  .page-shell:has(> .app-sidebar) { margin-top: 32px !important; }
}

/* ハンバーガーメニュー内「新規登録」ボタン（PC版サイドメニューと同じ枠ボタン）。見学コース管理グループの先頭に表示 */
@media (max-width: 1024px) {
  .app-sidebar .btn-sidebar-create { display: block; margin: 12px 24px 4px; padding: 11px 0; border: 1.5px solid var(--fc-main, #2a8b8b); border-radius: 9999px; background: #fff; color: var(--fc-main-d, var(--fc-main, #2a8b8b)); font-size: 15px; font-weight: 800; text-align: center; text-decoration: none; }
  .app-sidebar .sidebar-main-btn:focus, .app-sidebar .sidebar-main-btn:focus-visible { outline: none; box-shadow: none; }
}

/* ===== 画面タイトル（h1）サイズ統一: 一覧・詳細・マイページ系の画面タイトルは全画面 26px/800 =====
   fc-theme.css が h1.main-title 等を 22px(!important) で上書きしているため、同じ詳細度で後から指定する。
   対象外: 登録・決済などステップ付きフォームの .page-title(30px/900・デザイン準拠)、ヒーロー、カード内見出し */
@media (max-width: 1024px) {
  h1.main-title, h1.main-heading-title, h1.section-main-title { font-size: 26px !important; font-weight: 800 !important; line-height: 1.3 !important; }
}
