/* Шаги заказа: итоги, панели инструментов, таблицы по группам, строки файлов, формы, ТЗ, сборки. */
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack > .card + .card { margin-top: 0; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar h2 { margin-right: 4px; }
.sub-h { margin: 16px 0 8px; font-size: 13px; color: var(--ink2); }
.sub { font-size: 12px; color: var(--muted); }
.clamp1, .clamp2 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.clamp1 { -webkit-line-clamp: 1; }
.clamp2 { -webkit-line-clamp: 2; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* итоги шага */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; border-top: 3px solid var(--accent); }
.kpi.warn { border-top-color: var(--warn); }
.kpi .lbl { font-size: 12px; color: var(--muted); }
.kpi .val { font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* таблицы в карточке (шапка прилипает к верху экрана) */
.tbl-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.tbl-card .tbl th:first-child { border-top-left-radius: 10px; }
.tbl-card .tbl th:last-child { border-top-right-radius: 10px; }
.tbl.fixed { table-layout: fixed; }
.tbl.fixed td { overflow: hidden; overflow-wrap: anywhere; }
.tbl.fixed th { white-space: normal; }
.tbl tr.grp td { background: var(--panel2); font-weight: 600; cursor: pointer; border-bottom: 1px solid var(--line2); overflow: visible; white-space: nowrap; }
.tbl tr.grp:hover td { background: var(--bg2); }
.tbl .pname { min-width: 260px; max-width: 460px; }
.tbl .pmat { max-width: 180px; }
.tbl tr.sub-row td { background: var(--panel2); }
.pos-link { display: block; padding: 3px 0; color: var(--ink); font-size: 13px; }
.pos-link:hover { color: var(--accent); text-decoration: none; }
.add-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 10px 12px; }
.ref-tbl { max-height: calc(100vh - 170px); }
.ref-tbl td { min-width: 90px; max-width: 360px; font-size: 12.5px; }

/* строки входных файлов */
.files { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; }
.frow + .frow { border-top: 1px solid var(--line); }
.frow-line {
  display: grid; grid-template-columns: 40px minmax(180px, 1.2fr) 64px 160px minmax(220px, 1fr) 16px; gap: 12px;
  align-items: center; padding: 8px 12px; cursor: pointer;
}
.frow-line:hover, .frow.open .frow-line { background: var(--panel2); }
/* имя файла и итог разбора — до двух строк (на узком экране не обрезаются на полуслове) */
.frow-name {
  min-width: 0; overflow: hidden; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.frow-name a { color: var(--ink); }
.frow-name a:hover { color: var(--accent); }
.frow-size { text-align: right; font-size: 12.5px; color: var(--muted); }
.frow .chip.kind { max-width: 160px; overflow: hidden; text-overflow: ellipsis; background: var(--panel2); border: 1px solid var(--line2); }
.frow-state { display: flex; align-items: center; gap: 8px; min-width: 0; }
.frow-state > .clip {
  flex: 1; min-width: 0; white-space: normal; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.frow-state .bar { min-width: 60px; }
.frow.error { box-shadow: inset 3px 0 0 var(--fail); }
.frow.parsing, .frow.queued { box-shadow: inset 3px 0 0 var(--run); }
.frow-more { display: flex; gap: 16px; padding: 4px 16px 14px 64px; background: var(--panel2); }
.frow-fields { flex: 1; min-width: 0; }
.frow-prev { flex: none; align-self: flex-start; }
.frow-prev img { display: block; max-width: 280px; max-height: 300px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.kv { border-collapse: collapse; width: 100%; font-size: 13px; }
.kv th { text-align: left; font-weight: 500; color: var(--muted); padding: 5px 12px 5px 0; vertical-align: top; width: 170px; white-space: nowrap; }
.kv td { padding: 5px 0; vertical-align: top; border-bottom: 1px dashed var(--line); }
.src { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.src-path { margin-top: 8px; overflow-wrap: anywhere; }
.kind-row { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.kind-row select { height: 26px; padding: 0 6px; font-size: 12.5px; }
.tbl-wrap.mini { max-height: 260px; }
.tbl-wrap.mini .tbl { font-size: 12px; }
.drop-slim { padding: 14px; }
.fi-box { display: inline-block; position: relative; flex: none; vertical-align: middle; }
.fi { display: block; flex: none; }
.fi-page { fill: var(--file-page); stroke: var(--file-edge); stroke-width: 1.2; }
.fi-fold { fill: var(--file-fold); stroke: var(--file-edge); stroke-width: 1.2; stroke-linejoin: round; }
.fi-lines { fill: none; stroke: var(--file-line); stroke-width: 1.6; stroke-linecap: round; }
.fi-thumb { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 5px; border: 1px solid var(--line); background: var(--panel2); }
.fi-thumb.wait { position: absolute; inset: 0; opacity: 0; }

/* формы */
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.form-grid.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .w2 { grid-column: span 2; }
.form-grid.g2 .w2 { grid-column: 1 / -1; }
.wh { display: flex; align-items: center; gap: 6px; }
.wh input { width: 0; flex: 1; }
.chip.sm { height: 18px; font-size: 11px; padding: 0 6px; }

/* смета по лотам */
.lots { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 14px; align-items: start; }
.lots-side { position: sticky; top: 12px; }
.kv2 { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0 0; font-size: 13px; }
.kv2 dt { color: var(--muted); }
.kv2 dd { margin: 0; text-align: right; }

/* ТЗ */
.tz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.tz-sec { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.tz-head { display: flex; align-items: center; gap: 8px; }
.tz-n { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink2); }
.tz-sec ul { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--ink2); }
.tz-sec li { margin: 2px 0; overflow-wrap: anywhere; }
.qcard { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.qcard.block { border-left: 3px solid var(--fail); }
.qcard.hl { box-shadow: 0 0 0 2px var(--accent); }
.qtext { font-weight: 500; margin: 6px 0 4px; }
.qact { margin-top: 8px; }

/* сборки */
.asm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.asm {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer;
  display: flex; flex-direction: column; gap: 5px; min-width: 0;
}
.asm:hover { border-color: var(--faint); }
.asm.on { border-color: var(--accent); }
.asm.warn { border-left: 3px solid var(--warn); }
.asm-head { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--accent); }
.asm-head b { color: var(--ink); }
.asm-mat { font-size: 13px; color: var(--ink2); }
.asm-nums { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.asm-nums b { color: var(--ink); font-variant-numeric: tabular-nums; }
.asm-file { display: flex; align-items: center; gap: 6px; color: var(--muted); min-width: 0; }
.asm-pos { border-top: 1px solid var(--line); padding-top: 6px; max-height: 240px; overflow: auto; cursor: default; }

/* пометки полей: бледно-жёлтая ячейка (как FFF2CC в документах), пустое — серым курсивом */
:root { --mk: #fff2cc; --mk-line: #e9d58f; }
[data-theme="dark"] { --mk: #3a3218; --mk-line: #6b5a22; }
.tbl td.mk, .mk-cell { background: var(--mk); box-shadow: inset 0 0 0 1px var(--mk-line); cursor: help; }
.tbl tr.click:hover td.mk, .tbl tr.sel td.mk { background: var(--mk); filter: brightness(.97); }
/* читаемость (06.10): жёлтая заливка — только «не заполнено»; «проверьте» (умолчание, угадано ИИ, из ТЗ) — тонкая черта слева */
.tbl td.mk:not(.mk-e), .tbl tr.click:hover td.mk:not(.mk-e), .tbl tr.sel td.mk:not(.mk-e) { background: transparent;
  box-shadow: inset 3px 0 0 var(--warn); filter: none; }
.mk-none { color: var(--faint); font-style: italic; font-size: 12px; }
.mk-dot { display: inline-block; width: 7px; height: 7px; margin-left: 5px; border-radius: 50%; background: var(--warn);
  vertical-align: middle; cursor: help; }
.mk-legend { display: flex; align-items: center; gap: 8px; color: var(--muted); margin: -2px 0 2px; }
.mk-sw { width: 14px; height: 14px; border-radius: 3px; background: var(--mk); box-shadow: inset 0 0 0 1px var(--mk-line); flex: none; }
.mk-sw.line { background: transparent; box-shadow: inset 3px 0 0 var(--warn); }
.mk-list { margin: 4px 0 0; padding: 0; list-style: none; }
.mk-list li { padding: 4px 8px; margin-bottom: 4px; border-radius: 6px; background: var(--mk); box-shadow: inset 0 0 0 1px var(--mk-line); }
.mk-list .mk-k { font-weight: 600; margin-right: 4px; }
.frow-marks { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 12px 8px 64px; }
.frow.skip { opacity: .75; }
.frow.skip .frow-line { cursor: default; }
.mk-none.sm { font-size: 11px; overflow-wrap: normal; word-break: normal; hyphens: none; }
input.mk-in { background: var(--mk); border-color: var(--mk-line); }
input.mk-in::placeholder { color: var(--faint); font-style: italic; }

/* шаг ТЗ: красная плашка «ТЗ — черновик» */
.tz-draft { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px;
  background: var(--fail-soft); color: var(--fail); border: 1px solid var(--fail); }
.tz-draft > svg { flex: none; }
.tz-draft a { color: var(--fail); font-weight: 600; white-space: nowrap; }

/* шаг 5: рабочие файлы CorelDRAW (step-corel.js) */
.corel-run { padding: 10px 12px; border-radius: 8px; background: var(--panel2); margin-bottom: 8px; }
.corel-run.busy { box-shadow: inset 3px 0 0 var(--warn); }
.corel-run.running, .corel-run.queued { box-shadow: inset 3px 0 0 var(--run); }
.corel-run.error, .corel-run.timeout { box-shadow: inset 3px 0 0 var(--fail); }
.corel-marks { display: flex; flex-direction: column; gap: 3px; margin: 6px 0; max-height: 220px; overflow: auto; }
.corel-h { margin: 14px 0 8px; }
.wf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.wf { border: 1px solid var(--line); border-radius: 8px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.wf img { width: 100%; height: 120px; object-fit: contain; background: #fff; border-radius: 4px; cursor: zoom-in; }
.wf-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asm-out { border-top: 1px solid var(--line); padding: 8px 0; }
.sheet-row { display: flex; gap: 8px; overflow-x: auto; padding-top: 6px; }
.sheet-row img { height: 110px; background: #fff; border: 1px solid var(--line); border-radius: 4px; cursor: zoom-in; }
.img-big { position: fixed; inset: 0; background: rgba(0, 0, 0, .7); z-index: 100; display: flex;
  align-items: center; justify-content: center; cursor: zoom-out; }
.img-big img { max-width: 94vw; max-height: 94vh; background: #fff; }
.corel-marks > div > svg, .corel-run > svg { margin-right: 5px; vertical-align: -2px; }

/* Шаг 1: «Изделия и технологии» (step-tech.js) и «Нужные файлы» (needs.js) */
.need-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 2px 0 10px; }
.need-strip .chip svg { vertical-align: -1px; }
.tech-bar { gap: 10px; margin: 2px 0 8px; flex-wrap: wrap; }
.tech-tbl td { vertical-align: middle; }
.tech-tbl tr.tech-grp td { background: var(--panel2); border-top: 1px solid var(--line2); }
.tech-tbl tr.tech-grp.none td { background: var(--warn-soft); }
.tech-tbl tr.tech-grp svg { vertical-align: -2px; margin-right: 4px; }
.tech-tbl .chip.route { margin-left: 4px; background: var(--bg2); color: var(--muted); }
.tech-tbl tr.tech-row.mk td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.tech-tbl .clamp2 { max-width: 360px; }
.tech-edit { padding: 8px; border: 1px solid var(--line2); border-radius: 8px; background: var(--panel2); }
.tech-edit input { width: 100%; }
.tech-opts { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; max-height: 260px; overflow: auto; }
.tech-opt { text-align: left; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); padding: 6px 8px;
  color: var(--ink); cursor: pointer; font: inherit; }
.tech-opt:hover, .tech-opt.on { border-color: var(--accent); }
.tech-foot { gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.wait-step .btn { margin-top: 6px; }
/* Шаг 1: «Анализ документов» (aspects.js) */
.aspects details.asp { margin-top: 6px; }
.asp-fact { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.asp-fact a, .asp-q a { margin-left: 6px; }
.asp-q { margin: 4px 0 0; padding-left: 20px; }

/* 06.10: таблица технологий плотнее — строка в одну линию, без воздуха */
.tech-tbl th, .tech-tbl td { padding: 3px 8px; }
.tech-tbl tr.tech-row td:not(.tt-name) { white-space: nowrap; }
.tech-tbl tr.tech-row td { height: 30px; }
.tech-tbl .tt-name .clamp1 { -webkit-line-clamp: 1; max-width: 440px; }
.tech-tbl tr.tech-grp td { padding-top: 5px; padding-bottom: 5px; }
.tech-tbl .btn.sm { padding: 1px 8px; min-height: 0; height: 24px; font-size: 12px; }
.tech-tbl td.num.nowrap { width: 1%; }
.tech-card .tbl-wrap { overflow-x: auto; }
.tech-tbl { width: max-content; max-width: 100%; }
.tech-tbl td.num.nowrap { text-align: left; }
.tech-tbl .tt-tech .ie-v { cursor: pointer; border-bottom: 1px dashed var(--line2); }
.tech-tbl .tt-tech .ie-in { min-width: 260px; }
.tech-tbl tr.tech-grp .ie-in { min-width: 300px; }
.tech-tbl td.tt-size { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.tech-tbl td.tt-tech { max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
.tech-tbl td.tt-tech .ie.on { overflow: visible; }
.tech-card .tbl-wrap { width: fit-content; max-width: 100%; }
.tech-tbl td.tt-tech .ie-v { display: inline-block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* узкое окно (≤ 560 px): строка файла — значок, имя и шеврон в первой строке, итог разбора под именем */
@media (max-width: 560px) {
  .frow-line { grid-template-columns: 32px minmax(0, 1fr) 16px; gap: 4px 8px; padding: 8px; }
  .frow-line > :nth-child(5) { grid-column: 2 / 4; grid-row: 2; }
  .frow-line > :nth-child(6) { grid-column: 3; grid-row: 1; }
}

/* таблицы с фиксированной раскладкой на узком экране прокручиваются внутри своей карточки, а не растягивают страницу
   (только на узком: прокручиваемая карточка отключает «прилипшую» шапку таблицы на широком) */
@media (max-width: 760px) { .tbl-card, #tz-marked { overflow-x: auto; } }

/* карточка ТЗ позиции (js/tz-card.js, этап 2, 15.10.2026): раскрывается под строкой позиции на шаге «ТЗ» */
.tech-tbl tr.tech-cardrow td { padding: 0 8px 10px; background: var(--panel2); border-bottom: 1px solid var(--line2); white-space: normal; height: auto; }
.tech-tbl .tt-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tech-tbl .tzc-toggle { height: 22px; padding: 0 6px; font-size: 11px; flex: none; }
.tzc { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--line2); border-radius: 8px; background: var(--panel); margin-top: 4px; font-size: 13px; }
.tzc.editing { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.tzc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tzc-why { min-width: 0; overflow-wrap: anywhere; }
.tzc-flags { display: flex; flex-wrap: wrap; gap: 4px; }
.tzc-flags .chip { height: auto; min-height: 18px; padding: 1px 7px; white-space: normal; line-height: 1.25; }
.tzc-grid { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 3px 12px; align-items: baseline; }
.tzc-k { color: var(--muted); font-size: 12px; }
.tzc-grid > div:not(.tzc-k) { overflow-wrap: anywhere; }
.tzc-sec { display: flex; flex-direction: column; gap: 4px; }
.tzc-sec > b { font-size: 12.5px; }
.tzc-sub { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.tzc-tbl { width: 100%; font-size: 12.5px; }
.tzc-tbl th, .tzc-tbl td { padding: 2px 8px; white-space: normal; }
.tzc-tbl tr.part td { color: var(--ink2); }
.tzc-tbl input.tzc-qty { width: 90px; text-align: right; }
.tzc-params { display: flex; flex-wrap: wrap; gap: 4px; }
.tzc-params .chip { height: auto; min-height: 18px; white-space: normal; }
.tzc-list { margin: 0; padding-left: 18px; }
/* база знаний: правка людьми (20.10, js/kbase.js) */
.kb-mini { height: 20px; padding: 0 6px; font-size: 11px; }
.kb-pick { position: relative; display: inline-flex; gap: 4px; align-items: center; }
.kb-pick input, .kb-price input, .kbv-q, .kbv-doc { font: inherit; font-size: 12.5px; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line2); background: var(--panel); color: var(--ink); min-width: 0; }
.kb-pick input { width: 260px; max-width: 70vw; }
.kb-res { position: absolute; z-index: 45; top: 26px; left: 0; width: min(460px, 86vw); max-height: 260px; overflow-y: auto; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-l); padding: 4px; display: flex; flex-direction: column; }
.kb-opt { display: flex; justify-content: space-between; gap: 8px; text-align: left; padding: 4px 6px; border: 0; background: none; color: var(--ink); border-radius: 5px; cursor: pointer; font: inherit; font-size: 12.5px; }
.kb-opt:hover, .kb-opt.on { background: var(--accent-soft); }
.kb-price { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.kb-price input { width: 90px; text-align: right; }
.kbv { display: flex; flex-direction: column; gap: 8px; }
.kbv-q { width: 260px; max-width: 100%; }
.kbv-new { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.kbv-doc { width: 380px; max-width: 100%; }
.kbv-tbl { width: 100%; font-size: 12.5px; }
.kbv-tbl td { white-space: normal; overflow-wrap: anywhere; vertical-align: top; }
.kbv-tbl tr.off td { color: var(--muted); text-decoration: line-through; }
.kbv-rule textarea, .kbv-ta { font: inherit; font-size: 12.5px; padding: 4px 6px; border-radius: 5px; border: 1px solid var(--line2); background: var(--panel); color: var(--ink); width: min(640px, 100%); }
.kbv-tbl tr.off td select { text-decoration: none; }
.kbv-st { font: inherit; font-size: 12px; padding: 1px 4px; border-radius: 5px; border: 1px solid var(--line2); background: var(--panel); color: var(--ink); max-width: 210px; }
.kbv-st.warn { border-color: var(--warn, #d9a400); }
.kbv-st.ok { border-color: var(--ok, #2a9d6a); }
/* редактор технологии изделия (21.10, js/tech-editor.js) */
.te { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border: 1px solid var(--accent); border-radius: 8px; background: var(--panel); margin: 6px 0; max-width: 1480px; }
.te-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.te-cur { display: inline-block; max-width: min(560px, 60vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.te-hint { margin: 0; }
.te-parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 8px; align-items: start; }
.te-part { display: flex; flex-direction: column; gap: 3px; padding: 5px 7px 6px; border: 1px solid var(--line2); border-radius: 6px; background: var(--panel2); min-width: 0; }
.te-ph { display: flex; align-items: center; gap: 3px; }
.te-no { flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.te-pn, .te-name, .te-phr, .te-note, .te-how, .te-q, .te-per { font: inherit; font-size: 12.5px; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line2); background: var(--panel); color: var(--ink); min-width: 0; }
.te-pn { font-weight: 600; max-width: 100%; height: 24px; border-color: transparent; background: transparent; }
.te-pn:hover, .te-pn:focus { border-color: var(--line2); background: var(--panel); }
.te-how { width: 100%; resize: none; overflow: hidden; line-height: 1.35; color: var(--ink2); field-sizing: content; min-height: 24px; }
.te-ic { flex: none; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--muted); font-size: 12px; cursor: pointer; }
.te-ic:hover:not(:disabled) { background: var(--accent-soft); color: var(--ink); }
.te-ic:disabled { opacity: .3; cursor: default; }
.te-rows { display: flex; flex-direction: column; }
.te-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) 58px 42px 92px 20px; gap: 4px; align-items: center; font-size: 12.5px; min-height: 26px; padding: 1px 0; border-top: 1px solid var(--line); }
.te-row:first-child { border-top: 0; }
.te-k { font-size: 10.5px; line-height: 16px; border-radius: 4px; text-align: center; }
.te-k.m { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.te-k.w { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.te-n { overflow-wrap: anywhere; line-height: 1.25; }
.te-q { width: 100%; height: 22px; text-align: right; padding: 0 4px; }
.te-u { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.te-per { width: 100%; height: 22px; padding: 0 2px; }
.te-add { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.te-newpart { justify-self: start; border-style: dashed; }
.te-parts.te-one { grid-template-columns: minmax(0, 860px); }       /* правка одной части (22.10) */
.te-all { border: 1px solid var(--line2); background: var(--panel2); color: var(--ink2); }
.tzd-pedit { margin-left: 8px; vertical-align: 1px; border: 1px solid var(--line2); background: var(--panel2); color: var(--ink2); }
.tzd-pedit:hover, .tzd-pedit.on { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.te-save { position: sticky; bottom: 0; z-index: 3; display: grid; grid-template-columns: minmax(200px, 2fr) minmax(200px, 3fr) minmax(120px, 1fr); gap: 4px 8px;
  align-items: end; padding: 6px 0 2px; border-top: 1px dashed var(--line2); background: var(--panel); }
.te-f { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: 11px; color: var(--muted); }
.te-f input { width: 100%; height: 26px; }
.te-btns { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.te-rn { display: inline-block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.te-addb { border: 1px dashed var(--line2); background: var(--panel); color: var(--ink2); }
.te-addb:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
@media (max-width: 760px) { .te-save { grid-template-columns: 1fr; } }
.tzd-edit { margin-left: 8px; vertical-align: middle; }
/* ТЗ на изготовление на экране (20.10, js/tz-doc.js) — как документ */
.tzd { display: flex; flex-direction: column; gap: 6px; }
.tzd-hdr dd, .tzd-kv dd { text-align: left; overflow-wrap: anywhere; }
.tzd-hdr { grid-template-columns: 170px minmax(0, 1fr); }
.tzd-kv { grid-template-columns: 170px minmax(0, 1fr); margin-top: 4px; }
.tzd-item { border-top: 1px solid var(--line2); padding-top: 10px; margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.tzd-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tzd-tech { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tzd-bar { gap: 8px; flex-wrap: wrap; align-items: center; }
.tzd-hdr-box > summary { cursor: pointer; padding: 4px 0; overflow-wrap: anywhere; }
/* 21.10: «кнопку цвета — как кнопку, а не просто текст» */
/*        цвет и температура необязательны — кнопка спокойная, без «предупреждения» */
.tzd-attr { border: 1px solid var(--line2); background: var(--panel2); color: var(--ink2); }
/* картинка изделия в ТЗ (21.10): справа от свойств, на телефоне — под ними */
.tzd-gq { margin-top: 12px; }
.tzd-qs { margin-top: 18px; padding: 10px 12px; border: 1px solid var(--line2); border-radius: 8px; background: var(--panel); }
.tzd-q { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(200px, 2fr) auto; gap: 4px 12px; align-items: center; padding: 6px 0;
  border-top: 1px solid var(--line); }
.tzd-q:first-of-type { border-top: 0; }
.tzd-qn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tzd-qa { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tzd-qi { width: 140px; }
.tzd-qu { min-width: 2.2em; }          /* «шт» и «мм» одной ширины — поля ответа в столбик ровно (22.10) */
@media (max-width: 760px) { .tzd-q { grid-template-columns: 1fr; } .tzd-qn { white-space: normal; } }
.tzd-imgf .tzd-addpic { margin-left: 6px; cursor: pointer; }
.tzd-addpic.dis { opacity: .5; pointer-events: none; }
.tzd-main { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.tzd-main > .tzd-kv { flex: 1 1 360px; min-width: 0; }
.tzd-pic { flex: none; display: flex; flex-direction: column; gap: 3px; max-width: 250px; padding: 5px; border: 1px solid var(--line2);
  border-radius: 6px; background: var(--panel2); text-decoration: none; }
.tzd-pic img { display: block; max-width: 238px; max-height: 190px; object-fit: contain; align-self: center; background: #fff; border-radius: 3px; }
.tzd-pic span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
.tzd-attr:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.tzd-item.tzd-ok .tzd-title::before { content: "✓ "; color: var(--ok, #2a9d6a); }
.tzd-title { margin: 0; font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.tzd-h { margin: 8px 0 2px; font-size: 13px; color: var(--ink2); }
.tzd-pm { overflow-wrap: anywhere; }
.tzd-req > summary { cursor: pointer; }
.tzd-warn { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tzd-warn .chip { height: auto; min-height: 18px; white-space: normal; line-height: 1.25; }
@media (max-width: 640px) { .tzd-hdr, .tzd-kv { grid-template-columns: minmax(0, 1fr); } .tzd-hdr dt, .tzd-kv dt { margin-top: 4px; } }
.tzc-part { display: flex; flex-direction: column; gap: 2px; padding: 4px 0 4px 8px; border-left: 2px solid var(--line2); }
.tzc-part-h { overflow-wrap: anywhere; }
.tzc-part-m { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 12.5px; }
.tzc-mat { display: inline-flex; gap: 4px; align-items: baseline; flex-wrap: wrap; }
.tzc-part-w { overflow-wrap: anywhere; }
.tzc-more { display: flex; flex-direction: column; gap: 8px; }
details.tzc-more > summary { cursor: pointer; color: var(--muted); }
details.tzc-more[open] { gap: 8px; }
.tzc-edit { display: flex; flex-direction: column; gap: 10px; border-top: 1px dashed var(--line2); padding-top: 8px; }
.tzc-form { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 4px 12px; align-items: center; }
.tzc-form input, .tzc-form select, .tzc-form textarea, .tzc-find input { font: inherit; font-size: 13px; padding: 3px 6px; border-radius: 5px; border: 1px solid var(--line2); background: var(--panel); color: var(--ink); min-width: 0; }
.tzc-find { position: relative; flex-wrap: wrap; align-items: flex-start; margin-top: 4px; }
.tzc-find input { flex: 1 1 320px; }
.tzc-res { position: absolute; z-index: 40; top: 30px; left: 0; width: min(520px, 100%); max-height: 260px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-l); padding: 4px; display: flex; flex-direction: column; }
.tzc-add { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px; border: 1px solid var(--warn); border-radius: 6px; background: var(--warn-soft); margin-top: 6px; }
.tzc-add input { font: inherit; font-size: 13px; padding: 3px 6px; border-radius: 5px; border: 1px solid var(--line2); background: var(--panel); color: var(--ink); }
.tzc-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 8px; }
/* «Скорректировать» в ТЗ на экране (21.10 вечер «полотно — упрощай»): только правка, вкладками */
.tzc-bare { gap: 6px; padding: 8px 10px; max-width: 1480px; }
.tzc-bh { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tzc-tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; border-radius: 7px; background: var(--bg2); }
.tzc-tab { border: 0; border-radius: 5px; background: none; color: var(--ink2); font: inherit; font-size: 12.5px; padding: 3px 10px; cursor: pointer; }
.tzc-tab:hover { color: var(--ink); }
.tzc-tab.on { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.tzc-bare .tzc-edit { border-top: 0; padding-top: 0; gap: 8px; }
.tzc-bare .tzc-form { grid-template-columns: repeat(auto-fill, minmax(120px, 180px) minmax(200px, 1fr)); gap: 4px 10px; }
.tzc-bare .tzc-foot { padding-top: 6px; }
.tzc-prs { display: flex; flex-direction: column; max-width: 980px; }
.tzc-pr { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 28px; padding: 1px 0; border-top: 1px solid var(--line); font-size: 12.5px; }
.tzc-pr:first-child { border-top: 0; }
.tzc-pb { border: 1px solid var(--line2); background: var(--panel2); color: var(--ink2); }
@media (max-width: 760px) { .tzc-grid, .tzc-form { grid-template-columns: minmax(0, 1fr); } .tzc-k { margin-top: 4px; } }

/* 15.10: позиции списком в порядке документов заказчика, «техническое задание» строкой, справа «Посмотреть» и «Скорректировать» */
.tech-tbl .tz-bits { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
.tech-tbl tr.tech-row td.tt-name .small { line-height: 1.25; max-width: 440px; }
.tech-tbl .btn.tzc-view.on, .tech-tbl .btn.tzc-edit-btn.on { border-color: var(--accent); color: var(--accent); }
.tzc .tzc-bit { color: var(--muted); }
