/* Terminal theme: Bloomberg-inspired - плотность, amber/orange accent, тёмный фон, condensed labels */
:root {
  --bg: #08090c;
  --panel: #0d0f12;
  --text: #e8e6e3;
  --muted: #6b7280;
  --line: #1e2228;
  --border: #1e2228;
  --primary: #f48024;
  --accent: #f48024;
  --good: #26a269;
  --bad: #e5484d;
  --risk: #e5b318;
  --warn: #e5b318;
  --tooltip-bg: #0d0f12;
  --tooltip-text: #e8e6e3;
  --hover-row: #13161b;
  --chip-active-bg: #1e2228;
  --chip-active-text: #f5a623;
  --button-hover: #1f2735;
  --table-bg: #262626;
  --table-data-bg: #0d0d0d;
  --table-header-row-bg: #404040;
  --table-header-row-text: #a6a6a6;
  --table-title-row-text: #e19137;
  --table-vertical-line: #595959;
  --table-line: var(--table-vertical-line);
  --chart-bg: #0d0f12;
  --chart-bg-end: #151820;
  --chart-area-fill-mode: solid;
  --chart-area-fill: #0d0f12;
  --chart-grid-h: #1e2228;
  --chart-grid-v: #1e2228;
  --chart-axis-x: #9aa0a6;
  --chart-axis-y: #9aa0a6;
  --chart-axis-y2: #8b9cb3;
  --chart-label: #6b7280;
  --chart-figure: #e8eaed;
  --chart-series-1: #f48024;
  --chart-series-2: #5b9bd5;
  --chart-series-3: #70ad47;
  --chart-series-4: #ffc000;
  --chart-series-5: #ed7d31;
  --chart-series-6: #4472c4;
  --chart-mp-ozon: #005bff;
  --chart-mp-wb: #cb11ab;
  --chart-mp-ym: #ffcc00;
  --chart-mp-b2b: #0f766e;
  --chart-mp-diy: #b45309;
  --font-ui: Inter, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-cond: var(--font-ui);
  --font-mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --fs-9: 9px;
  --fs-10: 11px;
  --fs-11: 12px;
  --fs-12: 13px;
  --fs-14: 15px;
  --fs-16: 17px;
  --fs-18: 19px;
  --canvas-fs-10: 10px;
  --fs-exact-16: 16px;
  --fs-exact-18: 18px;
  --fs-20: 20px;
  --fs-22: 22px;
  --fs-24: 24px;
  --fs-28: 28px;
  --fs-32: 32px;
  --text-on-accent: #0a0a0c;
  --text-inverse: #ffffff;
  --text-info: #aebcd5;
  --text-success-muted: #9fb09f;
  --text-divider: #1e2228;
  --text-warning: #d4a72c;
  --text-error: #f87171;
  --text-warning-contrast: #fff8e1;
  --text-dark: #0f172a;
  --text-dark-strong: #111827;
  --text-dark-blue: #0b1220;
  --text-risk-high: #ff9aa6;
  --text-risk-medium: #ffd08a;
  --text-risk-low: #ffe694;
  --text-risk-pill-high: #842029;
  --text-risk-pill-medium: #7a5200;
  --text-risk-pill-low: #8b6a00;
  --text-error-soft: #ffb4b4;
  --text-success-soft: #9be7bd;
  --text-check-fail: #b42318;
  --lh-tight: 1.2;
  --lh-normal: 1.35;
  --radius-sm: 2px;
  --radius: 4px;
  --space-xs: 4px;
  --space-sm: 6px;
  --space-md: 8px;
  --space-lg: 12px;
  --table-scroll-max-height: min(70vh, 720px);
  --rv2-matrix-subhead-top: 33px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-12);
  background: var(--bg);
  color: var(--text);
}

.page-header {
  padding: var(--space-md) var(--space-lg);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  gap: 24px;
}
.page-header h1 { margin: 0; font-size: var(--fs-28); }
.header-controls {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1;
  min-width: 0;
}
.header-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 14px;
}
.header-refresh-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.header-refresh-btn {
  padding: var(--space-sm) var(--space-md);
  white-space: nowrap;
  font-size: var(--fs-11);
}
.header-loading-indicator {
  min-width: 120px;
  font-size: var(--fs-11);
  line-height: var(--lh-tight);
}
.status--header {
  display: block;
  margin-top: 6px;
  width: 100%;
  text-align: right;
  font-size: var(--fs-11);
  line-height: 1.2;
  color: var(--muted);
}
.header-divider {
  color: var(--text-divider);
  font-weight: 700;
}
.help-link {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 700;
  color: var(--text);
}
.container {
  width: 100%;
  max-width: 1440px;
  margin: var(--space-lg) auto;
  padding: 0 var(--space-md) var(--space-lg);
}

.dashboard-layout {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: var(--space-lg);
}

.section-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  position: sticky;
  top: var(--space-md);
  align-self: start;
  border-right: 1px solid var(--line);
  padding-right: var(--space-md);
}

.tbtn,
.section-nav-btn,
.history-range-btn,
.chip-link {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-sm) var(--space-md);
  background: var(--panel);
  color: var(--text);
  font-family: var(--font-cond);
  font-size: var(--fs-11);
  line-height: var(--lh-tight);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
  cursor: pointer;
}

.tbtn:hover,
.section-nav-btn:hover,
.history-range-btn:hover,
.chip-link:hover {
  border-color: color-mix(in srgb, var(--line) 60%, var(--text) 40%);
  background: color-mix(in srgb, var(--panel) 90%, var(--button-hover) 10%);
}

.tbtn:focus-visible,
.section-nav-btn:focus-visible,
.history-range-btn:focus-visible,
.chip-link:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--primary) 68%, var(--line) 32%);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--panel) 42%, var(--primary) 58%);
}

.tbtn.active,
.tbtn--active,
.section-nav-btn.active,
.history-range-btn.active,
.chip-link.active,
.tbtn[aria-pressed='true'] {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-on-accent);
}

.section-nav-btn {
  text-align: left;
  border-radius: var(--radius-sm);
}

.dashboard-content {
  min-width: 0;
}

.tabs { display: flex; gap: var(--space-md); margin-bottom: var(--space-md); }
/* Вкладки/кнопки в стиле терминала (Data Quality, Math Lab) */
.tab {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-sm) var(--space-md);
  background: var(--panel);
  color: var(--text);
  font-family: var(--font-cond);
  font-size: var(--fs-11);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.tab:hover { border-color: color-mix(in srgb, var(--line) 60%, var(--text) 40%); background: color-mix(in srgb, var(--panel) 90%, var(--button-hover) 10%); }
.tab.active { background: var(--primary); border-color: var(--primary); color: var(--text-on-accent); }
.tbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.controls {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}
.controls .tabs {
  margin-bottom: 0;
}
.tbtn--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-on-accent);
}
.status { color: var(--muted); }
.qr-status-error { color: var(--bad); }

.qr-panel {
  margin-bottom: var(--space-md);
}

.qr-pre {
  margin: 0;
  padding: var(--space-sm);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0a0b0e;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--fs-10);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow: auto;
}

.qr-textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0a0b0e;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--fs-10);
  padding: var(--space-sm);
}

