/*
 * life-plan-styles.css - v3.5.0 (最終調整版)
 *
 * このスタイルシートは、人生プランの入力、一覧、表示ページのデザインを制御します。
 * 特に、モバイルとデスクトップの両方でテーブルのレイアウトが適切に表示されるように調整されています。
 */

/* ==========================================================================
   Root Variables (CSSカスタムプロパティ)
   ========================================================================== */
:root {
    /* 主要な色: 落ち着いたトーンの緑と青を基調に */
    --primary-color: #4CAF50; /* 緑 (Google Material Design Green 500) */
    --primary-dark-color: #388E3C; /* 濃い緑 (Google Material Design Green 700) */
    --secondary-color: #2196F3; /* 青 (Google Material Design Blue 500) */
    --secondary-dark-color: #1976D2; /* 濃い青 (Google Material Design Blue 700) */
    --danger-color: #F44336; /* 赤 (Google Material Design Red 500) */
    --danger-dark-color: #D32F2F; /* 濃い赤 (Google Material Design Red 700) */

    /* グレー系の色: 全体的に柔らかい印象に */
    --light-gray-color: #F9F9F9; /* 明るい背景色 */
    --medium-gray-color: #EAEAEA; /* 中間的なグレー (ボーダーなどに) */
    --dark-gray-color: #616161; /* 濃いグレー (サブテキストなどに) */
    --text-color: #424242; /* メインテキストの色 */

    /* その他の要素の色 */
    --background-color-light: #FFFFFF; /* 明るい背景 */
    --border-color-subtle: #EEEEEE; /* 細かい要素のボーダー */
    --input-border-color: #CFCFCF; /* 入力フィールドのボーダー */
    --hover-background-light: #F5F5F5; /* ホバー時の背景色 */

    /* フォント設定 */
    --base-font-family: 'Hiragino Sans', 'ヒラギノ角ゴ ProN W3', 'Yu Gothic', '游ゴシック', 'Meiryo', 'メイリオ', sans-serif;
    --border-radius: 6px; /* 角丸の半径 */
}

/* ==========================================================================
   General Body Styles
   ========================================================================== */
body {
    background-color: var(--light-gray-color);
    font-family: var(--base-font-family);
    color: var(--text-color);
    line-height: 1.6;
    font-size: 15px;
}

/* ==========================================================================
   Container Styles (フォーム、リスト、表示ページ共通)
   ========================================================================== */
.life-plan-form-container,
.life-plan-list-container,
.life-plan-display-container {
    max-width: 900px;
    margin: 60px auto; /* 上下60px、左右中央揃え */
    padding: 40px 50px; /* 全体のパディング */
    border: 1px solid var(--medium-gray-color);
    border-radius: var(--border-radius);
    background-color: var(--background-color-light);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08); /* 影の追加 */
}

/* ==========================================================================
   Heading Styles (H2共通)
   ========================================================================== */
.life-plan-form-container h2,
.life-plan-list-container h2.section-title,
.life-plan-display-container h2.section-title {
    text-align: center;
    color: var(--primary-dark-color);
    margin-bottom: 30px;
    font-size: 1.8em;
    font-weight: 700;
    letter-spacing: 0.02em;
    position: relative;
    padding-bottom: 0;
}

/* H2の下線削除 */
.life-plan-form-container h2::after,
.life-plan-list-container h2.section-title::after,
.life-plan-display-container h2.section-title::after {
    display: none;
}

/* ==========================================================================
   Alert/Error Messages
   ========================================================================== */
p.plan-limit-message-top,
p.error-message {
    color: var(--danger-dark-color);
    font-weight: 600;
    text-align: center;
    padding: 12px 18px;
    margin-bottom: 25px;
    background-color: #FFFAEE;
    border: 1px solid #FFEBCC;
    border-radius: var(--border-radius);
    font-size: 0.95em;
}

p.plan-limit-message-top a,
p.error-message a {
    color: var(--secondary-dark-color);
    text-decoration: underline;
    font-weight: 700;
}
p.plan-limit-message-top a:hover,
p.error-message a:hover {
    color: var(--secondary-color);
}

/* ==========================================================================
   Life Plan Form Section
   ========================================================================== */
