/* Встроенный калькулятор в CRM — стиль vk-block */
.admin-calc-inline {
  width: 100%;
  margin-top: 0.75rem;
}
.admin-calc-inline .calc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 0.85rem;
  align-items: start;
  width: 100%;
}
.admin-calc-inline .form-card,
.admin-calc-inline .calc-form-card {
  background: #fff;
  border: 1px solid #e4ebf2;
  border-radius: 12px;
  padding: 0.95rem 1.05rem;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  max-width: none;
  margin: 0;
}
.admin-calc-inline .calc-form-card h3,
.admin-calc-inline .calc-form-card .vk-block__title {
  margin: 1.15rem 0 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7c93;
}
.admin-calc-inline .calc-form-card h3:first-child,
.admin-calc-inline .calc-form-card .vk-block__title:first-child {
  margin-top: 0;
}
.admin-calc-inline .field {
  margin-bottom: 0.75rem;
}
.admin-calc-inline .field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7c93;
  margin-bottom: 0.3rem;
}
.admin-calc-inline .field input,
.admin-calc-inline .field select,
.admin-calc-inline .calc-share-box input,
.admin-calc-inline .calc-share-panel input {
  width: 100%;
  padding: 0.58rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  color: #0f172a;
  background: #f8fafc;
  min-height: 42px;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.admin-calc-inline .field select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2rem;
  cursor: pointer;
  background: #f8fafc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E") no-repeat right 0.7rem center;
}
.admin-calc-inline .field input:hover,
.admin-calc-inline .field select:hover,
.admin-calc-inline .calc-share-box input:hover,
.admin-calc-inline .calc-share-panel input:hover {
  border-color: #cbd5e1;
  background-color: #fff;
}
.admin-calc-inline .field select:hover {
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
}
.admin-calc-inline .field input:focus,
.admin-calc-inline .field select:focus,
.admin-calc-inline .calc-share-box input:focus,
.admin-calc-inline .calc-share-panel input:focus {
  outline: none;
  border-color: #93c5fd;
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
.admin-calc-inline .field select:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
}
.admin-calc-inline .field-row,
.admin-calc-inline .calc-site-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 0.75rem;
}
.admin-calc-inline .checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.4rem 0;
  font-size: 0.9rem;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  color: #0f172a;
}
.admin-calc-inline .form-error {
  color: #b91c1c;
  font-size: 0.88rem;
  margin: 0.5rem 0;
}
.admin-calc-inline .calc-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.admin-calc-inline .calc-result {
  position: sticky;
  top: 1rem;
  background: #fff;
  border: 1px solid #e4ebf2;
  border-radius: 12px;
  padding: 0.95rem 1.05rem;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  min-height: 220px;
}
.admin-calc-inline .calc-result__empty p {
  margin: 0;
  color: #64748b;
  font-size: 0.92rem;
  line-height: 1.5;
}
.admin-calc-inline .calc-result__badge {
  display: inline-block;
  margin: 0 0 0.5rem;
  padding: 0.25rem 0.55rem;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.admin-calc-inline .calc-result__body h3 {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
  font-weight: 600;
  color: #0f172a;
  font-family: inherit;
}
.admin-calc-inline .calc-result__price {
  font-family: inherit;
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  font-weight: 700;
  color: #0f172a;
}
.admin-calc-inline .calc-result__totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 0.85rem 0;
}
.admin-calc-inline .calc-stat {
  padding: 0.65rem 0.75rem;
  background: #f8fafc;
  border: 1px solid #e4ebf2;
  border-radius: 10px;
}
.admin-calc-inline .calc-stat span {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7c93;
  margin-bottom: 0.2rem;
}
.admin-calc-inline .calc-stat strong {
  font-size: 0.95rem;
}
.admin-calc-inline .calc-share-panel {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid #eef2f6;
}
.admin-calc-inline .calc-share-box__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.admin-calc-inline .calc-share-box__row input {
  flex: 1;
  min-width: 12rem;
}
@media (max-width: 960px) {
  .admin-calc-inline .calc-layout {
    grid-template-columns: 1fr;
  }
  .admin-calc-inline .calc-result {
    position: static;
  }
  .admin-calc-inline .field-row,
  .admin-calc-inline .calc-site-grid {
    grid-template-columns: 1fr;
  }
  .admin-calc-inline .calc-result__totals {
    grid-template-columns: 1fr;
  }
}

