/* Шрифт Onest (OFL) лежит рядом, во внешние сети страница не ходит */
@font-face { font-family: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/static/fonts/onest-cyrillic-wght-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/static/fonts/onest-latin-wght-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ══════════════════════════════════════════════════════════════════════════════
   Кабинет инфраструктуры: единая система стилей.
   Порядок: токены → основа → каркас → элементы управления → общие компоненты → разделы.
   Шкала отступов 4/8/12/16/24/32, скругления: панели 12, элементы управления 8.
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── токены ─────────────────────────────────────────────────────────────────── */
:root {
  color-scheme: light;
  --bg-page: #f2f4f8;
  --bg-panel: #ffffff;
  --bg-inset: #f5f7fa;
  --bg-hover: #ebeff5;
  --border: #d9dfe8;
  --border-control: #9aa6b6;
  --text-primary: #16202c;
  --text-secondary: #364353;
  --text-muted: #4d5b6c;
  --accent: #3554d1;
  --accent-ink: #ffffff;
  --accent-soft: rgba(53, 84, 209, .10);
  --success: #17783d;
  --warning: #955800;
  --danger: #c01f45;
  --success-soft: rgba(23, 120, 61, .11);
  --warning-soft: rgba(176, 108, 0, .13);
  --danger-soft: rgba(192, 31, 69, .10);
  --neutral-soft: rgba(84, 100, 122, .11);
  --neutral: #8792a2;
  --overlay: rgba(12, 18, 28, .45);
  --shadow-pop: 0 12px 40px rgba(16, 24, 40, .18);
  --heat-s: 58%;
  --heat-l: 52%;
  --r-panel: 12px;
  --r-ctl: 8px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Consolas, monospace;
  --sans: Onest, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg-page: #0b1017;
    --bg-panel: #121a24;
    --bg-inset: #0d141c;
    --bg-hover: #1b2635;
    --border: #2a3748;
    --border-control: #56677f;
    --text-primary: #edf2f7;
    --text-secondary: #bcc8d7;
    --text-muted: #9fafc2;
    --accent: #7c9cff;
    --accent-ink: #0b1017;
    --accent-soft: rgba(124, 156, 255, .14);
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #fb7185;
    --success-soft: rgba(74, 222, 128, .12);
    --warning-soft: rgba(251, 191, 36, .12);
    --danger-soft: rgba(251, 113, 133, .13);
    --neutral-soft: rgba(148, 163, 184, .12);
    --neutral: #5d6c80;
    --overlay: rgba(3, 6, 10, .62);
    --shadow-pop: 0 16px 48px rgba(0, 0, 0, .5);
    --heat-s: 52%;
    --heat-l: 42%;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-page: #0b1017;
  --bg-panel: #121a24;
  --bg-inset: #0d141c;
  --bg-hover: #1b2635;
  --border: #2a3748;
  --border-control: #56677f;
  --text-primary: #edf2f7;
  --text-secondary: #bcc8d7;
  --text-muted: #9fafc2;
  --accent: #7c9cff;
  --accent-ink: #0b1017;
  --accent-soft: rgba(124, 156, 255, .14);
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #fb7185;
  --success-soft: rgba(74, 222, 128, .12);
  --warning-soft: rgba(251, 191, 36, .12);
  --danger-soft: rgba(251, 113, 133, .13);
  --neutral-soft: rgba(148, 163, 184, .12);
  --neutral: #5d6c80;
  --overlay: rgba(3, 6, 10, .62);
  --shadow-pop: 0 16px 48px rgba(0, 0, 0, .5);
  --heat-s: 52%;
  --heat-l: 42%;
}

/* ── основа ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg-page); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg-page); color: var(--text-primary); font: 15px/1.5 var(--sans); overflow-x: hidden; }
h1, h2, h3, p, figure { margin: 0; }
h2 { font-size: 16px; line-height: 1.3; font-weight: 650; }
h3 { font-size: 15px; line-height: 1.3; font-weight: 650; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--accent); text-underline-offset: 2px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }
.ico { width: 16px; height: 16px; flex: none; display: block; }

/* ── каркас: шапка, страница, панели ────────────────────────────────────────── */
.appbar { position: sticky; top: 0; z-index: 10; background: var(--bg-panel); border-bottom: 1px solid var(--border); }
.appbar-in { max-width: 1500px; margin: 0 auto; padding: 0 32px; min-height: 56px; display: flex; align-items: stretch; gap: 8px 24px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: var(--text-primary); text-decoration: none; white-space: nowrap; }
.brand svg { color: var(--accent); flex: none; }
.tabs { display: flex; align-items: stretch; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { display: flex; align-items: center; padding: 0 12px; min-height: 44px; color: var(--text-secondary); text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; border-bottom: 2px solid transparent; border-top: 2px solid transparent; }
.tabs a:hover { color: var(--text-primary); }
.tabs a.on { color: var(--text-primary); border-bottom-color: var(--accent); }
.tabs a:focus-visible { outline-offset: -3px; }
.appbar-meta { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.updated { color: var(--text-muted); font-size: 14px; white-space: nowrap; margin-right: 8px; }
.updated.bad { color: var(--danger); font-weight: 600; }
.logout { display: flex; margin: 0; }

main { max-width: 1500px; margin: 0 auto; padding: 24px 32px 64px; }
.view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px 32px; }
.page-head-main { min-width: 0; flex: 1 1 560px; }
.page-title { font-size: 27px; line-height: 1.2; font-weight: 700; letter-spacing: -.012em; text-wrap: balance; display: flex; align-items: baseline; gap: 12px; }
.page-desc { color: var(--text-secondary); margin-top: 8px; max-width: 78ch; }
.page-side { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; }
.status-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--neutral); flex: none; transform: translateY(-2px); }
.page-head.lv-ok .status-dot { background: var(--success); }
.page-head.lv-warn .status-dot { background: var(--warning); }
.page-head.lv-crit .status-dot { background: var(--danger); }

.panel { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r-panel); padding: 24px; min-width: 0; }
.panel > h2 { margin-bottom: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 16px; }
.panel-head h2 { margin: 0; }
.panel > .hint { margin: -8px 0 16px; }
.panel > input[type="search"] { margin-bottom: 16px; max-width: 480px; }
.panel > .composer { margin-top: 16px; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.grid.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.col-main, .col-side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; min-width: 0; }

