/* Neodent IP-enforcement — дизайн-система (ui-ux-pro-max: "Data-Dense Dashboard",
   палитра authority-navy + amber-акцент, заголовки EB Garamond, текст Lato).
   Единый стайлшит; все цвета/отступы — через токены :root, без сырых hex в компонентах. */
@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:wght@500;600;700&family=Lato:wght@400;500;700&display=swap');

:root {
    /* поверхности */
    --bg: #eef2f7; --surface: #ffffff; --surface-2: #f8fafc; --surface-3: #f1f5f9;
    --border: #e2e8f0; --border-strong: #cbd5e1;
    /* текст */
    --text: #0f172a; --text-muted: #64748b; --text-faint: #6b7280;
    /* authority navy (primary) */
    --primary: #1e3a8a; --primary-700: #172e6e; --primary-600: #1e40af;
    --primary-weak: #eef2fb; --on-primary: #ffffff;
    /* amber акцент (вторичный CTA, эскалация/суд) */
    --accent: #b45309; --accent-600: #92400e; --accent-weak: #fef6ec;
    /* семантика */
    --ok: #047857; --ok-weak: #ecfdf5;
    --warn: #b45309; --warn-weak: #fffbeb;
    --danger: #b91c1c; --danger-weak: #fef2f2;
    /* форма */
    --radius: 12px; --radius-sm: 8px; --radius-pill: 999px;
    --shadow-sm: 0 1px 2px rgba(15,23,42,.05);
    --shadow: 0 4px 16px rgba(15,23,42,.08);
    --shadow-pop: 0 8px 22px rgba(15,23,42,.20);
    --space: 1.5rem;
    --font: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    --font-display: "EB Garamond", Georgia, "Times New Roman", serif;
    --sidebar-w: 248px;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--font-display); letter-spacing: .01em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: "SF Mono", "JetBrains Mono", "Roboto Mono", ui-monospace, monospace; }
/* Доступность: видимый фокус с клавиатуры */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ── Логин ──────────────────────────────────────────────────────────── */
.login-page {
    max-width: 400px; margin: 8vh auto; padding: 36px 34px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 16px; box-shadow: var(--shadow);
}
.login-page .brand-mark {
    display: flex; align-items: center; gap: 10px; margin-bottom: 18px;
    color: var(--primary); font-family: var(--font-display); font-weight: 700; font-size: 1.25rem;
}
.login-page .brand-mark svg { width: 26px; height: 26px; }
.login-page h1 { font-size: 1.4rem; margin: 0 0 2px; color: var(--text); }
.login-page h2 { font-size: 0.95rem; font-family: var(--font); font-weight: 500; color: var(--text-muted); margin: 0 0 20px; }
.login-page form { display: flex; flex-direction: column; gap: 12px; }
.login-page label { display: flex; flex-direction: column; gap: 5px; font-size: 0.85rem; color: var(--text-muted); }
.login-page input { padding: 11px 13px; font-size: 1rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.login-page input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-weak); }
.login-page button { padding: 12px; background: var(--primary); color: var(--on-primary); border: 0; border-radius: var(--radius-sm); font-size: 0.95rem; font-weight: 700; cursor: pointer; transition: background .14s; }
.login-page button:hover { background: var(--primary-700); }
.login-page .notice { background: var(--primary-weak); color: var(--primary-700); padding: 10px 12px; border-radius: var(--radius-sm); font-size: 0.88rem; }
.login-page .resend { margin-top: 2px; }
.login-page button.link { background: none; color: var(--primary); border: 0; padding: 4px; font-weight: 600; width: auto; align-self: flex-start; }
.login-page button.link:hover { background: none; text-decoration: underline; }
.admin-login { margin-top: 22px; border-top: 1px solid var(--border); padding-top: 14px; }
.admin-login summary { cursor: pointer; color: var(--text-muted); font-size: 0.85rem; }
.admin-login form { margin-top: 12px; }
.error { padding: 10px 12px; background: var(--danger-weak); color: var(--danger); border-radius: var(--radius-sm); margin-bottom: 1rem; }
.ok { padding: 10px 12px; background: var(--ok-weak); color: var(--ok); border-radius: var(--radius-sm); margin-bottom: 1rem; }

/* ── Шапка контента ─────────────────────────────────────────────────── */
header.app-header {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 16px var(--space); background: var(--surface); border-bottom: 1px solid var(--border);
}
header.app-header h1 { font-size: 1.35rem; font-weight: 700; margin: 0; color: var(--text); }
header.app-header .muted { margin-left: auto; }

main.dashboard { padding: 1.25rem var(--space); }

