/* Профиль качества детали (#/item), пост ОТК (#/otk), полоса допуска, запись клейма. Норма — серым; цвет —
   только отклонению: препятствия — красным, «обратить внимание» — янтарным. */

.item-page { max-width: 1680px; margin: 0 auto; }
.profile:not(.pf-obj) { display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 24vw, 380px); gap: var(--gap); align-items: start; }
.pf-main, .pf-side { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.skeleton { color: var(--muted); padding: 40px; text-align: center; }
.pf-error h2 { margin: 0 0 6px; }

/* ---------- шапка детали ---------- */
.pf-head { padding: 0 2px; }
.pf-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pf-title h1 { margin: 0; font-size: 24px; }
.pf-type { color: var(--muted); }
.pf-where { margin: 4px 0 0; color: var(--text-2); }

/* ---------- «Можно ли принять»: прежняя форма решений (карточки до панели К40) ---------- */
.acc-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.acc-actions { display: flex; flex-direction: column; gap: 6px; }
.acc-row { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-accept { padding: 11px 16px; font-size: 16px; font-weight: 750; background: var(--text); border-color: var(--text); color: var(--bg); }
.btn-accept:hover:not(:disabled) { background: var(--text-2); }
.btn-accept-off { padding: 9px 14px; font-size: 14px; background: transparent; color: var(--faint); border-style: dashed; opacity: 1; }
.acc-why { margin: 0; font-size: 14px; color: var(--muted); }
.act-hold { color: var(--st-serious-ink); border-color: color-mix(in srgb, var(--st-serious) 55%, var(--line-2)); }
.acc-reason { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line-2); }
.acc-reason label { font-weight: 650; font-size: 14px; }
.acc-reason textarea { resize: vertical; border-radius: 4px; border: 1px solid var(--line-2); background: var(--surface); padding: 6px 8px; }
.acc-err { color: var(--st-critical-ink); font-size: 14px; }
.acc-status { font-size: 14px; }
.acc-status:empty { display: none; }
.acc-status.err { color: var(--st-critical-ink); font-weight: 600; }
.acc-status.ok, .acc-status.busy { color: var(--muted); }
.core-error { max-width: 720px; margin: 10vh auto 0; }
.core-error .acc-row { margin-top: 12px; }

/* запись клейма и квитанции */
.stamp-rec { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 4px; }
.stamp-rec.tone-critical { border-color: var(--st-critical); }
.stamp-h { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.stamp-dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; margin: 0; font-size: 14px; }
.stamp-dl dt { color: var(--muted); }
.stamp-dl dd { margin: 0; color: var(--text); }
.stamp-dl dd.bad { color: var(--st-critical-ink); font-weight: 700; }
.stamp-dl dd.sig-unknown { color: var(--muted); }
.rcpt { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; color: var(--text-2); }
.rcpt li { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 5px; }
.rc-ic { font-weight: 800; color: var(--z-ink); text-align: center; }
.rcpt .tone-serious, .rcpt .tone-critical { color: var(--z-ink); font-weight: 600; }


/* ---------- проверки и полосы допуска ---------- */
.checks { display: flex; flex-direction: column; }
.chk { padding: 8px 4px 10px 10px; border-top: 1px solid var(--line); border-left: 3px solid transparent; }
.chk:first-child { border-top: 0; }
.chk-odd { border-left-color: var(--z); }
.chk-ahead { opacity: .75; }
.chk-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chk-h h3 { margin: 0; font-size: 14px; }
.chk-meta { color: var(--muted); font-size: 14px; margin-left: auto; }
.chk-reason { margin: 3px 0 4px; font-size: 14px; color: var(--muted); }
.chk-odd .chk-reason { color: var(--text-2); }
.chk-cards { margin: 4px 0 0; font-size: 14px; color: var(--st-serious-ink); }

.tb { margin: 6px 0 2px; }
.tb-head { display: flex; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; margin-bottom: 26px; font-size: 14px; }
.tb-title { font-weight: 600; }
.tb-key { font-size: 14px; padding: 0 5px; border-radius: 3px; border: 1px solid var(--line-2); color: var(--muted); }
.tb-spec { color: var(--muted); }
.tb-basis { color: var(--link); font-size: 14px; border-bottom: 1px dotted var(--link); cursor: help; }
.tb-margin { margin-left: auto; color: var(--text-2); }
.tb-odd .tb-margin { color: var(--z-ink); font-weight: 700; }
.tb-bar { position: relative; height: 12px; border-radius: 2px; background: transparent; }
.tb-seg { position: absolute; top: 0; bottom: 0; }
.tb-seg.tb-with_margin { background: var(--line-2); }
.tb-seg.tb-margin_reduced { background: color-mix(in srgb, var(--line-2) 70%, var(--surface-3)); }
.tb-seg.tb-near_limit { background: var(--surface-3); }
.tb-seg.tb-beyond_limit { background: transparent; border-top: 1px dashed var(--line-2); border-bottom: 1px dashed var(--line-2); }
.tb-guard { position: absolute; top: -2px; bottom: -2px;
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--text) 40%, transparent) 0 1.5px, transparent 1.5px 4px); }
.tb-limit { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--text-2); }
.tb-nom { position: absolute; top: 1px; bottom: 1px; width: 0; border-left: 1px dashed var(--muted); }
.tb-marker { position: absolute; top: -6px; bottom: -6px; width: 3px; margin-left: -1.5px; background: var(--text); border-radius: 1px; }
.tb-marker-odd { background: var(--z); width: 4px; margin-left: -2px; }
.tb-val { position: absolute; bottom: calc(100% + 3px); left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 14px; font-weight: 700;
  color: var(--text); }