/* ── элементы управления ────────────────────────────────────────────────────── */
button.primary, button.danger, .ghost-btn, .ai-btn, .act-btn, .more-btn, .file-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 6px 16px;
  border: 1px solid transparent; border-radius: var(--r-ctl); background: transparent; color: var(--text-primary);
  font-weight: 600; font-size: 14px; line-height: 1.3; text-decoration: none; white-space: nowrap; cursor: pointer;
}
button.primary { background: var(--accent); color: var(--accent-ink); }
button.primary:hover { filter: brightness(1.08); }
button.danger { border-color: var(--danger); color: var(--danger); }
button.danger:hover { background: var(--danger-soft); }
.ghost-btn, .act-btn, .more-btn { border-color: var(--border-control); }
.ghost-btn:hover, .act-btn:hover, .more-btn:hover { background: var(--bg-hover); }
.ai-btn { background: var(--accent-soft); color: var(--accent); }
.ai-btn:hover { border-color: var(--accent); }
.file-btn { border: 1px dashed var(--border-control); font-weight: 500; color: var(--text-secondary); }
.file-btn:hover { border-style: solid; color: var(--text-primary); }
.file-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.more-btn { width: 100%; margin-top: 8px; color: var(--text-secondary); font-weight: 500; }
button.small, .act-btn { min-height: 32px; padding: 4px 12px; font-size: 14px; }
button.block { width: 100%; min-height: 40px; }
button.primary:disabled, button.danger:disabled, .ghost-btn:disabled, .ai-btn:disabled, .act-btn:disabled { opacity: .5; filter: none; }

.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: var(--r-ctl); background: transparent; color: var(--text-secondary); }
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.linkbtn { border: 0; background: none; padding: 0; color: var(--accent); font-size: 14px; font-weight: 500; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: transparent; }
.linkbtn:hover { text-decoration-color: currentColor; }
.linkbtn.danger-link { color: var(--danger); }
.chip-btn { border: 1px solid var(--border-control); background: transparent; border-radius: 999px; padding: 1px 10px; font-size: 14px; font-weight: 600; }
.chip-btn:hover { background: var(--bg-hover); }

textarea, select, input[type="text"], input[type="password"], input[type="date"], input[type="search"], input[type="number"] {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border-control); border-radius: var(--r-ctl);
  background: var(--bg-inset); color: var(--text-primary); font-size: 14px; line-height: 1.5;
}
textarea { resize: vertical; min-height: 64px; display: block; }
textarea::placeholder, input::placeholder { color: var(--text-muted); opacity: 1; }
textarea:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea:disabled, input:disabled { opacity: .55; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; margin: 3px 0 0; flex: none; accent-color: var(--accent); }

.field { display: grid; gap: 4px; min-width: 0; }
.field-l { font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.field-h { display: block; font-size: 14px; font-weight: 400; color: var(--text-muted); line-height: 1.45; }
.radio, .check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.radio b, .check b { font-weight: 600; }
.radio-col { display: grid; gap: 4px; }

.seg { display: inline-flex; gap: 2px; padding: 2px; background: var(--bg-inset); border: 1px solid var(--border); border-radius: var(--r-ctl); max-width: 100%; }
.seg button { border: 1px solid transparent; background: transparent; min-height: 28px; padding: 2px 12px; border-radius: 6px; font-size: 14px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.seg button:hover { color: var(--text-primary); }
.seg button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text-primary); }
.seg.wide { display: flex; }
.seg.wide button { flex: 1; min-height: 32px; padding: 2px 4px; }

/* ── общие компоненты ───────────────────────────────────────────────────────── */
.hint { color: var(--text-muted); font-size: 14px; line-height: 1.5; max-width: 78ch; }
.hint-inline { color: var(--text-muted); font-size: 14px; }
.sub { color: var(--text-muted); font-size: 14px; }
.empty { color: var(--text-muted); font-size: 14px; }
.tag { color: var(--text-muted); font-style: normal; font-size: 13px; }

.counts { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: baseline; gap: 8px; padding: 4px 12px; border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--bg-panel); font-size: 14px; color: var(--text-secondary); white-space: nowrap; }
.pill b { font: 700 15px var(--sans); font-variant-numeric: tabular-nums; color: var(--text-primary); }
.pill.ok b { color: var(--success); } .pill.warn b { color: var(--warning); } .pill.crit b { color: var(--danger); }
.pill.flat { font-weight: 600; }
.pill.flat.ok { color: var(--success); } .pill.flat.warn { color: var(--warning); } .pill.flat.crit { color: var(--danger); }

.badge { display: inline-block; font-size: 13px; font-weight: 650; line-height: 1.4; padding: 2px 8px; border-radius: 6px; background: var(--neutral-soft); color: var(--text-secondary); white-space: nowrap; }
.badge.running { background: var(--accent-soft); color: var(--accent); }
.badge.done { background: var(--success-soft); color: var(--success); }
.badge.pending, .badge.checkpoint, .badge.approved, .badge.queued { background: var(--warning-soft); color: var(--warning); }
.badge.failed { background: var(--danger-soft); color: var(--danger); }
.chip { display: inline-block; font-size: 13px; font-style: normal; line-height: 1.4; padding: 1px 8px; border-radius: 6px; background: var(--neutral-soft); color: var(--text-secondary); white-space: nowrap; }
.count { font: 700 13px var(--sans); font-variant-numeric: tabular-nums; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--neutral); flex: none; margin-right: 8px; }
.dot.ok { background: var(--success); } .dot.warn { background: var(--warning); } .dot.crit { background: var(--danger); }

.meter { position: relative; height: 6px; border-radius: 3px; background: var(--neutral-soft); min-width: 88px; }
.meter i { display: block; height: 100%; border-radius: 3px; background: var(--success); }
.meter i.warn { background: var(--warning); } .meter i.crit { background: var(--danger); }
.meter-mark { position: absolute; top: -2px; bottom: -2px; width: 2px; border-radius: 1px; background: var(--text-primary); opacity: .55; }
.num-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.num-line b { font-size: 15px; }
.num-line.big b { font-size: 26px; line-height: 1.1; }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); flex: none; }
@media (prefers-reduced-motion: no-preference) { .spinner { animation: spin .8s linear infinite; } }
@keyframes spin { to { transform: rotate(360deg); } }

.fold > summary { cursor: pointer; list-style: none; color: var(--text-secondary); font-size: 14px; font-weight: 600; border-radius: 4px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before { content: "▸"; display: inline-block; width: 16px; color: var(--text-muted); }
.fold[open] > summary::before { content: "▾"; }
.fold > summary h2 { display: inline; }
.fold > summary:hover { color: var(--text-primary); }

/* заметка со степенью важности: подпись словом и цветная точка, без заливки больших областей */
.item { display: grid; gap: 4px; font-size: 14px; line-height: 1.5; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--bg-inset); }
.item + .item { margin-top: 8px; }
.sev { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--text-secondary); }
.sev::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--neutral); }
.crit > .sev, .crit > .att-head > .sev { color: var(--danger); } .crit > .sev::before, .crit > .att-head > .sev::before { background: var(--danger); }
.warn > .sev, .warn > .att-head > .sev { color: var(--warning); } .warn > .sev::before, .warn > .att-head > .sev::before { background: var(--warning); }
.item.warn { border-color: var(--warning); }
.item.crit, .att.crit { border-color: var(--danger); }

/* markdown: ответы агента и отчёты */
.md { overflow-wrap: anywhere; }
.md > * + * { margin-top: 8px; }
.md-p { margin: 0; }
.md-h { font-weight: 650; line-height: 1.3; }
.md > .md-h:not(:first-child) { margin-top: 16px; }
.md-h1 { font-size: 1.2em; } .md-h2 { font-size: 1.12em; } .md-h3 { font-size: 1.04em; } .md-h4 { font-size: 1em; color: var(--text-secondary); }
.md-list { margin: 0; padding-left: 1.5em; display: grid; gap: 4px; }
.md-list.nested { margin-top: 4px; }
.md-list li { padding-left: 2px; }
.md-list li::marker { color: var(--text-muted); }
.md code { font: .88em var(--mono); background: var(--neutral-soft); padding: 1px 6px; border-radius: 5px; }
.md-pre { margin: 0; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--bg-inset); overflow-x: auto; font: 13px/1.55 var(--mono); white-space: pre; overflow-wrap: normal; }
.md-pre code { background: none; padding: 0; font: inherit; }
.md-quote { margin: 0; padding: 4px 0 4px 16px; border-left: 3px solid var(--border-control); color: var(--text-secondary); }
.md-hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.md-table-wrap { overflow-x: auto; }
.md-table { border-collapse: collapse; font-size: .92em; overflow-wrap: normal; }
.md-table th, .md-table td { padding: 6px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.md-table th { color: var(--text-secondary); font-weight: 600; white-space: nowrap; }
.cat { display: inline-flex; align-items: center; gap: 6px; font: 650 .8em/1.5 var(--sans); padding: 0 8px; border-radius: 6px; white-space: nowrap; vertical-align: 1px; background: var(--neutral-soft); color: var(--text-secondary); }
.cat::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.cat.critical { background: var(--danger-soft); color: var(--danger); }
.cat.useful { background: var(--success-soft); color: var(--success); }
.cat.research { background: var(--accent-soft); color: var(--accent); }
.cat.watch { background: var(--warning-soft); color: var(--warning); }

.ai-text { font-size: 15px; line-height: 1.6; max-width: 84ch; padding: 16px 20px; border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--bg-inset); }
.ai-err { color: var(--danger); font-size: 14px; }
.ai-foot { color: var(--text-muted); font-size: 14px; margin-top: 8px; }
.ai-wait { display: flex; align-items: center; gap: 12px; color: var(--text-secondary); font-size: 14px; }
.ai { display: grid; gap: 8px; justify-items: start; min-width: 0; }
.ai-out { width: 100%; }
.ai-out:empty { display: none; }

.log { margin: 0; padding: 12px 16px; max-height: 320px; overflow: auto; font: 13px/1.55 var(--mono); border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--bg-inset); white-space: pre-wrap; overflow-wrap: anywhere; }

/* диалог подтверждения */
.dlg { width: min(480px, calc(100vw - 32px)); padding: 24px; border: 1px solid var(--border); border-radius: var(--r-panel); background: var(--bg-panel); color: var(--text-primary); box-shadow: var(--shadow-pop); }
.dlg::backdrop { background: rgba(3, 6, 10, .6); }
.dlg h2 { font-size: 18px; margin-bottom: 8px; }
.dlg-text { color: var(--text-secondary); font-size: 14px; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.dlg-field { margin-top: 16px; }
.dlg-err { color: var(--danger); font-size: 14px; min-height: 1.5em; margin-top: 4px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* ── выдвижная панель: нода и задача ────────────────────────────────────────── */
.drawer { position: fixed; inset: 0; z-index: 20; display: flex; justify-content: flex-end; }
.drawer-backdrop { position: absolute; inset: 0; background: var(--overlay); }
.drawer-panel { position: relative; width: min(760px, 100%); height: 100%; overflow-y: auto; background: var(--bg-panel); border-left: 1px solid var(--border); padding: 24px 32px 48px; }
.drawer-close { position: sticky; top: 0; float: right; z-index: 3; margin: -8px -16px 0 8px; background: var(--bg-panel); }
.d-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 4px; }
.d-head h3 { font-size: 22px; line-height: 1.25; font-weight: 700; overflow-wrap: anywhere; }
.d-score { font: 700 26px/1 var(--sans); font-variant-numeric: tabular-nums; }
.lv-ok > .d-head .d-score { color: var(--success); } .lv-warn > .d-head .d-score { color: var(--warning); } .lv-crit > .d-head .d-score { color: var(--danger); }
.d-sub, .d-note { color: var(--text-secondary); font-size: 14px; }
.d-sub { margin-bottom: 16px; }
.d-note { margin: 8px 0; }
.d-block { margin-top: 24px; }
.d-block > h2 { margin-bottom: 12px; }
.period { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 32px 0 0; padding-top: 24px; border-top: 1px solid var(--border); }
.period h2 { margin: 0; }
.ai-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 24px; align-items: start; }

