/* ============================================================
   AI 助成金診断シミュレーター v2 — Blue & White
   ============================================================ */

:root {
    /* Main White & Blue Palette */
    --accent-blue: #2563EB;
    --accent-blue-light: #60A5FA;
    --accent-blue-dark: #1E40AF;
    
    /* Repurposing other accents to fit the blue theme (keeping variable names to avoid breaking CSS) */
    --accent-green: #0EA5E9; /* Changed to Sky Blue */
    --accent-purple: #3B82F6; /* Changed to Blue */
    --accent-orange: #0284C7; /* Changed to Ocean Blue */

    --bg-base: #F8FAFC;
    --bg-card: #FFFFFF;
    --bg-input: #F1F5F9;

    --text-main: #0F172A;
    --text-sub: #475569;
    --text-muted: #94A3B8;

    --stroke: #E2E8F0;

    /* Neumorphism / 3D Shadows & Textures */
    --shadow-soft: 
        0 4px 16px rgba(15, 23, 42, 0.04), 
        inset 0 1px 0 rgba(255, 255, 255, 1);
    
    --shadow-hover: 
        0 12px 32px rgba(37, 99, 235, 0.08), 
        0 4px 12px rgba(15, 23, 42, 0.03),
        inset 0 1px 0 rgba(255, 255, 255, 1);
        
    --shadow-focus: 0 0 0 4px rgba(37, 99, 235, 0.15);

    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 8px;

    --font-en: 'Inter', sans-serif;
    --font-jp: 'Noto Sans JP', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-jp), var(--font-en), sans-serif;
    font-size: 15px;
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 親フレーム (app.html / vault.html) の auto-resize iframe 内では body の
   min-height:100vh が「伸びる一方で縮まない」高さのループを作るため無効化する。
   (ui.js の setupEmbedResize が html/body に .embedded を付与) */
html.embedded body {
    min-height: 0;
}

button {
    font-family: inherit;
    cursor: pointer;
}

input,
select {
    font-family: inherit;
}

/* ============ Nav ============ */

.sim-nav {
    display: none !important;
}

/* ============ Main ============ */

.sim-main {
    flex: 1;
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
    padding: 8px 12px 24px;
}

/* ============ Step indicator ============ */

.step-label {
    text-align: center;
    font-family: var(--font-en);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--accent-blue);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.step-indicator {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.step-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--stroke);
    transition: all 0.3s ease;
}

.step-dot.done {
    background: #93C5FD;
}

.step-dot.active {
    background: var(--accent-blue);
    transform: scale(1.35);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.step-dot.result-dot.active {
    background: var(--accent-green);
    box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.15);
}

/* ============ Step sections & transitions ============ */

.step-section {
    display: none;
}

.step-section.active {
    display: block;
}

.step-section.slide-left {
    animation: slideInLeft 0.4s ease both;
}

.step-section.slide-right {
    animation: slideInRight 0.4s ease both;
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(28px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(-28px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============ Step card ============ */

.step-card {
    background: var(--bg-card);
    border: 1px solid var(--stroke);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    padding: 14px 16px 12px;
}

.step-q {
    font-family: var(--font-en);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-blue);
    margin-bottom: 2px;
}

.step-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}

.step-desc {
    font-size: 12px;
    color: var(--text-sub);
    margin-bottom: 10px;
}

/* ============ Step nav buttons ============ */

.step-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid var(--stroke);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 28px;
    border: 1px solid #1D4ED8;
    border-radius: 999px;
    background: linear-gradient(180deg, #3B82F6 0%, #2563EB 100%);
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        inset 0 -1px 0 rgba(0, 0, 0, 0.15),
        0 2px 5px rgba(37, 99, 235, 0.3);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    background: linear-gradient(180deg, #4F8FF7 0%, #2C6CEE 100%);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.5), 
        inset 0 -1px 0 rgba(0, 0, 0, 0.15),
        0 4px 10px rgba(37, 99, 235, 0.35);
}

.btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border: 1px solid var(--stroke);
    border-radius: 999px;
    background: var(--bg-card);
    color: var(--text-sub);
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
}

.btn-ghost:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

/* ============ Mode cards ============ */

.mode-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 6px;
}

