:root {
  --bg: #f7fbff;
  --surface: #ffffff;
  --surface-2: #eef6ff;
  --surface-3: #e5edf8;
  --ink: #071325;
  --muted: #64748b;
  --line: rgba(11,31,58,.13);
  --brand: #0a6cff;
  --teal: #0f9f8f;
  --green: #15803d;
  --violet: #6c4bff;
  --amber: #b7791f;
  --danger: #d3425f;
  --shadow: 0 18px 55px rgba(8,35,86,.11);
  --max: 1380px;
}
html[data-theme="dark"] {
  --bg: #07111f;
  --surface: #0d2036;
  --surface-2: #132b47;
  --surface-3: #183451;
  --ink: #ecf5ff;
  --muted: #a8b7cc;
  --line: rgba(214,232,255,.14);
  --shadow: 0 24px 70px rgba(0,0,0,.34);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg), var(--surface-2));
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
.shell { width: min(var(--max), calc(100% - 32px)); margin: auto; }
.nav {
  position: sticky;
  top: 12px;
  z-index: 30;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}
.nav-inner { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .62rem .72rem; }
.brand { display: flex; align-items: center; gap: .72rem; font-weight: 950; }
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--teal));
}
.brand small { display: block; color: var(--muted); font-size: .72rem; font-weight: 800; }
.nav-links { display: flex; gap: .32rem; flex-wrap: wrap; align-items: center; }
.nav-links a, .icon-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
  border-radius: 999px;
  padding: .64rem .78rem;
}
.nav-links a:hover, .icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.icon-btn { cursor: pointer; }
.hero {
  display: grid;
  grid-template-columns: minmax(0,.72fr) minmax(360px,.28fr);
  gap: 1rem;
  align-items: stretch;
  padding: 1.5rem 0 1rem;
}
.hero-copy, .tool-panel, .result-panel, .section-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  box-shadow: var(--shadow);
}
.hero-copy { padding: 1.15rem; }
.kicker {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: var(--brand);
  font-size: .74rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0;
}
h1 {
  font-size: clamp(2.25rem, 4.8vw, 5rem);
  line-height: .96;
  letter-spacing: 0;
  margin: .85rem 0;
}
.hero-copy p, .context-card p { color: var(--muted); line-height: 1.65; font-size: 1.02rem; max-width: 920px; }
.actions { display: flex; flex-wrap: wrap; gap: .68rem; margin-top: 1rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 950;
  padding: .8rem 1rem;
  cursor: pointer;
}
.btn.primary { border-color: transparent; background: linear-gradient(135deg, var(--brand), var(--teal)); color: #fff; }
.btn:disabled { opacity: .72; cursor: wait; }
.context-card { padding: 1rem; display: grid; align-content: space-between; }
.context-card h2 { font-size: 1.1rem; margin: .6rem 0; }
.note {
  display: flex;
  gap: .6rem;
  border: 1px solid rgba(183,121,31,.25);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2) 80%, rgba(183,121,31,.15));
  padding: .78rem;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.45;
}
.note i { color: var(--amber); margin-top: .15rem; }
.workspace { display: grid; grid-template-columns: 390px minmax(0,1fr); gap: 1rem; align-items: start; padding: 0 0 3rem; }
.tool-panel, .result-panel, .section-card { padding: 1rem; }
.tool-panel h2, .result-panel h2, .section-card h2 { font-size: 1rem; margin: .2rem 0 1rem; }
.form-grid { display: grid; gap: .75rem; }
.field label { display: block; color: var(--muted); font-size: .74rem; font-weight: 900; margin-bottom: .3rem; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink);
  padding: .72rem;
  outline: none;
}
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: color-mix(in srgb, var(--brand) 58%, var(--line));
  box-shadow: 0 0 0 4px rgba(10,108,255,.1);
}
.result-head { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 1rem; align-items: start; border-bottom: 1px solid var(--line); padding-bottom: 1rem; margin-bottom: 1rem; }
.score { font-size: 3.6rem; line-height: .9; font-weight: 950; color: var(--brand); text-align: right; }
.status { color: var(--muted); font-size: .82rem; font-weight: 850; text-align: right; margin-top: .35rem; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border-radius: 999px;
  background: rgba(15,159,143,.12);
  color: var(--teal);
  font-weight: 950;
  font-size: .75rem;
  padding: .42rem .58rem;
}
.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .65rem; }
.metric { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); padding: .74rem; min-height: 92px; }
.metric b { display: block; color: var(--brand); font-size: 1.2rem; }
.metric small { display: block; color: var(--muted); line-height: 1.4; margin-top: .24rem; }
.sections { display: grid; gap: 1rem; margin-top: 1rem; }
.item-list { display: grid; gap: .6rem; }
.list-item {
  display: flex;
  gap: .62rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  padding: .75rem;
  color: var(--muted);
  line-height: 1.45;
}
.list-item i { color: var(--brand); margin-top: .16rem; }
.list-item strong { color: var(--ink); display: block; margin-bottom: .16rem; }
.kv-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .55rem; margin-top: .45rem; }
.kv { border: 1px solid var(--line); border-radius: 10px; padding: .58rem; background: var(--surface); }
.kv span { display: block; color: var(--muted); font-size: .72rem; font-weight: 850; }
.kv b { display: block; margin-top: .18rem; font-size: .85rem; overflow-wrap: anywhere; }
.footer { padding: 0 0 3rem; color: var(--muted); font-size: .82rem; }
.footer-inner { border-top: 1px solid var(--line); padding-top: 1rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer nav { display: flex; gap: .75rem; flex-wrap: wrap; }
@media (max-width: 1120px) {
  .hero, .workspace { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 640px) {
  .shell { width: min(var(--max), calc(100% - 22px)); }
  .nav-inner { align-items: flex-start; flex-direction: column; }
  h1 { font-size: 2.45rem; }
  .metric-grid, .kv-grid, .result-head { grid-template-columns: 1fr; }
  .score, .status { text-align: left; }
  .actions .btn { width: 100%; }
}