.sc-row { display: grid; grid-template-columns: 160px 1fr 32px; align-items: center; gap: 12px; font-size: 14px; margin: 8px 0; }
.sc-bar { height: 8px; border-radius: 4px; background: var(--neutral-soft); overflow: hidden; }
.sc-bar i { display: block; height: 100%; background: var(--success); } .sc-bar i.warn { background: var(--warning); } .sc-bar i.crit { background: var(--danger); }
.sc-row span:last-child { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

dl.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; margin: 12px 0 8px; font-size: 14px; }
dl.kv dt { color: var(--text-secondary); } dl.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

.act-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.act-btn .ico { color: var(--text-secondary); }
.act-panel { margin-top: 12px; padding: 16px; border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--bg-inset); display: grid; gap: 12px; }
.act-panel textarea, .act-panel input { background: var(--bg-panel); }
.act-title { font-weight: 650; }
.act-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.act-note { margin-top: 8px; min-height: 1.5em; }
.act-steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 14px; }

/* таблицы данных */
table.ru, table.metrics, .ctable { width: 100%; border-collapse: collapse; font-size: 14px; }
table.ru th, table.metrics th, .ctable th { text-align: left; color: var(--text-muted); font-weight: 600; font-size: 14px; padding: 4px 8px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.ru td, table.metrics td, .ctable td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; font-variant-numeric: tabular-nums; }
table.ru tr:last-child td, table.metrics tr:last-child td, .ctable tr:last-child td { border-bottom: 0; }
table.metrics th, table.metrics td { text-align: right; }
table.metrics th:first-child, table.metrics td:first-child { text-align: left; }
.ctable-wrap, .ru-wrap { overflow-x: auto; }
.ctable .r { text-align: right; }
.ctable td { white-space: nowrap; }
.ctable td.st { white-space: normal; min-width: 220px; }
.ctable .pctcell { min-width: 160px; }
.rate { display: flex; align-items: center; gap: 8px; min-width: 112px; }
.rate-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--neutral-soft); overflow: hidden; }
.rate-bar i { display: block; height: 100%; background: var(--success); } .rate-bar i.warn { background: var(--warning); } .rate-bar i.crit { background: var(--danger); }
.rate b { font-size: 14px; min-width: 36px; text-align: right; }