.kpi-strip {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-bottom: var(--space-md);
  border: 1px solid var(--line);
  border-left: 0;
  border-right: 0;
  background: color-mix(in srgb, var(--panel) 92%, #08090c 8%);
  overflow-x: auto;
  scrollbar-width: thin;
}

.kpi-item {
  min-width: 0;
  flex: 1 1 0;
  padding: var(--space-sm) var(--space-md);
  border-right: 1px solid var(--line);
}

.kpi-item:last-child {
  border-right: 0;
}

.kpi-label {
  color: var(--muted);
  font-size: var(--fs-10);
  font-family: var(--font-cond);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.kpi-flag {
  margin-top: var(--space-xs);
  font-size: var(--fs-10);
  color: var(--muted);
}

.kpi-value {
  margin-top: var(--space-xs);
  font-size: var(--fs-16);
  font-weight: 700;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.kpi-delta {
  margin-top: var(--space-xs);
  font-size: var(--fs-11);
  font-weight: 600;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.kpi-delta.pos {
  color: var(--good);
}

.kpi-delta.neg {
  color: var(--bad);
}

.kpi-delta.neu {
  color: var(--risk);
}


.panel-title {
  margin: 0;
  font-size: var(--fs-11);
  font-family: var(--font-cond);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: var(--lh-tight);
  font-weight: 700;
}

.panel-meta {
  color: var(--muted);
  font-size: var(--fs-12);
  line-height: var(--lh-tight);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.trend-panel {
  padding: var(--space-md) var(--space-lg) var(--space-md);
  background: color-mix(in srgb, var(--panel) 90%, #08090c 10%);
}

.trend-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.trend-title { color: var(--text); }

.trend-meta { font-family: var(--font-mono); font-size: var(--fs-11); }
.source-data-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: var(--space-lg);
  align-items: start;
}
.source-data-nav {
  max-height: calc(100vh - 96px);
  overflow-y: auto;
}
.source-data-nav-btn {
  width: 100%;
  white-space: normal;
  line-height: 1.35;
}
.source-data-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.source-data-section-title {
  margin: 0 0 12px;
  font-size: var(--fs-14);
}
.source-data-datasets { display: flex; flex-direction: column; gap: 10px; }
.source-data-dataset { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.source-data-dataset-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; background: color-mix(in srgb, var(--panel) 88%, #000 12%); }
.source-data-toggle { display: inline-flex; align-items: center; gap: 8px; text-align: left; }
.source-data-toggle-icon { width: 14px; color: var(--primary); }
.source-data-source { font-size: var(--fs-11); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-data-dataset-body { padding: 12px; }
.source-data-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.source-data-limit-label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--muted); }
.source-data-meta { margin-left: auto; font-family: var(--font-mono); font-size: var(--fs-11); color: var(--muted); }
.source-data-sql-wrap { margin-top: 12px; }
.source-data-sql-title { margin: 0 0 6px; font-size: var(--fs-12); font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.source-data-sql { margin: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: color-mix(in srgb, var(--panel) 82%, #000 18%); font-family: var(--font-mono); font-size: var(--fs-11); line-height: 1.45; white-space: pre-wrap; word-break: break-word; color: var(--text); overflow: auto; max-height: 220px; }
.source-data-page td.cell-negative { color: var(--bad); font-weight: 600; }
.empty-cell { text-align: center; color: var(--muted); padding: 18px 12px; }

.sku-panel-header h2 {
  margin: 0;
}

.trend-canvas-wrap {
  position: relative;
  width: 100%;
  height: 200px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(8, 9, 12, 0.95) 0%, rgba(5, 6, 8, 0.98) 100%);
  overflow: hidden;
}

#trendCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.trend-crosshair {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.trend-crosshair::before,
.trend-crosshair::after {
  content: '';
  position: absolute;
  background: color-mix(in srgb, #9aa4b2 55%, #0e1118 45%);
  opacity: 0.8;
}

.trend-crosshair::before {
  top: 0;
  bottom: 0;
  left: var(--crosshair-x, 0px);
  width: 1px;
}

.trend-crosshair::after {
  left: 0;
  right: 0;
  top: var(--crosshair-y, 0px);
  height: 1px;
}

.trend-tooltip {
  position: absolute;
  min-width: 140px;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--tooltip-bg);
  color: var(--tooltip-text);
  font-size: var(--fs-11);
  line-height: var(--lh-normal);
  font-family: var(--font-mono);
  white-space: nowrap;
  pointer-events: none;
  transform: translate(8px, -8px);
  font-variant-numeric: tabular-nums;
  z-index: 2;
}

.trend-legend {
  margin-top: var(--space-md);
  display: flex;
  gap: var(--space-lg);
  align-items: center;
  color: var(--muted);
  font-size: var(--fs-11);
  font-family: var(--font-cond);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-cur { color: var(--text-info); }
.legend-prev { color: var(--text-success-muted); }
.legend-gmv { background: #60a5fa; }
.legend-rev { background: #4ade80; }

.bridge-panel { padding: var(--space-md) var(--space-lg); }
.bridge-header { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-md); margin-bottom: var(--space-md); }
.bridge-title { color: var(--text); }
.bridge-meta { font-family: var(--font-mono); font-size: var(--fs-11); }
.bridge-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
.bridge-col { min-width: 0; }
.bridge-subtitle { font-size: var(--fs-11); font-family: var(--font-cond); margin: 0 0 var(--space-sm); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; line-height: var(--lh-tight); }
.bridge-canvas-wrap { position: relative; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: color-mix(in srgb, var(--panel) 85%, #08090c 15%); }
#bridgeCanvasGmv, #bridgeCanvasRevenue { width:100%; height:260px; display:block; }

.bridge-tooltip {
  position:absolute; pointer-events:none; max-width:280px;
  background:var(--panel); border:1px solid var(--line); border-radius:6px;
  padding:8px 10px; color:var(--text);
  box-shadow:0 10px 22px rgba(0,0,0,0.25);
  font-size: var(--fs-12); line-height: var(--lh-normal); font-family: var(--font-mono); font-variant-numeric:tabular-nums;
}

.bridge-footer { display: flex; flex-wrap: wrap; gap: var(--space-md); margin-top: var(--space-md); font-size: var(--fs-11); font-family: var(--font-cond); color: var(--muted); line-height: var(--lh-tight); }
.bridge-foot-item { display: inline-flex; align-items: center; gap: var(--space-sm); }
.legend-pos { background: var(--good); }
.legend-neg { background: var(--bad); }

.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}
.panel h2 { margin: 0 0 var(--space-md); font-size: var(--fs-11); font-family: var(--font-cond); letter-spacing: 0.08em; text-transform: uppercase; line-height: var(--lh-tight); }

.chart {
  display: grid;
  gap: 8px;
}
.chart-row {
  display: grid;
  grid-template-columns: 240px 1fr 110px;
  gap: 10px;
  align-items: center;
}
.bar-wrap {
  width: 100%;
  height: 18px;
  background: #e9eefc;
  border-radius: 2px;
  overflow: hidden;
}
.bar {
  height: 100%;
  width: var(--bar-pct, 0);
  background: linear-gradient(90deg, #4f83ff 0%, #2a6cff 100%);
}

/* Ширина колонки «Сегмент» задаётся через CSS-переменную (значение в JS) */
#segmentsMainTable col.segment-col {
  width: var(--segment-col-width);
  min-width: var(--segment-col-width);
  max-width: var(--segment-col-width);
}

.table-wrap {
  overflow: auto;
  max-height: var(--table-scroll-max-height);
}
.table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-12);
  font-family: var(--font-ui);
}
thead th {
  text-align: center;
  border-bottom: 1px solid var(--line);
  padding: var(--space-sm) var(--space-md);
  font-size: var(--fs-11);
  font-family: var(--font-cond);
  font-weight: 600;
  letter-spacing: 0.03em;
  background: color-mix(in srgb, var(--panel) 90%, var(--line) 10%);
  white-space: nowrap;
}

thead th > div {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
tbody td {
  border-bottom: 1px solid var(--line);
  padding: var(--space-sm) var(--space-md);
  white-space: nowrap;
}

#segmentsMainTable tbody tr {
  height: 28px;
}

#segmentsMainTable tbody td {
  height: 28px;
  padding-top: 0;
  padding-bottom: 0;
  vertical-align: middle;
  font-size: var(--fs-12);
}
.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.deltaCell {
  /* Ширина колонки учитывает и абсолютное, и относительное изменение, чтобы избежать обрезки значения. */
  display: inline-flex;
  justify-content: flex-end;
  gap: 8px;
  align-items: baseline;
  white-space: nowrap;
  width: auto;
  min-width: fit-content;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.deltaAbs {
  text-align: right;
  white-space: nowrap;
}

.deltaPct {
  text-align: left;
  white-space: nowrap;
}
.cell-warning-low-buyout {
  background: color-mix(in srgb, #b45309 55%, var(--panel) 45%);
  color: var(--text-warning-contrast);
  font-weight: 700;
  border: 1px solid color-mix(in srgb, #d97706 60%, var(--line) 40%);
}
.table-zebra tbody tr:nth-child(even):not(.total-row) { background: transparent; }
.table-zebra tbody tr:hover:not(.total-row) { background: var(--hover-row); }
.table-zebra tbody tr:hover:not(.total-row) .cell-warning-low-buyout { background: color-mix(in srgb, #92400e 72%, var(--hover-row) 28%); color: var(--text-inverse); }
.table-zebra tbody tr.total-row { background: color-mix(in srgb, var(--panel) 75%, #c2cee8 25%); }
.table-zebra tbody tr.total-row .cell-warning-low-buyout { background: color-mix(in srgb, #7c2d12 70%, var(--panel) 30%); color: var(--text-inverse); }
.table-zebra tbody tr.row-ddp-missing { background: color-mix(in srgb, #92400e 20%, transparent 80%); }
.table-zebra tbody tr.row-ddp-missing:hover { background: color-mix(in srgb, #92400e 30%, var(--hover-row) 70%); }
.table-zebra tbody tr.row-sku-top-mover { background: color-mix(in srgb, #f472b6 18%, transparent 82%); }
.table-zebra tbody tr.row-sku-top-mover:hover { background: color-mix(in srgb, #f472b6 26%, var(--hover-row) 74%); }
.table-zebra tbody tr.row-sku-active,
.table-zebra tbody tr.row-sku-active:hover {
  background: color-mix(in srgb, #facc15 28%, var(--hover-row) 72%);
}

.growth-pos { color: var(--good); font-weight: 600; }
.growth-neg { color: var(--bad); font-weight: 600; }
.hidden { display: none; }
.total-row td { font-weight: 700; }

.marketplace-controls {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.filter-group {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-label {
  font-size: var(--fs-12);
  color: var(--muted);
}

.marketplace-controls label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-14);
}


.history-range-toggle {
  display:inline-flex;
  gap: 8px;
}
.history-range-btn { color: var(--text); }
.period-select {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius);
  padding: var(--space-sm) var(--space-md);
  font: inherit;
  font-size: var(--fs-12);
  transition: border-color 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}

select,
select option,
select optgroup {
  background: var(--panel);
  color: var(--text);
}

select:hover {
  border-color: color-mix(in srgb, var(--line) 65%, var(--text) 35%);
}

select:focus,
select:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--line) 40%, var(--text) 60%);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--panel) 55%, var(--line) 45%);
}

.th-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.sort-indicator { color: var(--muted); font-size: var(--fs-11); }
.help-trigger {
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0 2px;
  line-height: 1;
}
.tooltip-popover {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  position: fixed;
  z-index: 100;
  max-width: 320px;
  background: var(--tooltip-bg);
  color: var(--tooltip-text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  white-space: normal;
  line-height: var(--lh-normal);
}
.tooltip-sql { margin-top: 8px; font-size: var(--fs-12); color: var(--muted); }
.growth-neutral { color: var(--muted); }

.segment-cell {
  width: 100%;
}
/* Отступ первой колонки по глубине вложенности (формула: 8 + depth*14 px) - только в styles.css */
#segmentsMainTable .row-depth-0 td.segment-cell { padding-left: 8px; }
#segmentsMainTable .row-depth-1 td.segment-cell { padding-left: 22px; }
#segmentsMainTable .row-depth-2 td.segment-cell { padding-left: 36px; }
#segmentsMainTable .row-depth-3 td.segment-cell { padding-left: 50px; }
#segmentsMainTable .row-depth-4 td.segment-cell { padding-left: 64px; }

.segment-cell-content {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
}
.segment-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.child-segment {
  padding-left: 22px;
}
.other-toggle,
.segment-toggle,
.other-toggle-placeholder,
.other-toggle-right {
  width: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  line-height: 1;
}
.other-toggle {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.segment-toggle {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  color: var(--muted);
}
.other-toggle-right {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  width: auto;
  min-width: 14px;
}
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.line-chart { border: 1px solid var(--line); border-radius: 6px; padding: 8px; overflow: auto; }
.line-chart-title { font-size: var(--fs-12); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; line-height: var(--lh-tight); margin-bottom: 6px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: var(--fs-11); margin-bottom: 6px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.monthly-canvas-wrap {
  border-radius: 6px;
  height: 280px;
}

#monthlyCanvasLeft,
#monthlyCanvasRight {
  display: block;
  width: 100%;
  height: 100%;
}

.sku-bubble-panel {
  margin: 10px 0;
  padding: 10px 12px 12px;
}

.sku-bubble-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
  margin-right: 12px;
  flex-wrap: wrap;
}

.sku-bubble-size-switch {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

#skuBubbleCanvasWrap {
  min-height: 540px;
  overflow: visible;
}

.export-png-host {
  position: relative;
}

.export-png-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.export-view-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  z-index: 12;
}

.export-png-title > .export-view-actions {
  position: static;
  margin-left: auto;
}

.export-png-host > .export-view-actions {
  position: absolute;
  top: 8px;
  right: 8px;
}

.export-png-btn,
.export-expand-btn,
.export-xlsx-btn,
.sku-bubble-export-icon {
  position: relative;
  top: auto;
  right: auto;
  z-index: 12;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--line) 70%, #6f7c95 30%);
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel) 82%, #101827 18%);
  color: var(--text);
  cursor: pointer;
}
.export-xlsx-btn {
  width: auto;
  min-width: 28px;
  padding: 0 8px;
  font-size: var(--fs-10, 10px);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.sku-bubble-export-icon {
  position: absolute;
  top: 8px;
  right: 8px;
}

.export-png-btn:hover,
.export-expand-btn:hover,
.export-xlsx-btn:hover,
.sku-bubble-export-icon:hover {
  border-color: color-mix(in srgb, var(--primary) 70%, #6f7c95 30%);
  color: var(--primary);
}

.export-png-btn:focus-visible,
.export-expand-btn:focus-visible,
.export-xlsx-btn:focus-visible,
.sku-bubble-export-icon:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.export-expand-btn--active {
  border-color: color-mix(in srgb, var(--primary) 70%, #6f7c95 30%);
  color: var(--primary);
}

.export-png-icon,
.export-expand-icon {
  display: block;
  pointer-events: none;
}

.export-expand-target:fullscreen,
.export-expand-target:-webkit-full-screen {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 20px 24px;
  overflow: auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.export-expand-target:fullscreen .rv2-chart-host,
.export-expand-target:fullscreen .rv2-chart,
.export-expand-target:fullscreen .chart,
.export-expand-target:fullscreen #chart,
.export-expand-target:-webkit-full-screen .rv2-chart-host,
.export-expand-target:-webkit-full-screen .rv2-chart,
.export-expand-target:-webkit-full-screen .chart,
.export-expand-target:-webkit-full-screen #chart {
  flex: 1 1 auto;
  width: 100%;
  min-height: min(70vh, 100%);
  height: auto;
}

.export-expand-target:fullscreen .rv2-table-wrap,
.export-expand-target:fullscreen .table-wrap,
.export-expand-target:fullscreen .rv2-heatmap-wrap,
.export-expand-target:-webkit-full-screen .rv2-table-wrap,
.export-expand-target:-webkit-full-screen .table-wrap,
.export-expand-target:-webkit-full-screen .rv2-heatmap-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.export-expand-target:fullscreen.export-png-host > .export-view-actions,
.export-expand-target:-webkit-full-screen.export-png-host > .export-view-actions {
  position: fixed;
  top: 16px;
  right: 16px;
}

.rv2-margin-sku-chart-card,
.rv2-planfact-matrix-host,
#chart.chart {
  position: relative;
}

.sku-bubble-legend {
  margin: 0 0 8px;
  gap: 10px;
}

.sku-bubble-clip-mark {
  color: var(--primary);
  font-weight: 700;
}

#skuBubbleCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.quick-filters {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel) 85%, #dbe7ff 15%);
}

.quick-filters-layout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.quick-filters-layout .quick-filters {
  flex: 1;
  margin-bottom: 0;
}

.column-picker-btn {
  align-self: flex-start;
  white-space: nowrap;
}
.quick-filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; }
.quick-filter-title { font-size: var(--fs-12); color: var(--muted); white-space: nowrap; }

.quick-filter-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 0;
  min-width: 0;
}

.quick-filter-search {
  display: grid;
  min-width: 260px;
  gap: 6px;
  font-size: var(--fs-12);
  color: var(--muted);
  flex: 1;
}

.quick-filter-search input {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  color: var(--text);
  background: var(--panel);
}

.quick-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-14);
}

.inline-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--fs-11);
  line-height: 1;
  cursor: help;
}

.inline-hint:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.quick-filter-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
}

#segmentsMainTable {
  table-layout: auto;
  width: max-content;
  min-width: 100%;
}

#segmentsMainTable thead th {
  white-space: normal;
}

#segmentsMainTable thead th > div {
  display: flex;
  width: 100%;
  justify-content: center;
  align-items: center;
}

#segmentsMainTable .th-btn {
  white-space: normal;
  text-align: center;
  justify-content: center;
}

#segmentsMainTable.institutional thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: color-mix(in srgb, var(--panel) 88%, #ffffff 12%);
  border-right: 1px solid var(--line);
}

#segmentsMainTable.institutional thead th:last-child,
#segmentsMainTable.institutional tbody td:last-child {
  border-right: none;
}

#segmentsMainTable.institutional tbody td {
  border-right: 1px solid var(--line);
}

#segmentsMainTable.institutional thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--panel) 92%, #ffffff 8%);
}

#segmentsMainTable.institutional tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: color-mix(in srgb, var(--panel) 95%, #ffffff 5%);
}

#segmentsMainTable.institutional tbody tr:hover:not(.total-row) td {
  background: var(--hover-row);
}

#segmentsMainTable.institutional tbody tr:hover:not(.total-row) td:first-child {
  background: color-mix(in srgb, var(--hover-row) 85%, var(--panel) 15%);
}

#segmentsMainTable.institutional tbody tr.total-row td {
  border-top: 2px solid color-mix(in srgb, var(--line) 40%, #ffffff 60%);
  background: color-mix(in srgb, var(--panel) 70%, #c2cee8 30%);
}

#segmentsMainTable.institutional tbody tr.row-depth-1 td,
#segmentsMainTable.institutional tbody tr.row-depth-2 td {
  color: color-mix(in srgb, var(--text) 82%, var(--muted) 18%);
}

#segmentsMainTable.institutional tbody tr.row-depth-1 td.growth-pos,
#segmentsMainTable.institutional tbody tr.row-depth-2 td.growth-pos {
  color: var(--good);
}

#segmentsMainTable.institutional tbody tr.row-depth-1 td.growth-neg,
#segmentsMainTable.institutional tbody tr.row-depth-2 td.growth-neg {
  color: var(--bad);
}

#segmentsMainTable.institutional tbody tr.row-risk td:first-child {
  box-shadow: inset 2px 0 0 0 color-mix(in srgb, #d09300 82%, #ffffff 18%);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: grid;
  place-items: center;
  z-index: 200;
  padding: 16px;
}