.mode-card {
    --mode-color: var(--accent-blue);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    text-align: left;
    padding: 22px 20px;
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
    border: 1px solid #E2E8F0;
    border-radius: var(--radius-md);
    box-shadow: 
        inset 0 1px 0 #FFFFFF, 
        0 2px 6px -1px rgba(15, 23, 42, 0.05);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.mode-card:hover {
    box-shadow: 
        inset 0 1px 0 #FFFFFF,
        0 6px 16px -2px rgba(15, 23, 42, 0.08);
    transform: translateY(-2px);
    border: 1px solid #CBD5E1;
}

.mode-card.selected {
    background: linear-gradient(180deg, #EFF6FF 0%, #FFFFFF 100%);
    border: 1px solid var(--accent-blue);
    box-shadow: 
        inset 0 1px 0 rgba(255,255,255,0.8),
        0 6px 12px -2px rgba(37, 99, 235, 0.15);
}

.mode-icon {
    font-size: 24px;
    line-height: 1;
}

.mode-badge-line {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.mode-price {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--mode-color) 12%, #ffffff);
    color: var(--mode-color);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.mode-name {
    font-weight: 800;
    font-size: 17px;
    color: var(--text-main);
    line-height: 1.35;
}

.mode-desc {
    font-size: 13px;
    color: var(--text-sub);
    line-height: 1.65;
}

/* ============ Growth Focus cards (STEP1 フック) ============ */

.focus-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 6px;
}

.focus-card {
    --focus-color: var(--accent-blue);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    text-align: left;
    padding: 22px 20px;
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
    border: 1px solid #E2E8F0;
    border-radius: var(--radius-md);
    box-shadow: 
        inset 0 1px 0 #FFFFFF, 
        0 2px 6px -1px rgba(15, 23, 42, 0.05);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.focus-card:hover {
    box-shadow: 
        inset 0 1px 0 #FFFFFF,
        0 6px 16px -2px rgba(15, 23, 42, 0.08);
    transform: translateY(-2px);
    border: 1px solid #CBD5E1;
}

.focus-card.selected {
    background: linear-gradient(180deg, #EFF6FF 0%, #FFFFFF 100%);
    border: 1px solid var(--accent-blue);
    box-shadow: 
        inset 0 1px 0 rgba(255,255,255,0.8),
        0 6px 12px -2px rgba(37, 99, 235, 0.15);
}

.focus-card .focus-icon {
    font-size: 30px;
    line-height: 1;
    margin-bottom: 2px;
}

.focus-card .focus-name {
    font-weight: 800;
    font-size: 17px;
    color: var(--text-main);
    line-height: 1.35;
}

.focus-card.selected .focus-name {
    color: var(--focus-color);
}

.focus-card .focus-desc {
    font-size: 13px;
    color: var(--text-sub);
    line-height: 1.65;
}

@media (min-width: 640px) {
    .focus-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

/* ============ Yes/No question ============ */

.yn-question {
    padding: 16px 0;
    border-bottom: 1px solid var(--stroke);
    animation: fadeInUp 0.4s ease both;
}

.yn-question:last-of-type {
    border-bottom: none;
}

.yn-question-text {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 12px;
}

.yn-buttons {
    display: flex;
    gap: 10px;
}

.yn-btn {
    flex: 1;
    max-width: 200px;
    padding: 11px 0;
    border-radius: 999px;
    border: 2px solid var(--stroke);
    background: var(--bg-card);
    color: var(--text-sub);
    font-weight: 700;
    font-size: 14px;
    transition: all 0.2s ease;
}

.yn-btn:hover:not(:disabled) {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.yn-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.yn-btn.yn-yes.selected {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.30);
}

.yn-btn.yn-yes.selected:disabled {
    opacity: 1;
}

.yn-btn.yn-no.selected {
    background: #64748B;
    border-color: #64748B;
    color: #fff;
}

.yn-btn.yn-unknown {
    color: #B45309;
    font-size: 13px;
}

.yn-btn.yn-unknown:hover:not(:disabled) {
    border-color: #F59E0B;
    color: #B45309;
    background: #FFFBEB;
}

.yn-btn.yn-unknown.selected {
    background: #F59E0B;
    border-color: #F59E0B;
    color: #fff;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.28);
}

/* サブ質問（展開） */

.yn-sub {
    display: none;
    overflow: hidden;
}

.yn-sub.open {
    display: block;
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    animation: subExpand 0.35s ease both;
}

@keyframes subExpand {
    from { opacity: 0; max-height: 0; transform: translateY(-6px); }
    to   { opacity: 1; max-height: 1200px; transform: translateY(0); }
}

.yn-question.yn-nested {
    border-bottom: none;
    padding: 12px 0 4px;
}

.yn-question.yn-nested .yn-question-text {
    font-size: 14px;
}

.yn-question.yn-nested .yn-sub.open {
    background: #fff;
    border: 1px solid var(--stroke);
}

/* 常時展開質問（採用ペース等） */

.yn-question.yn-always-open .yn-sub {
    display: block;
    margin-top: 12px;
    padding: 16px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
}

/* ヒント */

.yn-hint {
    display: none;
    margin-top: 12px;
    padding: 10px 14px;
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    border-radius: var(--radius-sm);
    color: #1D4ED8;
    font-size: 13px;
    font-weight: 500;
}

.yn-hint.visible {
    display: block;
    animation: fadeInUp 0.35s ease both;
}

.sub-note {
    font-size: 13px;
    color: var(--text-sub);
}

.forced-badge {
    display: inline-block;
    margin-bottom: 10px;
    padding: 4px 12px;
    border-radius: 999px;
    background: #F3E8FF;
    border: 1px solid #D8B4FE;
    color: var(--accent-purple);
    font-size: 12px;
    font-weight: 700;
}

/* ============ Forms ============ */

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.num-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.num-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-sub);
}

.num-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--stroke);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.num-input-wrap:focus-within {
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-focus);
}

.num-input-wrap input {
    flex: 1;
    width: 100%;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    font-family: var(--font-en), var(--font-jp);
}

.num-unit {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.select-field {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.select-field select {
    padding: 10px 12px;
    border: 1px solid var(--stroke);
    border-radius: var(--radius-sm);
    background: #fff;
    font-size: 14px;
    color: var(--text-main);
    outline: none;
}

.select-field select:focus {
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-focus);
}

/* SMEバッジ */

.sme-badge {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    animation: fadeInUp 0.3s ease both;
}

.sme-badge--ok {
    background: #ECFDF5;
    border: 1px solid #A7F3D0;
    color: var(--accent-green);
}

.sme-badge--large {
    background: #FFF7ED;
    border: 1px solid #FED7AA;
    color: var(--accent-orange);
}

/* ============ ゲート閉塞カード ============ */

.gate-blocked {
    margin-top: 18px;
    padding: 22px 18px;
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: var(--radius-md);
    text-align: center;
    animation: fadeInUp 0.35s ease both;
}

.gate-blocked-icon {
    font-size: 30px;
    margin-bottom: 8px;
}

.gate-blocked-title {
    font-weight: 700;
    font-size: 15px;
    color: #B91C1C;
    margin-bottom: 4px;
}

.gate-blocked-desc {
    font-size: 13px;
    color: var(--text-sub);
    margin-bottom: 14px;
}

.gate-blocked-link {
    display: inline-block;
    padding: 11px 20px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
}

.gate-blocked-link:hover {
    background: var(--accent-blue);
    color: #fff;
}

/* ============ チェックボックス ============ */

.option-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    background: #fff;
    border: 1px solid var(--stroke);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-item:hover {
    border-color: var(--accent-blue);
}

.option-item input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.option-box {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: 2px solid var(--stroke);
    border-radius: 6px;
    background: #fff;
    position: relative;
    transition: all 0.2s ease;
}

.option-item input:checked + .option-box {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

.option-item input:checked + .option-box::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.option-text {
    font-size: 14px;
    font-weight: 500;
}

/* ============ 賃上げ幅ラジオ ============ */

.raise-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.raise-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid var(--stroke);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.raise-option:hover {
    border-color: var(--accent-blue);
}

.raise-option:has(input:checked) {
    border-color: var(--accent-blue);
    background: #EFF6FF;
    box-shadow: var(--shadow-focus);
}

.raise-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.raise-radio {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    border: 2px solid var(--stroke);
    border-radius: 50%;
    background: #fff;
    position: relative;
    transition: all 0.2s ease;
}

.raise-option input:checked + .raise-radio {
    border-color: var(--accent-blue);
}

.raise-option input:checked + .raise-radio::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: var(--accent-blue);
}

.raise-texts {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.raise-main {
    font-weight: 700;
    font-size: 14px;
}

.raise-impact {
    font-size: 12px;
    color: var(--text-muted);
}

/* ============ ピル型ラジオ（訓練詳細） ============ */

.detail-field {
    margin: 14px 0;
}

.pill-group {
    display: flex;
    gap: 8px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.pill-option {
    cursor: pointer;
}

.pill-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.pill-label {
    display: inline-block;
    padding: 9px 18px;
    border-radius: 999px;
    border: 2px solid var(--stroke);
    background: #fff;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-sub);
    transition: all 0.2s ease;
}

.pill-option:hover .pill-label {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.pill-option input:checked + .pill-label {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.30);
}

/* ============ 結果ヒーロー ============ */

.result-hero {
    border-radius: var(--radius-lg);
    padding: 34px 22px;
    text-align: center;
    color: #fff;
    margin-bottom: 26px;
    box-shadow: var(--shadow-hover);
    animation: fadeInUp 0.5s ease both;
}

.result-hero--green {
    background: linear-gradient(135deg, #059669, #10B981);
}

.result-hero--blue {
    background: linear-gradient(135deg, #1D4ED8, #3B82F6);
}

.result-hero--purple {
    background: linear-gradient(135deg, #6D28D9, #8B5CF6);
}

.result-hero-label {
    font-size: 13px;
    font-weight: 700;
    opacity: 0.9;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.result-hero-amount {
    font-family: var(--font-en), var(--font-jp);
    font-size: 42px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.result-hero-count {
    margin-top: 8px;
    display: inline-block;
    padding: 4px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 13px;
    font-weight: 700;
}

/* ============ 結果セクション ============ */

.result-section {
    margin-bottom: 30px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--stroke);
}

.result-section:last-of-type {
    border-bottom: none;
}

.result-section-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 14px;
    letter-spacing: -0.01em;
}

.result-empty {
    padding: 18px;
    background: var(--bg-card);
    border: 1px dashed var(--stroke);
    border-radius: var(--radius-md);
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* ============ 助成金カード ============ */

.grant-card {
    --cat-color: var(--accent-blue);
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--stroke);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    padding: 18px 18px 16px 22px;
    margin-bottom: 12px;
    overflow: hidden;
    animation: fadeInUp 0.45s ease both;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.grant-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.grant-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: var(--cat-color);
}

.grant-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.grant-cat {
    font-size: 11px;
    font-weight: 700;
    color: var(--cat-color);
    letter-spacing: 0.03em;
}

.grant-amount {
    font-family: var(--font-en), var(--font-jp);
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
    white-space: nowrap;
}

.grant-name {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 2px;
}

.grant-desc {
    font-size: 13px;
    color: var(--text-sub);
    margin-bottom: 10px;
}

.grant-details {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 10px;
}

.grant-detail-line {
    font-size: 12.5px;
    color: var(--text-sub);
    line-height: 1.8;
}

/* 整備ヒント・賃上げヒント */

.setup-hint {
    display: inline-block;
    margin: 0 6px 8px 0;
    padding: 6px 12px;
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    border-radius: 999px;
    color: #1D4ED8;
    font-size: 12px;
    font-weight: 700;
}

.raise-hint {
    display: inline-block;
    margin: 0 6px 8px 0;
    padding: 6px 12px;
    background: #F3E8FF;
    border: 1px solid #D8B4FE;
    border-radius: 999px;
    color: var(--accent-purple);
    font-size: 12px;
    font-weight: 700;
}

.grant-note {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ============ 結果アクション ============ */

.result-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 28px;
    flex-wrap: wrap;
}

/* ============ Footer ============ */

.sim-footer {
    padding: 20px 16px 28px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--stroke);
    background: var(--bg-card);
}

/* ============ Responsive (tablet+) ============ */

@media (min-width: 640px) {
    body {
        font-size: 16px;
    }

    .sim-main {
        padding: 36px 24px 80px;
    }

    .step-card {
        padding: 34px 34px 28px;
    }

    .step-title {
        font-size: 23px;
    }

    .mode-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .form-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .result-hero {
        padding: 44px 30px;
    }

    .result-hero-amount {
        font-size: 54px;
    }
}

@media (min-width: 640px) and (max-width: 819px) {
    .form-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Reduced motion */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============ 整備チェックリスト ============ */
.maximize-checklist {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.maximize-check-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.maximize-check-item:hover {
    border-color: var(--primary-color);
    background-color: #f8fafc;
}

.maximize-check-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    width: 100%;
}

.maximize-check-item input[type="checkbox"],
.maximize-check-item input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.maximize-check-amount {
    font-weight: 700;
    color: var(--primary-color);
    white-space: nowrap;
}


/* ============ オプションモジュール選択 (Expansion Section) ============ */
.optional-modules {
    margin-top: 28px;
    padding: 28px 24px;
    background: linear-gradient(180deg, #FFFFFF, #F8FAFC);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05), inset 0 1px 0 #FFFFFF;
}

.optional-modules-title {
    font-size: 18px;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: 0.01em;
    margin-bottom: 6px;
}

.optional-modules-desc {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 20px;
    line-height: 1.6;
}

.optional-modules-group + .optional-modules-group {
    margin-top: 20px;
}

.optional-modules-group-label {
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    letter-spacing: 0.02em;
    margin-bottom: 10px;
}

.optional-capex-list,
.optional-module-list {
    padding: 16px;
    gap: 10px;
}

.optional-module-row label {
    justify-content: flex-start;
}

.optional-module-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.optional-module-name {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.optional-module-desc {
    font-size: 12px;
    font-weight: 400;
    color: #64748b;
    line-height: 1.5;
}

.maximize-check-item.selected {
    border-color: var(--primary-color);
    background-color: #EFF6FF;
}

.optional-modules-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #EFF6FF, #DBEAFE);
    border: 1px solid #BFDBFE;
    border-radius: 12px;
}

.optional-modules-total-label {
    font-size: 14px;
    font-weight: 700;
    color: #1E3A8A;
}

.optional-modules-total-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary-color);
    white-space: nowrap;
}

/* ============ NEW: プルダウン追加式 オプションモジュール UI ============ */
.optional-modules-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.optional-add-group {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1 1 auto;
    min-width: 220px;
}

.optional-add-select {
    flex: 1;
    padding: 10px 12px;
    font-size: 14px;
    color: #1e293b;
    background: #ffffff;
    border: 1px solid #BFDBFE;
    border-radius: 8px;
    box-shadow: inset 0 1px 0 #ffffff;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.optional-add-select:hover,
.optional-add-select:focus {
    border-color: #60A5FA;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    outline: none;
}

.btn-optional-add {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, #3B82F6, #2563EB);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.22);
    transition: transform 0.1s ease, box-shadow 0.15s ease;
    white-space: nowrap;
}

.btn-optional-add:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(37, 99, 235, 0.3);
}

.btn-optional-custom {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    color: #1E3A8A;
    background: #F1F5F9;
    border: 1px dashed #93C5FD;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}

.btn-optional-custom:hover {
    background: #EFF6FF;
    border-color: #3B82F6;
}

.optional-rows-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    min-height: 40px;
}

.optional-empty-row {
    font-size: 13px;
    color: #94A3B8;
    padding: 18px 12px;
    text-align: center;
    background: #F8FAFC;
    border: 1px dashed #CBD5E1;
    border-radius: 10px;
}

.optional-row {
    display: grid;
    grid-template-columns: auto 1fr 160px 36px;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.optional-row:hover {
    border-color: #BFDBFE;
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.08);
}

.optional-row-badge {
    font-size: 11px;
    font-weight: 700;
    color: #1E3A8A;
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    border-radius: 999px;
    padding: 3px 10px;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.optional-row-badge.badge-capex {
    background: #DBEAFE;
    border-color: #93C5FD;
    color: #1E3A8A;
}

.optional-row-badge.badge-module {
    background: #EFF6FF;
    border-color: #BFDBFE;
    color: #1D4ED8;
}

.optional-row-badge.badge-custom {
    background: #F1F5F9;
    border-color: #CBD5E1;
    color: #475569;
}

.optional-row-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.optional-row-name-fixed {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.optional-row-title {
    font-size: 14px;
    font-weight: 700;
    color: #1E293B;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.optional-row-desc {
    font-size: 12px;
    color: #64748B;
    line-height: 1.4;
}

.optional-row-name {
    width: 100%;
    padding: 8px 10px;
    font-size: 14px;
    color: #0F172A;
    background: #F8FAFC;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.optional-row-name:focus {
    outline: none;
    border-color: #3B82F6;
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.optional-row-amount-fixed {
    font-size: 15px;
    font-weight: 800;
    color: #1D4ED8;
    text-align: right;
    font-family: var(--font-en);
    white-space: nowrap;
}

.optional-row-amount-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #F8FAFC;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    padding: 0 8px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.optional-row-amount-wrap:focus-within {
    border-color: #3B82F6;
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.optional-row-yen {
    color: #64748B;
    font-size: 14px;
    font-weight: 600;
}

.optional-row-amount {
    flex: 1;
    min-width: 0;
    width: 100%;
    padding: 8px 4px;
    font-size: 14px;
    text-align: right;
    color: #0F172A;
    background: transparent;
    border: none;
    outline: none;
    font-family: var(--font-en);
}

.optional-row-delete {
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    color: #475569;
    background: #F1F5F9;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.optional-row-delete:hover {
    background: #E0E7FF;
    color: #1E3A8A;
    border-color: #93C5FD;
}

@media (max-width: 640px) {
    .optional-row {
        grid-template-columns: auto 1fr 36px;
        grid-template-rows: auto auto;
        row-gap: 8px;
    }
    .optional-row-body { grid-column: 1 / -2; }
    .optional-row-delete { grid-column: -2 / -1; grid-row: 1; align-self: start; }
    .optional-row-amount-fixed,
    .optional-row-amount-wrap {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }
    .optional-row-amount-fixed { text-align: right; }
}


/* ============ 比較シミュレーション (Comparison Section) ============ */
.comparison-section {
    margin-top: 40px;
    padding: 32px 24px;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.05);
}

.comparison-title {
    font-size: 22px;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 8px;
    text-align: center;
}

.comparison-desc {
    font-size: 14px;
    color: #64748b;
    text-align: center;
    margin-bottom: 24px;
}

.comparison-table-wrapper {
    overflow-x: auto;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.comparison-table th,
.comparison-table td {
    padding: 16px;
    text-align: center;
    border: 1px solid #e2e8f0;
    font-size: 15px;
}

.comparison-table th {
    background: #f8fafc;
    font-weight: 700;
    color: #475569;
}

.comparison-table .row-label {
    text-align: left;
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
}

.comparison-table th.highlight-col {
    background: #eff6ff;
    color: var(--primary-color);
    font-size: 16px;
}

.comparison-table td.highlight-col {
    background: #f0f9ff;
}

.comparison-table .net-row td {
    background: #f8fafc;
}

.comparison-table .net-row td.highlight-col {
    background: #dbeafe;
}

.comparison-delta {
    /* アニメーション削除 */
}

/* ---- 比較モード切替プルダウン ---- */
.comparison-mode-select {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin: 0 0 16px;
    flex-wrap: wrap;
}
.comparison-mode-select label {
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.03em;
}
.comparison-mode-select select {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
    min-width: 200px;
    transition: border-color 0.15s ease;
}
.comparison-mode-select select:hover,
.comparison-mode-select select:focus {
    border-color: var(--primary-color, #2563EB);
    outline: none;
}

/* ---- 3列比較テーブル: プルダウンによる列表示切替 ---- */
.comparison-table-3col[data-mode="general-vs-ai"] .col-sr-top,
.comparison-table-3col[data-mode="top-vs-ai"]     .col-sr-general {
    display: none;
}


/* ======== Result Accordion ======== */
.result-accordion {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow: hidden;
}

.result-accordion summary {
    list-style: none;
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    cursor: pointer;
    position: relative;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    transition: background 0.2s;
}

.result-accordion summary::-webkit-details-marker {
    display: none;
}

.result-accordion summary:hover {
    background: #f1f5f9;
}

.result-accordion summary::after {
    content: "▼";
    font-size: 12px;
    color: #64748b;
    transition: transform 0.3s ease;
}

.result-accordion[open] summary::after {
    transform: rotate(180deg);
}

.result-accordion[open] summary {
    border-bottom: 1px solid #e2e8f0;
}

.result-accordion .accordion-content {
    padding: 20px;
    background: #ffffff;
}


/* ============ Premium Stepper ============ */
.office-form-groups {
    display: flex;
    flex-direction: column;
    gap: 28px;
}
.office-group .group-title {
    font-size: 18px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 12px;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 6px;
}
.group-grid {
    display: grid;
    gap: 16px;
}
.group-grid.col-3 {
    grid-template-columns: repeat(3, 1fr);
}
.group-grid.col-2 {
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 768px) {
    .group-grid.col-3, .group-grid.col-2 {
        grid-template-columns: 1fr;
    }
}

/* ═══ ステッパー（人数入力）: 独立ボタン + 中央入力 + 単位ラベル ═══ */
.stepper-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 6px;
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
    height: 44px;
    box-shadow: none;
    width: 100%;
    padding: 0;
}

/* 共通ステッパーボタン */
.stepper-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    flex: 0 0 auto;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background-color 0.12s ease, transform 0.06s ease, box-shadow 0.12s ease;
}

/* -1 / +1 は主操作: 大きめ 40x36 */
.stepper-btn.minus-1,
.stepper-btn.plus-1 {
    width: 40px;
    min-width: 40px;
    font-size: 16px;
}

/* -5 / +5 は補助: 小さめ 34x36 */
.stepper-btn.minus-5,
.stepper-btn.plus-5 {
    width: 34px;
    min-width: 34px;
    font-size: 12px;
    font-weight: 800;
}

/* -系: 薄いグレー背景 */
.stepper-btn.minus-5,
.stepper-btn.minus-1 {
    background: #f1f5f9;
    color: #475569;
    border-color: #e2e8f0;
}
.stepper-btn.minus-5:hover,
.stepper-btn.minus-1:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* +系: アクセントカラー背景 */
.stepper-btn.plus-1,
.stepper-btn.plus-5 {
    background: var(--accent-blue);
    color: #ffffff;
    border-color: var(--accent-blue);
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.15);
}
.stepper-btn.plus-1:hover,
.stepper-btn.plus-5:hover {
    background: var(--accent-blue-dark);
    border-color: var(--accent-blue-dark);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.stepper-btn:active {
    transform: translateY(1px);
    filter: brightness(0.95);
}

/* Focus ring for keyboard users */
.stepper-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

/* 入力エリア（枠あり・幅固定・単位ラベル右） */
.stepper-input-area {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 8px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    flex: 0 0 auto;
    gap: 3px;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.stepper-input-area:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.stepper-input-area input {
    width: 60px;
    text-align: center;
    border: none;
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    background: transparent;
    outline: none;
    padding: 0;
    -moz-appearance: textfield;
    font-family: inherit;
}

.stepper-input-area input::-webkit-outer-spin-button,
.stepper-input-area input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.stepper-input-area .num-unit {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    margin: 0;
}

/* Readonly 表示（計算結果表示のみ） */
.stepper-wrap.readonly {
    justify-content: center;
}
.stepper-wrap.readonly .stepper-input-area {
    background: #f8fafc;
    border-color: #e2e8f0;
    box-shadow: none;
}
.stepper-wrap.readonly .stepper-input-area input {
    color: #64748b;
}

.num-field .stepper-wrap {
    width: 100%;
    margin-top: 8px;
}
.num-field .num-label {
    font-size: 16px;
    font-weight: 700;
}

/* ═══ STEP 2 (事業所人数入力) 専用コンパクトレイアウト ═══
   事業所カードは項目数が多く縦に伸びやすいため、1画面に収まるよう
   #step-gate 配下だけ余白・行高を圧縮する。他ステップ／結果画面には影響しない。 */
#step-gate .step-card {
    padding: 14px 16px 12px;
}
#step-gate .yn-question {
    padding: 8px 0;
}
#step-gate .yn-question-text {
    margin-bottom: 8px;
}
#step-gate .yn-sub.open {
    margin-top: 8px;
    padding: 8px;
}
#step-gate .step-title {
    font-size: 18px;
}
#step-gate .step-nav {
    margin-top: 8px;
    padding-top: 8px;
}
#step-gate .step-nav .btn-primary {
    padding: 10px 22px;
    font-size: 15px;
}
#step-gate .step-nav .btn-ghost {
    padding: 9px 18px;
}
#step-gate .yn-btn {
    padding: 8px 0;
    max-width: 170px;
}