/* ── KPI-карточки ───────────────────────────────────────────────────── */
.kpi-bar { display: flex; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.kpi-card {
    flex: 1; min-width: 130px; padding: 14px 16px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
    color: inherit; text-decoration: none; cursor: pointer;
    transition: box-shadow .15s, transform .05s, border-color .15s;
    border-top: 3px solid var(--border-strong);
}
.kpi-card:hover { box-shadow: var(--shadow); text-decoration: none; border-top-color: var(--primary); }
.kpi-card:active { transform: scale(.99); }
.kpi-card.active { border-color: var(--primary); border-top-color: var(--primary); background: var(--primary-weak); }
.kpi-row { display: flex; align-items: center; gap: 8px; }
.kpi-ico { display: inline-flex; color: var(--text-muted); }
.kpi-ico svg { width: 20px; height: 20px; }
.kpi-card .kpi-num { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi-card .kpi-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.kpi-new { border-top-color: var(--primary); } .kpi-new .kpi-ico { color: var(--primary); }
.kpi-triaged { border-top-color: var(--ok); } .kpi-triaged .kpi-ico { color: var(--ok); }
.kpi-scared { border-top-color: #d14b63; } .kpi-scared .kpi-ico { color: #d14b63; }
.kpi-whitelisted { border-top-color: var(--accent); } .kpi-whitelisted .kpi-ico { color: var(--accent); }
.kpi-ignored { border-top-color: var(--border-strong); } .kpi-ignored .kpi-ico { color: var(--text-muted); }
.kpi-closed { border-top-color: var(--text-muted); } .kpi-closed .kpi-ico { color: var(--text-muted); }

/* ── Панель добавления ──────────────────────────────────────────────── */
.add-bar {
    display: flex; gap: 0.6rem; align-items: center; margin-bottom: 0.6rem;
    padding: 0.85rem; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.add-bar input[name="url"] {
    flex: 1; padding: 0.6rem 0.8rem; border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); font-size: 0.92rem; font-family: var(--font);
}
.add-bar input[name="url"]:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-weak); }
.add-hint { margin: 0 0 1.1rem; font-size: 0.84rem; color: var(--text-muted); }
.add-hint code { background: var(--surface); border: 1px solid var(--border); padding: 1px 6px; border-radius: 5px; }
.add-confirm {
    margin-bottom: 1rem; padding: 0.85rem 1.1rem; border-radius: var(--radius);
    background: var(--warn-weak); border: 1px solid #fcd34d;
}
.add-confirm ul { margin: 0.25rem 0 0.5rem 1.25rem; }
.add-confirm form { display: flex; gap: 0.5rem; }

/* ── Фильтры ────────────────────────────────────────────────────────── */
.filters {
    display: flex; gap: 0.55rem; flex-wrap: wrap; align-items: center;
    margin-bottom: 1.1rem; padding: 0.8rem; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.filters select, .filters input {
    padding: 0.45rem 0.6rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font-size: 0.88rem; font-family: var(--font); background: var(--surface); color: var(--text);
}
.filters select:focus, .filters input:focus { border-color: var(--primary); outline: none; }
.filters .chk { display: flex; align-items: center; gap: 5px; font-size: 0.85rem; color: var(--text-muted); }
.filters input[name="q"] { flex: 1; min-width: 180px; }

/* ── Таблица находок (overflow: visible — тултипы не обрезаются) ──────── */
.findings-table {
    width: 100%; border-collapse: collapse; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); overflow: visible;
    box-shadow: var(--shadow-sm);
}
.findings-table th, .findings-table td {
    padding: 0.6rem 0.7rem; text-align: left; border-bottom: 1px solid var(--surface-3);
    font-size: 0.9rem;
}
.findings-table th {
    background: var(--surface-2); color: var(--text-muted); cursor: pointer;
    font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    white-space: nowrap;
}
.findings-table thead th:first-child { border-top-left-radius: var(--radius); }
.findings-table thead th:last-child { border-top-right-radius: var(--radius); }
.findings-table td { vertical-align: top; }
.findings-table tbody tr:hover { background: var(--surface-2); }
.findings-table tbody tr:last-child td { border-bottom: 0; }

/* ── Кнопки действий ────────────────────────────────────────────────── */
.action-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 12px; border: 1px solid var(--border-strong); background: var(--surface);
    border-radius: var(--radius-sm); cursor: pointer; font-size: 0.84rem; font-family: var(--font);
    color: var(--text); line-height: 1.3; white-space: nowrap;
    transition: background .12s, border-color .12s, transform .04s, color .12s;
}
.action-btn svg { width: 15px; height: 15px; flex: 0 0 auto; }
.action-btn:hover { background: var(--surface-2); border-color: var(--primary); color: var(--primary); text-decoration: none; }
.action-btn:active { transform: scale(.97); }
.action-btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.action-btn.primary:hover { background: var(--primary-700); color: var(--on-primary); }
.action-btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.action-btn.danger:hover { background: #991b1b; color: #fff; }
/* Приглушённый деструктив (Удалить в строке находки): красный только текст/контур,
   заливка появляется на hover — не перетягивает внимание в каждой строке. */
.action-btn.danger-soft { color: var(--danger); border-color: #fecaca; background: var(--surface); }
.action-btn.danger-soft:hover { background: var(--danger-weak); color: #991b1b; border-color: var(--danger); }
.action-btn.ghost { border-color: var(--border); color: var(--text-muted); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* HTMX feedback: запрос летит — приглушаем, курсор «думает» */
.htmx-request, .htmx-request.action-btn { opacity: 0.5; cursor: progress; }
.htmx-request.findings-table tbody tr { background: var(--warn-weak); }
/* Подсветить строку после успешного swap на 1 с */
@keyframes flash-row { 0% { background: #fde68a; } 100% { background: transparent; } }
.findings-table tbody tr { animation: flash-row 1s ease-out; }

/* ── Статус-бейджи ──────────────────────────────────────────────────── */
.status-badge {
    display: inline-block; padding: 0.18rem 0.55rem; border-radius: var(--radius-pill);
    font-size: 0.78rem; font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(15,23,42,.06);
}
.status-new { background: #dbeafe; color: #1e40af; }
.status-triaged { background: var(--ok-weak); color: var(--ok); }
.status-scared { background: #fde7ea; color: #b3324a; }
.status-ignored { background: var(--surface-3); color: var(--text-muted); }
.status-whitelisted { background: #fef3c7; color: var(--accent-600); }
.status-deleted { background: var(--surface-3); color: var(--text-muted); text-decoration: line-through; }

/* ── Drawer-справка ─────────────────────────────────────────────────── */
.help-drawer {
    position: fixed; right: 0; top: 0; height: 100vh; width: 380px;
    background: var(--surface); box-shadow: -8px 0 24px rgba(15,23,42,.14);
    padding: 1.6rem; overflow-y: auto; transform: translateX(100%);
    transition: transform 0.22s ease; z-index: 120;
}
.help-drawer.open { transform: translateX(0); }
.help-content h3 { margin: 0 0 14px; font-size: 1.15rem; color: var(--primary); }
.help-content h4 { margin: 18px 0 6px; font-size: 0.92rem; color: var(--text); }
.help-content ul { margin: 0; padding-left: 1.15rem; }
.help-content li { margin-bottom: 5px; font-size: 0.9rem; }
.help-content p { font-size: 0.88rem; color: var(--text-muted); }
.action-btn.close { position: absolute; top: 1.1rem; right: 1.1rem; padding: 2px 9px; font-size: 1rem; }

/* ── Модалка ────────────────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,0.5); display: flex; align-items: center; justify-content: center; z-index: 150; }
.modal-content { background: var(--surface); padding: 1.6rem; border-radius: var(--radius); min-width: 400px; max-width: 90vw; box-shadow: var(--shadow-pop); }

/* ── Боковое меню ───────────────────────────────────────────────────── */
.sidebar {
    position: fixed; left: 0; top: 0; width: var(--sidebar-w); height: 100vh;
    background: var(--surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; z-index: 50;
}
.sidebar__head { display: flex; align-items: stretch; }
.sidebar__head .sidebar__brand { flex: 1; }
.sidebar__brand {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 1.05rem 1.25rem; border-bottom: 1px solid var(--surface-3);
    color: var(--primary); font-weight: 700;
}
.sidebar__brand:hover { text-decoration: none; }
.sidebar__logo { display: inline-flex; }
.sidebar__logo svg { width: 26px; height: 26px; color: var(--primary); }
.sidebar__brandtext { display: flex; flex-direction: column; line-height: 1.05; font-family: var(--font-display); font-size: 1.18rem; }
.sidebar__brandtext small { font-family: var(--font); font-size: 0.66rem; font-weight: 600; color: var(--text-faint); text-transform: uppercase; letter-spacing: .06em; }
.sidebar__nav { display: flex; flex-direction: column; padding: 0.6rem; gap: 2px; flex: 1; overflow-y: auto; }
.sidebar__link {
    display: flex; align-items: center; gap: 0.7rem;
    padding: 0.62rem 0.75rem; border-radius: var(--radius-sm);
    color: #334155; font-size: 0.92rem; font-weight: 500; transition: background .12s, color .12s;
}
.sidebar__link:hover { background: var(--surface-3); text-decoration: none; }
.sidebar__link.is-active { background: var(--primary-weak); color: var(--primary); font-weight: 700; box-shadow: inset 3px 0 0 var(--primary); }
.sidebar__ico { width: 1.4rem; display: inline-flex; align-items: center; justify-content: center; color: currentColor; }
.sidebar__ico svg { width: 18px; height: 18px; }
.sidebar__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__foot { border-top: 1px solid var(--surface-3); padding: 0.6rem; }
.sidebar__logout-form { margin: 0; padding: 0 0.1rem; }
.sidebar__logout {
    width: 100%; margin-top: 4px; padding: 0.55rem; border: 1px solid var(--border);
    background: var(--surface); border-radius: var(--radius-sm); color: var(--text-muted);
    cursor: pointer; font-size: 0.85rem; font-family: var(--font); transition: background .12s, color .12s;
}
.sidebar__logout:hover { background: var(--danger-weak); color: var(--danger); border-color: #fecaca; }

.page-wrap.with-sidebar { margin-left: var(--sidebar-w); }
.page-wrap.no-sidebar { margin-left: 0; }

/* Верхняя панель с гамбургером и кнопка закрытия drawer — только мобила (см. @media) */
.topbar { display: none; }
.sidebar__close { display: none; }
.nav-backdrop { display: none; }

/* ── Хлебные крошки ─────────────────────────────────────────────────── */
.breadcrumbs {
    padding: 0.65rem var(--space); font-size: 0.85rem; color: var(--text-muted);
    background: var(--surface); border-bottom: 1px solid var(--border);
}
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs__sep { margin: 0 0.45rem; color: var(--border-strong); }
.breadcrumbs__current { color: var(--text); font-weight: 700; }

/* ── Общие утилиты ──────────────────────────────────────────────────── */
.stage-badge {
    display: inline-block; padding: 2px 9px; border-radius: var(--radius-pill);
    font-size: 0.78rem; font-weight: 700; color: #334155; white-space: nowrap;
    box-shadow: inset 0 0 0 1px rgba(15,23,42,.06);
}
.muted { color: var(--text-muted); font-size: 0.85rem; }
/* Причина закрытия (список дел): под меткой этапа у закрытых дел */
.close-reason-tag {
    margin-top: 4px; font-size: 0.78rem; font-weight: 600; color: var(--text-muted);
    display: inline-flex; align-items: center; gap: 5px;
}
.close-reason-tag::before {
    content: ""; width: 7px; height: 7px; border-radius: 50%;
    background: var(--text-faint); flex: none;
}
/* Победные дела: медаль + красная подсветка (owner 2026-07-08). */
.close-reason-tag.won { color: #b91c1c; font-weight: 700; }
.close-reason-tag.won::before { display: none; }
tr.won-case { background: rgba(220, 38, 38, 0.06); box-shadow: inset 3px 0 0 #dc2626; }
tr.won-case .case-code { color: #b91c1c; font-weight: 700; }
.won-medal { font-size: 1.05em; }
.won-badge {
    display: inline-flex; align-items: center; gap: 4px;
    background: rgba(220, 38, 38, 0.10); color: #b91c1c; font-weight: 700;
    border: 1px solid #dc2626; border-radius: 999px; padding: 1px 10px; font-size: 0.82rem;
}
.app-header.won-case .case-code { color: #b91c1c; }
.kanban-card.won { border-color: #dc2626; box-shadow: inset 3px 0 0 #dc2626; }
.kanban-card.won .kanban-card-code { color: #b91c1c; font-weight: 700; }
.kanban-card-reason.won { color: #b91c1c; font-weight: 700; }
.kanban-card-reason.won::before { background: #dc2626; }
.empty { color: var(--text-faint); font-style: italic; }
.ts { color: var(--text-faint); font-size: 0.78rem; font-variant-numeric: tabular-nums; }

/* ── Страница дела ──────────────────────────────────────────────────── */
.case-detail { padding: 1.25rem var(--space); }
.case-detail .case-code { font-family: "SF Mono", ui-monospace, monospace; color: var(--primary); }
.case-detail .priority {
    display: inline-block; padding: 2px 9px; border-radius: var(--radius-pill);
    font-size: 0.72rem; font-weight: 700; margin-left: 0.5rem;
}
.case-detail .priority.HIGH { background: var(--danger-weak); color: var(--danger); }
.case-detail .priority.MEDIUM { background: var(--accent-weak); color: var(--accent); }
.case-detail .priority.LOW { background: var(--ok-weak); color: var(--ok); }
.alert {
    display: flex; align-items: center; gap: 8px;
    background: var(--danger-weak); color: var(--danger); padding: 12px 18px;
    border-left: 4px solid var(--danger); border-radius: var(--radius-sm); margin-bottom: 16px;
}
.alert svg { width: 18px; height: 18px; flex: 0 0 auto; }
.case-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
@media (max-width: 900px) { .case-grid { grid-template-columns: 1fr; } }
.case-detail section {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px 20px; box-shadow: var(--shadow-sm);
    min-width: 0;   /* grid-элемент: даёт колонке сжиматься, не раздуваясь по длинному URL */
}
.case-detail section h2 { margin: 0 0 12px; font-size: 1.1rem; color: var(--primary); }
.case-detail dl { margin: 0; }
.case-detail dt { font-size: 0.72rem; color: var(--text-muted); margin-top: 10px; text-transform: uppercase; letter-spacing: .04em; }
.case-detail dd { margin: 2px 0 0; font-size: 0.9rem; word-wrap: break-word; }
/* Длинные URL (найденные карточки, ссылки в деле) и код — переносить, не раздувать грид */
.case-detail a, .case-detail code, .brand-cards a { overflow-wrap: anywhere; word-break: break-word; }
.brand-cards { padding-left: 18px; margin: 4px 0 0; }
.brand-cards li { margin: 2px 0; }

/* Воронка этапов */
.funnel-wrap { margin-bottom: 18px; }
.funnel { list-style: none; display: flex; gap: 4px; padding: 0; margin: 0 0 14px; overflow-x: auto; }
.funnel__step {
    flex: 1; min-width: 92px; text-align: center; padding: 10px 6px;
    border-radius: var(--radius-sm); background: var(--surface-3); font-size: 0.8rem;
    color: var(--text-faint); border: 1px solid var(--border);
}
.funnel__dot { display: block; font-size: 1.1rem; line-height: 1; margin-bottom: 4px; }
.funnel__label { display: block; }
.funnel__step.is-done { background: var(--ok-weak); color: var(--ok); border-color: #a7f3d0; }
.funnel__step.is-current { background: var(--primary-weak); color: var(--primary); border-color: #93c5fd; font-weight: 700; }
.status-card { background: var(--primary-weak); border-left: 4px solid var(--primary); padding: 14px 18px; border-radius: var(--radius-sm); }
.status-card__done { font-weight: 700; color: var(--primary-700); margin-bottom: 8px; }
.status-card__title { font-weight: 700; font-size: 0.92rem; }
.status-card__steps { margin: 6px 0 0; padding-left: 20px; }
.status-card__steps li { margin-bottom: 4px; font-size: 0.9rem; }
.pill {
    display: inline-flex; align-items: center; gap: 6px; background: var(--primary); color: #fff; padding: 7px 15px;
    border-radius: var(--radius-pill); text-decoration: none; font-size: 0.82rem; font-weight: 600; margin-top: 10px;
}
.pill svg { width: 15px; height: 15px; }
.pill:hover { background: var(--primary-700); text-decoration: none; }

/* Документы */
.files { display: flex; flex-direction: column; gap: 8px; }
.file { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.file-ico { display: inline-flex; color: var(--primary); flex: 0 0 auto; }
.file-ico svg { width: 18px; height: 18px; }
.file.missing .file-ico { color: var(--text-faint); }
.file .name { font-weight: 600; }
.file .desc { color: var(--text-muted); font-size: 0.78rem; }
.file > div:first-child { flex: 1; }
.file .links { display: flex; gap: 6px; }
.file .links a { color: var(--primary); font-size: 0.8rem; border: 1px solid var(--primary); padding: 4px 10px; border-radius: var(--radius-sm); }
.file .links a:hover { background: var(--primary); color: #fff; text-decoration: none; }
.file.missing { background: var(--surface-2); color: var(--text-faint); }
.file.missing .links a, .file .links a.disabled { border-color: var(--border-strong); color: var(--text-faint); pointer-events: none; }

/* Хронология */
.case-timeline .tl-item { padding: 8px 0 8px 22px; border-left: 2px solid var(--border); position: relative; font-size: 0.85rem; }
.case-timeline .tl-item::before { content: ''; position: absolute; left: -6px; top: 12px; width: 10px; height: 10px; background: var(--primary); border-radius: 50%; box-shadow: 0 0 0 3px var(--surface); }
.case-timeline .ts { color: var(--text-faint); font-size: 0.72rem; }
.case-timeline .desc { color: #475569; margin-top: 2px; }

/* Markdown-превью */
.markdown-preview { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 18px 22px; max-height: 600px; overflow: auto; font-size: 0.88rem; line-height: 1.65; }
.markdown-preview h1 { font-size: 1.2rem; margin-top: 0; }
.markdown-preview h2 { font-size: 1.05rem; margin-top: 18px; color: var(--primary); }
.markdown-preview code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; font-size: 0.8rem; }
.markdown-preview table { border-collapse: collapse; }
.markdown-preview td, .markdown-preview th { border: 1px solid var(--border); padding: 6px 10px; font-size: 0.8rem; }

/* ── Тултип-поповер (работает при наведении И при фокусе/тапе) ───────── */
.tip { position: relative; }
.tip::after {
    content: attr(data-tip);
    position: absolute; bottom: calc(100% + 8px); left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--text); color: #fff; padding: 8px 11px; border-radius: var(--radius-sm);
    font-size: 12px; font-weight: 400; line-height: 1.45; text-align: left;
    width: max-content; max-width: 260px; white-space: normal;
    opacity: 0; pointer-events: none; transition: opacity .14s, transform .14s;
    box-shadow: var(--shadow-pop); z-index: 200;
}
.tip:hover::after, .tip:focus-visible::after, .tip:focus::after {
    opacity: 1; transform: translateX(-50%) translateY(0);
}

/* Круглый значок-вопрос «?» рядом с термином/полем — триггер тултипа .tip */
.qmark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 15px; height: 15px; margin-left: 5px; border-radius: 50%;
    background: var(--primary-weak); color: var(--primary); border: 1px solid var(--border-strong);
    font-size: 10px; font-weight: 700; line-height: 1; cursor: help; vertical-align: middle;
    user-select: none; flex: none;
}
.qmark:hover { background: var(--primary); color: #fff; }

/* Словарь терминов на странице справки */
.glossary { margin: 1.5rem var(--space) 0; }
.glossary h2 { font-family: var(--font-display); font-size: 1.15rem; color: var(--primary-700);
    border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.glossary-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 4px 24px; margin: 12px 0 0; }
.glossary-list dt { font-weight: 700; color: var(--text); margin-top: 10px; }
.glossary-list dd { margin: 2px 0 0; color: var(--text-muted); font-size: 0.9rem; line-height: 1.45; }

/* ── Страница справки ───────────────────────────────────────────────── */
.help-page { padding: 1.25rem var(--space); }
.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }
.help-page section {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px 20px; box-shadow: var(--shadow-sm);
}
.help-page section h2 { margin: 0 0 10px; font-size: 1.15rem; color: var(--primary); }
.help-page section.warn { border-left: 4px solid var(--warn); background: var(--warn-weak); }
.help-page .legend { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.help-page .legend li { font-size: 0.9rem; }
.help-page .legend--ico li { display: flex; gap: 6px; align-items: baseline; }
.ico-label { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.lico { display: inline-flex; color: var(--primary); }
.lico svg { width: 15px; height: 15px; }
.help-page section.warn h2 { color: var(--accent-600); }
.help-page code, .help-page .example code { background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 5px; font-size: 0.82rem; }
.funnel-legend { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.funnel-pill { display: inline-block; background: var(--primary-weak); color: var(--primary-700); padding: 4px 10px; border-radius: var(--radius-pill); font-size: 0.82rem; font-weight: 600; }

/* ── Адаптив ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    main.dashboard, .case-detail, .help-page { padding: 0.75rem; }
    .kpi-bar { flex-wrap: wrap; }
    .findings-table { font-size: 0.82rem; }
    .findings-table th, .findings-table td { padding: 0.4rem; }
    /* Верхняя панель с гамбургером */
    .topbar {
        display: flex; align-items: center; gap: 0.7rem;
        position: sticky; top: 0; z-index: 120;
        padding: 0.55rem 0.9rem;
        background: var(--surface); border-bottom: 1px solid var(--border);
    }
    .topbar__burger {
        display: inline-flex; align-items: center; justify-content: center;
        width: 2.4rem; height: 2.4rem; padding: 0;
        background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm);
        color: var(--text); cursor: pointer;
    }
    .topbar__burger:hover { background: var(--surface-3); }
    .topbar__burger svg { width: 22px; height: 22px; }
    .topbar__brand {
        display: inline-flex; align-items: center; gap: 0.45rem;
        font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; color: var(--primary);
    }
    .topbar__brand:hover { text-decoration: none; }
    .topbar__logo svg { width: 22px; height: 22px; color: var(--primary); }

    /* Боковое меню → выезжающий drawer поверх контента */
    .sidebar {
        width: min(84vw, 300px); height: 100dvh;
        transform: translateX(-100%); transition: transform .22s ease;
        z-index: 200;
    }
    body.nav-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-pop); }
    .sidebar__close {
        display: inline-flex; align-items: center; justify-content: center;
        align-self: center; margin-right: 0.7rem; width: 2rem; height: 2rem; padding: 0;
        background: transparent; border: 0; border-radius: var(--radius-sm);
        color: var(--text-muted); cursor: pointer;
    }
    .sidebar__close:hover { background: var(--surface-3); color: var(--text); }
    .sidebar__close svg { width: 20px; height: 20px; }

    /* Затемнение под drawer */
    .nav-backdrop {
        display: block; position: fixed; inset: 0; z-index: 150;
        background: rgba(15,23,42,0.45);
        opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s ease;
    }
    body.nav-open .nav-backdrop { opacity: 1; visibility: visible; }

    .page-wrap.with-sidebar { margin-left: 0; }
}

/* ── Канбан-доска дел (M1) ─────────────────────────────────────────── */
.view-toggle { margin-left: auto; display: inline-flex; gap: 4px; background: var(--surface-3);
    border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 3px; }
.view-tab { font-size: 0.85rem; padding: 0.3rem 0.85rem; border-radius: var(--radius-pill);
    color: var(--text-muted); text-decoration: none; line-height: 1.4; }
.view-tab:hover { color: var(--text); }
.view-tab.is-active { background: var(--primary); color: var(--on-primary); font-weight: 600; }

.kanban-board { display: flex; gap: 0.75rem; overflow-x: auto; align-items: flex-start;
    padding-bottom: 1rem; }
.kanban-col { flex: 0 0 264px; display: flex; flex-direction: column; max-height: calc(100vh - 220px);
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.kanban-col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 0.6rem 0.8rem; border-top: 3px solid var(--col-accent, var(--border-strong));
    border-top-left-radius: var(--radius); border-top-right-radius: var(--radius);
    border-bottom: 1px solid var(--border); }
.kanban-col-title { font-family: var(--font-display); font-size: 0.98rem; font-weight: 600;
    color: var(--text); }
.kanban-count { font-size: 0.75rem; font-weight: 700; color: var(--text-muted);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-pill);
    min-width: 1.4rem; text-align: center; padding: 1px 6px; }
.kanban-cards { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.6rem;
    overflow-y: auto; }
.kanban-card { display: block; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 0.6rem 0.7rem; text-decoration: none; color: var(--text);
    box-shadow: var(--shadow-sm); transition: box-shadow .12s ease, transform .12s ease; }
.kanban-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kanban-card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.kanban-card-code { font-weight: 700; color: var(--primary); font-size: 0.9rem; }
.kanban-card-sum { font-size: 0.8rem; font-weight: 600; color: var(--accent); white-space: nowrap; }
.kanban-card-resp { font-size: 0.88rem; margin-top: 2px; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kanban-card-brand { font-size: 0.74rem; color: var(--accent-600); text-transform: uppercase;
    letter-spacing: .02em; margin-top: 1px; }
.kanban-card-next { font-size: 0.8rem; color: var(--text-muted); margin-top: 5px; line-height: 1.35; }
/* Причина закрытия на карточке закрытого дела (won/lost) — вместо «след. шага» */
.kanban-card-reason { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px;
    font-size: 0.78rem; font-weight: 600; color: var(--text-muted); line-height: 1.3; }
.kanban-card-reason::before { content: ""; width: 7px; height: 7px; border-radius: 50%;
    background: var(--text-faint); flex: none; }
.kanban-card-ev { font-size: 0.72rem; color: var(--text-faint); margin-top: 5px; }
.kanban-empty { color: var(--text-faint); font-size: 0.8rem; text-align: center; padding: 0.6rem 0; margin: 0; }
/* Drag&drop: обёртка карточки (перетаскиваемая) + крестик «закрыть» поверх неё. */
.kanban-card-wrap { position: relative; cursor: grab; }
.kanban-card-wrap.dragging { opacity: .5; }
.kanban-card-close { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px;
    line-height: 18px; text-align: center; border: 1px solid var(--border); border-radius: 50%;
    background: var(--surface); color: var(--text-faint); font-size: 0.72rem; cursor: pointer;
    opacity: 0; transition: opacity .12s ease, color .12s ease, background .12s ease; padding: 0; }
.kanban-card-wrap:hover .kanban-card-close { opacity: 1; }
.kanban-card-close:hover { color: #fff; background: var(--danger, #dc2626); border-color: var(--danger, #dc2626); }
/* Кнопка «Вернуть в работу» на карточке закрытого дела — как ✕, но всегда видна */
.kanban-card-reopen { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px;
    line-height: 20px; text-align: center; border: 1px solid var(--border); border-radius: 50%;
    background: var(--surface); color: var(--text-muted); font-size: 0.82rem; cursor: pointer;
    opacity: .75; transition: opacity .12s ease, color .12s ease, background .12s ease; padding: 0; }
.kanban-card-wrap:hover .kanban-card-reopen { opacity: 1; }
.kanban-card-reopen:hover { color: #fff; background: var(--primary); border-color: var(--primary); }
.kanban-col.drop-target { outline: 2px dashed var(--accent, #d97706); outline-offset: -2px; }
.kanban-hint { font-size: 0.78rem; padding: 0.5rem var(--space) 0; margin: 0; line-height: 1.4; }
/* Модалка выбора причины закрытия дела. */
.close-dialog { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem;
    max-width: 420px; width: calc(100% - 2rem); box-shadow: var(--shadow); color: var(--text); }
.close-dialog::backdrop { background: rgba(15, 23, 42, .35); }

/* ── Консультант ────────────────────────────────────────────────────── */
.consult { padding: 1.25rem var(--space); max-width: 860px; }
.consult .page-title { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700;
    margin: 0 0 4px; color: var(--text); }
.consult__log {
    display: flex; flex-direction: column; gap: 0.65rem;
    max-height: 60vh; overflow-y: auto; padding: 0.8rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    margin: 1rem 0;
}
.consult__turn {
    padding: 0.6rem 0.85rem; border-radius: var(--radius-sm);
    font-size: 0.92rem; line-height: 1.5; max-width: 88%;
}
.consult__turn--user {
    background: var(--primary-weak); color: var(--primary-700);
    align-self: flex-end; border: 1px solid #c7d7f6;
}
.consult__turn--assistant {
    background: var(--surface-2); color: var(--text);
    align-self: flex-start; border: 1px solid var(--border);
}
.consult__turn.is-ungrounded {
    background: var(--warn-weak); border-color: #fcd34d;
    color: var(--warn);
}
.consult__answer { white-space: pre-wrap; }
.consult__sources { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }
.consult__form {
    display: flex; gap: 0.6rem; align-items: flex-end;
    padding: 0.85rem; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.consult__form textarea {
    flex: 1; padding: 0.55rem 0.75rem; border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); font-size: 0.92rem; font-family: var(--font);
    resize: vertical; min-height: 3rem;
}
.consult__form textarea:focus { border-color: var(--primary); outline: none;
    box-shadow: 0 0 0 3px var(--primary-weak); }
.consult__form button {
    padding: 0.55rem 1.1rem; background: var(--primary); color: var(--on-primary);
    border: 0; border-radius: var(--radius-sm); font-size: 0.92rem;
    font-weight: 600; cursor: pointer; transition: background .14s; white-space: nowrap;
}
.consult__form button:hover { background: var(--primary-700); }
/* Чипы источников */
.src-chip {
    display: inline-block; padding: 1px 7px; border-radius: var(--radius-pill);
    font-size: 0.72rem; font-weight: 600; letter-spacing: .01em;
    background: var(--surface-3); color: var(--text-muted);
    border: 1px solid var(--border);
}
.src-chip--superseded { background: var(--danger-weak); color: var(--danger);
    border-color: #fca5a5; }
.src-chip--current { background: var(--ok-weak); color: var(--ok);
    border-color: #6ee7b7; }
.src-chip--na { background: var(--surface-3); color: var(--text-muted); }

/* Баннер контекста дела в консультанте */
.consult__case {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem;
    padding: 0.65rem 0.9rem; margin-bottom: 0.85rem;
    background: var(--primary-weak); border: 1px solid #c7d7f6;
    border-radius: var(--radius); font-size: 0.88rem;
}
.consult__case-label {
    flex: 1; color: var(--primary-700); font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.consult__note {
    display: flex; gap: 0.45rem; align-items: center; flex-wrap: nowrap;
}
.consult__note input[type="text"] {
    padding: 0.38rem 0.7rem; border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); font-size: 0.88rem; font-family: var(--font);
    min-width: 16rem;
}
.consult__note input[type="text"]:focus {
    border-color: var(--primary); outline: none;
    box-shadow: 0 0 0 3px var(--primary-weak);
}
.consult__note button {
    padding: 0.38rem 0.9rem; background: var(--accent); color: #fff;
    border: 0; border-radius: var(--radius-sm); font-size: 0.88rem;
    font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .14s;
}
.consult__note button:hover { background: var(--accent-700, #b45309); }
.consult__proposal {
    display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
    margin-top: 0.5rem; padding: 0.6rem 0.9rem;
    background: var(--accent-weak); border: 1px solid #f6d8a8;
    border-radius: var(--radius-sm); font-size: 0.88rem; color: var(--accent-600);
}
.consult__proposal span { flex: 1 1 0; }
.consult__proposal button {
    padding: 0.3rem 0.85rem; background: var(--accent); color: #fff;
    border: none; border-radius: var(--radius-sm); font-size: 0.83rem;
    cursor: pointer; white-space: nowrap;
}
.consult__proposal button:hover { background: var(--accent-600); }

/* --- Инструкции по этапам (playbook) --- */
.status-card__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pill--primary { background: var(--accent); }
.pill--primary:hover { background: var(--accent-600); }

.playbook-page { max-width: 1000px; }
.pb-phase { margin-top: 1.6rem; }
.pb-phase__title { font-family: var(--font-display); font-size: 1.15rem; color: var(--primary-700);
    border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 12px; }
.pb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.pb-card { display: flex; flex-direction: column; gap: 5px; background: var(--surface);
    border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: var(--radius-sm);
    padding: 12px 14px; text-decoration: none; transition: box-shadow .12s, border-color .12s; }
.pb-card:hover { box-shadow: var(--shadow-sm); border-left-color: var(--accent); text-decoration: none; }
.pb-card__title { font-weight: 700; color: var(--text); }
.pb-card__summary { font-size: 0.85rem; color: var(--text-muted); line-height: 1.35; }

.pb-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
.pb-side { position: sticky; top: 1rem; font-size: 0.86rem; }
.pb-side__back { display: inline-block; margin-bottom: 10px; color: var(--primary); font-weight: 600; text-decoration: none; }
.pb-side__group { margin-bottom: 12px; }
.pb-side__phase { text-transform: uppercase; font-size: 0.7rem; letter-spacing: .04em;
    color: var(--text-faint); margin-bottom: 4px; }
.pb-side__link { display: block; padding: 4px 8px; color: var(--text-muted); text-decoration: none;
    border-radius: var(--radius-sm); border-left: 2px solid transparent; }
.pb-side__link:hover { background: var(--surface-3); text-decoration: none; }
.pb-side__link.is-active { color: var(--primary-700); font-weight: 700; border-left-color: var(--primary);
    background: var(--primary-weak); }

.pb-article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 22px 28px; box-shadow: var(--shadow-sm); }
.pb-article__phase { display: inline-block; background: var(--primary-weak); color: var(--primary-700);
    font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    padding: 3px 10px; border-radius: var(--radius-pill); margin-bottom: 10px; }
.pb-article__body { line-height: 1.6; }
.pb-article__body h1 { font-family: var(--font-display); font-size: 1.5rem; color: var(--primary-700); margin: 0 0 .6rem; }
.pb-article__body h2 { font-size: 1.08rem; color: var(--text); margin: 1.4rem 0 .5rem; }
.pb-article__body h3 { font-size: 0.98rem; color: var(--text); margin: 1rem 0 .4rem; }
.pb-article__body table { border-collapse: collapse; width: 100%; margin: .8rem 0; font-size: 0.9rem; }
.pb-article__body th, .pb-article__body td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; vertical-align: top; }
.pb-article__body th { background: var(--surface-3); }
.pb-article__body code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; font-size: 0.88em; }
.pb-article__body blockquote { border-left: 3px solid var(--accent); background: var(--accent-weak);
    margin: .8rem 0; padding: 8px 14px; border-radius: var(--radius-sm); }
.pb-article__body blockquote p { margin: .3rem 0; }
.pb-article__body a { color: var(--primary); }
@media (max-width: 760px) {
    .pb-layout { grid-template-columns: 1fr; }
    .pb-side { position: static; }
}

/* ── Документы/доказательства дела (P5) ─────────────────────────────────── */
.docs-missing { background: var(--accent-weak); border-left: 3px solid var(--accent);
    padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: .9rem; }
.page-intro { background: var(--primary-weak); border-left: 3px solid var(--primary);
    padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: .9rem; }
.page-intro h2 { margin: 0 0 6px; font-size: 1rem; }
.page-intro ul { margin: 6px 0 0; padding-left: 18px; }
.page-intro li { margin: 4px 0; }
.page-intro .muted { margin: 8px 0 0; }
.owner-only-tag { display: inline-block; background: var(--primary); color: var(--on-primary);
    border-radius: 999px; padding: 1px 9px; font-size: .76rem; font-weight: 600; margin-left: 8px;
    vertical-align: middle; }
.doc-chip-missing { display: inline-block; background: #fff; border: 1px solid #fde68a;
    color: var(--accent-600); border-radius: 999px; padding: 2px 10px; margin: 3px 4px 0 0; font-size: .82rem; }
.doc-upload { margin-bottom: 16px; }
.doc-dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px;
    border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 22px 16px;
    text-align: center; color: var(--text-muted); cursor: pointer; transition: border-color .15s, background .15s; }
.doc-dropzone:hover, .doc-dropzone.dragover { border-color: var(--primary); background: var(--primary-weak); color: var(--primary); }
.doc-dropzone input[type=file] { display: none; }
.doc-dropzone__ico svg { width: 26px; height: 26px; }
.doc-fname { font-size: .82rem; }
.doc-upload__meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.doc-upload__meta select, .doc-upload__meta input { padding: 6px 10px; border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); font-family: var(--font); font-size: .85rem; background: var(--surface); }
.doc-upload__meta input[type=text] { flex: 1 1 220px; }
.doc-list { display: flex; flex-direction: column; gap: 6px; }
.doc-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.doc-row .doc-ico { color: var(--text-muted); flex: 0 0 auto; margin-top: 1px; }
.doc-row .doc-ico svg { width: 17px; height: 17px; }
.doc-main { flex: 1 1 auto; min-width: 0; }
.doc-name { font-weight: 600; color: var(--primary); word-break: break-word; }
.doc-meta { font-size: .8rem; margin-top: 2px; }
.doc-note { color: var(--text); font-style: italic; }
.doc-row .action-btn { flex: 0 0 auto; padding: 5px 8px; }

/* Письмо «Напугать» на странице дела */
.scare-letter { border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px 18px; margin-bottom: 18px; background: var(--surface); }
.scare-enrich { background: var(--primary-weak); border-left: 3px solid var(--primary);
    padding: 8px 12px; border-radius: var(--radius-sm); font-size: .9rem; }
.scare-draft { white-space: pre-wrap; word-break: break-word; font-family: var(--font);
    font-size: .9rem; line-height: 1.5; background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 14px 16px; max-height: 460px; overflow-y: auto; }

/* Слабые места позиции (контр-прецеденты + red-team) */
.risk-precedents { list-style: none; padding: 0; margin: 8px 0 0; display: flex;
    flex-direction: column; gap: 6px; }
.risk-precedents li { font-size: .88rem; line-height: 1.5; }
.redteam { margin-top: 14px; }
.redteam .spinner { display: none; margin-left: 10px; color: var(--text-muted); font-size: .85rem; }
.redteam .spinner.htmx-request { display: inline-block; }
.redteam-risk { border-left: 3px solid var(--border); padding: 8px 14px; margin: 8px 0;
    background: var(--surface-2); border-radius: var(--radius-sm); font-size: .9rem; }
.redteam-risk.high { border-left-color: var(--danger); }
.redteam-risk.medium { border-left-color: #d97706; }
.redteam-risk .sev { font-weight: 700; text-transform: uppercase; font-size: .7rem;
    letter-spacing: .04em; color: var(--text-muted); }
.redteam-risk.high .sev { color: var(--danger); }
.redteam-risk.medium .sev { color: #d97706; }
.redteam-risk .preempt { color: var(--text-muted); margin-top: 4px; }
.redteam-meta { font-size: .8rem; color: var(--text-muted); margin-top: 6px; }
