/* Показ «ИИ-технолог ТОиР»: каркас и общие компоненты.
   Вид — система генератора техкарт (techcards_generation/static/ui/tokens.css, docs/ui/DESIGN.md).
   Шрифты IBM Plex (SIL OFL 1.1, fonts/OFL.txt) отдаёт сам сервис; внешних адресов нет. */

@font-face { font-family: "IBM Plex Sans"; src: url("fonts/IBMPlexSans-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/IBMPlexSans-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/IBMPlexSans-SemiBold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/IBMPlexMono-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/IBMPlexMono-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }

:root {
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --c-bg: #F3F5F2;
  --c-surface: #FFFFFF;
  --c-soft: #F7F9F6;
  --c-text: #17211E;
  --c-text-2: #56625D;
  --c-text-3: #7A857F;
  --c-line: #D8DDD7;
  --c-line-soft: #E9EDE8;
  --c-row-hover: #FAFBF9;

  --c-header: #17211E;
  --c-header-text: #FFFFFF;
  --c-header-muted: #D5DBD7;
  --c-header-active: #2C3935;
  --c-header-line: #4A5853;
  --c-online: #6FD3B8;

  --c-accent: #0E6A5B;
  --c-accent-hover: #094A40;
  --c-accent-bg: #E1F0EC;
  --c-accent-ink: #0B3F36;

  --c-attention: #A85A08;
  --c-attention-bg: #FCEFD9;
  --c-attention-ink: #6B3A05;

  --c-info: #2B5EA7;
  --c-info-bg: #E4ECF7;
  --c-info-ink: #1F4680;

  --c-danger: #A8322A;
  --c-danger-bg: #F8E3E0;
  --c-danger-ink: #7A211B;

  --c-norm: #46525A;
  --c-change: #FFF0B3;

  --r-block: 12px;
  --r-control: 8px;
  --r-pill: 999px;

  --page-max: 1304px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font: 400 15px/1.45 var(--font-sans);
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--c-accent); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.mono { font-family: var(--font-mono); font-size: 0.93em; letter-spacing: -0.01em; }
.muted { color: var(--c-text-2); }
.small { font-size: 13px; }

/* ---------- шапка ---------- */
.hdr {
  display: flex; align-items: center; gap: 28px;
  height: 56px; padding: 0 28px;
  background: var(--c-header); color: var(--c-header-text);
}
.hdr-brand { font-weight: 600; font-size: 16px; letter-spacing: -0.01em; white-space: nowrap; }
.hdr-nav { display: flex; gap: 4px; }
.hdr-nav button {
  border: 0; background: transparent; cursor: pointer;
  color: var(--c-header-muted); padding: 8px 12px; border-radius: 6px; font-size: 15px;
}
.hdr-nav button[aria-current="page"] { background: var(--c-header-active); color: var(--c-header-text); }
.hdr-right { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--c-header-muted); }
.hdr-btn {
  min-height: 34px; padding: 0 14px; border-radius: var(--r-control); cursor: pointer;
  border: 1px solid var(--c-header-line); background: transparent; color: var(--c-header-text); font-size: 14px; font-weight: 500;
}
.hdr-btn:hover { background: var(--c-header-active); }

/* ---------- страница ---------- */
.page { max-width: var(--page-max); margin: 0 auto; padding: 22px 28px 64px; }

/* полоса шагов показа */
.path { display: flex; margin: 0 0 22px; padding: 0; list-style: none; }
.path li { flex: 1; display: flex; align-items: center; min-width: 0; }
.path li::after { content: ""; flex: 1; height: 1px; background: var(--c-line); margin: 0 12px 0 4px; }
.path li:last-child::after { display: none; }
.path button {
  display: inline-flex; align-items: center; gap: 10px; padding: 4px 4px 4px 0;
  border: 0; background: transparent; cursor: pointer; font-size: 13px; color: var(--c-text-3); white-space: nowrap;
}
.path .n {
  width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  border: 1px solid var(--c-line); background: var(--c-surface); font-size: 12px; font-weight: 500; color: var(--c-text-2);
}
.path .done button { color: var(--c-text-2); }
.path .done .n { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }
.path .n svg { display: block; }
.path .now button { color: var(--c-text); font-weight: 600; }
.path .now .n { background: var(--c-text); border-color: var(--c-text); color: #fff; }
.path button:hover { color: var(--c-text); }

.crumbs { font-size: 13px; color: var(--c-text-2); margin-bottom: 6px; }
.crumbs a { color: var(--c-text-2); }
h1 { font-size: 30px; line-height: 1.2; font-weight: 600; letter-spacing: -0.015em; }
.lede { color: var(--c-text-2); margin-top: 6px; max-width: 70ch; }

.facts { display: flex; flex-wrap: wrap; gap: 6px 28px; margin: 10px 0 0; font-size: 14px; }
.facts div { display: flex; gap: 8px; align-items: baseline; }
.facts dt { color: var(--c-text-2); }
.facts dd { margin: 0; }

.head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.head-actions { display: flex; gap: 8px; flex: none; padding-top: 4px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; }

/* ---------- блоки ---------- */
.block { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-block); }
.block-pad { padding: 22px 24px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 20px 24px 0; }
.block-title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.block-note { font-size: 13px; color: var(--c-text-2); }
.label { font-size: 13px; font-weight: 600; color: var(--c-text-2); }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--r-control);
  font: 500 15px/1 var(--font-sans); text-decoration: none; cursor: pointer;
  border: 1px solid var(--c-line); background: var(--c-surface); color: var(--c-text);
  white-space: nowrap;
}
.btn:hover { border-color: var(--c-text-3); }
.btn-primary { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }
.btn-primary:hover { background: var(--c-accent-hover); border-color: var(--c-accent-hover); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--c-accent); padding: 0 6px; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }

/* ---------- метки состояний ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; border-radius: var(--r-pill);
  padding: 3px 10px; font-size: 13px; font-weight: 500; white-space: nowrap;
}
.pill-draft { background: var(--c-accent-bg); color: var(--c-accent-ink); }
.pill-wait { background: var(--c-attention-bg); color: var(--c-attention-ink); }
.pill-info { background: var(--c-info-bg); color: var(--c-info-ink); }
.pill-bad { background: var(--c-danger-bg); color: var(--c-danger-ink); }
.pill-plain { background: var(--c-line-soft); color: var(--c-text-2); }

/* ---------- таблицы ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 13px; font-weight: 600; color: var(--c-text-2); padding: 10px 12px; border-bottom: 1px solid var(--c-line); }
.tbl td { padding: 12px; border-bottom: 1px solid var(--c-line-soft); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl-wrap { padding: 8px 12px 6px; }

/* ---------- знаки основания строки ---------- */
.sh { width: 11px; height: 11px; display: inline-block; flex: none; margin-top: 3px; }
.sh-oem { border-radius: 50%; background: var(--c-accent); }
.sh-doc, .sh-erp { background: var(--c-info); transform: rotate(45deg) scale(0.82); }
.sh-norm { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 11px solid var(--c-norm); }
.sh-answer { background: var(--c-attention); border-radius: 1px; }
.sh-card { border-radius: 50%; border: 2px solid var(--c-accent); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; font-size: 13px; color: var(--c-text-2); }
.legend span { display: inline-flex; gap: 7px; align-items: center; }
.legend .sh { margin-top: 0; }

.b { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 8px; align-items: start; font-size: 13.5px; line-height: 1.35; }
.b + .b { margin-top: 7px; }

