:root {
    color-scheme: light;
    --navy: #0c1c2f;
    --ink: #152b42;
    --muted: #516376;
    --gold: #e8c789;
    --line: #dfe5eb;
    --green: #176344;
    --red: #a23331;
    --radius: 20px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    margin: 0;
    background: #edf1f4;
    color: var(--ink);
    font: 1rem/1.65 "Noto Sans Thai", Tahoma, sans-serif;
}
.hero {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    color: #fff;
    background: radial-gradient(ellipse at 86% 94%, #1d405d 0, transparent 52%),
        linear-gradient(120deg, #081422, #122b44);
    border-bottom: 1px solid #a68148;
}
.hero::after {
    content: "";
    position: absolute;
    z-index: -1;
    width: min(64vw, 680px);
    aspect-ratio: 1;
    right: -10%;
    top: -58%;
    border: 1px solid #e8c78955;
    border-radius: 50%;
    box-shadow: 0 0 0 45px #d6b57914, 0 0 0 100px #d6b5790c, 0 0 0 156px #d6b57908;
    pointer-events: none;
}
.hero-content { max-width: 1180px; margin: auto; padding: 30px 28px 46px; }
.brand-logo {
    display: block;
    width: clamp(215px, 26vw, 310px);
    height: auto;
    border-radius: 13px;
    border: 1px solid #e8c78938;
    box-shadow: 0 10px 25px #040b1470;
}
h1 {
    margin: 20px 0 5px;
    color: #f4ddb1;
    font: 500 clamp(2.6rem, 6vw, 5.3rem)/1.02 Georgia, serif;
    letter-spacing: -.045em;
}
.hero-break { display: none; }
.hero p { color: #dce5ec; margin-top: 14px; }
main { max-width: 1180px; margin: auto; padding: 24px 28px 64px; }
.navigation {
    display: inline-flex;
    gap: 5px;
    padding: 5px;
    margin-bottom: 19px;
    background: #dae2e9;
    border-radius: 14px;
}
button { cursor: pointer; }
.navigation button {
    border: 1px solid transparent;
    padding: 8px 20px;
    background: transparent;
    color: #304b63;
    min-height: 46px;
}
.navigation button[aria-pressed="true"] {
    background: var(--navy);
    color: #f6dab0;
    border-color: #284360;
    box-shadow: 0 3px 9px #0c1c2f22;
}
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.13fr); gap: 18px; }
.panel {
    min-width: 0;
    background: #fff;
    border: 1px solid #dbe3ea;
    border-radius: var(--radius);
    padding: clamp(17px, 2.5vw, 31px);
    box-shadow: 0 8px 26px #102b4510;
}
h2 { margin: 0 0 .8rem; font-size: clamp(1.2rem, 2.2vw, 1.6rem); line-height: 1.35; }
p { margin: .45rem 0; }
.plan-description { color: var(--muted); font-size: .9rem; margin: -.25rem 0 1.1rem; }
form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
label { display: flex; flex-direction: column; gap: 5px; font-weight: 700; font-size: .94rem; }
input, select, button { width: 100%; min-height: 48px; border-radius: 10px; font: inherit; }
input, select { min-width: 0; padding: .55rem .7rem; background-color: #f6f8fa; border: 1px solid #a9b8c5; color: var(--ink); }
input:focus, select:focus { background-color: #fff; }
select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #40566e 50%), linear-gradient(135deg, #40566e 50%, transparent 50%);
    background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%;
    background-size: 5px 5px;
    background-repeat: no-repeat;
    padding-right: 28px;
}
form button {
    grid-column: 1 / -1;
    background: linear-gradient(110deg, #e7c78b, #d8ad64);
    color: #17283b;
    border: 1px solid #c89d51;
    font-weight: 800;
}
form button:hover { background: #f3d9a8; }
:focus-visible { outline: 3px solid #647eaa; outline-offset: 3px; }
.note { color: var(--muted); font-size: .875rem; font-weight: 400; }
.error { color: var(--red); font-weight: 700; }
.error:empty { display: none; }
.summary { border-top: 4px solid #caa15c; }
.summary table { margin-top: .5rem; }
.summary thead { background: var(--navy); color: #fff; }
.summary thead th:first-child { border-radius: 9px 0 0 9px; }
.summary thead th:last-child { border-radius: 0 9px 9px 0; }
.summary th, .summary td { text-align: center; }
.summary td, .summary tbody th {
    white-space: nowrap;
    padding-block: 1rem;
    font-size: clamp(.89rem, 2vw, 1.28rem);
    font-weight: 800;
}
.summary .note { margin-top: 12px; }
.first-payment { margin-bottom: .8rem; padding: .65rem .8rem; background: #edf7ef; border-inline-start: 4px solid #378259; border-radius: 8px; color: #185839; font-weight: 700; }
.table { margin-top: 18px; }
.table-scroll { overflow-x: auto; }
.table-scroll table { min-width: 780px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: .64rem .55rem; border-bottom: 1px solid var(--line); text-align: right; }
th:first-child, td:first-child { text-align: left; }
thead { background: #e9eff5; }
.table tbody tr:nth-child(even) { background: #f6f8fa; }
.table tr.current { background: #faedcf; font-weight: 700; }
summary { cursor: pointer; font-weight: 750; }
summary::marker { color: #8a622e; }
a { color: #24527a; text-underline-offset: 3px; }
.negative { color: var(--red); }
.positive, .milestone { color: var(--green); }
.milestone { display: block; font-size: .85rem; font-weight: 700; }
.result { margin-top: 15px; background: #132942; color: #fff; border-color: #263d56; box-shadow: none; }
#amount, #med-amount { color: #f4d7a0; font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 750; line-height: 1.2; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 15px; border-top: 1px solid #557086; padding-top: 13px; }
.stats strong { display: block; font-size: 1.2rem; }
.stats span, .subtle { color: #dce5ef; }
@media (max-width: 820px) {
    .hero-content { padding: 25px 20px 34px; }
    main { padding: 18px 20px 45px; }
    .layout { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 465px) {
    .hero-content, main { padding-inline: 13px; }
    .hero-break { display: initial; }
    .navigation { display: flex; }
    .navigation button { padding-inline: 6px; font-size: .88rem; }
    .summary th, .summary td { padding-inline: .2rem; }
    .summary thead th { font-size: .85rem; }
    .summary tbody td { font-size: .9rem; }
    th, td { font-size: .9rem; }
}
@media (max-width: 350px) {
    form { grid-template-columns: 1fr; }
}

/* สรุป ไม่วางแผน vs วางแผน */
.plan-summary { margin-top: 18px; border-top: 4px solid #caa15c; }
.plan-head { margin: 0; color: var(--green); font-size: clamp(1.25rem, 3vw, 1.9rem); font-weight: 800; line-height: 1.3; }
.compare { margin: 18px 0 6px; display: grid; gap: 12px; }
.compare-row { display: grid; grid-template-columns: minmax(0, 9.5em) minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.compare-label { font-weight: 800; line-height: 1.25; }
.compare-label small { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; }
.bar-track { height: 26px; background: #eef2f5; border-radius: 8px; overflow: hidden; }
.bar { height: 100%; border-radius: 8px; transition: width .5s ease; }
.bar-without { width: 100%; background: #b9c3cd; }
.bar-with { background: linear-gradient(90deg, #d8ad64, #e7c78b); }
.compare-row strong { white-space: nowrap; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.helped { margin: 0; color: var(--green); font-weight: 700; }
.plan-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.plan-facts div { background: #f6f8fa; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.plan-facts span { display: block; color: var(--muted); font-size: .85rem; }
.plan-facts strong { display: block; font-size: 1.2rem; white-space: nowrap; }
.plan-facts small { display: block; color: var(--muted); font-size: .82rem; line-height: 1.4; }
.story { margin-top: 16px; padding: 12px 14px; background: #faf3e3; border-radius: 10px; }
@media (prefers-reduced-motion: reduce) { .bar { transition: none; } }
@media (max-width: 640px) {
    .compare-row { grid-template-columns: minmax(0, 1fr) auto; }
    .compare-row .bar-track { grid-column: 1 / -1; grid-row: 2; }
    .plan-facts { grid-template-columns: 1fr; }
}

/* การ์ดรายปี 12PL vs IHT Gold */
.year-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 12px 0 4px; font-size: .9rem; font-weight: 700; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.dot-back, .ybar-back { background: #2f8a5d; }
.dot-health, .ybar-health { background: #c9a25e; }
.year-nav { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 10px; align-items: center; margin: 6px 0 10px; }
.year-nav p { margin: 0; text-align: center; }
.year-nav button { width: 44px; min-height: 44px; border-radius: 50%; border: 1px solid #a9b8c5; background: #fff; color: var(--ink); font-size: 1.5rem; line-height: 1; }
.year-nav button:hover { background: #f3f6f8; }
.year-strip { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 4px; padding: 4px 4px 14px; overscroll-behavior-x: contain; }
.ycard { flex: 0 0 clamp(210px, 26%, 250px); scroll-snap-align: start; text-align: left; display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: #fff; color: var(--ink); min-height: 0; font: inherit; box-shadow: 0 4px 14px #102b450d; }
.ycard:hover { border-color: #c9a25e; }
.ycard.current { border: 2px solid #c9a25e; background: #fffaf0; }
.ycard-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ycard-age { font-size: 1.45rem; font-weight: 800; line-height: 1.1; }
.ycard-term { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.ytag { align-self: flex-start; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: #e9eff5; color: #304b63; }
.ytag.gold { background: #faedcf; color: #7a5520; }
.yline { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; font-size: .85rem; }
.yline b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ybar { grid-column: 1 / -1; height: 9px; border-radius: 5px; background: #eef2f5; overflow: hidden; }
.ybar i { display: block; height: 100%; border-radius: 5px; }
.yresult { margin-top: auto; padding-top: 8px; border-top: 1px dashed var(--line); }
.yresult span { display: block; font-size: .78rem; color: var(--muted); }
.yresult strong { font-size: 1.15rem; white-space: nowrap; }
.ycover { font-size: .8rem; font-weight: 700; color: var(--green); }
.full-table { margin-top: 10px; }
.full-table .table-scroll { margin-top: 10px; }
@media (max-width: 600px) { .ycard { flex-basis: 78%; } }
