:root {
  --ink: #e7f3fb;
  --muted: #93a9bd;
  --line: rgba(126, 214, 255, 0.18);
  --paper: #060912;
  --card: rgba(12, 20, 36, 0.78);
  --cyan: #7ed6ff;
  --mint: #5ef2c5;
  --gold: #f6c56b;
  --red: #ff8f7a;
  --soft: rgba(126, 214, 255, 0.08);
  --ok: rgba(94, 242, 197, 0.12);
  --warn: rgba(246, 197, 107, 0.12);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  --sans: "Manrope", "Segoe UI", sans-serif;
  --display: "Space Grotesk", "Manrope", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(94, 242, 197, 0.16), transparent 55%),
    radial-gradient(700px 420px at -10% 10%, rgba(126, 214, 255, 0.16), transparent 50%),
    radial-gradient(500px 300px at 50% 100%, rgba(246, 197, 107, 0.08), transparent 60%),
    var(--paper);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
}
body::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(126, 214, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 214, 255, 0.05) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at 50% 20%, #000 0%, transparent 75%);
}

a { color: var(--cyan); }
.wrap { width: min(1140px, calc(100% - 32px)); margin: 0 auto; position: relative; }

.site-header {
  position: relative;
  overflow: hidden;
  padding: 48px 0 64px;
}
.site-header::before {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -80px;
  top: -120px;
  border-radius: 50%;
  border: 1px solid rgba(94, 242, 197, 0.35);
  box-shadow: 0 0 80px rgba(94, 242, 197, 0.15), inset 0 0 60px rgba(126, 214, 255, 0.08);
}
.site-header::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: 20px;
  top: -20px;
  border-radius: 50%;
  border: 1px dashed rgba(246, 197, 107, 0.45);
}
.header-inner { position: relative; z-index: 1; }
.eyebrow {
  margin: 0 0 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--mint);
}
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.03em; }
h1 {
  margin: 0 0 12px;
  max-width: 14ch;
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  line-height: 0.95;
  color: #f4fbff;
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  h1 {
    background: linear-gradient(100deg, #ffffff 20%, #7ed6ff 55%, #5ef2c5 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}
.lede { margin: 0; max-width: 62ch; color: #c5d7e6; }
.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}
.hero-pills li {
  border: 1px solid rgba(126, 214, 255, 0.35);
  background: rgba(8, 16, 30, 0.55);
  color: #e7f6ff;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: inset 0 0 18px rgba(126, 214, 255, 0.08);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 20px;
  margin-top: -28px;
}
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 22px;
  backdrop-filter: blur(16px);
}
.results { align-self: start; position: sticky; top: 14px; }

.required-note { margin: 0 0 4px; font-size: 0.86rem; color: var(--muted); }
.required-note span, .req { color: var(--gold); }
.step {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(6, 12, 24, 0.45);
}
.step h2 { margin: 0 0 10px; font-size: 1.15rem; color: #f4fbff; }
label { display: block; font-weight: 700; margin: 10px 0 6px; color: #d5e7f4; }
.hint { margin: 6px 0 0; color: var(--muted); font-size: 0.92rem; }
.rate-source {
  background: rgba(246, 197, 107, 0.1);
  border: 1px solid rgba(246, 197, 107, 0.25);
  border-radius: 12px;
  padding: 8px 10px;
  color: #f6e2b4;
}

.field, input, select {
  border: 1px solid rgba(126, 214, 255, 0.28);
  border-radius: 14px;
  background: #08111d;
  color: #f4fbff;
}
.field {
  display: flex;
  align-items: center;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field:focus-within { border-color: var(--mint); box-shadow: 0 0 0 4px rgba(94, 242, 197, 0.14); }
.prefix, .suffix { color: var(--cyan); padding: 0 12px; font-weight: 700; white-space: nowrap; }
input, select { width: 100%; padding: 12px; font: inherit; }
.field input { border: 0; border-radius: 0; outline: none; background: transparent; }
input:focus, select:focus { outline: 3px solid rgba(94, 242, 197, 0.2); border-color: var(--mint); }
select option { background: #08111d; color: #f4fbff; }
.split { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.check { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; font-weight: 700; }
.check input { width: auto; margin-top: 4px; accent-color: var(--mint); }

.preset-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip, .btn {
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
  border: 1px solid rgba(126, 214, 255, 0.4);
  background: rgba(126, 214, 255, 0.06);
  color: #e7f6ff;
  padding: 9px 14px;
  font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.chip:hover, .btn.ghost:hover {
  border-color: var(--mint);
  box-shadow: 0 0 22px rgba(94, 242, 197, 0.25);
  transform: translateY(-1px);
}
.actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 14px;
}
.form-error { color: var(--red); font-weight: 700; min-height: 1.2em; }

.instruments { display: grid; gap: 10px; }
.instrument {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(8, 17, 29, 0.65);
}
.instrument strong { display: block; color: #f4fbff; }
.instrument small { color: var(--muted); display: block; }
.instrument input[type="range"] { width: 100%; padding: 0; accent-color: var(--mint); }
.weight-label { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--mint); }

.results-hero {
  margin: -4px -4px 16px;
  padding: 22px 18px 16px;
  border-radius: 18px;
  background:
    radial-gradient(240px 120px at 100% 0%, rgba(94, 242, 197, 0.28), transparent 70%),
    linear-gradient(160deg, rgba(8, 18, 34, 0.2), rgba(8, 18, 34, 0.55));
  border: 1px solid rgba(94, 242, 197, 0.28);
  box-shadow: inset 0 0 40px rgba(94, 242, 197, 0.06);
}
.results-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--cyan);
}
.results-value {
  margin: 8px 0 0;
  font-family: var(--display);
  font-size: clamp(2.5rem, 5vw, 3.7rem);
  line-height: 0.95;
  color: #f4fffb;
  text-shadow: 0 0 24px rgba(94, 242, 197, 0.45);
}
.results-exact { margin: 8px 0 0; color: #b7c9d8; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 14px; }
.stats div {
  background: rgba(126, 214, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
}
.stats dt { color: var(--muted); font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; }
.stats dd { margin: 2px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 1.05rem; color: #f4fbff; }
.chart {
  width: 100%;
  overflow: hidden;
  background: rgba(4, 10, 18, 0.7);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px 4px 0;
}
.chart svg { width: 100%; height: auto; display: block; }
.chart path { filter: drop-shadow(0 0 6px rgba(94, 242, 197, 0.35)); }
.legend { display: flex; flex-wrap: wrap; gap: 10px 14px; margin: 8px 0 12px; font-size: 0.88rem; color: #c5d7e6; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 4px; border-radius: 4px; display: inline-block; box-shadow: 0 0 8px currentColor; }

.income-cards, .goal-card { display: grid; gap: 8px; }
.cardlet {
  border-radius: 16px;
  padding: 12px 14px;
  background: var(--ok);
  border: 1px solid rgba(94, 242, 197, 0.28);
}
.cardlet.warn { background: var(--warn); border-color: rgba(246, 197, 107, 0.35); }
.cardlet h3 { margin: 0 0 4px; font-size: 1.02rem; color: #f4fbff; }
.cardlet p { margin: 0; color: #d5e4ee; }
.goal-card { margin-top: 8px; }
.goal-card:empty { display: none; }

.table-panel { margin-top: 20px; }
.table-head h2 { margin: 0; }
.table-scroll { overflow: auto; max-height: 420px; margin-top: 10px; border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 0.95rem; }
th, td { text-align: right; padding: 9px 10px; border-bottom: 1px solid rgba(126, 214, 255, 0.12); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; background: #0c1626; }
tbody tr:nth-child(even) td, tbody tr:nth-child(even) td:first-child { background: #101c30; }
thead th, thead th:first-child {
  position: sticky;
  top: 0;
  background: #07111d;
  color: var(--cyan);
  z-index: 1;
}

.notes { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 18px; margin: 18px 0 28px; }
.notes article {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 22px;
  backdrop-filter: blur(16px);
}
.notes h2 { margin: 0 0 8px; font-size: 1.35rem; }
.notes ul { margin: 0; padding-left: 1.1em; }
.notes li { margin: 0 0 8px; }
.notes p { color: #c5d7e6; }
.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 22px 0 28px;
}
.site-footer p { margin: 0; }

@media (max-width: 900px) {
  .layout, .notes, .split, .stats { grid-template-columns: 1fr; }
  .results { position: static; }
  .instrument { grid-template-columns: 1fr; }
  .site-header { padding: 32px 0 48px; }
  .site-header::before, .site-header::after { display: none; }
}