.modal-backdrop.hidden { display: none; }

.modal-card {
  width: min(760px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-close-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
}

.modal-subtitle {
  margin: 8px 0 10px;
  color: var(--muted);
}

.column-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}

.column-picker-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.column-picker-option.selected {
  border-color: var(--primary);
}

.column-picker-option.disabled {
  opacity: 0.45;
}

.column-picker-max-hint {
  margin: 0;
  color: var(--muted);
}

.column-picker-max-hint.hidden {
  display: block;
  visibility: hidden;
}

.modal-footer {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.chip-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  white-space: nowrap;
  text-decoration: none;
}

.chip-link.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-inverse);
}

.help-page { scroll-behavior: smooth; }
.help-intro { color: var(--muted); margin: 0 0 12px; }
.help-nav {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.help-nav a {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
}
.help-nav a:hover { border-bottom-color: var(--primary); }
.help-metrics-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 10px;
}
.help-metrics-header label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: var(--fs-12);
}
.help-metrics-header input {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  min-width: 280px;
  background: var(--panel);
  color: var(--text);
}

.formula-code {
  font-family: var(--font-mono);
  white-space: normal;
}

.formula-var-db {
  background: color-mix(in srgb, var(--line) 70%, var(--panel) 30%);
  border-radius: 6px;
  padding: 0 4px;
}

.formula-var-derived {
  font-weight: 700;
}

@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .header-actions {
    justify-content: flex-start;
  }
  .status--header {
    text-align: left;
  }
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
  .source-data-layout {
    grid-template-columns: 1fr;
  }
  .source-data-nav {
    position: static;
    max-height: none;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    padding-right: 0;
    border-bottom: 1px solid var(--line);
    padding-bottom: var(--space-md);
  }
  .source-data-nav-btn {
    width: auto;
  }
  .section-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .help-metrics-header {
    flex-direction: column;
    align-items: stretch;
  }
  .help-metrics-header input {
    min-width: 0;
    width: 100%;
  }
  .quick-filters-layout {
    flex-direction: column;
    align-items: stretch;
  }
  .column-picker-btn {
    align-self: flex-end;
  }
}

.growth-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.growth-mode-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.segmented-control {
  display: inline-flex;
  gap: 6px;
}

.growth-metric {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: color-mix(in srgb, var(--panel) 86%, #d7e2fb 14%);
}

.growth-metric.total {
  background: color-mix(in srgb, var(--panel) 84%, #ffffff 16%);
}

.growth-metric .label {
  color: var(--muted);
  font-size: var(--fs-11);
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.growth-metric .value {
  margin-top: 4px;
  font-size: var(--fs-20);
  font-weight: 700;
}

.growth-help {
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  background: var(--panel);
  color: var(--text);
  cursor: help;
  font-size: var(--fs-10);
  line-height: 1;
}

.growth-chart-wrap {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.growth-stack {
  display: flex;
  align-items: center;
  height: 22px;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--panel) 70%, #1f2a44 30%);
}

.growth-stack-segment {
  height: 100%;
  min-width: 8px;
}

.growth-volume { background: #637a96; }
.growth-price { background: #f5a623; }
.growth-mix { background: #6765e5; }
.growth-total { background: #eef3ff; border: 1px solid var(--line); }

.growth-stack-segment.is-negative {
  filter: brightness(0.72) saturate(0.85);
}

.growth-stack-total {
  margin-left: auto;
  width: 14px;
  height: 100%;
  background: var(--text);
}

.growth-legend {
  margin-top: 8px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: var(--fs-11);
}

.growth-legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
  vertical-align: middle;
}

.growth-placeholder {
  color: var(--muted);
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
}

.growth-subtables {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.growth-scope-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.growth-segment-btn {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  padding: 0;
  font: inherit;
}

.growth-marketplace-btn {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  padding: 0;
  font: inherit;
}

.growth-marketplace-btn.active {
  font-weight: 700;
}

.growth-sku-panel {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}


.growth-sku-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: var(--fs-11);
}

.growth-sku-actions {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.growth-sku-meta {
  color: var(--muted);
  font-size: var(--fs-11);
}

.diagnostics-panel {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.diagnostics-kpi {
  font-size: var(--fs-exact-16);
  margin-bottom: 8px;
}

.diagnostics-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.diagnostics-chip {
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--text-dark);
  font-weight: 600;
  font-size: var(--fs-11);
}

.diagnostics-waterfall {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.diagnostics-bar {
  min-height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dark-strong);
  font-size: var(--fs-11);
  font-weight: 600;
}

.diag-price { background: #f59e0b; }
.diag-volume { background: #3b82f6; }
.diag-assortment { background: #22c55e; }
.diag-margin { background: #a855f7; }

.diagnostics-bar.is-negative {
  filter: brightness(0.75);
}

.diagnostics-note {
  color: var(--muted);
  font-size: var(--fs-11);
}

.diagnostics-chip,
.diagnostics-bar {
  color: var(--text-dark-blue);
}

.risk-summary-badges { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-bottom:10px; }
.risk-badge { padding: 4px 8px; border-radius: 999px; font-weight: 600; font-size: var(--fs-11); }
.risk-badge.high { background: rgba(220,53,69,0.18); }
.risk-badge.medium { background: rgba(255,152,0,0.2); }
.risk-badge.low { background: rgba(255,193,7,0.2); }
.risk-row.severity-high td:first-child { border-left: 3px solid #dc3545; }
.risk-row.severity-medium td:first-child { border-left: 3px solid #ff9800; }
.risk-row.severity-low td:first-child { border-left: 3px solid #ffc107; }
.risk-segment-btn, .risk-marketplace-btn { background:none; border:none; color:var(--primary); cursor:pointer; font:inherit; text-align:left; padding:0; }
.risk-subpanel { margin-top: 10px; }
.risk-list { margin: 6px 0 0; padding-left: 18px; }
.risk-pill { display: inline-block; min-width: 20px; text-align: center; border-radius: 12px; font-size: var(--fs-10); padding: 2px 6px; margin: 0 6px; }
.risk-pill.severity-high { background: #f8d7da; color: var(--text-risk-pill-high); }
.risk-pill.severity-medium { background: #fff3cd; color: var(--text-risk-pill-medium); }
.risk-pill.severity-low { background: #fff8d6; color: var(--text-risk-pill-low); }
.risk-badge.high { color: var(--text-risk-high); }
.risk-badge.medium { color: var(--text-risk-medium); }
.risk-badge.low { color: var(--text-risk-low); }

.data-quality-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  text-decoration: none;
  color: var(--text);
  font-size: var(--fs-11);
}

.data-quality-indicator .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9ca3af;
}

.data-quality-indicator.ok .dot { background: var(--good); }
.data-quality-indicator.fail .dot { background: var(--bad); }
.data-quality-indicator.neutral .dot { background: #9ca3af; }

.math-lab-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.recon-overall-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 700;
  margin-bottom: 12px;
}
.recon-ok { background: color-mix(in srgb, var(--good) 20%, var(--panel) 80%); color: var(--good); }
.recon-fail { background: color-mix(in srgb, var(--bad) 20%, var(--panel) 80%); color: var(--bad); }
.recon-neutral { background: color-mix(in srgb, var(--line) 50%, var(--panel) 50%); color: var(--muted); }
.recon-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.recon-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}
.recon-card h3 { margin: 0 0 8px; text-transform: capitalize; }
.recon-card p { margin: 4px 0; }
.recon-table-panel h3 { margin-top: 0; text-transform: capitalize; }
.recon-fail-row { background: color-mix(in srgb, #ffb4b4 20%, var(--panel) 80%); }

.dq-quick-checks {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.dq-check-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.dq-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 600;
}

.dq-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: dq-spin 0.8s linear infinite;
}

@keyframes dq-spin {
  to { transform: rotate(360deg); }
}

.dq-banner {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 12px;
  background: var(--panel);
}

.dq-banner-ok {
  border-color: color-mix(in srgb, var(--good) 55%, var(--line) 45%);
  background: color-mix(in srgb, var(--panel) 85%, #c9f3df 15%);
}

.dq-banner-fail {
  border-color: color-mix(in srgb, var(--bad) 55%, var(--line) 45%);
  background: color-mix(in srgb, var(--panel) 88%, #ffd9d9 12%);
}

.dq-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.dq-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.dq-card h3 {
  margin: 0 0 8px;
}

.dq-card-status,
.dq-card-meta {
  color: var(--muted);
  margin-top: 4px;
}

.dq-card-ok {
  border-color: color-mix(in srgb, var(--good) 60%, var(--line) 40%);
}

.dq-card-fail {
  border-color: color-mix(in srgb, var(--bad) 60%, var(--line) 40%);
}

.dq-row-rev-diff {
  background: color-mix(in srgb, var(--panel) 85%, #ffd8d8 15%);
}

.dq-row-qty-diff {
  background: color-mix(in srgb, var(--panel) 86%, #ffe6cc 14%);
}

.dq-offenders-panel h3 {
  margin-top: 0;
}

.dq-total-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.dq-total-result {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: var(--panel);
}
.dq-hint {
  margin: 0 0 10px;
  font-size: var(--fs-12);
  color: var(--muted);
}
.dq-check-list {
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: var(--fs-12);
}
.dq-check-ok { color: var(--text); }
.dq-check-fail { color: var(--text-check-fail); }

.dq-total-result-pass {
  border-color: color-mix(in srgb, var(--good) 60%, var(--line) 40%);
  background: color-mix(in srgb, var(--panel) 88%, #cef7e2 12%);
}

.dq-total-result-fail {
  border-color: color-mix(in srgb, var(--bad) 60%, var(--line) 40%);
  background: color-mix(in srgb, var(--panel) 88%, #ffdede 12%);
}

.dq-total-heading {
  margin-bottom: 10px;
}

.dq-total-heading div {
  color: var(--muted);
  margin-top: 4px;
}

.dq-total-pass td:nth-child(2) {
  color: var(--good);
}

.dq-total-fail td:nth-child(2) {
  color: var(--bad);
}

#trendMeta,
#bridgeMeta,
.chart-row .num,
.tooltip-sql {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}


.panel-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

/* Конструктор формул (Math Lab) */
.builder-controls {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}
.builder-controls label { display: flex; align-items: center; gap: var(--space-sm); }
.builder-controls select { min-width: 220px; }
.builder-form {
  display: grid;
  gap: var(--space-md);
  max-width: 560px;
  margin-top: var(--space-lg);
}
.builder-field label { display: block; margin-bottom: var(--space-xs); font-size: var(--fs-11); color: var(--muted); }
.builder-field-hint {
  font-size: var(--fs-10);
  color: var(--muted);
  margin: 0 0 var(--space-xs);
  line-height: 1.35;
}
.builder-field input,
.builder-field select,
.builder-field textarea {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--fs-12);
}
.builder-field textarea { resize: vertical; min-height: 80px; }
.builder-actions { display: flex; align-items: center; gap: var(--space-md); margin-top: var(--space-md); }
.builder-status { font-size: var(--fs-11); color: var(--muted); }
.builder-metrics-list { margin-top: var(--space-lg); display: flex; flex-direction: column; gap: var(--space-sm); }
.builder-metric-item { padding: var(--space-sm); background: var(--panel); border-radius: var(--radius); font-size: var(--fs-12); }
.builder-metric-item code { color: var(--primary); }
.help-meta { color: var(--muted); font-size: var(--fs-11); margin-bottom: var(--space-lg); }

/* Модальное окно справочника полей БД */
.db-fields-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}
.db-fields-modal.hidden { display: none; }
.db-fields-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}
.db-fields-modal-content {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.db-fields-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--line);
}
.db-fields-modal-header h2 { margin: 0; font-size: var(--fs-14); }
.db-fields-modal-close {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-24);
  line-height: 1;
  cursor: pointer;
  border-radius: var(--radius);
}
.db-fields-modal-close:hover { color: var(--text); background: var(--bg); }
.db-fields-modal-desc {
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--fs-11);
  color: var(--muted);
}
.db-fields-used-badge { color: var(--good); }
.db-fields-modal-body {
  overflow-y: auto;
  padding: var(--space-md) var(--space-lg) var(--space-lg);
}
.db-fields-entity {
  margin-bottom: var(--space-lg);
}
.db-fields-entity h3 {
  font-size: var(--fs-12);
  color: var(--primary);
  margin: 0 0 var(--space-sm);
}
.db-fields-entity-desc {
  font-size: var(--fs-10);
  color: var(--muted);
  margin-bottom: var(--space-sm);
}
.db-fields-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-11);
}
.db-fields-table th,
.db-fields-table td {
  padding: var(--space-xs) var(--space-sm);
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.db-fields-table th {
  color: var(--muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
  background: color-mix(in srgb, var(--panel) 90%, var(--line) 10%);
}
.db-fields-table code { color: var(--primary); }
.db-fields-used { color: var(--good); }

/* Reporting v2 (CEO dashboard) */
.rv2-body {
  background: var(--bg);
  color: var(--text);
  --rv2-max-width: 1600px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.rv2-body .page-header.rv2-header {
  position: sticky;
  top: 0;
  z-index: 200;
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  padding-left: 0;
  padding-right: 0;
}
.rv2-header-inner {
  width: 100%;
  max-width: var(--rv2-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-md);
  padding-right: var(--space-md);
  box-sizing: border-box;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px 24px;
}
.rv2-body .container.rv2-page {
  max-width: var(--rv2-max-width);
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  margin-top: var(--space-lg);
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.rv2-header {
  display: block;
}
.rv2-mobile-icon-btn,
.rv2-mobile-period-card,
.rv2-drawer-backdrop {
  display: none;
}
.rv2-title { font-size: var(--fs-18); color: var(--text); text-transform: uppercase; letter-spacing: 0.06em; justify-self: start; }
.rv2-header-controls { gap: 8px; justify-self: end; flex: 0 0 auto; align-items: flex-end; }
.rv2-filter--header { margin-right: 2px; }
.rv2-filter { display: inline-flex; align-items: center; gap: 8px; }
.rv2-filter-label { color: var(--muted); font-size: var(--fs-11); text-transform: uppercase; letter-spacing: 0.05em; }
.rv2-channel-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.rv2-clients-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}
.rv2-clients-filter-tab.active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, var(--panel));
}
.rv2-table tbody tr.rv2-table-row--others td {
  color: var(--muted);
  font-style: italic;
}
.rv2-channel-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-12);
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.rv2-channel-filter input {
  margin: 0;
  accent-color: var(--primary);
}
.rv2-channel-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.rv2-channel-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-12);
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.rv2-channel-filter input {
  margin: 0;
  accent-color: var(--primary);
}
.rv2-select { min-width: 160px; }
.rv2-period-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  color: var(--muted);
}
.rv2-period-meta--header {
  justify-content: center;
  justify-self: center;
  text-align: center;
  min-width: 0;
  font-size: var(--fs-12);
  line-height: var(--lh-normal);
}
.rv2-period-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.rv2-period-meta > span > span {
  color: var(--muted);
}
.rv2-period-meta strong { color: var(--text); font-weight: 600; }
.rv2-page { padding-top: 0; width: 100%; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.rv2-layout { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 14px; align-items: stretch; width: 100%; flex: 1; min-height: 0; }
.rv2-nav { position: sticky; top: calc(var(--rv2-sticky-header-height, 52px) + 12px); display: flex; flex-direction: column; gap: 6px; }
.rv2-nav-group { display: flex; flex-direction: column; gap: 6px; }
.rv2-nav-divider { height: 1px; margin: 6px 0; background: var(--line); }
.rv2-nav-btn { text-align: left; display: inline-flex; align-items: center; gap: 8px; }
.rv2-nav-icon {
  width: 18px;
  flex: 0 0 18px;
  color: var(--primary);
  text-align: center;
}
.rv2-nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rv2-nav-link { display: inline-flex; }
.rv2-content { min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.rv2-section { display: flex; flex-direction: column; gap: 14px; }
.rv2-section--fill { flex: 1; min-height: 0; }
.rv2-panel--fill-table {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.rv2-table-host--fill {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.rv2-table-host--fill .rv2-table-wrap {
  flex: 1;
  min-height: 0;
  max-height: none;
}
.rv2-table--tree .rv2-tree-cell { min-width: 220px; }
.rv2-table--tree thead th:first-child {
  left: 0;
  z-index: 5;
}
.rv2-tree-label-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: calc(var(--rv2-tree-depth, 0) * 18px);
}
.rv2-tree-toggle {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 88%, #000 12%);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  line-height: 1;
  cursor: pointer;
}
.rv2-tree-toggle:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--line) 55%); }
.rv2-tree-toggle-spacer { width: 22px; flex: 0 0 22px; }
.rv2-tree-label { font-weight: 600; }
.rv2-tree-meta { color: var(--muted); font-size: var(--fs-11); font-weight: 400; }
.rv2-tree-row--category .rv2-tree-label { font-weight: 700; }
.rv2-tree-row--sku .rv2-tree-label { font-weight: 600; }
.rv2-tree-row--marketplace .rv2-tree-label { font-weight: 500; color: var(--muted); }
.rv2-section-heading {
  margin: 0;
  font-size: var(--fs-14);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
}
.rv2-kpi-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}
.rv2-kpi-strip--overview { gap: 12px; }
.rv2-kpi-card {
  background: color-mix(in srgb, var(--panel) 90%, #000 10%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  min-height: 96px;
}
.rv2-kpi-card--primary {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--line) 55%);
  background: color-mix(in srgb, var(--panel) 82%, var(--primary) 18%);
}
.rv2-kpi-card--actionable { cursor: pointer; transition: border-color 120ms ease, transform 120ms ease, background 120ms ease; }
.rv2-kpi-card--actionable:hover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--panel) 84%, var(--primary) 16%);
  transform: translateY(-1px);
}
.rv2-kpi-card--actionable:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.rv2-kpi-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: var(--fs-10); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.rv2-kpi-label-text { min-width: 0; overflow-wrap: anywhere; }
.rv2-kpi-value { font-family: var(--font-mono); font-size: var(--fs-18); font-weight: 700; margin-top: 6px; line-height: 1.15; }
.rv2-kpi-card--primary .rv2-kpi-value { font-size: var(--fs-18); }
.rv2-kpi-meta { font-size: var(--fs-11); color: var(--muted); margin-top: 4px; line-height: 1.35; }
.rv2-kpi-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.rv2-sparkline { display: block; flex-shrink: 0; opacity: 0.85; }
.rv2-sparkline-axis { stroke: rgba(209, 213, 219, 0.48); stroke-width: 1; }
.rv2-sparkline--empty { width: 72px; height: 22px; }
.rv2-sparkline-host { position: relative; }
.rv2-sparkline-tip {
  position: absolute; right: 0; top: 100%; z-index: 5;
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
  padding: 4px 6px; font-size: var(--fs-10); white-space: nowrap;
}
.rv2-executive-summary { display: grid; gap: 10px; }
.rv2-executive-summary--empty { padding: 8px 0; }
.rv2-executive-empty-title { font-weight: 600; margin: 0 0 4px; }
.rv2-insight {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; background: color-mix(in srgb, var(--panel) 92%, #000 8%);
}
.rv2-insight--critical { border-left: 3px solid var(--bad); }
.rv2-insight--risk { border-left: 3px solid var(--warn); }
.rv2-insight--opportunity { border-left: 3px solid var(--good); }
.rv2-insight--data_quality { border-left: 3px solid var(--muted); }
.rv2-insight-headline { font-size: var(--fs-13); margin: 0 0 4px; font-weight: 600; }
.rv2-insight-message { font-size: var(--fs-12); color: var(--muted); margin: 0 0 8px; line-height: 1.4; }
.rv2-insight-action {
  font-size: var(--fs-11); color: var(--primary); background: none; border: none;
  padding: 0; cursor: pointer; text-decoration: underline;
}
.rv2-portfolio-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.rv2-portfolio-preset.active { border-color: var(--primary); color: var(--primary); }
.rv2-heatmap-mode-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.rv2-heatmap-mode.active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--panel)); }
.rv2-heatmap-filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 12px;
}
.rv2-heatmap-filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.rv2-heatmap-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.rv2-heatmap-filter-tab.active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, var(--panel));
}
.rv2-heatmap-wrap { overflow: auto; max-height: 70vh; margin-top: 10px; }
.rv2-heatmap-table { border-collapse: separate; border-spacing: 0; font-size: var(--fs-10); width: max-content; min-width: 100%; }
.rv2-heatmap-table th, .rv2-heatmap-table td {
  border: 1px solid var(--line); padding: 4px 6px; text-align: right; white-space: nowrap;
}
.rv2-heatmap-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--panel);
}
.rv2-heatmap-table thead th:first-child {
  left: 0;
  z-index: 4;
}
.rv2-heatmap-row-label {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--panel);
  text-align: left;
  font-weight: 500;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rv2-heatmap-cell { background: var(--rv2-heatmap-bg, transparent); }