.plan-section {
    border: 1px solid var(--medium-gray-color);
    padding: 30px;
    margin-bottom: 35px;
    background-color: var(--background-color-light);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.plan-section h3 {
    margin-top: 0;
    color: var(--dark-gray-color);
    border-bottom: 1px solid var(--border-color-subtle);
    padding-bottom: 12px;
    margin-bottom: 25px;
    font-size: 1.2em;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.plan-section h3::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 20px;
    background-color: var(--primary-color);
    margin-right: 12px;
    border-radius: 3px;
    opacity: 1;
}

/* Age Input Area Container */
.age-inputs {
    max-height: 400px;
    overflow-y: auto;
    background-color: transparent;
    border-radius: var(--border-radius);
    padding-right: 10px;
}

/* スクロールバーのスタイル (WebKit系ブラウザ) */
.age-inputs::-webkit-scrollbar {
    width: 6px;
}

.age-inputs::-webkit-scrollbar-track {
    background: #F0F0F0;
    border-radius: 10px;
}

.age-inputs::-webkit-scrollbar-thumb {
    background: #B0B0B0;
    border-radius: 10px;
}

.age-inputs::-webkit-scrollbar-thumb:hover {
    background: #909090;
}

/* Individual Age Input Group */
.age-input-group {
    display: flex;
    align-items: flex-start;
    margin-bottom: 18px;
    gap: 18px; /* プランタイトルとギャップを合わせる */
    background-color: transparent;
    padding: 12px 0;
    border: none;
    border-bottom: 1px solid var(--border-color-subtle);
    box-shadow: none;
    border-radius: 0;
}

/* Remove bottom border for the last age input group */
.age-input-group:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
}

.age-input-group label {
    width: 80px; /* 年齢ラベルの幅を狭め、入力開始位置を左に寄せる */
    flex-shrink: 0;
    font-weight: 600;
    color: var(--dark-gray-color);
    font-size: 0.98em;
    text-align: right;
    padding-right: 15px;
    position: relative;
    padding-top: 2px;
}

.age-input-group label::after {
    content: ':';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    color: var(--medium-gray-color);
}

.age-input-group textarea {
    flex-grow: 1;
    padding: 10px 12px;
    border: 1px solid var(--input-border-color);
    border-radius: var(--border-radius);
    font-size: 0.95em;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
    background-color: #ffffff;
    font-family: var(--base-font-family);
    line-height: 1.6;
    min-height: 80px;
    resize: vertical;
    box-sizing: border-box;
    box-shadow: none;
}

.age-input-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
    outline: none;
    background-color: #F8FFF8;
}

/* Form Header Styles */
.form-header {
    margin-bottom: 35px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--medium-gray-color);
}

.form-header .input-group.title-input-group {
    display: flex;
    align-items: center;
    gap: 18px;
    /* プランタイトル入力欄を「開始年齢」などと同様のデザインにする */
    padding: 12px 20px; /* selection-options-compact と同様のパディング */
    background-color: #FBFBFB; /* selection-options-compact と同様の背景色 */
    border: 1px solid var(--border-color-subtle); /* selection-options-compact と同様のボーダー */
    border-radius: var(--border-radius); /* selection-options-compact と同様の角丸 */
    box-shadow: 0 1px 5px rgba(0,0,0,0.02); /* selection-options-compact と同様のシャドウ */
    margin-bottom: 20px; /* 既存のマージンを維持 */
}

.form-header .title-input-group label {
    flex-shrink: 0;
    width: 130px; /* プランタイトルラベルの幅を広げ、改行を防ぐ */
    font-weight: 600;
    color: var(--text-color);
    text-align: right;
    font-size: 1em;
}

.form-header .title-input-group input[type="text"] {
    flex-grow: 1;
    padding: 10px 12px;
    border: 1px solid var(--input-border-color);
    border-radius: var(--border-radius);
    font-size: 0.95em;
    width: 100%; /* 親要素の幅に合わせて100%に */
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
    background-color: #ffffff;
    height: auto;
    min-height: 42px;
    box-sizing: border-box;
    box-shadow: none;
}

.form-header .title-input-group input[type="text"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
    outline: none;
    background-color: #F8FFF8;
}

