/* FinlyCalc shared design system — linked by every tool page (no build step).
   Page-specific visualization CSS (.donut, .chart, .legend, .savings) stays
   inline in each tool, since those differ per tool. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0b1220;
  --bg-soft: #111a2e;
  --card: #16213c;
  --card-2: #1c2a48;
  --line: #27375c;
  --text: #eef2fb;
  --dim: #9fb0d0;
  --muted: #6b7da3;
  --brand: #4f8cff;
  --brand-2: #38e0c4;
  --accent: #ffb84d;
  --good: #38e0a0;
  /* tool palette tokens */
  --pi: #4f8cff;
  --tax: #ffb84d;
  --ins: #38e0c4;
  --pmi: #c98cff;
  --hoa: #ff7a8a;
  --contrib: #4f8cff;
  --interest: #38e0c4;
  --radius: 16px;
  --shadow: 0 18px 48px rgba(0,0,0,0.45);
}
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 700px at 80% -10%, #1a2747 0%, var(--bg) 55%) fixed;
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

header.site { position: sticky; top: 0; z-index: 30; backdrop-filter: blur(12px); background: rgba(11,18,32,0.72); border-bottom: 1px solid var(--line); }
.nav { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; letter-spacing: 0.2px; color: var(--text); }
.brand .dot { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 4px 14px rgba(79,140,255,0.5); }
.nav nav a { color: var(--dim); margin-left: 22px; font-size: 0.95rem; font-weight: 600; }
.nav nav a:hover { color: var(--text); text-decoration: none; }

.hero { padding: 46px 0 8px; }
.crumbs { color: var(--muted); font-size: 0.84rem; margin-bottom: 14px; }
.crumbs a { color: var(--muted); }
h1 { font-size: clamp(1.9rem, 4.6vw, 2.9rem); line-height: 1.12; font-weight: 850; letter-spacing: -0.5px; }
h1 .grad { background: linear-gradient(120deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { color: var(--dim); font-size: 1.12rem; max-width: 70ch; margin-top: 16px; }
.updated { display: inline-block; margin-top: 14px; font-size: 0.8rem; font-weight: 700; color: var(--good); background: rgba(56,224,160,0.12); border: 1px solid rgba(56,224,160,0.3); padding: 4px 12px; border-radius: 999px; }

.ad-slot { margin: 26px auto; min-height: 90px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.78rem; letter-spacing: 1px; text-transform: uppercase; background: repeating-linear-gradient(45deg, rgba(255,255,255,0.018) 0 12px, transparent 12px 24px); border: 1px dashed var(--line); border-radius: 12px; }

.app { display: grid; grid-template-columns: 1.05fr 1fr; gap: 22px; margin-top: 18px; }
@media (max-width: 880px) { .app { grid-template-columns: 1fr; } }
.card { background: linear-gradient(180deg, var(--card), var(--bg-soft)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 22px; }
.card h2 { font-size: 1.04rem; font-weight: 750; margin-bottom: 4px; }
.card .sub { color: var(--muted); font-size: 0.85rem; margin-bottom: 16px; }

.field { margin-bottom: 18px; }
.field .row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 7px; }
.field label { font-size: 0.9rem; font-weight: 650; color: var(--dim); }
.field .val { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.02rem; }
.inputbox { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; transition: border-color 0.15s; }
.inputbox:focus-within { border-color: var(--brand); }
.inputbox .pre { color: var(--muted); font-weight: 700; }
.inputbox input { flex: 1; background: transparent; border: none; outline: none; color: var(--text); font-size: 1.02rem; font-weight: 700; font-variant-numeric: tabular-nums; width: 100%; }
.inputbox .post { color: var(--muted); font-weight: 700; }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px; margin-top: 12px; background: var(--line); outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--brand); border: 3px solid #0b1220; box-shadow: 0 2px 10px rgba(79,140,255,0.7); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 20px; height: 20px; border: 3px solid #0b1220; border-radius: 50%; background: var(--brand); cursor: pointer; }

.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 4px; gap: 4px; }
.seg button { background: transparent; border: none; color: var(--dim); font-weight: 700; font-size: 0.9rem; padding: 7px 14px; border-radius: 7px; cursor: pointer; transition: all 0.15s; }
.seg button.on { background: var(--brand); color: #051226; }

.result-top { text-align: center; padding: 8px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.result-top .k { color: var(--dim); font-size: 0.9rem; font-weight: 650; }
.result-top .big { font-size: clamp(2.4rem, 7vw, 3.4rem); font-weight: 870; letter-spacing: -1px; font-variant-numeric: tabular-nums; line-height: 1.05; margin: 4px 0; }
.result-top .big small { font-size: 1rem; color: var(--muted); font-weight: 700; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; }
.stat .k { color: var(--muted); font-size: 0.78rem; font-weight: 650; }
.stat .v { font-size: 1.18rem; font-weight: 820; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .v.good { color: var(--good); }

section.block { margin: 40px 0; }
section.block h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.3px; }
section.block p { color: var(--dim); max-width: 75ch; margin-bottom: 12px; }
.formula { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; background: var(--bg); border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 10px; padding: 14px 16px; color: var(--text); font-size: 0.95rem; overflow-x: auto; margin: 14px 0; }
.example { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-top: 12px; }
.example .t { font-weight: 750; margin-bottom: 8px; }
.example ul { list-style: none; display: grid; gap: 5px; }
.example li { color: var(--dim); display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; border-bottom: 1px dashed var(--line); padding-bottom: 5px; }
.example li b { color: var(--text); }

.sched-wrap { margin-top: 16px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; max-height: 420px; }
table.sched { width: 100%; border-collapse: collapse; font-size: 0.86rem; font-variant-numeric: tabular-nums; }
table.sched thead th { position: sticky; top: 0; background: var(--card-2); color: var(--dim); font-weight: 700; text-align: right; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.sched thead th:first-child { text-align: left; }
table.sched td { padding: 9px 14px; text-align: right; border-bottom: 1px solid rgba(39,55,92,0.5); color: var(--dim); }
table.sched td:first-child { text-align: left; color: var(--text); font-weight: 650; }
table.sched tbody tr:hover { background: rgba(79,140,255,0.07); }

details.faq { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: var(--card); overflow: hidden; }
details.faq summary { cursor: pointer; padding: 15px 18px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; color: var(--brand); font-size: 1.4rem; font-weight: 400; transition: transform 0.2s; }
details.faq[open] summary::after { transform: rotate(45deg); }
details.faq .a { padding: 0 18px 16px; color: var(--dim); }

.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 16px; }
.tool-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; transition: transform 0.15s, border-color 0.15s; }
.tool-card:hover { transform: translateY(-3px); border-color: var(--brand); text-decoration: none; }
.tool-card .ti { font-weight: 750; color: var(--text); }
.tool-card .td { color: var(--muted); font-size: 0.84rem; margin-top: 3px; }
.tool-card.soon { opacity: 0.6; }
.tool-card.soon .ti::after { content: " soon"; color: var(--accent); font-size: 0.7rem; font-weight: 700; vertical-align: super; }

footer.site { border-top: 1px solid var(--line); margin-top: 50px; padding: 30px 0; color: var(--muted); font-size: 0.88rem; }
footer.site .disc { max-width: 80ch; margin-bottom: 14px; }