/* карточки метрик с графиком */
.mcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.mcard { display: grid; gap: 8px; padding: 16px; border: 1px solid var(--border); border-radius: var(--r-ctl); min-width: 0; }
.mcard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.mcard-title { font-weight: 650; font-size: 14px; line-height: 1.3; }
.mcard-val { display: flex; align-items: center; gap: 8px; flex: none; }
.mcard-val b { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mcard-chip { font-style: normal; font-size: 13px; font-weight: 650; padding: 1px 8px; border-radius: 6px; }
.mcard-chip.ok { background: var(--success-soft); color: var(--success); } .mcard-chip.warn { background: var(--warning-soft); color: var(--warning); } .mcard-chip.crit { background: var(--danger-soft); color: var(--danger); }
.mcard-help { color: var(--text-muted); font-size: 14px; line-height: 1.45; }
.mcard-plot { position: relative; cursor: crosshair; }
.mcard-svg { width: 100%; height: 118px; display: block; background: var(--bg-inset); border-radius: 6px; }
.mcard-grid { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.mcard-line { fill: none; stroke: var(--accent); stroke-width: 1.8; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.mcard-area { fill: var(--accent); opacity: .13; stroke: none; }
.mcard-line.warn { stroke: var(--warning); } .mcard-area.warn { fill: var(--warning); }
.mcard-line.crit { stroke: var(--danger); } .mcard-area.crit { fill: var(--danger); }
.mcard-thr { fill: none; stroke-width: 1; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.mcard-thr.warn { stroke: var(--warning); } .mcard-thr.crit { stroke: var(--danger); }
.mcard-cross { stroke: var(--text-primary); stroke-width: 1; opacity: .5; vector-effect: non-scaling-stroke; }
.mcard-y { position: absolute; left: 8px; font: 12px var(--mono); color: var(--text-muted); pointer-events: none; }
.mcard-y.ytop { top: 4px; } .mcard-y.ybot { bottom: 4px; }
.mcard-mark { position: absolute; right: 8px; transform: translateY(-115%); font: 12px var(--mono); pointer-events: none; }
.mcard-mark.warn { color: var(--warning); } .mcard-mark.crit { color: var(--danger); }
.mcard-tip { position: absolute; top: -4px; transform: translate(-50%, -100%); background: var(--text-primary); color: var(--bg-panel); font: 13px var(--mono); padding: 4px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 2; }
.mcard-axis { display: flex; justify-content: space-between; font: 12px var(--mono); color: var(--text-muted); }
.mcard-stats { font-size: 14px; color: var(--text-muted); }

.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.chart figcaption { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: var(--text-secondary); margin-bottom: 4px; }
.chart figcaption b { color: var(--text-primary); font-weight: 650; font-size: 14px; font-variant-numeric: tabular-nums; }
.chart-svg { width: 100%; height: 84px; display: block; background: var(--bg-inset); border-radius: 6px; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-area { fill: var(--accent); opacity: .12; stroke: none; }
.chart-thr { stroke: var(--warning); stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.chart-foot { display: flex; justify-content: space-between; font: 12px var(--mono); color: var(--text-muted); margin-top: 4px; }
.chart-range { text-align: center; font: 12px var(--mono); color: var(--text-muted); }

/* ── раздел «Ноды» ──────────────────────────────────────────────────────────── */
.ntable-wrap { overflow-x: auto; margin: 0 -8px; }
.ntable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.ntable th { text-align: left; font-weight: 600; font-size: 14px; color: var(--text-muted); padding: 4px 12px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.ntable th button { border: 0; background: none; padding: 0; font: inherit; color: inherit; border-radius: 4px; }
.ntable th button:hover, .ntable th button.on { color: var(--text-primary); }
.ntable td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.ntable tbody tr:last-child td { border-bottom: 0; }
.nrow { cursor: pointer; }
.nrow:hover td { background: var(--bg-hover); }
.nrow:focus-visible { outline-offset: -2px; }
.n-name { font-size: 15px; font-weight: 650; white-space: nowrap; }
.ntable td:first-child .sub, .ntable td:nth-child(3) .sub { white-space: nowrap; }
.sub.exp.warn { color: var(--warning); font-weight: 600; } .sub.exp.crit { color: var(--danger); font-weight: 700; }
.score-chip { display: inline-block; min-width: 44px; text-align: center; font: 700 15px var(--sans); font-variant-numeric: tabular-nums; padding: 2px 8px; border-radius: 6px; }
.score-chip.lv-ok { background: var(--success-soft); color: var(--success); } .score-chip.lv-warn { background: var(--warning-soft); color: var(--warning); } .score-chip.lv-crit { background: var(--danger-soft); color: var(--danger); }
.score-word { display: block; font-size: 14px; margin-top: 4px; color: var(--text-muted); }
.score-word.lv-warn { color: var(--warning); } .score-word.lv-crit { color: var(--danger); }
.flag { display: flex; align-items: flex-start; font-size: 14px; line-height: 1.4; max-width: 44ch; }
.flag .dot { margin-top: .42em; }
.flag span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.flag.warn .dot { background: var(--warning); } .flag.crit .dot { background: var(--danger); }

.dyn-lead { font-size: 14px; color: var(--text-secondary); margin-bottom: 8px; }
.dyn-table td { padding: 8px 12px; vertical-align: middle; }
.dyn-graph { width: 120px; }
.dyn-spark { width: 110px; height: 24px; display: block; }
.dyn-line { fill: none; stroke: var(--text-muted); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.dyn-end { fill: var(--text-primary); }
.dyn-down .dyn-line { stroke: var(--danger); } .dyn-up .dyn-line { stroke: var(--success); }
.dyn-was b { font-weight: 700; font-variant-numeric: tabular-nums; }
.delta { font-weight: 700; font-variant-numeric: tabular-nums; }
.delta.down { color: var(--danger); } .delta.up { color: var(--success); } .delta.flat { color: var(--text-muted); font-weight: 400; font-size: 14px; }
.heat-fold { margin-top: 16px; }
.heat-wrap { overflow-x: auto; padding: 12px 0 8px; }
.heat { display: grid; gap: 2px; min-width: max-content; align-items: center; }
.heat-name { position: sticky; left: 0; z-index: 1; background: var(--bg-panel); border: 0; padding: 0 8px 0 0; font-size: 14px; text-align: left; white-space: nowrap; }
.heat-name:hover { color: var(--accent); }
.cell { height: 16px; min-width: 9px; border-radius: 2px; background: hsl(var(--h) var(--heat-s) var(--heat-l)); }
.cell.none { background: var(--neutral-soft); }
.axis { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.legend { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 14px; color: var(--text-muted); }
.lg { display: inline-block; width: 16px; height: 10px; border-radius: 2px; background: hsl(var(--h) var(--heat-s) var(--heat-l)); }
.lg.h0 { --h: 0; } .lg.h40 { --h: 40; } .lg.h80 { --h: 80; } .lg.h125 { --h: 125; }
.lg.none { background: var(--neutral-soft); margin-left: 8px; }

.attention, .att-list { display: grid; gap: 8px; }
.att-list { margin-top: 8px; }
.att { display: grid; gap: 8px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--bg-inset); }
.att-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.att-text { font-size: 14px; line-height: 1.5; }

.events { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; font-size: 14px; }
.events .fold { margin-top: 4px; }
.events .fold .events { margin-top: 12px; }
.ev { display: grid; gap: 2px; padding-left: 12px; border-left: 2px solid var(--border); }
.ev.rec { border-left-color: var(--success); }
.ev-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.ev-head time { margin-left: auto; color: var(--text-muted); font-size: 14px; white-space: nowrap; }
.ev-text { color: var(--text-secondary); font-size: 14px; line-height: 1.45; }

.system { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
.system dt { color: var(--text-secondary); }
.system dd { margin: 0; display: flex; align-items: baseline; font-variant-numeric: tabular-nums; }

/* ── раздел «Агент» ─────────────────────────────────────────────────────────── */
.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs button { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 8px 16px 10px; margin-bottom: -1px; border-bottom: 2px solid transparent; font-weight: 600; font-size: 14px; color: var(--text-secondary); white-space: nowrap; }
.subtabs button:hover { color: var(--text-primary); }
.subtabs button.on { color: var(--text-primary); border-bottom-color: var(--accent); }
.subtabs button:focus-visible { outline-offset: -3px; }
.subview { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }

.composer { display: grid; gap: 12px; }
.composer-row { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; }
.composer-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; min-width: 0; }
.files-row { display: flex; flex-wrap: wrap; gap: 8px; }
.files-row:empty { display: none; }
.file-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 12px; border-radius: 6px; background: var(--neutral-soft); font-size: 14px; }
.file-chip button { border: 0; background: transparent; color: var(--text-muted); font-size: 16px; line-height: 1; padding: 2px 6px; border-radius: 4px; }
.file-chip button:hover { color: var(--text-primary); }

.work-grid { display: grid; grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); gap: 24px; align-items: start; }
.work-left { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; min-width: 0; }
.tasks { display: grid; }
.task { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 4px 12px; align-items: baseline; padding: 12px 0; border-top: 1px solid var(--border); font-size: 14px; }
.task:first-child { border-top: 0; padding-top: 0; }
.task:last-child { padding-bottom: 0; }
.task .badge { justify-self: start; }
.task-title { font-weight: 600; line-height: 1.4; }
.task-title.linkish { border: 0; background: none; padding: 0; text-align: left; color: var(--text-primary); border-radius: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-title.linkish:hover { color: var(--accent); }
.tries { margin-left: 8px; font-size: 14px; font-weight: 600; color: var(--text-muted); }
.task-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; color: var(--text-muted); font-size: 14px; }
.task > .task-meta, .task > .task-sum, .task > .prog { grid-column: 2; }
.task-sum { color: var(--text-secondary); font-size: 14px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-more { font-size: 14px; color: var(--text-secondary); }
.task-more summary { cursor: pointer; width: max-content; border-radius: 4px; }
.prog { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.bar { height: 6px; border-radius: 3px; background: var(--neutral-soft); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
@media (prefers-reduced-motion: no-preference) { .bar i { transition: width .4s; } .bar.indet i { animation: slide 1.6s ease-in-out infinite alternate; } }
@keyframes slide { from { margin-left: 0; } to { margin-left: 92%; } }
.prog-text { font-size: 14px; color: var(--text-secondary); }
.plan { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: 14px; line-height: 1.45; }
.plan li.completed { color: var(--text-muted); text-decoration: line-through; }
.plan li.in_progress { font-weight: 600; }

.pb-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; align-items: start; }
.pb-card { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: var(--r-ctl); min-width: 0; }
.pb-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 12px; }
.pb-desc { color: var(--text-secondary); font-size: 14px; line-height: 1.5; white-space: pre-line; }
.pb-actions { display: flex; gap: 8px; }
.pb-form { display: grid; gap: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.pick-head { font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 8px 12px; }
.pick { display: inline-flex; align-items: flex-start; gap: 8px; font-size: 14px; cursor: pointer; }

.props { display: grid; }
.prop { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 16px 0; border-top: 1px solid var(--border); }
.prop:first-child { border-top: 0; padding-top: 0; }
.prop-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.prop-head code, .commit code { font: 13px var(--mono); color: var(--text-muted); overflow-wrap: anywhere; }
.prop-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-top: 8px; }
.repo + .repo { margin-top: 24px; }
.repo h3 { margin-bottom: 8px; }
.commit { font-size: 14px; margin-bottom: 12px; overflow-wrap: anywhere; }
.commit .refs { color: var(--text-muted); font-size: 14px; }

.facts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px 24px; }
.facts li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-content: start; font-size: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.facts li > time, .facts li > b, .facts li > .fact-text { grid-column: 1 / -1; }
.facts time { color: var(--text-muted); font-size: 14px; }
.facts b { overflow-wrap: anywhere; }
.fact-text { color: var(--text-secondary); line-height: 1.5; overflow-wrap: anywhere; }
.facts .linkbtn { justify-self: start; margin-top: 4px; }
.facts li.span-all, .facts li.empty { grid-column: 1 / -1; border: 0; padding: 0; display: block; }

.plan-box { margin-top: 24px; padding: 16px; border: 1px solid var(--accent); border-radius: var(--r-ctl); background: var(--bg-inset); }
.plan-box h2 { margin-bottom: 8px; }
.plan-text { font-size: 14px; line-height: 1.55; color: var(--text-secondary); margin-bottom: 12px; }
.plan-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.incomplete-box { margin: 12px 0; gap: 8px; }
.files-list { display: grid; gap: 8px; justify-items: start; }
.file-link { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--border-control); border-radius: var(--r-ctl); color: var(--text-primary); text-decoration: none; font-size: 14px; max-width: 100%; overflow-wrap: anywhere; }
.file-link:hover { background: var(--bg-hover); }
.reply { display: grid; gap: 8px; margin-top: 24px; }
.reply-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; }
.reply-btns { display: flex; gap: 8px; }

/* ── раздел «Сборщики» ──────────────────────────────────────────────────────── */
/* сборщики: общий вердикт сверху, одинаковые карточки, технические детали по кнопке */
.verdict { padding: 24px; border: 1px solid var(--border); border-radius: var(--r-panel); background: var(--bg-panel); align-items: center; }
.verdict.lv-ok { background: var(--success-soft); border-color: transparent; }
.verdict.lv-warn { background: var(--warning-soft); border-color: transparent; }
.verdict.lv-crit { background: var(--danger-soft); border-color: transparent; }
.verdict .page-title { font-size: 30px; align-items: center; }
.verdict .status-dot { width: 16px; height: 16px; transform: none; }
.verdict .page-desc { color: var(--text-primary); }
.verdict .pill { background: var(--bg-panel); }
.collectors { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 24px; align-items: stretch; }
.ccard { display: flex; flex-direction: column; gap: 16px; padding: 24px; background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r-panel); min-width: 0; }
.ccard.lv-crit { border-color: var(--danger); }
.ccard.lv-warn { border-color: var(--warning); }
.ccard.open { grid-column: 1 / -1; }
.ccard-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ccard-head h3 { font-size: 18px; }
.ccard-headline { font-size: 16px; line-height: 1.45; font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0; padding: 16px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.kpi { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 4px; min-width: 0; }
.kpi dd { margin: 0; font-size: 26px; line-height: 1.15; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; overflow-wrap: anywhere; }
.kpi dd.long { font-size: 18px; line-height: 1.3; }
.kpi dt { font-size: 14px; line-height: 1.35; color: var(--text-secondary); }
.nstrip { display: flex; flex-wrap: wrap; gap: 8px; }
.nchip { display: inline-flex; align-items: center; padding: 4px 12px 4px 8px; border-radius: var(--r-ctl); font-size: 14px; font-weight: 600; background: var(--neutral-soft); color: var(--text-primary); }
.nchip .dot { margin-right: 8px; background: var(--neutral); }
.nchip.ok .dot { background: var(--success); } .nchip.info .dot { background: var(--accent); }
.nchip.warn { background: var(--warning-soft); } .nchip.warn .dot { background: var(--warning); }
.nchip.crit { background: var(--danger-soft); } .nchip.crit .dot { background: var(--danger); }
.ccard-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; }
.ccard-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 12px; border: 1px solid var(--border-control); border-radius: var(--r-ctl); background: transparent; color: var(--text-primary); font-weight: 600; font-size: 14px; }
.ccard-toggle:hover { background: var(--bg-hover); }
.ccard-age { color: var(--text-muted); font-size: 14px; }
.ccard-detail { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.ccard-desc { color: var(--text-secondary); max-width: 78ch; }
.col-metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 0 32px; margin: 0; font-size: 14px; }
.mrow { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.col-metrics dt { color: var(--text-secondary); }
.col-metrics dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.col-timers { display: grid; gap: 8px; font-size: 14px; }
.col-timer .sub { margin-left: 16px; overflow-wrap: anywhere; }
.col-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }

/* ── раздел «Чат» ───────────────────────────────────────────────────────────── */
.chat { max-width: 880px; width: 100%; margin: 0 auto; display: grid; gap: 16px; }
.chat-log { display: grid; gap: 12px; align-content: start; min-height: 280px; max-height: calc(100vh - 420px); overflow-y: auto; padding: 4px; }
.msg { display: grid; gap: 4px; max-width: 86%; min-width: 0; }
.msg.user { justify-self: end; }
.msg-text { padding: 8px 16px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.55; }
.msg-text.md { white-space: normal; }
.msg.user .msg-text { background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.msg.assistant .msg-text { background: var(--bg-inset); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.typing .msg-text { color: var(--text-muted); font-style: italic; }
.msg-meta { font-size: 14px; color: var(--text-muted); }
.msg.user .msg-meta { text-align: right; }

/* ── раздел «Анализ» ────────────────────────────────────────────────────────── */
.an-grid { display: grid; grid-template-columns: 368px minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "form result" "hist result"; gap: 24px; align-items: start; }
.an-form { grid-area: form; display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 24px; }
.an-result { grid-area: result; padding: 32px; }
.an-hist { grid-area: hist; }
.group { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.group-l { padding: 0; font-size: 14px; font-weight: 650; color: var(--text-primary); display: flex; align-items: baseline; justify-content: space-between; gap: 8px; width: 100%; }
.group-l .opt { font-size: 14px; font-weight: 400; color: var(--text-muted); }
.group-l .opt.req { color: var(--warning); font-weight: 600; }
.an-form .radio { padding: 8px 12px; border: 1px solid transparent; border-radius: var(--r-ctl); }
.an-form .radio:hover { background: var(--bg-hover); }
.an-form .radio:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); }
.an-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.an-tools .hint-inline { white-space: nowrap; }
.an-quick { display: inline-flex; gap: 16px; white-space: nowrap; }
.an-topics { max-height: 328px; overflow-y: auto; display: grid; gap: 2px; padding: 4px; border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--bg-inset); }
.an-topics > .empty { padding: 12px; }
.an-topic { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 12px; align-items: start; padding: 8px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.an-topic:hover { background: var(--bg-hover); }
.an-topic:has(input:checked) { background: var(--accent-soft); }
.an-topic.quiet .an-name { color: var(--text-secondary); }
.an-name { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; line-height: 1.4; }
.an-n { font-size: 14px; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; text-align: right; line-height: 1.6; }
.an-mem { display: block; font-style: normal; }
.an-launch { display: grid; gap: 8px; padding-top: 24px; border-top: 1px solid var(--border); }
.an-launch .hint.bad { color: var(--danger); }

.rep-head { display: grid; gap: 16px; padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.rep-top { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px 16px; }
.rep-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; min-width: 0; }
.rep-title h2 { font-size: 20px; }
.rep-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.rep-meta { margin: 0; display: flex; flex-wrap: wrap; gap: 12px 40px; font-size: 14px; }
.rep-meta div { min-width: 0; }
.rep-meta .rep-src { flex: 1 0 100%; }
.rep-meta dt { font-size: 14px; color: var(--text-muted); margin-bottom: 2px; }
.rep-meta dd { margin: 0; overflow-wrap: anywhere; }
.rep-note { font-size: 14px; color: var(--text-secondary); padding: 12px 16px; border: 1px solid var(--warning); border-radius: var(--r-ctl); background: var(--bg-inset); }
.report { font-size: 16px; line-height: 1.65; max-width: 84ch; }
.report > * + * { margin-top: 12px; }
.report .md-list { gap: 8px; }
.rep-sec { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.report > .rep-sec + .rep-sec { margin-top: 32px; }
.rep-sec > h3 { font-size: 19px; line-height: 1.3; font-weight: 700; }
.rep-sec.lead { padding: 20px 24px; border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--bg-inset); }
.rep-sec.lead > h3 { font-size: 14px; font-weight: 650; color: var(--accent); }
.rep-void { font-size: 14px; color: var(--text-muted); padding-top: 24px; margin-top: 32px; border-top: 1px solid var(--border); }
.rep-foot { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 14px; color: var(--text-muted); max-width: 84ch; }
.state { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 64px 16px; color: var(--text-secondary); }
.state .ico { width: 32px; height: 32px; color: var(--text-muted); margin-bottom: 8px; }
.state h2 { font-size: 18px; color: var(--text-primary); }
.state p { max-width: 52ch; font-size: 14px; }
.state.err .ico { color: var(--danger); }
.state .ghost-btn, .state .primary { margin-top: 12px; }
.rep-run { display: grid; gap: 12px; padding: 32px 0 16px; }
.rep-run .ai-wait { font-size: 16px; color: var(--text-primary); }
.rep-steps { list-style: none; margin: 0; padding: 0 0 0 28px; display: grid; gap: 4px; font-size: 14px; color: var(--text-muted); }

.an-history { display: grid; gap: 4px; margin: 0 -8px; }
.an-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: baseline; text-align: left; padding: 8px; border: 1px solid transparent; border-radius: var(--r-ctl); background: transparent; }
.an-item:hover { background: var(--bg-hover); }
.an-item.on { background: var(--accent-soft); border-color: var(--accent); }
.an-item b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-item .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-item .an-item-st { grid-column: 1 / -1; font-size: 14px; font-weight: 600; }
.an-item-st.failed { color: var(--danger); } .an-item-st.running { color: var(--accent); }

/* ── страница входа ─────────────────────────────────────────────────────────── */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login { width: 100%; max-width: 400px; padding: 0; margin: 0; }
.login-card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--r-panel); padding: 32px; display: grid; gap: 24px; }
.login-brand { display: flex; align-items: center; gap: 16px; }
.login-brand .pulse { color: var(--accent); flex: none; }
.login-brand h1 { font-size: 22px; line-height: 1.2; }
.login-brand p { color: var(--text-secondary); font-size: 14px; margin-top: 2px; }
.login-form { display: grid; gap: 16px; }
.login-form label { font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.login-form input { padding: 10px 12px; font-size: 15px; }
.pw { position: relative; }
.pw input { padding-right: 96px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--text-secondary); font-size: 14px; padding: 6px 8px; border-radius: 6px; }
.pw-toggle:hover { color: var(--text-primary); background: var(--bg-hover); }
.form-error { border: 1px solid var(--danger); background: var(--danger-soft); color: var(--danger); border-radius: var(--r-ctl); padding: 8px 12px; font-size: 14px; }
.login-note { text-align: center; color: var(--text-muted); font-size: 14px; }