/* Compact Selection Options Container */
.form-header .selection-options-compact {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 25px;
    margin-top: 12px;
    padding: 12px 20px;
    background-color: #FBFBFB;
    border: 1px solid var(--border-color-subtle);
    border-radius: var(--border-radius);
    box-shadow: 0 1px 5px rgba(0,0,0,0.02);
}

.form-header .selection-options-compact label {
    font-weight: 600;
    color: var(--dark-gray-color);
    font-size: 0.9em;
    margin-right: 4px;
    flex-shrink: 0;
}

.form-header .selection-options-compact select {
    padding: 8px 12px;
    border: 1px solid var(--input-border-color);
    border-radius: var(--border-radius);
    font-size: 0.9em;
    height: 38px;
    min-width: 110px;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
    background-color: #ffffff;
    appearance: none; /* デフォルトの矢印を非表示に */
    /* カスタムの矢印SVG */
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="%23616161"%3E%3Cpath fill-rule="evenodd" d="M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06z"/%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
    padding-right: 30px; /* カスタム矢印のスペース確保 */
}

.form-header .selection-options-compact select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
    outline: none;
    background-color: #F8FFF8;
}

.form-header .note-text {
    font-size: 0.8em;
    color: var(--dark-gray-color);
    text-align: center;
    margin-top: 12px;
    width: 100%;
    line-height: 1.4;
}

/* ==========================================================================
   Form Action Buttons (入力・編集フォーム)
   ========================================================================== */
