/* Quotra — компоненты: кнопки, бейджи, флаги, таблицы, поля, вкладки, KPI, модальные окна, тосты, пустые состояния. DESIGN_SPEC.md §2 */

/* ------------------------------------------------------------------ кнопки */
.btn, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--control-h); padding: 8px 14px;
  font-size: var(--fs-md); font-weight: 500; line-height: 1.2; text-decoration: none; white-space: nowrap;
  color: var(--ink-900); background: var(--surface); border: 1px solid var(--line-input); border-radius: var(--r-md);
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover, button:hover { background: var(--bg-muted); color: var(--ink-900); }
.btn:disabled, button:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary, button.primary, .btn.primary {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600;
}
.btn-primary:hover, button.primary:hover, .btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-ghost, button.link, .btn.link {
  min-height: 0; padding: 6px 8px; border-color: transparent; background: transparent; color: var(--accent); font-weight: 500;
}
.btn-ghost:hover, button.link:hover { background: var(--bg-muted); color: var(--accent-hover); }
button.link.danger, .btn-ghost.danger { color: var(--ink-500); }
button.link.danger:hover, .btn-ghost.danger:hover { color: var(--danger-fg); background: var(--danger-bg); }
.btn-danger, button.danger:not(.link) { background: var(--danger-fg); border-color: var(--danger-fg); color: #fff; font-weight: 600; }
.btn-danger:hover, button.danger:not(.link):hover { background: #96190F; border-color: #96190F; color: #fff; }
.btn-sm { min-height: 32px; padding: 5px 10px; font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn-lg { min-height: 48px; padding: 12px 22px; font-size: 16px; border-radius: var(--r-lg); }
.btn-block { width: 100%; }
.icon-btn { min-height: 32px; width: 32px; padding: 0; border-color: transparent; background: transparent; color: var(--ink-500); border-radius: var(--r-sm); }
.icon-btn:hover { background: var(--bg-muted); color: var(--ink-900); }

/* ------------------------------------------------------------ бейджи статуса */
.pill {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: var(--fs-sm); font-weight: 600; line-height: 1.4; border-radius: var(--r-pill); padding: 3px 10px;
  background: var(--neutral-bg); color: var(--neutral-fg);
}
.pill-parsing { background: var(--accent-soft); color: var(--accent); }
.pill-review { background: var(--warn-bg); color: var(--warn-fg); }
.pill-ask { background: var(--ask-bg); color: var(--ask-fg); }
.pill-sent { background: var(--neutral-bg); color: var(--neutral-fg); }
.pill-won, .pill-ok { background: var(--ok-bg); color: var(--ok-fg); }
.pill-lost, .pill-danger { background: var(--danger-bg); color: var(--danger-fg); }
.pill-sm { font-size: var(--fs-xs); padding: 2px 8px; }
.pill-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* флаги позиций: * допущение, ≈ приближённо, ! без цены */
.flag-star { font-weight: 700; color: var(--warn-star); }
.flag-approx { font-weight: 700; color: var(--ink-900); }
.flag-none { font-weight: 700; color: var(--danger-fg); }
.flag-chip { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; font-weight: 700; }
.flag-chip.star { background: var(--warn-bg); color: var(--warn-star); }
.flag-chip.none { background: var(--danger-bg); color: var(--danger-fg); }
.flag-chip.ok { background: var(--ok-bg); color: var(--ok-fg); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--ink-500); }

/* ---------------------------------------------------------------- карточки */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.card-pad { padding: var(--sp-5); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); flex-wrap: wrap; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 18px; }
.card-head .sub { font-size: var(--fs-sm); color: var(--ink-500); }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--bg-subtle); border-radius: 0 0 var(--r-card) var(--r-card); }
.card-title { font-family: var(--font-head); font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.card-dark { background: var(--ink-900); color: #fff; border-color: var(--ink-900); }

/* ----------------------------------------------------------------- таблицы */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; } /* relative: скрытые подписи (.sr-only) не растягивают страницу */
.q-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.q-table th {
  text-align: left; font-size: var(--fs-xs); font-weight: 500; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-500); background: var(--bg-subtle); padding: 12px 18px; white-space: nowrap;
}
.q-table td { padding: 14px 18px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.q-table tbody tr:hover { background: var(--bg-hover); }
.q-table .num, .q-table th.num { text-align: right; }
.q-table tr.clickable { cursor: pointer; }
.q-table tr.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.q-table .cell-sub { display: block; font-size: var(--fs-sm); color: var(--ink-500); }
.q-table.compact th { padding: 10px 12px; }
.q-table.compact td { padding: 12px; }
.q-table.compact th:first-child, .q-table.compact td:first-child { padding-left: 20px; }
.q-table.compact th:last-child, .q-table.compact td:last-child { padding-right: 20px; }

/* ------------------------------------------------------------------- поля */
.field-q { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-q > label, .field-q > .label { font-size: var(--fs-md); font-weight: 500; }
.field-q .hint { font-size: var(--fs-sm); color: var(--ink-500); }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], input[type="tel"], input:not([type]), select, textarea {
  min-height: var(--control-h); padding: 8px 12px; font-size: var(--fs-base); line-height: 1.4;
  background: var(--surface); color: var(--ink-900); border: 1px solid var(--line-input); border-radius: var(--r-md); min-width: 0; max-width: 100%;
}
textarea { min-height: 96px; resize: vertical; }
select { padding-right: 32px; }
input:disabled, select:disabled, textarea:disabled, input[readonly] { background: var(--bg-subtle); color: var(--ink-700); }
input.lg, .input-lg { min-height: 48px; padding: 12px 14px; font-size: 16px; border-color: var(--line-strong); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex: none; }
input[type="file"] { font-size: var(--fs-md); max-width: 100%; }
.check { display: flex; align-items: center; gap: 10px; font-size: var(--fs-md); cursor: pointer; }
.check-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: var(--fs-md); padding: 4px 0; cursor: pointer; }
.search {
  display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line-input); border-radius: var(--r-md);
  padding: 0 12px; height: var(--control-h); min-width: 0; width: min(320px, 100%);
}
.search input { border: 0; outline: none; min-height: 0; padding: 0; flex: 1; background: transparent; }
.search:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.kbd { font-family: var(--font-mono); font-size: 11px; color: var(--ink-500); border: 1px solid var(--line-input); border-radius: 5px; padding: 0 5px; }