.rv2-heatmap-cell--missing { background: var(--rv2-heatmap-missing, #2a2d35); color: var(--muted); font-style: italic; }
.rv2-heatmap-table--cat-mp {
  width: 100%;
  min-width: 100%;
  table-layout: fixed;
}
.rv2-heatmap-table--sku-month {
  --rv2-heatmap-sku-col-w: 180px;
  --rv2-heatmap-mp-col-w: 88px;
  --rv2-heatmap-revenue-col-w: 96px;
  --rv2-heatmap-qty-col-w: 72px;
}
.rv2-heatmap-table--sku-month .rv2-heatmap-col--sku { width: var(--rv2-heatmap-sku-col-w); }
.rv2-heatmap-table--sku-month .rv2-heatmap-col--mp { width: var(--rv2-heatmap-mp-col-w); }
.rv2-heatmap-table--sku-month .rv2-heatmap-col--revenue { width: var(--rv2-heatmap-revenue-col-w); }
.rv2-heatmap-table--sku-month .rv2-heatmap-col--qty { width: var(--rv2-heatmap-qty-col-w); }
.rv2-heatmap-table--sku-month .rv2-heatmap-th--sku,
.rv2-heatmap-table--sku-month .rv2-heatmap-row-label {
  position: sticky;
  left: 0;
  z-index: 4;
  max-width: var(--rv2-heatmap-sku-col-w);
  text-align: left;
}
.rv2-heatmap-table--sku-month .rv2-heatmap-row-label .rv2-tree-label-wrap {
  max-width: 100%;
  min-width: 0;
}
.rv2-heatmap-table--sku-month .rv2-heatmap-row-label .rv2-tree-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rv2-heatmap-table--sku-month .rv2-heatmap-row--marketplace .rv2-tree-label {
  font-weight: 500;
  color: var(--muted);
}
.rv2-heatmap-table--sku-month .rv2-heatmap-row--cabinet .rv2-tree-label {
  font-weight: 600;
}
.rv2-heatmap-table--sku-month .rv2-heatmap-th--mp,
.rv2-heatmap-table--sku-month .rv2-heatmap-mp-col {
  position: sticky;
  left: var(--rv2-heatmap-sku-col-w);
  z-index: 3;
  text-align: left;
  background: color-mix(in srgb, var(--panel) 92%, var(--line) 8%);
  max-width: var(--rv2-heatmap-mp-col-w);
  overflow: hidden;
  text-overflow: ellipsis;
}
.rv2-heatmap-table--sku-month .rv2-heatmap-th--revenue,
.rv2-heatmap-table--sku-month .rv2-heatmap-revenue-col {
  position: sticky;
  left: calc(var(--rv2-heatmap-sku-col-w) + var(--rv2-heatmap-mp-col-w));
  z-index: 3;
  text-align: right;
  background: color-mix(in srgb, var(--panel) 92%, var(--line) 8%);
}
.rv2-heatmap-table--sku-month .rv2-heatmap-th--qty,
.rv2-heatmap-table--sku-month .rv2-heatmap-qty-col {
  position: sticky;
  left: calc(var(--rv2-heatmap-sku-col-w) + var(--rv2-heatmap-mp-col-w) + var(--rv2-heatmap-revenue-col-w));
  z-index: 3;
  text-align: right;
  background: color-mix(in srgb, var(--panel) 92%, var(--line) 8%);
}
.rv2-heatmap-table--sku-month .rv2-heatmap-revenue-col {
  font-weight: 600;
}
.rv2-heatmap-table--sku-month thead .rv2-heatmap-th--sku {
  z-index: 5;
}
.rv2-heatmap-table--sku-month thead .rv2-heatmap-th--mp,
.rv2-heatmap-table--sku-month thead .rv2-heatmap-th--revenue,
.rv2-heatmap-table--sku-month thead .rv2-heatmap-th--qty {
  z-index: 4;
  background: var(--panel);
}
.rv2-heatmap-table--sku-month .rv2-heatmap-th--sku .rv2-heatmap-sort-btn { justify-content: flex-start; }
.rv2-heatmap-table--sku-month .rv2-heatmap-th--revenue .rv2-heatmap-sort-btn,
.rv2-heatmap-table--sku-month .rv2-heatmap-th--qty .rv2-heatmap-sort-btn { justify-content: flex-end; width: 100%; }
.rv2-heatmap-table--cat-mp {
  width: 100%;
  min-width: 100%;
  table-layout: fixed;
}
.rv2-heatmap-table--cat-mp .rv2-heatmap-col--category {
  width: 28%;
}
.rv2-heatmap-table--cat-mp .rv2-heatmap-col--total,
.rv2-heatmap-table--cat-mp .rv2-heatmap-col--mp {
  width: calc(72% / var(--rv2-heatmap-value-cols, 4));
}
.rv2-heatmap-table--cat-mp .rv2-heatmap-row-label {
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rv2-heatmap-table--cat-mp thead th {
  white-space: normal;
  line-height: 1.25;
  vertical-align: bottom;
  overflow-wrap: anywhere;
}
.rv2-heatmap-table--cat-mp .rv2-heatmap-total-col,
.rv2-heatmap-table--cat-mp .rv2-heatmap-mp-col,
.rv2-heatmap-table--cat-mp .rv2-heatmap-th--total,
.rv2-heatmap-table--cat-mp .rv2-heatmap-th--mp {
  text-align: right;
}
.rv2-heatmap-table--cat-mp .rv2-heatmap-th--category,
.rv2-heatmap-table--cat-mp .rv2-heatmap-row-label {
  text-align: left;
}
.rv2-heatmap-table--cat-mp .rv2-heatmap-total-col {
  font-weight: 600;
  color: var(--text);
  background: color-mix(in srgb, var(--panel) 92%, var(--line) 8%);
}
.rv2-heatmap-table--cat-mp tfoot th,
.rv2-heatmap-table--cat-mp tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 3;
  font-weight: 700;
  background: color-mix(in srgb, var(--panel) 88%, var(--line) 12%);
  box-shadow: 0 -1px 0 var(--line);
}
.rv2-heatmap-table--cat-mp tfoot .rv2-heatmap-row-label {
  left: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--panel) 88%, var(--line) 12%);
}
.rv2-heatmap-table--cat-mp tfoot .rv2-heatmap-total-col {
  background: color-mix(in srgb, var(--panel) 84%, var(--line) 16%);
}
.rv2-heatmap-table--cat-mp .rv2-heatmap-sort-btn {
  white-space: normal;
  max-width: 100%;
}
.rv2-heatmap-table .rv2-heatmap-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: none;
  cursor: pointer;
}
.rv2-heatmap-table .rv2-heatmap-sort-btn:hover { color: var(--text); }
.rv2-heatmap-table .rv2-heatmap-th--category .rv2-heatmap-sort-btn { justify-content: flex-start; }
.rv2-heatmap-table .rv2-heatmap-th--total .rv2-heatmap-sort-btn,
.rv2-heatmap-table .rv2-heatmap-th--mp .rv2-heatmap-sort-btn { justify-content: flex-end; width: 100%; }
.rv2-heatmap-legend { display: flex; gap: 10px; align-items: center; margin-top: 8px; font-size: var(--fs-10); flex-wrap: wrap; }
.rv2-heatmap-legend-swatch { display: inline-block; width: 16px; height: 10px; border-radius: 2px; }
.rv2-heatmap-legend-swatch--low { background: rgba(91, 155, 213, 0.2); }
.rv2-heatmap-legend-swatch--high { background: rgba(91, 155, 213, 0.65); }
.rv2-heatmap-legend-swatch--neg { background: rgba(220, 80, 70, 0.55); }
.rv2-heatmap-legend-swatch--warn { background: rgba(212, 150, 44, 0.55); }
.rv2-heatmap-legend-swatch--pos { background: rgba(70, 180, 110, 0.55); }
.rv2-heatmap-legend-swatch--missing { background: #2a2d35; }
.rv2-overview-grid { display: grid; gap: 12px; }
.rv2-overview-grid--main { grid-template-columns: minmax(0, 1.75fr) minmax(280px, 1fr); align-items: stretch; }
.rv2-overview-grid--explain { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rv2-panel--trend { min-height: 420px; }
.rv2-overview-charts { align-items: stretch; }
.rv2-overview-charts > .rv2-panel--trend {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.rv2-overview-charts > .rv2-panel--trend > .rv2-chart-host {
  flex: 1 1 0;
  min-height: 280px;
}
.rv2-overview-charts > .rv2-panel--trend > .rv2-chart-host > .rv2-chart {
  min-height: 0;
  height: 100%;
}
.rv2-overview-charts > .rv2-panel--trend > .rv2-chart-legend {
  flex: 0 0 auto;
}
.rv2-chart--trend { min-height: 360px; }
.rv2-chart--grouped-bars { min-height: 360px; }
.rv2-chart--horizontal { min-height: 480px; }
.rv2-chart--stacked { min-height: 380px; }
.rv2-panel--monthly-mp,
.rv2-panel--planfact { margin-top: 0; }
.rv2-category-charts { margin-bottom: 12px; }
.rv2-chart-legend--wrap { max-height: 120px; overflow-y: auto; }
.rv2-panel--table .rv2-table-wrap { max-height: var(--table-scroll-max-height); }
.rv2-grid { display: grid; gap: 12px; }
.rv2-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rv2-panel { position: relative; padding: 12px; }
.rv2-panel-title { margin: 0 0 10px; font-size: var(--fs-11); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text); }
.rv2-subpanel-title { margin: 14px 0 6px; font-size: var(--fs-11); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text); }
.rv2-chart { width: 100%; display: block; border: 1px solid var(--line); border-radius: var(--radius); background: var(--chart-area-fill, var(--chart-bg)); }
.rv2-chart:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.rv2-period-lock {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 10px;
  padding: 8px 10px;
  border-left: 3px solid var(--primary);
  background: color-mix(in srgb, var(--panel) 82%, var(--primary) 18%);
  color: var(--text);
  font-size: var(--fs-11);
}
.rv2-period-lock span { color: var(--muted); }
.rv2-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  font-size: var(--fs-11);
  color: var(--muted);
}
.rv2-chart-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.rv2-chart-legend-swatch { width: 16px; height: 3px; border-radius: 1px; flex-shrink: 0; }
.rv2-chart-legend-swatch--revenue { background: #f48024; }
.rv2-chart-legend-swatch--gmv { background: #5b9bd5; }
.rv2-chart-legend-swatch--incomplete {
  background-color: #4b5563;
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.35) 0,
    rgba(255, 255, 255, 0.35) 2px,
    transparent 2px,
    transparent 6px
  );
}
.rv2-chart-legend-swatch--line {
  width: 18px;
  height: 0;
  border-top: 2px solid #9aa0a6;
  border-radius: 0;
  background: transparent;
}
.rv2-chart-legend-combo {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  width: 22px;
  flex-shrink: 0;
}
.rv2-chart-legend-combo-bar {
  width: 7px;
  height: 11px;
  border-radius: 1px;
  flex-shrink: 0;
}
.rv2-chart-legend-combo-line {
  flex: 1;
  height: 0;
  border-top: 2px solid;
  border-radius: 0;
  background: transparent;
}
.rv2-chart-host,
.rv2-chart-tooltip-host { position: relative; }
.rv2-chart-host { min-height: 120px; }
.rv2-chart-host--waterfall { margin-top: 20px; }
.rv2-cm3-waterfall-controls {
  display: flex;
  align-items: end;
  gap: 12px;
  margin: 10px 0 6px;
}
.rv2-cm3-waterfall-controls .rv2-filter {
  min-width: 220px;
}
.export-view-actions #rv2Cm3AuditCsv {
  height: 28px;
  padding: 0 10px;
  white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--line) 70%, #6f7c95 30%);
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel) 82%, #101827 18%);
  box-shadow: none;
}
.export-view-actions #rv2Cm3AuditCsv:hover {
  border-color: color-mix(in srgb, var(--primary) 70%, #6f7c95 30%);
  color: var(--primary);
  background: color-mix(in srgb, var(--panel) 82%, #101827 18%);
}
.export-view-actions #rv2Cm3AuditCsv:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: none;
}
.rv2-cm3-status {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: var(--fs-11);
}
.rv2-cm3-status--warning { color: var(--warn); }
.rv2-cm3-status--fail { color: var(--danger); }
.rv2-plan-chart-card { position: relative; }
.rv2-chart-tooltip {
  position: absolute;
  max-width: 260px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel) 94%, #000 6%);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: var(--fs-12);
  line-height: 1.35;
  pointer-events: none;
  z-index: 20;
}
.rv2-chart-tooltip-note {
  color: var(--muted);
  font-size: var(--fs-11);
}
.rv2-chart-crosshair {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
}
.rv2-chart-crosshair__core {
  position: absolute;
  left: var(--crosshair-x);
  top: var(--crosshair-y);
  width: calc(var(--crosshair-arm, 6px) * 2);
  height: calc(var(--crosshair-arm, 6px) * 2);
  transform: translate(-50%, -50%);
}
.rv2-chart-crosshair__core::before,
.rv2-chart-crosshair__core::after {
  content: '';
  position: absolute;
  background: color-mix(in srgb, var(--chart-axis, #9aa4b2) 55%, var(--text) 45%);
}
.rv2-chart-crosshair__core::before {
  left: 50%;
  top: 0;
  width: 1px;
  height: 100%;
  transform: translateX(-50%);
}
.rv2-chart-crosshair__core::after {
  top: 50%;
  left: 0;
  height: 1px;
  width: 100%;
  transform: translateY(-50%);
}
.rv2-chart-crosshair__dash {
  position: absolute;
  pointer-events: none;
  border-color: color-mix(in srgb, var(--chart-axis, #9aa4b2) 55%, var(--text) 45%);
  opacity: 0.85;
}
.rv2-chart-crosshair__dash--v-top {
  left: calc(var(--crosshair-x) - 0.5px);
  top: var(--plot-top);
  width: 0;
  height: max(0px, calc(var(--crosshair-y) - var(--crosshair-arm, 6px) - var(--plot-top)));
  border-left: 1px dashed color-mix(in srgb, var(--chart-axis, #9aa4b2) 55%, var(--text) 45%);
}
.rv2-chart-crosshair__dash--v-bottom {
  left: calc(var(--crosshair-x) - 0.5px);
  top: calc(var(--crosshair-y) + var(--crosshair-arm, 6px));
  width: 0;
  height: max(0px, calc(var(--plot-bottom) - var(--crosshair-y) - var(--crosshair-arm, 6px)));
  border-left: 1px dashed color-mix(in srgb, var(--chart-axis, #9aa4b2) 55%, var(--text) 45%);
}
.rv2-chart-crosshair__dash--h-left {
  top: calc(var(--crosshair-y) - 0.5px);
  left: var(--plot-left);
  height: 0;
  width: max(0px, calc(var(--crosshair-x) - var(--crosshair-arm, 6px) - var(--plot-left)));
  border-top: 1px dashed color-mix(in srgb, var(--chart-axis, #9aa4b2) 55%, var(--text) 45%);
}
.rv2-chart-crosshair__dash--h-right {
  top: calc(var(--crosshair-y) - 0.5px);
  left: calc(var(--crosshair-x) + var(--crosshair-arm, 6px));
  height: 0;
  width: max(0px, calc(var(--plot-right) - var(--crosshair-x) - var(--crosshair-arm, 6px)));
  border-top: 1px dashed color-mix(in srgb, var(--chart-axis, #9aa4b2) 55%, var(--text) 45%);
}
.rv2-chart-host--loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 96%, #000 4%);
}
.rv2-chart-placeholder {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.rv2-plan-charts { display: flex; flex-direction: column; gap: 12px; }
.rv2-plan-chart-card { display: flex; flex-direction: column; gap: 6px; }
.rv2-plan-chart-title {
  margin: 0;
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--text);
  text-transform: none;
  letter-spacing: normal;
}
.rv2-table-wrap { overflow: auto; max-height: var(--table-scroll-max-height); }
.rv2-table { width: 100%; border-collapse: collapse; font-size: var(--fs-12); }
.rv2-table th, .rv2-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.rv2-table th {
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 3;
  color: var(--muted);
  font-size: var(--fs-11);
  text-transform: uppercase;
}
.rv2-header-label,
.rv2-th-content {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: 100%;
}
.rv2-th-content > .rv2-th-btn {
  min-width: 0;
  max-width: calc(100% - 20px);
}
.rv2-table .rv2-th-btn { padding: 0; color: inherit; text-transform: inherit; font-size: inherit; letter-spacing: inherit; }
.rv2-table .rv2-th-btn--multiline {
  display: inline-flex;
  align-items: flex-start;
  gap: 4px;
  white-space: normal;
  text-align: left;
  line-height: 1.25;
}
.rv2-table .rv2-th-btn--multiline .sort-indicator { flex-shrink: 0; margin-top: 1px; }
.rv2-table .rv2-th-btn:hover { color: var(--text); }
.rv2-help-dot {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border: 1px solid color-mix(in srgb, var(--muted) 72%, transparent);
  border-radius: 50%;
  color: var(--muted);
  font-size: var(--fs-9);
  font-weight: 700;
  line-height: 1;
  text-transform: none;
  cursor: help;
}
.rv2-help-dot:hover,
.rv2-help-dot:focus {
  border-color: var(--primary);
  color: var(--primary);
  outline: none;
}
.rv2-help-tooltip {
  position: fixed;
  width: max-content;
  max-width: min(280px, calc(100vw - 16px));
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel) 94%, #000 6%);
  color: var(--text);
  box-shadow: var(--shadow);
  font-family: var(--font-ui);
  font-size: var(--fs-12);
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  text-transform: none;
  white-space: normal;
  z-index: 1000;
  pointer-events: none;
}
.rv2-table tbody tr:hover { background: var(--hover-row); }
.rv2-table tfoot td {
  position: sticky;
  bottom: 0;
  background: color-mix(in srgb, var(--panel) 75%, #c2cee8 25%);
  font-weight: 700;
  border-top: 2px solid var(--line);
  z-index: 1;
}
.rv2-table-footer-label { white-space: nowrap; }
.rv2-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }
.rv2-table .rv2-num { text-align: right; }
.rv2-table--sku-b2b-diy thead th {
  text-align: center;
}
.rv2-table--sku-b2b-diy thead .rv2-th-content {
  justify-content: center;
  width: 100%;
}
.rv2-table--sku-b2b-diy thead .rv2-th-btn {
  justify-content: center;
  text-align: center;
}
.rv2-table--sku-b2b-diy tbody td:not(:first-child),
.rv2-table--sku-b2b-diy tbody td.rv2-num {
  text-align: center;
}
.rv2-section--margin .rv2-table th:not(:first-child),
.rv2-section--margin .rv2-table td:not(:first-child) {
  text-align: center;
}
.rv2-section--margin .rv2-table th:not(:first-child) .rv2-th-content {
  justify-content: center;
  width: 100%;
}
.rv2-share-list { display: flex; flex-direction: column; gap: 8px; }
.rv2-share-row { display: grid; grid-template-columns: minmax(88px, 112px) 1fr 52px; gap: 8px; align-items: center; font-size: var(--fs-12); }
.rv2-share-track { height: 8px; background: #1a1d24; border-radius: 999px; overflow: hidden; }
.rv2-share-bar { height: 100%; width: var(--rv2-share, 0%); background: var(--primary); }
.rv2-share-bar--margin { background: #6ecf8a; }
.rv2-table-wrap--compact { max-height: none; }
.rv2-table-wrap--wide { overflow: auto; }
.rv2-unit-table-wrap {
  max-height: var(--table-scroll-max-height);
  overflow: auto;
}
.rv2-unit-table { min-width: 760px; }
.rv2-unit-table thead th {
  z-index: 3;
}
.rv2-unit-table thead .rv2-unit-metric {
  z-index: 5;
}
.rv2-unit-table .rv2-unit-metric {
  position: sticky;
  left: 0;
  min-width: 280px;
  background: var(--panel);
  z-index: 2;
  white-space: normal;
}
.rv2-unit-table tbody .rv2-unit-metric {
  color: var(--text);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
.rv2-unit-table tbody .rv2-unit-regular-label-row .rv2-unit-metric {
  font-weight: 400;
}
.rv2-unit-table td.rv2-num {
  font-weight: 400;
  color: var(--text);
}
.rv2-unit-metric-content {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}
.rv2-unit-contribution-row .rv2-unit-metric-content {
  padding-left: 18px;
}
.rv2-unit-table tbody td.rv2-unit-metric--sub,
.rv2-unit-table tbody td.rv2-unit-metric--sub .rv2-unit-label,
.rv2-unit-table tbody td.rv2-unit-metric--sub .rv2-unit-metric-content,
.rv2-unit-table tbody .rv2-unit-sub-row .rv2-unit-metric,
.rv2-unit-table tbody .rv2-unit-sub-row .rv2-unit-label,
.rv2-unit-table tbody .rv2-unit-sub-row .rv2-unit-metric-content,
.rv2-unit-table .rv2-unit-sub-row td.rv2-num {
  color: var(--muted);
  font-weight: 400;
}
.rv2-unit-table tbody td.rv2-unit-metric--sub .rv2-unit-metric-content,
.rv2-unit-sub-row .rv2-unit-metric-content {
  padding-left: 18px;
}
.rv2-unit-table .rv2-unit-sub-row .rv2-unit-abs {
  color: var(--muted);
}
.rv2-unit-table tbody td.rv2-unit-metric--sub .rv2-unit-toggle,
.rv2-unit-table tbody .rv2-unit-sub-row .rv2-unit-toggle {
  color: var(--muted);
}
.rv2-unit-table tbody td.rv2-unit-metric--sub .rv2-unit-toggle:hover,
.rv2-unit-table tbody td.rv2-unit-metric--sub .rv2-unit-toggle:focus-visible,
.rv2-unit-table tbody .rv2-unit-sub-row .rv2-unit-toggle:hover,
.rv2-unit-table tbody .rv2-unit-sub-row .rv2-unit-toggle:focus-visible {
  color: var(--primary);
}
.rv2-unit-toggle-slot {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: 24px;
}
.rv2-unit-toggle,
.rv2-unit-toggle-spacer {
  width: 18px;
  height: 18px;
}
.rv2-unit-toggle {
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font: inherit;
  line-height: 16px;
  text-align: center;
  cursor: pointer;
}
.rv2-unit-toggle:hover { color: var(--primary); }
.rv2-unit-toggle-spacer { display: inline-block; }
.rv2-unit-label { min-width: 0; }
.rv2-unit-abs {
  font-style: normal;
  font-weight: 400;
  color: var(--text);
}
.rv2-unit-abs--bold,
.rv2-unit-emphasis-row .rv2-unit-abs {
  font-weight: 700;
}
.rv2-unit-emphasis-row .rv2-unit-metric,
.rv2-unit-cm3-row .rv2-unit-metric {
  font-weight: 700;
}
.rv2-unit-pct {
  font-style: italic;
  font-weight: 400;
  color: var(--muted);
}
.rv2-unit-stacked {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  line-height: 1.2;
}
.rv2-unit-contribution-row td {
  vertical-align: middle;
}
.rv2-unit-child-row td {
  color: var(--muted);
}
.rv2-unit-table tbody .rv2-unit-child-row .rv2-unit-metric,
.rv2-unit-table .rv2-unit-child-row td.rv2-num {
  color: var(--muted);
}
.rv2-unit-table .rv2-unit-child-row .rv2-unit-abs {
  color: var(--muted);
}
.rv2-unit-table tbody .rv2-unit-child {
  font-weight: 500;
}
.rv2-unit-table tbody .rv2-unit-child .rv2-unit-metric-content {
  padding-left: 18px;
}
.rv2-unit-child-marker {
  display: inline-block;
  width: 10px;
  height: 1px;
  background: var(--line);
}
.rv2-unit-prev-col {
  background: color-mix(in srgb, var(--panel) 86%, #6b7280 14%);
  color: var(--muted);
}
.rv2-unit-table .rv2-unit-summary-col {
  background: color-mix(in srgb, var(--panel) 88%, var(--primary) 12%);
  white-space: nowrap;
}
.rv2-unit-table thead .rv2-unit-summary-col {
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
/* P&L по месяцам: chrome как у матрицы план/факт (заливки, линии, sticky, Итого).
   Без внутреннего скролла: таблица растёт по высоте вместе с раскрытыми «+» строками. */
.rv2-unit-pnl-wrap {
  background: var(--table-bg);
  max-height: none;
  overflow: visible;
}
.rv2-unit-pnl-table,
.rv2-unit-pnl-table tbody {
  background: var(--table-data-bg);
}
.rv2-unit-pnl-table {
  table-layout: fixed;
  width: 100%;
  min-width: 960px;
}
.rv2-unit-pnl-table .rv2-unit-metric {
  width: 260px;
}
.rv2-unit-pnl-table thead th:not(.rv2-unit-metric) {
  text-align: center;
  width: 88px;
}
.rv2-unit-pnl-table thead th.rv2-num {
  text-align: center;
}
.rv2-unit-pnl-table tbody td:not(.rv2-unit-metric) {
  width: 88px;
}
.rv2-unit-pnl-table thead th {
  background: var(--table-header-row-bg);
  color: var(--table-header-row-text);
  border-top: 1px solid var(--table-line);
  border-bottom: 1px solid var(--table-line);
}
.rv2-unit-pnl-table thead th:first-child {
  border-left: 1px solid var(--table-line);
}
.rv2-unit-pnl-table th,
.rv2-unit-pnl-table td {
  border-top: 0;
  border-bottom: 0;
}
/* Внутренние вертикальные линии между всеми колонками (как матрица план/факт). */
.rv2-unit-pnl-table thead th:not(:first-child),
.rv2-unit-pnl-table tbody td:not(:first-child) {
  border-left: 1px solid var(--table-line);
}
.rv2-unit-pnl-table tbody td {
  background-color: var(--table-data-bg);
}
.rv2-unit-pnl-table tbody tr:last-child > td:not(.rv2-unit-metric) {
  border-bottom: 1px solid var(--table-line);
}
.rv2-unit-pnl-table tbody tr:last-child > .rv2-unit-metric {
  border-bottom-style: none !important;
  border-bottom-width: 0 !important;
}
.rv2-unit-pnl-table tbody tr > *:last-child,
.rv2-unit-pnl-table thead th:last-child {
  border-right: 1px solid var(--table-line);
}
.rv2-unit-pnl-table .rv2-unit-metric {
  background: var(--table-bg);
  box-shadow: none;
  border-right: 1px solid var(--table-line);
}
.rv2-unit-pnl-table tbody .rv2-unit-metric {
  background-color: var(--table-bg);
  border-left-style: none !important;
  border-left-width: 0 !important;
}
.rv2-unit-pnl-table thead .rv2-unit-metric {
  background: var(--table-header-row-bg);
  color: var(--table-header-row-text);
  border-left: 1px solid var(--table-line);
  z-index: 6;
}
.rv2-unit-pnl-table tbody .rv2-unit-summary-col:not(.rv2-unit-prev-col) {
  background: var(--table-data-bg);
}
.rv2-unit-pnl-table thead .rv2-unit-summary-col {
  background: var(--table-header-row-bg);
  color: var(--table-header-row-text);
  font-weight: inherit;
  text-transform: uppercase;
  letter-spacing: inherit;
  text-align: center;
  width: 88px;
  white-space: normal;
  line-height: 1.25;
}
.rv2-unit-pnl-table .rv2-unit-prev-col {
  background: color-mix(in srgb, var(--table-data-bg) 88%, #4b5563 12%);
}
.rv2-unit-pnl-table thead .rv2-unit-prev-col {
  background: var(--table-header-row-bg);
  color: var(--table-header-row-text);
}
.rv2-unit-pnl-table .rv2-unit-emphasis-row > .rv2-unit-metric,
.rv2-unit-pnl-table .rv2-unit-cm3-row > .rv2-unit-metric {
  color: var(--table-title-row-text);
}
/* Явная заливка ячеек перекрывает tr:hover - подсвечиваем td, включая sticky. */
.rv2-unit-pnl-table tbody tr:hover > td {
  background-color: var(--hover-row);
}
.rv2-unit-pnl-table tbody tr:hover > .rv2-unit-prev-col {
  background-color: color-mix(in srgb, var(--hover-row) 88%, #4b5563 12%);
}
.rv2-marketplace-overview-table th:nth-child(n+2),
.rv2-marketplace-overview-table td:nth-child(n+2) { text-align: right; }
.rv2-marketplace-overview-table th:first-child,
.rv2-marketplace-overview-table td:first-child { text-align: left; }
.rv2-panel--mp-overview { margin-top: 0; }
.rv2-planfact-matrix-host { margin-top: 12px; }
.rv2-section-tabs {
  margin: 12px 0 0;
  flex-wrap: wrap;
}
.rv2-section-tabs--inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
}
.rv2-margin-cluster-wrap {
  /* Высота по контенту; max-height - потолок viewport, не принудительный stretch. */
  height: auto;
  max-height: calc(100dvh - var(--rv2-margin-cluster-offset, 220px));
  overflow: auto;
  background: var(--table-bg);
}
.rv2-margin-cluster-table {
  table-layout: fixed;
  width: 100%;
  background: var(--table-data-bg);
}
.rv2-margin-cluster-table tbody {
  background: var(--table-data-bg);
}
.rv2-margin-cluster-table .rv2-margin-cluster-metric-col {
  width: 240px;
}
.rv2-margin-cluster-table .rv2-margin-cluster-num-col {
  width: 72px;
}
.rv2-margin-cluster-table thead th {
  background: var(--table-header-row-bg);
  color: var(--table-header-row-text);
  border-top: 1px solid var(--table-line);
  border-bottom: 1px solid var(--table-line);
  /* Как .rv2-table th / sticky «Кластер CM3»; не inherit от table (fs-12). */
  font-size: var(--fs-11);
  font-family: inherit;
  font-weight: inherit;
}
.rv2-margin-cluster-table thead th.rv2-num {
  /* Сбрасываем mono (.rv2-num), иначе месяцы визуально крупнее. */
  font-family: inherit;
}
.rv2-margin-cluster-table thead th:first-child {
  border-left: 1px solid var(--table-line);
}
.rv2-margin-cluster-table thead th:not(:first-child) {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
  vertical-align: middle;
  padding-top: 10px;
  padding-bottom: 10px;
}
.rv2-margin-cluster-table th,
.rv2-margin-cluster-table td {
  border-top: 0;
  border-bottom: 0;
}
.rv2-margin-cluster-table thead th:not(:first-child),
.rv2-margin-cluster-table tbody td:not(:first-child),
.rv2-margin-cluster-table tfoot td:not(:first-child) {
  border-left: 1px solid var(--table-line);
  white-space: nowrap;
}
.rv2-margin-cluster-table tbody td {
  background-color: var(--table-data-bg);
}
.rv2-margin-cluster-table tfoot td {
  background-color: var(--table-data-bg);
  border-top-width: 0 !important;
}
.rv2-margin-cluster-table tfoot tr > td,
.rv2-margin-cluster-table tbody tr:last-child > td {
  border-bottom: 1px solid var(--table-line);
}
.rv2-margin-cluster-table thead th:last-child,
.rv2-margin-cluster-table tbody tr > *:last-child,
.rv2-margin-cluster-table tfoot tr > *:last-child {
  border-right: 1px solid var(--table-line);
}
.rv2-margin-cluster-table .rv2-unit-metric,
.rv2-margin-cluster-table tfoot .rv2-table-footer-label {
  background: var(--table-bg);
  box-shadow: none;
  border-left: 1px solid var(--table-line);
  border-right: 1px solid var(--table-line);
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 220px;
}
.rv2-margin-cluster-table tbody .rv2-unit-metric {
  background-color: var(--table-bg);
}
.rv2-margin-cluster-table thead .rv2-unit-metric {
  background: var(--table-header-row-bg);
  color: var(--table-header-row-text);
  z-index: 6;
}
.rv2-margin-cluster-table .rv2-margin-cluster-total,
.rv2-margin-cluster-table .rv2-margin-cluster-revenue {
  font-weight: 600;
}
.rv2-margin-cluster-table tfoot .rv2-table-footer-label {
  font-weight: 600;
  color: var(--table-title-row-text);
  z-index: 5;
}
.rv2-margin-cluster-table tfoot td.rv2-num {
  font-weight: 600;
  color: var(--table-title-row-text);
}
.rv2-margin-cluster-table tbody tr:hover > td {
  background-color: var(--hover-row);
}
.rv2-margin-cluster-table tbody tr:hover > .rv2-unit-metric {
  background-color: var(--hover-row);
}
.rv2-section--margin #rv2MarginTabPanel {
  margin-top: 12px;
}
.rv2-table-wrap--matrix {
  max-height: none;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--table-bg);
}
.rv2-planfact-matrix-table,
.rv2-planfact-matrix-table tbody {
  background: var(--table-data-bg);
}
.rv2-planfact-matrix-table thead tr:first-child th {
  top: 0;
  z-index: 4;
  background: var(--table-header-row-bg);
  color: var(--table-header-row-text);
  border-top: 1px solid var(--table-line);
  border-bottom: 1px solid var(--table-line);
}
.rv2-planfact-matrix-table thead tr:first-child th:first-child {
  border-left: 1px solid var(--table-line);
}
.rv2-planfact-matrix-table thead tr:first-child th:last-child {
  border-right: 1px solid var(--table-line);
}
.rv2-planfact-matrix-table thead tr:nth-child(2) th {
  top: var(--rv2-matrix-subhead-top);
  z-index: 3;
  background: var(--table-header-row-bg);
  color: var(--table-header-row-text);
  border-bottom: 1px solid var(--table-line);
}
.rv2-planfact-matrix-table thead tr:nth-child(2) th:last-child {
  border-right: 1px solid var(--table-line);
}
.rv2-planfact-matrix-table thead .rv2-planfact-matrix-month--incomplete {
  background-color: var(--table-header-row-bg);
}
.rv2-planfact-matrix-table th,
.rv2-planfact-matrix-table td {
  white-space: nowrap;
  padding: 4px 6px;
  border-top: 0;
  border-bottom: 0;
}
.rv2-planfact-matrix-table thead th {
  text-align: center;
}
.rv2-planfact-matrix-table thead .rv2-planfact-matrix-mp {
  text-align: left;
  background: var(--table-header-row-bg);
  border-bottom: 1px solid var(--table-line);
}
.rv2-planfact-matrix-table tbody th,
.rv2-planfact-matrix-table tbody td,
.rv2-planfact-matrix-table tfoot td {
  background-color: var(--table-data-bg);
}
.rv2-planfact-matrix-table tfoot td {
  border-top-width: 0 !important;
}
.rv2-planfact-matrix-table tbody tr > *:last-child,
.rv2-planfact-matrix-table tfoot tr > *:last-child {
  border-right: 1px solid var(--table-line);
}
.rv2-planfact-matrix-table td.rv2-planfact-matrix-plan,
.rv2-planfact-matrix-table td.rv2-planfact-matrix-fact {
  font-weight: 200;
}
.rv2-planfact-matrix-table tfoot td.rv2-planfact-matrix-plan,
.rv2-planfact-matrix-table tfoot td.rv2-planfact-matrix-fact {
  font-weight: 200;
}
.rv2-planfact-matrix-mp {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--table-bg);
  min-width: 120px;
  /* Без мягкой тени: она давала чёрный шов справа у sticky-колонки. */
  box-shadow: none;
  border-left: 1px solid var(--table-line);
  border-right: 1px solid var(--table-line);
}
.rv2-planfact-matrix-table .rv2-table-row--regular > .rv2-planfact-matrix-mp {
  padding-left: 24px;
}
.rv2-planfact-matrix-table .rv2-table-row--regular > td.rv2-planfact-matrix-plan:not(.rv2-planfact-matrix-total-start) {
  color: var(--table-header-row-text);
  font-weight: 100;
}
.rv2-planfact-matrix-table tbody .rv2-table-row--regular > th,
.rv2-planfact-matrix-table tbody .rv2-table-row--regular > td {
  padding-top: 2px;
  padding-bottom: 2px;
  line-height: 1.15;
}
.rv2-planfact-matrix-table tbody .rv2-planfact-matrix-mp {
  background-color: var(--table-bg);
}
/* Явная заливка ячеек перекрывает tr:hover - подсвечиваем th/td, включая sticky. */
.rv2-planfact-matrix-table tbody tr:not(.rv2-planfact-matrix-spacer):hover > th,
.rv2-planfact-matrix-table tbody tr:not(.rv2-planfact-matrix-spacer):hover > td {
  background-color: var(--hover-row);
}
.rv2-planfact-matrix-table tbody tr:not(.rv2-planfact-matrix-spacer):hover > .rv2-planfact-matrix-month--incomplete {
  background-color: color-mix(in srgb, var(--hover-row) 88%, #4b5563 12%);
}
.rv2-planfact-matrix-table .rv2-table-row--title > th,
.rv2-planfact-matrix-table .rv2-table-row--title > td {
  color: var(--table-title-row-text);
}
/* Выше specificity, чем `thead tr:first-child th` (z-index: 4), иначе месяцы рисуются поверх sticky-колонки. */
.rv2-planfact-matrix-table thead tr:first-child th.rv2-planfact-matrix-mp {
  z-index: 6;
}
.rv2-planfact-matrix-table tfoot .rv2-table-footer-label {
  position: sticky;
  left: 0;
  z-index: 5;
  min-width: 120px;
  background: var(--table-bg);
  box-shadow: none;
  border-left: 1px solid var(--table-line);
  border-right: 1px solid var(--table-line);
}
.rv2-planfact-matrix-section th,
.rv2-planfact-matrix-section td {
  padding-top: 3px;
  padding-bottom: 3px;
  font-weight: 700;
  text-align: left;
}
.rv2-planfact-matrix-table tbody .rv2-planfact-matrix-spacer td {
  height: 4px;
  padding: 0;
  background-color: var(--table-data-bg);
}
.rv2-planfact-matrix-table tbody .rv2-planfact-matrix-spacer .rv2-planfact-matrix-mp {
  background-color: var(--table-bg);
}
.rv2-planfact-matrix-subtotal td {
  font-weight: 700;
}
.rv2-planfact-matrix-subtotal td.rv2-planfact-matrix-plan,
.rv2-planfact-matrix-subtotal td.rv2-planfact-matrix-fact {
  font-weight: 700;
}
.rv2-planfact-matrix-month {
  text-align: center;
  border-left: 1px solid var(--table-line);
}
.rv2-planfact-matrix-month-start,
.rv2-planfact-matrix-table td.rv2-planfact-matrix-month-start,
.rv2-planfact-matrix-table th.rv2-planfact-matrix-month-start {
  border-left: 1px solid var(--table-line);
}
.rv2-planfact-matrix-total,
.rv2-planfact-matrix-total-start,
.rv2-planfact-matrix-table td.rv2-planfact-matrix-total-start,
.rv2-planfact-matrix-table th.rv2-planfact-matrix-total-start {
  border-left: 1px solid var(--table-line);
}
.rv2-planfact-matrix-month--incomplete {
  background-color: color-mix(in srgb, var(--table-data-bg) 88%, #4b5563 12%);
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.12) 0,
    rgba(255, 255, 255, 0.12) 2px,
    transparent 2px,
    transparent 6px
  );
}
.rv2-planfact-matrix-legend { margin-top: 8px; }
.rv2-planfact-table td { vertical-align: middle; }
.rv2-planfact-cell { display: flex; flex-direction: column; gap: 4px; min-width: 88px; }
.rv2-planfact-track { margin-top: 2px; }
.rv2-planfact-bar.rv2-signal-bad { background: var(--bad); }
.rv2-planfact-bar.rv2-signal-warn { background: #d4a72c; }
.rv2-planfact-bar.rv2-signal-good { background: var(--good); }
.rv2-row-anomaly { background: color-mix(in srgb, var(--bad) 8%, transparent); }
.rv2-cell-above-avg {
  background: color-mix(in srgb, var(--warn) 28%, transparent);
  color: var(--text-warning);
  font-weight: 600;
}
.rv2-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: var(--fs-10);
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
}
.rv2-badge--anomaly { color: var(--text-inverse); background: var(--bad); }
.rv2-signals-group { margin-bottom: 10px; }
.rv2-signals-group-title {
  font-size: var(--fs-10);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  font-weight: 700;
}
.rv2-panel--signals .rv2-alerts { margin: 0; padding-left: 18px; }
.rv2-dq-status {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-11);
  font-family: var(--font-mono);
  color: var(--muted);
}
.rv2-signal-warn { color: var(--text-warning); }
.rv2-muted { color: var(--muted); }
.rv2-recon { margin: 10px 0 0; font-size: var(--fs-11); font-family: var(--font-mono); }
.rv2-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-12);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 92%, #000 8%);
}
.rv2-breadcrumb-clear { margin-left: auto; }
.rv2-hint { margin: 0 0 8px; font-size: var(--fs-11); color: var(--muted); }
.rv2-table-row--clickable { cursor: pointer; }
.rv2-table tbody tr.rv2-table-row--clickable:hover { background: color-mix(in srgb, var(--hover-row) 70%, var(--primary) 30%); }
.rv2-table tbody tr.rv2-table-row--active { background: color-mix(in srgb, var(--hover-row) 55%, var(--primary) 45%); }
.rv2-margin-sku-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}
.rv2-margin-sku-layout--split {
  grid-template-columns: 3fr 2fr;
}
.rv2-margin-sku-charts {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 96%, #000 4%);
  padding: 12px;
}
.rv2-margin-sku-charts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.rv2-margin-sku-charts-heading {
  margin: 0;
  font-size: var(--fs-14);
  font-weight: 600;
}
.rv2-margin-sku-charts-close {
  min-width: 32px;
  padding: 4px 10px;
  font-size: var(--fs-exact-18);
  line-height: 1;
}
.rv2-margin-sku-chart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.rv2-margin-sku-chart-card {
  min-width: 0;
}
.rv2-margin-sku-chart-title {
  margin: 0 0 6px;
  font-size: var(--fs-12);
  color: var(--muted);
  font-weight: 600;
}
.rv2-margin-sku-table { min-width: 0; }
.rv2-margin-sku-table .rv2-table-wrap {
  max-height: var(--table-scroll-max-height);
  overflow: auto;
}
.rv2-error-inline { color: var(--bad); font-size: var(--fs-12); margin: 8px 0; }
.rv2-bubble-wrap {
  position: relative;
  min-height: 480px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 92%, #000 8%);
}
.rv2-bubble-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-bottom: 10px;
}
.rv2-bubble-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.rv2-bubble-select { min-width: 220px; }
.rv2-bubble-axis-error {
  margin: 0 0 10px;
  color: var(--text-error);
  font-size: var(--fs-12);
}
.rv2-bubble-axis-error.hidden { display: none; }
.rv2-bubble-canvas { width: 100%; height: 480px; display: block; border: 0; border-radius: var(--radius); background: transparent; }
.rv2-bubble-tooltip {
  position: absolute;
  z-index: 3;
  max-width: 280px;
  padding: 8px 10px;
  font-size: var(--fs-11);
  line-height: 1.45;
  color: var(--text);
  background: color-mix(in srgb, var(--panel) 88%, #000 12%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.rv2-bubble-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  font-size: var(--fs-11);
  color: var(--muted);
}
.rv2-bubble-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.rv2-bubble-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #7aa2f7;
  flex-shrink: 0;
}
.rv2-bubble-legend-dot--y { border-radius: 2px; height: 3px; width: 14px; background: #cad6ea; }
.rv2-bubble-legend-dot--size { width: 14px; height: 14px; background: rgba(122, 162, 247, 0.45); border: 1px solid rgba(176, 204, 255, 0.85); }
.rv2-signal-good { color: var(--good); }
.rv2-signal-bad { color: var(--bad); }
.rv2-signal-neutral { color: var(--muted); }
.rv2-empty, .rv2-error { padding: 16px; color: var(--muted); }
.rv2-error { color: var(--bad); border-color: var(--bad); }

/* Login */
.login-body {
  min-height: 100vh;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--line) 42%, transparent) 1px, transparent 1px),
    linear-gradient(180deg, color-mix(in srgb, var(--line) 34%, transparent) 1px, transparent 1px),
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 8%, transparent), transparent 36%),
    var(--bg);
  background-size: 44px 44px, 44px 44px, 100% 100%, auto;
  color: var(--text);
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-shell {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 18px;
  align-items: stretch;
}

.login-hero,
.login-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 92%, #000 8%);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.login-hero {
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 2px solid color-mix(in srgb, var(--primary) 70%, transparent);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 14%, transparent), transparent 42%),
    linear-gradient(0deg, color-mix(in srgb, #5b9bd5 8%, transparent), transparent 34%);
  pointer-events: none;
}

.login-brand {
  position: relative;
  z-index: 1;
}

.login-kicker,
.login-panel-label,
.login-field span {
  font-family: var(--font-cond);
  font-size: var(--fs-11);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-kicker {
  display: inline-flex;
  padding: 5px 8px;
  border: 1px solid color-mix(in srgb, var(--primary) 52%, var(--line) 48%);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.login-brand h1 {
  margin: 18px 0 10px;
  font-size: clamp(25px, 4.67vw, 51px);
  line-height: 0.95;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-copy {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-14);
  line-height: 1.5;
}

.login-panel {
  padding: 18px;
  align-self: center;
}

.login-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 18px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.login-field span {
  color: var(--muted);
}

.login-field input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 84%, #000 16%);
  color: var(--text);
  font: 600 var(--fs-14)/var(--lh-normal) var(--font-ui);
  padding: 9px 10px;
}

.login-field input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--primary) 70%, var(--line) 30%);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 32%, transparent);
}

.login-message {
  margin: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: var(--fs-12);
}

.login-message--error {
  border-color: color-mix(in srgb, var(--bad) 70%, var(--line) 30%);
  color: var(--text-error-soft);
  background: color-mix(in srgb, var(--bad) 12%, transparent);
}

.login-message--ok {
  border-color: color-mix(in srgb, var(--good) 70%, var(--line) 30%);
  color: var(--text-success-soft);
  background: color-mix(in srgb, var(--good) 12%, transparent);
}

.login-submit {
  width: 100%;
  min-height: 42px;
  margin-top: 2px;
}

@media (max-width: 1280px) {
  .rv2-kpi-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .rv2-overview-grid--main { grid-template-columns: 1fr; }
}

.rv2-hint--merge { margin: 0; color: var(--muted); }
.rv2-hint--legend { margin: 8px 0 0; }
.rv2-merge-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: 12px; align-items: start; }
.rv2-merge-list { display: flex; flex-direction: column; gap: 10px; }
.rv2-merge-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: color-mix(in srgb, var(--panel) 94%, #000 6%); }
.rv2-merge-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.rv2-merge-card-title { margin: 0; font-size: var(--fs-12); font-weight: 600; color: var(--text); text-transform: none; letter-spacing: normal; }
.rv2-merge-card-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: var(--fs-12); }
.rv2-merge-form { display: flex; flex-direction: column; gap: 12px; }
.rv2-merge-field { display: flex; flex-direction: column; gap: 6px; }
.rv2-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font: inherit;
}
.rv2-merge-picker {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 360px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 96%, #000 4%);
}
.rv2-merge-option { display: flex; align-items: flex-start; gap: 8px; font-size: var(--fs-12); color: var(--text); cursor: pointer; }
.rv2-merge-option input { margin-top: 2px; }
.rv2-merge-error { margin: 0; color: var(--text-error); font-size: var(--fs-12); }
.rv2-merge-error.hidden { display: none; }

