/* RealCostCalc styles. Brand colors are in the two theme blocks below. */
:root, [data-theme="light"] {
  --bg: #F5F7FA;
  --card: #FFFFFF;
  --ink: #18212B;
  --muted: #5A6675;
  --line: #E1E6ED;
  --field: #FFFFFF;
  --brand: #16804F;
  --brand-ink: #0F6A40;
  --brand-soft: #E5F4EC;
  --hi: #FFE680;
  --danger: #B42318;
  --shadow: 0 1px 2px rgba(24,33,43,.06), 0 4px 16px rgba(24,33,43,.05);
  --home: #2563EB; --pay: #16804F; --car: #E0620D; --biz: #7C3AED;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0E1319;
  --card: #161D25;
  --ink: #E8EDF3;
  --muted: #9CA8B6;
  --line: #27323F;
  --field: #111820;
  --brand: #3DD68C;
  --brand-ink: #6EE3AA;
  --brand-soft: #173026;
  --hi: #6B5B12;
  --danger: #F39187;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  --home: #6EA0FF; --pay: #3DD68C; --car: #FF9A57; --biz: #B195FF;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 1.0625rem; line-height: 1.6; font-variant-numeric: tabular-nums;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transition: background-color .2s, color .2s;
}
a { color: var(--brand-ink); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--card); padding: .5rem 1rem; z-index: 10; }
[hidden] { display: none !important; }
.wrap { width: min(1140px, 100% - 2.5rem); margin-inline: auto; }

/* Icons */
.i { width: 1.25em; height: 1.25em; flex: none; }
.ico { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; flex: none;
  color: var(--c); background: color-mix(in srgb, var(--c) 13%, var(--card)); }
.ico .i { width: 24px; height: 24px; }
.ico.lg { width: 56px; height: 56px; border-radius: 16px; }
.ico.lg .i { width: 30px; height: 30px; }
.c-home { --c: var(--home); } .c-pay { --c: var(--pay); } .c-car { --c: var(--car); } .c-biz { --c: var(--biz); }

/* Header */
.site-head { background: var(--card); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); position: sticky; top: 0; z-index: 5; }
.head-row { display: flex; align-items: center; gap: 1rem; min-height: 64px; padding-top: .3rem; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.2rem; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand .logo { width: 32px; height: 32px; }
.site-nav { display: flex; gap: .25rem; }
.site-nav a { display: flex; align-items: center; gap: .4rem; padding: .45rem .7rem; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: .95rem; white-space: nowrap; }
.site-nav a .i { color: var(--c); }
.site-nav a:hover, .site-nav a[aria-current] { background: var(--bg); color: var(--ink); }
.theme-btn { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.theme-btn:hover { background: var(--bg); }
.theme-btn .i-sun { display: none; }
[data-theme="dark"] .theme-btn .i-sun { display: block; }
[data-theme="dark"] .theme-btn .i-moon { display: none; }
@media (max-width: 860px) {
  .head-row { flex-wrap: wrap; }
  .site-nav { order: 3; width: 100%; overflow-x: auto; padding-bottom: .6rem; margin-top: -.3rem; scrollbar-width: none; }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { background: var(--bg); }
}

/* Type */
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: clamp(1.75rem, 4vw, 2.4rem); font-weight: 700; margin: 0; }
h2 { font-size: 1.4rem; font-weight: 700; margin: 2.2rem 0 .6rem; }
h3 { font-size: 1.12rem; font-weight: 600; margin: 1.5rem 0 .3rem; }
.lede { color: var(--muted); font-size: 1.1rem; margin: .5rem 0 0; max-width: 62ch; }

.crumbs { font-size: .9rem; color: var(--muted); padding: 1.2rem 0 .8rem; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0; }
.crumbs a { color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: .4rem; }

.page-title { display: flex; gap: 1rem; align-items: center; }
.page-intro { margin-bottom: 1.5rem; }

/* Calculator */
.calc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 860px) { .calc { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: clamp(1.2rem, 3vw, 1.75rem); }
.card-title { font-size: 1.05rem; font-weight: 700; margin: 0 0 1.1rem; display: flex; align-items: center; gap: .5rem; }
.card-title .i { color: var(--muted); }
form.card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.1rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 480px) { .two { grid-template-columns: 1fr; } }
.field, .two > * { min-width: 0; }
.field { display: grid; gap: .4rem; }
.field > label, .field > .label { font-weight: 600; font-size: .95rem; }
.hint { font-size: .86rem; color: var(--muted); margin: 0; }
.input { display: flex; align-items: center; background: var(--field); border: 1.5px solid var(--line); border-radius: 10px; min-height: 50px; transition: border-color .15s, box-shadow .15s; }
.input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.input span { padding: 0 .85rem; color: var(--muted); font-weight: 600; }
.input input, .input select { flex: 1; min-width: 0; width: 100%; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 1.08rem; padding: .7rem .85rem; outline: none; }
.input span + input { padding-left: 0; }
.input input + span { padding-left: 0; }
.input select { cursor: pointer; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2.2rem; }
.input select option { background: var(--card); color: var(--ink); }
.input input:disabled { color: var(--muted); }
.check { display: flex; align-items: center; gap: .6rem; font-weight: 500; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }

.seg { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; }
.seg label { flex: 1; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: .6rem .5rem; border-radius: 9px; font-weight: 600; font-size: .95rem; color: var(--muted); }
.seg input:checked + span { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.seg input:focus-visible + span { outline: 3px solid var(--brand); }

details.more { border-top: 1px solid var(--line); padding-top: .9rem; }
details.more > summary { cursor: pointer; font-weight: 600; color: var(--brand-ink); list-style: none; display: flex; align-items: center; gap: .4rem; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "+"; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--brand-soft); font-weight: 700; }
details.more[open] > summary::before { content: "−"; }
details.more .more-body { display: grid; gap: 1.1rem; margin-top: 1rem; }