/* ------------------------------------------------------------------ вкладки */
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  min-height: 0; padding: 12px 0; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent;
  color: var(--ink-500); font-size: var(--fs-base); font-weight: 500; white-space: nowrap; text-decoration: none;
}
.tab:hover { background: transparent; color: var(--ink-900); }
.tab[aria-selected="true"], .tab.active { color: var(--ink-900); font-weight: 600; border-bottom-color: var(--accent); }
.tab .count { color: var(--ink-500); font-weight: 500; margin-left: 4px; }

/* сегментированный фильтр */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; background: #E9ECF1; border-radius: var(--r-lg); padding: 4px; max-width: 100%; }
.seg a, .seg button {
  min-height: 0; border: 0; border-radius: 9px; padding: 8px 14px; font-size: var(--fs-md); font-weight: 500; color: var(--ink-700);
  background: transparent; text-decoration: none; white-space: nowrap;
}
.seg a:hover, .seg button:hover { color: var(--ink-900); background: rgba(255,255,255,.5); }
.seg [aria-current="page"], .seg [aria-selected="true"] { background: var(--surface); color: var(--ink-900); font-weight: 600; box-shadow: 0 1px 2px rgba(14,17,22,.08); }
.seg .count { margin-left: 6px; color: var(--ink-500); font-weight: 500; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------- KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi .label { font-size: var(--fs-sm); color: var(--ink-500); }
.kpi .value { font-family: var(--font-head); font-weight: 600; font-size: 28px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi .value small { font-family: var(--font-ui); font-size: 16px; color: var(--ink-500); font-weight: 500; letter-spacing: 0; }
.kpi .value.accent { color: var(--accent); }

/* ------------------------------------------------------------- сообщения */
.note { display: flex; gap: 10px; align-items: flex-start; font-size: var(--fs-md); border-radius: var(--r-md); padding: 10px 12px; }
.note-warn { background: var(--warn-bg); color: var(--warn-text); }
.note-info { background: var(--accent-soft); color: var(--accent-ink); }
.note-danger { background: var(--danger-bg); color: var(--danger-fg); }
.note-ok { background: var(--ok-bg); color: var(--ok-fg); }
.note-neutral { background: var(--bg); color: var(--ink-700); }
.note svg { margin-top: 2px; }

/* ----------------------------------------------------------- пустые состояния */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 48px 24px; color: var(--ink-500); }
.empty h3 { font-size: 18px; color: var(--ink-900); }
.empty p { max-width: 460px; }

/* скелетон строки при разборе */
.skeleton { display: inline-block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, #EEF0F3 25%, #F6F7F9 37%, #EEF0F3 63%); background-size: 400% 100%; animation: q-shimmer 1.4s ease infinite; vertical-align: middle; }
.skeleton.w-40 { width: 40px; } .skeleton.w-80 { width: 80px; } .skeleton.w-120 { width: 120px; } .skeleton.w-full { width: 100%; }
@keyframes q-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ------------------------------------------------------------ модальное окно */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 15, 30, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.modal { width: min(460px, 100%); background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-modal); padding: 24px; display: flex; flex-direction: column; gap: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.modal h2 { font-size: 20px; }
.modal p { color: var(--ink-700); }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- тосты */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 110; pointer-events: none; max-width: calc(100vw - 40px); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; background: var(--ink-900); color: #fff; font-size: var(--fs-md); border-radius: var(--r-lg); padding: 12px 16px; box-shadow: var(--shadow-pop); animation: q-toast .2s ease; }
.toast.error { background: var(--danger-fg); }
.toast svg { color: var(--accent-on-dark); }
@keyframes q-toast { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------- выпадающее меню */
.menu-wrap { position: relative; display: inline-block; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: 6px; z-index: 50; display: flex; flex-direction: column; }
.menu button { justify-content: flex-start; border: 0; background: transparent; font-weight: 500; padding: 8px 10px; min-height: 0; border-radius: var(--r-sm); }
.menu button:hover { background: var(--bg-muted); }

/* ------------------------------------------------------- панель сохранения */
.savebar {
  position: sticky; bottom: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  background: rgba(255,255,255,.96); border-top: 1px solid var(--line); padding: 14px 36px; margin: 0 -36px;
}
.savebar .dirty { display: inline-flex; gap: 8px; align-items: center; font-size: var(--fs-md); color: var(--ink-700); }
.savebar .dirty::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #E8A317; }

/* знак и надпись Quotra — кабинет, вход, документы, ошибки */
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--ink-900); text-decoration: none; }
.logo:hover { color: var(--ink-900); }
.logo span { font-family: var(--font-head); font-weight: 700; font-size: 20px; letter-spacing: -0.02em; }

/* Ассистент Quotra: кнопка справа внизу и панель чата; на телефоне — на весь экран */
.qa-fab { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 18px 0 14px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font: 600 15px/1 var(--font-body); box-shadow: var(--shadow-pop); cursor: pointer; }
.qa-fab:hover { background: var(--accent-hover); }
.qa-panel { position: fixed; right: 20px; bottom: 80px; z-index: 81; width: min(400px, calc(100vw - 32px)); height: min(600px, calc(100vh - 110px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); overflow: hidden; }
.qa-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.qa-head b { font-family: var(--font-head); font-size: 16px; display: block; }
.qa-sub { font-size: var(--fs-xs); color: var(--ink-500); }
.qa-close { font-size: 22px; line-height: 1; width: 36px; height: 36px; }
.qa-log { flex: 1 1 auto; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.qa-msg { max-width: 88%; padding: 9px 12px; border-radius: 14px; font-size: var(--fs-md); line-height: 1.45; white-space: pre-line; }
.qa-assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; color: var(--ink-900); }
.qa-user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.qa-wait .qa-text { color: var(--ink-500); letter-spacing: 2px; }
.qa-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px 0; background: var(--bg); }
.qa-chip { border: 1px solid var(--line-input); background: var(--surface); color: var(--ink-700); border-radius: 999px; padding: 6px 12px; font-size: var(--fs-sm); cursor: pointer; }
.qa-chip:hover { border-color: var(--accent); color: var(--accent); }
.qa-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface); }
.qa-input { flex: 1 1 auto; resize: none; min-height: 40px; max-height: 120px; padding: 9px 12px; border: 1px solid var(--line-input); border-radius: var(--r-md); font: inherit; font-size: var(--fs-md); }
.qa-send { width: 44px; height: 40px; padding: 0; justify-content: center; }
.qa-note { margin: 0; padding: 0 16px 10px; font-size: var(--fs-xs); color: var(--ink-500); background: var(--surface); }
@media (max-width: 600px) {
  .qa-fab { right: 14px; bottom: 14px; }
  .qa-panel { inset: 0; width: 100%; height: 100%; border-radius: 0; border: 0; }
  html.qa-open, html.qa-open body { overflow: hidden; }
  html.qa-open .qa-fab { display: none; }
}
@media print { .qa-fab, .qa-panel { display: none !important; } }