.office-card .office-form-groups {
    gap: 8px;
}
.office-card .group-grid {
    gap: 8px;
}
.office-card .group-grid.col-2 {
    column-gap: 36px;
}
.office-card .num-field {
    gap: 2px;
}
.office-card .num-field .num-label {
    font-size: 13px;
    line-height: 1.3;
}
.office-card .num-field .stepper-wrap {
    margin-top: 2px;
}
.office-card .stepper-wrap {
    height: 32px;
    gap: 4px;
}
.office-card .stepper-btn {
    height: 30px;
}
.office-card .stepper-btn.minus-1,
.office-card .stepper-btn.plus-1 {
    width: 34px;
    min-width: 34px;
    font-size: 15px;
}
.office-card .stepper-btn.minus-5,
.office-card .stepper-btn.plus-5 {
    width: 30px;
    min-width: 30px;
}
.office-card .stepper-input-area {
    height: 30px;
    padding: 0 6px;
}
.office-card .stepper-input-area input {
    width: 46px;
    font-size: 16px;
}

/* 狭幅 (1カラム) では自動計算欄だけ横並びにして行数を削る。
   ±ボタン付きの欄は横幅が足りないため縦積みのまま。 */
@media (max-width: 767px) {
    .office-card .num-field-ro {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }
    .office-card .num-field-ro .stepper-wrap {
        width: auto;
        flex: 0 0 auto;
        margin-top: 0;
    }
}