/* Гостевой блюр позиций на /calc */
.calc-lock-wrap {
  position: relative;
  margin-top: 1rem;
}
.calc-lock-wrap.is-locked .calc-lock-blur {
  filter: blur(7px);
  user-select: none;
  pointer-events: none;
  max-height: 220px;
  overflow: hidden;
}
.calc-lock-note {
  margin-top: 0.85rem;
  padding: 0.9rem 1rem;
  background: #f0f7fc;
  border: 1px solid #cfe3f5;
  border-radius: 10px;
}
.calc-lock-note p {
  margin: 0 0 0.65rem;
  font-size: 0.92rem;
  color: var(--navy, #1a2b3c);
}
.calc-lock-note__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.calc-result__saved {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  color: #166534;
}
.calc-result__saved a {
  color: #166534;
  font-weight: 600;
}

.calc-dynamic-fields {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.calc-algo__card h2 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--navy);
}

.calc-algo__steps {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.calc-algo__steps li + li {
  margin-top: 0.35rem;
}

.calc-algo__formula {
  margin: 0;
  padding: 0.85rem 1rem;
  background: var(--accent-soft);
  border-radius: var(--radius);
  color: var(--navy);
  font-size: 0.88rem;
  font-weight: 600;
  overflow-x: auto;
}

.calc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 1.5rem;
  align-items: start;
}

.calc-form-card h3 {
  margin: 1.5rem 0 0.85rem;
  font-size: 1.05rem;
  color: var(--navy);
}

.calc-form-card h3:first-child {
  margin-top: 0;
}