/* Метка расчёта по ставкам (только кабинет): A — по данным цеха, B — оценка, C — нет данных */
.conf-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; margin-left: 4px; padding: 0 5px; border-radius: 6px; font-size: 12px; font-weight: 700; background: var(--ok-bg); color: var(--ok-fg); }
.conf-chip.conf-B { background: var(--warn-bg); color: var(--warn-star); }
.conf-chip.conf-C { background: var(--danger-bg); color: var(--danger-fg); }
.legend .conf-chip { margin: 0 2px 0 0; height: 18px; min-width: 18px; font-size: 11px; }
.rate-table td, .rate-table th { white-space: nowrap; }
.rate-table tr.group-first td { border-top: 2px solid var(--line); }
.rate-table input.confirmed { border-width: 2px; border-color: var(--ink-700); font-weight: 600; }
.rate-table input.estimated { border-style: dashed; }
.tpl-row { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 10px; align-items: center; }
.tpl-row .w-xl { width: 100%; }
.json-field textarea { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
@media (max-width: 640px) { .tpl-row { grid-template-columns: 1fr; gap: 2px; } }
/* Карточка клиента */
.card-kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
.card-kv dt { color: var(--ink-500); }
.card-kv dd { margin: 0; overflow-wrap: anywhere; }
ul.hist { padding-left: 18px; margin: 0 0 8px; max-height: 260px; overflow: auto; }
@media (max-width: 520px) { .card-kv { grid-template-columns: 1fr; gap: 0 0; } .card-kv dd { margin-bottom: 8px; } }
.modal.wide { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; }
.req-terms { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; }
.client-line { margin: 0; }
.conf-chip.conf-low { background: var(--danger-bg); color: var(--warn-star); outline: 1px solid var(--warn-star); }

/* Шина по торцам (заказ на производство): 20 / 30 / нет, клик переключает */
.bus-box { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; margin-left: 6px; }
.bus-box:empty { display: none; }
.c-name .bus-box { display: flex; margin: 4px 0 0 18px; }
.c-name .bus-box:empty { display: none; }
.bus-chip { font: inherit; font-size: var(--fs-xs); line-height: 1; padding: 4px 7px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-900); cursor: pointer; min-width: 30px; min-height: 0; height: 22px; }
.bus-label { font-size: var(--fs-xs); color: var(--ink-500); margin-right: 2px; }
.bus-chip:hover:not(:disabled) { background: var(--bg-hover); }
.bus-chip:disabled { cursor: default; opacity: .8; }
.bus-chip.bus-30 { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-text); }
.bus-chip.bus-none { background: var(--bg-muted); color: var(--ink-500); text-decoration: line-through; }
.bus-chip.bus-manual { box-shadow: inset 0 -2px 0 var(--accent); }
.bus-chip.bus-req { border-style: dashed; border-color: var(--warn-star); }
.bus-hint { font-size: var(--fs-xs); color: var(--warn-text); }
.bus-src { font-size: var(--fs-xs); color: var(--ink-500); white-space: nowrap; }
.bus-src.bus-src-req { color: var(--warn-text); }
.type-sections { width: 100%; border-collapse: collapse; }
.type-sections td { padding: 4px 6px; border-bottom: 1px solid var(--line, #e6e8eb); }
.type-sections th { text-align: left; font-weight: 500; color: var(--ink-500); font-size: var(--fs-sm); padding: 4px 6px; }
.type-sections select { width: 100%; max-width: 280px; }
.type-sections .ts-short { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.type-sections .ts-confirm { white-space: nowrap; }
@media (max-width: 640px) { .type-sections .ts-confirm { white-space: normal; } }
/* Цена шины — оценка: заметно в строке и в легенде */
.bus-est-chip { display: inline-flex; align-items: center; height: 22px; margin-left: 4px; padding: 0 6px; border-radius: var(--r-sm);
  font-size: 12px; font-weight: 700; background: var(--warn-bg); color: var(--warn-text); border: 1px dashed var(--warn-star); white-space: nowrap; }
.legend .bus-est-chip { height: 18px; font-size: 11px; margin: 0 2px 0 0; }
#bus-est-note { flex-direction: column; gap: 4px; }

/* Быстрый ввод: строки слева, фото для сверки справа */
.quick-panel { padding: 16px 20px; border-bottom: 1px solid var(--line); background: var(--bg-subtle); }
.quick-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.quick-grid:has(.quick-photo.hidden) { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 900px) { .quick-grid { grid-template-columns: minmax(0, 1fr); } }
#quick-text { width: 100%; font-family: var(--font-mono); font-size: var(--fs-md); line-height: 1.5; resize: vertical; }
.quick-lines { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow: auto; }
.quick-lines:empty { display: none; }
.quick-line { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; border-radius: var(--r-sm); font-size: var(--fs-sm); background: var(--surface); border: 1px solid var(--line-soft); }
.quick-line.bad { background: var(--danger-bg); border-color: var(--danger-fg); }
.quick-line .quick-n { flex: none; min-width: 20px; color: var(--ink-500); font-variant-numeric: tabular-nums; }
.quick-line.ok .quick-n::before { content: "✓ "; color: var(--ok-fg); }
.quick-line.bad .quick-n::before { content: "! "; color: var(--danger-fg); font-weight: 700; }
.quick-err { color: var(--danger-fg); font-weight: 600; }
.quick-photo { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 6px; }
.quick-photo-frame { max-height: 520px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.quick-photo-frame img { display: block; width: 100%; height: auto; cursor: zoom-in; }
.quick-photo.zoomed .quick-photo-frame img { width: 220%; max-width: none; cursor: zoom-out; }
.quick-photo .btn.active { background: var(--accent-soft); }
.quick-default { font-size: var(--fs-sm); color: var(--warn-text); }

/* Заказ на производство в карточке заявки (узкая колонка) */
.prod-orders { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.prod-orders li { padding: 8px 0; border-top: 1px solid var(--line); min-width: 0; }
.prod-orders li:first-child { border-top: 0; padding-top: 0; }
.prod-order-head { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.prod-order-sub { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; font-size: var(--fs-sm); margin-top: 2px; }

/* Раздел «Цены и изделия» во время внедрения — только просмотр */
.setup-locked [inert] { opacity: .65; }
.prod-orders li.cancelled .prod-order-head b { text-decoration: line-through; color: var(--ink-500); }
.prod-progress { font-size: var(--fs-sm); }
.modal.issue-modal { width: min(920px, calc(100vw - 32px)); }
.issue-table td, .issue-table th { vertical-align: middle; }
.issue-table td.n { color: var(--ink-500); }
.issue-table input.w-s { width: 80px; text-align: right; }

/* Отметка выдачи в строке позиции */
.prod-mark { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: var(--fs-xs); color: var(--ink-500); margin-top: 2px; }
.prod-mark:empty { display: none; }
.prod-mark-text.done { color: var(--ok-fg); }
.prod-mark-chg { background: var(--warn-bg); color: var(--warn-fg); border-radius: var(--r-sm); padding: 0 6px; font-weight: 600; }
#reprice-btn { font-size: var(--fs-sm); }
.modal.reprice-modal { width: min(820px, calc(100vw - 32px)); }

/* «Цены и изделия» (22.11.2026, макет docs/mockups/settings_2026_11_22): пример было → стало, карточки изделий, эскизы */
.example-card .old { color: var(--text-on-dark-2); text-decoration: line-through; font-weight: 400; margin-right: 8px; }
.example-card .up { color: #FFD27A; }
.example-card .down { color: #8FE0B0; }
.ex-sizes { display: flex; gap: 6px; flex-wrap: wrap; }
.ex-sizes button { white-space: normal; text-align: left; max-width: 100%; overflow-wrap: anywhere; line-height: 1.3; border: 1px solid #2F3850; background: #1C2333; color: var(--text-on-dark); border-radius: var(--r-sm); padding: 5px 10px; font-size: var(--fs-sm); }
.ex-sizes button.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
/* изделие: эскиз и размеры как на helpeng / в СофтВенте */
.prod-layout { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.prod-list { flex: 1 1 220px; max-width: 260px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.prod-list .grp { font-size: var(--fs-xs); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-500); padding: 10px 8px 4px; }
.prod-list button { display: flex; justify-content: space-between; gap: 8px; text-align: left; border: 0; background: transparent; padding: 8px; border-radius: var(--r-sm); font-size: var(--fs-md); color: var(--ink-700); }
.prod-list button:hover { background: var(--bg-muted); }
.prod-list button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.prod-list .code { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink-500); }
.prod-card { flex: 999 1 480px; min-width: 0; }
.sketch-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 20px; }
.sketch { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px; }
.sketch figcaption { font-size: var(--fs-sm); color: var(--ink-500); padding: 6px 4px 0; }
.dims { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 2px; background: var(--bg-subtle); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px 14px; }
.dim { display: grid; grid-template-columns: minmax(0, 1fr) 58px 130px 30px; gap: 10px; align-items: center; padding: 6px 0; font-size: var(--fs-md); }
.dim .letter { display: inline-flex; align-items: center; justify-content: center; height: 30px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line-input); font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--accent); font-style: italic; }
.dim input { min-height: 34px; padding: 5px 8px; text-align: right; }
.dim .unit { color: var(--ink-500); font-size: var(--fs-sm); }
.dim .src { grid-column: 1 / -1; font-size: var(--fs-xs); color: var(--ink-500); margin-top: -4px; }
.dims .sep { border-top: 1px solid var(--line); margin: 6px 0; }
.sk { width: 100%; height: auto; background: var(--bg-subtle); border: 1px solid var(--line); border-radius: var(--r-lg); }
.sk .o { fill: #EEF1F5; stroke: #0E1116; stroke-width: 1.4; }
.sk .f { fill: #C9CED6; stroke: #0E1116; stroke-width: 1; }
.sk .l { fill: none; stroke: #0E1116; stroke-width: 1.1; }
.sk .c { fill: none; stroke: #8A93A0; stroke-width: .8; stroke-dasharray: 8 3 2 3; }
.sk .d { fill: none; stroke: #1F4FE0; stroke-width: 1; }
.sk .t { font-family: Onest, sans-serif; font-style: italic; font-size: 14px; fill: #1F4FE0; }
.sk .n { font-family: Onest, sans-serif; font-size: 11px; fill: #5B6472; }
.sk { max-height: 330px; }
/* заявка: «Как посчитано» в строке позиции */
.how { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.how-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.how-step { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line-soft); }
.how-step:first-of-type { border-top: 0; }
.how-step .n { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: var(--fs-sm); font-weight: 600; display: flex; align-items: center; justify-content: center; }
.how-step .t { font-weight: 600; font-size: var(--fs-md); }
.how-step .d { font-size: var(--fs-sm); color: var(--ink-700); white-space: pre-line; }
.how-step a { font-size: var(--fs-sm); font-weight: 500; }
/* раздел «Цены и изделия»: таблица прайса, история, карточка изделия на телефоне */
.price-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.price-cell input { width: 96px; min-height: 34px; padding: 5px 8px; text-align: right; border-radius: var(--r-sm); }
.price-cell .old { font-size: var(--fs-xs); color: var(--ink-500); text-decoration: line-through; }
.price-cell .none { color: var(--ink-500); padding: 6px 8px; }
.rate-grid th.num, .rate-grid td.num { text-align: right; }
.rate-grid td:first-child { font-weight: 600; min-width: 120px; }
.raise-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.raise-row input { width: 96px; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: var(--r-pill); background: var(--neutral-bg); color: var(--ink-700); font-size: var(--fs-sm); padding: 4px 10px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-md); }
.check-row { display: flex; gap: 10px 22px; flex-wrap: wrap; }
.start-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 12px; padding: 18px 20px 20px; }
.start-card { display: flex; flex-direction: column; gap: 6px; text-align: left; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); padding: 14px 16px; cursor: pointer; }
.start-card:hover { border-color: var(--accent); }
.start-card b { font-size: var(--fs-base); }
.start-card span { font-size: var(--fs-sm); color: var(--ink-500); }
.start-card .go { color: var(--accent); font-weight: 600; }
.hist-val { white-space: nowrap; }
.hist-val s { color: var(--ink-500); }
.dim .src .badge { font-size: var(--fs-xs); }
.dim select { min-height: 34px; }
.dim.dim-choice { grid-template-columns: minmax(0, 1fr); gap: 6px; }
.dim.dim-choice select { width: 100%; }
/* поле, которое выбранная формула не использует (23.11) */
.dim.dim-unused > :not(.src) { opacity: .45; }
.dim .unused-note { color: var(--ink-500); }
.dim .flag { justify-self: end; }
.prod-card .card-head .pill { flex: none; }
.ver-list { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); color: var(--ink-700); }
@media (max-width: 720px) {
  .prod-list { max-width: none; flex-basis: 100%; }
  .dim { grid-template-columns: minmax(0, 1fr) 44px 96px 28px; gap: 6px; }
  .price-cell input { width: 72px; }
}
.settings-layout.no-rail .settings-rail { display: none; }
.settings-more > summary { cursor: pointer; font-weight: 600; list-style: none; }
.settings-more > summary::-webkit-details-marker { display: none; }
.settings-more > summary::after { content: "▸"; margin-left: 8px; color: var(--ink-500); }
.settings-more[open] > summary::after { content: "▾"; }
.example-card select.hidden, .example-card .title:empty { display: none; }
.prod-card .sketch svg { display: block; }
/* ППП / ППК: ряд эскизов вариантов (23.11) */
.sk-vars { display: flex; flex-direction: column; gap: 8px; }
.sk-vars-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.sk-var-fig { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 6px; }
.sk-var-fig svg { display: block; width: 100%; height: auto; border: 0; background: none; }
.sk-var-fig figcaption { font-size: var(--fs-sm); color: var(--ink-700, #2A303B); padding: 4px 2px 0; line-height: 1.3; }
.example-card { min-width: 0; }
.rate-grid th, .rate-grid td { padding: 8px 6px !important; }
.rate-grid th:first-child, .rate-grid td:first-child { padding-left: 20px !important; }
.rate-grid .price-cell input { width: 82px; }
.prod-list .code { white-space: normal; text-align: right; flex: 0 1 auto; max-width: 72px; }
.prod-list button { white-space: normal; align-items: center; }
.prod-list button > span:first-child { flex: 1 1 auto; min-width: 0; }
.tpl-row { display: grid; grid-template-columns: minmax(140px, 240px) minmax(0, 1fr); gap: 10px; align-items: center; }
.tpl-row input { width: 100%; font-family: var(--font-mono); font-size: var(--fs-sm); }
@media (max-width: 720px) { .tpl-row { grid-template-columns: minmax(0, 1fr); gap: 4px; } }

/* «Какое изделие по какой колонке считать» (правила офиса, 22.11) */
.or-list { display: flex; flex-direction: column; }
.or-row { display: flex; flex-direction: column; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line-soft); }
.or-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.or-n { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: var(--fs-sm); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.or-line { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px; align-items: start; }
.or-label { font-size: var(--fs-sm); color: var(--ink-500); padding-top: 7px; }
.or-ctrl select { max-width: 100%; }
.or-row .chip .link { padding: 0 2px; }
@media (max-width: 720px) { .or-line { grid-template-columns: minmax(0, 1fr); gap: 4px; } .or-label { padding-top: 0; } }
