/* Калькулятор в стиле SpaceMETALL: палитра и типографика как на сайте */
:root {
  --surface: #f0f3f8;
  --card: #ffffff;
  --input-bg: #ffffff;
  --input-bg-soft: #f0f3f8;
  --border: rgba(5, 28, 63, 0.1);
  --border-strong: rgba(5, 28, 63, 0.16);
  --text: #051c3f;
  --text-muted: #5c6b7f;
  --navy-mid: #0a2d5c;
  --accent: #ff1b45;
  --accent-hover: #ff3358;
  --accent-soft: rgba(255, 27, 69, 0.08);
  --navy-soft: rgba(5, 28, 63, 0.05);
  --shadow-card: 0 1px 2px rgba(5, 28, 63, 0.04), 0 0 0 1px rgba(5, 28, 63, 0.06);
  --radius: 12px;
  --radius-lg: 16px;
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: transparent;
  -webkit-font-smoothing: antialiased;
}

body.embed-body {
  background: var(--surface);
  padding: 0;
  box-sizing: border-box;
}

.embed-root {
  padding: 0.75rem 0.75rem 1rem;
  box-sizing: border-box;
}

@media (min-width: 640px) {
  .embed-root {
    padding: 1rem 1rem 1.25rem;
  }
}

.embed-header {
  margin: 0 0 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.embed-logo {
  display: inline-flex;
  align-items: stretch;
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: clamp(1.15rem, 4.2vw, 1.4rem);
  letter-spacing: -0.03em;
  text-transform: uppercase;
  line-height: 1;
  user-select: none;
}

.embed-logo-box {
  display: flex;
  align-items: center;
  border: 0.09em solid var(--accent);
  padding: 0.24em 0.44em;
  color: var(--text);
  border-radius: 2px;
}

.embed-logo-red {
  display: flex;
  align-items: center;
  padding-left: 0.32em;
  color: var(--accent);
}

.embed-logo-sub {
  margin: 0.55rem 0 0;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.header {
  display: none;
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
}

.logo {
  display: block;
  text-decoration: none;
  width: 100%;
}

.logo:hover {
  opacity: 0.9;
}

.logo-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 56px;
  object-fit: contain;
  object-position: left center;
}

.tagline {
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.main {
  max-width: none;
  width: 100%;
  margin: 0 auto;
  padding: 0;
  box-sizing: border-box;
}

/* последняя карточка — без лишнего отступа снизу (убирает «пустоту» под iframe) */
.main > section:last-child {
  margin-bottom: 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1rem, 3vw, 1.35rem);
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow-card);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.card-title {
  margin: 0 0 1.1rem;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
}

.card-title--small {
  font-size: 1.05rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
  color: var(--text);
}

.form-row {
  margin-bottom: 1rem;
}

.label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.metal-tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.metal-tabs input[type='radio'] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.metal-tabs label {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.65rem;
  background: var(--input-bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: clamp(0.8rem, 2.8vw, 0.9rem);
  color: var(--text);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.metal-tabs input:checked + label {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 600;
}

.metal-tabs label:hover {
  border-color: rgba(255, 27, 69, 0.45);
  background: var(--navy-soft);
}

.calc-mode-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.calc-mode-tabs input[type='radio'] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.calc-mode-tabs label {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.85rem;
  background: var(--input-bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}

.calc-mode-tabs input:checked + label {
  border-color: var(--navy-mid);
  background: rgba(10, 45, 92, 0.08);
  font-weight: 600;
}

.calc-mode-tabs label:hover {
  border-color: var(--navy-mid);
}

.select {
  width: 100%;
  max-width: none;
  padding: 0.6rem 0.85rem;
  font-size: 1rem;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235c6b7f' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 27, 69, 0.12);
}

.params {
  margin-bottom: 1rem;
}

.param-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.param-row label {
  min-width: 140px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.param-row input {
  width: 120px;
  padding: 0.5rem 0.65rem;
  font-size: 1rem;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.param-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 27, 69, 0.12);
}

.param-row .unit {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.actions {
  margin-top: 1.25rem;
  margin-bottom: 0;
}

.btn {
  display: inline-block;
  padding: 0.65rem 1.35rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  box-shadow: 0 4px 14px rgba(255, 27, 69, 0.28);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.result {
  margin-top: 1.25rem;
  padding: 1rem 1.1rem;
  background: var(--input-bg-soft);
  border-radius: var(--radius);
  border-left: 4px solid var(--navy-mid);
  font-size: 1.1rem;
  min-height: 1.5em;
}

.result.has-value {
  border-left-color: var(--accent);
  background: rgba(255, 27, 69, 0.05);
}

.result .weight {
  font-weight: 700;
  color: var(--accent);
}

.hint {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.history-section {
  margin-top: 0.5rem;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.history-list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.history-list li:last-child {
  border-bottom: none;
}

.history-list li.history-empty {
  font-style: italic;
  color: var(--text-muted);
}

.history-list .history-weight {
  font-weight: 600;
  color: var(--accent);
}

.history-list .history-extra {
  color: var(--text-muted);
  font-size: 0.85em;
  font-weight: normal;
}

.request-row {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.request-row .card-title--small {
  margin-bottom: 0.75rem;
}

.request-choices {
  margin-top: 0;
  padding: 1rem 1.1rem;
  background: var(--input-bg-soft);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 4px solid var(--navy-mid);
}

.request-choices-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.request-choices-buttons .btn-mail,
.request-choices-buttons .btn-mail-copy {
  flex: 1 1 auto;
  min-width: min(100%, 8.5rem);
  text-align: center;
}

.request-choices-buttons .btn-primary {
  flex: 1 1 auto;
  min-width: min(100%, 8.5rem);
}

.btn-embed-zayavka {
  padding: 0.5rem 0.9rem;
  font-size: 0.875rem;
  line-height: 1.3;
}

.request-inline-mail {
  color: var(--navy-mid);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.request-inline-mail:hover {
  color: var(--accent);
}

.request-choices-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.request-choices-buttons a.btn-mail {
  text-decoration: none;
  display: inline-block;
  box-sizing: border-box;
}

.btn-mail {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-mail-icon {
  flex-shrink: 0;
  display: block;
  width: 22px;
  height: 22px;
  object-fit: contain;
}


.btn-mail:hover {
  background: var(--navy-soft);
  border-color: var(--navy-mid);
  color: var(--navy-mid);
}

.btn-mail-copy {
  background: var(--card);
  color: var(--text-muted);
  border-color: var(--border);
}

.btn-mail-copy:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.footer {
  display: none;
}

.footer a {
  color: var(--navy-mid);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

.footer-sep {
  margin: 0 0.5rem;
}

@media (max-width: 600px) {
  .main {
    padding: 0;
  }

  .card-title {
    font-size: 1.1rem;
  }

  .param-row label {
    min-width: 100%;
  }

  .param-row input {
    width: 100%;
    max-width: none;
  }

  .calc-mode-tabs,
  .metal-tabs {
    gap: 0.35rem;
  }

  .calc-mode-tabs label {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
  }

  .actions .btn-primary {
    width: 100%;
    text-align: center;
  }

  .request-choices-buttons--pair {
    flex-direction: column;
  }

  .request-choices-buttons--pair .btn-mail,
  .request-choices-buttons--pair .btn-primary {
    width: 100%;
    max-width: none;
  }
}
