:root {
  --bg: #0b101b;
  --surface: #131b2e;
  --surface-2: #1a243d;
  --border: #273554;
  --text: #e8eefc;
  --muted: #9aa8c7;
  --accent: #f59e0b;
  --accent-hover: #fbbf24;
  --ok: #10b981;
  --warn: #ef4444;
  --radius: 12px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1060px; margin: 0 auto; padding: 0 18px; }

header.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(11, 16, 27, 0.95);
  position: sticky;
  top: 0;
  z-index: 20;
}
.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  flex-wrap: wrap;
}
.brand {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: -0.02em;
}
.brand span { color: var(--accent); }
.nav-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.92rem;
}
.nav-links a { color: var(--muted); font-weight: 600; }
.nav-links a:hover { color: var(--text); text-decoration: none; }

.hero { padding: 22px 0 10px; }
.hero h1 {
  margin: 0 0 6px;
  font-size: clamp(1.55rem, 3vw, 2.2rem);
  line-height: 1.2;
}
.hero p { margin: 0; color: var(--muted); font-size: 0.98rem; }

.calc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin: 16px 0 26px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.budget-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
}
.budget-num { font-size: 1.35rem; color: var(--ok); }
.budget-num.over { color: var(--warn); }

.controls-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
select, button.btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
button.btn:hover, select:hover { border-color: var(--accent); }
button.btn-primary {
  background: var(--accent);
  color: #111827;
  border-color: var(--accent);
}
button.btn-primary:hover { background: var(--accent-hover); }

.stat-table { width: 100%; border-collapse: collapse; }
.stat-table th {
  text-align: left;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
}
.stat-table td {
  padding: 10px 6px;
  border-bottom: 1px solid rgba(39, 53, 84, 0.55);
  vertical-align: middle;
}
.stat-name { font-weight: 800; font-size: 1rem; }
.stat-sub { display: block; font-size: 0.76rem; color: var(--muted); font-weight: 400; }

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.stepper button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}
.stepper button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.stepper button:disabled { opacity: 0.35; cursor: not-allowed; }
.stepper .base-val {
  min-width: 28px;
  text-align: center;
  font-weight: 800;
  font-size: 1.05rem;
}

.total-badge {
  display: inline-block;
  min-width: 34px;
  text-align: center;
  font-weight: 800;
  font-size: 1.08rem;
  color: var(--accent);
}
.mod-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--surface-2);
  font-weight: 700;
  font-size: 0.92rem;
}
.mod-pos { color: var(--ok); }
.mod-neg { color: var(--warn); }

.calc-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.status-msg { font-size: 0.88rem; color: var(--muted); }
.status-msg.ok { color: var(--ok); }
.status-msg.warn { color: var(--warn); }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
  margin: 22px 0;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.card h2, .card h3 { margin-top: 0; line-height: 1.3; }

.ref-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.ref-table th, .ref-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.ref-table th { color: var(--muted); font-size: 0.82rem; text-transform: uppercase; }

.build-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
}
.chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0 36px;
  margin-top: 36px;
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 640px) {
  .stat-table th:nth-child(4), .stat-table td:nth-child(4) { display: none; }
  .stepper button { width: 28px; height: 28px; }
}