.rv2-settings-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: var(--fs-12);
  color: var(--text);
  cursor: pointer;
}

.rv2-settings-option input { margin-top: 2px; }

.rv2-settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.rv2-settings-tab-panel.hidden { display: none; }
.rv2-refresh-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
}
.rv2-refresh-command {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}
.rv2-refresh-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--space-md);
  margin: var(--space-lg) 0 0;
}
.rv2-refresh-status-grid div {
  min-width: 0;
  padding: var(--space-sm) 0;
  border-top: 1px solid var(--line);
}
.rv2-refresh-status-grid dt {
  color: var(--muted);
  font-size: var(--fs-11);
}
.rv2-refresh-status-grid dd {
  margin: var(--space-xs) 0 0;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.rv2-refresh-errors {
  margin: var(--space-md) 0 0;
  padding-left: var(--space-lg);
  color: var(--bad);
  font-size: var(--fs-11);
}
.rv2-typography-form {
  display: grid;
  gap: var(--space-lg);
}
.rv2-typography-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-md) var(--space-lg);
}
.rv2-typography-grid--fonts {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.rv2-typography-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  min-width: 0;
}
.rv2-typography-field--wide .rv2-hint {
  min-height: 2.4em;
  margin: 0;
}
.rv2-typography-size-control,
.rv2-typography-color-control {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.rv2-typography-size-control .rv2-input {
  max-width: 110px;
}
.rv2-typography-color {
  width: 48px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  cursor: pointer;
}
.rv2-typography-color-control output {
  font-family: var(--font-mono);
  color: var(--muted);
}
.rv2-typography-preview {
  font-family: var(--font-ui);
}
.rv2-typography-preview-title {
  margin: 0 0 var(--space-md);
  font-family: var(--font-cond);
  font-size: var(--fs-16);
  color: var(--text);
}
.rv2-typography-preview p {
  margin: var(--space-xs) 0;
}
.rv2-typography-preview .text-positive,
.rv2-typography-preview .text-negative {
  margin-right: var(--space-md);
}
.rv2-typography-preview-risk {
  color: var(--risk);
  margin-right: var(--space-md);
}
.rv2-typography-preview-block {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--line);
}
.rv2-typography-preview-block:first-of-type {
  margin-top: var(--space-md);
  padding-top: 0;
  border-top: 0;
}
.rv2-typography-preview-ui {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-sm);
}
.rv2-typography-preview-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-top: var(--space-md);
}
.rv2-typography-preview-inputs .rv2-input {
  max-width: 220px;
}
.rv2-typography-preview-surface {
  margin-top: var(--space-md);
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
}
.rv2-typography-preview-table {
  width: 100%;
  margin-top: var(--space-md);
  border-collapse: collapse;
  font-size: var(--fs-11);
  background: var(--table-bg);
}
.rv2-typography-preview-table th,
.rv2-typography-preview-table td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.rv2-typography-preview-table th {
  background: var(--table-header-row-bg);
  color: var(--table-header-row-text);
  font-family: var(--font-cond);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rv2-typography-preview-table tbody td {
  background: var(--table-data-bg);
}
.rv2-typography-preview-table tbody td:first-child {
  background: var(--table-bg);
}
.rv2-typography-preview-table .rv2-table-row--title td {
  color: var(--table-title-row-text);
  font-weight: 700;
}
.rv2-typography-preview-table .rv2-table-row--regular td:first-child {
  padding-left: 24px;
}
.rv2-typography-preview-row-hover {
  background: var(--hover-row);
}
.rv2-typography-preview-row-hover td:not(:first-child) {
  background: var(--hover-row);
}
.rv2-typography-preview-chart-wrap {
  margin-top: var(--space-sm);
}
.rv2-typography-preview-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}
.rv2-typography-preview-swatch {
  width: 28px;
  height: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--chart-series-1);
}
.rv2-typography-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
  padding: var(--space-md);
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
}