/* Result */
.result { position: relative; overflow: hidden; }
.result::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--c, var(--brand)); }
@media (min-width: 861px) { .result { position: sticky; top: 84px; } }
.result-label { color: var(--muted); font-weight: 600; margin: 0; }
.big { display: inline-block; font-size: clamp(2.4rem, 6vw, 3.2rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin: .15rem 0 .2rem;
  background: linear-gradient(transparent 62%, var(--hi) 62%, var(--hi) 92%, transparent 92%); padding: 0 .08em; }
.big-sub { color: var(--muted); margin: 0 0 1rem; }
.bar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--line); margin: .3rem 0 .6rem; gap: 2px; }
.bar i { display: block; height: 100%; transition: width .3s; }
.rows { margin: 0; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.rows + .rows { margin-top: .9rem; padding-top: .3rem; border-top: 1px dashed var(--line); }
.row dt { color: var(--muted); display: flex; align-items: center; gap: .55rem; }
.row dd { margin: 0; font-weight: 600; text-align: right; }
.row dd small { display: block; white-space: nowrap; font-weight: 400; color: var(--muted); font-size: .82rem; }
.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.row.total { border-top: 2px solid var(--ink); border-bottom: 0; margin-top: .2rem; }
.row.total dt, .row.total dd { color: var(--ink); font-weight: 700; }
.note { display: flex; gap: .6rem; background: var(--brand-soft); border-radius: 12px; padding: .8rem 1rem; font-size: .95rem; margin: 1rem 0 0; }
.note .i { color: var(--brand-ink); margin-top: .15rem; }
.warn { background: color-mix(in srgb, var(--danger) 12%, var(--card)); border-left: 4px solid var(--danger); border-radius: 10px; padding: .8rem 1rem; font-size: .95rem; margin: 1rem 0 0; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.2rem; }
.btn { display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; padding: .55rem 1rem; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
[data-theme="dark"] .btn.primary { color: #07140D; }
.btn.primary:hover { filter: brightness(1.05); background: var(--brand); }

details.schedule { margin-top: 1rem; }
details.schedule summary { cursor: pointer; font-weight: 600; color: var(--brand-ink); }
table.ledger { width: 100%; border-collapse: collapse; font-size: .93rem; margin-top: .6rem; }
table.ledger th, table.ledger td { padding: .5rem .4rem; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.ledger th:first-child, table.ledger td:first-child { text-align: left; }
table.ledger thead th { color: var(--muted); font-weight: 600; }
.scroll { overflow-x: auto; }

/* Article */
.learn { max-width: 760px; margin-top: 2.5rem; }
.learn p, .learn li { color: var(--ink); }
.learn ul { padding-left: 1.2rem; }
.learn li { margin: .35rem 0; }
.formula { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 10px; padding: .85rem 1rem; font-weight: 600; overflow-x: auto; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem; margin: .6rem 0; }
.faq summary { font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--brand-ink); font-weight: 700; font-size: 1.25rem; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: .6rem 0 0; color: var(--muted); }
.updated { font-size: .88rem; color: var(--muted); margin-top: 2rem; }

/* Tool cards (home + related) */
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: .9rem; padding: 0; margin: 0; list-style: none; }
.tool { display: flex; gap: .9rem; align-items: center; height: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1rem; text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s; }
.tool:hover { border-color: var(--c); transform: translateY(-2px); }
.tool strong { display: block; font-weight: 600; font-size: 1.03rem; line-height: 1.3; }
.tool small { display: block; color: var(--muted); font-size: .9rem; line-height: 1.4; margin-top: .15rem; }

/* Home */
.hero { padding: clamp(2.5rem, 7vw, 4.5rem) 0 2rem; text-align: center; }
.hero h1 { font-size: clamp(2.1rem, 5.5vw, 3.3rem); max-width: 20ch; margin-inline: auto; line-height: 1.15; }
.hero .lede { margin: 1rem auto 0; font-size: 1.15rem; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin-top: 1.8rem; padding: 0; list-style: none; }
.chips a { display: flex; align-items: center; gap: .5rem; padding: .6rem 1rem; border-radius: 99px; background: var(--card); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; }
.chips a .i { color: var(--c); }
.chips a:hover { border-color: var(--c); }
.cat { margin: 2.5rem 0; }
.cat-head { display: flex; align-items: center; gap: .9rem; margin-bottom: 1rem; }
.cat-head h2 { margin: 0; }
.cat-head p { margin: .1rem 0 0; color: var(--muted); }
.why { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin: 3rem 0 1rem; padding: 0; list-style: none; }
.why li { display: flex; gap: .8rem; align-items: flex-start; }
.why strong { display: block; }
.why span { color: var(--muted); font-size: .95rem; }
.why .ico { --c: var(--brand); }

/* Plain pages */
.prose { max-width: 720px; padding-bottom: 2rem; }

/* Footer */
.site-foot { background: var(--card); border-top: 1px solid var(--line); margin-top: 3rem; padding: 2.2rem 0 2.5rem; font-size: .93rem; color: var(--muted); }
.foot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.5rem; }
.site-foot h2 { font-size: .98rem; margin: 0 0 .6rem; color: var(--ink); display: flex; align-items: center; gap: .4rem; }
.site-foot h2 .i { color: var(--c); }
.site-foot ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--ink); text-decoration: underline; }
.disclaimer { margin-top: 1.8rem; font-size: .85rem; max-width: 80ch; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
@media print { .site-head, .site-foot, .actions, .learn, .crumbs, .theme-btn { display: none !important; } body { background: #fff; } }
