:root {
  --bg: #0b1020;
  --card: #121a33;
  --text: #e8ecff;
  --muted: #9aa6d1;
  --accent: #5b8cff;
  --border: #243056;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(1200px 600px at 10% -10%, #1a2b6b 0%, transparent 60%),
              radial-gradient(900px 500px at 90% 0%, #123a2f 0%, transparent 55%),
              var(--bg);
  color: var(--text);
  line-height: 1.5;
}
.wrap { max-width: 1200px; margin: 0 auto; padding: 28px 20px 60px; }
.hero {
  background: linear-gradient(135deg, #1a2f7a, #123a2f);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  margin-bottom: 20px;
}
h1 { margin: 0 0 8px; font-size: 1.9rem; }
.meta { color: #d5ddff; opacity: .9; }
.nav-sites {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.nav-sites a {
  color: var(--muted);
  text-decoration: none;
  font-size: .9rem;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
}
.nav-sites a:hover { color: var(--text); border-color: var(--border); }
.nav-sites a.active {
  color: var(--text);
  background: #0f1730;
  border-color: var(--border);
}
.nav-main {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.nav-main a, .nav-main button, .tab-btn {
  border: 1px solid var(--border);
  background: #0f1730;
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  font-size: .95rem;
}
.nav-main a.active,
.nav-main button.active,
.tab-btn.active {
  background: var(--accent);
  border-color: var(--accent);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 16px 0;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}
.card h3 { margin: 0 0 6px; font-size: .95rem; color: var(--muted); font-weight: 600; }
.card .value { font-size: 1.6rem; font-weight: 700; }
.section { margin-top: 20px; }
.section h2 { margin: 0 0 12px; font-size: 1.2rem; }
.channel-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
#channel-tabs-wrap { margin-bottom: 12px; }
.channel-tabs-more { margin-top: 10px; }

.channel-links-search {
  width: 100%;
  max-width: 360px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .9rem;
  margin-bottom: 10px;
  background: #0f1730;
  color: var(--text);
}
.channel-links-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding: 2px;
}
.channel-link-chip {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #121a33;
  font-size: .82rem;
  text-decoration: none;
  color: var(--accent);
  line-height: 1.3;
}
.channel-link-chip:hover { border-color: #bfd3ff; background: #182040; }
.channel-link-chip-muted { color: var(--muted); cursor: default; }

.collapse-more {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px 14px 10px;
  background: #0f1730;
}
.collapse-more summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  padding: 10px 4px;
  list-style: none;
  user-select: none;
}
.collapse-more summary::-webkit-details-marker { display: none; }
.collapse-more[open] summary { margin-bottom: 4px; }
.posts-period-section.card { padding: 12px 14px; }
.posts-period-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.posts-period-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.posts-period-total {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1;
  margin: 0;
  letter-spacing: -0.02em;
}
.channel-posts-header,
.channel-posts-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 4.5rem 9.5rem;
  gap: 8px 10px;
  align-items: center;
}
.channel-posts-header {
  padding: 0 0 4px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.channel-posts-header span:nth-child(2),
.channel-posts-header span:nth-child(3) { text-align: right; }
.channel-posts-list {
  display: flex;
  flex-direction: column;
}
.channel-posts-row {
  padding: 4px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  font-size: .86rem;
}
.channel-posts-row:last-child { border-bottom: none; }
.channel-posts-name {
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.channel-posts-warn { margin-left: 3px; font-size: .8rem; }
.channel-posts-count {
  font-size: .86rem;
  font-weight: 700;
  text-align: right;
}
.channel-posts-subs {
  color: var(--muted);
  font-size: .78rem;
  text-align: right;
  white-space: nowrap;
}
.channel-posts-more {
  margin-top: 4px;
  padding: 2px 10px 4px;
  font-size: .88rem;
}
.channel-posts-more summary { padding: 6px 2px; }
@media (max-width: 640px) {
  .channel-posts-header { display: none; }
  .channel-posts-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "name count"
      "name subs";
    gap: 0 10px;
    padding: 6px 0;
  }
  .channel-posts-name { grid-area: name; white-space: normal; }
  .channel-posts-count { grid-area: count; }
  .channel-posts-subs { grid-area: subs; text-align: right; }
  .posts-period-total { font-size: 1.25rem; }
}
.chart-toolbar {
  margin-bottom: 12px;
  position: relative;
  z-index: 10;
  isolation: isolate;
  overflow: visible;
}
.chart-filter-wrap {
  position: relative;
  z-index: 10;
  overflow: visible;
}
.chart-filter-wrap > .channel-filter:first-of-type {
  max-height: 168px;
  overflow-y: auto;
}
.filter-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.btn-filter {
  border: 1px solid var(--border);
  background: #0f1730;
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: .85rem;
}
.btn-filter:hover { border-color: var(--accent); color: #fff; }
.channel-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .85rem;
  cursor: pointer;
  background: #0a1228;
}
.filter-chip:has(input:checked) {
  border-color: var(--accent);
  background: #1a2f5a;
}
.filter-chip input { accent-color: var(--accent); cursor: pointer; }
.filter-chip-meta { color: var(--muted); font-size: .78rem; margin-left: 2px; }
.filter-more {
  margin-top: 8px;
  position: relative;
  z-index: 10;
}
.filter-more[open] { margin-bottom: 16px; }
.filter-more .channel-filter {
  margin-top: 8px;
  max-height: min(50vh, 480px);
  overflow-y: auto;
  overflow-x: hidden;
}
.chart-toolbar:has(.filter-more[open]) + .chart-box {
  margin-top: 12px;
}
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td {
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}
th { color: var(--muted); font-weight: 600; }
a { color: #9ec1ff; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .75rem;
  background: #1f3b2a;
  color: #86efac;
}
.chart-box {
  height: 300px;
  position: relative;
  z-index: 0;
  clear: both;
  margin-top: 8px;
}
.section.card:has(#postsChart) {
  overflow: visible;
}
.btn-dl {
  display: inline-block;
  padding: 6px 12px;
  background: #1e3a8a;
  border-radius: 8px;
  color: #fff;
  text-decoration: none;
  font-size: .85rem;
  margin: 2px 4px 2px 0;
}
.btn-dl:hover { background: #2563eb; }
select {
  background: #0f1730;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 1rem;
  min-width: 280px;
}
.analysis-content { font-size: .95rem; }
.analysis-lead { font-size: 1.05rem; margin: 0 0 16px; line-height: 1.6; }
.analysis-sub { margin: 18px 0 8px; font-size: 1rem; color: var(--accent); }
.insight-list { margin: 0 0 8px; padding-left: 20px; }
.insight-list li { margin-bottom: 8px; }
.rec-list li { color: #c7d7ff; }

.moscow-share { margin: 0 0 12px; }
.moscow-share-value {
  font-size: 2rem;
  font-weight: 700;
  color: #86efac;
  margin-right: 8px;
}
.tone-bars { margin: 12px 0 16px; }
.tone-bar-row {
  display: grid;
  grid-template-columns: 88px 1fr 48px;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  font-size: .88rem;
}
.tone-bar-label { color: var(--muted); }
.tone-bar-track {
  height: 10px;
  background: #0a1228;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.tone-bar-fill { height: 100%; border-radius: 999px; }
.tone-bar-fill.tone-pos { background: linear-gradient(90deg, #166534, #22c55e); }
.tone-bar-fill.tone-neg { background: linear-gradient(90deg, #7f1d1d, #ef4444); }
.tone-bar-fill.tone-neu { background: linear-gradient(90deg, #1e3a5f, #64748b); }
.tone-bar-pct { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.theme-sentiment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 8px;
}
.theme-sentiment-card {
  background: #0a1228;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}
.theme-sentiment-title { margin: 0 0 4px; font-size: 1rem; color: var(--accent); }
.theme-sentiment-meta { margin: 0 0 10px; font-size: .85rem; color: var(--muted); }
.theme-sentiment-insight { margin: 10px 0 0; font-size: .9rem; line-height: 1.5; }
.theme-sentiment-empty { color: var(--muted); margin: 0; }

.analytics-intro { color: var(--muted); margin: 0 0 14px; font-size: .92rem; }
.load-status { color: var(--muted); margin: 0 0 12px; }
.load-error { color: #f87171; margin: 0 0 12px; }
.table-scroll { overflow-x: auto; margin-bottom: 4px; }
.analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  margin-bottom: 0;
}
.analytics-table th,
.analytics-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.analytics-table thead th {
  background: #0f1730;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
.analytics-table tbody tr:nth-child(even) { background: rgba(15, 23, 48, 0.5); }
.analytics-table-overview { font-size: .85rem; }
.analytics-total-row td { background: #121a33; font-weight: 600; }
.analytics-note {
  margin: 6px 0 18px;
  padding: 10px 12px;
  font-size: .88rem;
  line-height: 1.5;
  color: #c7d7ff;
  background: rgba(91, 140, 255, 0.08);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
}
.analytics-insights-list {
  margin: 8px 0 16px;
  padding-left: 20px;
  font-size: .9rem;
}
.analytics-insights-list li { margin-bottom: 8px; }
.cell-muted { color: var(--muted); font-size: .8rem; }
.analytics-scope-badge {
  margin: 0 0 14px;
  padding: 10px 12px;
  font-size: .9rem;
  line-height: 1.45;
  background: rgba(91, 140, 255, 0.12);
  border: 1px solid rgba(91, 140, 255, 0.35);
  border-radius: 10px;
}
.moscow-conclusions { margin-bottom: 8px; }
.moscow-conclusion-p { margin: 0 0 10px; line-height: 1.55; font-size: .95rem; }
.analytics-lead { font-size: 1rem; line-height: 1.55; margin: 0 0 4px; }
.analytics-data-more { margin-top: 10px; }
.analytics-data-body { margin-top: 14px; }
.analytics-data-body .analysis-sub:first-child { margin-top: 0; }
.channel-analytics-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0a1228;
  overflow: hidden;
}
.channel-analytics-item[open] { border-color: #3b5bcc; }
.channel-analytics-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.channel-analytics-summary::-webkit-details-marker { display: none; }
.channel-analytics-name { font-weight: 600; color: var(--text); }
.channel-analytics-handle { color: var(--muted); font-weight: 500; font-size: .88rem; }
.channel-analytics-badges {
  font-size: .82rem;
  color: #9ec1ff;
  font-variant-numeric: tabular-nums;
}
.channel-analytics-body {
  padding: 0 14px 14px;
  border-top: 1px solid var(--border);
}
.channel-analytics-body .moscow-share-value { font-size: 1.5rem; }
.channel-analytics-body .analysis-sub { font-size: .92rem; margin-top: 14px; }
.channel-analytics-link { margin: 14px 0 0; font-size: .9rem; }
@media (max-width: 640px) {
  .channel-analytics-summary { flex-direction: column; align-items: flex-start; }
}

/* —— Вкладка «Отчёт о размещении» —— */
.placement-badge {
  margin: 0 0 16px;
  font-size: .85rem;
  color: #fde68a;
  background: rgba(0,0,0,.2);
  display: inline-block;
  padding: 6px 12px;
  border-radius: 8px;
}
.placement-lead { margin: 0 0 12px; }
.placement-note { color: var(--muted); font-size: .9rem; margin: 0 0 14px; }
.placement-section h2 { font-size: 1.15rem; margin-bottom: 12px; }
.placement-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.placement-table th,
.placement-table td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}
.placement-table thead th { background: #0f1730; color: var(--muted); font-weight: 600; width: auto; }
.placement-table tbody th { background: #0f1730; color: var(--muted); font-weight: 600; width: 22%; }
.placement-total-row td { background: #0f1a35; }
.materials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 8px;
}
.material-card {
  margin: 0;
  background: #0f1730;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.material-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  background: #1a2548;
}
.material-card figcaption {
  padding: 12px 14px;
  font-size: .88rem;
  color: #c7d7ff;
  line-height: 1.45;
}
.placement-links { margin: 0; padding-left: 22px; }
.placement-links li { margin-bottom: 10px; word-break: break-all; }
.placement-certificate { border-color: #3d4f8a; }
.placement-cert-subtitle { color: var(--muted); margin: -6px 0 16px; font-size: .9rem; }
.certificate-body {
  background: #0a1022;
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 20px 22px;
}
.cert-header {
  text-align: center;
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0 0 16px;
  line-height: 1.5;
}
.cert-total { margin: 16px 0; padding: 12px; background: #0f1730; border-radius: 8px; }
.cert-sign {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.cert-sign-block { display: flex; flex-direction: column; gap: 8px; font-size: .9rem; color: var(--muted); }
.cert-line { color: var(--text); }
.cert-stamp-box {
  border: 1px dashed #5b6b9a;
  border-radius: 50%;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  color: #6b7cb0;
  margin-top: 4px;
}
.placement-table-wrap { overflow-x: auto; margin-top: 8px; }
.placement-table-compact { font-size: .82rem; }
.placement-table-compact th,
.placement-table-compact td { padding: 6px 8px; white-space: nowrap; }
.placement-table-compact th:nth-child(2),
.placement-table-compact td:nth-child(2) { white-space: normal; min-width: 120px; max-width: 160px; }
.placement-table-compact .cell-source { white-space: normal; min-width: 140px; max-width: 200px; font-size: .8rem; color: #c7d7ff; }
.placement-table-compact .cell-period { font-size: .78rem; color: var(--muted); }
.placement-table-compact tbody tr { height: 36px; }
.placement-table-compact .cell-thumb {
  text-align: center;
  vertical-align: middle;
  width: 72px;
  padding: 4px 6px !important;
  line-height: 0;
}
.placement-table-compact .thumb-open {
  display: inline-block;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #1a2548;
  cursor: zoom-in;
  vertical-align: middle;
  overflow: hidden;
  line-height: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.placement-table-compact .thumb-open:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(91, 140, 255, 0.35);
}
.placement-table-compact .thumb-open img {
  display: block !important;
  width: 56px !important;
  height: 30px !important;
  max-width: 56px !important;
  max-height: 30px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  object-fit: cover;
  aspect-ratio: unset !important;
}
.placement-table-compact .thumb-ext {
  display: inline-block;
  margin-left: 4px;
  font-size: .75rem;
  color: var(--muted);
  vertical-align: middle;
  text-decoration: none;
  line-height: 1;
}
.placement-table-compact .thumb-ext:hover { color: #9ec1ff; }
.placement-table-compact .thumb-ext-only,
.placement-table-compact .thumb-empty {
  font-size: .72rem;
  color: var(--muted);
}
body.placement-lb-open { overflow: hidden; }
.placement-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.placement-lightbox[hidden] { display: none !important; }
.placement-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  cursor: zoom-out;
}
.placement-lightbox-panel {
  position: relative;
  margin: 0;
  max-width: min(96vw, 1200px);
  max-height: 92vh;
  z-index: 1;
}
.placement-lightbox-panel img {
  display: block;
  max-width: min(96vw, 1200px);
  max-height: 92vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}
.placement-lightbox-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #111;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}
.placement-conclusion {
  margin: 16px 0 0;
  padding: 12px 14px;
  background: #0f1730;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  font-size: .92rem;
  line-height: 1.5;
}

.sentiment-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 16px 0;
}
.sentiment-toolbar input[type=search],
.sentiment-toolbar select {
  background: #0f1730;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 200px;
}
.sentiment-tone-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.sentiment-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 12px;
}
.sentiment-col h3 { margin: 0 0 10px; font-size: 1rem; }
.sentiment-count { color: var(--muted); font-weight: 500; }
.sentiment-list { display: flex; flex-direction: column; gap: 12px; max-height: 70vh; overflow: auto; padding-right: 4px; }
.sentiment-card {
  background: #0f1730;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.sentiment-card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.sentiment-preview { margin: 0 0 8px; font-size: .92rem; }
.sentiment-reason { margin: 0 0 8px; font-size: .85rem; color: #c5d0f5; }
.sentiment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: 8px;
}
.sentiment-reactions { font-size: .85rem; margin-bottom: 8px; }
.sentiment-card footer { font-size: .85rem; }
.tone-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
}
.tone-positive { background: #14532d88; color: #86efac; border: 1px solid #22c55e55; }
.tone-negative { background: #7f1d1d88; color: #fca5a5; border: 1px solid #ef444455; }
.tone-neutral { background: #33415588; color: #cbd5e1; border: 1px solid #64748b55; }
.rx-breakdown { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.rx-item {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: .8rem;
  background: #1a2448;
}
.rx-positive { border: 1px solid #22c55e44; }
.rx-negative { border: 1px solid #ef444444; }
.rx-neutral { border: 1px solid #64748b44; }
.rx-totals { font-size: .8rem; color: var(--muted); }
.sentiment-neutral-block { margin-top: 16px; }
.sentiment-kpi .card .value { font-size: 1.35rem; }

@media (max-width: 700px) {
  .chart-box { height: 240px; }
  h1 { font-size: 1.45rem; }
  .sentiment-columns { grid-template-columns: 1fr; }
}

/* —— Раздел «Документы»: разбор по пунктам —— */
.doc-section-lead { color: var(--muted); margin: 0 0 14px; font-size: .92rem; }
.doc-empty { color: var(--muted); margin: 0; }
.doc-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: #0a1228;
}
.doc-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 8px;
}
.doc-card-head h3 { margin: 0; font-size: 1.05rem; }
.doc-card-head h3 a { color: var(--text); text-decoration: none; }
.doc-card-head h3 a:hover { color: #9ec1ff; }
.doc-card-summary { margin: 0 0 10px; font-size: .92rem; color: #c7d7ff; line-height: 1.5; }
.doc-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  font-size: .85rem;
  color: var(--muted);
}
.doc-type-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: #0f1730;
  color: var(--muted);
}
.doc-type-requirement { border-color: #3b5bcc; color: #9ec1ff; }
.doc-type-completed_work { border-color: #166534; color: #86efac; }
.doc-original-bar { margin: 12px 0 0; }
.doc-original-missing { color: #f87171; font-size: .9rem; }
.btn-original-top { font-size: .9rem; }
.doc-lead {
  margin: 0 0 18px;
  font-size: 1rem;
  line-height: 1.55;
  color: #c7d7ff;
}
.doc-points-card h2 { margin-bottom: 14px; }
.doc-points { display: flex; flex-direction: column; gap: 10px; }
.doc-point {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0a1228;
  overflow: hidden;
}
.doc-point[open] { border-color: #3b5bcc; }
.doc-point-summary {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.doc-point-summary::-webkit-details-marker { display: none; }
.doc-point-num {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #1a2f5a;
  color: #9ec1ff;
  font-weight: 700;
  font-size: .9rem;
}
.doc-point-titles { min-width: 0; flex: 1; }
.doc-point-title {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}
.doc-point-brief {
  display: block;
  font-size: .9rem;
  color: var(--muted);
  line-height: 1.45;
}
.doc-brief-label { color: #7b8fc4; font-weight: 600; }
.doc-point-body {
  padding: 0 14px 14px 3.5rem;
  border-top: 1px solid var(--border);
}
.doc-point-detail p {
  margin: 12px 0;
  font-size: .95rem;
  line-height: 1.55;
  color: #d5ddff;
}
.doc-point-original {
  margin-top: 12px;
  padding: 12px 14px;
  background: #0f1730;
  border-radius: 10px;
  border-left: 3px solid var(--accent);
}
.doc-point-original-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  font-size: .88rem;
  color: var(--muted);
}
.doc-point-ref { font-size: .82rem; color: #7b8fc4; }
.doc-point-quote {
  margin: 0 0 10px;
  padding: 0 0 0 14px;
  border-left: 2px solid #3b5bcc;
  font-size: .9rem;
  line-height: 1.55;
  color: #e8ecff;
  white-space: pre-wrap;
}
.doc-back { margin-top: 20px; font-size: .92rem; }
.btn-open { background: #1e3a5f; }
@media (max-width: 640px) {
  .doc-point-body { padding-left: 14px; }
}

.audit-report-section { margin-top: 0; }
.audit-report-scroll { overflow-x: auto; }
.audit-report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.audit-report-table th,
.audit-report-table td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: center;
  vertical-align: middle;
}
.audit-report-table th {
  background: #0f1730;
  font-weight: 600;
}
.audit-report-table td.audit-report-about {
  text-align: left;
  white-space: pre-wrap;
  min-width: 280px;
  max-width: 520px;
}
.audit-report-table td.audit-report-num {
  width: 56px;
  font-weight: 600;
}
.audit-report-table a {
  color: #9ec1ff;
  word-break: break-all;
}
.audit-report-more {
  margin-top: 10px;
}
.audit-report-more > .audit-report-table {
  margin-top: 0;
}
.audit-report-table-themes td.audit-report-about {
  text-align: left;
  min-width: 320px;
  max-width: 640px;
}

.theme-deep-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 12px 0;
}

.theme-deep-toolbar label {
  font-size: .9rem;
  color: var(--muted);
  font-weight: 600;
}

.theme-deep-toolbar select {
  min-width: 340px;
}

.theme-mentions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  margin-bottom: 10px;
}

.theme-deep-head h3 {
  margin: 0 0 8px;
}

/* Тема «Поток» для обзора и сводки по каналу. */
:root:has(> body.audit-shell) {
  color-scheme: dark;
  background: #252b30;
  scrollbar-color: #657681 #263037;
  scrollbar-width: auto;
}
.audit-shell {
  --bg: #252b30;
  --card: #30383d;
  --text: #f1f3f5;
  --muted: #b4bec6;
  --accent: #66a8f5;
  --link: #a8cefa;
  --border: #ffffff24;
  --inset: #222c33;
  --quiet: #ffffff07;
  --selection: #66a8f51c;
  --danger: #edb0a8;
  --positive: #9ccfba;
  --edge: 28px;
  --shell-width: min(1280px, calc(100% - 2 * var(--edge)));
  display: flow-root;
  min-height: 100dvh;
  scrollbar-color: #657681 #263037;
  scrollbar-width: auto;
  font-family: "Segoe UI", Arial, sans-serif;
  background: radial-gradient(ellipse 1100px 730px at 14% 60px, #56666c 0%, transparent 72%),
              radial-gradient(ellipse 1000px 650px at 88% 800px, #4a4c43 0%, transparent 73%),
              var(--bg);
}
.audit-shell [hidden] { display: none !important; }
/* Nginx добавляет плавающую ссылку в старую разметку. В этих двух отчётах она уже в шапке. */
.audit-shell > a[href="/panel/"] { display: none; }
.audit-shell * { scrollbar-color: #657681 #263037; scrollbar-width: auto; }
.audit-shell ::-webkit-scrollbar { width: 12px; height: 12px; }
.audit-shell ::-webkit-scrollbar-track { background: #263037; }
.audit-shell ::-webkit-scrollbar-thumb {
  background: #657681;
  border: 3px solid #263037;
  border-radius: 8px;
}
.audit-shell ::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.audit-shell ::-webkit-scrollbar-thumb:active { background: var(--link); }
.audit-shell a { color: var(--link); }
.audit-shell :is(a, button, summary, select, input, [tabindex]):focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}
.audit-shell :is(button, select, input) { font-family: inherit; }
.audit-shell :is(button, select, summary):not(:disabled) { cursor: pointer; }
.audit-shell :is(button, select):disabled { cursor: default; opacity: .6; }
.audit-shell > .site-topbar {
  width: var(--shell-width);
  margin: 20px auto 0;
  position: static;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 12px 30px #0002;
}
@supports (backdrop-filter: blur(20px)) {
  .audit-shell > .site-topbar { background: #30383dd9; backdrop-filter: blur(20px); }
}
.audit-shell .site-topbar__inner {
  display: flex;
  min-height: 62px;
  max-width: none;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 8px 14px;
}
.audit-shell .nav-sites {
  margin: 0;
  padding: 0;
  gap: 4px;
  border: 0;
}
.audit-shell .nav-sites a,
.audit-shell .audit-control-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 11px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: .875rem;
  text-decoration: none;
}
.audit-shell .nav-sites a.active { background: var(--selection); border-color: var(--border); color: var(--text); }
.audit-shell .nav-sites a:hover { background: var(--quiet); color: var(--text); border-color: var(--border); }
.audit-shell .audit-control-link { color: var(--text); border-color: var(--border); background: var(--quiet); }
.audit-shell .audit-control-link:hover { color: var(--link); border-color: var(--link); }

.audit-shell > .wrap { width: var(--shell-width); max-width: none; padding: 0 0 48px; }
.audit-shell .hero { margin: 0; padding: 30px 0 20px; background: none; border: 0; }
.audit-shell .hero h1 { margin: 0 0 8px; font-size: clamp(1.55rem, 4vw, 2.125rem); font-weight: 600; line-height: 1.2; }
.audit-shell .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; color: var(--muted); opacity: 1; font-size: .875rem; }
.audit-shell .meta strong { color: var(--text); font-weight: 500; }
.audit-shell .report-plan { padding: 1px 7px; border: 1px solid var(--border); border-radius: 6px; font-size: .75rem; }
.audit-shell .nav-main { margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.audit-shell :is(.nav-main a, .nav-main button, .btn-filter, .tab-btn) {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 8px;
  border-color: var(--border);
  background: var(--quiet);
  color: var(--text);
  font-size: .875rem;
}
.audit-shell :is(.nav-main a, .nav-main button, .btn-filter, .tab-btn):hover { border-color: var(--link); }
.audit-shell :is(.nav-main a, .nav-main button, .btn-filter, .tab-btn).active {
  color: #d2e8ff;
  background: var(--selection);
  border-color: #8db8ec8c;
}
.audit-shell .nav-download { margin-left: auto; }
.audit-shell .card { min-width: 0; background: var(--card); border-radius: 12px; padding: 16px; }
.audit-shell .section { margin-top: 14px; }
.audit-shell .section h2 { font-weight: 600; }
.audit-shell .load-error { color: var(--danger); }
.audit-shell :is(.load-status, .load-error) { margin: 0 0 10px; }
.audit-shell .overview-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 26px;
}
.audit-shell .overview-metrics .card { padding: clamp(10px, 2vw, 20px); }
.audit-shell .overview-metrics dt { color: var(--muted); font-size: .875rem; }
.audit-shell .overview-metrics dd {
  margin: 3px 0 0;
  color: #c1dffc;
  font-size: clamp(1.15rem, 3.5vw, 2rem);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 1.2;
}
.audit-shell .report-groups > h2 { margin: 0 0 10px; font-size: 1rem; font-weight: 600; color: var(--muted); }
.audit-shell .report-group { margin-bottom: 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--quiet); }
.audit-shell .report-group[open] { background: #28313799; }
.audit-shell .report-group > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 66px;
  padding: 12px 16px;
  border-radius: 11px;
  list-style: none;
}
.audit-shell .report-group > summary::-webkit-details-marker { display: none; }
.audit-shell .report-group > summary:hover { background: var(--quiet); }
.audit-shell .report-group > summary::after {
  content: "";
  flex: 0 0 8px;
  height: 8px;
  margin: 0 3px 4px 0;
  border: solid var(--link);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.audit-shell .report-group[open] > summary::after { transform: rotate(225deg); margin-bottom: -4px; }
.audit-shell .report-group summary strong { display: block; font-size: 1rem; font-weight: 600; }
.audit-shell .report-group summary small { display: block; margin-top: 2px; color: var(--muted); font-size: .875rem; }
.audit-shell .report-group-content { min-width: 0; padding: 0 12px 12px; }
.audit-shell .report-group-content > .section:first-child { margin-top: 0; }
.audit-shell .report-group-content > .load-status { margin: 12px 0; }
.audit-shell .report-group-content h3 { color: var(--text); font-size: 1rem; }

.audit-shell :is(select, input[type=search]) {
  min-height: 42px;
  min-width: 0;
  max-width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--inset);
  color: var(--text);
  font-size: .9375rem;
}
.audit-shell select { width: min(100%, 360px); }
.audit-shell select option { background: var(--inset); color: var(--text); }
.audit-shell input[type=search]::placeholder { color: var(--muted); }
.audit-shell input[type=search]::-webkit-search-cancel-button { appearance: none; }
.audit-shell .audit-search { position: relative; width: min(100%, 440px); }
.audit-shell .audit-search input { width: 100%; margin: 0; }
.audit-shell .audit-search:has(button:not([hidden])) input { padding-right: 92px; }
.audit-shell .audit-search button { position: absolute; right: 3px; top: 3px; min-height: 36px; padding: 4px 8px; }
.audit-shell #channel-links-section .audit-search { margin-bottom: 10px; }
.audit-shell .channel-picker { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.audit-shell .channel-picker .load-status { margin: 0; }
.audit-shell .channel-picker label { color: var(--muted); font-size: .9rem; font-weight: 600; }
.audit-shell :is(.grid, .theme-sentiment-grid, .theme-mentions-grid) {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 215px), 1fr));
}
.audit-shell .sentiment-toolbar select { width: auto; }
.audit-shell .sentiment-columns { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.audit-shell .sentiment-card { overflow-wrap: anywhere; }
.audit-shell .channel-source { overflow-wrap: anywhere; }
.audit-shell :is(.card .value, .channel-posts-count, .channel-posts-subs, table) { font-variant-numeric: tabular-nums; }
.audit-shell :is(.collapse-more, .filter-chip, .channel-link-chip, .sentiment-card, .rx-item, .tone-bar-track,
                 .theme-sentiment-card, .channel-analytics-item, .analytics-total-row td, .analytics-table th, .audit-report-table th) {
  background: var(--inset);
}
.audit-shell :is(.filter-chip:has(input:checked), .analytics-scope-badge, .analytics-note) { background: var(--selection); }
.audit-shell .channel-link-chip:hover { background: var(--selection); border-color: var(--link); }
.audit-shell .analytics-table tbody tr:nth-child(even) { background: var(--quiet); }
.audit-shell .moscow-share-value { color: var(--positive); }
.audit-shell .badge { background: #314840; color: var(--positive); }
.audit-shell .tone-positive { background: #314840; color: var(--positive); border-color: #9ccfba65; }
.audit-shell .tone-negative { background: #4a3435; color: var(--danger); border-color: #edb0a865; }
.audit-shell .tone-neutral { background: var(--inset); color: var(--muted); border-color: var(--border); }
.audit-shell :is(.audit-report-scroll, .channel-posts-scroll) { max-height: min(62vh, 560px); overflow: auto; }
.audit-shell .audit-report-table { min-width: 475px; }
.audit-shell :is(#posts-table, #all-posts-table) { min-width: 720px; }
.audit-shell :is(.audit-report-scroll, .channel-posts-scroll) th { position: sticky; top: 0; background: var(--inset); }
.audit-shell .sentiment-list { scrollbar-gutter: stable; }
.audit-shell .channel-analytics-item[open] { border-color: var(--link); }
.audit-shell .chart-box canvas { max-width: 100%; }

@media (max-width: 700px) {
  .audit-shell { --edge: 12px; }
  .audit-shell > .site-topbar { margin-top: 12px; }
  .audit-shell .hero { padding: 22px 0 16px; }
  .audit-shell .nav-download { margin-left: 0; }
  .audit-shell .overview-metrics { gap: 6px; }
  .audit-shell .overview-metrics dt { font-size: .8rem; }
  .audit-shell .sentiment-columns { grid-template-columns: minmax(0, 1fr); }
  .audit-shell .report-group-content { padding-inline: 8px; }
  .audit-shell .report-group-content .card { padding: 12px; }
}
@media (prefers-contrast: more) {
  .audit-shell { --border: #a2b0bc; --muted: #f1f3f5; }
  .audit-shell > .site-topbar { background: var(--card); }
}
@media (forced-colors: active) {
  :root:has(> body.audit-shell), .audit-shell, .audit-shell * { scrollbar-color: auto; }
  .audit-shell :is(a, button, summary, select, input, [tabindex]):focus-visible { outline-color: Highlight; }
  .audit-shell :is(.nav-main a, .nav-main button, .btn-filter, .tab-btn).active { border-color: Highlight; }
}

.audit-shell > .ai-ask {
  width: var(--shell-width);
  margin: 16px auto 0;
  display: flex;
  gap: 8px;
  align-items: center;
}
.audit-shell .ai-ask input {
  min-height: 42px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--inset);
  color: var(--text);
  font: inherit;
  font-size: .9375rem;
}
.audit-shell .ai-ask__pass { width: 128px; flex: 0 0 128px; }
.audit-shell .ai-ask__q { flex: 1 1 auto; min-width: 0; }
.audit-shell .ai-ask button {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--selection);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.audit-shell > .ai-ask__log {
  width: var(--shell-width);
  margin: 8px auto 0;
  color: var(--muted);
  font-size: .9rem;
  white-space: pre-wrap;
}

.audit-shell .ai-ask__stop {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--danger);
  font: inherit;
  cursor: pointer;
}
.audit-shell > .ai-ask__log { max-height: 168px; overflow: auto; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); }
.audit-shell .ai-line { margin: 0 0 6px; }
.audit-shell .ai-line b { color: var(--muted); font-weight: 600; margin-right: 6px; }
.audit-shell .ai-line--me b { color: var(--text); }

.audit-shell .ai-ask__pass--need { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.audit-shell .ai-line--warn { color: var(--danger); }
.audit-shell .ai-line--thinking { color: var(--muted); }
.audit-shell .ai-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin: 0 6px -2px 0;
  border: 2px solid var(--border);
  border-top-color: var(--link);
  border-radius: 50%;
  animation: ai-spin .7s linear infinite;
  vertical-align: middle;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }
