.project-layout{display:grid;grid-template-columns:minmax(290px,380px) minmax(0,1fr);gap:22px;align-items:start}.project-settings,.project-output{display:grid;gap:16px;min-width:0}.project-section{padding:20px}.project-section summary{padding:3px 0 14px}.project-section label{display:block;font-size:12px;margin:10px 0}.project-section input{margin-top:5px}.project-section select,select,textarea{font:inherit;max-width:100%;padding:9px;border:1px solid var(--line);border-radius:5px;background:var(--white)}textarea{width:100%;min-height:75px}.check{display:flex!important;align-items:center;gap:7px}.check input{width:18px;height:18px;margin:0!important}.editor-tools{display:flex;flex-wrap:wrap;gap:8px;align-items:center;padding:12px 18px}.editor-tools button,button:not(.calculate-button){min-height:44px;border:1px solid var(--line);border-radius:5px;background:var(--white);padding:8px 12px}button:disabled{opacity:.4}.project-settings .editor-tools{padding:8px 0}#plan{width:100%;display:block;touch-action:none;background:#eeefe6}#three-view svg{width:100%;display:block;touch-action:none}.project-note{font-size:12px;color:var(--muted);padding:14px 0;line-height:1.65}.project-output .project-note{padding:12px 20px}#project-status{font-size:12px;color:var(--green)}.breadcrumbs{padding-top:24px;font-size:12px;display:block}h3{font-size:14px;margin:20px 0 6px}.project-table{width:100%;border-collapse:collapse;font-size:12px}.project-table td,.project-table th{text-align:left;padding:9px 4px;border-bottom:1px solid var(--line);overflow-wrap:anywhere}.table-scroll{overflow-x:auto}.summary-number{font-size:42px;color:var(--green);letter-spacing:-1.5px}.expense-row{display:grid;grid-template-columns:2fr 1fr 1fr;gap:5px}.expense-row input{min-width:0;padding:6px;font-size:16px}.variant-row{padding:8px 0;border-bottom:1px solid var(--line)}#project-error{margin:0}.project-section .field-grid input{min-width:0}#project-result ul{padding-left:18px;font-size:12px;color:var(--muted)}@media(max-width:850px){.project-layout{grid-template-columns:1fr}.project-output{grid-row:2}.project-section{padding:18px}#plan{min-height:230px}.editor-tools{padding:10px;gap:6px}.intro-copy{display:none}.project-table{font-size:11px}.project-settings .calculate-button{margin-top:0}}@media print{header,button,.project-settings,#documents{display:none!important}.project-layout{display:block}.panel{break-inside:avoid}.page{max-width:none}details{display:block}}
/* Acceptance fixes: usable form targets and no iOS zoom on select/textarea. */
.project-layout .check{min-height:44px}
.intro-copy{flex:0 1 360px;max-width:360px;min-width:0}
@media(max-width:1000px){.intro-copy{flex-basis:220px;max-width:220px}}
@media(max-width:850px){.project-layout .project-section select,.project-layout .project-section textarea{font-size:16px}}
/* Таблицы результатов сохраняют читаемый текст и прокручиваются внутри блока. */
.project-table{font-size:14px;min-width:560px}
.table-scroll{max-width:100%;overscroll-behavior-x:contain}
@media(max-width:600px){
  .project-section label,.project-note,#project-result ul{font-size:14px}
}
/* Компактные элементы управления поверх 3D, без выделения подписи при вращении. */
#three-view{position:relative;user-select:none;-webkit-user-select:none}
#three-view svg{cursor:grab;user-select:none;-webkit-user-select:none}
#three-view svg:active{cursor:grabbing}
#three-view .view-zoom{position:absolute;right:14px;bottom:14px;display:flex;flex-direction:column;gap:4px}
#three-view .view-zoom button{width:44px;height:44px;min-height:44px;padding:0;font-size:22px;line-height:1;color:var(--green);background:var(--white);border:1px solid var(--line);border-radius:6px}
/* Выбор участка располагается под подписью и не выходит за границы панели. */
#selected-segment{display:block;box-sizing:border-box;width:100%;min-width:0;max-width:100%;margin-top:6px;text-overflow:ellipsis}
/* Убираем встроенную рамку браузера и оставляем одну рамку поля. */
#selected-segment,#grid-step{
  appearance:none;
  -webkit-appearance:none;
  padding-right:36px;
  background-image:linear-gradient(45deg,transparent 50%,#526b59 50%),linear-gradient(135deg,#526b59 50%,transparent 50%);
  background-position:calc(100% - 19px) center,calc(100% - 14px) center;
  background-size:5px 5px;
  background-repeat:no-repeat;
}
#selected-segment:focus,#grid-step:focus{outline:none;border-color:var(--green);box-shadow:none}
#selected-segment:focus-visible,#grid-step:focus-visible{outline:1px solid #899d8d;outline-offset:-1px;border-color:#899d8d}
/* Кнопки шаблонов и остальных инструментов используют тот же фокус, что поля. */
.project-layout :is(button,input,select,textarea):focus-visible{
  outline:1px solid #899d8d;
  outline-offset:-1px;
  border-color:#899d8d;
  box-shadow:none;
}

