:root {
  --ink: #14211d;
  --ink-soft: #4a5a54;
  --line: #dfe6e3;
  --bg: #f6f8f7;
  --card: #ffffff;
  --brand: #0f5e4b;
  --brand-2: #e9a23b;
  --brand-tint: #e5f1ed;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 33, 29, .06), 0 6px 20px rgba(20, 33, 29, .06);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--brand); }
img { max-width: 100%; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Header */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.header-row { display: flex; align-items: center; gap: 18px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 750; font-size: 1.15rem; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.tools-nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.tools-nav::-webkit-scrollbar { display: none; }
.tools-nav a { padding: 6px 10px; border-radius: 8px; color: var(--ink-soft); text-decoration: none; font-size: .92rem; white-space: nowrap; }
.tools-nav a:hover { background: var(--bg); color: var(--ink); }
.tools-nav a[aria-current="page"] { background: var(--brand-tint); color: var(--brand); font-weight: 600; }
.currency-pick select { font: inherit; font-size: .9rem; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }

@media (max-width: 720px) {
  .header-row { flex-wrap: wrap; gap: 8px; padding: 10px 20px; }
  .tools-nav { order: 3; flex-basis: 100%; }
  .currency-pick { margin-left: auto; }
}

/* Main */
main { padding: 28px 20px 48px; }
h1 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); line-height: 1.15; letter-spacing: -.02em; margin: 8px 0 8px; }
.lede { font-size: 1.1rem; color: var(--ink-soft); max-width: 680px; margin: 0 0 24px; }
h2 { font-size: 1.4rem; letter-spacing: -.01em; margin: 40px 0 10px; }
h3 { font-size: 1.1rem; margin: 24px 0 6px; }
.prose { max-width: 720px; }
.prose p, .prose li { color: #26332f; }

/* Calculator */
.calc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px; align-items: start; }
@media (max-width: 820px) { .calc { grid-template-columns: 1fr; } }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.field .hint { font-weight: 400; color: var(--ink-soft); font-size: .82rem; }
.input-wrap { display: flex; align-items: stretch; border: 1px solid #cdd8d4; border-radius: 10px; background: #fff; overflow: hidden; }
.input-wrap:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.input-wrap input, .input-wrap select { flex: 1; min-width: 0; border: 0; font: inherit; font-size: 1.02rem; padding: 10px 12px; background: transparent; outline: none; }
.input-wrap .unit { display: flex; align-items: center; padding: 0 12px; background: var(--bg); color: var(--ink-soft); font-size: .9rem; border-left: 1px solid var(--line); white-space: nowrap; }
.input-wrap .unit.pre { border-left: 0; border-right: 1px solid var(--line); }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.field, .panel { min-width: 0; }
.input-wrap input { width: 100%; }

.result-main { background: var(--brand); color: #fff; border-radius: 12px; padding: 18px 20px; margin-bottom: 14px; }
.result-main .label { font-size: .88rem; opacity: .85; }
.result-main .value { font-size: clamp(1.8rem, 4vw, 2.4rem); font-weight: 750; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--bg); border-radius: 10px; padding: 12px 14px; }
.stat .label { font-size: .8rem; color: var(--ink-soft); }
.stat .value { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.note { font-size: .85rem; color: var(--ink-soft); margin: 8px 0 0; }
.warn { background: #fff6e6; border: 1px solid #f3d9a6; color: #6b4a0f; padding: 10px 12px; border-radius: 10px; font-size: .9rem; }

.chart-box { position: relative; width: 100%; }
.chart-box canvas { width: 100%; height: 220px; display: block; }
.legend { display: flex; gap: 16px; font-size: .82rem; color: var(--ink-soft); margin-top: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.breakdown { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--bg); margin: 6px 0 8px; }
.breakdown span { display: block; height: 100%; }

table.schedule { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
table.schedule th, table.schedule td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--line); }
table.schedule th:first-child, table.schedule td:first-child { text-align: left; }
table.schedule th { font-size: .8rem; color: var(--ink-soft); font-weight: 600; background: var(--bg); position: sticky; top: 0; }
.table-scroll { max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
details.toggle > summary { cursor: pointer; font-weight: 600; color: var(--brand); margin: 12px 0 8px; }

.btn-row { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.btn { font: inherit; font-size: .88rem; padding: 8px 12px; border-radius: 9px; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--ink); }
.btn:hover { border-color: var(--brand); color: var(--brand); }

/* FAQ */
details.faq { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px; margin-bottom: 10px; max-width: 720px; }
details.faq summary { cursor: pointer; font-weight: 600; padding: 10px 0; }
details.faq div { padding-bottom: 12px; color: #26332f; }

.formula { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--brand); padding: 12px 16px; border-radius: 8px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92rem; overflow-x: auto; max-width: 720px; }

/* Home cards */
.hero { padding: 16px 0 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 16px; }
.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
.card:hover { transform: translateY(-2px); border-color: var(--brand); }
.card h3 { margin: 0 0 6px; }
.card p { margin: 0 0 12px; color: var(--ink-soft); font-size: .95rem; }
.card-cta { color: var(--brand); font-weight: 600; font-size: .9rem; }
.related { margin-top: 32px; }
.related ul { padding-left: 18px; }

.ad-slot { margin: 24px 0; min-height: 90px; }

/* Footer */
.site-footer { background: #0e1f1a; color: #c8d6d1; padding: 36px 0 20px; font-size: .92rem; }
.site-footer a { color: #e6efec; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer .brand { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 24px; }
.footer-grid h4 { color: #fff; margin: 0 0 8px; font-size: .95rem; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 6px; }
.fine { border-top: 1px solid #22372f; margin-top: 24px; padding-top: 14px; font-size: .8rem; color: #8aa098; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; } }

@media print {
  .site-header, .site-footer, .ad-slot, .btn-row { display: none; }
}