/* ── адаптив ────────────────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .grid { grid-template-columns: minmax(0, 1fr) 320px; }
  .work-grid { grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); }
}
@media (max-width: 960px) {
  main { padding: 24px 24px 48px; }
  .appbar-in { padding: 0 24px; }
  .grid, .grid.even, .work-grid { grid-template-columns: minmax(0, 1fr); }
  .an-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "form" "result" "hist"; }
  .an-topics { max-height: 264px; }

  /* на узком экране важное первым: замечания, затем ноды, динамика, события, работа мониторинга */
  #view-nodes .grid { display: flex; flex-direction: column; align-items: stretch; }
  #view-nodes .col-main, #view-nodes .col-side { display: contents; }
  #sec-att { order: 1; } #sec-nodes { order: 2; } #sec-dyn { order: 3; } #sec-ev { order: 4; } #sec-sys { order: 5; }

  /* таблица нод превращается в карточки */
  .ntable-wrap { margin: 0; }
  .ntable, .ntable thead, .ntable tbody { display: block; }
  .ntable thead { display: none; }
  .ntable tr { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; padding: 16px 0; border-bottom: 1px solid var(--border); }
  .ntable tbody tr:last-child { border-bottom: 0; padding-bottom: 0; }
  .ntable tbody tr:first-child { padding-top: 0; }
  .ntable td { display: block; border: 0; padding: 0; }
  .ntable td::before { content: attr(data-label); display: block; font-size: 14px; color: var(--text-muted); margin-bottom: 4px; }
  .ntable td:first-child, .ntable td:last-child { grid-column: 1 / -1; }
  .ntable td:first-child::before { display: none; }
  .nrow:hover td { background: transparent; }
  .dyn-table tr { grid-template-columns: minmax(0, 1.4fr) auto auto; align-items: center; padding: 8px 0; }
  .dyn-table td:first-child, .dyn-table td:last-child { grid-column: auto; }
  .dyn-table td::before { display: none; }
  .dyn-table td.dyn-graph, .dyn-table td:last-child { display: none; }
}
@media (max-width: 720px) {
  .appbar-in { flex-wrap: wrap; padding: 0 16px; gap: 0 12px; }
  .brand { min-height: 48px; }
  .tabs { order: 3; flex: 1 0 100%; margin: 0 -16px; padding: 0 8px; border-top: 1px solid var(--border); }
  .updated { display: none; }
  main { padding: 16px 16px 48px; }
  .view, .subview, .col-main, .col-side, .work-left { gap: 16px; }
  .grid, .work-grid, .an-grid, .collectors { gap: 16px; }
  .page-title { font-size: 23px; }
  .panel, .an-form, .ccard, .verdict { padding: 16px; }
  .verdict .page-title { font-size: 24px; }
  .kpi dd { font-size: 22px; }
  .an-result { padding: 20px 16px; }
  .page-side { width: 100%; }
  .drawer-panel { padding: 16px 16px 48px; }
  .drawer-close { margin: -4px -8px 0 8px; }
  .collectors, .pb-list, .facts { grid-template-columns: minmax(0, 1fr); }
  .task { grid-template-columns: minmax(0, 1fr); }
  .task > .task-meta, .task > .task-sum, .task > .prog { grid-column: 1; }
  .composer-row { flex-wrap: wrap; }
  .composer-row > button.primary { margin-left: auto; }
  .sc-row { grid-template-columns: 128px 1fr 32px; }
  .rep-title h2 { font-size: 18px; }
  .report { font-size: 15.5px; }
  .rep-sec > h3 { font-size: 18px; }
  .rep-sec.lead { padding: 16px; }
  .rep-meta { gap: 12px 24px; }
  .msg { max-width: 94%; }
  .chat-log { max-height: none; min-height: 200px; }
  .state { padding: 40px 8px; }
  .login-card { padding: 24px; }
}
@media (prefers-reduced-motion: no-preference) {
  button, .tabs a, .an-topic, .an-item, .radio { transition: background-color .12s, border-color .12s, color .12s; }
}

