:root {
    --primary: #059669;
    --primary-dark: #047857;
    --primary-light: #d1fae5;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --success: #16a34a;
    --success-light: #f0fdf4;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --text: #1f2937;
    --text-sub: #6b7280;
    --bg: #f0fdf4;
    --white: #ffffff;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Noto Sans JP', sans-serif; color: var(--text); background: var(--bg); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }

/* Header */
.header { background: var(--white); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: 1100px; margin: 0 auto; padding: 0 20px; height: 56px; display: flex; align-items: center; gap: 20px; }
.header-logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; color: var(--text); white-space: nowrap; }
.logo-icon { font-size: 22px; }
.header-nav { display: flex; gap: 2px; flex: 1; }
.nav-link { padding: 6px 12px; border-radius: var(--radius-sm); color: var(--text-sub); font-size: 13px; font-weight: 500; transition: 0.15s; }
.nav-link:hover { background: var(--bg); color: var(--text); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.stage-badge { font-size: 12px; padding: 4px 10px; background: var(--primary-light); color: var(--primary-dark); border-radius: 20px; font-weight: 600; }
.hamburger { display: none; background: none; border: none; width: 32px; height: 32px; flex-direction: column; justify-content: center; gap: 5px; cursor: pointer; margin-left: auto; }
.hamburger span { display: block; width: 20px; height: 2px; background: var(--text); border-radius: 2px; }
.mobile-nav { display: none; background: var(--white); border-bottom: 1px solid var(--border); padding: 12px 20px; }
.mobile-nav a { display: block; padding: 10px 0; color: var(--text); font-size: 15px; border-bottom: 1px solid var(--border); }
.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav.open { display: block; }
@media (max-width: 768px) { .header-nav, .header-actions { display: none; } .hamburger { display: flex; } }

/* Layout */
.main-content { min-height: calc(100vh - 56px); }
.container { max-width: 960px; margin: 0 auto; padding: 24px 20px; }
.footer { text-align: center; padding: 20px; }
.disclaimer { font-size: 11px; color: var(--text-sub); max-width: 700px; margin: 0 auto; }
.disclaimer-small { font-size: 11px; color: var(--text-sub); margin-bottom: 12px; }

/* Page Header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 22px; font-weight: 800; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 20px; border: none; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; cursor: pointer; transition: 0.15s; text-decoration: none; gap: 6px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: var(--white); color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-full { width: 100%; }

/* Stage Hero */
.stage-hero { background: linear-gradient(135deg, #059669, #10b981); color: #fff; border-radius: var(--radius); padding: 28px; display: flex; align-items: center; gap: 20px; margin-bottom: 24px; }
.stage-hero-icon { font-size: 48px; }
.stage-hero-label { font-size: 12px; opacity: 0.8; }
.stage-hero-name { font-size: 24px; font-weight: 800; }
.stage-hero-theme { font-size: 14px; opacity: 0.85; margin-top: 4px; }
.stage-hero-age { font-size: 13px; opacity: 0.7; margin-top: 4px; }

/* Action Grid */
.action-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 28px; }
.action-card { background: var(--white); border-radius: var(--radius); padding: 20px; text-align: center; box-shadow: var(--shadow); transition: 0.15s; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text); }
.action-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.action-icon { font-size: 32px; }
.action-text { font-weight: 700; font-size: 13px; }
.action-desc { font-size: 12px; color: var(--text-sub); }

/* Cards */
.card-list { display: flex; flex-direction: column; gap: 12px; }
.form-card { background: var(--white); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.detail-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.detail-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.detail-row:last-child { border-bottom: none; }
.detail-row-header { background: #f9fafb; font-weight: 600; }
.detail-row-total { background: var(--primary-light); font-weight: 700; }
.detail-row-highlight { background: #fff7ed; }

/* Forms */
.form-section { margin-bottom: 24px; }
.form-section-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; padding-bottom: 8px; border-bottom: 2px solid var(--primary-light); }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; transition: border 0.15s; font-family: inherit; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(5,150,105,0.1); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; padding-top: 16px; border-top: 1px solid var(--border); margin-top: 16px; }
.required { color: var(--danger); }
.expense-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; }
.alert-error { background: var(--danger-light); color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: var(--success-light); color: var(--success); }

/* Result Hero */
.result-hero { border-radius: var(--radius); padding: 28px; text-align: center; margin-bottom: 24px; color: #fff; }
.result-hero-budget { background: var(--white); color: var(--text); border: 2px solid var(--border); }
.result-hero-success { background: linear-gradient(135deg, #059669, #10b981); }
.result-hero-danger { background: linear-gradient(135deg, #dc2626, #ef4444); }
.result-label { font-size: 14px; opacity: 0.85; margin-bottom: 8px; }
.result-price { font-size: 32px; font-weight: 800; }
.result-unit { font-size: 16px; font-weight: 600; margin-left: 4px; }
.result-sub { font-size: 14px; opacity: 0.8; margin-top: 6px; }
.result-value { font-size: 24px; font-weight: 800; }
.result-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* Budget */
.budget-summary-card { background: var(--white); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.budget-summary-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; border-bottom: 1px solid var(--border); }
.budget-summary-row:last-of-type { border-bottom: none; }
.budget-comparison { display: flex; flex-direction: column; gap: 12px; }
.budget-row { background: var(--white); border-radius: var(--radius-sm); padding: 14px; box-shadow: var(--shadow); }
.budget-row-label { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 14px; font-weight: 600; }
.bar-container { background: #e5e7eb; border-radius: 4px; height: 24px; overflow: hidden; }
.bar-actual { height: 100%; background: var(--primary); border-radius: 4px; display: flex; align-items: center; padding-left: 8px; font-size: 11px; color: #fff; font-weight: 600; min-width: 40px; }
.bar-ideal { font-size: 11px; color: var(--text-sub); margin-top: 4px; }
.budget-row-diff { font-size: 13px; font-weight: 700; text-align: right; margin-top: 4px; }
.diff-over { color: var(--danger); }
.diff-under { color: var(--primary); }
.diff-ok { color: var(--text-sub); }

/* Advice */
.advice-list { display: flex; flex-direction: column; gap: 10px; }
.advice-card { padding: 14px 16px; border-radius: var(--radius-sm); font-size: 14px; line-height: 1.5; }
.advice-warning { background: var(--warning-light); border-left: 4px solid var(--warning); }
.advice-info { background: #eff6ff; border-left: 4px solid #3b82f6; }
.advice-danger { background: var(--danger-light); border-left: 4px solid var(--danger); }
.advice-success { background: var(--success-light); border-left: 4px solid var(--success); }

/* Simulation Cards */
.sim-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.sim-card { background: var(--white); border-radius: var(--radius); padding: 28px 20px; text-align: center; box-shadow: var(--shadow); transition: 0.15s; color: var(--text); border: 2px solid transparent; }
.sim-card:hover { border-color: var(--primary); box-shadow: var(--shadow-lg); }
.sim-card-icon { font-size: 40px; margin-bottom: 12px; }
.sim-card-title { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.sim-card-desc { font-size: 13px; color: var(--text-sub); line-height: 1.5; }
.sim-history-card { background: var(--white); border-radius: var(--radius-sm); padding: 12px 16px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; font-size: 14px; }

/* Content Cards */
.content-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.content-card { background: var(--white); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: block; color: var(--text); transition: 0.15s; }
.content-card:hover { box-shadow: var(--shadow-lg); }
.content-category { font-size: 11px; font-weight: 600; color: var(--primary); text-transform: uppercase; }
.content-title { font-size: 15px; font-weight: 700; margin: 6px 0; }
.content-summary { font-size: 13px; color: var(--text-sub); }

/* Article */
.article-header { margin-bottom: 24px; }
.back-link { font-size: 13px; color: var(--text-sub); }
.article-meta { display: flex; gap: 8px; margin: 12px 0; }
.article-title { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.article-summary { color: var(--text-sub); font-size: 15px; }
.article-body { background: var(--white); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); line-height: 1.8; font-size: 15px; }
.article-body h3 { font-size: 18px; margin: 20px 0 10px; color: var(--primary-dark); }
.article-body ul, .article-body ol { margin-left: 20px; margin-bottom: 16px; }
.article-body li { margin-bottom: 6px; }
.article-body p { margin-bottom: 14px; }
.article-footer { margin-top: 24px; text-align: center; }

/* Plans */
.plan-card { background: var(--white); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.plan-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.plan-card-header h3 { font-size: 16px; font-weight: 700; }
.plan-note { font-size: 14px; color: var(--text-sub); margin: 8px 0; white-space: pre-wrap; }

/* Badges & Filter */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; background: var(--primary-light); color: var(--primary-dark); }
.badge-stage { background: #ede9fe; color: #7c3aed; }
.filter-bar { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-chip { padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 500; background: var(--white); color: var(--text-sub); border: 1px solid var(--border); transition: 0.15s; white-space: nowrap; }
.filter-chip:hover, .filter-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Auth */
.auth-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(135deg, #059669, #10b981); }
.auth-card { background: var(--white); border-radius: 16px; padding: 36px; width: 100%; max-width: 400px; box-shadow: 0 8px 32px rgba(0,0,0,0.15); }
.auth-logo { font-size: 48px; text-align: center; margin-bottom: 8px; }
.auth-title { text-align: center; font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.auth-subtitle { text-align: center; color: var(--text-sub); font-size: 14px; margin-bottom: 24px; }
.auth-form { margin-bottom: 16px; }
.auth-link { text-align: center; font-size: 13px; color: var(--text-sub); }

/* Onboarding */
.onboarding-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--bg); }
.onboarding-card { background: var(--white); border-radius: 16px; padding: 36px; width: 100%; max-width: 600px; box-shadow: var(--shadow-lg); }
.onboarding-title { font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 4px; }
.onboarding-sub { text-align: center; color: var(--text-sub); font-size: 14px; margin-bottom: 24px; }

/* Section */
.section { margin-bottom: 28px; }
.section-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; }

/* Empty State */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-sub); }
.empty-icon { font-size: 48px; margin-bottom: 12px; }

/* Text */
.text-primary { color: var(--primary); font-weight: 700; }
.text-success { color: var(--success); font-weight: 700; }
.text-danger { color: var(--danger); font-weight: 700; }
.text-warning { color: var(--warning); font-weight: 700; }
.text-sub { color: var(--text-sub); }
.text-center { text-align: center; }

/* Responsive */
@media (max-width: 768px) {
    .action-grid-3 { grid-template-columns: 1fr; }
    .sim-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .result-grid-3 { grid-template-columns: 1fr; gap: 8px; }
    .stage-hero { flex-direction: column; text-align: center; }
    .stage-hero-icon { font-size: 36px; }
    .result-price { font-size: 24px; }
    .content-list { grid-template-columns: 1fr; }
    .sim-history-card { flex-wrap: wrap; }
    .expense-grid { grid-template-columns: 1fr 1fr; }
}

/* 誘導・提案カード */
.action-suggestions { display: flex; flex-direction: column; gap: 12px; }
.suggestion-card { padding: 16px; border-radius: var(--radius-sm); line-height: 1.6; }
.suggestion-card p { margin: 8px 0; color: var(--text-sub); font-size: 14px; }
.suggestion-card .btn { margin-top: 8px; }
.suggestion-warning { background: var(--warning-light); border-left: 4px solid var(--warning); }
.suggestion-success { background: var(--success-light); border-left: 4px solid var(--success); }
.suggestion-link { display: block; padding: 12px 16px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); text-decoration: none; transition: all 0.2s; }
.suggestion-link:hover { border-color: var(--primary); background: var(--primary-light); }

/* プラン進捗 */
.plan-progress { margin: 12px 0; }
.plan-progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.plan-progress-label { font-size: 14px; color: var(--text); }
.plan-progress-pct { font-size: 18px; font-weight: 700; color: var(--primary); }
.progress-bar { height: 12px; background: var(--border); border-radius: 6px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--primary); border-radius: 6px; transition: width 0.3s; min-width: 2px; }
.progress-complete { background: var(--success); }
.plan-deadline { font-size: 12px; display: block; margin-top: 4px; }
.plan-update-form { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.plan-update-form .input-sm { width: 100px; padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; }
.plan-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.plan-card-header { display: flex; justify-content: space-between; align-items: center; }
.plan-card-header h3 { margin: 0; font-size: 16px; }
.plan-note { color: var(--text-sub); font-size: 14px; margin: 8px 0; line-height: 1.5; }

/* フォームヒント・チェックボックス */
.form-hint { display: block; font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: 18px; height: 18px; }
.result-sub { font-size: 14px; color: var(--text-sub); margin-top: 4px; }

/* チェックイン */
.checkin-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.checkin-card-empty { text-align: center; padding: 32px; }
.checkin-card-empty p { color: var(--text-sub); margin-bottom: 16px; }
.checkin-status { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.checkin-badge { padding: 4px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; }
.checkin-done { background: var(--success-light); color: var(--success); }
.checkin-warn { background: var(--warning-light); color: #b45309; }
.checkin-overdue { background: var(--danger-light); color: var(--danger); }
.checkin-metrics { display: flex; gap: 24px; margin-bottom: 16px; }
.checkin-metric-label { font-size: 12px; color: var(--text-sub); }
.checkin-metric-value { font-size: 20px; font-weight: 700; }
.checkin-trend { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.checkin-trend-label { font-size: 12px; color: var(--text-sub); margin-bottom: 8px; }
.checkin-trend-items { display: flex; gap: 12px; align-items: flex-end; }
.trend-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.trend-date { font-size: 11px; color: var(--text-sub); }
.trend-bar-container { width: 24px; display: flex; justify-content: center; }
.trend-bar { width: 16px; border-radius: 4px 4px 0 0; }
.trend-bar-good { background: var(--primary); }
.trend-bar-warn { background: var(--warning); }
.trend-value { font-size: 11px; font-weight: 600; }

/* ホームのプラン表示 */
.home-plans { display: flex; flex-direction: column; gap: 8px; }
.home-plan-item { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.home-plan-title { font-weight: 600; font-size: 14px; }
.home-plan-nums { font-size: 12px; color: var(--text-sub); margin: 4px 0; }

@media print {
    .header, .mobile-nav, .form-actions, .hamburger, .footer { display: none !important; }
    .result-hero { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