/* ---------- плашки ---------- */
.callout {
  padding: 14px 16px; border-radius: 10px; background: var(--c-attention-bg); color: var(--c-attention-ink);
}
.callout-info { background: var(--c-info-bg); color: var(--c-info-ink); }
.dark-bar {
  margin-top: 20px; background: var(--c-header); color: var(--c-header-text); border-radius: var(--r-block);
  padding: 14px 18px 14px 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.dark-bar .btn-go { background: var(--c-online); color: #0B2A24; border: 0; font-weight: 600; }

/* ---------- экраны ---------- */
.screen-title { margin-bottom: 22px; }
.load-error { margin-top: 20px; }

/* ---------- всплывающее сообщение ---------- */
.tbl-note { margin: 0; padding: 12px 24px 16px; font-size: 13px; color: var(--c-text-2); }

.toast {
  position: fixed; right: 24px; top: 72px; z-index: 50;  /* под шапкой справа: не закрывает находки внизу */
  max-width: min(560px, calc(100vw - 40px)); padding: 12px 18px; border-radius: 10px;
  background: var(--c-header); color: var(--c-header-text); font-size: 14.5px;
  box-shadow: 0 12px 32px rgba(23, 33, 30, 0.24);
}

/* ---------- экран 1: поиск ---------- */
.search-wrap { position: relative; margin-top: 22px; }
.search {
  display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 18px;
  background: var(--c-surface); border: 2px solid var(--c-accent); border-radius: 10px; font-size: 18px; cursor: text;
}
.search svg { flex: none; color: var(--c-text-2); }
.search-input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent;
  font: inherit; color: var(--c-text);
}
.search-input::placeholder { color: var(--c-text-2); }
.search .hint { flex: none; font-size: 13px; color: var(--c-text-3); }
.search-input:placeholder-shown + .hint { visibility: hidden; }
.search:focus-within { box-shadow: 0 0 0 4px var(--c-accent-bg); }
.dropdown {
  position: absolute; left: 0; top: 62px; z-index: 5; width: min(860px, 100%);
  max-height: min(460px, calc(100vh - 220px)); overflow-y: auto;
  background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(23, 33, 30, 0.12); padding: 6px 0 8px;
}
.dd-group { padding: 12px 18px 6px; }
.dd-group h3 { font-size: 14px; font-weight: 600; }
.dd-row {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding: 9px 18px; border-left: 3px solid transparent; cursor: pointer;
}
.dd-row.is-active { background: var(--c-accent-bg); border-left-color: var(--c-accent); }
.dd-ico {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: var(--c-line-soft); color: var(--c-text-2); font-size: 13px; font-weight: 600;
}
.dd-row.is-active .dd-ico { background: #fff; color: var(--c-accent); }
.dd-name { font-weight: 500; }
.dd-name mark {
  background: none; color: inherit; font-weight: 600;
  text-decoration: underline; text-decoration-color: var(--c-accent); text-underline-offset: 3px;
}
.dd-row.is-other .dd-name { font-weight: 400; color: var(--c-text-2); }
.dd-sub { font-size: 13px; color: var(--c-text-2); margin-top: 1px; }
.dd-right { text-align: right; }
.dd-meta { font-size: 13px; color: var(--c-text-2); }
.dd-sep { height: 1px; background: var(--c-line-soft); margin: 6px 0; }
.dd-empty { padding: 12px 18px; color: var(--c-text-2); font-size: 14px; }

/* ---------- экран 1: реестр ---------- */
.registry { margin-top: 22px; overflow: hidden; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 12px; border-bottom: 1px solid var(--c-line-soft); }
.stats > div { padding: 14px 24px 18px; border-left: 1px solid var(--c-line-soft); }
.stats > div:first-child { border-left: 0; }
.stat-num { font-size: 34px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.stat-num.bad { color: var(--c-danger); }
.stat-txt { margin-top: 4px; font-size: 14px; color: var(--c-text-2); max-width: 36ch; }
.prio { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.prio th { text-align: left; font-size: 13px; font-weight: 600; color: var(--c-text-2); padding: 12px 16px; border-bottom: 1px solid var(--c-line); }
.prio td { padding: 12px 16px; border-bottom: 1px solid var(--c-line-soft); vertical-align: middle; }
.prio tbody tr { cursor: pointer; }
.prio tbody tr:hover td { background: var(--c-row-hover); }
.prio tr:last-child td { border-bottom: 0; }
.prio .num { text-align: right; white-space: nowrap; }
.eq-name { font-weight: 600; }
.eq-sub { font-size: 13px; color: var(--c-text-2); margin-top: 2px; }
.prio tr.top td { background: #FBFCFA; }
.prio tr.top td:first-child { box-shadow: inset 4px 0 0 var(--c-danger); }
.flags { display: flex; flex-wrap: wrap; gap: 6px; }
.flag { font-size: 12.5px; border-radius: 6px; padding: 2px 8px; background: var(--c-danger-bg); color: var(--c-danger-ink); white-space: nowrap; }
.flag.ok { background: var(--c-accent-bg); color: var(--c-accent-ink); }
.flag.warn { background: var(--c-attention-bg); color: var(--c-attention-ink); }

/* ---------- экран 1: проверка действующих карт ---------- */
.sap-check { margin-top: 28px; scroll-margin-top: 16px; }
.check-head { margin-bottom: 16px; }
.check-title { font-size: 24px; line-height: 1.25; font-weight: 600; letter-spacing: -0.015em; margin-top: 4px; }
.check-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; align-items: start; margin-bottom: 20px; }
.verdict { position: relative; padding: 22px 26px 24px 32px; overflow: hidden; }
.verdict::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--c-danger); }
.verdict-lead { font-size: 23px; line-height: 1.25; font-weight: 600; letter-spacing: -0.015em; margin-top: 8px; }
.verdict-text { margin-top: 10px; color: var(--c-text-2); }
.verdict-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; align-items: center; }
.rules { list-style: none; margin: 0; padding: 4px 24px 8px; }
.rules li {
  display: grid; grid-template-columns: 28px minmax(0, 0.9fr) minmax(0, 1.25fr); gap: 14px; align-items: start;
  padding: 12px 0; border-top: 1px solid var(--c-line-soft); font-size: 14.5px;
}
.rules li:first-child { border-top: 0; }
.rule-text { font-weight: 500; }
.rule-fact { color: var(--c-text-2); }
.mark { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; margin-top: -1px; }
.mark svg { display: block; }
.mark-fail { background: var(--c-danger-bg); color: var(--c-danger); }
.mark-pass { background: var(--c-accent-bg); color: var(--c-accent); }
.dup td { color: var(--c-text-3); }

/* ---------- экран 2: данные для карты ---------- */
.sources { margin-top: 22px; }
.needs-sum { font-size: 14px; font-weight: 600; }
.needs { width: 100%; border-collapse: collapse; margin-top: 14px; }
.needs th { text-align: left; font-size: 13px; font-weight: 600; color: var(--c-text-2); padding: 12px 16px; border-bottom: 1px solid var(--c-line); background: var(--c-soft); }
.needs th:first-child { width: 30%; }
.needs td { padding: 13px 16px; border-bottom: 1px solid var(--c-line-soft); vertical-align: top; }
.need-title { font-weight: 500; }
.need-why { font-size: 13px; color: var(--c-text-2); margin-top: 2px; }
.found { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.found + .found { margin-top: 10px; }
.found .sh { margin-top: 5px; }
.found-name { font-weight: 500; }
.found-detail { font-size: 13px; color: var(--c-text-2); }
.found .btn-sm { min-height: 34px; text-decoration: none; display: inline-flex; align-items: center; }
.dropzone {
  margin: 16px; padding: 16px 18px; border: 1.5px dashed #8D9891; border-radius: 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--c-soft);
  transition: background-color 0.15s, border-color 0.15s;
}
.dropzone p { font-size: 14px; color: var(--c-text-2); max-width: 74ch; }
.dropzone b { color: var(--c-text); font-weight: 600; }
.dropzone .dropzone-note { margin-top: 2px; font-size: 13px; }
.dropzone .dropzone-over { display: none; color: var(--c-accent-ink); font-weight: 600; }
.dropzone.is-over { border-color: var(--c-accent); background: var(--c-accent-bg); }
.dropzone.is-over p { display: none; }
.dropzone.is-over .dropzone-over { display: block; }
.uploads { list-style: none; margin: -4px 16px 16px; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.upl { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: var(--r-control); }
.upl-recognized { background: var(--c-accent-bg); color: var(--c-accent-ink); }
.upl-added { background: var(--c-info-bg); color: var(--c-info-ink); }
.upl-mark { display: grid; place-items: center; flex: none; }
.q { padding: 22px 24px; }
.q-top { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.q-kind { font-size: 13px; color: var(--c-text-2); }
.q-title { font-size: 20px; line-height: 1.3; font-weight: 600; margin-top: 6px; letter-spacing: -0.01em; }
.foundbox { margin-top: 16px; background: var(--c-info-bg); border-radius: 10px; padding: 14px 16px; }
.foundbox .label { color: var(--c-info-ink); }
.quote { margin-top: 6px; font-size: 14.5px; line-height: 1.5; }
.quote-src { margin-top: 6px; font-size: 13px; }
.quote-src a { color: var(--c-info); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 16px; cursor: pointer;
  border: 1px solid var(--c-line); border-radius: var(--r-control); background: var(--c-surface); font-size: 15px;
}
.chip:hover { border-color: var(--c-text-3); }
.chip[aria-pressed="true"] { border: 2px solid var(--c-accent); padding: 0 15px; background: var(--c-accent-bg); color: var(--c-accent-ink); font-weight: 500; }
.chip .tag { font-size: 12px; background: var(--c-info-bg); color: var(--c-info-ink); border-radius: var(--r-pill); padding: 1px 8px; font-weight: 500; }
.change { margin: 16px 0 0; display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 10px 16px; font-size: 14px; }
.change dt { color: var(--c-text-2); }
.change dd { margin: 0; }

/* ---------- экран 3: агент собирает карту ---------- */
.grid-3 { display: grid; grid-template-columns: 250px minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.steps { list-style: none; margin: 0; padding: 6px 20px 16px; }
.steps li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; padding: 9px 0; }
.steps .n {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600;
  border: 1px solid var(--c-line); color: var(--c-text-2); background: var(--c-surface);
}
.steps .n svg { display: block; }
.steps .done .n { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }
.steps .now .n { background: var(--c-info); border-color: var(--c-info); color: #fff; }
.steps .s-name { font-weight: 500; padding-top: 2px; }
.steps .todo .s-name { color: var(--c-text-2); font-weight: 400; }
.steps .s-sub { font-size: 13px; color: var(--c-text-2); }
.steps .now .s-sub { color: var(--c-info-ink); }
.source-line { font-size: 13px; color: var(--c-text-3); padding: 0 24px 18px; }

.now-head { padding-bottom: 6px; }
.now-title { font-size: 21px; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; margin-top: 6px; }
.now-ready { margin-top: 8px; color: var(--c-text-2); }
.now-open { margin-top: 14px; }
.counters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 16px; border-top: 1px solid var(--c-line-soft); }
.counters > div { padding: 14px 0 2px; }
.counters span { display: block; font-size: 13px; color: var(--c-text-2); }
.counters b { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.counters .amber b { color: var(--c-attention); }
.log { list-style: none; margin: 0; padding: 4px 24px 14px; }
.log li { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 12px; padding: 11px 0; border-top: 1px solid var(--c-line-soft); font-size: 14.5px; }
.log li:first-child { border-top: 0; }
.log time { font-family: var(--font-mono); font-size: 13px; color: var(--c-text-3); padding-top: 1px; }
.log .hl { background: var(--c-attention-bg); margin: 0 -24px; padding: 11px 24px; }
.log .new-ev { color: var(--c-text); font-weight: 500; }
.log .is-new { animation: log-in 0.35s ease-out; }
@keyframes log-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.msgs { display: grid; gap: 12px; margin-top: 12px; }
.msg { max-width: 100%; font-size: 14.5px; line-height: 1.5; }
.msg .who { font-size: 12.5px; font-weight: 600; color: var(--c-text-2); margin-bottom: 4px; }
.msg-agent .bubble { background: var(--c-soft); border: 1px solid var(--c-line-soft); border-radius: 4px 12px 12px 12px; padding: 12px 14px; }
.msg-agent .bubble.is-asking { border: 2px solid var(--c-attention); background: #FFFBF3; padding: 11px 13px; }
.msg-user { justify-self: end; max-width: 82%; }
.msg-user .who { text-align: right; }
.msg-user .bubble { background: var(--c-accent); color: #fff; border-radius: 12px 4px 12px 12px; padding: 10px 14px; }
.bubble .q-text { font-weight: 600; font-size: 16px; }
.bubble .q-detail { margin-top: 4px; color: var(--c-text-2); }
.bubble .q-hint { margin-top: 8px; font-size: 13px; color: var(--c-text-3); }
.bubble .q-source { margin-top: 6px; font-size: 13px; }
.bubble .q-source a { color: var(--c-info, #2B5EA7); }
.bubble .chips { margin-top: 12px; }
.bubble .chip { min-height: 36px; font-size: 14px; padding: 0 11px; }
.bubble .chip[aria-pressed="true"] { padding: 0 10px; }
.bubble .chip:disabled { cursor: default; }
.bubble .chip:disabled:not([aria-pressed="true"]) { color: var(--c-text-3); }
.bubble img { display: block; width: 100%; max-width: 620px; height: auto; margin-top: 10px; border: 1px solid var(--c-line); border-radius: 6px; }
/* живой ответ агента (Р2): «думает…» — три точки; блоки после текста появляются мягко; пузырь — клик дописывает */
.msg-agent.is-live .bubble { cursor: pointer; }
.bubble:has(> .typing) { width: fit-content; }
.typing { display: inline-flex; align-items: center; gap: 6px; height: 22px; }
.typing i { width: 9px; height: 9px; border-radius: 50%; background: var(--c-text); animation: typing-dot 1.1s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-dot { 0%, 70%, 100% { opacity: 0.3; transform: none; } 35% { opacity: 1; transform: translateY(-3px); } }
.live-in { animation: live-in var(--live-fade, 260ms) ease-out both; }
@keyframes live-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .typing i, .live-in { animation: none; }
}

.srcs { list-style: none; margin: 0; padding: 4px 20px 14px; }
.srcs li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-top: 1px solid var(--c-line-soft); font-size: 14px; }
.srcs li:first-child { border-top: 0; }
.srcs a { color: inherit; text-decoration: none; }
.srcs a:hover { color: var(--c-accent); text-decoration: underline; }
.srcs .sub { display: block; font-size: 12.5px; color: var(--c-text-2); }
.srcs .sh { margin-top: 4px; }
.tag-new { font-size: 11.5px; font-weight: 600; color: var(--c-attention-ink); background: var(--c-attention-bg); border-radius: var(--r-pill); padding: 1px 7px; margin-left: 6px; white-space: nowrap; }

/* ---------- экран 4: карта ---------- */
.fact-sap { margin-left: 8px; font-size: 13px; }
.ledger { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ledger > div { padding: 18px 24px 22px; border-left: 1px solid var(--c-line-soft); }
.ledger > div:first-child { border-left: 0; }
.ledger-cap { display: flex; justify-content: space-between; align-items: baseline; padding: 18px 24px 0; }
.ledger-kind { font-size: 14px; font-weight: 600; }
.ledger-was { margin-top: 8px; font-size: 14px; line-height: 20px; min-height: 40px; color: var(--c-danger-ink); padding-left: 10px; border-left: 3px solid #E8B4AD; }
.ledger-now { margin-top: 4px; font-size: 40px; line-height: 1.05; font-weight: 600; letter-spacing: -0.02em; }
.ledger-now small { font-size: 18px; font-weight: 500; letter-spacing: 0; margin-left: 4px; }
.ledger-sub { margin-top: 6px; font-size: 13px; color: var(--c-text-2); }
.ledger-before { font-size: 20px; font-weight: 500; letter-spacing: 0; color: var(--c-text-3); text-decoration-thickness: 1.5px; }
.ledger-arrow { margin: 0 6px; font-size: 20px; font-weight: 400; letter-spacing: 0; color: var(--c-text-3); }

.version-bar { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 14px 20px; border-left: 4px solid #E0B400; }
.version-list ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.version-list li + li { margin-top: 2px; }
.version-list p { margin-top: 4px; font-size: 14px; }
.seg { display: inline-flex; border: 1px solid var(--c-line); border-radius: var(--r-control); overflow: hidden; flex: none; }
.seg button { border: 0; background: var(--c-surface); padding: 9px 16px; font: 500 14px/1 var(--font-sans); color: var(--c-text-2); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--c-line); }
.seg button[aria-pressed="true"] { background: var(--c-text); color: #fff; }

.card-block { overflow: clip; }  /* не hidden: иначе правая колонка не прилипает */
.tabs { display: flex; gap: 6px; padding: 10px 16px 0; border-bottom: 1px solid var(--c-line); flex-wrap: wrap; align-items: flex-end; }
.tab { padding: 10px 14px 12px; font: 400 15px/1.2 var(--font-sans); color: var(--c-text-2); background: transparent; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; cursor: pointer; }
.tab:hover { color: var(--c-text); }
.tab.is-on { color: var(--c-text); border-bottom-color: var(--c-accent); font-weight: 600; }
.tab .count { color: var(--c-text-2); font-weight: 400; margin-left: 6px; }
.card-legend { padding: 10px 16px; border-bottom: 1px solid var(--c-line-soft); display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--c-text-2); }
.card-legend span { display: inline-flex; align-items: center; gap: 7px; }
.card-legend .sh { margin-top: 0; }

.card-grid2 { display: grid; grid-template-columns: minmax(0, 1fr) 440px; align-items: start; }
.card-main { min-width: 0; }
.ops { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.ops th { text-align: left; font-size: 13px; font-weight: 600; color: var(--c-text-2); padding: 10px 12px; border-bottom: 1px solid var(--c-line); }
.ops td { padding: 12px; border-bottom: 1px solid var(--c-line-soft); vertical-align: top; }
.ops .grp td { background: var(--c-soft); padding: 7px 12px; font-size: 13px; font-weight: 600; color: var(--c-text-2); }
.ops .num-col { width: 58px; }
.ops .code-col { width: 92px; }
.ops .hrs { text-align: right; white-space: nowrap; width: 76px; font-weight: 500; }
.ops .basis-col { width: 190px; }
.ops tr.op { cursor: pointer; }
.ops tr.op:hover td { background: var(--c-row-hover); }
.ops tr.op:focus-visible { outline: 2px solid var(--c-accent); outline-offset: -2px; }
.op-no { font-family: var(--font-mono); font-size: 13.5px; color: var(--c-text-2); }
.op-title { font-weight: 600; }
.op-mark { margin-left: 8px; font-size: 12px; padding: 1px 8px; vertical-align: 1px; font-weight: 500; }
.op-desc { color: var(--c-text-2); margin-top: 3px; font-size: 14px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.is-sel .op-desc { -webkit-line-clamp: unset; display: block; }
.op-cond { display: inline-block; margin-top: 6px; font-size: 12.5px; color: var(--c-text-2); background: var(--c-line-soft); border-radius: var(--r-pill); padding: 1px 9px; }
.ops tr.is-sel td { background: #F2F8F6; }
.ops tr.is-sel td:first-child { box-shadow: inset 4px 0 0 var(--c-accent); }
.ops .is-cond .hrs { color: var(--c-text-2); font-weight: 400; }
.ops tr.is-removed .op-title, .ops tr.is-removed .op-desc, .ops tr.is-removed .hrs { text-decoration: line-through; color: var(--c-text-3); }
.ops tr.is-removed .op-mark { text-decoration: none; }
.ops tr.is-added td, .ops tr.is-changed td { background: var(--c-change); }
.ops tr.is-added.is-sel td, .ops tr.is-changed.is-sel td { background: #FFE88A; }
.ops .total-row td { font-weight: 600; border-bottom: 0; border-top: 1px solid var(--c-line); }
.ops.mats td { font-size: 14px; }
.cond-note { padding: 10px 12px 16px; font-size: 13px; color: var(--c-text-2); }
.b-label { color: var(--c-text); text-decoration: underline; text-decoration-color: #B9C1BB; text-underline-offset: 3px; }

.card-side { border-left: 1px solid var(--c-line); background: #FBFCFA; position: sticky; top: 0; max-height: 100vh; overflow-y: auto; align-self: start; }
.side-tabs { padding-top: 6px; background: var(--c-surface); }
.side-note { margin-left: auto; padding-bottom: 12px; }
.side-body { padding: 16px 20px 22px; }
.side-title { font-size: 15px; font-weight: 600; line-height: 1.35; }
.side-doc { margin-top: 12px; font-size: 14px; }
.pdfframe { margin-top: 10px; border: 1px solid var(--c-line); border-radius: 8px; overflow: hidden; background: #fff; }
.pdfbar { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--c-line-soft); font-size: 13px; color: var(--c-text-2); background: var(--c-soft); }
.pdfframe img { display: block; width: 100%; height: auto; }
.pdfcap { margin: 12px 0; font-size: 14px; line-height: 1.5; }
.drawer-sec { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--c-line-soft); }
.drawer-sec .label { display: block; margin-bottom: 6px; }
.in-card { font-size: 14px; line-height: 1.5; }
.note-box { width: 100%; min-height: 72px; border: 1px solid #B9C1BB; border-radius: var(--r-control); padding: 10px 12px; font: 14px/1.45 var(--font-sans); color: var(--c-text); resize: vertical; }
.remark-saved { margin-top: 6px; font-size: 12.5px; color: var(--c-accent); }

.side-agent .msgs { margin-top: 0; max-height: calc(100vh - 290px); min-height: 160px; overflow-y: auto; padding-right: 6px; }
.msg-agent .bubble > p + * { margin-top: 10px; }
.effect { border-top: 1px solid var(--c-line-soft); padding-top: 8px; }
.effect ul { margin: 4px 0 0; padding-left: 18px; font-size: 13.5px; }
.explain-title { font-weight: 600; font-size: 14px; }
.bars { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 5px; }
.bars li { display: grid; grid-template-columns: 150px minmax(0, 1fr) 48px; gap: 8px; align-items: center; font-size: 13px; }
.bar { height: 10px; background: var(--c-line-soft); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--c-accent); }
.bar-hrs { text-align: right; font-variant-numeric: tabular-nums; }
.explain-top { margin-top: 12px; font-size: 13px; color: var(--c-text-2); }
.top-ops { display: grid; gap: 6px; margin-top: 6px; }
.top-op { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; text-align: left; padding: 8px 10px; border: 1px solid var(--c-line); border-radius: var(--r-control); background: var(--c-surface); font: 13.5px/1.35 var(--font-sans); cursor: pointer; }
.top-op:hover { border-color: var(--c-accent); }
.composer { display: flex; gap: 8px; align-items: center; margin-top: 14px; border: 1px solid #B9C1BB; border-radius: 10px; padding: 6px 6px 6px 12px; background: #fff; }
.composer:focus-within { border-color: var(--c-accent); }
.composer-input { flex: 1; min-width: 0; border: 0; outline: 0; font: 14.5px/1.4 var(--font-sans); padding: 6px 0; background: transparent; }
.send { width: 34px; height: 34px; border-radius: 8px; border: 0; background: var(--c-accent); color: #fff; font-size: 16px; cursor: pointer; flex: none; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sugg { font: 13.5px/1.3 var(--font-sans); border: 1px solid var(--c-line); border-radius: var(--r-pill); padding: 6px 12px; background: #fff; color: var(--c-text); cursor: pointer; text-align: left; }
.sugg:hover { border-color: var(--c-accent); color: var(--c-accent-ink); }
/* пока агент пишет, поле ввода и подсказки неактивны */
.sugg:disabled, .sugg:disabled:hover { color: var(--c-text-3); border-color: var(--c-line); cursor: default; }
.composer:has(.composer-input:disabled) { background: var(--c-soft); border-color: var(--c-line); }
.composer .send:disabled { opacity: 0.45; cursor: default; }

/* ---------- экран 5: согласование и выгрузка ---------- */
.route { list-style: none; margin: 0; padding: 18px 24px 22px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.route li { position: relative; padding-right: 18px; }
.route li::before { content: ""; position: absolute; left: 30px; right: 4px; top: 14px; height: 2px; background: var(--c-line); }
.route li:last-child::before { display: none; }
.route li.done::before { background: var(--c-accent); }
.route .rn { position: relative; z-index: 1; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; background: var(--c-surface); border: 2px solid var(--c-line); color: var(--c-text-2); }
.route .rn svg { display: block; }
.route .done .rn { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }
.route .now .rn { border-color: var(--c-accent); color: var(--c-accent); }
.route .rt { margin-top: 10px; font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.route .rt .pill { font-size: 12px; padding: 1px 8px; }
.route .rs { font-size: 13px; color: var(--c-text-2); margin-top: 2px; max-width: 26ch; line-height: 1.45; }
.route .rs.is-returned { color: var(--c-attention-ink); background: var(--c-attention-bg); border-radius: 6px; padding: 4px 8px; }
.route-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.expert { margin: 0 24px 22px; padding: 18px 20px; border-radius: 10px; background: var(--c-soft); border: 1px solid var(--c-line-soft); }
.expert-title { font-size: 15px; font-weight: 600; }
.expert-cols { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 24px; margin-top: 12px; }
.expert-cols .label { display: block; margin-bottom: 6px; }
.expert-list { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.45; }
.expert-list li + li { margin-top: 4px; }
.expert-cols p { font-size: 13.5px; line-height: 1.45; }
.expert-actions { display: flex; gap: 8px; margin-top: 16px; }
.export-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.export-row .btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.export-note { margin-top: 12px; font-size: 14px; color: var(--c-text-2); }
.finds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.finds > div { padding: 18px 24px 22px; border-left: 1px solid var(--c-line-soft); }
.finds > div:first-child { border-left: 0; }
.find-kind { font-size: 13px; font-weight: 600; }
.find-kind.k-bad { color: var(--c-danger-ink); }
.find-kind.k-ok { color: var(--c-accent-ink); }
.find-kind.k-warn { color: var(--c-attention-ink); }
.find-title { margin-top: 6px; font-size: 17px; font-weight: 600; line-height: 1.3; }
.find-big { margin-top: 10px; font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.find-text { margin-top: 8px; font-size: 14px; color: var(--c-text-2); line-height: 1.5; }
.find-src { margin-top: 10px; font-size: 13px; }