/* 2カラム表示できる幅では ラベルとステッパーを横並びにして行数分の高さを削る。
   1カラムに落ちる狭幅では横幅が足りないため、従来どおり縦積みのまま。 */
@media (min-width: 768px) {
    .office-card .num-field {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }
    .office-card .num-field .num-label {
        flex: 1 1 auto;
        min-width: 0;
    }
    .office-card .num-field .stepper-wrap {
        width: auto;
        flex: 0 0 auto;
        margin-top: 0;
        justify-content: flex-end;
    }
}

/* ============ 余力（助成金枠）拡大シミュレーション ============ */

.expansion-section {
    margin-top: 40px;
    padding: 28px 22px 24px;
    background: linear-gradient(135deg, #FFFFFF 0%, #EFF6FF 55%, #DBEAFE 100%);
    color: var(--text-main);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px -6px rgba(37, 99, 235, 0.12);
    border: 1px solid #BFDBFE;
    position: relative;
    overflow: hidden;
}

.expansion-section::before {
    content: "";
    position: absolute;
    inset: -40px -40px auto auto;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle at center, rgba(37, 99, 235, 0.08), transparent 70%);
    pointer-events: none;
}

.expansion-header {
    text-align: center;
    margin-bottom: 22px;
    position: relative;
}

.expansion-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.2);
    color: #2563EB;
    font-family: var(--font-en);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
    margin-bottom: 12px;
}