/* отступы внутри выдвижной панели задачи */
.drawer-panel .prog { margin: 12px 0; }
.drawer-panel .plan { margin-bottom: 16px; }
.drawer-panel .item { margin-top: 12px; }

/* описание инфраструктуры на странице «Анализ» */
.infra-box { align-items: center; gap: 12px 16px; }
.infra-state { display: grid; gap: 2px; }
.infra-l { font-size: 14px; color: var(--text-muted); }
.infra-v { font-size: 14px; font-weight: 600; }
.infra-v.old { color: var(--warning); }
.infra-state .linkbtn { justify-self: start; }

/* выбор модели в формах задачи и анализа */
.model-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.model-row .hint { flex: 1 1 260px; margin: 0; }
.an-form .model-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.an-form .model-row .field-l { font-size: 14px; font-weight: 650; color: var(--text-primary); }
.an-form .model-seg { display: flex; }
.an-form .model-seg button { flex: 1; padding: 2px 4px; }

/* повтор упавшей задачи */
.retry-box { gap: 12px; margin: 12px 0; }
.retry-box textarea { background: var(--bg-panel); }
.retry-fold { margin: 12px 0; }
.retry-fold > .retry-box { margin-top: 8px; }

/* метка состояния (сторож и другие сводки): точка и текст, цвет не единственный признак */
.stchip { display: inline-flex; align-items: center; gap: 0; padding: 2px 10px 2px 8px; border-radius: 6px; font-size: 14px; font-weight: 600; line-height: 1.4; background: var(--neutral-soft); color: var(--text-secondary); }
.stchip .dot { margin-right: 8px; margin-top: 0; background: var(--neutral); }
.stchip.ok { background: var(--success-soft); color: var(--success); } .stchip.ok .dot { background: var(--success); }
.stchip.warn { background: var(--warning-soft); color: var(--warning); } .stchip.warn .dot { background: var(--warning); }
.stchip.crit { background: var(--danger-soft); color: var(--danger); } .stchip.crit .dot { background: var(--danger); }
.stchip.info { background: var(--accent-soft); color: var(--accent); } .stchip.info .dot { background: var(--accent); }
.guard-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 4px; }
.guard-help { margin: 8px 0 4px; max-width: 70ch; }

/* форма «Большая задача»: сценарий, проект, лимит расходов */
.proj-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--bg-inset); }
.proj-form .hint { margin: -4px 0 0; }
.proj-new { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; align-items: end; }
.proj-info { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.proj-info:empty { display: none; }
.proj-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; font-size: 14px; color: var(--text-secondary); }
.proj-goal { color: var(--text-secondary); max-width: 78ch; overflow-wrap: anywhere; }
.proj-notes summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.proj-notes .log { margin-top: 8px; }
