/* «Карточки с ИИ» v2 (08.11.2026; frontend/modules/cards.js). Язык кабинета: карточки .card, плашки .st-badge, кнопки .btn, поля из
   styles.css; здесь — раскладка раздела и то, чего в кабинете нет: шкала стадий карточки, коробка сметы и хода, слоты картинок.
   Только токены styles.css — светлая и тёмная темы получаются сами. Префикс .cv-. */

.cv { display: flex; flex-direction: column; gap: 14px; }
.cv-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 16px; }
.cv-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.cv-crumb { font: inherit; padding: 0; border: 0; background: none; color: var(--ac-600); cursor: pointer; }
.cv-crumb:hover { text-decoration: underline; }
.cv-crumb:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-xs); }
.cv-sep { color: var(--text-4); }
.cv-grow { flex: 1 1 0; min-width: 0; }
.cv-money { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.cv-block { padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.cv-block > p { margin: 0; }
.cv-empty { align-items: flex-start; }
.cv-h { margin: 0; font-size: 15px; font-weight: 600; color: var(--text-1); }
.cv-h4 { margin: 6px 0 0; font-size: 13px; font-weight: 600; color: var(--text-1); }
.cv-h4 .cv-muted { font-weight: 400; }
.cv-muted { font-size: 12px; color: var(--text-3); }
.cv-bad { font-size: 13px; color: var(--bad-ink); }
.cv-pre { white-space: pre-line; margin: 0; }
.cv-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.cv-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; min-width: 0; }
.cv-field { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 12px; font-weight: 400; color: var(--text-3); min-width: 0; }
.cv-field > span { white-space: nowrap; }
.cv-field input, .cv-field select { width: auto; min-width: 0; padding: 6px 10px; border-radius: var(--r-ctl); font-size: 13px; }
.cv-field--grow { flex: 1 1 260px; }
.cv-field--grow input { flex: 1 1 auto; width: 100%; }
.cv-check { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; font-weight: 400; color: var(--text-2); cursor: pointer; }
.cv-check input[type="checkbox"] { width: auto; margin: 0; }
.cv-textarea { width: 100%; min-height: 64px; padding: 8px 10px; border-radius: var(--r-ctl); font: inherit; font-size: 13px; line-height: 1.45; resize: vertical; }
.cv-mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.cv-input-wide { flex: 1 1 320px; min-width: 0; width: 100%; padding: 6px 10px; border-radius: var(--r-ctl); font-size: 13px; }
.cv-input-num { width: 96px; }
.cv-row input[type="text"]:not(.cv-input-wide), .cv-row input[type="search"] { padding: 6px 10px; border-radius: var(--r-ctl); font-size: 13px; min-width: 0; }

/* таблицы раздела: своя прокрутка, страница вбок не едет */
.cv-table-wrap { overflow-x: auto; }
.cv-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cv-table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--text-3); padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.cv-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--text-1); }
.cv-table tr:last-child td { border-bottom: 0; }
.cv-table .cv-num { text-align: right; font-variant-numeric: tabular-nums; }
.cv-table input[type="checkbox"] { width: auto; margin: 0; }
.cv-nowrap { white-space: nowrap; }
.cv-row-link { cursor: pointer; }
.cv-row-link:hover td { background: var(--row-hover); }
.cv-row-link:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.cv-table tr.is-disputed td { background: var(--warn-50); }

/* шкала стадий: семь делений, пройденные — акцентом, текущая — темнее */
.cv-scale { display: inline-flex; gap: 3px; vertical-align: middle; }
.cv-scale-step { width: 14px; height: 6px; border-radius: var(--r-pill); background: var(--line-2); }
.cv-scale-step.is-done { background: var(--ac-300); }
.cv-scale-step.is-now { background: var(--ac-600); }
.cv-scale-label { margin-left: 8px; font-size: 12px; color: var(--text-2); vertical-align: middle; }

/* предмет WB и его выбор */
.cv-subject { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.cv-subject > .cv-muted { flex-basis: 100%; }
.cv-subject-name { font-weight: 500; }
.cv-pick { flex-basis: 100%; display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--r-ctl); background: var(--surface-2); }
.cv-chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }

/* смета и ход: одна коробка на место — рубли видны до запуска, факт после */
.cv-quote:empty { display: none; }
.cv-quote-box, .cv-run { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1px solid var(--ac-100); border-radius: var(--r-card); background: var(--ac-50); font-size: 13px; }
.cv-run { border-color: var(--line-2); background: var(--surface-2); }
.cv-run.is-over { opacity: .85; }
.cv-quote-sum { font-size: 13px; color: var(--text-1); }
.cv-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow: auto; }
.cv-lines li { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(160px, 2fr) auto; gap: 10px; align-items: baseline; }
.cv-line-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-line-what { color: var(--text-2); }
.cv-line-rub { font-variant-numeric: tabular-nums; white-space: nowrap; }

.cv-attn { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-left: 3px solid var(--warn-500); background: var(--warn-50); border-radius: var(--r-xs); font-size: 13px; }
.cv-attn p { margin: 0; }
.cv-notes, .cv-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.cv-notes { list-style: none; padding-left: 0; }
.cv-questions { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; }
.cv-questions select, .cv-questions input { margin-top: 4px; padding: 6px 10px; border-radius: var(--r-ctl); font-size: 13px; width: auto; max-width: 100%; }
.cv-create { padding-top: 10px; border-top: 1px solid var(--line); }
.cv-details summary { cursor: pointer; font-size: 13px; color: var(--text-2); }
.cv-details[open] summary { margin-bottom: 8px; }

/* вкладки карточки */
.cv-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); }
.cv-tab { font: inherit; font-size: 13px; padding: 8px 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--text-2); cursor: pointer; margin-bottom: -1px; }
.cv-tab.is-on { color: var(--text-1); font-weight: 600; border-bottom-color: var(--ac-600); }
.cv-tab:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.cv-usps { gap: 10px; }
.cv-usp { display: flex; flex-direction: column; gap: 2px; }
.cv-slide { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cv-slide:last-child { border-bottom: 0; }
.cv-slide input[type="text"] { flex: 1 1 200px; }
.cv-blocks { margin: 0; padding-left: 18px; font-size: 12px; color: var(--text-2); }
.cv-prompt { margin: 0; padding: 10px 12px; max-height: 320px; overflow: auto; white-space: pre-wrap; font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-ctl); }

/* слоты картинок: 3:4, как у WB */
.cv-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.cv-slot { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cv-slot-img { aspect-ratio: 3 / 4; display: flex; align-items: center; justify-content: center; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface-2); text-align: center; padding: 8px; }
.cv-slot-img img { width: 100%; height: 100%; object-fit: contain; }
.cv-slot.is-empty .cv-slot-img { border-style: dashed; }

/* поля WB */
.cv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px 14px; }
.cv-grid .cv-field { justify-content: space-between; }
.cv-grid .cv-field input, .cv-grid .cv-field select { flex: 1 1 auto; max-width: 60%; }
.cv-doc { padding: 8px 0; border-bottom: 1px dashed var(--line-2); }
.cv-dry, .cv-pub { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: var(--r-card); }

@media (max-width: 640px) {
  .cv-block { padding: 14px 16px; }
  .cv-lines li { grid-template-columns: 1fr auto; }
  .cv-line-what { grid-column: 1 / -1; }
  .cv-grid .cv-field { flex-wrap: wrap; }
  .cv-grid .cv-field input, .cv-grid .cv-field select { max-width: 100%; }
}