/* Пояснения к расчёту: открытый текст с отдельным примером и ограничениями. */
.guide-section{margin:72px 0 48px;border-top:1px solid var(--line);padding-top:42px}
.guide-heading{max-width:640px;margin-bottom:28px}
.guide-eyebrow,.guide-index{color:#687a69;font-size:11px;font-weight:650;letter-spacing:.1em}
.guide-heading h2{font-size:clamp(25px,3vw,34px);font-weight:550;letter-spacing:-.8px;line-height:1.2;margin:10px 0}
.guide-heading>p:last-child{color:var(--muted);font-size:15px;line-height:1.6}
.guide-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.guide-card{background:var(--white);border:1px solid var(--line);border-radius:12px;padding:24px;min-width:0}
.guide-card h3,.guide-bottom h3{font-size:17px;font-weight:600;line-height:1.35;letter-spacing:-.3px;margin:14px 0 10px}
.guide-card p,.guide-bottom p{color:var(--muted);font-size:14px;line-height:1.7;margin:0}
.guide-example{background:#eef1e9;border-color:#dce3d7}
.guide-example .guide-formula{color:var(--ink);font-size:16px;line-height:1.5;margin:16px 0;overflow-wrap:anywhere}
.guide-example strong{color:var(--green)}
.guide-bottom{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,.75fr);gap:36px;margin-top:32px}
.guide-bottom h3{margin:0 0 16px;font-size:20px}
.guide-answer{border-top:1px solid var(--line);padding:16px 0}
.guide-answer h4{font-size:14px;line-height:1.45;margin:0 0 6px;font-weight:600}
.guide-limits{border-left:2px solid #b9c8b4;padding-left:22px;align-self:start}
.guide-limits h3{margin:10px 0}
.guide-limits p+p{margin-top:12px}
@media(max-width:700px){
  .guide-section{margin:48px 0 36px;padding-top:30px}
  .guide-grid,.guide-bottom{grid-template-columns:1fr}
  .guide-card{padding:20px}
  .guide-bottom{gap:24px;margin-top:28px}
}
.work-row{border-top:1px solid var(--line);padding:8px 0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:0 8px}
.work-row>.check{grid-column:1/-1}
.work-row input,.work-row select{width:100%;min-width:0}
/* Keep work checkboxes next to their labels instead of stretching them like text inputs. */
.work-row input[type="checkbox"]{width:18px;min-width:18px;height:18px;flex:0 0 18px;padding:0}
.work-row select{height:49px}
/* Align controls across a row even when one label wraps onto a second line. */
.project-layout .field-grid>label{display:flex;flex-direction:column;justify-content:flex-end;min-width:0}
.project-layout .field-grid>label>select{width:100%;height:49px;margin-top:5px}
/* Purchase quantities and prices should scroll as whole values, not break mid-number. */
.project-table:has(th:nth-child(8)){min-width:850px}
.project-table:has(th:nth-child(8)) :is(th,td):nth-child(n+3){white-space:nowrap;overflow-wrap:normal}
#project-result h4{margin:20px 0 8px;font-size:14px}
#project-result .purchase-explanation{margin:6px 0;color:var(--muted);font-size:12px;line-height:1.5}
#timber-fields[hidden]{display:none}
.work-row:not(:has(input[data-work="enabled"]:checked))>label:not(.check){display:none}
.underlay-settings{padding:0 18px 12px;border-bottom:1px solid var(--line)}
.underlay-settings summary{cursor:pointer;padding:12px 0;font-size:13px;font-weight:600}
.underlay-settings label{display:block;font-size:12px;margin:10px 0}
.underlay-settings input[type=file]{height:auto;width:100%;padding:8px;font-size:13px}
.underlay-settings input[type=number]{margin-top:5px}
.underlay-settings .editor-tools{padding:8px 0}
#underlay-controls[hidden]{display:none}

/* Long-form guide: readable text, lightweight diagrams and local table scrolling. */
.guide-toc{padding:20px 22px;border:1px solid var(--line);border-radius:10px;background:var(--white);margin-bottom:38px}
.guide-toc strong{display:block;font-size:14px;margin-bottom:10px}
.guide-toc div{display:flex;flex-wrap:wrap;gap:8px 22px}
.guide-toc a{color:var(--green);font-size:14px;text-decoration:underline;text-underline-offset:3px}
.guide-content{display:grid;gap:0}
.guide-article{display:grid;grid-template-columns:minmax(0,1.2fr) minmax(0,.8fr);gap:36px;padding:34px 0;border-top:1px solid var(--line);align-items:start}
.guide-article h2,.guide-questions h2{font-size:clamp(23px,2.5vw,30px);line-height:1.25;letter-spacing:-.5px;margin:0 0 18px}
.guide-article h3,.guide-answer h3{font-size:17px;line-height:1.4;margin:26px 0 10px}
.guide-article p,.guide-article li,.guide-answer p{font-size:15px;line-height:1.7;color:var(--muted)}
.guide-article p{margin:0 0 14px}
.guide-steps{margin:0;padding-left:22px}
.guide-steps li{padding-left:4px;margin-bottom:12px}
.guide-article figure{margin:0;background:#f1f4ed;border:1px solid #dce3d7;border-radius:10px;padding:12px;min-width:0}
.guide-article img{display:block;max-width:100%;width:100%;height:auto}
.guide-article figcaption{font-size:13px;line-height:1.5;color:var(--muted);padding:0 8px 5px}
.guide-article .guide-equation{background:#eef1e9;border-radius:8px;color:var(--ink);padding:14px 16px;font-size:16px;overflow-wrap:anywhere}
.guide-table-wrap{max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;margin:18px 0}
.guide-table{border-collapse:collapse;min-width:520px;width:100%;font-size:14px}
.guide-table th,.guide-table td{text-align:left;border-bottom:1px solid var(--line);padding:10px 8px;white-space:nowrap}
.guide-questions{border-top:1px solid var(--line);padding-top:34px;max-width:800px}
.guide-questions .guide-answer h3{margin:0 0 8px}
.guide-questions .guide-answer p{margin:0}
@media(max-width:700px){.guide-article{grid-template-columns:minmax(0,1fr);gap:18px;padding:26px 0}.guide-toc{padding:18px;margin-bottom:26px}.guide-toc div{gap:8px 16px}}

/* Keep the guide inset from the viewport and independent of the header navigation. */
.guide-section{padding-inline:clamp(8px,1vw,16px)}
.guide-toc{display:block;margin-left:0}
.guide-toc a{display:inline-flex;align-items:center;min-height:36px}
.guide-article>div{min-width:0}
.guide-article .guide-scroll-hint{display:none}
@media(max-width:700px){.guide-article .guide-scroll-hint{display:block;font-size:13px;margin:12px 0 0}}
.project-subtitle{font-size:14px;font-weight:600;margin:20px 0 6px}