.expansion-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 8px;
    line-height: 1.35;
    color: #1E3A8A;
}

.expansion-desc {
    font-size: 13px;
    line-height: 1.75;
    color: #475569;
}

.expansion-desc strong {
    color: #2563EB;
    font-weight: 700;
}

/* 自動計算値テーブル（診断結果から連動・readonly表示） */
.expansion-auto-table {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #BFDBFE;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 24px;
    font-size: 13px;
    display: none;
}

/* ============ NEW: Surplus Gauge UI ============ */
.expansion-surplus-container {
    background: #FFFFFF;
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    border: 1px solid #E2E8F0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.expansion-surplus-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -10px rgba(37, 99, 235, 0.15);
}
.surplus-label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
}
.surplus-title {
    font-size: 14px;
    font-weight: 700;
    color: #475569;
}
.surplus-value {
    font-size: 28px;
    font-weight: 900;
    color: #2563EB;
    font-family: var(--font-en);
}
.surplus-bar-bg {
    height: 8px;
    background: #F1F5F9;
    border-radius: 99px;
    overflow: hidden;
    position: relative;
    margin-bottom: 12px;
}
.surplus-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #3B82F6, #1D4ED8);
    width: 0%;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 99px;
}
.surplus-desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.6;
}

/* 余剰枠 − 追加投資 ＝ 残り の計算式行 */
.exp-surplus-formula {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 10px;
    margin-top: 14px;
    padding: 12px 14px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    font-size: 13px;
    color: #334155;
    font-weight: 600;
}
.exp-surplus-formula .formula-term {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.exp-surplus-formula .formula-term b {
    font-family: var(--font-en), var(--font-jp);
    font-weight: 800;
    font-size: 15px;
    color: #0F172A;
}
.exp-surplus-formula .formula-surplus b { color: #1D4ED8; }
.exp-surplus-formula .formula-invest b  { color: #475569; }
.exp-surplus-formula .formula-remain b  { color: #1E3A8A; }
.exp-surplus-formula .formula-remain.is-over { color: #B91C1C; }
.exp-surplus-formula .formula-remain.is-over b { color: #B91C1C; }
.exp-surplus-formula .formula-op {
    color: #94A3B8;
    font-weight: 700;
}

.investment-slider-wrap {
    margin-top: 16px;
    padding: 0 8px;
}
.investment-slider-wrap input[type=range] {
    width: 100%;
    appearance: none;
    height: 6px;
    background: #E2E8F0;
    border-radius: 99px;
    outline: none;
}
.investment-slider-wrap input[type=range]::-webkit-slider-thumb {
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #FFFFFF;
    border: 2px solid #2563EB;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
    cursor: pointer;
    transition: transform 0.1s;
}
.investment-slider-wrap input[type=range]::-webkit-slider-thumb:active {
    transform: scale(1.1);
}

.investment-coverage-ui {
    background: rgba(255, 255, 255, 0.6);
    border: 1px dashed #93C5FD;
    border-radius: 12px;
    padding: 16px;
    margin-top: 16px;
    animation: fadeIn 0.4s ease forwards;
}
.coverage-chart-container {
    height: 12px;
    background: #F1F5F9;
    border-radius: 99px;
    display: flex;
    overflow: hidden;
}
.coverage-bar-track {
    width: 100%;
    display: flex;
    height: 100%;
}
.coverage-bar-grant {
    height: 100%;
    background: linear-gradient(90deg, #60A5FA, #3B82F6);
    transition: width 0.4s ease;
}
.coverage-bar-real {
    height: 100%;
    background: #CBD5E1;
    transition: width 0.4s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.expansion-auto-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #E2E8F0;
}

.expansion-auto-row:last-child {
    border-bottom: none;
}

.expansion-auto-label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.expansion-auto-value {
    font-size: 16px;
    font-weight: 800;
    color: #1E3A8A;
    white-space: nowrap;
}

.expansion-inputs {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 18px;
    position: relative;
}

.expansion-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid #BFDBFE;
    border-radius: var(--radius-md);
    backdrop-filter: blur(4px);
}

.expansion-label {
    font-size: 14px;
    font-weight: 700;
    color: #1E3A8A;
}

.expansion-hint {
    font-size: 12px;
    color: #94A3B8;
    line-height: 1.55;
    margin-bottom: 6px;
}

.expansion-field .num-input-wrap {
    background: #fff;
    border-color: transparent;
}

.expansion-field .num-input-wrap:focus-within {
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.45);
}

.expansion-field .num-input-wrap input {
    color: var(--text-main);
    font-size: 18px;
}

.expansion-module-info {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(37, 99, 235, 0.06);
    border: 1px solid #BFDBFE;
    border-radius: var(--radius-sm);
    margin-bottom: 22px;
    position: relative;
}

.expansion-module-label {
    font-size: 12px;
    font-weight: 700;
    color: #2563EB;
    letter-spacing: 0.05em;
}

.expansion-module-badge {
    font-size: 14px;
    font-weight: 800;
    color: #1E3A8A;
}

.expansion-pnl {
    padding: 20px 18px;
    background: rgba(255, 255, 255, 0.96);
    border-radius: var(--radius-md);
    position: relative;
}

.expansion-pnl-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 14px;
    letter-spacing: -0.01em;
}

.pnl-table {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pnl-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
}

.pnl-row.income {
    background: #EFF6FF;
    border-color: #BFDBFE;
    color: #1E3A8A;
}

.pnl-row.expense {
    background: #FDF2F2;
    border-color: #FBD5D5;
    color: #7F1D1D;
}

/* 小計行（AIシステム実質負担 / 収入総額 / コスト総額） */
.pnl-row.pnl-subtotal {
    font-weight: 800;
}
.pnl-row.pnl-subtotal .pnl-label {
    font-weight: 800;
}
.pnl-row.pnl-subtotal .pnl-value {
    font-size: 17px;
}

/* 経費助成によるコスト削減行（マイナス表記） */
.pnl-row.pnl-row-reduction {
    background: #F1F5F9;
    border-color: #CBD5E1;
    color: #334155;
}
.pnl-row.pnl-row-reduction .pnl-value {
    color: #1D4ED8;
}

/* セクションヘッダー（＜受給＞ / ＜支払＞ / ＜最終結果＞） */
.pnl-section-header {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #475569;
    margin: 10px 2px 2px;
    padding: 0 2px;
}
.pnl-section-header:first-child {
    margin-top: 0;
}
.pnl-header-income  { color: #1D4ED8; }
.pnl-header-cost    { color: #B91C1C; }
.pnl-header-final   { color: #0F172A; }

.pnl-row .pnl-label {
    font-weight: 600;
}

.pnl-row .pnl-value {
    font-family: var(--font-en), var(--font-jp);
    font-weight: 800;
    font-size: 16px;
}

/* 働き方改革助成の余剰 → 経費助成枠 追加獲得行 */
.pnl-row.pnl-surplus-extra {
    background: #EFF6FF;
    border-color: #BFDBFE;
    color: #1D4ED8;
}

.pnl-row .pnl-sublabel {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: #64748B;
    margin-top: 2px;
}

/* 「経費助成枠に上乗せ」バッジ（比較表・サマリー共通） */
.surplus-extra-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 4px 12px;
    background: linear-gradient(135deg, #EFF6FF, #DBEAFE);
    border: 1px solid #BFDBFE;
    border-radius: 999px;
    color: #1D4ED8;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
}

.pnl-row.net {
    margin-top: 10px;
    padding: 18px 20px;
    background: linear-gradient(135deg, #1E3A8A 0%, #1D4ED8 100%);
    border: 1px solid #1E3A8A;
    color: #FFFFFF;
    font-size: 16px;
}

.pnl-row.net .pnl-label {
    font-weight: 800;
    color: #FFFFFF;
}

.pnl-row.net .pnl-value {
    font-size: 24px;
    color: #FFFFFF;
}

.pnl-row.net .pnl-value.positive {
    color: #FFFFFF;
}

.pnl-row.net .pnl-value.negative {
    color: #FCA5A5;
}

@media (min-width: 640px) {
    .expansion-section {
        padding: 36px 32px 30px;
    }

    .expansion-inputs {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }

    .expansion-title {
        font-size: 26px;
    }

    .pnl-row .pnl-value {
        font-size: 18px;
    }

    .pnl-row.net .pnl-value {
        font-size: 28px;
    }
}

/* ============================================================
   結果マルチページ (Result Pages)
   ============================================================ */

/* ---- Step Tab Indicator ---- */
.result-step-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 20px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 50;
  margin: 0 -20px 24px -20px;
}
.result-step-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.result-step-tab:hover {
  border-color: #93c5fd;
  color: #3b82f6;
  background: #eff6ff;
}
.result-step-tab.active {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}
.result-step-tab .step-tab-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 800;
  background: #e2e8f0;
  color: #64748b;
  flex-shrink: 0;
}
.result-step-tab.active .step-tab-num {
  background: rgba(255,255,255,0.25);
  color: #fff;
}
.result-step-tab.locked {
  opacity: 0.5;
  cursor: not-allowed;
}
.result-step-tabs.wizard-mode {
  padding: 6px 20px;
  margin-bottom: 12px;
}
.result-step-tabs.wizard-mode .result-step-tab {
  padding: 7px 8px;
}
/* 診断中: 結果ページ用タブ (1〜4) は到達前なので操作不可の見た目にする */
.result-step-tabs.wizard-mode .result-step-tab:not([data-step-tab="0"]) {
  opacity: 0.5;
  cursor: default;
}
.result-step-tabs.wizard-mode .result-step-tab:not([data-step-tab="0"]):hover {
  border-color: #e2e8f0;
  color: #94a3b8;
  background: #fff;
}
.result-step-tab.locked:hover {
  border-color: #e2e8f0;
  color: #94a3b8;
  background: #fff;
}
@media (max-width: 480px) {
  .result-step-tab .step-tab-label { display: none; }
  .result-step-tab { padding: 8px 6px; }
}

.result-page {
    display: none;
}

.result-page.active {
    display: block;
}

.result-page.page-fade-in {
    animation: resultPageFade 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes resultPageFade {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- ページ内セクション区切り（コスト比較 → 余力シミュレーション） --- */
.result-section-divider {
    margin: 56px 0 32px;
}

.result-divider-line {
    border: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #CBD5E1 20%, #CBD5E1 80%, transparent);
    margin: 0;
}

/* --- Page header (common) --- */
.result-page-header {
    text-align: center;
    max-width: 720px;
    margin: 0 auto 40px;
    padding: 20px 8px 0;
}

.result-page-eyebrow {
    display: inline-block;
    font-family: var(--font-en);
    font-weight: 800;
    font-size: 11px;
    letter-spacing: 0.18em;
    color: var(--accent-blue);
    padding: 6px 14px;
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    border-radius: 999px;
    margin-bottom: 18px;
}

.result-page-title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-main);
    margin-bottom: 14px;
    line-height: 1.35;
}

.result-page-desc {
    font-size: 14px;
    color: var(--text-sub);
    line-height: 1.85;
}

/* --- Page 1 hero (extra-large) --- */
.result-hero--xl {
    padding: 64px 32px;
    margin: 24px 0 40px;
    border-radius: 28px;
    background: linear-gradient(135deg, #1E40AF 0%, #2563EB 55%, #3B82F6 100%);
    box-shadow:
        0 20px 48px -12px rgba(37, 99, 235, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    position: relative;
    overflow: hidden;
}

.result-hero--xl::before {
    content: "";
    position: absolute;
    inset: -30% -20% auto auto;
    width: 380px;
    height: 380px;
    background: radial-gradient(circle at center, rgba(255,255,255,0.18), transparent 65%);
    pointer-events: none;
}

.result-hero--xl::after {
    content: "";
    position: absolute;
    inset: auto auto -40% -25%;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle at center, rgba(147, 197, 253, 0.22), transparent 65%);
    pointer-events: none;
}

.result-hero--xl .result-hero-label {
    font-size: 15px;
    letter-spacing: 0.12em;
    opacity: 0.85;
    margin-bottom: 22px;
    text-transform: uppercase;
}

.result-hero--xl .result-hero-amount {
    font-size: 64px;
    font-weight: 900;
    letter-spacing: -0.03em;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    line-height: 1.05;
}

@media (min-width: 640px) {
    .result-hero--xl {
        padding: 96px 40px;
    }
    .result-hero--xl .result-hero-amount {
        font-size: 96px;
    }
    .result-hero--xl .result-hero-label {
        font-size: 16px;
        margin-bottom: 28px;
    }
    .result-page-title {
        font-size: 34px;
    }
    .result-page-desc {
        font-size: 15px;
    }
}

@media (min-width: 900px) {
    .result-hero--xl .result-hero-amount {
        font-size: 112px;
    }
}

/* --- Δ delta (real net) --- */
.comparison-delta--xl {
    margin: 0 auto 48px;
    padding: 28px 32px;
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
    border: 1px solid #BFDBFE;
    border-radius: 20px;
    box-shadow: 0 8px 20px -6px rgba(37, 99, 235, 0.12);
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    color: #1E3A8A;
    max-width: 860px;
    text-align: center;
    line-height: 1.5;
}

.comparison-delta--xl .delta-amount {
    font-family: var(--font-en), var(--font-jp);
    font-size: 44px;
    font-weight: 900;
    color: var(--accent-blue);
    line-height: 1;
    letter-spacing: -0.02em;
}

@media (min-width: 640px) {
    .comparison-delta--xl {
        font-size: 18px;
        padding: 32px 40px;
    }
    .comparison-delta--xl .delta-amount {
        font-size: 56px;
    }
}

/* --- Page 1 breakdown wrapper --- */
.result-breakdown {
    background: var(--bg-card);
    border: 1px solid var(--stroke);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 24px;
}

/* --- Page 1 unified summary card (bottom) --- */
.result-summary-card {
    margin: 32px 0 24px;
    padding: 28px 24px 22px;
    border-radius: 20px;
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
    border: 1px solid #E2E8F0;
    box-shadow: 0 12px 32px -12px rgba(15, 23, 42, 0.10), inset 0 1px 0 #FFFFFF;
}

.result-summary-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #64748B;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 20px;
}

.result-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1.3fr 1fr;
    gap: 12px;
    align-items: stretch;
}

@media (max-width: 768px) {
    .result-summary-grid {
        grid-template-columns: 1fr;
    }
}

.result-summary-cell {
    padding: 20px 12px 18px;
    border-radius: 14px;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}

.result-summary-cell .cell-label {
    font-size: 12px;
    font-weight: 700;
    color: #64748B;
    letter-spacing: 0.04em;
}

.result-summary-cell .cell-value {
    font-family: var(--font-en), var(--font-jp);
    font-size: 22px;
    font-weight: 900;
    line-height: 1.1;
    color: var(--text-main);
    letter-spacing: -0.02em;
    word-break: keep-all;
}

.result-summary-cell.cell-grant {
    background: linear-gradient(180deg, #EFF6FF, #DBEAFE);
    border-color: #BFDBFE;
}
.result-summary-cell.cell-grant .cell-value { color: var(--accent-blue, #2563EB); }

.result-summary-cell.cell-cost {
    background: #F8FAFC;
    border-color: #CBD5E1;
    padding: 16px 10px;
}

.cell-cost-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
    width: 100%;
}

.cell-cost-subcol {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 2px 8px;
}

.cell-cost-subcol .subcol-label {
    font-size: 12px;
    font-weight: 700;
    color: #64748B;
}

.cell-cost-subcol .subcol-val {
    font-family: var(--font-en), var(--font-jp);
    font-size: 18px;
    font-weight: 900;
    color: #334155;
    word-break: keep-all;
}

.cell-cost-subcol.subcol-real .subcol-val {
    color: #0284C7;
}

.cell-cost-divider {
    width: 100%;
    height: 1px;
    background: #E2E8F0;
    margin: 2px 0;
}

.result-summary-cell.cell-net {
    background: linear-gradient(180deg, #EFF6FF, #DBEAFE);
    border-color: #BFDBFE;
}
.result-summary-cell.cell-net .cell-value { color: var(--accent-blue, #2563EB); }
.result-summary-cell.cell-net .cell-value.negative { color: #B91C1C; }

.result-module-breakdown {
    margin-top: 20px;
    padding: 18px 18px 14px;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 14px;
}

.module-breakdown-header {
    font-size: 13px;
    font-weight: 700;
    color: #1E3A8A;
    letter-spacing: 0.04em;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #E2E8F0;
    text-align: left;
}

.module-breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.module-breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 4px;
    border-bottom: 1px dashed #E2E8F0;
    gap: 12px;
}

.module-breakdown-row:last-child {
    border-bottom: none;
}

.module-breakdown-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
    min-width: 0;
    flex: 1;
}

.module-breakdown-name {
    font-size: 14px;
    font-weight: 700;
    color: #1E3A8A;
    letter-spacing: -0.005em;
}

.module-breakdown-desc {
    font-size: 11px;
    font-weight: 500;
    color: #64748B;
    line-height: 1.4;
}

.module-breakdown-cost {
    font-family: var(--font-en), var(--font-jp);
    font-size: 15px;
    font-weight: 700;
    color: #475569;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.module-breakdown-row.module-breakdown-total {
    margin-top: 4px;
    padding-top: 12px;
    border-top: 2px solid #CBD5E1;
    border-bottom: none;
}

.module-breakdown-row.module-breakdown-total .module-breakdown-name {
    font-size: 15px;
    color: #0F172A;
}

.module-breakdown-row.module-breakdown-total .module-breakdown-cost {
    font-size: 18px;
    color: #1E3A8A;
    font-weight: 900;
}

@media (min-width: 640px) {
    .result-module-breakdown {
        padding: 22px 24px 18px;
    }
    .module-breakdown-header {
        font-size: 14px;
    }
    .module-breakdown-name {
        font-size: 15px;
    }
    .module-breakdown-desc {
        font-size: 12px;
    }
    .module-breakdown-cost {
        font-size: 17px;
    }
    .module-breakdown-row.module-breakdown-total .module-breakdown-cost {
        font-size: 20px;
    }
}

.result-summary-note {
    margin-top: 14px;
    font-size: 12px;
    color: #64748B;
    text-align: center;
    line-height: 1.6;
}

@media (min-width: 640px) {
    .result-summary-card {
        padding: 34px 32px 26px;
    }
    .result-summary-cell {
        padding: 26px 16px 22px;
    }
    .result-summary-cell .cell-value {
        font-size: 32px;
    }
    .result-summary-title {
        font-size: 15px;
    }
}

.result-breakdown-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--stroke);
    letter-spacing: -0.01em;
}

@media (min-width: 640px) {
    .result-breakdown {
        padding: 44px 40px;
    }
    .result-breakdown-title {
        font-size: 22px;
        margin-bottom: 24px;
    }
}

/* --- FitStat 専用: 見積書・提案レポート生成パネル (Page 3) --- */
.grant-docs-panel {
    margin-top: 32px;
    padding: 22px 24px;
    border-radius: 14px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    box-shadow: 0 10px 28px rgba(26, 26, 46, 0.28);
}

.grant-docs-head { margin-bottom: 14px; }

.grant-docs-title {
    font-size: 1.05rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
}

.grant-docs-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.grant-docs-sub {
    margin-top: 4px;
    font-size: 0.86rem;
    opacity: 0.85;
}

.grant-docs-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.grant-docs-btn {
    flex: 1 1 200px;
    background: #fff;
    color: #1a1a2e;
    border-color: #fff;
    font-weight: 800;
    box-shadow: none;
}

.grant-docs-btn:hover:not(:disabled) {
    background: #e8ebf5;
    color: #1a1a2e;
    box-shadow: none;
}

.grant-docs-btn:disabled { opacity: 0.6; }

.grant-docs-note {
    margin-top: 12px;
    font-size: 0.78rem;
    opacity: 0.7;
}

/* --- Result page navigation buttons --- */
.result-page-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 40px;
    padding-top: 28px;
    border-top: 1px solid var(--stroke);
    flex-wrap: wrap;
}

.result-page-nav .btn-primary,
.result-page-nav .btn-page-next {
    font-size: 16px;
    padding: 16px 32px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        inset 0 -1px 0 rgba(0, 0, 0, 0.15),
        0 6px 18px rgba(37, 99, 235, 0.3);
}

.result-page-nav .btn-ghost {
    padding: 13px 22px;
}

@media (min-width: 640px) {
    .result-page-nav {
        margin-top: 56px;
        padding-top: 32px;
    }
    .result-page-nav .btn-page-next {
        font-size: 17px;
        padding: 18px 36px;
    }
}

/* --- Page 3 locked overlay (見積もり未承認時) --- */
.cost-comparison-locked {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    margin: 32px 0;
    padding: 48px 24px;
    background: rgba(248, 250, 252, 0.95);
    border-radius: 16px;
    border: 1px dashed #cbd5e1;
    text-align: center;
    color: #64748b;
}
.cost-comparison-locked .lock-icon {
    font-size: 48px;
    margin-bottom: 16px;
    line-height: 1;
}
.cost-comparison-locked .lock-text {
    font-size: 16px;
    font-weight: 700;
    color: #334155;
}
.cost-comparison-locked .lock-sub {
    font-size: 13px;
    margin-top: 8px;
    line-height: 1.7;
    max-width: 480px;
}

/* --- Page 3 comparison wrap --- */
.result-comparison-wrap {
    background: var(--bg-card);
    border: 1px solid var(--stroke);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    box-shadow: var(--shadow-soft);
}

.result-comparison-wrap .comparison-section {
    margin-top: 0;
    padding: 8px 4px;
    border: none;
    box-shadow: none;
    background: transparent;
}

.result-comparison-wrap .comparison-table th,
.result-comparison-wrap .comparison-table td {
    padding: 20px 18px;
}

@media (min-width: 640px) {
    .result-comparison-wrap {
        padding: 44px 40px;
    }
    .result-comparison-wrap .comparison-table th,
    .result-comparison-wrap .comparison-table td {
        padding: 24px 20px;
    }
    .result-comparison-wrap .comparison-title {
        font-size: 26px;
    }
    .result-comparison-wrap .comparison-desc {
        font-size: 15px;
        margin-bottom: 32px;
    }
}

/* --- Page 3 CTA block --- */
.result-cta-block {
    margin-top: 40px;
    padding: 32px 24px;
    background: linear-gradient(135deg, #F8FAFC 0%, #EFF6FF 100%);
    border: 1px solid #BFDBFE;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
    text-align: center;
}

.result-cta-block .btn-cta-lg {
    font-size: 18px;
    padding: 20px 28px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        inset 0 -1px 0 rgba(0, 0, 0, 0.15),
        0 8px 24px rgba(37, 99, 235, 0.35);
}

.result-cta-block .btn-cta-lg:hover:not(:disabled) {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        inset 0 -1px 0 rgba(0, 0, 0, 0.15),
        0 12px 32px rgba(37, 99, 235, 0.4);
}

@media (min-width: 640px) {
    .result-cta-block {
        padding: 44px 40px;
    }
    .result-cta-block .btn-cta-lg {
        font-size: 19px;
        padding: 22px 36px;
    }
}

.result-cta-secondary-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.result-cta-secondary-row .btn-ghost {
    padding: 10px 18px;
    font-size: 14px;
}

/* --- Saved-result (one-shot policy) badge & hint --- */
.saved-result-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: center;
    padding: 8px 16px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #EFF6FF, #DBEAFE);
    color: #1E3A8A;
    border: 1px solid #BFDBFE;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.saved-result-hint {
    margin: 16px 0 24px;
    padding: 14px 18px;
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    border-radius: 12px;
    color: #78350F;
    font-size: 13px;
    line-height: 1.7;
}

@media print {
    .sim-nav,
    .step-label,
    .step-indicator,
    .result-page-nav,
    .result-cta-block,
    .grant-docs-panel,
    #saved-result-hint,
    .sim-footer,
    .loading-overlay {
        display: none !important;
    }
    .sim-main { padding: 0 !important; }
    .result-page { display: block !important; page-break-after: always; }
    .grant-accordion-content { display: block !important; }
}

/* --- Overall layout breathing room --- */
#step-result .expansion-section {
    margin-top: 0;
    padding: 36px 28px;
}

@media (min-width: 640px) {
    #step-result .expansion-section {
        padding: 48px 40px;
    }
}

.sim-main {
    padding: 28px 20px 72px;
}

@media (min-width: 640px) {
    .sim-main {
        padding: 44px 32px 96px;
        max-width: 1120px;
    }
}

/* ============================================================
   Loading Transaction Overlay
   ============================================================ */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(248, 250, 252, 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* auto-resize iframe 内では position:fixed の「中央」が iframe 全高の中央 (画面外) になる。
   ui.js が表示前に親を iframe 先頭へスクロールするので、内容は上端寄せで確実に視界に入れる。 */
html.embedded .loading-overlay {
    align-items: flex-start;
    padding-top: 120px;
}

.loading-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 26px;
    padding: 48px 40px;
    background: #FFFFFF;
    border: 1px solid var(--stroke);
    border-radius: 24px;
    box-shadow:
        0 24px 64px -12px rgba(37, 99, 235, 0.18),
        inset 0 1px 0 #FFFFFF;
    min-width: 320px;
    max-width: 92vw;
    text-align: center;
}

.loading-spinner {
    width: 72px;
    height: 72px;
    position: relative;
}

.loading-spinner svg {
    animation: spinnerRotate 1.6s linear infinite;
}

.loading-spinner-track {
    stroke: #E2E8F0;
}

.loading-spinner-arc {
    stroke: var(--accent-blue);
    stroke-linecap: round;
    stroke-dasharray: 90 200;
    stroke-dashoffset: 0;
    filter: drop-shadow(0 2px 6px rgba(37, 99, 235, 0.35));
}

@keyframes spinnerRotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.loading-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-blue-dark);
    letter-spacing: 0.02em;
    line-height: 1.5;
    min-height: 24px;
}

.loading-text.fade-swap {
    animation: loadingTextSwap 0.35s ease both;
}

@keyframes loadingTextSwap {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.loading-progress {
    width: 260px;
    max-width: 100%;
    height: 4px;
    background: #E2E8F0;
    border-radius: 999px;
    overflow: hidden;
}

.loading-progress-bar {
    display: block;
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue-light), var(--accent-blue));
    border-radius: 999px;
}

@media (min-width: 640px) {
    .loading-inner {
        padding: 56px 48px;
        min-width: 380px;
    }
    .loading-text {
        font-size: 17px;
    }
}

/* ============================================================
   Simulation Blocked Modal
   ============================================================ */

.sim-block-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    padding: 20px;
}

