/* ============================================================
   SUMATIX design system — standalone stylesheet.
   Извлечено из colon-deploy/templates/base.html (инлайн <style>).
   Подключение в новом сервисе:
     <html data-theme="light|dark|auto">
       <link rel="stylesheet" href="/static/design-system.css">
   Тема управляется атрибутом data-theme на <html>. Все цвета — через
   CSS-переменные (:root светлая, [data-theme="dark"] тёмная,
   [data-theme="auto"] следует за prefers-color-scheme).

   Отличия от base.html (сознательные исправления при выносе):
   - .chart-tip background: var(--bg-card) → var(--surface) (переменной
     --bg-card в токенах нет);
   - dark-правило .tile.sev-warn .tile-count разбито корректно (в base.html
     селектор был склеен с @media и правило игнорировалось браузером).
   ============================================================ */

:root {
  --bg: #f8f9fa;
  --surface: #fff;
  --surface-alt: #fafbfc;
  --surface-hover: #f3f4f6;
  --border: #e5e7eb;
  --border-soft: #f1f3f5;
  --border-input: #d1d5db;
  --text: #222;
  --text-soft: #374151;
  --text-muted: #555;
  --text-faint: #888;
  --text-th: #666;
  --accent: #0aac6a;
  --accent-hover: #099a5e;
  --accent-soft: rgba(10, 172, 106, 0.12);
  --brand: #0aac6a;
  --brand-2: #00c48c;
  --brand-grad: linear-gradient(135deg, #0aac6a 0%, #00c48c 100%);
  --shadow-btn-hover: 0 4px 12px rgba(10, 172, 106, 0.25);
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --danger-border: #fecaca;
  --code-bg: #f3f4f6;
  --badge-bg: #e5e7eb;
  --badge-fg: #555;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --warn-text: #92400e;
  --ok: #10b981;
  --ok-soft: #d1fae5;
  --ok-text: #065f46;
}
[data-theme="dark"] {
  --bg: #0f1419;
  --surface: #1a1f26;
  --surface-alt: #232a33;
  --surface-hover: #2a313b;
  --border: #2a313b;
  --border-soft: #232a33;
  --border-input: #3a424d;
  --text: #e5e7eb;
  --text-soft: #d1d5db;
  --text-muted: #aab1bc;
  --text-faint: #8a929d;
  --text-th: #aab1bc;
  --accent: #2dd4a7;
  --accent-hover: #5ee0bd;
  --accent-soft: rgba(45, 212, 167, 0.15);
  --brand: #2dd4a7;
  --brand-2: #34d399;
  --brand-grad: linear-gradient(135deg, #0aac6a 0%, #00c48c 100%);
  --shadow-btn-hover: 0 4px 12px rgba(10, 172, 106, 0.35);
  --danger: #f87171;
  --danger-soft: #3a1f22;
  --danger-border: #5a2a2f;
  --code-bg: #232a33;
  --badge-bg: #2a313b;
  --badge-fg: #aab1bc;
  --warn: #fbbf24;
  --warn-soft: #422006;
  --warn-text: #fbbf24;
  --ok: #34d399;
  --ok-soft: #064e3b;
  --ok-text: #6ee7b7;
}
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    --bg: #0f1419;
    --surface: #1a1f26;
    --surface-alt: #232a33;
    --surface-hover: #2a313b;
    --border: #2a313b;
    --border-soft: #232a33;
    --border-input: #3a424d;
    --text: #e5e7eb;
    --text-soft: #d1d5db;
    --text-muted: #aab1bc;
    --text-faint: #8a929d;
    --text-th: #aab1bc;
    --accent: #2dd4a7;
    --accent-hover: #5ee0bd;
    --accent-soft: rgba(45, 212, 167, 0.15);
    --brand: #2dd4a7;
    --brand-2: #34d399;
    --brand-grad: linear-gradient(135deg, #0aac6a 0%, #00c48c 100%);
    --shadow-btn-hover: 0 4px 12px rgba(10, 172, 106, 0.35);
    --danger: #f87171;
    --danger-soft: #3a1f22;
    --danger-border: #5a2a2f;
    --code-bg: #232a33;
    --badge-bg: #2a313b;
    --badge-fg: #aab1bc;
    --warn: #fbbf24;
    --warn-soft: #422006;
    --warn-text: #fbbf24;
    --ok: #34d399;
    --ok-soft: #064e3b;
    --ok-text: #6ee7b7;
  }
}
* { box-sizing: border-box; }
body { font-family: -apple-system, system-ui, "Segoe UI", sans-serif; margin: 0; color: var(--text); background: var(--bg); }
.nav { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 20px; }
.nav .wrap { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 16px; height: 50px; }
.nav strong { margin-right: 12px; }
.nav .logo { margin-right: 12px; padding: 0; font-size: 16px; font-weight: 800; letter-spacing: 0.08em; text-decoration: none; display: inline-flex; align-items: baseline; }
.nav .logo:hover { background: transparent; }
.nav .logo .brand { color: var(--text); }
.nav .logo .tld { color: var(--brand); font-weight: 800; }
.nav a { color: var(--text-soft); text-decoration: none; font-size: 14px; font-weight: 500; padding: 6px 10px; border-radius: 4px; }
.nav a:hover { background: var(--surface-hover); }
.nav a.active { color: var(--accent); }
.container { max-width: 1100px; margin: 24px auto; padding: 0 20px; }
h1 { margin: 0 0 16px; font-size: 22px; }
h2 { margin: 24px 0 12px; font-size: 16px; font-weight: 600; color: var(--text-soft); }
.btn { display: inline-block; padding: 7px 14px; border: 1px solid transparent; background: var(--brand-grad); color: #fff; border-radius: 8px; cursor: pointer; font-size: 13px; text-decoration: none; font-family: inherit; transition: box-shadow .15s ease, background .15s ease; }
.btn:hover:not(:disabled) { box-shadow: var(--shadow-btn-hover); }
.btn.secondary { background: var(--surface); color: var(--text-soft); border-color: var(--border-input); }
.btn.secondary:hover:not(:disabled) { background: var(--surface-hover); }
.btn.danger { background: var(--surface); color: var(--danger); border-color: var(--danger-border); }
.btn.danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.card.flush { padding: 0; }
.muted { color: var(--text-faint); font-size: 13px; }
table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
table thead th { color: var(--text-th); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; background: var(--surface-alt); border-bottom: 1px solid var(--border); }
table tbody tr:hover { background: var(--surface-alt); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 11px; font-weight: 600; background: var(--badge-bg); color: var(--badge-fg); }
.badge.ok { background: #d1fae5; color: #065f46; }
.badge.off { background: var(--surface-hover); color: var(--text-faint); }
.badge.err { background: #fee2e2; color: #991b1b; }
.badge.run { background: #dbeafe; color: #1e40af; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.info { background: var(--surface-hover); color: var(--text-muted); }
input[type=text], input[type=time], input[type=search], input[type=number], select, textarea {
  padding: 7px 10px; border: 1px solid var(--border-input); border-radius: 6px; font-size: 14px; font-family: inherit; background: var(--surface); color: var(--text);
}
input[type=text]:focus, input[type=time]:focus, input[type=search]:focus, input[type=number]:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft);
}
textarea { font-family: ui-monospace, Consolas, monospace; font-size: 13px; resize: vertical; width: 100%; }
label { display: block; font-size: 13px; color: var(--text-muted); margin: 14px 0 4px; font-weight: 500; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
code { background: var(--code-bg); padding: 1px 5px; border-radius: 3px; font-size: 12px; color: var(--text); }
a { color: var(--accent); }

/* Problem tiles */
.tiles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.tile {
  display: block; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; text-decoration: none; color: var(--text); transition: border-color .12s, background .12s;
  position: relative;
  border-left-width: 3px;
}
.tile:hover:not(.tile.zero) { border-color: var(--accent); background: var(--surface-alt); }
.tile .tile-label { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; line-height: 1.3; }
.tile .tile-count { font-size: 22px; font-weight: 600; line-height: 1; }
.tile.sev-err { border-left-color: var(--danger); }
.tile.sev-err .tile-count { color: var(--danger); }
.tile.sev-warn { border-left-color: #d97706; }
.tile.sev-warn .tile-count { color: #92400e; }
[data-theme="dark"] .tile.sev-warn { border-left-color: #fbbf24; }
[data-theme="dark"] .tile.sev-warn .tile-count { color: #fbbf24; }
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] .tile.sev-warn { border-left-color: #fbbf24; }
  [data-theme="auto"] .tile.sev-warn .tile-count { color: #fbbf24; }
}
.tile.sev-info { border-left-color: var(--accent); }
.tile.sev-info .tile-count { color: var(--accent); }
.tile.sev-ok { border-left-color: #10b981; }
.tile.sev-ok .tile-count { color: #065f46; }
[data-theme="dark"] .tile.sev-ok .tile-count { color: #34d399; }
@media (prefers-color-scheme: dark) { [data-theme="auto"] .tile.sev-ok .tile-count { color: #34d399; } }
.tile.zero { opacity: 0.55; cursor: default; border-left-color: var(--border) !important; }
.tile.zero .tile-count { color: var(--text-faint); }

/* Tile row: count on the left, trend sparkline on the right */
.tile-row { display: flex; align-items: flex-end; gap: 8px; justify-content: space-between; }
.tile-trend { width: 56px; height: 18px; display: block; flex-shrink: 0; opacity: 0.7; }
.tile-trend .tline { fill: none; stroke: currentColor; stroke-width: 1.5; }
.tile-trend .tdot  { fill: currentColor; }
.tile.sev-err .tile-trend  { color: var(--danger); }
.tile.sev-warn .tile-trend { color: #d97706; }
.tile.sev-info .tile-trend { color: var(--accent); }
.tile.sev-ok .tile-trend   { color: #10b981; }
.tile.zero .tile-trend     { color: var(--text-faint); opacity: 0.4; }

/* Collapsible problem categories. <details> — summary acts as the heading. */
details.tile-section {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 12px; padding: 0;
}
details.tile-section > summary {
  list-style: none;
  cursor: pointer; padding: 14px 18px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 600; color: var(--text-soft);
  user-select: none;
}
details.tile-section > summary::-webkit-details-marker { display: none; }
details.tile-section > summary::before {
  content: '▸';
  display: inline-block;
  transition: transform 0.15s;
  color: var(--text-faint);
  font-size: 10px;
  width: 12px;
}
details.tile-section[open] > summary::before { transform: rotate(90deg); }
details.tile-section > summary .sect-label { flex: 1; }
details.tile-section > summary .sect-badge {
  background: var(--surface-hover); color: var(--text-faint);
  padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
details.tile-section > summary .sect-badge.has-issues {
  background: var(--danger-soft); color: var(--danger);
}
[data-theme="dark"] details.tile-section > summary .sect-badge.has-issues { background: #450a0a; color: #f87171; }
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] details.tile-section > summary .sect-badge.has-issues { background: #450a0a; color: #f87171; }
}
details.tile-section > .tiles-grid { padding: 0 18px 16px; }

.tile-empty {
  padding: 12px 18px 16px; font-size: 12px; color: var(--text-faint);
}

/* ---- Health card ---- */
.health-card { display: flex; gap: 20px; align-items: center; padding: 16px 20px; }
.health-score {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 110px; height: 110px; border-radius: 50%; flex-shrink: 0;
  font-weight: 600; line-height: 1;
}
.health-score .num { font-size: 36px; }
.health-score .of { font-size: 11px; opacity: 0.7; margin-top: 4px; }
.health-score.good { background: #d1fae5; color: #065f46; }
.health-score.attention { background: #fef3c7; color: #92400e; }
.health-score.critical { background: #fee2e2; color: #991b1b; }
.health-score.nodata { background: var(--surface-hover); color: var(--text-faint); }
.health-body { flex: 1; min-width: 0; }
.health-verdict { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.health-verdict.good { color: #065f46; }
.health-verdict.attention { color: #92400e; }
.health-verdict.critical { color: #991b1b; }
[data-theme="dark"] .health-score.good { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .health-score.attention { background: #422006; color: #fbbf24; }
[data-theme="dark"] .health-score.critical { background: #450a0a; color: #f87171; }
[data-theme="dark"] .health-verdict.good { color: #6ee7b7; }
[data-theme="dark"] .health-verdict.attention { color: #fbbf24; }
[data-theme="dark"] .health-verdict.critical { color: #f87171; }
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] .health-score.good { background: #064e3b; color: #6ee7b7; }
  [data-theme="auto"] .health-score.attention { background: #422006; color: #fbbf24; }
  [data-theme="auto"] .health-score.critical { background: #450a0a; color: #f87171; }
  [data-theme="auto"] .health-verdict.good { color: #6ee7b7; }
  [data-theme="auto"] .health-verdict.attention { color: #fbbf24; }
  [data-theme="auto"] .health-verdict.critical { color: #f87171; }
}
.health-issues { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.health-issue { display: flex; gap: 8px; align-items: baseline; }
.health-issue .count { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 60px; text-align: right; }
.health-issue.sev-crit .count { color: var(--danger); }
.health-issue.sev-warn .count { color: #92400e; }
[data-theme="dark"] .health-issue.sev-warn .count { color: #fbbf24; }
@media (prefers-color-scheme: dark) { [data-theme="auto"] .health-issue.sev-warn .count { color: #fbbf24; } }
.health-issue a { color: var(--text); text-decoration: none; }
.health-issue a:hover { color: var(--accent); }

/* ---- Report navigation ---- */
.report-nav {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.report-nav-back { flex-shrink: 0; }
.report-nav-links {
  display: flex; flex-wrap: wrap; gap: 4px 6px; flex: 1; min-width: 0;
}
.report-nav-link {
  display: inline-block; padding: 5px 11px; border-radius: 6px;
  font-size: 12px; font-weight: 500; text-decoration: none;
  color: var(--text-soft); transition: background 0.12s, color 0.12s;
}
.report-nav-link:hover { background: var(--surface-hover); color: var(--text); }
.report-nav-link.active {
  background: var(--accent-soft); color: var(--accent);
}
/* ---- Grouped tabs (напр. Синтез / Источники / Пересечения) ---- */
.report-nav.project-tabs { gap: 6px 10px; }
.report-nav-group {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px;
}
.report-nav-grouplabel {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-soft); opacity: 0.55;
  margin-right: 2px; user-select: none; white-space: nowrap;
}
.report-nav-divider {
  align-self: stretch; width: 1px; background: var(--border); margin: 0 4px;
}
@media (max-width: 720px) {
  .report-nav-divider { display: none; }
  .report-nav.project-tabs { gap: 8px 10px; }
}
/* ---- Source sub-navigation (табы внутри раздела) ---- */
.source-subnav {
  display: flex; flex-wrap: wrap; gap: 2px 4px;
  margin: -4px 0 16px; border-bottom: 1px solid var(--border);
}
.source-subnav-link {
  padding: 6px 12px; font-size: 12.5px; font-weight: 500; text-decoration: none;
  color: var(--text-soft); border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 0.12s, border-color 0.12s;
}
.source-subnav-link:hover { color: var(--text); }
.source-subnav-link.active { color: var(--accent); border-bottom-color: var(--accent); }
/* ---- Overview cards ---- */
.ov-sources {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px;
}
@media (max-width: 900px) { .ov-sources { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .ov-sources { grid-template-columns: 1fr; } }
.ov-src {
  display: block; padding: 14px 16px; text-decoration: none; color: inherit;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.ov-src:hover { border-color: var(--accent); box-shadow: 0 1px 6px rgba(0,0,0,0.06); }
.ov-src-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.03em; color: var(--text-soft);
}
.ov-src-go { color: var(--accent); font-weight: 400; }
.ov-src-num {
  font-size: 26px; font-weight: 700; line-height: 1.1; margin: 8px 0 4px;
  font-variant-numeric: tabular-nums;
}
.ov-src-unit { font-size: 12px; font-weight: 500; color: var(--text-soft); margin-left: 6px; }
.ov-src-sub { font-size: 12px; color: var(--text-soft); }
.ov-src-sub .sev-err { color: #dc2626; font-weight: 600; }
.ov-src-sub .ok { color: #059669; }
.ov-src-empty { font-size: 14px; color: var(--text-soft); margin: 10px 0 4px; }
/* ---- Активные срезы (чипы фильтров) ---- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
  background: var(--accent-soft); color: var(--accent);
  border-radius: 14px; padding: 3px 6px 3px 10px; font-weight: 500;
}
.chip b { font-weight: 600; }
.chip .x {
  cursor: pointer; width: 16px; height: 16px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.06); font-size: 11px;
}
.chip .x:hover { background: rgba(0,0,0,0.14); }
/* ---- Дерево подпапок ---- */
.ftree, .ftree ul { list-style: none; margin: 0; padding: 0; }
.ftree ul { margin-left: 16px; border-left: 1px solid var(--border); padding-left: 8px; }
.ftree li { padding: 2px 0; }
.ftree-row {
  display: flex; align-items: center; gap: 8px; padding: 2px 6px; border-radius: 5px;
}
.ftree-row:hover { background: var(--surface-hover); }
.ftree-name { font-size: 13px; font-family: ui-monospace, monospace; color: var(--text); text-decoration: none; }
.ftree-name:hover { color: var(--accent); }
.ftree-name.leaf { color: var(--text-soft); }
.ftree-cnt {
  font-size: 11px; font-weight: 600; color: var(--text-soft);
  background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: 9px; padding: 0 7px; font-variant-numeric: tabular-nums;
}
.ftree-bar { height: 4px; border-radius: 2px; background: var(--accent-soft); min-width: 20px; }
.ftree-pct { font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; min-width: 42px; }
/* мини-метрики */
.sm-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.sm-metric { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.sm-metric .v { font-size: 22px; font-weight: 700; line-height: 1; }
.sm-metric .l { font-size: 11px; color: var(--text-soft); margin-top: 4px; }
/* свёрнутые подробные блоки */
.ov-more { margin-bottom: 16px; }
.ov-more > summary {
  cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text-soft);
  padding: 8px 0; list-style: none; user-select: none;
}
.ov-more > summary::before { content: "▸ "; color: var(--text-soft); }
.ov-more[open] > summary::before { content: "▾ "; }
.ov-more > summary:hover { color: var(--text); }

/* ---- Charts ---- */
.chart-block { margin-bottom: 18px; }
.chart-block:last-child { margin-bottom: 0; }
.chart-title { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.4px; }

/* HTTP distribution: одна горизонтальная полоса с пропорциональными сегментами */
.dist-bar {
  display: flex; height: 28px; border-radius: 6px; overflow: hidden;
  background: var(--surface-hover);
}
.dist-seg {
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 600; min-width: 0;
  white-space: nowrap; overflow: hidden;
}
.dist-legend {
  display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 10px;
  font-size: 12px; color: var(--text-muted);
}
.dist-legend-item { display: flex; align-items: center; gap: 6px; }
.dist-swatch { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.dist-count { color: var(--text); font-weight: 600; }

/* Vertical bar chart (SVG, 600x140 viewBox) */
.svg-bars { width: 100%; height: 140px; display: block; }
.svg-bars .bar-rect { transition: opacity 0.12s; }
.svg-bars .bar-rect:hover { opacity: 0.75; }
.svg-bars .bar-value { font-size: 10px; font-weight: 600; fill: var(--text-muted); text-anchor: middle; }
.svg-bars .bar-label { font-size: 10px; fill: var(--text-faint); text-anchor: middle; }
.svg-bars .baseline  { stroke: var(--border-soft); stroke-width: 1; }

/* Line chart (SVG) */
.line-chart { width: 100%; height: 140px; }
.line-chart .grid { stroke: var(--border-soft); stroke-width: 1; }
.line-chart .line { fill: none; stroke: var(--accent); stroke-width: 2; }
.line-chart .area { fill: var(--accent); opacity: 0.1; }
.line-chart .dot { fill: var(--accent); }
.line-chart .axis-label { fill: var(--text-faint); font-size: 10px; }

/* Категориальная палитра для стек-графиков (бренд-зелёный первым) */
:root {
  --c0: #0aac6a; --c1: #2563eb; --c2: #f59e0b; --c3: #db2777;
  --c4: #7c3aed; --c5: #0891b2; --c6: #94a3b8;
}
.line-chart .sline { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.sline.a0 { stroke: var(--c0); } .sline.a1 { stroke: var(--c1); }
.sline.a2 { stroke: var(--c2); } .sline.a3 { stroke: var(--c3); }
.sline.a4 { stroke: var(--c4); } .sline.a5 { stroke: var(--c5); }
.sline.a6 { stroke: var(--c6); }
.slice-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; }
.slice-legend .lg { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex: none; }
.sw.a0 { background: var(--c0); } .sw.a1 { background: var(--c1); }
.sw.a2 { background: var(--c2); } .sw.a3 { background: var(--c3); }
.sw.a4 { background: var(--c4); } .sw.a5 { background: var(--c5); }
.sw.a6 { background: var(--c6); }

/* Hover-тултип для стек-графиков */
.chart-hover { position: relative; }
.chart-hover .line-chart { display: block; height: 200px; }
.chart-guide { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--text-faint);
  opacity: 0.45; pointer-events: none; display: none; }
.chart-tip { position: absolute; z-index: 6; display: none; pointer-events: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 11px; line-height: 1.45; box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  min-width: 150px; max-width: 240px; }
.chart-tip .tip-date { font-weight: 600; margin-bottom: 5px; padding-bottom: 4px;
  border-bottom: 1px solid var(--border-soft); color: var(--text); }
.chart-tip .r { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.chart-tip .r + .r { margin-top: 2px; }
.chart-tip .r .nm { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
.chart-tip .r .vl { margin-left: auto; font-weight: 600; color: var(--text); padding-left: 12px;
  font-variant-numeric: tabular-nums; }
.chart-tip .r.total { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--border-soft); }
.chart-tip .r.total .nm { color: var(--text); font-weight: 600; }

/* Секции проблем (цветная левая граница по серьёзности) */
.audit-group { margin-top: 22px; }
.audit-group-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; }
.audit-group-head h2 { margin: 0; font-size: 17px; }
.audit-group-counts { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.audit-issue-head h3 { margin: 0; font-size: 15px; }
.audit-issue { border-left: 4px solid var(--border); }
.audit-issue.err { border-left-color: var(--danger); }
.audit-issue.warn { border-left-color: var(--warn); }
.audit-issue.info { border-left-color: var(--text-faint); }
.audit-issue-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.audit-issue-head h2 { margin: 0; font-size: 16px; }
.audit-issue-head .audit-count { margin-left: auto; font-size: 12px; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.audit-problem { margin: 0 0 8px; line-height: 1.55; }
.audit-fix { margin: 0 0 8px; line-height: 1.55; color: var(--text); }
.audit-examples { font-size: 13px; }
.audit-examples-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.audit-examples ul { margin: 4px 0 0; padding-left: 18px; }
.audit-examples li { margin: 2px 0; word-break: break-all; }
.audit-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.share-panel { display: flex; flex-direction: column; gap: 10px; }
.share-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.share-row > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.share-row form { margin-left: auto; }
.share-link-row { display: flex; gap: 8px; align-items: center; }
.share-url { flex: 1; min-width: 0; font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Печать / сохранение в PDF */
@media print {
  .nav, .report-nav, .source-subnav, .no-print, .filterbar { display: none !important; }
  body { background: #fff; }
  .container { margin: 0 auto; padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #d4d4d4; break-inside: avoid; page-break-inside: avoid; }
  .audit-issue { break-inside: avoid; page-break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
  h1, h2 { page-break-after: avoid; }
}

/* Charts grid */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---- Mobile / narrow screens ---- */
@media (max-width: 640px) {
  .container { padding: 0 12px; margin: 16px auto; }
  h1 { font-size: 18px; }
  h2 { font-size: 14px; margin: 18px 0 10px; }
  .card { padding: 14px; overflow-x: auto; }
  table td, table th { padding: 7px 8px; font-size: 12px; }
  .mobile-hide { display: none !important; }
  .row > input[type=text],
  .row > input[type=search],
  .row > input[type=number],
  .row > select,
  .row > textarea {
    width: 100% !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }
  .row .spacer { display: none; }
  .nav .wrap { gap: 6px; height: auto; padding: 8px 0; flex-wrap: wrap; }
  .nav a { padding: 4px 8px; font-size: 13px; }
  .nav strong { font-size: 13px; }
  .health-card { flex-direction: column; align-items: stretch; gap: 14px; }
  .health-score { width: 90px; height: 90px; align-self: center; }
  .health-score .num { font-size: 30px; }
  .charts-grid { grid-template-columns: 1fr; }
  .bars { height: 110px; }
}

/* ============================================================
   Reports layer — шапка отчёта, панель фильтров (segment control),
   таблица данных, пагинация, health-hero, сводка серьёзности,
   карточки-ссылки, разбивка диска.
   ============================================================ */
.rpt-head { margin-bottom: 14px; }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-faint); margin-bottom: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--text-faint); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { opacity: .5; }
.rpt-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rpt-title-row h1 { margin: 0; font-size: 20px; }
.rpt-kpi { font-size: 13px; color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 3px 12px; font-weight: 500; }
.rpt-kpi strong { color: var(--text); }
.asof { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-faint); }

/* Липкая панель фильтров: segment control + поиск + экспорт */
.filterbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 8px; padding: 2px; gap: 2px; flex-wrap: wrap; }
.seg a, .seg button { border: 0; background: transparent; color: var(--text-soft); font: inherit; font-size: 12px; font-weight: 600;
  padding: 5px 11px; border-radius: 6px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.seg a:hover, .seg button:hover { color: var(--text); }
.seg .cnt { font-size: 11px; font-weight: 600; background: var(--badge-bg); color: var(--badge-fg); padding: 0 6px; border-radius: 8px; }
.seg .cnt.c-err { background: var(--danger-soft); color: var(--danger); }
.seg .cnt.c-warn { background: var(--warn-soft); color: var(--warn-text); }
.seg a.on, .seg button.on { background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.08); color: var(--text); }
.seg a.on.sev-err, .seg button.on.sev-err { color: var(--danger); }
.seg a.on.sev-warn, .seg button.on.sev-warn { color: var(--warn-text); }

/* Применённые фильтры — чипами */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* Таблица данных: липкая шапка, цветная полоска серьёзности, URL в одну строку */
.dtable-wrap { max-height: 68vh; overflow: auto; }
.dtable thead th { position: sticky; top: 0; z-index: 1; }
.dtable td .u { display: inline-block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.dtable .sev-cell { border-left: 3px solid transparent; }
.dtable tr.sev-err .sev-cell { border-left-color: var(--danger); }
.dtable tr.sev-warn .sev-cell { border-left-color: var(--warn); }
.dtable .num { text-align: right; font-variant-numeric: tabular-nums; }
.ext { color: var(--text-faint); text-decoration: none; margin-left: 4px; }

/* Пагинация */
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding: 12px; flex-wrap: wrap; }
.pager .grow { flex: 1; }
.pager .pg { display: inline-flex; gap: 4px; }
.pager .pg a, .pager .pg span { min-width: 30px; text-align: center; padding: 4px 8px; border-radius: 6px; font-size: 12px; text-decoration: none; color: var(--text-soft); border: 1px solid var(--border); }
.pager .pg a:hover { background: var(--surface-hover); }
.pager .pg a.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.pager .pg span.gap { border: 0; }

/* Health-hero */
.hero { display: flex; gap: 20px; align-items: center; padding: 18px 22px; }
.score { width: 104px; height: 104px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 600; flex-shrink: 0; line-height: 1; }
.score .n { font-size: 38px; } .score .o { font-size: 11px; opacity: .7; margin-top: 3px; }
.score.good { background: var(--ok-soft); color: var(--ok-text); }
.score.attention { background: var(--warn-soft); color: var(--warn-text); }
.score.critical { background: var(--danger-soft); color: var(--danger); }
.score.nodata { background: var(--surface-hover); color: var(--text-faint); }
.hero-body { flex: 1; min-width: 0; }
.hero-verdict { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.hero-verdict.good { color: var(--ok-text); } .hero-verdict.attention { color: var(--warn-text); } .hero-verdict.critical { color: var(--danger); }
.hero-line { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
.hero-cta { display: flex; gap: 8px; flex-wrap: wrap; }

/* Сводка по серьёзности */
.sev-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.sev-box { background: var(--surface); border: 1px solid var(--border); border-left-width: 4px; border-radius: 8px; padding: 14px 16px; text-decoration: none; color: var(--text); display: block; }
.sev-box:hover { background: var(--surface-alt); }
.sev-box.err { border-left-color: var(--danger); } .sev-box.warn { border-left-color: var(--warn); } .sev-box.ok { border-left-color: var(--ok); }
.sev-box .big { font-size: 30px; font-weight: 700; line-height: 1; }
.sev-box.err .big { color: var(--danger); } .sev-box.warn .big { color: var(--warn-text); } .sev-box.ok .big { color: var(--ok-text); }
.sev-box .lbl { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.sev-box .top { font-size: 12px; color: var(--text-faint); margin-top: 8px; line-height: 1.5; }

/* Карточки-ссылки */
.report-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.rcard { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; text-decoration: none; color: var(--text); transition: border-color .12s; }
.rcard:hover { border-color: var(--accent); }
.rcard .t { font-size: 14px; font-weight: 600; margin-bottom: 3px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rcard .d { font-size: 12px; color: var(--text-faint); line-height: 1.45; }
.rcard .n { font-size: 12px; font-weight: 700; }
.rcard .n.err { color: var(--danger); } .rcard .n.warn { color: var(--warn-text); } .rcard .n.ok { color: var(--ok-text); }

/* Разбивка диска: стек-бар + легенда */
.storage-bar { display: flex; height: 34px; border-radius: 8px; overflow: hidden; background: var(--surface-hover); margin-bottom: 12px; }
.storage-bar .seg2 { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 600; white-space: nowrap; min-width: 0; overflow: hidden; }
.s-crawl { background: #2563eb; } .s-feed { background: #0891b2; } .s-wm { background: #ea580c; } .s-other { background: #7c3aed; } .s-index { background: #94a3b8; } .s-free { background: #cbd5e1; color: #475569 !important; }
.slegend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12px; color: var(--text-muted); }
.slegend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-right: 6px; vertical-align: middle; }
.mini-bar { height: 8px; border-radius: 4px; background: var(--surface-hover); overflow: hidden; display: flex; min-width: 120px; }

@media (max-width: 640px) {
  .sev-summary { grid-template-columns: 1fr; }
  .hero { flex-direction: column; align-items: stretch; }
  .score { align-self: center; }
  .dtable td .u { max-width: 200px; }
  .filterbar { position: static; }
}
