@import url("https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&display=swap");

:root,
html[data-theme="dark"] {
  --bg: #05070d;
  --bg-card: #12141c;
  --bg-soft: #1a1d27;
  --border: rgba(255, 255, 255, 0.1);
  --text: #f2f5ff;
  --muted: #9aa3b8;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --btn: #ffffff;
  --btn-text: #0d0d0d;
  --input: #0d0f15;
  --highlight: #60a5fa;
}

html[data-theme="light"] {
  --bg: #eef2f8;
  --bg-card: #ffffff;
  --bg-soft: #f4f7fc;
  --border: rgba(15, 23, 42, 0.1);
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --btn: #0d0d0d;
  --btn-text: #ffffff;
  --input: #ffffff;
  --highlight: #1d4ed8;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Sora", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: inherit; }

.calc-shell { min-height: 100dvh; display: flex; flex-direction: column; }

.calc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
}
html[data-theme="light"] .calc-top { background: rgba(255, 255, 255, 0.8); }

.calc-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
}
.calc-brand img {
  height: 32px;
  width: auto;
  display: block;
}
html[data-theme="dark"] .calc-brand img {
  filter: brightness(0) invert(1);
}

.calc-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.calc-chip,
.calc-btn,
.calc-btn-solid {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}
.calc-chip:hover { background: var(--accent-soft); }
.calc-btn-solid {
  background: var(--btn);
  color: var(--btn-text);
  border-color: transparent;
}

.calc-main {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 28px 18px 48px;
  flex: 1;
}

.calc-crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 18px;
}
.calc-crumb a { text-decoration: none; }
.calc-crumb a:hover { color: var(--text); }

.calc-hero { margin-bottom: 22px; }
.calc-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--highlight);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.calc-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.calc-hero p {
  margin: 0;
  color: var(--muted);
  max-width: 58ch;
  line-height: 1.5;
  font-size: 0.95rem;
}

.calc-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 880px) {
  .calc-grid { grid-template-columns: 1fr; }
}

.calc-card {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  padding: 20px;
}
.calc-card h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}
.calc-card .sub {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.82rem;
}

.field { margin-bottom: 12px; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}
.field input,
.field select {
  width: 100%;
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input);
  color: var(--text);
  padding: 0 12px;
  font: inherit;
  font-size: 0.92rem;
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 520px) {
  .field-row { grid-template-columns: 1fr; }
}

.calc-run {
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  border: none;
  border-radius: 12px;
  background: var(--btn);
  color: var(--btn-text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.calc-run:hover { filter: brightness(0.96); }

.result-rows { display: flex; flex-direction: column; }
.result-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.result-row:last-child { border-bottom: none; }
.result-row span:first-child { color: var(--muted); }
.result-row span:last-child { font-weight: 650; text-align: right; }
.result-row.highlight span:last-child {
  color: var(--highlight);
  font-size: 1.02rem;
}
.result-empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 20px;
}
.result-note {
  margin: 14px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
  font-style: italic;
}

.related {
  margin-top: 28px;
}
.related h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.related a {
  display: block;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  border-radius: 14px;
  padding: 12px 14px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.related a:hover {
  border-color: rgba(59, 130, 246, 0.45);
  background: var(--accent-soft);
}
.related strong {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 4px;
}
.related span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}

.index-grid {
  display: grid;
  gap: 18px;
}
.index-cat {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--bg-card);
  padding: 18px;
}
.index-cat h2 {
  margin: 0 0 12px;
  font-size: 1rem;
}
.index-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.index-links a {
  text-decoration: none;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 0.9rem;
}
.index-links a:hover {
  color: var(--text);
  background: var(--accent-soft);
  border-color: var(--border);
}

.calc-foot {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}
.calc-foot a { color: var(--highlight); }