.sim-block-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.sim-block-modal {
    background: #FFFFFF;
    border-radius: 24px;
    padding: 40px 32px 32px;
    max-width: 460px;
    width: 100%;
    box-shadow:
        0 32px 72px -12px rgba(15, 23, 42, 0.35),
        inset 0 1px 0 #FFFFFF;
    text-align: center;
    animation: blockModalPop 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes blockModalPop {
    from { opacity: 0; transform: scale(0.94) translateY(12px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.sim-block-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: linear-gradient(135deg, #EFF6FF, #DBEAFE);
    color: var(--accent-blue);
    margin-bottom: 20px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.sim-block-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

.sim-block-desc {
    font-size: 14px;
    color: var(--text-sub);
    line-height: 1.75;
    margin-bottom: 24px;
}

.sim-block-passcode {
    text-align: left;
    background: var(--bg-input);
    border: 1px solid var(--stroke);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 20px;
}

.sim-block-passcode-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-blue-dark);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.sim-passcode-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--stroke);
    border-radius: var(--radius-sm);
    background: #FFFFFF;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    letter-spacing: 0.05em;
}

.sim-passcode-input:focus {
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-focus);
}

.sim-passcode-input.shake {
    animation: inputShake 0.4s ease both;
    border-color: #DC2626;
}

@keyframes inputShake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-8px); }
    40%      { transform: translateX(6px); }
    60%      { transform: translateX(-4px); }
    80%      { transform: translateX(2px); }
}

