/* Discreta payback calculator — индустриально-минималистичный стиль */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #ffffff;
  --surface: #fafafa;
  --ink: #0c0c0c;
  --ink-muted: #555559;
  --line: #e6e6e6;
  --accent: #0F5782;
  --accent-hover: #0a4366;
  --error: #c0392b;
  --success: #1f6b3a;
  --radius: 4px;
  --shadow: 0 1px 0 rgba(0,0,0,0.04);
  --max: 1080px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 32px 20px 48px;
}
.wrap--embed { padding: 20px 16px 24px; }

.h-title {
  font-weight: 700;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  text-transform: none;
}
.h-sub {
  color: var(--ink-muted);
  margin: 0 0 28px;
  max-width: 720px;
}
.h-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 12px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 880px) {
  .grid { grid-template-columns: 1.1fr 1fr; align-items: start; }
}

.card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }

.section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 16px;
}

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field__label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
}
.field__hint {
  display: block;
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 4px;
}
.field__input,
.field__select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.field__input:focus,
.field__select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(12,12,12,0.08);
}
.field__input--error { border-color: var(--error); }
.field__select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%230c0c0c' stroke-width='1.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* segmented control: режим ввода зарплаты */
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 3px;
  background: var(--surface);
  margin-bottom: 6px;
}
.seg__btn {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  border: 0;
  color: var(--ink-muted);
  padding: 7px 14px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.seg__btn[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
}

/* чекбокс МСП */
.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  margin: 8px 0 12px;
}
.checkbox input { margin-top: 2px; }
.checkbox__title { font-weight: 500; color: var(--ink); }
.checkbox__hint { display: block; font-size: 12px; color: var(--ink-muted); margin-top: 2px; }

/* sub-fields для накладных расходов */
.subfields { display: none; margin-top: 8px; padding: 12px; background: var(--surface); border-radius: var(--radius); }
.subfields.is-open { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.subfield__label {
  display: block;
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 4px;
}
.subfield__input {
  width: 100%;
  font: inherit;
  font-size: 13px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
}
.subfield__input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 2px rgba(12,12,12,0.08); }
.field__input[readonly] { background: var(--surface); color: var(--ink-muted); }

.link-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 0;
  padding: 4px 0;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-toggle:hover { color: var(--accent-hover); }

/* подсказка под полем «На руки» */
.field__live {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-muted);
}
.field__live strong { color: var(--ink); font-weight: 600; }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 12px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.toggle__caret {
  width: 10px; height: 10px;
  border-right: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
  transform: rotate(-45deg);
  transition: transform 150ms ease;
}
.toggle[aria-expanded="true"] .toggle__caret { transform: rotate(45deg); }
.collapse { display: none; }
.collapse.is-open { display: block; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  padding: 14px 22px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  background: var(--accent);
  color: #fff;
  transition: background 120ms ease, color 120ms ease;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: #fff; }
.btn--block { display: flex; width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.result__placeholder {
  color: var(--ink-muted);
  font-size: 13px;
  padding: 40px 0;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.metric { padding: 14px 0; border-bottom: 1px solid var(--line); }
.metric:last-of-type { border-bottom: 0; }
.metric__label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.metric__value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.metric--hero { padding: 4px 0 18px; }
.metric--hero .metric__value { font-size: 34px; }

.note {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--surface);
  border-left: 3px solid var(--ink);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 13.5px;
  line-height: 1.5;
}

.cta-row { margin-top: 20px; }

.lead-form { display: none; margin-top: 20px; }
.lead-form.is-open { display: block; }
.lead-form__row { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 600px) {
  .lead-form__row { grid-template-columns: 1fr 1fr; }
}
.lead-form .field { margin-bottom: 0; }
.lead-form__hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.status {
  font-size: 13px;
  margin-top: 12px;
  min-height: 18px;
}
.status--err { color: var(--error); }
.status--ok { color: var(--success); }

.footer {
  margin-top: 32px;
  font-size: 12px;
  color: var(--ink-muted);
}

.wrap--embed .h-title { font-size: 22px; }
.wrap--embed .metric--hero .metric__value { font-size: 28px; }

/* ── Popup embed overrides ───────────────────────────────────────────── */
.wrap--embed {
  max-width: 720px;
  padding: 16px 16px 20px;
}
.wrap--embed .h-sub {
  font-size: 14px;
  margin: 0 0 16px;
  max-width: none;
}
/* Always single column inside popup — override the 880px two-col grid */
main.wrap--embed .grid {
  grid-template-columns: 1fr;
  gap: 16px;
}
main.wrap--embed .card {
  padding: 18px;
}
main.wrap--embed .card + .card {
  margin-top: 0;
}
main.wrap--embed .metric {
  padding: 12px 0;
}
/* Narrow popups: stack overhead sub-fields and lead-form fields */
main.wrap--embed .subfields.is-open {
  grid-template-columns: 1fr;
}
main.wrap--embed .lead-form__row {
  grid-template-columns: 1fr;
}
@media (min-width: 560px) {
  main.wrap--embed .subfields.is-open {
    grid-template-columns: 1fr 1fr;
  }
  main.wrap--embed .lead-form__row {
    grid-template-columns: 1fr 1fr;
  }
}
