:root {
  --accent: #059669;
  --accent-dark: #047857;
  --accent-soft: rgba(5, 150, 105, 0.12);
  --c-int: #059669;
  --c-contrib: #f59e0b;
  --c-principal: #06b6d4;
  --c-ded: #64748b;
  --c-net: #16a34a;
  --bg-grad-1: #0f172a;
  --bg-grad-2: #1e293b;
  --card-bg: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --input-bg: #f8fafc;
  --shadow: 0 20px 60px -15px rgba(2, 6, 23, 0.55);
  --radius: 16px;
  --radius-sm: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 18px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 800px at 15% -10%, #334155 0%, transparent 55%),
              radial-gradient(1000px 700px at 110% 10%, #047857 0%, transparent 45%),
              linear-gradient(160deg, var(--bg-grad-1), var(--bg-grad-2));
  background-attachment: fixed; -webkit-font-smoothing: antialiased;
}
.layout { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 22px; }

.card { width: 100%; max-width: 760px; background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 26px 24px; border: 1px solid rgba(255,255,255,0.6); }
.card__header { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.card__heading { flex: 1; min-width: 0; }
.logo { width: 48px; height: 48px; flex: 0 0 auto; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-dark)); border-radius: 14px; box-shadow: 0 8px 20px -6px var(--accent-dark); }
.logo svg { width: 25px; height: 25px; }
.card__header h1 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.subtitle { color: var(--text-muted); font-size: 0.88rem; margin-top: 3px; }

.card__body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.inputs, .results { min-width: 0; }

/* Inputs */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 7px; }
.field .opt { font-weight: 500; color: #94a3b8; font-size: 0.78rem; }
.input-wrap { display: flex; align-items: center; background: var(--input-bg); border: 2px solid var(--border); border-radius: var(--radius-sm); transition: border-color .15s, box-shadow .15s; }
.input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: #fff; }
.affix { color: var(--text-muted); font-weight: 600; font-size: 1.05rem; padding-left: 14px; }
.affix--suffix { padding-left: 0; padding-right: 14px; }
.input-wrap input { flex: 1; width: 100%; min-width: 0; border: none; outline: none; background: transparent; padding: 12px 14px; font-size: 1.05rem; font-weight: 600; color: var(--text); font-family: inherit; }

.quick { display: flex; gap: 6px; margin-top: 8px; }
.pct-mini { display: inline-flex; align-items: center; justify-content: flex-end; border: 1px solid var(--border); background: var(--input-bg); border-radius: 999px; padding: 6px 9px; cursor: text; }
.pct-mini:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: #fff; }
.pct-mini input { width: 38px; border: none; outline: none; background: transparent; font-size: 0.8rem; font-weight: 700; color: var(--text); font-family: inherit; padding: 0; text-align: right; }
.pct-mini input::placeholder { color: #cbd5e1; font-weight: 700; }
.pct-mini span { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); margin-left: 1px; }
.quick-btn { border: 1px solid var(--border); background: var(--input-bg); color: var(--text-muted); padding: 6px 12px; font-size: 0.8rem; font-weight: 700; border-radius: 999px; cursor: pointer; font-family: inherit; }
.quick-btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.quick-btn:active { transform: scale(0.96); }

.term-row { display: flex; gap: 10px; align-items: center; }
.term-row input { flex: 1; min-width: 0; border: 2px solid var(--border); border-radius: var(--radius-sm); background: var(--input-bg); padding: 12px 14px; font-size: 1.05rem; font-weight: 600; color: var(--text); font-family: inherit; outline: none; }
.term-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: #fff; }
.term-row .quick { margin-top: 0; }

.section-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin: 18px 0 12px; }
.section-label span { font-weight: 500; text-transform: none; letter-spacing: 0; color: #94a3b8; }
.grid2 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; margin-bottom: 16px; }
.grid2 .field { margin-bottom: 0; }
.pmi-note { font-size: 0.78rem; color: var(--text-muted); margin-top: 10px; line-height: 1.5; }