.rv2-admin-form {
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.rv2-admin-form-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.rv2-admin-table .rv2-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.rv2-admin-btn {
  font-size: var(--fs-11);
  padding: 4px 8px;
}

.rv2-admin-btn--danger {
  border-color: var(--bad);
  color: var(--bad);
}

.rv2-activity-pages {
  min-width: 220px;
}

.rv2-activity-page-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: var(--fs-11);
  line-height: 1.4;
}

.rv2-activity-path {
  color: var(--muted);
  word-break: break-all;
}

.rv2-activity-count {
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

@media (max-width: 960px) {
  .login-shell { grid-template-columns: 1fr; }
  .rv2-layout { grid-template-columns: 1fr; }
  .rv2-merge-layout { grid-template-columns: 1fr; }
  .rv2-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .rv2-nav-divider { flex-basis: 100%; margin: 4px 0; }
  .rv2-grid--2 { grid-template-columns: 1fr; }
  .rv2-overview-grid--explain { grid-template-columns: 1fr; }
  .rv2-kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rv2-header-inner { grid-template-columns: 1fr; }
  .rv2-period-meta--header { order: 3; width: 100%; justify-self: stretch; }
  .rv2-header-controls { order: 2; justify-self: stretch; }
  .rv2-header-controls .header-actions { justify-content: flex-end; width: 100%; }
}

@media (max-width: 720px) {
  .rv2-body {
    --rv2-mobile-header-height: 58px;
    overflow-x: hidden;
    background: #07080b;
  }

  .rv2-body .page-header.rv2-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--rv2-mobile-header-height);
    max-width: none;
    padding: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--line) 82%, #fff 18%);
    background: color-mix(in srgb, var(--bg) 94%, #000 6%);
    box-shadow: 0 10px 24px rgb(0 0 0 / 35%);
  }

  .rv2-header-inner {
    height: 100%;
    max-width: none;
    padding-left: 12px;
    padding-right: 12px;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 8px;
  }

  .rv2-header {
    height: 100%;
  }

  .rv2-mobile-icon-btn {
    display: inline-flex;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: var(--fs-22);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .rv2-mobile-icon-btn:active {
    background: color-mix(in srgb, var(--panel) 72%, #fff 8%);
  }

  .rv2-mobile-menu-btn {
    justify-self: start;
  }

  .rv2-mobile-refresh-btn {
    justify-self: end;
  }

  .rv2-refresh-icon {
    display: inline-block;
    transform-origin: center;
  }

  .rv2-is-loading .rv2-refresh-icon {
    animation: rv2-refresh-spin 0.8s linear infinite;
  }

  .rv2-title {
    justify-self: center;
    font-size: var(--fs-15);
  }

  .rv2-period-meta--header,
  .rv2-header-controls {
    display: none;
  }

  .rv2-body .container.rv2-page {
    max-width: none;
    margin-top: 0;
    padding: calc(var(--rv2-mobile-header-height) + 14px) 16px 28px;
    box-sizing: border-box;
  }

  .rv2-mobile-period-card {
    display: block;
    margin-bottom: 16px;
    padding: 14px;
    border: 1px solid color-mix(in srgb, var(--line) 82%, #fff 12%);
    border-radius: 8px;
    background: color-mix(in srgb, var(--panel) 88%, #000 12%);
    box-shadow: 0 12px 30px rgb(0 0 0 / 24%);
  }

  .rv2-mobile-period-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
  }

  .rv2-mobile-period-label {
    display: grid;
    gap: 6px;
    min-width: 0;
  }

  .rv2-mobile-period-eyebrow {
    color: var(--muted);
    font-size: var(--fs-12);
    text-transform: uppercase;
  }

  .rv2-mobile-period-select {
    min-width: 0;
    width: 100%;
    height: 44px;
    border-radius: 8px;
    font-size: var(--fs-14);
  }

  .rv2-mobile-period-refresh {
    min-width: 44px;
    height: 44px;
    border-radius: 8px;
    white-space: nowrap;
  }

  .rv2-period-meta--mobile {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
    font-size: var(--fs-11);
  }

  .rv2-period-meta--mobile > span {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--bg) 54%, var(--panel) 46%);
  }

  .rv2-period-meta--mobile strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .rv2-mobile-loading {
    display: block;
    margin-top: 10px;
    font-size: var(--fs-11);
  }

  .rv2-mobile-loading.hidden {
    display: none;
  }

  .rv2-layout {
    display: block;
    min-height: 0;
  }

  .rv2-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 240;
    display: block;
    background: rgb(0 0 0 / 52%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
  }

  .rv2-drawer-open .rv2-drawer-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .rv2-nav {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 260;
    width: min(84vw, 320px);
    height: 100dvh;
    box-sizing: border-box;
    padding: 18px 14px max(18px, env(safe-area-inset-bottom));
    transform: translateX(-104%);
    transition: transform 0.22s ease;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-right: 1px solid color-mix(in srgb, var(--line) 84%, #fff 14%);
    background: color-mix(in srgb, var(--panel) 92%, #000 8%);
    box-shadow: 20px 0 38px rgb(0 0 0 / 45%);
  }

  .rv2-drawer-open .rv2-nav {
    transform: translateX(0);
  }

  .rv2-nav::before {
    content: "RITTER";
    display: block;
    padding: 4px 8px 14px;
    color: var(--text);
    font-weight: 700;
    text-transform: uppercase;
  }

  .rv2-nav-group {
    gap: 8px;
  }

  .rv2-nav-group--footer {
    margin-top: auto;
  }

  .rv2-nav-divider {
    flex-basis: auto;
    margin: 4px 0;
  }

  .rv2-nav-btn {
    width: 100%;
    min-height: 44px;
    justify-content: flex-start;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: var(--fs-14);
  }

  .rv2-nav-icon {
    width: 22px;
    flex-basis: 22px;
  }

  .rv2-content {
    min-height: 0;
  }

  .rv2-section {
    gap: 24px;
  }

  .rv2-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .rv2-kpi-strip--overview {
    gap: 16px;
  }

  .rv2-kpi-card {
    min-height: 150px;
    padding: 16px;
    border: 0;
    border-radius: 8px;
    background: color-mix(in srgb, var(--panel) 88%, #000 12%);
  }

  .rv2-kpi-card--primary {
    background: color-mix(in srgb, var(--panel) 78%, var(--primary) 12%);
  }

  .rv2-kpi-label {
    font-size: var(--fs-12);
    line-height: 1.25;
    letter-spacing: 0;
  }

  .rv2-kpi-value,
  .rv2-kpi-card--primary .rv2-kpi-value {
    margin-top: 12px;
    font-size: var(--fs-32);
    line-height: 1.05;
    overflow-wrap: anywhere;
  }

  .rv2-kpi-meta {
    margin-top: 8px;
    font-size: var(--fs-12);
    line-height: 1.35;
  }

  .rv2-help-dot {
    min-width: 22px;
    min-height: 22px;
  }

  .rv2-grid,
  .rv2-grid--2,
  .rv2-overview-grid--main,
  .rv2-overview-grid--explain {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .rv2-panel {
    padding: 16px;
    border-radius: 8px;
  }

  .rv2-panel--trend {
    min-height: 320px;
  }

  .rv2-overview-charts > .rv2-panel--trend > .rv2-chart-host {
    min-height: 260px;
  }

  .rv2-chart--trend,
  .rv2-chart--grouped-bars,
  .rv2-chart--stacked {
    min-height: 260px;
  }

  .rv2-chart--horizontal {
    min-height: 340px;
  }

  .rv2-hint {
    font-size: var(--fs-12);
    line-height: 1.45;
  }

  .rv2-table-wrap,
  .rv2-planfact-matrix-scroll,
  .rv2-unit-table-wrap {
    max-height: none;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 380px) {
  .rv2-kpi-value,
  .rv2-kpi-card--primary .rv2-kpi-value {
    font-size: var(--fs-28);
  }
}

@media (max-width: 720px) {
  .rv2-typography-actions {
    position: static;
  }
}

@keyframes rv2-refresh-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Единый контракт существующих границ во всех HTML-таблицах. */
:where(table, table thead, table tbody, table tfoot, table tr, table th, table td) {
  border-color: var(--table-line) !important;
  border-width: 1px !important;
}