.calc-actions {
  position: static;
  margin: 1.5rem 0 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.calc-result {
  position: sticky;
  top: 5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.4rem;
  box-shadow: var(--shadow-lg);
  min-height: 280px;
}

.calc-result__empty h3 {
  margin: 0 0 0.5rem;
  color: var(--navy);
}

.calc-result__empty p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.calc-result__badge {
  display: inline-block;
  margin: 0 0 0.5rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.calc-result__body h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  color: var(--navy);
}

.calc-result__scope {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.calc-result__price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.03em;
}

.calc-result__price small {
  font-size: 1rem;
  color: var(--text-muted);
}

.calc-result__sep {
  color: var(--text-muted);
  font-weight: 600;
}

.calc-result__note {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.calc-result__totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.calc-stat {
  padding: 0.65rem 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.calc-stat span {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.calc-stat strong {
  font-size: 0.95rem;
  color: var(--navy);
}

.calc-result__body h4 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--navy);
}

.calc-table-wrap {
  overflow-x: auto;
  margin-bottom: 1.15rem;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.calc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.calc-table th,
.calc-table td {
  padding: 0.55rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.calc-table th {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-weight: 600;
}

.calc-table tr:last-child td {
  border-bottom: none;
}

.calc-table td:nth-child(2),
.calc-table td:nth-child(3),
.calc-table td:nth-child(4),
.calc-table th:nth-child(2),
.calc-table th:nth-child(3),
.calc-table th:nth-child(4) {
  text-align: right;
  white-space: nowrap;
}

.calc-table--editable .calc-edit-input {
  width: 100%;
  min-width: 0;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
  color: inherit;
}

.calc-table--editable .calc-edit-qty {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  justify-content: flex-end;
}

.calc-table--editable .calc-edit-input[data-edit-qty] {
  width: 5.5rem;
}

.calc-table--editable .calc-edit-input--unit {
  width: 3.2rem;
  text-align: center;
}

.calc-table--editable td:last-child,
.calc-table--editable th:last-child {
  width: 2.5rem;
  text-align: center;
}

.calc-section > [data-add-line] {
  margin: -0.5rem 0 1rem;
}

.calc-excel-bar {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--border, #d7e2ee);
}

.calc-excel-bar__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.calc-factors {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.calc-factors li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.calc-factors li strong {
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

.calc-result__disclaimer {
  margin: 0 0 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.calc-result__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.calc-result__cta .btn {
  flex: 1 1 auto;
  text-align: center;
  justify-content: center;
}

.calc-share-box {
  margin: 0.85rem 0 0;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
}

.calc-share-box label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--navy);
}

.calc-share-box__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.calc-share-box__row input {
  flex: 1 1 160px;
  min-width: 0;
  font-size: 0.8rem;
}

.calc-share-panel {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-elevated);
}

.calc-share-panel__title {
  margin: 0 0 0.35rem;
  font-weight: 700;
  color: var(--navy);
}

.calc-share-panel__hint {
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.calc-share-panel__actions {
  margin-bottom: 0.85rem;
}

.calc-share-panel__email label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--navy);
}

.calc-share-ok {
  margin: 0.65rem 0 0;
  color: #15803d;
  font-size: 0.85rem;
  font-weight: 600;
}

.calc-section {
  margin: 0 0 1.15rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
}

.calc-section__head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin: 0.85rem 0 0.55rem;
}

.calc-section__head h4 {
  margin: 0;
}

.calc-section__head p {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.calc-section__head strong {
  white-space: nowrap;
  color: var(--navy);
}

.calc-section-group__title {
  margin: 0.65rem 0 0.35rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.calc-table tfoot td {
  font-weight: 600;
  background: var(--bg-elevated);
}

/* Публичная ссылка /calculator/estimate/{code} */
.calc-share-page .calc-result__badge {
  margin-bottom: 0.65rem;
}

.calc-share-section {
  margin: 1.25rem 0;
  padding: 1rem 0 0;
  border-top: 1px solid #dce8f2;
}

.calc-share-section__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  align-items: baseline;
  margin-bottom: 0.75rem;
}

.calc-share-section__head h2 {
  margin: 0;
  font-size: 1.15rem;
  color: #1a2b3c;
}

.calc-share-section__head p {
  margin: 0;
  flex: 1 1 100%;
  font-size: 0.82rem;
  color: #5a7189;
}

.calc-share-section__head strong {
  font-size: 1.05rem;
  color: #3d8fd4;
}

.calc-share-group__title {
  margin: 0.75rem 0 0.4rem;
  font-size: 0.92rem;
  color: #1a2b3c;
}

.calc-share-cards {
  display: none;
}

@media (max-width: 768px) {
  .calc-share-page .estimate-table-wrap--desktop {
    display: none;
  }

  .calc-share-cards {
    display: grid;
    gap: 0.65rem;
  }
}

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

  .calc-result {
    position: static;
  }
}

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

  .calc-algo__card {
    padding: 1.15rem;
  }
}

/* --- public lock --- */
.calc-lock-wrap { position: relative; margin-top: 1rem; }
.calc-lock-wrap.is-locked .calc-lock-blur {
  filter: blur(7px);
  user-select: none;
  pointer-events: none;
  max-height: 220px;
  overflow: hidden;
}
.calc-lock-note {
  margin-top: 0.85rem;
  padding: 0.9rem 1rem;
  background: #f0f7fc;
  border: 1px solid #cfe3f5;
  border-radius: 10px;
}
.calc-lock-note p {
  margin: 0 0 0.65rem;
  font-size: 0.92rem;
  color: var(--navy, #1a2b3c);
}
.calc-lock-note__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.calc-result__saved {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  color: #166534;
}
.calc-result__saved a { color: #166534; font-weight: 600; }