/* Results */
.results { background: linear-gradient(160deg, #0f172a, #1e293b); border-radius: var(--radius); color: #fff; padding: 22px 20px; }
.result-head { display: flex; flex-direction: column; gap: 2px; padding-bottom: 16px; border-bottom: 1px solid rgba(148,163,184,.22); margin-bottom: 18px; }
.result-label { font-size: 0.85rem; color: #cbd5e1; font-weight: 600; }
.result-value { font-size: 2.3rem; font-weight: 800; letter-spacing: -0.02em; color: #fff; font-variant-numeric: tabular-nums; }

.breakdown { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.donut { width: 104px; height: 104px; flex: 0 0 auto; border-radius: 50%; background: conic-gradient(rgba(148,163,184,.25) 0 100%); -webkit-mask: radial-gradient(farthest-side, transparent 58%, #000 60%); mask: radial-gradient(farthest-side, transparent 58%, #000 60%); transition: background .35s ease; }
.legend { list-style: none; display: flex; flex-direction: column; gap: 7px; font-size: 0.85rem; flex: 1; min-width: 0; }
.legend li { display: flex; align-items: center; gap: 8px; color: #cbd5e1; }
.legend li b { color: #fff; margin-left: auto; font-variant-numeric: tabular-nums; }
.dot { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 auto; }

.rrow { display: flex; justify-content: space-between; align-items: baseline; padding: 7px 0; font-size: 0.92rem; color: #cbd5e1; }
.rrow b { color: #fff; font-weight: 700; font-size: 1rem; font-variant-numeric: tabular-nums; }

/* Schedule */
.schedule-toggle { margin-top: 18px; text-align: center; }
#schedBtn { background: var(--input-bg); border: 1px solid var(--border); color: var(--accent-dark); font-weight: 700; font-size: 0.9rem; padding: 11px 20px; border-radius: 999px; cursor: pointer; font-family: inherit; }
#schedBtn:hover { border-color: var(--accent); }
.schedule { margin-top: 14px; }
.table-scroll { max-height: 340px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.schedule table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.schedule th { position: sticky; top: 0; background: var(--input-bg); color: var(--text); font-weight: 700; text-align: right; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.schedule th:first-child, .schedule td:first-child { text-align: left; }
.schedule td { text-align: right; padding: 9px 12px; border-bottom: 1px solid #f1f5f9; color: #334155; font-variant-numeric: tabular-nums; }
.schedule tr.year-row td { background: var(--accent-soft); font-weight: 700; color: var(--accent-dark); }
.sched-note { font-size: 0.78rem; color: var(--text-muted); margin-top: 10px; text-align: center; }

/* Ad + footer */
.adslot { width: 100%; max-width: 760px; min-height: 100px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.04); border: 1px dashed rgba(148,163,184,.35); border-radius: var(--radius-sm); color: rgba(148,163,184,.7); font-size: 0.8rem; }
.site-footer { width: 100%; max-width: 760px; display: flex; justify-content: flex-end; align-items: center; gap: 18px; padding: 4px 6px 0; color: rgba(148,163,184,.75); font-size: 0.8rem; }
.site-footer .copy { margin-right: auto; }
.site-footer a { color: rgba(203,213,225,.85); text-decoration: none; font-weight: 500; }
.site-footer a:hover { color: #fff; text-decoration: underline; }

/* Document pages */
.doc { width: 100%; max-width: 720px; background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 34px 34px 30px; border: 1px solid rgba(255,255,255,.6); }
.doc__brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); margin-bottom: 22px; }
.doc__brand .logo { width: 40px; height: 40px; }
.doc__brand .logo svg { width: 21px; height: 21px; }
.doc__brand span { font-size: 1.15rem; font-weight: 700; }
.doc h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 6px; }
.doc .updated { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 20px; }
.doc .lead { font-size: 1.06rem; color: #475569; line-height: 1.7; }
.doc h2 { font-size: 1.1rem; font-weight: 700; margin: 24px 0 8px; }
.doc h3 { font-size: 1rem; font-weight: 600; margin: 18px 0 4px; }
.doc p, .doc li { color: #334155; font-size: 0.96rem; line-height: 1.7; }
.doc p { margin-bottom: 12px; }
.doc ul { margin: 0 0 12px 20px; }
.doc li { margin-bottom: 6px; }
.doc a { color: var(--accent-dark); font-weight: 600; text-decoration: none; }
.doc a:hover { text-decoration: underline; }
.doc .callout { background: var(--accent-soft); border: 1px solid rgba(8,145,178,.25); border-left: 4px solid var(--accent); border-radius: 12px; padding: 16px 18px; margin: 20px 0; }
.doc .callout p { margin: 0; color: var(--accent-dark); font-weight: 500; }
.doc .faq h3 { font-size: 1.02rem; font-weight: 700; margin: 20px 0 4px; color: var(--text); }
.doc .table-wrap { overflow-x: auto; margin: 14px 0 20px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 360px; }
.doc th, .doc td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc th { color: var(--text); font-weight: 700; background: var(--input-bg); }
.doc td { color: #334155; }
.doc td:first-child { font-weight: 600; color: var(--text); white-space: nowrap; }
.doc .back { display: inline-block; margin-top: 24px; padding: 11px 20px; background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #fff; border-radius: var(--radius-sm); font-weight: 700; font-size: 0.9rem; }
.doc .back:hover { filter: brightness(1.08); text-decoration: none; }

@media (min-width: 760px) {
  .card__body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
  .card__header h1 { font-size: 1.55rem; }
}
@media (max-width: 440px) {
  .card { padding: 24px 20px 22px; }
  .doc { padding: 24px 20px 22px; }
  .result-value { font-size: 2rem; }
  .grid2 { grid-template-columns: 1fr; }
  .site-footer { justify-content: center; flex-wrap: wrap; gap: 12px; }
  .site-footer .copy { margin-right: 0; width: 100%; text-align: center; }
}

/* ---- Select / segment additions ---- */
select.input-el {
  width: 100%; border: 2px solid var(--border); border-radius: var(--radius-sm); background: var(--input-bg);
  padding: 12px 34px 12px 14px; font-size: 0.92rem; font-weight: 600; color: var(--text); font-family: inherit; outline: none;
  cursor: pointer; appearance: none; -webkit-appearance: none; min-width: 0; text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
select.input-el:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background-color: #fff; }
.seg { display: flex; background: var(--input-bg); border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 3px; gap: 3px; }
.seg button {
  flex: 1; padding: 10px 0; border: none; border-radius: 9px; background: transparent; cursor: pointer;
  font-size: 0.88rem; font-weight: 700; color: var(--text-muted); font-family: inherit;
  transition: background 0.12s ease, color 0.12s ease;
}
.seg button.active { background: #fff; color: var(--accent-dark); box-shadow: 0 1px 4px rgba(2,6,23,.12); }
.freq-note { font-size: 0.78rem; color: var(--text-muted); margin-top: 7px; }
.rrow.net b { color: #4ade80; }
.tax-note { font-size: 0.74rem; color: #94a3b8; margin-top: 14px; line-height: 1.5; }

/* ---- Growth chart (pure divs, no lib) ---- */
.chart { display: flex; align-items: flex-end; gap: 2px; height: 120px; margin: 16px 0 4px; }
.chart .bar { flex: 1; min-width: 0; background: linear-gradient(180deg, #34d399, #059669); border-radius: 3px 3px 0 0; position: relative; }
.chart .bar .contrib { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(245, 158, 11, .55); border-radius: 0; }
.chart-labels { display: flex; justify-content: space-between; font-size: 0.7rem; color: #94a3b8; margin-bottom: 12px; }
.chart-hint { font-size: 0.72rem; color: #94a3b8; text-align: center; margin-bottom: 10px; }
