:root {
    --ink: #172422;
    --muted: #60706c;
    --paper: #fffdf7;
    --paper-strong: #ffffff;
    --line: #dbe8e3;
    --teal: #0f766e;
    --teal-dark: #0b4f4a;
    --teal-soft: #dff5ef;
    --gold: #d79b36;
    --gold-soft: #fff0cf;
    --rose: #b94d48;
    --blue: #3269a8;
    --shadow: 0 18px 48px rgba(15, 76, 70, 0.13);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(90deg, rgba(15, 118, 110, 0.055) 1px, transparent 1px),
        linear-gradient(180deg, rgba(215, 155, 54, 0.06) 1px, transparent 1px),
        #fbfaf3;
    background-size: 28px 28px;
    font-family: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Hiragino Sans", "Yu Gothic", serif;
    line-height: 1.75;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid rgba(215, 155, 54, 0.55);
    outline-offset: 3px;
}

.app-header {
    background: linear-gradient(135deg, #f7f1df 0%, #fffdf7 46%, #e4f3ee 100%);
    border-bottom: 1px solid rgba(15, 118, 110, 0.15);
}

.topbar {
    max-width: 1160px;
    margin: 0 auto;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.brand,
.nav-links {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand {
    font-weight: 800;
    letter-spacing: 0;
}

.brand-mark {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--teal-dark);
    border-radius: 7px;
    font-family: Georgia, serif;
}

.nav-links a {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.hero {
    max-width: 1160px;
    margin: 0 auto;
    padding: 54px 22px 70px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
    gap: 54px;
    align-items: center;
    overflow: hidden;
}

.hero > * {
    min-width: 0;
}

.eyebrow,
.section-kicker,
.result-label {
    margin: 0 0 10px;
    color: var(--teal);
    font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 18px;
    font-size: clamp(38px, 7vw, 78px);
    line-height: 1.02;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.lead {
    max-width: 620px;
    color: #34413e;
    font-size: 18px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.primary-btn,
.ghost-btn,
.secondary-btn {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    padding: 10px 18px;
    font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
    font-weight: 800;
}

.primary-btn,
.secondary-btn {
    color: #fff;
    background: var(--teal-dark);
    box-shadow: 0 10px 24px rgba(11, 79, 74, 0.22);
    border: 0;
}

.ghost-btn {
    color: var(--teal-dark);
    border: 1px solid rgba(15, 118, 110, 0.28);
    background: rgba(255, 255, 255, 0.5);
}

.invoice-board {
    position: relative;
    min-height: 470px;
    padding: 32px;
    background: #163b36;
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
    max-width: 100%;
}

.invoice-board::before {
    content: "";
    position: absolute;
    inset: 18px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
}

.invoice-card {
    position: relative;
    z-index: 1;
    width: 74%;
    padding: 18px;
    background: var(--paper);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.invoice-card + .flow-line {
    position: relative;
    z-index: 1;
    width: 2px;
    height: 44px;
    margin: 8px 0 8px 38%;
    background: linear-gradient(#e8c46f, rgba(232, 196, 111, 0.15));
}

.invoice-card span,
.corner span {
    display: block;
    color: var(--muted);
    font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
    font-size: 12px;
    font-weight: 800;
}

.invoice-card strong,
.corner strong {
    display: block;
    font-size: 24px;
}

.invoice-card.ap {
    margin-left: 20%;
}

.invoice-card.buyer {
    margin-left: 10%;
}

.mini-invoice {
    position: absolute;
    right: 26px;
    bottom: 26px;
    width: 122px;
    height: 156px;
    padding: 20px 16px;
    background: #fff;
    border-radius: 8px;
    transform: rotate(-4deg);
}

.mini-invoice span {
    display: block;
    height: 10px;
    margin-bottom: 18px;
    background: #d7e6e0;
    border-radius: 999px;
}

.mini-invoice span:first-child {
    width: 64%;
    background: var(--gold);
}

.section {
    max-width: 1120px;
    margin: 0 auto;
    padding: 72px 22px;
}

.section-heading h2 {
    margin-bottom: 12px;
    font-size: clamp(28px, 4vw, 44px);
    line-height: 1.18;
}

.section-heading {
    max-width: 760px;
    margin-bottom: 28px;
}

.diagnosis-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 28px;
    align-items: start;
}

.diagnosis-section .section-heading {
    grid-column: 1 / -1;
}

.diagnosis-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.diagnosis-actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px;
    background: rgba(223, 245, 239, 0.66);
    border: 1px solid rgba(15, 118, 110, 0.18);
    border-radius: var(--radius);
}

.diagnosis-actions .primary-btn {
    min-width: 180px;
}

.diagnosis-actions p {
    margin: 0;
    color: var(--muted);
    font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
    font-size: 13px;
}

.question,
.result-panel,
.term-card,
.corner,
.checklist {
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(15, 76, 70, 0.06);
}

.question {
    min-width: 0;
    margin: 0;
    padding: 18px;
}

.question legend {
    padding: 0 4px;
    font-weight: 800;
}

.question label,
.checklist label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
    color: #273a36;
    font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
    font-size: 14px;
}

input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    margin-top: 3px;
    accent-color: var(--teal);
    flex: 0 0 auto;
}

.result-panel {
    position: sticky;
    top: 18px;
    padding: 24px;
    background: linear-gradient(180deg, #ffffff, #f6fffb);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.result-panel-empty {
    background: rgba(255, 255, 255, 0.72);
}

.result-empty h3 {
    color: var(--ink);
}

.result-score {
    width: 82px;
    height: 82px;
    display: grid;
    place-items: center;
    margin-bottom: 14px;
    color: #fff;
    background: var(--teal-dark);
    border-radius: 50%;
    font-family: Georgia, serif;
    font-size: 22px;
    font-weight: 800;
}

.result-level {
    display: inline-flex;
    margin: 0 0 12px;
    padding: 4px 10px;
    color: var(--teal-dark);
    background: var(--teal-soft);
    border-radius: 999px;
    font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
    font-size: 13px;
    font-weight: 800;
}

.is-middle .result-score {
    background: var(--gold);
}

.is-high .result-score {
    background: var(--rose);
}

.is-middle .result-level {
    color: #7a5214;
    background: var(--gold-soft);
}

.is-high .result-level {
    color: #7c2521;
    background: #ffe1df;
}

.result-stale {
    border-color: rgba(215, 155, 54, 0.65);
    box-shadow: 0 8px 24px rgba(215, 155, 54, 0.12);
}

.result-panel h3 {
    margin-bottom: 10px;
    color: var(--teal-dark);
    font-size: 24px;
    line-height: 1.28;
}

.result-panel ul {
    padding-left: 1.2em;
    margin: 8px 0 18px;
    font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
    font-size: 14px;
}

.result-subtitle {
    margin: 18px 0 4px;
    color: var(--ink);
    font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
    font-size: 14px;
    font-weight: 800;
}

.saved-note {
    margin: 12px 0 0;
    color: var(--teal);
    font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
    font-size: 13px;
    font-weight: 700;
}

.decision-flow {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.flow-step {
    position: relative;
    min-height: 210px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(15, 76, 70, 0.06);
}

.flow-step span {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    margin-bottom: 18px;
    color: #fff;
    background: var(--teal-dark);
    border-radius: 50%;
    font-family: Georgia, serif;
    font-weight: 800;
}

.flow-step strong {
    display: block;
    margin-bottom: 10px;
    font-size: 22px;
}

.flow-step p,
.why-model p {
    color: #45534f;
    font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
    font-size: 14px;
}

.why-model {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    gap: 24px;
    margin-top: 18px;
    padding: 22px;
    background: var(--teal-soft);
    border-radius: var(--radius);
}

.why-model h3 {
    margin: 0;
    color: var(--teal-dark);
    font-size: 24px;
    line-height: 1.35;
}

.term-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.term-card {
    padding: 20px;
}

.term-card h3 {
    margin-bottom: 8px;
    font-size: 21px;
}

.term-card p {
    margin-bottom: 0;
    color: #42524e;
    font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
    font-size: 14px;
}

.checklist {
    padding: 22px;
}

.footer {
    padding: 34px 22px;
    color: #5b6966;
    background: #edf6f2;
    font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
    font-size: 13px;
    text-align: center;
    border-top: 1px solid var(--line);
}

.footer p {
    margin: 0 auto 8px;
    max-width: 900px;
}

.footer-about {
    max-width: 900px;
    margin: 0 auto 20px;
    text-align: left;
}

.footer-about-title {
    margin-bottom: 8px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
}

.footer-about-text {
    color: #5b6966;
    font-size: 13px;
    line-height: 1.8;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px 18px;
    margin-bottom: 8px;
}

.footer-nav a {
    color: var(--teal-dark);
    font-weight: 700;
}

.footer-copyright {
    color: #6b7875;
    font-size: 12px;
}

.legal-page {
    max-width: 860px;
    margin: 0 auto;
    padding: 56px 22px 72px;
}

.legal-card {
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: 0 8px 24px rgba(15, 76, 70, 0.06);
}

.legal-card h1 {
    font-size: clamp(30px, 5vw, 48px);
}

.legal-card h2 {
    margin-top: 28px;
    font-size: 22px;
}

.flow-page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 56px 22px 72px;
}

.flow-hero {
    max-width: 820px;
    margin-bottom: 42px;
}

.flow-hero h1 {
    font-size: clamp(34px, 5vw, 62px);
    line-height: 1.12;
}

.flow-hero p,
.diagram-caption,
.process-list span,
.flow-note p {
    color: #45534f;
    font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
}

.peppol-diagram,
.process-list,
.flow-note {
    margin-top: 28px;
    padding: 28px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(15, 76, 70, 0.06);
}

.diagram-heading h2,
.process-list h2,
.flow-note h2 {
    margin-bottom: 18px;
    font-size: clamp(26px, 4vw, 40px);
    line-height: 1.2;
}

.diagram-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr) 34px minmax(0, 1fr) 34px minmax(0, 1fr);
    gap: 12px;
    align-items: stretch;
}

.diagram-node {
    min-height: 240px;
    padding: 20px;
    background: var(--paper);
    border: 1px solid rgba(15, 118, 110, 0.18);
    border-radius: var(--radius);
}

.node-number {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    margin-bottom: 14px;
    color: #fff;
    background: var(--teal-dark);
    border-radius: 50%;
    font-family: Georgia, serif;
    font-weight: 800;
}

.node-role {
    margin-bottom: 4px;
    color: var(--teal);
    font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
    font-size: 12px;
    font-weight: 800;
}

.diagram-node h3 {
    margin-bottom: 10px;
    font-size: 23px;
    line-height: 1.25;
}

.diagram-node p:last-child {
    margin-bottom: 0;
    color: #45534f;
    font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
    font-size: 14px;
}

.diagram-arrow {
    display: grid;
    place-items: center;
    color: var(--gold);
    font-size: 28px;
    font-weight: 800;
}

.diagram-caption {
    margin: 18px 0 0;
    padding: 14px 16px;
    background: var(--teal-soft);
    border-radius: var(--radius);
    font-size: 14px;
}

.process-list ol {
    display: grid;
    gap: 12px;
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.process-list li {
    display: grid;
    grid-template-columns: 0.65fr 1.35fr;
    gap: 18px;
    padding: 16px;
    background: #fffdf7;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.process-list strong {
    color: var(--teal-dark);
}

.flow-note {
    background: var(--teal-soft);
}

.flow-note .primary-btn {
    margin-top: 8px;
}

.explain-page {
    max-width: 960px;
    margin: 0 auto;
    padding: 56px 22px 72px;
}

.explain-hero {
    margin-bottom: 28px;
}

.explain-hero h1 {
    max-width: 880px;
    font-size: clamp(34px, 5vw, 58px);
    line-height: 1.14;
}

.explain-hero p,
.explain-card p,
.explain-list,
.simple-flow span,
.key-points span,
.explain-table span {
    color: #45534f;
    font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
}

.explain-card {
    margin-top: 18px;
    padding: 28px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(15, 76, 70, 0.06);
}

.explain-card h2 {
    margin-bottom: 12px;
    font-size: clamp(25px, 4vw, 36px);
    line-height: 1.24;
}

.before-after,
.explain-table,
.key-points {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.before-after {
    grid-template-columns: 1fr 1fr;
}

.before-after > div,
.explain-table > div,
.key-points > div {
    padding: 18px;
    background: var(--paper);
    border: 1px solid rgba(15, 118, 110, 0.16);
    border-radius: var(--radius);
}

.compare-label {
    margin-bottom: 4px;
    color: var(--teal);
    font-size: 13px;
    font-weight: 800;
}

.before-after strong,
.explain-table strong,
.key-points strong {
    display: block;
    margin-bottom: 8px;
    color: var(--teal-dark);
    font-size: 18px;
}

.simple-flow {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 18px 0;
    padding: 0;
    list-style: none;
}

.simple-flow li {
    padding: 18px;
    background: var(--teal-soft);
    border-radius: var(--radius);
}

.simple-flow strong {
    display: block;
    margin-bottom: 6px;
    color: var(--teal-dark);
}

.explain-list {
    margin: 12px 0 16px;
    padding-left: 1.4em;
}

.explain-list li {
    margin-bottom: 6px;
}

@media (max-width: 880px) {
    .hero,
    .diagnosis-section {
        grid-template-columns: 1fr;
    }

    .invoice-board {
        min-height: 410px;
    }

    .result-panel {
        position: static;
    }

    .decision-flow,
    .term-grid {
        grid-template-columns: 1fr 1fr;
    }

    .diagram-grid {
        grid-template-columns: 1fr;
    }

    .diagram-arrow {
        transform: rotate(90deg);
    }

    .process-list li {
        grid-template-columns: 1fr;
    }

    .before-after,
    .simple-flow {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .hero {
        padding-top: 34px;
        gap: 34px;
    }

    .lead {
        font-size: 16px;
    }

    h1 {
        font-size: 42px;
        line-height: 1.08;
    }

    .hero-actions a {
        width: 100%;
    }

    .invoice-board {
        min-height: 390px;
        padding: 22px;
    }

    .invoice-card {
        width: 100%;
    }

    .invoice-card.ap,
    .invoice-card.buyer {
        margin-left: 0;
    }

    .mini-invoice {
        width: 94px;
        height: 124px;
    }

    .section {
        padding: 52px 18px;
    }

    .diagnosis-grid,
    .decision-flow,
    .term-grid {
        grid-template-columns: 1fr;
    }

    .diagnosis-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .diagnosis-actions .primary-btn {
        width: 100%;
    }

    .why-model {
        grid-template-columns: 1fr;
    }
}
