:root {
  --ink: #102744;
  --ink-soft: #52647a;
  --navy: #173b66;
  --blue: #2d65a8;
  --blue-soft: #eaf2fb;
  --sky: #dcecff;
  --mint: #dff5e9;
  --mint-ink: #1c6b4a;
  --amber: #fff1c7;
  --amber-ink: #815c08;
  --paper: #f5f7fa;
  --white: #ffffff;
  --line: #dce4ed;
  --shadow: 0 18px 48px rgba(20, 48, 83, 0.1);
  --radius: 20px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 4%, rgba(66, 128, 196, 0.12), transparent 28rem),
    var(--paper);
  font-family: "Avenir Next", Avenir, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, input, select { font: inherit; }

button, select { cursor: pointer; }

.topbar {
  width: min(1380px, calc(100% - 48px));
  margin: 0 auto;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(23, 59, 102, 0.12);
}

.brand {
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-family: "Avenir Next", Avenir, system-ui, sans-serif;
  font-size: 1.18rem;
  letter-spacing: -0.03em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 3px;
  padding: 7px;
  border-radius: 10px;
  background: var(--navy);
}

.brand-mark span { display: block; border-radius: 2px; background: #fff; }
.brand-mark span:nth-child(1) { height: 42%; opacity: 0.65; }
.brand-mark span:nth-child(2) { height: 68%; opacity: 0.82; }
.brand-mark span:nth-child(3) { height: 100%; }

.product-context { display: flex; align-items: center; gap: 14px; color: var(--ink-soft); font-size: 0.82rem; }
.status-pill, .tag { display: inline-flex; align-items: center; border-radius: 999px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; }
.status-pill { background: var(--white); border: 1px solid var(--line); padding: 7px 11px; }

main { width: min(1380px, calc(100% - 48px)); margin: 0 auto; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.65fr);
  gap: 54px;
  align-items: end;
  padding: 68px 0 50px;
}

.eyebrow, .kicker {
  margin: 0 0 10px;
  color: var(--blue);
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  font-size: 0.74rem;
}

h1, h2 { font-family: "Avenir Next", Avenir, system-ui, sans-serif; }

h1 {
  max-width: 860px;
  margin: 0;
  font-size: clamp(2.4rem, 4.7vw, 4.8rem);
  line-height: 1.03;
  letter-spacing: -0.055em;
}

.hero-lead { max-width: 720px; margin: 22px 0 0; color: var(--ink-soft); font-size: 1.17rem; }

.scope-card {
  display: flex;
  gap: 15px;
  padding: 22px;
  border: 1px solid #bfd3e9;
  border-radius: 18px;
  background: rgba(234, 242, 251, 0.76);
}

.scope-card p { margin: 5px 0 0; color: var(--ink-soft); font-size: 0.9rem; }
.scope-icon { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--blue); font-weight: 700; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(410px, 0.92fr); gap: 28px; align-items: start; min-width: 0; }
.controls { display: grid; gap: 20px; min-width: 0; }
.results { position: sticky; top: 18px; display: grid; gap: 16px; min-width: 0; }

