.mcc-calculator {
  --mcc-ink: #171a1f;
  --mcc-muted: #626a75;
  --mcc-line: #d9dde3;
  --mcc-paper: #ffffff;
  --mcc-soft: #f4f5f7;
  --mcc-accent: #ff6b2c;
  --mcc-accent-dark: #d9480f;
  color: var(--mcc-ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 28px auto;
  max-width: 1080px;
}

.mcc-calculator * { box-sizing: border-box; }
.mcc-calculator [hidden] { display: none !important; }

.mcc-shell {
  background: var(--mcc-paper);
  border: 1px solid var(--mcc-line);
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(23, 26, 31, .1);
  overflow: hidden;
}

.mcc-header {
  align-items: flex-start;
  background: var(--mcc-ink);
  color: #fff;
  display: flex;
  gap: 32px;
  justify-content: space-between;
  padding: clamp(28px, 5vw, 52px);
}

.mcc-eyebrow {
  color: var(--mcc-accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  margin: 0 0 10px;
  text-transform: uppercase;
}

.mcc-header h2 {
  color: #fff;
  font-size: clamp(30px, 5vw, 50px);
  letter-spacing: -.04em;
  line-height: 1.02;
  margin: 0;
  max-width: 740px;
}

.mcc-lead {
  color: #c9ced6;
  font-size: 17px;
  line-height: 1.55;
  margin: 18px 0 0;
  max-width: 760px;
}

.mcc-format-badge { display: flex; gap: 7px; }
.mcc-format-badge span {
  border: 1px solid #4a505a;
  border-radius: 7px;
  color: #dce0e6;
  font-size: 11px;
  font-weight: 800;
  padding: 7px 8px;
}

.mcc-system-message {
  background: #fff7ed;
  border-bottom: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 13px;
  padding: 11px clamp(24px, 5vw, 52px);
}
.mcc-system-message[data-state="ready"] { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.mcc-system-message[data-state="error"] { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

.mcc-form { padding: clamp(26px, 5vw, 52px); }

.mcc-rows { display: grid; gap: 22px; }
.mcc-row { background: var(--mcc-soft); border: 1px solid var(--mcc-line); border-radius: 16px; padding: 22px; }
.mcc-row-head { align-items: center; display: flex; justify-content: space-between; margin-bottom: 16px; }
.mcc-row-number { font-size: 14px; font-weight: 800; }
.mcc-row-remove {
  background: transparent;
  border: 1px solid var(--mcc-line);
  border-radius: 8px;
  color: var(--mcc-muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  padding: 6px 12px;
}
.mcc-row-remove:hover:not(:disabled) { border-color: #f87171; color: #b91c1c; }
.mcc-row-remove:disabled { cursor: not-allowed; opacity: .4; }

.mcc-row-error { background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; color: #991b1b; margin-top: 16px; padding: 12px 14px; }

.mcc-row-result { background: #fff; border: 1px solid var(--mcc-line); border-radius: 12px; margin-top: 16px; padding: 16px 18px; }
.mcc-row-result-file { font-weight: 750; margin-bottom: 10px; overflow-wrap: anywhere; }
.mcc-row-result-metrics { color: var(--mcc-muted); display: flex; flex-wrap: wrap; font-size: 13px; gap: 6px 18px; }
.mcc-row-result-breakdown { border-top: 1px dashed var(--mcc-line); color: var(--mcc-muted); display: flex; flex-wrap: wrap; font-size: 13px; gap: 6px 18px; margin-top: 12px; padding-top: 12px; }
.mcc-row-result-cost { color: var(--mcc-accent-dark); font-size: 20px; font-weight: 800; margin-top: 10px; }
.mcc-row-result-review { color: #9a3412; font-size: 13px; font-weight: 700; margin-top: 10px; }
.mcc-row-result-warnings { color: #854d0e; font-size: 12px; margin: 10px 0 0; padding-left: 18px; }
.mcc-row-result-warnings li + li { margin-top: 4px; }

.mcc-row-actions { margin-top: 18px; }
.mcc-add-row {
  background: #fff;
  border: 1.5px dashed #aeb4bd;
  border-radius: 11px;
  color: var(--mcc-ink);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  padding: 13px 20px;
  width: 100%;
}
.mcc-add-row:hover:not(:disabled) { background: #fff7ed; border-color: var(--mcc-accent); }
.mcc-add-row:disabled { cursor: not-allowed; opacity: .5; }

.mcc-fields {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.mcc-field { display: grid; gap: 8px; }
.mcc-field > span { font-size: 13px; font-weight: 750; }
.mcc-field select,
.mcc-field input {
  appearance: none;
  background: #fff;
  border: 1px solid var(--mcc-line);
  border-radius: 10px;
  color: var(--mcc-ink);
  font: inherit;
  height: 48px;
  min-width: 0;
  padding: 0 14px;
  width: 100%;
}
.mcc-field select { background-image: linear-gradient(45deg, transparent 50%, #737b87 50%), linear-gradient(135deg, #737b87 50%, transparent 50%); background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px; background-repeat: no-repeat; background-size: 5px 5px, 5px 5px; padding-right: 34px; }
.mcc-field select:focus,
.mcc-field input:focus,
.mcc-upload-label:focus-within { border-color: var(--mcc-accent); box-shadow: 0 0 0 3px rgba(255, 107, 44, .16); outline: none; }
.mcc-field select:disabled { background-color: #f3f4f6; color: #9ca3af; }

.mcc-upload { margin-top: 26px; position: relative; }
.mcc-file-input { height: 1px; left: 50%; opacity: 0; position: absolute; top: 50%; width: 1px; }
.mcc-upload-label {
  align-items: center;
  background: var(--mcc-soft);
  border: 1.5px dashed #aeb4bd;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 180px;
  padding: 28px;
  text-align: center;
  transition: .2s ease;
}
.mcc-upload-label:hover,
.mcc-upload.is-dragging .mcc-upload-label { background: #fff7ed; border-color: var(--mcc-accent); }
.mcc-upload.has-file .mcc-upload-label { background: #f0fdf4; border-color: #4ade80; }
.mcc-upload-icon {
  align-items: center;
  background: var(--mcc-ink);
  border-radius: 50%;
  color: #fff;
  display: flex;
  font-size: 25px;
  height: 44px;
  justify-content: center;
  margin-bottom: 13px;
  width: 44px;
}
.mcc-upload-label strong { font-size: 17px; }
.mcc-upload-label > span:last-child { color: var(--mcc-muted); font-size: 13px; margin-top: 5px; }

.mcc-trust-row { color: var(--mcc-muted); display: flex; flex-wrap: wrap; font-size: 12px; gap: 12px 24px; margin: 16px 2px 24px; }
.mcc-trust-row span::before { color: #16a34a; content: "✓"; font-weight: 900; margin-right: 6px; }

.mcc-submit {
  align-items: center;
  background: var(--mcc-accent);
  border: 0;
  border-radius: 11px;
  color: #fff;
  cursor: pointer;
  display: flex;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  gap: 10px;
  justify-content: center;
  min-height: 52px;
  padding: 12px 28px;
  width: 100%;
}
.mcc-submit:hover:not(:disabled) { background: var(--mcc-accent-dark); }
.mcc-submit:disabled { background: #c9cdd3; cursor: not-allowed; }
.mcc-spinner { border: 2px solid rgba(255,255,255,.35); border-radius: 50%; border-top-color: #fff; display: none; height: 18px; width: 18px; }
.mcc-form.is-loading .mcc-spinner { animation: mcc-spin .8s linear infinite; display: block; }
@keyframes mcc-spin { to { transform: rotate(360deg); } }

.mcc-error { background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; color: #991b1b; margin: 0 clamp(26px, 5vw, 52px) 32px; padding: 14px 16px; }

.mcc-results { border-top: 1px solid var(--mcc-line); padding: clamp(28px, 5vw, 52px); }
.mcc-result-heading { align-items: center; display: flex; gap: 20px; justify-content: space-between; }
.mcc-result-heading h3 { font-size: clamp(21px, 3vw, 28px); margin: 0; overflow-wrap: anywhere; }
.mcc-secure { background: #dcfce7; border-radius: 999px; color: #166534; font-size: 12px; font-weight: 750; padding: 8px 12px; white-space: nowrap; }
.mcc-metrics { display: grid; gap: 1px; grid-template-columns: repeat(3, 1fr); margin-top: 28px; overflow: hidden; border: 1px solid var(--mcc-line); border-radius: 13px; background: var(--mcc-line); }
.mcc-metrics > div { background: #fff; min-width: 0; padding: 20px; }
.mcc-metrics span,
.mcc-breakdown span { color: var(--mcc-muted); display: block; font-size: 12px; margin-bottom: 6px; }
.mcc-metrics strong { display: block; font-size: 20px; overflow-wrap: anywhere; }
.mcc-warnings { background: #fffbeb; border: 1px solid #fde68a; border-radius: 11px; color: #854d0e; margin-top: 20px; padding: 13px 18px; }
.mcc-warnings ul { margin: 0; padding-left: 18px; }
.mcc-warnings li + li { margin-top: 5px; }

.mcc-quote { align-items: stretch; background: var(--mcc-ink); border-radius: 15px; color: #fff; display: grid; gap: 34px; grid-template-columns: 1fr 1fr; margin-top: 24px; padding: 28px; }
.mcc-breakdown { display: grid; gap: 15px 24px; grid-template-columns: 1fr 1fr; }
.mcc-breakdown span { color: #aeb4bd; }
.mcc-breakdown strong { font-size: 17px; }
.mcc-total { border-left: 1px solid #3d434c; display: flex; flex-direction: column; justify-content: center; padding-left: 34px; }
.mcc-total > span { color: #c9ced6; font-size: 13px; }
.mcc-total > strong { color: #fff; font-size: clamp(32px, 5vw, 48px); letter-spacing: -.04em; margin: 3px 0 7px; }
.mcc-total small { color: #979fa9; line-height: 1.45; }
.mcc-manual-review { background: #fff7ed; border: 1px solid #fdba74; border-radius: 13px; color: #9a3412; margin-top: 24px; padding: 22px; }
.mcc-manual-review strong { font-size: 18px; }
.mcc-manual-review p { margin: 7px 0 0; }

.mcc-request { background: var(--mcc-soft); border: 1px solid var(--mcc-line); border-radius: 15px; margin-top: 28px; padding: 28px; }
.mcc-request h3 { margin: 0 0 8px; }
.mcc-request > p { color: var(--mcc-muted); margin: 0 0 20px; }
.mcc-request .mcc-fields { margin-bottom: 18px; }
.mcc-request textarea {
  background: #fff;
  border: 1px solid var(--mcc-line);
  border-radius: 10px;
  color: var(--mcc-ink);
  font: inherit;
  min-height: 90px;
  padding: 12px 14px;
  resize: vertical;
  width: 100%;
}
.mcc-request .mcc-submit { margin-top: 18px; width: auto; min-width: 220px; }
.mcc-request.is-sent .mcc-fields,
.mcc-request.is-sent textarea,
.mcc-request.is-sent .mcc-extras,
.mcc-request.is-sent .mcc-submit { opacity: .5; pointer-events: none; }
.mcc-request-status { border-radius: 10px; font-size: 14px; margin-top: 14px; padding: 12px 16px; }
.mcc-request-hint { color: var(--mcc-muted); font-size: 13px; margin: -8px 0 16px; }
.mcc-extras { border: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0 0 18px; padding: 0; }
.mcc-extras legend { font-weight: 700; margin-bottom: 8px; padding: 0; width: 100%; }
.mcc-extras label { align-items: center; cursor: pointer; display: inline-flex; gap: 6px; }
.mcc-extras input { height: 18px; margin: 0; width: 18px; }
.mcc-alt { color: var(--mcc-muted); font-size: 14px; margin: -12px 2px 20px; }
.mcc-alt a { font-weight: 700; }
.mcc-request-status[data-state="success"] { background: #f0fdf4; color: #166534; }
.mcc-request-status[data-state="error"] { background: #fef2f2; color: #991b1b; }

@media (max-width: 840px) {
  .mcc-fields { grid-template-columns: 1fr 1fr; }
  .mcc-metrics { grid-template-columns: repeat(2, 1fr); }
  .mcc-quote { grid-template-columns: 1fr; }
  .mcc-total { border-left: 0; border-top: 1px solid #3d434c; padding: 24px 0 0; }
}

@media (max-width: 560px) {
  .mcc-calculator { margin: 12px auto; }
  .mcc-shell { border-radius: 14px; }
  .mcc-header { display: block; }
  .mcc-format-badge { margin-top: 22px; }
  .mcc-fields { grid-template-columns: 1fr; }
  .mcc-result-heading { align-items: flex-start; flex-direction: column; }
  .mcc-metrics { grid-template-columns: 1fr 1fr; }
  .mcc-breakdown { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .mcc-calculator *, .mcc-calculator *::before, .mcc-calculator *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Совместная раскладка деталей одной толщины (1.6.0) */
.mcc-row-result-shared {
  background: #f0f9f2;
  border-radius: 8px;
  color: #1c6b3a;
  font-size: 13px;
  margin-top: 10px;
  padding: 8px 12px;
}

.mcc-groups { border-top: 1px solid var(--mcc-line); margin-top: 22px; padding-top: 20px; }
.mcc-groups-title { color: var(--mcc-muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; margin: 0 0 12px; text-transform: uppercase; }
.mcc-groups-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); list-style: none; margin: 0; padding: 0; }

.mcc-group {
  background: var(--mcc-soft);
  border: 1px solid var(--mcc-line);
  border-radius: 12px;
  padding: 14px 16px;
}

.mcc-group.is-shared { background: #f0f9f2; border-color: #bfe3cb; }
.mcc-group-title { font-size: 14px; font-weight: 700; }
.mcc-group-facts { color: var(--mcc-muted); display: flex; flex-wrap: wrap; font-size: 12px; gap: 4px 14px; margin-top: 8px; }
.mcc-group-note { color: #1c6b3a; font-size: 12px; margin-top: 8px; }
.mcc-group.has-layout { grid-column: 1 / -1; }

.mcc-layout { margin-top: 12px; }
.mcc-sheets { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.mcc-sheet { margin: 0; min-width: 0; }
.mcc-sheet svg { display: block; height: auto; width: 100%; }
.mcc-sheet svg * { vector-effect: non-scaling-stroke; }
.mcc-sheet-rest { fill: #fff; }
.mcc-sheet-used { fill: #e3e6ea; }
.mcc-sheet-part { stroke: rgba(23, 26, 31, .45); stroke-width: .5; }
.mcc-sheet-cut { stroke: var(--mcc-accent-dark); stroke-dasharray: 4 3; stroke-width: 1.5; }
.mcc-sheet-edge { fill: none; stroke: #9aa2ad; stroke-width: 1; }
.mcc-sheet figcaption { color: var(--mcc-muted); font-size: 12px; margin-top: 4px; }
.mcc-layout-legend { display: flex; flex-wrap: wrap; font-size: 12px; gap: 4px 14px; list-style: none; margin: 10px 0 0; padding: 0; }
.mcc-layout-legend li { align-items: center; display: flex; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.mcc-layout-legend i { border: 1px solid rgba(23, 26, 31, .35); border-radius: 3px; flex: none; height: 12px; width: 12px; }
.mcc-layout-note { color: var(--mcc-muted); font-size: 12px; margin: 8px 0 0; }

.mcc-groups-saving {
  color: #1c6b3a;
  font-size: 13px;
  font-weight: 600;
  margin: 14px 0 0;
}

.mcc-consent { align-items: flex-start; display: flex; font-size: 13px; gap: 10px; margin-top: 18px; }
.mcc-consent input { flex: none; height: 18px; margin-top: 2px; width: 18px; }
.mcc-consent a { color: var(--mcc-accent-dark); }
