/* ===== モバイルレスポンシブ（768px以下） ===== */

/* --- 性別連動アイコン（PC: 👩固定 / モバイル: 性別連動） --- */
.owner-icon-mobile { display: none; }
.owner-icon-pc { display: inline; }
.avatar-text-mobile { display: none; }
.avatar-text-pc { display: inline; }

/* モバイルのみ表示ユーティリティ */
.sp-only { display: none; }

@media (max-width: 768px) {

    /* === 横スクロール防止（グローバル） === */
    html, body {
        overflow-x: hidden;
        max-width: 100%;
    }

    /* === コンテンツ幅制限（全コンテナ） === */
    #app, #lp-view, #dashboard-view, .content, #page-content {
        max-width: 100%;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }

    /* メディア要素の幅制限 */
    img, iframe, video, canvas, svg, table, pre, code {
        max-width: 100% !important;
    }

    .sp-only { display: inline; }

    /* --- テキスト改行制御（全画面共通） --- */
    body {
        word-break: keep-all;
        overflow-wrap: break-word;
        line-height: 1.8;
    }

    h1, h2, h3, h4, p, span, label, div, a, button {
        word-break: keep-all;
        overflow-wrap: break-word;
    }

    .btn, button {
        white-space: normal !important;
        word-break: keep-all;
    }

    /* --- 性別連動アイコン（モバイルのみ切替） --- */
    .owner-icon-pc { display: none; }
    .owner-icon-mobile { display: inline; }
    .avatar-text-pc { display: none; }
    .avatar-text-mobile { display: inline; font-size: 1rem; }

    /* --- ナビバー --- */
    .hamburger-btn {
        display: flex;
    }

    .glass-nav {
        height: 60px;
    }

    .nav-content {
        width: 95%;
        align-items: center;
    }

    body {
        padding-top: 68px;
    }

    .logo {
        font-size: 1.1rem;
        gap: 6px;
    }

    /* ナビリンク → スライドダウンパネル */
    .nav-links {
        display: none !important;
        position: fixed;
        top: 60px;
        left: 0;
        width: 100%;
        background: rgba(255, 255, 255, 0.97);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 15px 20px;
        gap: 5px;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
        border-bottom: 2px solid var(--border);
        z-index: 1000;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }

    .nav-links.mobile-open {
        display: flex !important;
    }

    .nav-links a {
        padding: 14px 16px;
        font-size: 1rem;
        border-radius: 14px;
        width: 100%;
    }

    .nav-links a.active {
        background: var(--primary-light);
    }

    /* ユーザーメニュー */
    .user-menu-container {
        margin-left: auto;
    }

    .user-profile {
        padding: 4px 8px;
        font-size: 0.8rem;
    }

    #nav-username {
        display: none;
    }

    .avatar {
        background: transparent;
        font-size: 1.2rem;
        width: 32px;
        height: 32px;
    }

    .dropdown-menu {
        position: fixed;
        top: 60px;
        right: 10px;
        width: calc(100% - 20px);
        max-width: 300px;
    }

    /* --- ランディングページ --- */
    .hero-text h1 {
        font-size: 1.7rem !important;
    }

    .hero-text p {
        font-size: 0.9rem !important;
    }

    .btn-lg {
        padding: 14px 28px !important;
        font-size: 0.95rem !important;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .f-card {
        padding: 28px 22px;
        max-width: 100%;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }
    .f-card h3,
    .f-card p {
        max-width: 100%;
        overflow-wrap: break-word;
        word-wrap: break-word;
        word-break: normal;
    }

    .section-title h2 {
        font-size: 1.5rem;
    }

    .lp-mock-dashboard {
        grid-template-columns: 1fr !important;
    }

    /* --- LP横スクロール防止 --- */
    #lp-view {
        overflow-x: hidden;
        max-width: 100%;
    }
    #lp-view > section {
        max-width: 100%;
        box-sizing: border-box;
    }
    .hero-section {
        padding-left: 20px !important;
        padding-right: 20px !important;
    }
    .features-section {
        padding-left: 20px !important;
        padding-right: 20px !important;
        box-sizing: border-box;
    }
    .features-grid {
        max-width: 100%;
    }

    /* --- FP相談ラウンジ: モバイル全体修正 --- */

    /* カレンダーヘッダー折り返し */
    .fp-calendar-header {
        flex-wrap: wrap !important;
        gap: 10px !important;
    }
    .fp-calendar-header .btn {
        font-size: 0.82rem !important;
        padding: 8px 12px !important;
    }

    /* Google Calendar iframe: コンテナ + iframe幅制限 */
    .fp-calendar-header + div {
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
        height: 350px !important;
    }
    .fp-calendar-header + div iframe {
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
    }

    /* 面談予約フォーム全体 */
    #consult-booking-form {
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding: 0 !important;
    }
    #consult-booking-form input,
    #consult-booking-form select,
    #consult-booking-form textarea {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    /* 希望日・希望時間: iOS Safari date/time入力の幅・外観修正 */
    #consult-booking-form input[type="date"],
    #consult-booking-form input[type="time"] {
        -webkit-appearance: none !important;
        appearance: none !important;
        width: 100% !important;
        height: auto !important;
        padding: 10px 12px !important;
        border-radius: 12px !important;
        border: 1px solid var(--border) !important;
        background: white !important;
        font-size: 0.95rem !important;
        text-align: left !important;
    }
    #consult-booking-form > div[style*="padding"] {
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-wrap: break-word;
        word-break: normal;
    }

    /* 予約送信ボタン */
    #consult-booking-form .btn,
    #consult-booking-form button {
        max-width: 100% !important;
        box-sizing: border-box !important;
        white-space: normal !important;
        overflow-wrap: break-word;
    }

    /* FPプロフィールカード: 全幅 + テキスト折り返し */
    .fp-cards-grid {
        padding: 0 16px !important;
    }
    .fp-cards-grid .glass-card {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-wrap: break-word;
        word-break: normal;
    }
    .fp-cards-grid .glass-card p,
    .fp-cards-grid .glass-card h3,
    .fp-cards-grid .glass-card span {
        overflow-wrap: break-word;
        word-break: normal;
        max-width: 100%;
    }

    /* FP相談ラウンジ: カレンダー・予約フォームカード幅統一 */
    .glass-card:has(.fp-calendar-header),
    .glass-card:has(#consult-booking-form) {
        width: calc(100% - 32px) !important;
        margin: 0 auto !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* FP相談ラウンジ全テキスト: 折り返し */
    .dashboard-main-grid h3,
    .dashboard-main-grid p,
    .dashboard-main-grid label,
    .dashboard-main-grid span {
        overflow-wrap: break-word;
        word-break: normal;
    }

    footer {
        padding: 30px 5% 20px !important;
    }

    /* --- ダッシュボード --- */
    .content {
        width: 95%;
        padding: 15px 0;
    }

    .dashboard-header {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        text-align: center;
    }

    #dashboard-view .dashboard-header h1 {
        font-size: 1.4rem; /* 22px ページタイトル */
    }

    /* サマリーカード */
    .summary-cards {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .summary-card {
        padding: 22px;
        border-radius: 22px;
    }

    .summary-card-value {
        font-size: 1.8rem;
    }

    /* ダッシュボードメイングリッド → 1カラム */
    .dashboard-main-grid {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }

    /* 月セレクター矢印非表示 */
    .month-selector .btn-icon-sm {
        display: none;
    }

    .month-selector {
        padding: 8px 20px !important;
    }

    /* カレンダー */
    .calendar-section {
        padding: 22px 16px;
        border-radius: 20px;
    }

    .calendar-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
        margin-bottom: 20px;
    }

    .calendar-grid {
        gap: 4px;
    }

    .calendar-day {
        min-height: 55px;
        padding: 6px 3px 4px;
        border-radius: 8px;
        font-size: 0.75rem;
    }

    .calendar-day-number {
        font-size: 0.75rem;
    }

    .calendar-day-expense,
    .calendar-day-income {
        font-size: 0.55rem;
    }

    .calendar-day-name {
        font-size: 0.65rem;
        padding: 6px 2px;
    }

    .calendar-controls button {
        width: 44px;
        height: 44px;
    }

    /* --- カレンダーはみ出し防止 --- */
    .home-sec-calendar {
        padding: 10px 6px !important;
    }
    .home-sec-calendar h3 {
        padding: 0 8px;
        margin-bottom: 10px !important;
    }
    #calendar-grid {
        gap: 2px !important;
        max-width: 100%;
        overflow: hidden;
    }
    .calendar-day {
        min-height: 38px !important;
        padding: 3px 1px 1px !important;
        aspect-ratio: auto !important;
        overflow: hidden !important;
        border-width: 1px !important;
    }
    .calendar-day-number {
        font-size: 0.6rem !important;
    }
    .cal-amounts {
        gap: 0 !important;
    }
    .cal-amt {
        font-size: 0.42rem !important;
        line-height: 1.1;
    }
    .calendar-day-header {
        font-size: 0.55rem !important;
        padding: 3px 1px !important;
    }
    #day-detail-area {
        padding: 0 8px;
    }

    /* glass-card（inline padding上書き + 幅制限） */
    .glass-card {
        border-radius: 20px;
        padding: 20px !important;
        max-width: 100%;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }

    /* クイックアクション */
    .quick-actions {
        grid-template-columns: 1fr;
    }

    .quick-action-btn {
        padding: 16px 20px;
        font-size: 1rem;
    }

    /* --- シミュレーション --- */
    .simulator-layout {
        grid-template-columns: 1fr;
    }

    .sim-input-grid {
        grid-template-columns: 1fr !important;
    }

    .sim-summary-grid {
        grid-template-columns: 1fr !important;
    }

    /* ローン開始/終了年月: 縦並び + 他フィールドとスタイル統一 */
    .loan-period-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }
    .loan-period-grid input[type="month"] {
        -webkit-appearance: none;
        appearance: none;
        background: white !important;
        width: 100% !important;
        padding: 12px !important;
        border-radius: 12px !important;
        border: 1px solid var(--border) !important;
        font-size: 1rem !important;
        height: auto !important;
        box-sizing: border-box !important;
        color: var(--text-main) !important;
    }

    /* ローン月々返済額ブロック: 白背景 + 全幅統一 */
    .loan-monthly-block {
        background: white !important;
        border: 1px solid var(--border) !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* お子様情報カード: ニックネーム全幅 + 年齢・続柄2列 */
    .child-info-card {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
        padding: 18px !important;
    }

    .child-info-card .child-field-nickname {
        grid-column: span 2;
    }

    /* --- レポート --- */
    .tab-container {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .tab-btn {
        font-size: 0.94rem;
        padding: 14px 12px;
        white-space: nowrap;
    }

    /* stats-grid */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* --- モーダル --- */
    .modal .modal-content {
        max-width: 95% !important;
        max-height: 75vh !important;
        overflow-y: auto !important;
        padding: 25px 18px !important;
        border-radius: 24px !important;
    }

    .modal .modal-header {
        position: sticky;
        top: -25px;
        background: white;
        z-index: 1;
        padding: 18px 0 12px;
        margin: -25px -18px 20px;
        padding-left: 18px;
        padding-right: 18px;
        border-radius: 24px 24px 0 0;
    }

    .modal .modal-header h2,
    .modal .modal-header h3 {
        font-size: 1.3rem;
    }

    /* --- 認証画面 --- */
    #auth-view {
        padding: 20px 10px !important;
    }

    #auth-modal {
        padding: 30px 20px !important;
        border-radius: 28px !important;
    }

    /* --- 証明書モーダル --- */
    .certificate-inner {
        min-width: auto;
        max-width: 95vw;
        padding: 30px 20px;
    }

    .certificate-title {
        font-size: 1.3rem;
        letter-spacing: 3px;
    }

    /* --- 通知 --- */
    .notif-container {
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .notif-card {
        padding: 16px 18px 14px;
    }

    /* --- ライフマップ --- */
    .lmh-timeline-area {
        height: 380px;
        padding: 0 15px;
    }

    .lmh-compare-grid {
        grid-template-columns: 1fr;
    }

    .lmh-compare-card {
        padding: 22px 20px;
    }

    /* --- 未来マップ比較セクション 幅制限・テキスト折り返し --- */
    .lmh-compare-section,
    .lmh-compare-section * {
        max-width: 100%;
        box-sizing: border-box;
    }
    .lmh-compare-header,
    .lmh-compare-footer,
    .lmh-compare-header > div,
    .lmh-compare-footer > div,
    .lmh-compare-card {
        min-width: 0;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }
    .lmh-compare-section {
        overflow: hidden;
    }
    .lmh-compare-title {
        font-size: 0.95rem;
        word-break: normal;
        overflow-wrap: break-word;
    }
    .lmh-compare-subtitle,
    .lmh-compare-card-title,
    .lmh-compare-breakdown,
    .lmh-compare-card-desc {
        word-break: normal;
        overflow-wrap: break-word;
    }
    .lmh-compare-amount {
        font-size: 1.3rem;
        overflow-wrap: break-word;
    }

    .lmh-cta-section {
        padding: 30px 15px;
    }

    .lmh-cta-btn {
        padding: 14px 30px;
        font-size: 1rem;
    }

    /* --- 未来マップ モバイル全幅・カードスタイル統一 --- */
    .lm-container {
        padding: 0 16px !important;
        margin-top: 20px !important;
    }
    .lm-container > .lm-status-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 18px !important;
        margin-bottom: 20px !important;
        background: #fff !important;
        border-radius: 16px !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
        border: none !important;
        gap: 14px !important;
    }
    .lm-container > .lmh-wrapper {
        background: #fff !important;
        border-radius: 16px !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
        border: none !important;
        padding: 20px 12px !important;
    }
    .lm-container > .lmh-compare-section {
        background: #fff !important;
        border-radius: 16px !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
        border: none !important;
        padding: 20px !important;
        margin-top: 20px !important;
    }
    .lm-container > .lm-savings-card {
        background: #fff !important;
        border-radius: 16px !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
        border: none !important;
        padding: 20px !important;
        margin-top: 20px !important;
    }
    .lm-container > .lmh-cta-section {
        background: #fff !important;
        border-radius: 16px !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
        border: none !important;
        padding: 24px 20px !important;
        margin-top: 20px !important;
    }
    .lmh-cta-badge {
        right: 0 !important;
        top: -12px !important;
    }

    /* --- FPスコアカード --- */
    .fp-score-card {
        flex-direction: column !important;
        text-align: center;
        align-items: center !important;
    }

    /* --- ライフステージバッジ --- */
    .life-stage-badge {
        flex-direction: column;
        text-align: center;
    }

    /* --- ホーム画面セクション並び替え --- */
    .home-sections {
        display: flex !important;
        flex-direction: column;
        gap: 24px;
    }
    .home-sec-calendar { order: 1; }
    .home-sec-mode-content { order: 2; }
    .home-sec-stats-compact { order: 3; }
    .home-sidebar { order: 4; display: flex; flex-direction: column; gap: 12px; }
    .home-sec-cta { order: 5; }
    .home-sec-cta .glass-card {
        flex-direction: column !important;
        align-items: stretch !important;
        text-align: center;
        gap: 20px !important;
        padding: 28px 20px !important;
        background: linear-gradient(135deg, #fafdf8 0%, #f0f7ec 100%) !important;
    }
    .home-sec-cta .glass-card h3 {
        font-size: 1.15rem !important;
        line-height: 1.5;
    }
    .home-sec-cta .glass-card p {
        font-size: 0.94rem !important;
        line-height: 1.7;
    }
    .home-sec-cta .glass-card .btn {
        width: 100%;
        padding: 16px 20px !important;
        font-size: 1rem;
    }

    /* --- 修正②: ライフマップ簡素化 --- */
    .lmh-mobile-dimmed {
        opacity: 0.15 !important;
        filter: blur(2px) !important;
        pointer-events: none;
    }

    .lmh-mobile-highlight {
        opacity: 1 !important;
        filter: none !important;
        z-index: 10;
    }

    .lmh-mobile-highlight .lmh-pin {
        box-shadow: 0 0 20px rgba(91, 140, 106, 0.4);
        animation: lmh-highlight-pulse 2s ease-in-out infinite;
    }

    @keyframes lmh-highlight-pulse {
        0%, 100% { box-shadow: 0 0 12px rgba(91, 140, 106, 0.25); transform: scale(1); }
        50% { box-shadow: 0 0 25px rgba(91, 140, 106, 0.5); transform: scale(1.1); }
    }

    .lmh-mobile-summary {
        position: absolute;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 15;
        background: white;
        border: 2px solid var(--primary-light);
        border-radius: 20px;
        padding: 10px 20px;
        font-size: 0.875rem;
        font-weight: 800;
        color: var(--primary-dark);
        cursor: pointer;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        transition: all 0.2s ease;
    }

    .lmh-mobile-summary:active {
        transform: translateX(-50%) scale(0.96);
    }

    /* --- 修正④: FPカード縦並び --- */
    .fp-cards-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    /* ===== モバイル全画面フォントサイズ最適化 ===== */

    /* --- インラインstyle 補足テキスト底上げ: 13px (0.82rem) --- */
    #page-content [style*="font-size:0.65rem"],
    #page-content [style*="font-size:0.68rem"],
    #page-content [style*="font-size:0.7rem"],
    #page-content [style*="font-size:0.72rem"],
    #page-content [style*="font-size:0.75rem"],
    #page-content [style*="font-size:0.78rem"],
    #page-content [style*="font-size:0.8rem"] {
        font-size: 0.82rem !important;
    }

    /* --- インラインstyle 本文底上げ: 15px (0.94rem) --- */
    #page-content [style*="font-size:0.9rem"] {
        font-size: 0.94rem !important;
    }

    /* --- インラインstyle ボタン底上げ: 16px (1rem) --- */
    #page-content button[style*="font-size:0.65rem"],
    #page-content button[style*="font-size:0.68rem"],
    #page-content button[style*="font-size:0.7rem"],
    #page-content button[style*="font-size:0.72rem"],
    #page-content button[style*="font-size:0.75rem"],
    #page-content button[style*="font-size:0.78rem"],
    #page-content button[style*="font-size:0.8rem"],
    #page-content button[style*="font-size:0.85rem"],
    #page-content button[style*="font-size:0.9rem"],
    #page-content button[style*="font-size:0.95rem"] {
        font-size: 1rem !important;
    }

    /* --- セクション見出し: 18px --- */
    #page-content h3 {
        font-size: 1.15rem !important;
    }
    #page-content h3[style*="font-size:1.4rem"],
    #page-content h3[style*="font-size:1.3rem"] {
        font-size: 1.35rem !important;
    }
    #page-content h4 {
        font-size: 1.1rem !important;
    }

    /* --- フォームラベル: 14px --- */
    #page-content .form-group label {
        font-size: 0.875rem !important;
    }

    /* --- コンパクト収支行 --- */
    .home-sec-stats-compact {
        font-size: 0.875rem !important;
        padding: 12px 16px !important;
    }
    .hsc-label {
        font-size: 0.82rem !important;
    }
    .hsc-cooking-opt {
        font-size: 0.78rem !important;
        padding: 8px 4px !important;
    }

    /* --- サマリーカード --- */
    .summary-card-header {
        font-size: 0.94rem !important;
    }
    .card-title {
        font-size: 0.875rem !important;
    }

    /* --- ライフマップ比較カード --- */
    .lmh-compare-card-label {
        font-size: 0.82rem !important;
    }
    .lmh-compare-card-title {
        font-size: 0.94rem !important;
    }
    .lmh-compare-breakdown {
        font-size: 0.82rem !important;
    }
    .lmh-compare-card-desc {
        font-size: 0.875rem !important;
    }
    .lmh-compare-footer {
        font-size: 0.82rem !important;
    }
    .lmh-compare-subtitle {
        font-size: 0.875rem !important;
    }
    .lmh-compare-meyasu {
        font-size: 0.82rem !important;
    }
    .lmh-cta-hint {
        font-size: 0.875rem !important;
    }

    /* --- 労いメッセージ --- */
    .praise-text {
        font-size: 0.875rem !important;
    }

    /* --- 通知カード --- */
    .notif-title {
        font-size: 0.94rem !important;
    }
    .notif-message {
        font-size: 0.875rem !important;
    }
    .notif-confirm {
        font-size: 0.875rem !important;
    }

    /* --- ドロップダウンメニュー --- */
    .dropdown-menu a {
        font-size: 1rem !important;
        padding: 14px 18px !important;
        min-height: 44px;
    }

    /* ===== モバイル全画面 余白・タップ領域最適化 ===== */

    /* --- テキスト行間: 1.7 --- */
    #page-content {
        line-height: 1.7;
    }
    #page-content h1,
    #page-content h2,
    #page-content h3,
    #page-content h4 {
        line-height: 1.4;
    }

    /* --- ボタン最小タップ領域: 44px × 44px --- */
    #page-content .btn {
        min-height: 44px;
    }
    .btn-icon-sm {
        width: 44px !important;
        height: 44px !important;
    }
    .modal .close-btn {
        width: 44px !important;
        height: 44px !important;
    }
    .notif-confirm {
        min-height: 44px !important;
        padding: 12px 16px !important;
    }

    /* --- インラインpadding小ボタン補正 --- */
    #page-content button[style*="padding:4px"],
    #page-content button[style*="padding:5px"],
    #page-content button[style*="padding:3px"] {
        min-height: 44px !important;
        padding-top: 10px !important;
        padding-bottom: 10px !important;
    }
    #page-content button[style*="padding:8px"] {
        min-height: 44px !important;
        padding-top: 12px !important;
        padding-bottom: 12px !important;
    }

    /* --- フォーム要素 最小タップ領域 --- */
    #page-content input,
    #page-content select {
        min-height: 44px;
    }

    /* --- ボタン間隔底上げ: 12px --- */
    #page-content [style*="gap:8px"] {
        gap: 12px !important;
    }
    #page-content [style*="gap:6px"] {
        gap: 12px !important;
    }

    /* --- カード内padding底上げ --- */
    #page-content [style*="padding:18px"] {
        padding: 20px !important;
    }

    /* --- 子供プロフィール入力フィールド --- */
    #page-content .child-nickname,
    #page-content .child-age,
    #page-content .child-relation {
        padding: 14px !important;
    }

    /* --- 目標選択ボタングリッド --- */
    #goal-options {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }
    #goal-options .goal-choice-btn[style*="grid-column: span 3"] {
        grid-column: span 2 !important;
    }

    /* --- プロフィール glass-card: 汎用ルールに委ねる --- */
    #profile-detail-card > h3 {
        margin-bottom: 16px !important;
        font-size: 1.2rem !important;
    }

    /* --- プロフィール設定フォーム 1カラム化 + コンパクト --- */
    #general-profile-form {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        row-gap: 12px !important;
        column-gap: 12px !important;
    }
    /* 入力フィールド: ローン/固定支出と同サイズに統一 */
    #general-profile-form input,
    #general-profile-form select,
    #general-profile-form textarea {
        padding: 10px !important;
        border-radius: 12px !important;
        font-size: 0.95rem !important;
        height: auto !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    /* 判定開始日 input[type=date]: iOS Safari対応 */
    #general-profile-form input[type="date"] {
        width: 100% !important;
        max-width: 100% !important;
        -webkit-appearance: none !important;
        appearance: none !important;
        text-align: left !important;
        padding: 10px 12px !important;
    }
    /* 子供情報カード: コンパクト化 */
    #general-profile-form .child-info-card {
        padding: 12px !important;
        gap: 8px !important;
    }
    #general-profile-form .child-info-card input,
    #general-profile-form .child-info-card select {
        padding: 8px !important;
    }
    #general-profile-form [style*="grid-column: span 2"],
    #general-profile-form [style*="grid-column:span 2"] {
        grid-column: span 1 !important;
    }
    /* 全直下要素: margin除去（gap のみで間隔制御） */
    #general-profile-form > * {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }
    /* 全label: ラベル↔フィールド間 8px, margin-left除去 */
    #general-profile-form label {
        margin-bottom: 8px !important;
        margin-top: 0 !important;
        margin-left: 0 !important;
    }
    /* 保存ボタン: モバイル幅調整 */
    #general-profile-form > div:last-child {
        text-align: center !important;
    }
    #general-profile-form > div:last-child .btn {
        width: 100% !important;
        max-width: 300px !important;
    }
    /* form-group内の補助テキスト・内部div */
    #general-profile-form .form-group > div[style*="margin"] {
        margin-top: 4px !important;
        margin-bottom: 0 !important;
    }
    /* 子供情報カード内部余白 */
    #general-profile-form .child-info-card {
        margin-bottom: 8px !important;
    }
    /* 目標グリッド上の説明テキスト */
    #general-profile-form #goal-options {
        margin-top: 0 !important;
    }
    #general-profile-form #goal-custom-field {
        margin-top: 8px !important;
    }

    /* --- 固定支出・ローン設定フォーム 余白詰め --- */
    #fixed-expense-add-form,
    #loan-add-form {
        gap: 16px !important;
    }
    #fixed-expense-add-form .form-group,
    #loan-add-form .form-group {
        margin-bottom: 0 !important;
    }
    #fixed-expense-add-form .form-group label,
    #loan-add-form .form-group label {
        margin-bottom: 8px !important;
    }

    /* --- FP相談ラウンジ: 予約フォーム日時グリッド --- */
    .booking-datetime-grid {
        grid-template-columns: 1fr !important;
    }

    /* --- セクション間マージン統一 --- */
    .form-group {
        margin-bottom: 24px;
    }
    .calendar-header {
        margin-bottom: 24px;
    }
    .section-header {
        margin-bottom: 24px;
    }

    /* --- エクスポートモーダル: ファイル形式カード縦並び --- */
    .export-format-grid {
        grid-template-columns: 1fr !important;
    }

    /* --- オンボーディングモーダル モバイル調整 --- */
    .onboarding-overlay {
        padding: 16px;
    }
    .onboarding-card {
        padding: 24px 18px !important;
        border-radius: 24px;
        max-height: calc(100vh - 32px);
    }
    .onboarding-features {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin-bottom: 14px;
        width: 100%;
        box-sizing: border-box;
    }
    .onboarding-feature {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 10px 4px;
        min-height: 80px;
        box-sizing: border-box;
    }
    .onboarding-feature-icon {
        font-size: 1.3rem;
        margin-bottom: 4px;
    }
    .onboarding-feature-title {
        font-size: 0.72rem;
    }
    .onboarding-feature-desc {
        font-size: 0.6rem;
    }
    .onboarding-tip {
        font-size: 0.8rem;
        padding: 10px 14px;
        margin-bottom: 14px;
    }
    .onboarding-start-btn {
        padding: 14px 20px !important;
    }

    /* --- カレンダーヒント モバイル調整 --- */
    .calendar-hint {
        font-size: 0.8rem;
        padding: 10px 14px;
    }
}

/* ============================================================
   ボトムナビゲーション (Bottom Navigation)
   ============================================================ */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 60px; background: white;
    border-top: 1px solid var(--border, #E8E0D4);
    display: flex; justify-content: space-around; align-items: center;
    z-index: 1500;
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}
.bottom-nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    background: none; border: none; cursor: pointer;
    color: var(--text-muted, #9E9789); font-size: 0.62rem; font-weight: 700;
    padding: 6px 12px; transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item.active { color: var(--primary-dark, #5B8C6A); }
.bottom-nav-item i, .bottom-nav-item svg { width: 22px; height: 22px; }

/* Mobile: show bottom nav, hide top nav links */
@media (max-width: 768px) {
    .bottom-nav { display: flex; }
    body.dashboard-active { padding-bottom: calc(60px + env(safe-area-inset-bottom, 0)) !important; }
    #logged-in-nav .nav-links { display: none !important; }
}
/* Desktop: hide bottom nav, show top nav links */
@media (min-width: 769px) {
    .bottom-nav { display: none !important; }
}