.tb-marker-odd .tb-val { color: var(--z-ink); }
.tb-scale { position: relative; height: 16px; margin-top: 4px; font-size: 14px; color: var(--muted); }
.tb-lab { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.tb-lab-lower { transform: translateX(-85%); }
.tb-lab-upper { transform: translateX(-15%); }
.tb-scale-2 { height: 34px; }
.tb-lab-r2 { top: 17px; }
.tb-trend { height: 30px; margin-top: 2px; }

.qual { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 14px; }
.q-method { color: var(--muted); }
.q-result { font-weight: 600; color: var(--text-2); }
.q-result.q-odd { color: var(--st-serious-ink); }
.q-meter-wrap { display: inline-flex; align-items: center; gap: 8px; }
.q-meter { position: relative; width: 110px; height: 6px; border-radius: 3px; background: var(--surface-3); }
.q-fill { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--muted); }
.q-meter.low .q-fill { background: var(--st-serious); }
.q-thr { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); }
.q-num { color: var(--muted); }
.q-warn { color: var(--st-standby-ink); font-weight: 700; }

/* ---------- матрица, документы, цепочка, история, карточки ---------- */
.mx-wrap { overflow-x: auto; }
.mx { border-collapse: separate; border-spacing: 2px; width: 100%; font-size: 14px; table-layout: fixed; min-width: 540px; }
.mx th { text-align: left; font-weight: 600; color: var(--muted); padding: 3px 4px; vertical-align: bottom; }
.mx thead th:first-child { width: 128px; }
.mx thead th span { display: block; color: var(--text-2); font-size: 14px; line-height: 1.15; hyphens: manual; }
.mx tbody th b { display: block; color: var(--text); font-size: 14px; font-weight: 600; }
.mx tbody th small { color: var(--faint); font-size: 14px; }
.mx td { text-align: center; padding: 4px 2px; border-radius: 3px; background: var(--surface-2); }
.mx td small { display: block; font-size: 14px; color: var(--muted); }
.mx-odd { box-shadow: inset 0 0 0 1.5px var(--z); }
.mx-odd small { color: var(--z-ink); }
.mx-empty { box-shadow: inset 0 0 0 1.5px var(--st-critical); color: var(--st-critical-ink); font-weight: 700; }
.mx-empty small { color: var(--st-critical-ink); }
.mx-na { background: transparent !important; }
.docs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 14px; }
.docs li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 0 6px; }
.docs small { grid-column: 2; }
.doc-ic { font-weight: 800; color: var(--muted); }
.doc-miss { color: var(--z-ink); }
.doc-miss .doc-ic { color: var(--z-ink); }
.chain-code { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.chain-code.bad { color: var(--z-ink); font-weight: 700; }
.chain-d { margin: 6px 0; font-size: 14px; color: var(--muted); }
.signers { margin: 4px 0 8px; font-size: 14px; }
.tl { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tl-e { display: grid; grid-template-columns: 62px 100px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; padding: 3px 4px;
  font-size: 14px; border-top: 1px solid var(--line); }
.tl-e:first-child { border-top: 0; }
.tl-e time { color: var(--faint); }
.tl-tag { color: var(--muted); font-size: 14px; }
.tl-sig { font-size: 14px; color: var(--faint); white-space: nowrap; }
.tl-decision-recorded .tl-s { font-weight: 600; }
.tl-external-receipt .tl-s { color: var(--text-2); }
.cards { list-style: none; margin: 0 0 8px; padding: 0; font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.card-open { padding-left: 8px; border-left: 3px solid var(--z); }
.card-closed { color: var(--muted); }
.card-body { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.card-dec { margin: 0; font-size: 14px; color: var(--text-2); }

/* ---------- пост ОТК ---------- */
.otkview { display: grid; grid-template-columns: clamp(230px, 19vw, 300px) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.otk-queue { position: sticky; top: 0; max-height: calc(100vh - 130px); overflow: auto; }
.q-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; }
/* очередь — строки списка, а не карточки в панели: разделитель снизу, полоса слева — только у отклонения */
.q-item { display: flex; gap: 8px; align-items: flex-start; padding: 6px 6px 6px 8px; border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent; color: var(--text); text-decoration: none !important; }
.q-item.q-odd-z { border-left-color: var(--z); }
.q-item.q-skip { border-left: 3px dashed var(--st-critical); }
.q-item:hover { background: var(--surface-2); }
.q-item.active { background: var(--surface-3); }
.q-item .zic { margin-top: 2px; }
.zic.zic-skip { background: transparent; color: var(--st-critical-ink); border: 1.5px dashed var(--st-critical); border-radius: 50%; }
.q-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.q-meta { color: var(--muted); font-size: 14px; }
.q-ready { font-size: 14px; color: var(--muted); }
.q-ready.q-odd { color: var(--z-ink); font-weight: 700; }
.q-sub { font-size: 14px; color: var(--muted); margin: 12px 0 4px; font-weight: 600; }
.q-find { display: flex; gap: 6px; }
.q-find input { flex: 1; min-width: 0; border-radius: 4px; border: 1px solid var(--line-2); background: var(--surface-2); padding: 4px 8px; }
.otk-pane { min-width: 0; }
.otk-empty { padding: 40px; text-align: center; color: var(--muted); }

@media (max-width: 1500px) {
  .otkview .profile:not(.pf-obj) { grid-template-columns: minmax(0, 1fr); }
  .otkview .pf-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--gap); }
}
@media (max-width: 1100px) {
  .profile:not(.pf-obj) { grid-template-columns: minmax(0, 1fr); }
  .otkview { grid-template-columns: minmax(0, 1fr); }
  .otk-queue { position: static; max-height: none; }
  .tl-e { grid-template-columns: 58px minmax(0, 1fr); }
  .tl-tag, .tl-sig { grid-column: 2; }
}
@media (max-width: 560px) {
  .tb-margin, .chk-meta { margin-left: 0; }
}

/* «Что увидел анализатор»: пара изображений и ступени анализатора (js/evidence.js) */
.an-cards { display: flex; flex-direction: column; gap: 14px; }
.an-ct { font-size: 14px; margin: 0 0 6px; }
.ev-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ev-fig { margin: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.ev-fig img { display: block; width: 100%; height: auto; aspect-ratio: 360 / 236; object-fit: contain; background: var(--surface-3); }
.ev-fig figcaption { font-size: 14px; color: var(--muted); padding: 3px 8px; }
.ev-obs { border-color: var(--line-2); }
.ev-miss { padding: 24px 8px; text-align: center; color: var(--muted); font-size: 14px; }
.ev-marks { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 6px 0 0; font-size: 14px; }
.ev-mark { padding: 1px 8px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--muted); }
.ev-synth { border-style: dashed; }
.ev-mark.sev-critical { color: var(--z-ink); border-color: var(--z); font-weight: 700; }
.an-stages { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.an-stage { background: var(--surface-2); border-left: 3px solid var(--line-2); border-radius: 4px; padding: 6px 10px; font-size: 14px; }
.an-h { margin-bottom: 3px; }
.an-sum { margin: 0 0 4px; color: var(--muted); font-size: 14px; }
.an-facts { display: flex; flex-direction: column; gap: 2px; }
.an-f.tone-standby { --z: var(--st-standby); --z-ink: var(--st-standby-ink); }
.an-f.tone-critical b, .an-f.tone-serious b, .an-f.tone-standby b { color: var(--z-ink); }
.an-note { color: var(--muted); }
.an-bars { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.an-bars li { display: grid; grid-template-columns: minmax(90px, 40%) minmax(0, 1fr) 38px; gap: 6px; align-items: center; }
.an-bar { height: 7px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.an-fill { display: block; height: 100%; background: var(--muted); }
.an-main .an-bt { font-weight: 700; }
.an-main .an-fill { background: var(--text); }
.an-p { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.an-ver { margin: 6px 0 0; font-size: 14px; }
.an-group + .an-group { margin-top: 6px; }
.an-gt { margin: 2px 0 0; }
.an-status { font-weight: 400; }
.an-card-closed .an-status, .an-card-closed .ev-pair { color: var(--muted); opacity: .8; }
@media (max-width: 900px) { .an-stages { grid-template-columns: minmax(0, 1fr); } }

/* ---------- объектная страница детали (К39, SPEC 3.4): шапка → чек-лист → разделы → нижняя панель ---------- */
.profile.pf-obj { display: flex; flex-direction: column; gap: var(--sp-3); max-width: 1320px; margin: 0 auto;
  font-size: var(--fs-body); line-height: 1.5; }
.pf-obj .btn-small { font-size: var(--fs-cap); }
.pf-stop { display: flex; gap: 8px; align-items: baseline; padding: 6px 12px; border: 1px solid var(--z); border-left-width: 4px;
  border-radius: var(--radius); background: var(--surface); color: var(--z-ink); font-weight: 650; }
.pf-stop[hidden] { display: none; }
.pf-head { display: flex; flex-direction: column; gap: var(--sp-2); padding: 0 2px; }
.pf-head .back { font-size: var(--fs-cap); }
.pf-row1 { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; }
.pf-row1 h1 { margin: 0; font-size: var(--fs-num); line-height: 1.2; }
.pf-type { color: var(--text-2); font-size: var(--fs-h); }
.pf-sp { flex: 1; }
.pf-pill { padding: 2px 10px; border-radius: 4px; border: 1px solid var(--line-2); font-size: var(--fs-cap); font-weight: 650; white-space: nowrap; }
.pl-bad { background: var(--st-serious); border-color: var(--st-serious); color: var(--on-st); }
.pl-ok { color: var(--text); border-color: var(--line-2); }
.pl-ok::first-letter { color: var(--accent); }
.pl-hold { border: 3px solid var(--text-2); color: var(--text); }
.pl-done, .pl-way { color: var(--text-2); }
.pf-hold { font-size: var(--fs-body); border-color: var(--text-2); }
.pf-more { position: relative; }
.pf-more > summary { list-style: none; cursor: pointer; padding: 4px 12px; border: 1px solid var(--line-2); border-radius: 4px; font-weight: 700; }
.pf-more > summary::-webkit-details-marker { display: none; }
.pf-more .mn { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 260px; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 4px; }
.mn-i { display: block; text-align: left; padding: 8px 10px; border: 0; background: none; color: var(--text); cursor: pointer;
  font-size: var(--fs-body); border-radius: 4px; text-decoration: none !important; }
.mn-i:hover { background: var(--surface-3); }
.pf-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); margin: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.fx dt { font-size: var(--fs-cap); color: var(--muted); }
.fx dd { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.fx-n { font-size: var(--fs-num); line-height: 1.2; }
.fx-s { font-size: var(--fs-cap); color: var(--text-2); }
.fx-odd dd, .fx-odd .fx-n { color: var(--z-ink); }
.fx-gauge { position: relative; flex-basis: 100%; height: 6px; margin-top: 4px; border-radius: 3px;
  background: linear-gradient(90deg, var(--surface-3) 0 20%, var(--line-2) 20% 100%); }
.fx-mark { position: absolute; top: -4px; width: 4px; height: 14px; margin-left: -2px; background: var(--text); border-radius: 1px; }
.fx-mark[class*=" z-"] { background: var(--z); }

/* чек-лист «Можно ли принять» */
.pf-check { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px;
  display: flex; flex-direction: column; gap: 8px; }
.cl-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.cl-h { margin: 0; font-size: var(--fs-h); flex: 1; }
.cl-h.sev-serious { color: var(--z-ink); }
.cl-done { color: var(--muted); font-size: var(--fs-cap); }
.cl-rows, .cl-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cl-row { display: flex; flex-direction: column; gap: 4px; }
.cl-title { font-weight: 650; }
.cl-line { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto; gap: 4px 10px; align-items: baseline;
  padding: 6px 8px; border-left: 4px solid var(--line-2); background: var(--surface-2); border-radius: 3px; }
.cl-line.mk-fail { border-left-color: var(--st-critical); }
.cl-line.mk-fail .cl-mk { color: var(--st-critical-ink); }
.cl-line.mk-wait { border-left-color: var(--faint); border-left-style: dashed; }
.cl-line.mk-wait .cl-mk, .cl-line.mk-info .cl-mk { color: var(--muted); }
.cl-line.cl-gone { border-left-color: var(--line-2); color: var(--muted); }
.cl-mk { font-weight: 800; text-align: center; }
.cl-who { color: var(--muted); font-size: var(--fs-cap); white-space: nowrap; }
.cl-when { color: var(--muted); font-size: var(--fs-cap); }
.cl-extra { margin: 0; display: flex; gap: 8px; padding: 6px 8px; border-left: 4px solid var(--st-serious); background: var(--surface-2); }
.cl-okline { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--text-2); }
.cl-quiet { margin: 0; display: flex; gap: 8px; color: var(--muted); font-size: var(--fs-cap); }
.cl-note { margin: 0; display: flex; gap: 8px; color: var(--text-2); font-size: var(--fs-cap); }
.cl-nmk { color: var(--st-serious-ink); font-weight: 800; }
.cl-sys summary, .st-sig summary, .sec-mx summary { cursor: pointer; color: var(--link); font-size: var(--fs-cap); }
.cl-sys ul { margin: 6px 0 0; padding-left: 20px; font-size: var(--fs-cap); color: var(--text-2); }
.pf-stamp { background: var(--surface); border: 1px solid var(--line-2); border-left: 4px solid var(--text-2); border-radius: var(--radius); padding: 12px 16px; }
.pf-stamp.tone-critical { border-left-color: var(--st-critical); }
.st-line { margin: 0 0 6px; font-size: var(--fs-h); font-weight: 650; display: flex; gap: 10px; }
.pf-fresh { font-size: var(--fs-cap); }

/* строка разделов и разделы */
.pf-secs { display: flex; flex-wrap: wrap; gap: 8px; position: sticky; top: -10px; z-index: 4; padding: 12px 0 6px; margin-top: -6px; background: var(--bg); }
.sec-b { padding: 8px 14px; border: 1px solid var(--line-2); border-radius: 4px; background: var(--surface); cursor: pointer;
  font-size: var(--fs-body); font-weight: 600; color: var(--text); }
.sec-b.on { border-color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); }
.sec .panel-h { font-size: var(--fs-h); color: var(--text); }
.sec-h { margin: 12px 0 6px; font-size: var(--fs-body); }
.chk-filter { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text);
  cursor: pointer; font-size: var(--fs-cap); }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--surface-3); font-weight: 650; }
.chk-all { margin-top: 8px; }
.card-next { margin: 2px 0 4px; font-size: var(--fs-cap); color: var(--text-2); }

/* нижняя панель 64 px */
.pf-foot { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: var(--h-foot); padding: 8px 16px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); }
.ft-left { position: relative; }
.ft-block { color: var(--st-critical-ink); border-color: var(--st-critical); font-size: var(--fs-body); }
.ft-pop { position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 20; min-width: 360px; max-width: 70vw; list-style: none; margin: 0;
  padding: 4px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); }