.sim-passcode-error {
    display: none;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #DC2626;
}

.sim-passcode-error.visible {
    display: block;
    animation: fadeInUp 0.25s ease both;
}

.sim-block-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.sim-block-actions .btn-primary,
.sim-block-actions .btn-ghost {
    flex: 1;
    min-width: 130px;
}

/* Mobile refinements */
@media (max-width: 480px) {
    .result-hero--xl {
        padding: 48px 22px;
        border-radius: 22px;
    }
    .result-hero--xl .result-hero-amount {
        font-size: 44px;
    }
    .comparison-delta--xl {
        padding: 22px 20px;
        font-size: 14px;
    }
    .comparison-delta--xl .delta-amount {
        font-size: 34px;
    }
    .result-breakdown,
    .result-comparison-wrap,
    .result-cta-block {
        padding: 24px 18px;
    }
    .result-page-header {
        margin-bottom: 24px;
        padding: 8px 4px 0;
    }
    .result-page-title {
        font-size: 22px;
    }
    .result-page-nav .btn-page-next,
    .result-page-nav .btn-ghost {
        flex: 1;
        min-width: 140px;
        font-size: 14px;
        padding: 14px 16px;
    }
    .result-cta-block .btn-cta-lg {
        font-size: 15px;
        padding: 16px 18px;
    }
    .sim-block-modal {
        padding: 32px 22px 24px;
    }
}

/* ==== CEO指示: 画面上部の巨大な青バナー (result-hero) は完全非表示 ==== */
#result-hero,
.result-hero {
    display: none !important;
}

/* ==== 受給可能額サマリー（コンパクトストリップ・Page 1 冒頭） ==== */
.result-total-strip {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-left: 4px solid var(--accent-blue, #2563EB);
    border-radius: 14px;
    padding: 18px 22px;
    margin-bottom: 24px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}
.result-total-strip-main {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}
.result-total-strip-label {
    font-size: 14px;
    font-weight: 700;
    color: #475569;
    letter-spacing: 0.02em;
}
.result-total-strip-amount {
    font-size: 30px;
    font-weight: 900;
    color: var(--accent-blue-dark, #1E3A8A);
    white-space: nowrap;
}
.result-total-strip-count {
    margin-top: 6px;
    font-size: 12px;
    color: #64748b;
}
.result-total-strip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-top: 1px dashed #E2E8F0;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}
.result-total-strip-sub {
    font-size: 16px;
    font-weight: 800;
    color: var(--accent-blue, #2563EB);
    white-space: nowrap;
}
