:root {
  color-scheme: dark;
  --bg: #08100f; --panel: #101b19; --panel-2: #142321; --text: #edf5f2; --muted: #91a8a2;
  --line: #233a36; --accent: #40d39c; --accent-2: #a4f2d3; --danger: #ff8a8a; --shadow: 0 18px 50px rgba(0,0,0,.2);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f1f5f3; --panel: #ffffff; --panel-2: #e8f0ed; --text: #10201c; --muted: #587069;
  --line: #cfddd8; --accent: #087f5b; --accent-2: #0a6047; --danger: #b42318; --shadow: 0 18px 50px rgba(29,55,47,.09);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: inherit; }
.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-size: 17px; letter-spacing: -.02em; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--accent); color: #04110d; font-weight: 900; font-size: 13px; }
.brand b { color: var(--accent); }
.theme-toggle { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 999px; padding: 9px 14px; cursor: pointer; }
.app-shell { display: grid; grid-template-columns: 278px minmax(0, 1fr); min-height: calc(100vh - 68px); }
.sidebar { padding: 24px 14px; border-right: 1px solid var(--line); }
.nav-label { margin: 4px 12px 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .13em; font-size: 10px; font-weight: 800; }
.data-label { margin-top: 28px; }
.sidebar a { display: grid; grid-template-columns: 32px 1fr; align-items: center; gap: 10px; padding: 10px; margin: 3px 0; border-radius: 11px; text-decoration: none; color: var(--muted); }
.sidebar a > span { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.sidebar a strong, .sidebar a small { display: block; }
.sidebar a strong { font-size: 13px; color: var(--text); }
.sidebar a small { font-size: 11px; margin-top: 2px; }
.sidebar a:hover { background: var(--panel); }
.sidebar a.active { background: color-mix(in srgb, var(--accent) 13%, var(--panel)); color: var(--accent); }
.sidebar a.active > span { background: var(--accent); color: #04110d; border-color: var(--accent); }
main { padding: 50px clamp(22px, 5vw, 78px) 70px; min-width: 0; }
.hero { max-width: 1180px; margin: 0 auto 28px; display: flex; align-items: end; justify-content: space-between; gap: 32px; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .13em; font-size: 11px; font-weight: 900; margin: 0 0 11px; }
h1 { margin: 0; font-size: clamp(32px, 4vw, 54px); letter-spacing: -.055em; line-height: .98; }
.hero > div > p:last-child, .hero > p { color: var(--muted); max-width: 700px; font-size: 16px; line-height: 1.55; }
.formula { min-width: 290px; max-width: 390px; padding: 18px; border-left: 2px solid var(--accent); background: var(--panel); }
.formula small, .formula strong { display: block; }
.formula small { color: var(--accent); text-transform: uppercase; font-size: 10px; letter-spacing: .12em; margin-bottom: 7px; }
.formula strong { font-size: 13px; line-height: 1.5; }
.workspace, .data-grid { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr); gap: 20px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 24px; }
.panel h2 { margin: 0 0 22px; font-size: 15px; letter-spacing: -.01em; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
label > span:first-child { display: block; font-size: 12px; font-weight: 750; margin-bottom: 7px; }
label em { color: var(--muted); display: block; font-style: normal; font-size: 10px; line-height: 1.4; margin-top: 5px; }
.input-wrap { display: grid; grid-template-columns: 1fr auto; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); overflow: hidden; }
.input-wrap:focus-within { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }
input, select { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text); padding: 12px; font: inherit; font-size: 14px; }
.input-wrap input { border: 0; border-radius: 0; background: transparent; outline: none; min-width: 0; }
.input-wrap small { padding: 0 12px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.primary { width: 100%; margin-top: 22px; background: var(--accent); color: #03110c; border: 0; border-radius: 11px; padding: 14px 18px; font-weight: 900; cursor: pointer; font-size: 14px; }
.primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.results { position: sticky; top: 92px; }
.result-list { display: grid; gap: 2px; }
.result-row { padding: 15px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: start; gap: 22px; }
.result-row:last-child { border-bottom: 0; }
.result-row span, .result-row small { display: block; }
.result-row span { font-size: 12px; color: var(--muted); }
.result-row small { font-size: 10px; color: var(--muted); margin-top: 5px; max-width: 270px; line-height: 1.4; }
.result-row strong { text-align: right; font-size: 17px; color: var(--accent-2); }
.empty-result { color: var(--muted); min-height: 250px; display: grid; place-items: center; align-content: center; text-align: center; }
.empty-result > span { width: 64px; height: 64px; display: grid; place-items: center; background: var(--panel-2); border-radius: 18px; font-size: 28px; color: var(--accent); }
.alert { max-width: 1180px; margin: 0 auto 20px; border-radius: 11px; padding: 14px 16px; font-size: 12px; line-height: 1.5; }
.alert b, .alert span { display: block; }
.alert.error { border: 1px solid color-mix(in srgb, var(--danger) 55%, var(--line)); background: color-mix(in srgb, var(--danger) 8%, var(--panel)); color: var(--danger); }
.alert.note { margin: 18px 0 0; background: var(--panel-2); color: var(--muted); }
.data-grid { align-items: stretch; }
.data-item { padding: 14px 0; border-top: 1px solid var(--line); }
.data-item h3 { font-size: 13px; margin: 0 0 7px; color: var(--accent-2); }
.data-item p { font-size: 12px; line-height: 1.55; margin: 4px 0; }
.data-item small { color: var(--muted); font-size: 10px; line-height: 1.5; }
footer { border-top: 1px solid var(--line); padding: 20px 28px; display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
footer a { color: var(--accent); }
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); display: flex; gap: 6px; overflow-x: auto; padding: 12px 18px; }
  .sidebar .nav-label, .sidebar a div { display: none; }
  .sidebar a { flex: 0 0 auto; padding: 4px; }
  main { padding-top: 34px; }
  .hero { display: block; }
  .formula { margin-top: 20px; max-width: none; min-width: 0; }
  .workspace, .data-grid { grid-template-columns: 1fr; }
  .results { position: static; }
}
@media (max-width: 600px) {
  .topbar { padding: 0 16px; }
  .theme-toggle span { display: none; }
  main { padding: 28px 14px 48px; }
  .fields { grid-template-columns: 1fr; }
  .panel { padding: 19px; border-radius: 13px; }
  .result-row { display: block; }
  .result-row strong { display: block; text-align: left; margin-top: 7px; }
  footer { display: grid; gap: 8px; padding: 18px; }
}