.ft-go { display: block; width: 100%; text-align: left; padding: 8px; border: 0; background: none; color: var(--text); cursor: pointer; font-size: var(--fs-body); }
.ft-go:hover { background: var(--surface-3); }
.ft-right { display: flex; gap: 8px; }
.btn-main { min-height: var(--h-row); padding: 8px 20px; font-size: var(--fs-body); font-weight: 700;
  background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn-main:hover:not(:disabled) { filter: brightness(1.1); background: var(--accent); }

/* окно решения и окно удержания (decide.js) — на уровне body, вне #view */
dialog.dlg { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0; z-index: 60;
  width: min(780px, calc(100vw - 32px)); max-height: calc(100vh - 64px); overflow: auto; padding: 0;
  background: var(--surface); color: var(--text); border: 2px solid var(--text-2); border-radius: var(--radius);
  font-size: var(--fs-body); line-height: 1.5; }
.dlg-h { display: flex; align-items: baseline; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.dlg-h h2 { margin: 0; flex: 1; font-size: var(--fs-h); }
.dlg-saved { color: var(--muted); font-size: var(--fs-cap); }
.dlg-x { border: 0; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--text-2); padding: 0 4px; }
.dlg-while { margin: 0; padding: 8px 16px; background: var(--surface-2); border-left: 4px solid var(--st-serious); }
.dlg-lead { padding: 8px 16px 0; }
.dlg-lead p { margin: 0 0 4px; }
.dec-opts { display: flex; flex-direction: column; gap: 6px; padding: 10px 16px 0; }
.dec-opts[hidden] { display: none; }
.dec-opt { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 2px 8px; padding: 6px 10px; border: 1px solid var(--line-2);
  border-radius: 4px; cursor: pointer; }
.dec-opt.on { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.dec-opt.dec-off { cursor: not-allowed; color: var(--muted); border-style: dashed; }
.dec-opt input { margin-top: 5px; width: 18px; height: 18px; }
.dec-body { display: flex; flex-direction: column; gap: 0; line-height: 1.4; }
.dec-l { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.dec-why { font-size: var(--fs-cap); color: var(--muted); }
.dec-when, .dec-what, .dec-next { font-size: var(--fs-cap); color: var(--text-2); }
.dec-reason, .dec-due { display: flex; flex-direction: column; gap: 6px; padding: 12px 16px 0; }
.dec-reason[hidden], .dec-due[hidden] { display: none; }
.dec-lab { font-weight: 650; }
.dec-reason .chips, .dec-due .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dec-reason textarea { resize: vertical; border-radius: 4px; border: 1px solid var(--line-2); background: var(--surface-2); padding: 8px; font-size: var(--fs-body); }
.dlg-f { position: sticky; bottom: 0; display: flex; flex-direction: column; gap: 6px; padding: 10px 16px; margin-top: 12px;
  border-top: 1px solid var(--line); background: var(--surface); }
.dec-sign { margin: 0; font-weight: 650; }
.dec-miss { margin: 0; color: var(--st-serious-ink); font-size: var(--fs-cap); }
.dec-miss:empty, .dec-status:empty, .dec-sign:empty { display: none; }
.dec-status { margin: 0; }
.dec-status.err { color: var(--st-critical-ink); font-weight: 650; }
.dec-status.ok { font-weight: 650; }
.dlg-btns { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.btn-link { border: 0; background: none; color: var(--link); margin-right: auto; }
.btn-link[hidden] { display: none; }
.dlg-ask { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 4px; }
.dlg-ask[hidden] { display: none; }
@media (max-width: 1100px) { .pf-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cl-line { grid-template-columns: 22px minmax(0, 1fr); } }
/* нижняя панель — у низа окна и при короткой странице */
.item-page:has(> .pf-obj) { min-height: 100%; display: flex; flex-direction: column; }
.item-page > .pf-obj { flex: 1 0 auto; width: 100%; }
.pf-obj > .pf-foot { margin-top: auto; }

/* «История» детали (К39, П4д): без своей прокрутки, решения людей — карточкой, записи станков и приёма — серой строкой */
.tl-tools { display: flex; gap: 8px 24px; flex-wrap: wrap; }
.tl-count { margin: 0 0 6px; font-size: var(--fs-cap); }
.pf-history .tl-e { font-size: var(--fs-cap); color: var(--text-2); }
.tl-e.tl-human { display: flex; flex-direction: column; gap: 2px; margin: 6px 0; padding: 8px 12px; border: 1px solid var(--line-2);
  border-left: 4px solid var(--text-2); border-radius: 4px; background: var(--surface); color: var(--text); font-size: var(--fs-body); }
.tl-dh { font-weight: 650; }
.tl-why { color: var(--text-2); }
.tl-rc { color: var(--muted); font-size: var(--fs-cap); }
.tl-group { display: block; }
.tl-run summary { cursor: pointer; color: var(--muted); }
.tl-in { margin: 4px 0 4px 16px; }
.tl-more-b { margin-top: 8px; }
.pf-history .fresh-bar { position: sticky; top: 52px; z-index: 3; }
.ft-way { color: var(--muted); }
.flash { background: var(--surface-3) !important; outline: 2px solid var(--accent); outline-offset: 2px; }
