:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-2: #374151;
  --text-dim: #6b7280;
  --text-muted: #9ca3af;
  --accent: #2563eb;
  --navy: #0f172a;
  --red: #ef4444;
  --red-bg: #fef2f2;
  --red-soft: #fee2e2;
  --orange: #f59e0b;
  --orange-bg: #fffbeb;
  --orange-soft: #fed7aa;
  --green: #10b981;
  --green-bg: #ecfdf5;
  --green-soft: #d1fae5;
  --blue-bg: #eff6ff;
  --purple: #8b5cf6;
  --purple-bg: #f5f3ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif; font-size: 14px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 32px 24px 48px; }

.header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.header h1 { margin: 0; font-size: 22px; font-weight: 700; }
.header h1 .em { color: var(--text-muted); font-weight: 400; }
.header .meta { font-size: 13px; color: var(--text-dim); }
.header .meta b { color: var(--text-2); }

.banner { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.banner.warn { background: var(--orange-bg); border: 1px solid #fcd34d; color: #92400e; }
.banner.crit { background: var(--red-bg); border: 1px solid #fecaca; color: #991b1b; }
.banner code { background: rgba(0,0,0,0.08); padding: 1px 5px; border-radius: 3px; font-size: 12px; }

.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 28px; }
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.kpi .label { font-size: 11px; font-weight: 600; color: var(--text-dim); letter-spacing: 0.04em; text-transform: uppercase; }
.kpi .num { font-size: 26px; font-weight: 700; margin: 6px 0 4px; }
.kpi .num.red { color: var(--red); }
.kpi .num.orange { color: var(--orange); }
.kpi .num.green { color: var(--green); }
.kpi .num.purple { color: var(--purple); }
.kpi .bar { height: 3px; border-radius: 2px; margin: 6px 0 8px; }
.kpi .bar.gray { background: var(--navy); }
.kpi .bar.red { background: var(--red); }
.kpi .bar.orange { background: var(--orange); }
.kpi .bar.green { background: var(--green); }
.kpi .bar.purple { background: var(--purple); }
.kpi .sub { font-size: 12px; color: var(--text-dim); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 0 12px; }
.section-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.section-head .right { font-size: 13px; color: var(--text-dim); }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.card-pad { padding: 16px 18px; }

.recap-grid { display: grid; grid-template-columns: 1.4fr 1fr 1.4fr; gap: 16px; padding: 18px; }
@media (max-width: 1000px) { .recap-grid { grid-template-columns: 1fr; } }
.recap-block h3 { margin: 0 0 10px 0; font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }

.type-stack { display: flex; flex-direction: column; gap: 8px; }
.type-stack .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; }
.type-stack .row .label { color: var(--text); }
.type-stack .row .pct { color: var(--text-dim); font-size: 11px; }
.type-stack .row .count { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 36px; text-align: right; }
.type-stack .row .bar-wrap { flex: 1; height: 6px; background: #f3f4f6; border-radius: 3px; overflow: hidden; }
.type-stack .row .bar-wrap span { display: block; height: 100%; }
.type-stack .row.problem .bar-wrap span { background: var(--red); }
.type-stack .row.idea .bar-wrap span { background: var(--purple); }
.type-stack .row.proposal .bar-wrap span { background: var(--accent); }
.type-stack .row.other .bar-wrap span { background: var(--text-muted); }

.changes { display: flex; flex-direction: column; gap: 10px; }
.change { padding: 10px 12px; border-radius: 6px; font-size: 13px; line-height: 1.4; }
.change.up { background: var(--red-bg); color: #991b1b; }
.change.down { background: var(--green-bg); color: #047857; }
.change.flat { background: #f9fafb; color: var(--text-2); }
.change.crit { background: #fef2f2; color: #991b1b; border-left: 3px solid var(--red); }

.heatmap { display: grid; gap: 2px; font-size: 11px; }
.heatmap .hcell { padding: 6px 4px; border-radius: 3px; text-align: center; font-variant-numeric: tabular-nums; }
.heatmap .hcorner { padding: 6px 4px; color: var(--text-dim); font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; text-align: center; }
.heatmap .hlabel { padding: 6px 8px; color: var(--text-2); font-weight: 500; text-align: left; align-self: center; }
.heatmap .hcell.l0 { background: #f9fafb; color: var(--text-muted); }
.heatmap .hcell.l1 { background: #dbeafe; color: #1e40af; }
.heatmap .hcell.l2 { background: #93c5fd; color: #1e40af; }
.heatmap .hcell.l3 { background: #3b82f6; color: white; }
.heatmap .hcell.l4 { background: #1d4ed8; color: white; }

.dir-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
@media (max-width: 1100px) { .dir-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .dir-grid { grid-template-columns: repeat(2, 1fr); } }
.dir-tile { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; min-height: 175px; display: flex; flex-direction: column; }
.dir-tile .top { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 10px; }
.dir-tile .icon { width: 24px; height: 24px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.dir-tile .icon.it { background: var(--blue-bg); color: #1e40af; }
.dir-tile .icon.infra { background: #ecfeff; color: #155e75; }
.dir-tile .icon.offline { background: var(--orange-bg); color: #92400e; }
.dir-tile .icon.hr { background: var(--purple-bg); color: #6b21a8; }
.dir-tile .icon.dev { background: var(--green-bg); color: #047857; }
.dir-tile .name { font-weight: 600; font-size: 14px; flex: 1; min-width: 0; }
.dir-tile .trend { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.dir-tile .trend.up { color: var(--red); }
.dir-tile .trend.down { color: var(--green); }
.dir-tile .num { font-size: 26px; font-weight: 700; line-height: 1; margin: 4px 0 2px; }
.dir-tile .num-sub { font-size: 11px; color: var(--text-dim); margin-bottom: 10px; }
.dir-tile .stat-row { display: flex; gap: 12px; padding: 6px 0; font-size: 11px; color: var(--text-dim); border-top: 1px solid var(--border); }
.dir-tile .stat-row .stat { flex: 1; }
.dir-tile .stat-row .stat b { display: block; font-size: 14px; font-weight: 600; color: var(--text); margin-top: 2px; }
.dir-tile .stat-row .stat b.red { color: var(--red); }
.dir-tile .stat-row .stat b.orange { color: var(--orange); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
table thead th { text-align: left; font-weight: 500; color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; padding: 12px 16px; border-bottom: 1px solid var(--border); }
table tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
table tbody tr:last-child td { border-bottom: none; }
table td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
td.num.red { color: var(--red); }
td.num.orange { color: var(--orange); }
td.num.green { color: var(--green); }
td.muted { color: var(--text-dim); }

.pill { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: 11px; font-weight: 500; line-height: 1.4; }
.pill.red { background: var(--red-bg); color: #991b1b; }
.pill.orange { background: var(--orange-bg); color: #92400e; }
.pill.green { background: var(--green-bg); color: #047857; }
.pill.blue { background: var(--blue-bg); color: #1e40af; }
.pill.gray { background: #f3f4f6; color: #4b5563; }
.pill.purple { background: var(--purple-bg); color: #6b21a8; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot.green { background: var(--green); }
.dot.orange { background: var(--orange); }
.dot.red { background: var(--red); }
.dot.gray { background: var(--text-muted); }
.dot.blue { background: var(--accent); }

.stream-row { padding: 12px 16px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 80px 130px 1fr 100px; gap: 14px; align-items: center; }
@media (max-width: 800px) { .stream-row { grid-template-columns: 1fr; gap: 4px; } }
.stream-row:last-child { border-bottom: none; }
.stream-time { color: var(--text-dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.stream-chat { font-size: 12px; color: var(--text-2); }
.stream-summary { color: var(--text); font-size: 13px; }
.stream-meta { color: var(--text-dim); font-size: 11px; margin-top: 2px; }
.stream-meta a { color: var(--accent); }

/* Сигнал-карточка для типизированных секций (Проблемы / Идеи / ...) */
.signal-row {
  display: grid;
  grid-template-columns: 110px 1fr 32px;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.signal-row:last-child { border-bottom: none; }
.signal-row:hover { background: #fafafa; }
@media (max-width: 800px) { .signal-row { grid-template-columns: 1fr; gap: 4px; } }
.signal-time {
  color: var(--text-dim);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.signal-chat {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.signal-body { min-width: 0; }
.signal-summary {
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
}
.signal-meta {
  color: var(--text-dim);
  font-size: 11px;
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.signal-meta .pill { margin-right: 2px; }
.signal-author { color: var(--text-2); }
.signal-author b { font-weight: 600; color: var(--text); }
.signal-noreply { color: var(--orange); font-weight: 500; }
.signal-reply { color: var(--green); }
.signal-link { text-align: right; }
.signal-link a {
  display: inline-block;
  width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  border-radius: 6px;
  color: var(--accent);
  font-size: 16px;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--card);
}
.signal-link a:hover {
  background: var(--blue-bg);
  text-decoration: none;
}

.empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 24px;
  font-style: italic;
}

/* Свернуть/развернуть для секции "Иное" */
details > summary { padding: 0; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary h2 span { color: var(--accent) !important; }

.footer-note { margin-top: 32px; font-size: 12px; color: var(--text-muted); }
.footer-note code { background: #f3f4f6; padding: 1px 5px; border-radius: 3px; font-size: 11px; }
