:root {
  --bg: #0f1720;
  --bg-soft: #16212c;
  --panel: #1b2836;
  --panel-2: #21313f;
  --line: #2c3e50;
  --text: #e8eef4;
  --muted: #9fb1c1;
  --accent: #f5a623;
  --accent-2: #ffcf6b;
  --good: #4ec9a0;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1d3348 0%, var(--bg) 55%) fixed;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.45;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(15, 23, 32, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1b1204;
  font-size: 20px;
  font-weight: 900;
}

.brand h1 { font-size: 1.15rem; margin: 0; letter-spacing: 0.2px; }
.subtitle { margin: 0; font-size: 0.8rem; color: var(--muted); }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { background: #2a3d4f; }
.btn:active { transform: translateY(1px); }
.btn.solid {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1b1204;
  border-color: transparent;
}
.btn.solid:hover { filter: brightness(1.05); }

.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 20px 60px;
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 20px;
  align-items: start;
}

.panel { min-width: 0; }

.hint {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.86rem;
  background: var(--bg-soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 14px;
  font-size: 1rem;
  letter-spacing: 0.3px;
  color: var(--accent-2);
  text-transform: uppercase;
  font-size: 0.82rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 0.86rem; font-weight: 600; color: #d5e0ea; }
.field small { color: var(--muted); font-size: 0.74rem; }

input[type="number"],
input[type="text"],
select {
  width: 100%;
  background: #0e1822;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.18);
}
input.invalid { border-color: #e06b6b; box-shadow: 0 0 0 3px rgba(224, 107, 107, 0.15); }

/* Results */
.results {
  position: sticky;
  top: 84px;
  background: linear-gradient(180deg, #1e2e3d, #17232f);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.results-head h2 { margin: 0; font-size: 1rem; }

.badge {
  background: rgba(245, 166, 35, 0.15);
  color: var(--accent-2);
  border: 1px solid rgba(245, 166, 35, 0.4);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.result-hero {
  background: linear-gradient(135deg, rgba(245, 166, 35, 0.16), rgba(245, 166, 35, 0.04));
  border: 1px solid rgba(245, 166, 35, 0.35);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  margin-bottom: 14px;
}
.hero-label { display: block; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.hero-value { display: block; font-size: 2.6rem; font-weight: 800; color: var(--accent-2); line-height: 1.1; font-variant-numeric: tabular-nums; }
.hero-note { display: block; font-size: 0.8rem; color: var(--muted); margin-top: 4px; }

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.result-item {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 12px;
}
.result-item.wide { grid-column: 1 / -1; }
.ri-label { display: block; font-size: 0.74rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.ri-value { display: block; font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ri-sub { display: block; font-size: 0.74rem; color: var(--muted); margin-top: 2px; }
.result-item.accent .ri-value { color: var(--accent-2); }
.result-item.good .ri-value { color: var(--good); }

.explain {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.explain summary { cursor: pointer; font-weight: 700; font-size: 0.86rem; color: var(--accent-2); }
.explain ul { margin: 10px 0 0; padding-left: 18px; color: #cbd8e3; font-size: 0.82rem; }
.explain li { margin-bottom: 5px; }

.disclaimer { font-size: 0.74rem; color: var(--muted); margin: 14px 0 0; }

.foot {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 30px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.78rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: var(--accent);
  color: #1b1204;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .results { position: static; }
}

@media (max-width: 560px) {
  .grid, .result-grid { grid-template-columns: 1fr; }
  .hero-value { font-size: 2.2rem; }
  .topbar-inner { padding: 12px 14px; }
}

@media print {
  body { background: #fff; color: #111; }
  .topbar, .foot, .actions, .explain, .disclaimer, .hint { display: none !important; }
  .layout { display: block; padding: 0; }
  .card, .results { box-shadow: none; border-color: #ccc; background: #fff; color: #111; }
  .card h2, .hero-value, .ri-value, .result-hero { color: #111; }
  .result-hero { background: #f4f4f4; border-color: #ccc; }
  .result-item { background: #f9f9f9; border-color: #ddd; }
  .ri-label, .hero-label, .ri-sub, .hero-note { color: #555; }
  .results { position: static; page-break-before: always; }
}