.form-actions {
    text-align: center;
    margin-top: 40px;
    padding-top: 25px;
    border-top: 1px solid var(--medium-gray-color);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.form-actions button,
.form-actions a.back-to-list-button {
    display: inline-block;
    padding: 12px 28px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.98em;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    color: white;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.form-actions button[type="submit"] {
    background-color: var(--primary-color);
}

.form-actions button[type="submit"]:hover {
    background-color: var(--primary-dark-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.form-actions a.back-to-list-button {
    background-color: var(--dark-gray-color);
}

.form-actions a.back-to-list-button:hover {
    background-color: #505050;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   Life Plan List Styles
   ========================================================================== */
.life-plan-list-container {
    position: relative;
    padding-top: 80px; /* ボタンのスペースを確保 */
}

.life-plan-list-container .list-header-wrapper {
    display: block;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--medium-gray-color);
}

.life-plan-list-container h2.section-title {
    margin-bottom: 0;
    text-align: center;
}

/* New Plan Button at the top of the list */
.life-plan-list-container .add-new-plan-button-top {
    position: absolute;
    top: 25px;
    right: 25px;
    display: inline-block;
    padding: 8px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    color: white;
    background-color: var(--secondary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    z-index: 10;
}

.life-plan-list-container .add-new-plan-button-top:hover {
    background-color: var(--secondary-dark-color);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

/* Plan Limit Message in the list header */
.life-plan-list-container .list-header-wrapper .plan-limit-message-list {
    margin: 15px auto 0;
    padding: 7px 12px;
    font-size: 0.85em;
    background-color: #FFFDE7;
    border: 1px solid #FFECB3;
    border-radius: var(--border-radius);
    color: var(--danger-dark-color);
    font-weight: 600;
    white-space: normal;
    text-align: center;
    max-width: 70%;
}

.life-plan-list-container ul {
    list-style: none;
    padding: 0;
    margin: 0;
    padding-top: 0;
}

.life-plan-list-container li {
    display: flex;
    flex-direction: column;
    gap: 15px;
    background-color: var(--background-color-light);
    border: 1px solid var(--medium-gray-color);
    padding: 20px 25px;
    margin-bottom: 15px;
    border-radius: var(--border-radius);
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-left-color 0.2s ease, background-color 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border-left: 4px solid var(--medium-gray-color);
}

.life-plan-list-container li:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
    border-left-color: var(--primary-color);
    background-color: var(--hover-background-light);
}

.life-plan-list-container li .plan-title {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-color);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color-subtle);
}

.life-plan-list-container li .plan-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 15px;
}

.life-plan-list-container li .plan-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    font-size: 0.85em;
    color: var(--dark-gray-color);
    white-space: nowrap;
}

.life-plan-list-container li .plan-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.life-plan-list-container li .plan-actions a,
.life-plan-list-container li .plan-actions button {
    font-weight: 500;
    padding: 7px 15px;
    border-radius: 5px;
    white-space: nowrap;
    font-size: 0.9em;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.life-plan-list-container li .plan-actions a.view-button {
    background-color: #E3F2FD;
    color: var(--secondary-dark-color);
    border-color: #BBDEFB;
}

.life-plan-list-container li .plan-actions a.view-button:hover {
    background-color: var(--secondary-color);
    color: white;
    transform: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.life-plan-list-container li .plan-actions a.edit-button {
    background-color: #E8F5E9;
    color: var(--primary-dark-color);
    border-color: #C8E6C9;
}

.life-plan-list-container li .plan-actions a.edit-button:hover {
    background-color: var(--primary-color);
    color: white;
    transform: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.life-plan-list-container li .plan-actions button.delete-button {
    background-color: #FFEBEE;
    color: var(--danger-dark-color);
    border-color: #FFCDD2;
}

.life-plan-list-container li .plan-actions button.delete-button:hover {
    background-color: var(--danger-color);
    border-color: var(--danger-dark-color);
    color: white;
    transform: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.no-plans-message {
    text-align: center;
    padding: 30px 20px;
    color: var(--dark-gray-color);
    font-size: 1em;
    background-color: var(--background-color-light);
    border-radius: var(--border-radius);
    border: 1px dashed var(--medium-gray-color);
    margin-top: 25px;
}

/* ==========================================================================
   Life Plan Display Page Styles
   ========================================================================== */
.life-plan-display-container {
    max-width: 900px; /* 親コンテナの最大幅を再設定 */
    margin: 60px auto;
    padding: 40px 50px;
    border: 1px solid var(--medium-gray-color);
    border-radius: var(--border-radius);
    background-color: var(--background-color-light);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    overflow-x: auto; /* ★重要: テーブルがはみ出た場合に横スクロールを有効にする */
}

.life-plan-display-container h2.section-title {
    font-size: 1.8em;
}

/* H2の下線削除 (表示ページも含む) */
.life-plan-display-container h2.section-title::after {
    display: none;
}

.plan-details {
    margin-bottom: 35px;
    padding: 25px 30px;
    background-color: var(--background-color-light);
    border-radius: var(--border-radius);
    border: 1px solid var(--medium-gray-color);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.plan-details p {
    margin-bottom: 0;
    font-size: 0.98em;
    color: var(--text-color);
    display: flex;
    align-items: baseline;
}

.plan-details strong {
    color: var(--primary-dark-color);
    margin-right: 15px;
    font-weight: 600;
    min-width: 100px;
    flex-shrink: 0;
}

/* --- plan-data-table の新しいスタイル (表示ページ) --- */
.plan-data-table {
    width: 100%; /* 親要素の100%幅を占める */
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 30px;
    margin-bottom: 40px;
    border: 1px solid var(--medium-gray-color);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    table-layout: fixed; /* ★重要: テーブル全体のレイアウトを固定 (常に適用) */
}

/* テーブル全体のセルに適用される基本スタイル */
.plan-data-table th, .plan-data-table td {
    padding: 15px 20px; /* 上下15px、左右20pxのパディング */
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border-color-subtle);
    word-break: break-word; /* 長い単語を途中で改行 */
    box-sizing: border-box; /* パディングとボーダーを幅に含める */
}

/* ヘッダー行 */
.plan-data-table thead th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    font-size: 1.0em;
    border-bottom: none; /* ヘッダーの下線は不要 */
}

/* ボディ内の年齢セル (th) */
.plan-data-table tbody th {
    font-weight: 600;
    color: var(--dark-gray-color);
    background-color: #F8F8F8;
    vertical-align: middle; /* 年齢は中央に揃える */
    border-right: 1px solid var(--border-color-subtle); /* 右側にボーダー */
    font-size: 0.95em;
}

/* 最終行のボーダーを削除 */
.plan-data-table tbody tr:last-child th,
.plan-data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ホバーエフェクト */
.plan-data-table tbody tr:hover {
    background-color: var(--hover-background-light);
}

/* データがない場合のセル */
.no-data-cell {
    text-align: center;
    font-style: italic;
    color: var(--dark-gray-color);
    padding: 25px !important;
    font-size: 0.95em;
}

.no-data-message {
    font-style: italic;
    color: var(--dark-gray-color);
    text-align: center;
    padding: 30px;
    background-color: var(--background-color-light);
    border-radius: var(--border-radius);
    margin-top: 20px;
    border: 1px dashed var(--medium-gray-color);
}

/* ==========================================================================
   Display Actions (表示ページのアクションボタン)
   ========================================================================== */
.display-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid var(--medium-gray-color);
    flex-wrap: wrap;
}

.display-actions a {
    display: inline-block;
    padding: 12px 28px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.98em;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    color: white;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.display-actions a.back-to-list-display {
    background-color: var(--dark-gray-color);
}
.display-actions a.back-to-list-display:hover {
    background-color: #505050;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.display-actions a.edit-button-main {
    background-color: var(--primary-color);
}
.display-actions a.edit-button-main:hover {
    background-color: var(--primary-dark-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}


/* ==========================================================================
   Mobile Adjustments (768px以下)
   ========================================================================== */
@media (max-width: 768px) {
    .life-plan-form-container,
    .life-plan-list-container,
    .life-plan-display-container {
        padding-left: 10px;
        padding-right: 10px;
        padding-top: 25px;
        padding-bottom: 25px;
    }

    .life-plan-form-container h2,
    .life-plan-list-container h2.section-title,
    .life-plan-display-container h2.section-title {
        font-size: 1.6em;
        margin-bottom: 25px;
    }

    .life-plan-form-container h2::after,
    .life-plan-list-container h2.section-title::after,
    .life-plan-display-container h2.section-title::after {
        display: none;
    }

    .form-header {
        padding-bottom: 15px;
        margin-bottom: 0;
    }

    .form-header .input-group.title-input-group {
        gap: 4px;
        margin-bottom: 10px;
        /* モバイルでのプランタイトル入力欄のデザイン調整 */
        padding: 10px 12px; /* モバイルの selection-options-compact と同様のパディング */
        background-color: #FBFBFB;
        border: 1px solid var(--border-color-subtle);
        border-radius: var(--border-radius);
        box-shadow: 0 1px 5px rgba(0,0,0,0.02);
    }

    .form-header .title-input-group label {
        font-size: 0.95em;
    }

    .form-header .title-input-group input[type="text"] {
        min-height: 40px;
        padding: 8px 10px;
        font-size: 0.9em;
    }

    .form-header .selection-options-compact {
        gap: 8px;
        padding: 10px 12px;
        margin-top: 10px;
    }

    .form-header .selection-options-compact label {
        font-size: 0.85em;
    }

    .form-header .selection-options-compact select {
        padding: 7px 10px;
        font-size: 0.85em;
        height: 35px;
        background-position: right 8px center;
        background-size: 12px;
        padding-right: 25px;
    }

    .form-header .note-text {
        font-size: 0.75em;
        margin-top: 10px;
    }

    .plan-section {
        padding: 20px 0;
    }

    .plan-section h3 {
        padding-bottom: 8px;
        margin-bottom: 15px;
        font-size: 1.1em;
    }

    .plan-section h3::before {
        height: 16px;
    }

    .age-input-group {
        padding: 10px 0;
        gap: 6px;
        margin-bottom: 12px;
    }

    .age-input-group label {
        font-size: 0.9em;
    }

    .age-input-group textarea {
        min-height: 50px;
        padding: 8px 10px;
        font-size: 0.9em;
    }

    /* List Page Title and Button Placement (Mobile) */
    .life-plan-list-container {
        padding-top: 70px;
    }

    .life-plan-list-container .list-header-wrapper {
        margin-bottom: 15px;
        padding-bottom: 10px;
    }

    .life-plan-list-container h2.section-title {
        font-size: 1.6em;
        margin-bottom: 10px;
    }

    .life-plan-list-container .add-new-plan-button-top {
        top: 20px;
        right: 10px;
        padding: 8px 15px;
        font-size: 0.85em;
    }

    .life-plan-list-container .list-header-wrapper .plan-limit-message-list {
        margin: 10px auto 0;
        font-size: 0.8em;
        padding: 7px 10px;
        max-width: 90%;
    }

    .life-plan-list-container ul {
        padding-top: 0;
    }

    .life-plan-list-container li {
        gap: 12px;
        padding: 15px 20px;
        margin-bottom: 12px;
    }

    .life-plan-list-container li .plan-title {
        font-size: 1.1em;
        padding-bottom: 10px;
    }

    .life-plan-list-container li .plan-footer {
        gap: 15px;
    }

    .life-plan-list-container li .plan-meta {
        font-size: 0.8em;
    }

    .life-plan-list-container li .plan-actions {
        gap: 8px;
    }

    .life-plan-list-container li .plan-actions a,
    .life-plan-list-container li .plan-actions button {
        padding: 6px 12px;
        font-size: 0.85em;
    }

    /* Life Plan Display Page Mobile Styles */
    .plan-details {
        gap: 8px;
        padding: 15px;
    }
    .plan-details p {
        padding: 10px 12px;
        font-size: 0.95em;
    }
    .plan-details strong {
        font-size: 0.85em;
    }

    /* Mobile Table Display */
    .plan-data-table {
        display: block; /* テーブル全体をブロック要素化 */
        overflow-x: auto; /* 横スクロールを可能にする */
        -webkit-overflow-scrolling: touch;
        white-space: nowrap; /* 各行が折り返さないように */
        min-width: 320px; /* テーブル全体の最小幅を確保 */
        width: 100%; /* ★追加: 親要素の幅いっぱいに広がるようにする */
    }

    .plan-data-table thead,
    .plan-data-table tbody {
        display: block; /* thead と tbody もブロック要素に */
        /* width: max-content; は削除 */
    }

    .plan-data-table tr {
        display: flex; /* 各行をFlexboxコンテナにする */
        border-bottom: 1px solid var(--border-color-subtle); /* 行ごとの下線 */
        white-space: normal; /* セル内のテキストは通常通り改行可能に */
    }

    /* 最後の行の下線を削除 */
    .plan-data-table tbody tr:last-child {
        border-bottom: none;
    }

    /* ヘッダーセル */
    .plan-data-table thead th {
        border-bottom: none; /* ヘッダーセルには個別の下線は不要 */
        background-color: var(--primary-color); /* 背景色維持 */
        color: white;
    }

    /* ヘッダーの「年齢」と「目標・出来事」の幅 */
    .plan-data-table thead th:first-child { /* 年齢 */
        flex-basis: 80px; /* 固定幅 */
        flex-shrink: 0; /* 縮まない */
        text-align: center;
    }
    .plan-data-table thead th:last-child { /* 目標・出来事 */
        flex-grow: 1; /* 残りのスペースを全て占める */
        text-align: left;
        min-width: 220px; /* 最小幅を設定して内容が少ない場合でも確保 */
    }

    /* ボディ内の「年齢」セル (th) と「目標・出来事」セル (td) */
    .plan-data-table tbody th { /* ◯歳 */
        flex-basis: 80px; /* 固定幅 */
        flex-shrink: 0; /* 縮まない */
        text-align: center;
        background-color: #F8F8F8; /* 背景色維持 */
    }
    .plan-data-table tbody td { /* 目標・出来事内容 */
        flex-grow: 1; /* 残りのスペースを全て占める */
        text-align: left;
        border-right: none; /* tdの右ボーダーは不要 */
        min-width: 220px; /* 最小幅を設定して内容が少ない場合でも確保 */
    }

    /* データがない場合のセルは全幅を占める */
    .no-data-cell {
        display: block; /* ブロック要素にして、flexboxの外で全幅を占める */
        width: 100%;
        text-align: center;
        white-space: normal; /* 改行を有効にする */
    }

    .display-actions {
        gap: 15px;
        margin-top: 25px;
        padding-top: 20px;
    }

    .display-actions a.back-to-list-display,
    .display-actions a.edit-button-main {
        padding: 10px 15px;
        font-size: 0.9em;
    }
}

/* ==========================================================================
   Desktop Adjustments (769px以上)
   ========================================================================== */
@media (min-width: 769px) {
    /* デスクトップでのカラム幅 */
    .plan-data-table thead th:first-child,
    .plan-data-table tbody th {
        width: 100px; /* 年齢カラムの固定幅 */
        text-align: left; /* 左寄せに戻す */
    }
    .plan-data-table thead th:last-child,
    .plan-data-table tbody td {
        width: calc(100% - 100px); /* 残りの幅全てを目標・出来事カラムに */
    }
}