.panel, .result-card, .metric-card, .method-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.step-panel { padding: 28px; box-shadow: 0 8px 28px rgba(20, 48, 83, 0.04); min-width: 0; }
.step-heading, .panel-heading-row { display: flex; align-items: center; gap: 15px; margin-bottom: 24px; }
.step-heading h2, .panel-heading-row h2 { margin: 0; font-size: 1.34rem; letter-spacing: -0.025em; }
.step-heading .kicker, .panel-heading-row .kicker { margin-bottom: 2px; }
.step-number { display: grid; place-items: center; width: 42px; height: 42px; color: var(--blue); background: var(--blue-soft); border-radius: 13px; font-family: "Avenir Next", Avenir, system-ui, sans-serif; font-size: 0.76rem; font-weight: 800; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.compact-grid { margin-top: 22px; }
.field-wide { grid-column: 1 / -1; }
.field { display: grid; gap: 7px; min-width: 0; }
.field > span, fieldset legend { color: var(--ink); font-weight: 700; font-size: 0.82rem; }
.field small { color: var(--ink-soft); line-height: 1.35; }

input, select {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cbd7e4;
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
  transition: 0.18s border-color, 0.18s box-shadow;
}

input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(45, 101, 168, 0.12); }
select:disabled { cursor: default; color: #68788c; background: #f6f8fa; }
.input-suffix { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border: 1px solid #cbd7e4; border-radius: 11px; background: #fff; overflow: hidden; }
.input-suffix:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(45, 101, 168, 0.12); }
.input-suffix input { border: 0; border-radius: 0; box-shadow: none; }
.input-suffix input:focus { box-shadow: none; }
.input-suffix em { padding: 0 12px; color: #718096; font-size: 0.75rem; font-style: normal; }

.assumption-note, .salary-source { margin-top: 20px; padding: 14px 16px; border-radius: 12px; background: #f5f8fc; }
.assumption-note p, .salary-source p { margin: 7px 0 0; color: var(--ink-soft); font-size: 0.82rem; }
.tag { padding: 5px 9px; }
.tag-model { color: var(--blue); background: var(--blue-soft); }
.tag-warning { color: var(--amber-ink); background: var(--amber); }
.tag-estimate { color: var(--mint-ink); background: var(--mint); }
.tag-private { color: #6a4ba1; background: #eee8fa; }

.duration-fieldset { margin: 0; padding: 0; border: 0; }
.duration-fieldset legend { margin-bottom: 10px; }
.segment-control { display: grid; grid-template-columns: repeat(4, 1fr); padding: 4px; border-radius: 13px; background: #eef2f7; }
.segment-control button { border: 0; padding: 10px; border-radius: 9px; color: var(--ink-soft); background: transparent; font-weight: 700; }
.segment-control button.active { color: #fff; background: var(--navy); box-shadow: 0 4px 12px rgba(23, 59, 102, 0.2); }
.custom-hours { margin-top: 14px; }
.is-hidden { display: none; }

.equation-box { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 20px; padding: 15px 17px; border: 1px solid #c8ddf1; border-radius: 13px; background: var(--blue-soft); }
.equation-box div { display: grid; }
.equation-box span { color: var(--ink-soft); font-size: 0.75rem; }
.equation-box strong { font-size: 1.05rem; }
.equation-box code { color: var(--blue); font-size: 0.78rem; }

.hierarchy-heading { align-items: flex-start; }
.hierarchy-heading .text-button { margin-left: auto; }
.text-button { border: 0; color: var(--blue); background: transparent; padding: 6px 2px; font-weight: 700; font-size: 0.82rem; }
.text-button:hover { text-decoration: underline; }
.hierarchy-table-wrap { width: 100%; max-width: 100%; overflow-x: auto; }
.hierarchy-table { width: 100%; border-collapse: separate; border-spacing: 0 8px; table-layout: fixed; min-width: 620px; }
.hierarchy-table .level-column { width: 18%; }
.hierarchy-table .role-column { width: 32%; }
.hierarchy-table .people-column { width: 15%; }
.hierarchy-table .salary-column { width: 35%; }
.hierarchy-table th { padding: 0 9px 5px; color: var(--ink-soft); text-align: left; font-size: 0.72rem; }
.hierarchy-table td { padding: 10px 9px; background: #f8fafc; vertical-align: middle; }
.hierarchy-table td:first-child { border-radius: 10px 0 0 10px; }
.hierarchy-table td:last-child { border-radius: 0 10px 10px 0; }
.level-label { display: flex; align-items: center; gap: 9px; }
.level-code { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 auto; border-radius: 9px; color: var(--blue); background: var(--blue-soft); font-weight: 800; font-size: 0.78rem; }
.level-label div { display: grid; }
.level-label small { color: var(--ink-soft); font-size: 0.68rem; }
.hierarchy-table input { min-width: 0; min-height: 39px; padding: 7px 9px; }
.hierarchy-table .input-suffix { min-width: 0; }
.hierarchy-table .input-suffix em { padding: 0 8px; }
.role-input { min-width: 0; }
.salary-input, .headcount-input { font-variant-numeric: tabular-nums; }
.headcount { font-variant-numeric: tabular-nums; }
.mix-status { color: var(--ink-soft); font-size: 0.76rem; text-align: right; }
.mix-status.warning { color: #8a5e00; }

.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 2px 5px 20px; }
.secondary-button { border: 1px solid #bfd0e3; border-radius: 11px; padding: 10px 14px; color: var(--navy); background: var(--white); font-weight: 700; font-size: 0.82rem; }
.secondary-button:hover { background: var(--blue-soft); }

.primary-result { padding: 28px; color: #fff; background: linear-gradient(145deg, #15385f, #234f80); border-color: transparent; box-shadow: var(--shadow); }
.result-label-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.result-label-row p { margin: 0; color: rgba(255, 255, 255, 0.76); font-size: 0.86rem; font-weight: 700; }
.main-value { display: block; margin-top: 18px; font-family: "Avenir Next", Avenir, system-ui, sans-serif; font-size: clamp(2.2rem, 4vw, 3.65rem); line-height: 1; letter-spacing: -0.05em; }
.usd-value { display: block; margin-top: 9px; color: #c9e0fa; font-size: 1.18rem; font-weight: 700; }
.result-explainer { margin: 18px 0 0; padding-top: 15px; border-top: 1px solid rgba(255, 255, 255, 0.16); color: rgba(255, 255, 255, 0.72); font-size: 0.78rem; }

.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.metric-card { min-height: 112px; padding: 17px; display: grid; align-content: start; }
.metric-card span { color: var(--ink-soft); font-size: 0.73rem; }
.metric-card strong { margin-top: 8px; font-family: "Avenir Next", Avenir, system-ui, sans-serif; font-size: 1.22rem; letter-spacing: -0.025em; }
.metric-card small { margin-top: 2px; color: var(--blue); font-weight: 700; }

.breakdown-panel, .disclaimer-panel { padding: 22px; }
.panel-heading-row { justify-content: space-between; margin-bottom: 17px; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.icon-button:hover { background: var(--blue-soft); }
.icon-button svg { width: 18px; fill: none; stroke: var(--blue); stroke-width: 1.8; }
.breakdown { display: grid; gap: 13px; }
.breakdown-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 14px; align-items: end; }
.breakdown-label { font-size: 0.78rem; font-weight: 700; }
.breakdown-value { font-size: 0.78rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.breakdown-meta { color: var(--ink-soft); font-size: 0.68rem; }
.bar-track { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: #edf1f5; overflow: hidden; }
.bar-fill { display: block; height: 100%; min-width: 2px; border-radius: inherit; background: linear-gradient(90deg, #4179b6, #72a5db); }
.copy-feedback { min-height: 18px; margin: 12px 0 0; color: var(--mint-ink); font-size: 0.72rem; }

.disclaimer-panel { border-color: #ebd59b; background: #fffaf0; }
.disclaimer-heading { display: flex; align-items: center; gap: 10px; }
.disclaimer-heading span { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #b57c05; font-weight: 800; }
.disclaimer-panel > p { margin: 8px 0 14px 33px; color: var(--ink-soft); font-size: 0.84rem; }
details summary { cursor: pointer; color: var(--blue); font-weight: 700; font-size: 0.8rem; }
details ul { padding-left: 21px; color: var(--ink-soft); font-size: 0.78rem; }

.method-card { padding: 19px 21px; }
.method-card > div { display: flex; gap: 10px; align-items: flex-start; }
.method-card p { margin: 1px 0 13px; color: var(--ink-soft); font-size: 0.76rem; }
.method-card details p { margin: 10px 0; }
.method-card a { color: var(--blue); font-size: 0.76rem; }
.method-card details + details { margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line); }

footer { width: min(1380px, calc(100% - 48px)); margin: 45px auto 0; padding: 25px 0 35px; display: flex; justify-content: space-between; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 0.75rem; }

@media (max-width: 1050px) {
  .hero { grid-template-columns: 1fr; gap: 26px; }
  .scope-card { max-width: 680px; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .controls, .results { width: 100%; max-width: 100%; }
  .results { position: static; }
}

@media (max-width: 680px) {
  .topbar, main, footer { width: min(100% - 28px, 1380px); }
  .topbar { min-height: 68px; }
  .product-context > span:first-child { display: none; }
  .hero { padding: 45px 0 34px; }
  h1 { font-size: 2.45rem; }
  .step-panel { padding: 21px 17px; }
  .field-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .segment-control { grid-template-columns: repeat(2, 1fr); gap: 3px; }
  .hierarchy-heading { flex-wrap: wrap; }
  .hierarchy-heading .text-button { width: 100%; margin-left: 57px; text-align: left; }
  .form-actions { align-items: flex-start; flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr; }
  footer { flex-direction: column; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
