:root {
  --bg: #f5f7fb;
  --ink: #101828;
  --muted: #64748b;
  --line: #dbe3ef;
  --panel: #ffffff;
  --navy: #0f172a;
  --blue: #2563eb;
  --green: #047857;
  --amber: #b45309;
  --red: #be123c;
  --shadow: 0 18px 60px rgba(15, 23, 42, .12);
  --radius: 8px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

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

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #fff;
  background: var(--navy);
  border-radius: 8px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.05;
}

.brand small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: flex;
  gap: 18px;
  color: #334155;
  font-size: 14px;
  font-weight: 650;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
  gap: 28px;
  min-height: calc(100vh - 68px);
  padding: clamp(34px, 7vw, 84px) clamp(16px, 4vw, 48px) 36px;
  align-items: center;
  background:
    linear-gradient(120deg, rgba(15, 23, 42, .95), rgba(30, 64, 175, .82)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1400' height='900' viewBox='0 0 1400 900'%3E%3Crect width='1400' height='900' fill='%23eef6ff'/%3E%3Cg fill='none' stroke='%2393c5fd' stroke-width='2' opacity='.65'%3E%3Cpath d='M90 170h460M90 240h350M90 310h410M90 380h290M790 165h350M790 240h450M790 315h280M790 390h390'/%3E%3C/g%3E%3Cg fill='%23fbbf24' opacity='.85'%3E%3Ccircle cx='1180' cy='160' r='48'/%3E%3Ccircle cx='1090' cy='485' r='32'/%3E%3C/g%3E%3Cg fill='%231e40af' opacity='.16'%3E%3Crect x='600' y='125' width='155' height='520' rx='18'/%3E%3Crect x='222' y='535' width='410' height='90' rx='14'/%3E%3Crect x='790' y='535' width='360' height='90' rx='14'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  color: #fff;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #60a5fa;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(40px, 6vw, 78px);
  line-height: .98;
}

.lede {
  max-width: 650px;
  margin: 20px 0 0;
  color: #dbeafe;
  font-size: 18px;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.button,
button {
  border: 0;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
}

.primary { color: var(--navy); background: #fff; }
.secondary { color: #fff; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28); }

.quick-panel {
  display: grid;
  gap: 14px;
  padding: 22px;
  color: var(--ink);
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(255,255,255,.55);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.panel-head strong {
  font-size: 32px;
}

label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 750;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  font: inherit;
}

.muted { color: var(--muted); }

.tools-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px clamp(16px, 4vw, 48px);
  background: #fff;
  border-block: 1px solid var(--line);
}

.tool-tab {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 13px;
  color: #334155;
  background: #eef2f7;
}

.tool-tab.active {
  color: #fff;
  background: var(--blue);
}

.workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 22px;
  padding: 26px clamp(16px, 4vw, 48px);
}

.rail {
  display: grid;
  align-content: start;
  gap: 16px;
}

.ad-slot,
.tracker,
.calculator-shell,
.seo-grid article,
.sources {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.ad-slot {
  display: grid;
  min-height: 250px;
  place-items: center;
  color: #94a3b8;
  border-style: dashed;
}

.ad-slot span,
.ad-slot small { display: block; text-align: center; }

.tracker {
  padding: 18px;
}

.tracker h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

dl { margin: 0; }
.tracker div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
dt { color: var(--muted); }
dd { margin: 0; font-weight: 800; }

.calculator-shell {
  min-width: 0;
  overflow: hidden;
  box-shadow: 0 10px 34px rgba(15, 23, 42, .07);
}

.calculator-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.calculator-head h2 {
  margin: 0;
  font-size: 28px;
}

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

.icon-button {
  min-height: 38px;
  padding: 0 12px;
  color: #fff;
  background: var(--navy);
}

.calculator-grid {
  display: grid;
  grid-template-columns: minmax(260px, .9fr) minmax(320px, 1.1fr);
  gap: 0;
}

.input-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-content: start;
  padding: 22px;
  border-right: 1px solid var(--line);
}

.input-panel .wide { grid-column: 1 / -1; }

.result-panel {
  padding: 22px;
}

.result-main {
  padding: 20px;
  color: #fff;
  background: var(--navy);
  border-radius: var(--radius);
}

.result-main span,
.result-main small {
  display: block;
  color: #cbd5e1;
}

.result-main strong {
  display: block;
  margin: 7px 0;
  font-size: clamp(34px, 6vw, 54px);
  line-height: 1;
}

.breakdown {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.row span:first-child { color: #475569; }
.row span:last-child { font-weight: 800; text-align: right; }
.row.positive span:last-child { color: var(--green); }
.row.negative span:last-child { color: var(--red); }
.row.warning span:last-child { color: var(--amber); }

.note {
  margin-top: 16px;
  padding: 13px;
  color: #475569;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.55;
}

.seo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 0 clamp(16px, 4vw, 48px) 26px;
}

.seo-grid article,
.sources {
  padding: 22px;
}

.seo-grid h2,
.sources h2 {
  margin: 0 0 10px;
  font-size: 22px;
}

.seo-grid p,
.sources li {
  color: #475569;
  line-height: 1.65;
}

.sources {
  margin: 0 clamp(16px, 4vw, 48px) 28px;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px clamp(16px, 4vw, 48px);
  color: #cbd5e1;
  background: var(--navy);
}

@media (max-width: 900px) {
  .nav { display: none; }
  .hero,
  .workspace,
  .calculator-grid,
  .seo-grid {
    grid-template-columns: 1fr;
  }
  .hero {
    min-height: auto;
    align-items: start;
  }
  .rail {
    order: 2;
  }
  .input-panel {
    grid-template-columns: 1fr;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 560px) {
  .topbar,
  .calculator-head,
  .footer {
    align-items: flex-start;
    flex-direction: column;
  }
  .hero h1 {
    font-size: 38px;
  }
  .quick-panel,
  .calculator-head,
  .input-panel,
  .result-panel,
  .seo-grid article,
  .sources {
    padding: 16px;
  }
}

@media print {
  .topbar,
  .hero,
  .tools-strip,
  .rail,
  .seo-grid,
  .sources,
  .footer,
  .head-actions,
  .input-panel {
    display: none;
  }
  body { background: #fff; }
  .workspace { display: block; padding: 0; }
  .calculator-shell { border: 0; box-shadow: none; }
  .calculator-grid { display: block; }
}

.compact-hero {
  min-height: 560px;
}

.no-rail {
  grid-template-columns: minmax(0, 1fr);
}

.no-rail .calculator-shell {
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}

.tool-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  padding: 0 clamp(16px, 4vw, 48px) 26px;
}

.tool-links a {
  display: flex;
  min-height: 48px;
  align-items: center;
  padding: 12px 14px;
  color: #0f172a;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 750;
}

.content-page {
  max-width: 980px;
  margin: 0 auto;
  padding: 34px clamp(16px, 4vw, 48px) 44px;
}

.content-page h1 {
  margin: 0 0 12px;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.04;
}

.content-page p,
.content-page li {
  color: #475569;
  font-size: 17px;
  line-height: 1.7;
}

.content-card {
  margin-top: 18px;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.inline-calc {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.inline-calc output {
  display: grid;
  align-content: center;
  min-height: 72px;
  padding: 12px;
  color: #fff;
  background: var(--navy);
  border-radius: var(--radius);
  font-size: 24px;
  font-weight: 850;
}

@media (max-width: 760px) {
  .inline-calc {
    grid-template-columns: 1fr;
  }
}

.brand-logo {
  display: block;
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: 8px;
}
