/* Боковые панели: «Почему так» и «Помощник». */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 500px; max-width: 94vw; z-index: 50; display: flex; flex-direction: column;
  background: var(--panel); border-left: 1px solid var(--line); box-shadow: var(--shadow-l); animation: slide-in .16s ease-out;
}
@keyframes slide-in { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); }
.drawer-head .ico { color: var(--accent); }
.drawer-body { flex: 1; overflow: auto; padding: 14px 16px 28px; }
.why-title { font-size: 17px; margin: 4px 0; line-height: 1.3; }
/* ТЗ позиции по клику на код (20.10): только ТЗ, коротко */
.tzb { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.tzb-cust { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tzb-kv dd { text-align: left; overflow-wrap: anywhere; }
.tzb .sub-h { margin: 12px 0 4px; }
.tzb-warn { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.tzb-warn .chip { height: auto; min-height: 18px; white-space: normal; line-height: 1.25; }
.why { margin: 0; padding-left: 18px; font-size: 13px; }
.why li { margin: 0 0 8px; overflow-wrap: anywhere; }
details.more { margin-top: 10px; }
details.more summary { cursor: pointer; color: var(--accent); font-size: 13px; margin-bottom: 8px; }

/* чат помощника */
.chat .drawer-body { display: flex; flex-direction: column; gap: 10px; background: var(--panel2); }
.chat-empty { color: var(--muted); font-size: 13.5px; }
.chat-empty .ex { display: flex; width: 100%; justify-content: flex-start; margin-top: 6px; height: auto; padding: 6px 10px; white-space: normal; text-align: left; }
.msg { max-width: 88%; display: flex; flex-direction: column; gap: 2px; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg-meta { font-size: 11.5px; color: var(--faint); }
.msg-text {
  padding: 8px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); white-space: pre-wrap;
  overflow-wrap: anywhere; font-size: 13.5px;
}
.msg.me .msg-text { background: var(--accent-soft); border-color: transparent; }
.msg-text code { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12.5px; background: var(--bg2); padding: 0 4px; border-radius: 4px; }
.md-pre { margin: 6px 0; padding: 8px 10px; background: var(--bg2); border-radius: 6px; font: 12px/1.4 Consolas, "Cascadia Mono", monospace; white-space: pre-wrap; }
.chg { font-size: 13px; }
.chat-in { border-top: 1px solid var(--line); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.files-pick summary { cursor: pointer; color: var(--muted); }
.files-pick .chk { display: flex; margin: 4px 0; }

/* смета по лотам на экране до 1400 px: сверка с ЗП — строкой над таблицей, таблица на всю ширину */
@media (max-width: 1400px) {
  .lots { grid-template-columns: 1fr; }
  .lots-side { position: static; order: -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
  .lots-side h3 { margin: 0; }
  .lots-side .kv2 { display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 0; }
  .lots-side .kv2 dd { margin-right: 10px; font-weight: 600; }
  .lots-side > div { margin: 0 !important; }
}

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lots { grid-template-columns: minmax(0, 1fr); }
  .new-grid { grid-template-columns: minmax(0, 1fr); }
  .frow-line { grid-template-columns: 40px minmax(120px, 1fr) 150px 16px; }
  .frow-size, .frow-line > span:nth-child(4) { display: none; }
  .ocard { grid-template-columns: minmax(200px, 1fr) 120px 120px auto; }
  .ocard > :nth-child(4), .ocard > :nth-child(5) { display: none; }
}

/* узкое окно браузера (07.10): список заказов — карточка в три строки (после правила ≤ 1100 px: оно в этом файле выше) */
@media (max-width: 640px) {
  .ocard { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 10px 12px; }
  .ocard > * { min-width: 0; }
  .ocard > :nth-child(1) { grid-column: 1 / -1; }
  .ocard > :nth-child(2) { grid-column: 1; }
  .ocard > :nth-child(3) { grid-column: 2; grid-row: 2; }
  .ocard > :nth-child(6) { grid-column: 1 / -1; justify-self: start; }
}
