/* KROFI 1.5: три коротких шага и навигация вне прокручиваемой области. */
:root { --calc-viewport-gap: 132px; }
#calculator .section-top { margin-bottom: 24px; }
#top #calculator .section-description { max-width: 780px; }
.calc-panel {
  display: flex;
  flex-direction: column;
  height: min(620px, calc(100vh - var(--calc-viewport-gap)));
  height: min(620px, calc(100svh - var(--calc-viewport-gap)));
  min-height: 0;
  padding: 0;
  overflow: hidden;
  scroll-margin-top: 8px;
}
.calc-panel .step-progress {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 13px 28px;
  border-bottom: 1px solid #e5e4dc;
  background: #f8f7f3;
  gap: 16px;
}
.calc-panel .step-progress::before, .calc-panel .step-progress::after { display: none; }
.calc-panel .step-progress li { width: auto; text-align: left; }
.calc-panel .step-progress button { flex-direction: row; align-items: center; gap: 9px; }
#top .calc-panel .step-progress button > span { width: 29px; height: 29px; font-size: 15px; }
#top .calc-panel .step-progress strong { display: block; position: static; transform: none; color: #4d5860; font-size: 16px; line-height: 1.4; }
#top .calc-panel .step-progress .current strong { color: var(--terra); }
.calc-panel .calc-main { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.calc-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 23px 28px; scrollbar-gutter: stable; scroll-padding-block: 10px; }
.calc-panel .question-heading { display: flex; flex-direction: row; align-items: flex-start; margin-bottom: 8px; gap: 18px; }
#top .calc-panel .question-heading h3 { font-size: 28px; line-height: 1.3; }
#top .calc-panel .question-help { margin-bottom: 16px; font-size: 16px; line-height: 1.5; }
.calc-panel .task-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.calc-panel .task-choice { display: flex; flex-direction: column; min-width: 0; padding: 0; text-align: left; border-color: #b2bcb8; border-radius: 10px; background: #fff; }
.calc-panel .task-photo { height: 94px; width: 100%; min-height: 0; }
.calc-panel .choice-caption { display: flex; align-items: center; justify-content: space-between; padding: 11px 13px; gap: 8px; flex: 1; min-height: 50px; }
#top .calc-panel .choice-caption strong { font-size: 18px; line-height: 1.35; font-weight: 650; overflow-wrap: normal; }
.calc-choice-check { display: flex; align-items: center; justify-content: center; width: 21px; height: 21px; flex-shrink: 0; border: 1px solid #a3afa7; border-radius: 50%; color: transparent; background: #fff; }
.selected .calc-choice-check { color: #fff; background: var(--terra); border-color: var(--terra); }
.calc-panel .task-choice.selected, .calc-material-choice.selected { border-color: var(--terra); box-shadow: inset 0 0 0 1px var(--terra); background: #fcf4ec; }
.calc-panel .task-choice:hover, .calc-material-choice:hover { border-color: #a4492f; box-shadow: 0 4px 16px #412b1b12; }
.calc-panel .task-choice:focus-visible, .calc-material-choice:focus-visible { outline: 3px solid #55745e; outline-offset: 2px; }
.calc-material-grid, .all-material-results { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
#top .calc-material-choice, #modal-root .calc-material-choice { display: flex; align-items: center; gap: 11px; min-width: 0; min-height: 92px; padding: 14px; text-align: left; background: #fff; border: 1px solid #b2bcb8; border-radius: 9px; transition: border-color .15s, background .15s, box-shadow .15s; }
#top .calc-material-choice.selected, #modal-root .calc-material-choice.selected { background: #fcf4ec; border-color: var(--terra); }
#top .calc-material-choice > strong, #modal-root .calc-material-choice > strong { font-size: 17px; line-height: 1.4; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
#top .calc-material-choice .material-swatch, #modal-root .calc-material-choice .material-swatch { width: 38px; height: 48px; min-width: 38px; border-radius: 5px; }
.calc-material-choice .calc-choice-check { margin-left: auto; width: 18px; height: 18px; flex-shrink: 0; }
.calc-material-help > .icon { color: var(--sage); flex-shrink: 0; }
.calc-material-more > .icon { color: var(--sage); flex-shrink: 0; }
#top .calc-material-more > strong > small { display: block; margin-top: 4px; font-size: 14px; font-weight: 400; line-height: 1.4; color: #4d5860; }
.calc-other-materials { margin-top: 15px; min-height: 44px; }
.all-material-results { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-block: 20px; }
.all-material-results .calc-material-choice { min-height: 74px; }
.calc-panel .calc-navigation {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
  flex-wrap: nowrap;
  margin: 0;
  min-height: 76px;
  padding: 12px 28px;
  border-top: 1px solid #dadfd6;
  background: #faf9f5;
  box-shadow: 0 -5px 18px #36412b08;
}
.calc-navigation > .button { margin-left: auto; flex-shrink: 0; }
#top .calc-panel .calc-auto-note { margin: 0; min-height: 0; max-width: 350px; color: #4d5860; font-size: 14px; line-height: 1.45; }
.calc-panel .calc-bottom-note { width: auto; gap: 7px; }
.calc-panel .back-button { min-height: 44px; padding: 7px 0; font-size: 16px; }
.calc-lead { max-width: 730px; margin-inline: auto; }
.calc-selected-summary { color: #4d5860; font-size: 15px; line-height: 1.5; padding: 10px 13px; background: #f4f4ed; border-radius: 6px; margin-bottom: 14px; }
.calc-selected-summary > span { margin-inline: 8px; }
.contact-route { display: flex; align-items: center; gap: 15px; margin-bottom: 12px; }
.contact-route label { font-size: 16px; color: #4d5860; }
#top .calc-panel select { min-height: 44px; max-width: 100%; font-size: 17px; line-height: 1.4; padding: 9px 12px; background: #fff; border: 1px solid #7b898f; border-radius: 7px; color: var(--ink); }
.calc-panel .field-label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.calc-panel .field-label input { min-height: 49px; }
.calc-panel .consent { margin-block: 17px; }
.calc-details { margin-top: 15px; border: 1px solid #c4cdc3; border-radius: 9px; background: #f9faf5; }
.calc-details > summary { display: flex; align-items: center; gap: 10px; padding: 13px 15px; cursor: pointer; list-style: none; font-size: 16px; font-weight: 600; }
.calc-details > summary::-webkit-details-marker { display: none; }
.calc-details > summary > span { flex: 1; }
.calc-details > summary small { display: block; font-size: 14px; line-height: 1.5; color: #4d5860; font-weight: 400; margin-top: 3px; }
.calc-details[open] > summary { border-bottom: 1px solid #d7ded2; }
.calc-details[open] > summary > .icon:last-child { transform: rotate(180deg); }
.calc-details-content { padding: 18px 16px 10px; }
.calc-details .attachment-block { margin-bottom: 20px; }
.calc-details .optional-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.calc-extra-options { margin-bottom: 20px; }
.calc-extra-options legend { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.calc-extra-options > div { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 16px; }
.calc-extra-options label { display: flex; gap: 9px; align-items: flex-start; padding-block: 6px; font-size: 16px; line-height: 1.5; }
.calc-extra-options input { flex-shrink: 0; width: 19px; height: 19px; margin-top: 2px; accent-color: var(--terra); }
.calc-success-scroll { overflow-y: auto; max-height: 100%; padding: 20px; }
.calc-panel.has-success .success-state { padding: 28px 10px; }

@media (max-width: 1000px) {
  .calc-material-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #top .calc-material-choice { min-height: 72px; }
  .calc-panel .calc-navigation { gap: 16px; }
  #top .calc-panel .calc-auto-note { max-width: 260px; }
}
@media (max-height: 740px) {
  .calc-panel .task-photo { height: 64px; }
  .calc-scroll { padding-block: 16px; }
  .calc-panel .step-progress { padding-block: 10px; }
  .calc-panel .calc-navigation { min-height: 68px; padding-block: 9px; }
}
@media (max-width: 700px) {
  :root { --calc-viewport-gap: 120px; }
  .calc-panel .step-progress { padding: 11px 15px; gap: 9px; }
  #top .calc-panel .step-progress strong { font-size: 14px; white-space: normal; }
  #top .calc-panel .step-progress button > span { width: 25px; height: 25px; font-size: 14px; }
  .calc-panel .step-progress button { gap: 6px; }
  .calc-scroll { padding: 17px 16px; scrollbar-gutter: auto; }
  .calc-panel .question-heading { position: relative; display: block; }
  #top .calc-panel .question-heading h3 { font-size: 24px; }
  .calc-panel .question-heading > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .calc-panel .task-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .calc-panel .task-photo { height: 58px; }
  .calc-panel .task-choice .choice-caption { min-height: 52px; padding: 9px; }
  #top .calc-panel .choice-caption strong { font-size: 17px; line-height: 1.25; }
  .task-choice .calc-choice-check { display: none; }
  .calc-material-grid { gap: 8px; }
  #top .calc-material-choice { min-height: 64px; padding: 9px; gap: 8px; }
  #top .calc-material-choice > strong { font-size: 16px; line-height: 1.3; }
  #top .calc-material-choice .material-swatch { width: 28px; min-width: 28px; height: 36px; }
  .calc-material-choice .calc-choice-check { display: none; }
  .calc-material-help > .icon { width: 26px; }
  #top .calc-panel .question-help { font-size: 16px; margin-bottom: 12px; }
  .calc-panel .calc-navigation { min-height: 68px; padding: 9px 15px; gap: 12px; }
  #top .calc-panel .calc-auto-note { display: none; }
  #top .calc-panel .calc-bottom-note { font-size: 14px; max-width: 105px; line-height: 1.4; }
  .calc-navigation > .button { flex: 0 1 auto; max-width: calc(100% - 60px); padding-inline: 14px; gap: 12px; }
  .calc-navigation > .button > .icon { display: none; }
  .calc-lead { max-width: none; }
  .calc-selected-summary { font-size: 14px; padding: 8px 11px; margin-bottom: 11px; }
  .calc-panel .field-label { margin-bottom: 10px; }
  .contact-route { margin-bottom: 10px; }
  .calc-details .optional-grid, .calc-extra-options > div { grid-template-columns: 1fr; gap: 7px; }
  .all-material-results { grid-template-columns: 1fr; gap: 10px; }
  .calc-details-content { padding: 15px 12px 5px; }
  .calc-details > summary { padding: 12px; }
}
@media (max-width: 700px) and (max-height: 680px) {
  .calc-panel .task-photo { height: 40px; }
  .calc-panel .task-choice .choice-caption { padding: 6px 8px; }
  .calc-scroll { padding-block: 12px; }
  #top .calc-panel .question-heading h3 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .calc-material-choice { transition: none; }
}

/* Форма крыши: необязательные карточки, без требования площади. */
.calc-roof-options { margin-block: 20px; }
.calc-roof-options legend { color: var(--ink); font-size: 18px; font-weight: 600; margin-bottom: 13px; }
.calc-roof-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
#top .calc-roof-choice { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; min-height: 140px; padding: 13px 10px; border: 1px solid #aebcaf; border-radius: 9px; background: #fff; text-align: center; transition: border-color .18s, box-shadow .18s; }
.calc-roof-choice > .roof-drawing { display: block; width: 130px; max-width: 100%; height: 88px; margin: 0 auto 8px; }
#top .calc-roof-choice > strong { font-size: 17px; font-weight: 600; line-height: 1.4; color: var(--ink); overflow-wrap: anywhere; }
.calc-roof-choice > .calc-choice-check { position: absolute; top: 9px; right: 9px; }
#top .calc-roof-choice.selected { border-color: var(--terra); background: #fcf4ec; box-shadow: inset 0 0 0 1px var(--terra); }
#top .calc-roof-choice:hover { border-color: var(--terra); box-shadow: 0 4px 15px #46321f12; }
.calc-roof-choice:focus-visible, .calc-roof-unknown:focus-visible { outline: 3px solid #55745e; outline-offset: 2px; }
#top .calc-roof-unknown { display: inline-flex; align-items: center; gap: 9px; margin-top: 13px; min-height: 44px; padding: 9px 11px; border: 1px solid #aebcaf; border-radius: 7px; color: var(--ink); background: #fff; text-align: left; font-size: 16px; line-height: 1.5; }
#top .calc-roof-unknown.selected { border-color: var(--terra); background: #fcf4ec; color: var(--terra-dark); }
@media (max-width: 700px) {
  .calc-roof-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #top .calc-roof-choice { min-height: 128px; padding: 12px 8px; }
  .calc-roof-choice > .roof-drawing { width: 110px; height: 74px; }
}
@media (prefers-reduced-motion: reduce) {
  .calc-roof-choice { transition: none; }
}

/* Версия 1.7: необязательные уточнения и короткий путь для протечки. */
.calc-panel .step-progress.is-short { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.calc-shape-details { margin: 0 0 16px; background: #f9faf5; }
.calc-shape-details > summary { min-height: 52px; padding: 10px 13px; }
.calc-shape-content { padding: 0 14px 14px; }
.calc-shape-content .calc-roof-options { margin: 15px 0 0; }
.calc-shape-details > summary:focus-visible, .calc-details > summary:focus-visible { outline: 3px solid #55745e; outline-offset: 2px; border-radius: 8px; }
.calc-area-options, .calc-use-options { margin: 22px 0; padding: 0; }
.calc-area-options > legend, .calc-use-options > legend, .calc-channels > legend { font-size: 17px; line-height: 1.45; font-weight: 600; color: var(--ink); }
#top .calc-panel .calc-optional-hint { margin: 5px 0 12px; font-size: 15px; line-height: 1.5; color: #4d5860; }
.calc-range-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.calc-use-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
#top .calc-option-chip { min-width: 0; min-height: 46px; padding: 9px 12px; border: 1px solid #9eada3; border-radius: 7px; background: #fff; color: var(--ink); font-size: 16px; line-height: 1.4; text-align: center; transition: border-color .15s, background .15s, box-shadow .15s; }
#top .calc-option-chip:hover { border-color: var(--terra); box-shadow: 0 3px 10px #412b1b10; }
#top .calc-option-chip.selected { border-color: var(--terra); background: #fcf0e7; box-shadow: inset 0 0 0 1px var(--terra); color: #85361f; }
.calc-option-chip:focus-visible, .calc-channel-choice:focus-visible, .calc-exact-toggle:focus-visible { outline: 3px solid #55745e; outline-offset: 2px; }
#top .calc-exact-toggle { min-height: 44px; gap: 8px; padding: 9px 0; margin-top: 5px; font-size: 16px; }
#area-exact-field { margin-top: 8px; }
#area-exact-field[hidden] { display: none; }
.calc-channels { padding: 0; margin: 0 0 14px; }
.calc-channels > legend { margin-bottom: 9px; }
.calc-channels-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
#top .calc-channel-choice { display: flex; justify-content: center; align-items: center; gap: 8px; min-width: 0; min-height: 48px; padding: 9px 10px; border: 1px solid #9eada3; border-radius: 8px; font-size: 16px; line-height: 1.4; color: var(--ink); background: #fff; transition: border-color .15s, background .15s, box-shadow .15s; }
#top .calc-channel-choice:hover { border-color: var(--terra); background: #fffbf7; }
#top .calc-channel-choice.selected { border-color: var(--terra); box-shadow: inset 0 0 0 1px var(--terra); background: #fcf0e7; }
.calc-channel-choice .messenger-symbol { flex-shrink: 0; }
.attachment-block { position: relative; }
.attachment-block:focus-within .upload-zone { outline: 3px solid #55745e; outline-offset: 2px; }
.calc-photo-upload { margin-top: 14px; }
#top .calc-photo-upload .upload-zone { min-height: 74px; padding: 12px 15px; border: 1px dashed #7f987f; border-radius: 9px; background: #f2f6ed; transition: background .15s, border-color .15s; }
#top .calc-photo-upload .upload-zone:hover { background: #e9f1df; border-color: #486346; }
#top .calc-photo-upload .upload-zone strong { font-size: 17px; }
#top .calc-photo-upload .upload-zone small { color: #4d5860; }
#top .calc-panel .calc-leak-hint { font-size: 16px; line-height: 1.5; margin: 0 0 14px; color: #4d5860; }
.calc-legacy-system { margin: 18px 0; padding: 12px 14px; border-left: 3px solid #8a9b76; background: #eff2e8; }
#top .calc-legacy-system p { margin: 0 0 5px; font-size: 15px; line-height: 1.5; }
#top .calc-legacy-system .text-link { font-size: 15px; min-height: 44px; }
@media (max-width: 700px) {
  .calc-channels-grid, .calc-range-grid, .calc-use-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #top .calc-channel-choice { justify-content: flex-start; padding: 9px 8px; gap: 6px; }
  .calc-channel-choice .messenger-symbol { width: 18px; height: 18px; }
  .calc-shape-content { padding-inline: 11px; }
  #top .calc-photo-upload .upload-zone { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .calc-option-chip, .calc-channel-choice, .calc-photo-upload .upload-zone { transition: none; }
}
