:root {
  --primary: #166534;
  --secondary: #1F7A41;
  --bg: #FFFFFF;
  --text-main: #111827;
  --text-muted: #667085;
  --ui-1: #F4F6FA;
  --ui-2: #D7DEE8;
  --soft: #E8F4EC;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --text-strong: #0F172A;
  --text-subtle: #64748B;
  --accent-blue: #4F79D8;
  --accent-cyan: #2EAAA8;
  --accent-violet: #7B61C9;
  --accent-rose: #CF6E8B;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: var(--ui-1);
  color: var(--text-main);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden; /* убираем микроскопический 2-й горизонтальный скролл */
  overflow-y: hidden; /* скролл только в контентной области */
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(180deg, #f4f6fa 0%, #eef2f7 100%);
}

.auth-card {
  width: min(100%, 420px);
  border: 1px solid #e3e8ef;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.12);
  padding: 22px 20px 20px;
}

.auth-logo {
  width: 136px;
  height: auto;
  display: block;
  margin: 0 auto 10px;
}

.auth-title {
  margin: 0;
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
}

.auth-subtitle {
  margin: 6px 0 14px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
}

.auth-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  padding: 4px;
  border: 1px solid #e3e8ef;
  border-radius: 12px;
  background: #eef2f7;
}

.auth-tab {
  flex: 1 1 50%;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #334155;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.auth-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.auth-error {
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 13px;
  font-weight: 700;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.auth-input {
  height: 42px;
  border: 1px solid #dce3ec;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
  background: #ffffff;
  outline: none;
}

.auth-input:focus {
  border-color: #bfc9d8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.16);
}

.auth-submit {
  margin-top: 8px;
  height: 42px;
  border: 1px solid var(--primary);
  border-radius: 10px;
  background: var(--primary);
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.auth-submit:hover {
  background: var(--secondary);
  border-color: var(--secondary);
}

.app {
  min-height: 100vh;
  height: 100vh;
  display: grid;
  grid-template-columns: 210px 1fr;
  grid-template-rows: auto 1fr;
}

.app-status-rail {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 1400;
  pointer-events: none;
}

.app-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(92vw, 560px);
  padding: 9px 12px;
  border: 1px solid #cfd8e6;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  color: #1e293b;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

.app-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #0ea5e9;
  flex: 0 0 auto;
}

.app-status--busy .app-status-dot {
  animation: app-status-pulse 1.1s ease-in-out infinite;
}

.app-status--success {
  border-color: #b9e3c8;
  background: rgba(237, 252, 242, 0.98);
  color: #14532d;
}

.app-status--success .app-status-dot { background: #15803d; }

.app-status--warn {
  border-color: #f6d99f;
  background: rgba(255, 248, 231, 0.98);
  color: #92400e;
}

.app-status--warn .app-status-dot { background: #d97706; }

.app-status--error {
  border-color: #f1b7b7;
  background: rgba(255, 241, 241, 0.98);
  color: #991b1b;
}

.app-status--error .app-status-dot { background: #dc2626; }

@keyframes app-status-pulse {
  0%, 100% { opacity: 0.5; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1); }
}

.sidebar {
  grid-column: 1;
  grid-row: 2;
  background: transparent;
  border-right: none;
  padding: 10px 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.brand-logo {
  height: 26px;
  width: auto;
  display: block;
}

.brand-logo-side {
  height: 34px;
}

.menu-title {
  margin: 0 0 8px;
  padding: 0;
  font-size: 16px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  transform: translateX(-28px);
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  max-width: 170px;
  transform: translateX(-28px);
}

.menu a {
  text-decoration: none;
  color: #3A3A3A;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.menu a:hover {
  background: #F7F8FA;
}

.menu a.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
  font-weight: 700;
  pointer-events: none;
  cursor: default;
}

.top {
  grid-column: 1 / 3;
  grid-row: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 6px;
  border-bottom: none;
  background: transparent;
}

.top-pills,
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #EEF1F5;
  border: 1px solid #E3E8EF;
  border-radius: 14px;
  padding: 6px;
}

.top-actions {
  background: transparent;
  border-color: transparent;
  padding: 0;
  margin-top: 0;
  margin-right: 14px;
}

.profile-menu {
  position: relative;
}

.profile-trigger {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid #D5DFED;
  padding: 0;
  background: #FFFFFF;
  cursor: pointer;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.profile-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-avatar-placeholder {
  width: 100%;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
  background: #f1f5f9;
  color: #64748b;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: #FFFFFF;
  border: 1px solid #DCE5F1;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  padding: 6px;
  z-index: 80;
}

.profile-dropdown-item {
  width: 100%;
  height: 38px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: #1E293B;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  padding: 0 12px;
  cursor: pointer;
}

.profile-dropdown-item:hover {
  background: #F4F8FF;
  border-color: #D9E4F3;
}

.top-brand-left {
  min-width: 210px;
  display: flex;
  align-items: center;
}

.top-pills-inline {
  margin-top: 4px;
  margin-bottom: 12px;
  width: fit-content;
}

.filters-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.top-meta-slot {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  align-items: center;
}

.top-meta-bar {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-left: -10px;
  width: 100%;
}

.meta-brand-chip {
  height: 68px;
  border: 1px solid #E4EAF2;
  background: #FFFFFF;
  border-radius: 20px;
  padding: 0 18px 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.meta-brand-chip:hover {
  border-color: #D5DEEA;
  background: #FBFDFF;
}

.meta-brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.meta-brand-name {
  color: #1F2A44;
  font-size: 40px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.meta-brand-caret {
  width: 16px;
  height: 16px;
  border-right: 3px solid #94A3B8;
  border-bottom: 3px solid #94A3B8;
  transform: rotate(45deg) translateY(-2px);
  margin-left: 2px;
}

.meta-value-chip {
  height: 42px;
  border: 1px solid #D9E2EF;
  background: #F4F8FF;
  border-radius: 10px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  max-width: 360px;
  overflow: hidden;
  color: #5C6F8D;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.meta-value-chip:hover {
  border-color: #C7D5EA;
  background: #ECF3FF;
}

.meta-dot {
  margin: 0 2px;
  color: #6B7EA0;
  font-size: 18px;
  font-weight: 800;
}

.filters-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.index-status {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #64748b;
  flex: 0 0 auto;
}

.index-status--ready {
  border-color: #0F5D0F;
  background: #ecfdf3;
  color: #0F5D0F;
}

.index-status--busy {
  animation: index-pulse 1.2s ease-in-out infinite;
}

@keyframes index-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.refresh-data-btn {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  border: 1px solid #0F5D0F;
  background: var(--primary);
  color: #ffffff;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.16);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}

.refresh-data-btn img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex: 0 0 auto;
  display: block;
}

.refresh-data-btn:hover {
  border-color: #0F6B0F;
  background: #0F6B0F;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
}

.refresh-data-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.blocking-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.26);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.blocking-overlay-card {
  min-width: 380px;
  background: #ffffff;
  border: 1px solid #d8e1ee;
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.2);
  display: grid;
  grid-template-columns: 24px 1fr;
  column-gap: 12px;
  row-gap: 4px;
  align-items: center;
}

.blocking-spinner {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 3px solid #d8f0df;
  border-top-color: #1f7a41;
  animation: spin .85s linear infinite;
  grid-row: 1 / 3;
}

.blocking-check {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #1f7a41;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
  grid-row: 1 / 3;
}

.blocking-check::before {
  content: "✓";
}

.blocking-title {
  color: #0f172a;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
}

.blocking-subtitle {
  color: #475569;
  font-size: 14px;
  font-weight: 600;
  transition: opacity 0.2s;
}

.blocking-rag-steps {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  max-height: 160px;
  overflow-y: auto;
}

.blocking-rag-step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #334155;
  padding: 3px 0;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.blocking-rag-step.done {
  opacity: 1;
  color: #166534;
}

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

.report-download-wrap {
  position: relative;
}

.report-download-btn {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  border: 1px solid #D8E1EE;
  background: #FFFFFF;
  color: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.report-download-btn svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.report-download-btn:hover {
  background: #F2F6FC;
  border-color: #C5D2E4;
  color: #1E293B;
  transform: translateY(-1px);
}

.report-download-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 170px;
  background: #FFFFFF;
  border: 1px solid #DDE5EF;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  padding: 6px;
  display: none;
  z-index: 60;
}

.report-download-wrap.open .report-download-menu {
  display: block;
}

.report-download-menu-item {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: #111827;
  border-radius: 8px;
  height: 34px;
  padding: 0 10px;
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.report-download-menu-item:hover {
  background: #F2F6FC;
  border-color: #D8E1EE;
}

.page-meaning {
  margin-top: 10px;
  color: var(--text-strong);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.page-meaning-row--seo {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;
  align-items: center;
  gap: 12px 16px;
  margin-top: 10px;
}

.page-meaning-row--seo .page-meaning {
  margin-top: 0;
}

.seo-view-pills,
.seo-source-pills {
  width: fit-content;
  max-width: 100%;
}

.seo-source-pills--hidden {
  display: none;
}

.pill-btn--seo-view {
  font-size: 15px;
  font-weight: 700;
  padding: 10px 16px;
}

.pill-btn--seo-view.active {
  font-weight: 800;
}

/* --- Settings / Goals (goal-config.json) --- */
.main--settings .content--settings {
  max-width: 920px;
}

.settings-card {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px 26px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.04);
}

.settings-card--stretch {
  width: 100%;
}

.settings-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.settings-card-title {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  color: var(--text-strong);
  letter-spacing: -0.3px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 24px;
  margin-bottom: 22px;
}

@media (max-width: 720px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

.settings-field-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.settings-field-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.settings-field-value--strong {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-strong);
}

.settings-block {
  margin-top: 18px;
}

.settings-block--tint {
  background: var(--surface-muted, #f6f8fc);
  border-radius: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
}

.settings-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

@media (max-width: 720px) {
  .settings-split {
    grid-template-columns: 1fr;
  }
}

.settings-block-title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 800;
  color: var(--text-strong);
}

.settings-block-hint {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.settings-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 800;
  color: var(--text-strong);
  background: #e8f5e9;
  border: 1px solid #c8e6c9;
}

.settings-chip--muted {
  background: var(--surface-muted, #f3f5f9);
  border-color: var(--border);
  color: var(--text-muted);
  font-weight: 700;
}

.settings-path-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.settings-path-row {
  display: grid;
  grid-template-columns: minmax(140px, 200px) minmax(0, 1fr);
  gap: 12px 16px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}

@media (max-width: 640px) {
  .settings-path-row {
    grid-template-columns: 1fr;
  }
}

.settings-path-lang {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-flag {
  font-size: 20px;
  line-height: 1;
}

.settings-lang-code {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-strong);
}

.settings-lang-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.settings-path-value {
  min-width: 0;
}

.settings-path-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-strong);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.settings-error {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #b71c1c;
}

.settings-muted {
  margin: 0;
  font-size: 15px;
  color: var(--text-muted);
  font-weight: 600;
}

.settings-user-card {
  margin-top: 14px;
}

.settings-user-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.settings-user-photo {
  width: 84px;
  height: 84px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #f8fafc;
  flex: 0 0 auto;
}

.settings-user-photo.is-hidden {
  display: none;
}

.settings-user-photo--empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 800;
  color: #94a3b8;
}

.settings-user-meta {
  flex: 1 1 auto;
  min-width: 0;
}

.settings-user-photo-form {
  margin-top: 10px;
}

.settings-user-photo-edit {
  display: flex;
  gap: 8px;
  align-items: center;
}

.settings-user-photo-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 38px;
  border: 1px solid #dce3ec;
  border-radius: 10px;
  padding: 5px 8px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  background: #ffffff;
}

.settings-user-photo-input::file-selector-button {
  height: 26px;
  border: 1px solid #dce3ec;
  border-radius: 7px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  padding: 0 8px;
  margin-right: 8px;
  cursor: pointer;
}

.settings-user-photo-save {
  height: 38px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.settings-user-photo-remove {
  height: 38px;
  border: 1px solid #dce3ec;
  background: #f8fafc;
  color: #475569;
  border-radius: 10px;
  padding: 0 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.settings-user-photo-hint,
.settings-user-photo-status {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-row {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 100%;
}

.kpi-row.kpi-row--engagement {
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
}

.kpi-card {
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 12px 14px;
}

.kpi-label {
  margin: 0 0 4px;
  font-size: 17px;
  color: var(--text-subtle);
  font-weight: 600;
}

.kpi-value {
  margin: 0;
  font-size: 32px;
  font-weight: 800;
  color: var(--text-strong);
}

/* SEO KPI: общий режим — 5 карточек, Яндекс/Google — 3 */
.kpi-row.kpi-row--seo {
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
}

.nvr-wrap {
  margin-top: 10px;
  max-width: 100%;
}

.nvr-card {
  background: #FFFFFF;
  border: 1px solid #E5EAF2;
  border-radius: 14px;
  padding: 14px 16px;
}

.nvr-title {
  font-size: 22px;
  font-weight: 800;
  color: #111111;
  margin-bottom: 0;
}

.nvr-table-wrap {
  overflow: auto;
}

.nvr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

.nvr-table th {
  text-align: center;
  font-size: 18px;
  color: #111111;
  font-weight: 900;
  padding: 8px 6px;
  border-bottom: 1px solid #EAEFF6;
}

.nvr-table td {
  padding: 10px 6px;
  border-bottom: 1px solid #F0F3F8;
  color: #111111;
  font-size: 20px;
  font-weight: 800;
  text-align: center;
}

/* Первая колонка — название строки, всегда слева */
.nvr-table th:first-child,
.nvr-table td:first-child {
  text-align: left;
}

.nvr-table tbody tr:last-child td {
  border-bottom: 0;
}

.nvr-num {
  font-weight: 700;
}

.nvr-pct {
  font-weight: 700;
}

.cjm-deep-insights {
  margin-top: 12px;
  max-width: 100%;
}

.cjm-deep-title {
  font-size: 25px;
  font-weight: 900;
  color: var(--text-strong);
  margin-bottom: 10px;
  letter-spacing: -0.2px;
}

.cjm-insights-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.cjm-insights-grid--wide {
  grid-template-columns: 1fr;
}

.cjm-insights-grid + .cjm-insights-grid {
  margin-top: 10px;
}

.cjm-insight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.02);
  display: flex;
  flex-direction: column;
}

/* ── Compact rows: hide rows beyond top-N until card is expanded ── */
.cjm-insight-card .cjm-row-extra {
  display: none !important;
}

.cjm-insight-card.is-expanded .cjm-row-extra {
  display: flex !important;
}

.cjm-insight-card.is-expanded .cjm-rank-item.cjm-row-extra {
  display: grid !important;
}

.cjm-insight-card.is-expanded .cjm-transition-row.cjm-row-extra {
  display: grid !important;
}

.cjm-insight-card.is-expanded tr.cjm-row-extra {
  display: table-row !important;
}

.cjm-card-expand {
  margin-top: auto;
  padding-top: 0;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid #D8E1EE;
  background: #F4F8FC;
  color: #35518A;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.cjm-card-expand:hover {
  background: #E8EFF8;
  border-color: #C5D2E5;
  color: #1F3D77;
}

.cjm-card-expand-chevron {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .2s ease;
}

.cjm-insight-card.is-expanded .cjm-card-expand-chevron {
  transform: rotate(180deg);
}

.cjm-insight-card .cjm-card-expand-less {
  display: none;
}

.cjm-insight-card.is-expanded .cjm-card-expand-more {
  display: none;
}

.cjm-insight-card.is-expanded .cjm-card-expand-less {
  display: inline;
}

.cjm-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.cjm-card-head-main {
  min-width: 0;
}

.cjm-card-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.overview-table-toggle.pill-btn {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.cjm-insight-card-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-strong);
  line-height: 1.25;
}

.cjm-card-caption {
  display: none;
}

.cjm-card-tool-wrap {
  position: relative;
  flex: 0 0 auto;
}

.cjm-card-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid #DEE6F0;
  background: #F8FBFF;
  color: #6C7789;
  border-radius: 8px;
  width: 34px;
  height: 28px;
  font-size: 18px;
  line-height: 1;
  letter-spacing: 0;
  font-weight: 900;
  cursor: pointer;
}

.cjm-card-tool:hover {
  background: #EEF4FB;
  border-color: #CFDCEB;
}

.cjm-card-tool:focus-visible {
  outline: 2px solid #7FB0FF;
  outline-offset: 1px;
}

.cjm-card-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 140px;
  background: #FFFFFF;
  border: 1px solid #DDE5EF;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  padding: 6px;
  display: none;
  z-index: 40;
}

.cjm-card-tool-wrap.open .cjm-card-menu {
  display: block;
}

.cjm-card-menu-item {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: #111827;
  border-radius: 8px;
  height: 34px;
  padding: 0 10px;
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.cjm-card-menu-item:hover {
  background: #F2F6FC;
  border-color: #D8E1EE;
}

.cjm-insight-card--rank {
  background: linear-gradient(180deg, #FFFFFF 0%, #F5FAF6 100%);
}

.cjm-rank-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cjm-rank-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 3px 0;
  min-width: 0;
}

.cjm-rank-label {
  font-size: 20px;
  color: #111111;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.cjm-rank-value {
  font-size: 20px;
  font-weight: 900;
  color: #111111;
}

.cjm-rank-line {
  grid-column: 1 / 3;
  display: block;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #3C8D5A var(--cjm-rank), #E5ECE8 var(--cjm-rank));
}

.cjm-bars-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cjm-bar-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px 0;
  min-width: 0;
}

.cjm-bar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cjm-bar-label {
  font-size: 20px;
  color: #111111;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.cjm-bar-value {
  font-size: 20px;
  font-weight: 900;
  color: #111111;
}

.cjm-bar-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #E6ECE8;
  overflow: hidden;
}

.cjm-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.cjm-bar-fill--blue {
  background: linear-gradient(90deg, #3C8D5A 0%, #58A874 100%);
}

.cjm-bar-fill--teal {
  background: linear-gradient(90deg, #2E7D57 0%, #4F9D77 100%);
}

.cjm-bar-fill--violet {
  background: linear-gradient(90deg, #4B8A66 0%, #71AA87 100%);
}

.cjm-bar-fill--rose {
  background: linear-gradient(90deg, #5A8F72 0%, #79AD90 100%);
}

.cjm-insight-card--routes {
  background: linear-gradient(180deg, #FFFFFF 0%, #F6FAF7 100%);
}

.cjm-routes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cjm-route-item {
  border: 1px solid #E3E9E5;
  background: #FFFFFF;
  border-radius: 10px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: border-color 0.15s ease, transform 0.15s ease;
  min-width: 0;
}

.cjm-route-item:hover {
  border-color: #C9D8CF;
  transform: translateY(-1px);
}

.cjm-route-path {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
}

.cjm-route-chip {
  border: 1px solid #D5E1DA;
  background: #F3F8F4;
  color: #2C5F44;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 18px;
  font-weight: 800;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.cjm-route-sep {
  color: #7A8D81;
  font-weight: 900;
}

.cjm-route-count {
  font-size: 20px;
  font-weight: 900;
  color: #1E3F2D;
}

.cjm-insight-card--heat {
  background: linear-gradient(180deg, #FFFFFF 0%, #F7FAF8 100%);
}

.cjm-heat-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.cjm-heat-row {
  border: 1px solid #DCE6E0;
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background:
    linear-gradient(
      90deg,
      rgba(22, 101, 52, calc(var(--heat) * 0.55)) 0%,
      rgba(22, 101, 52, calc(var(--heat) * 0.25)) 42%,
      rgba(255, 255, 255, 0) 100%
    ),
    #FFFFFF;
  transition: border-color 0.15s ease;
  min-width: 0;
}

.cjm-heat-row:hover {
  border-color: #C8D8CF;
}

.cjm-heat-label {
  color: #111111;
  font-size: 20px;
  font-weight: 800;
}

.cjm-heat-value {
  font-size: 20px;
  font-weight: 900;
  color: #1E3F2D;
}

.cjm-transitions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cjm-transition-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  border: 1px solid #E3E8F0;
  border-radius: 10px;
  padding: 6px 8px;
  background: #F8FBF9;
  transition: border-color 0.15s ease, background 0.15s ease;
  min-width: 0;
}

.cjm-transition-row:hover {
  border-color: #CBD8D0;
  background: #F2F7F4;
}

.cjm-transition-from,
.cjm-transition-to {
  color: #111111;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.cjm-transition-arrow {
  color: #7B8F83;
  font-weight: 900;
}

.cjm-transition-count {
  border: 1px solid #D4DDE9;
  border-radius: 999px;
  padding: 2px 8px;
  font-weight: 900;
  color: #111111;
  background: #F5F8FC;
  font-size: 20px;
}

.cjm-insight-card--time {
  background: linear-gradient(180deg, #FFFFFF 0%, #F6FAFF 100%);
}

.cjm-time-table-wrap {
  overflow-x: auto;
}

.cjm-time-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  min-width: 0;
}

.cjm-time-table th {
  text-align: center;
  font-size: 18px;
  color: #111111;
  font-weight: 900;
  padding: 8px 6px;
  border-bottom: 1px solid #E6EBF2;
  white-space: nowrap;
}

.cjm-time-table td {
  padding: 10px 6px;
  border-bottom: 1px solid #EEF2F7;
  color: #111111;
  font-weight: 800;
  font-size: 20px;
  white-space: normal;
  text-align: center;
}

/* Первая колонка — путь страницы, всегда слева */
.cjm-time-table th:first-child,
.cjm-time-table td:first-child,
.cjm-time-table .cjm-time-page-cell {
  text-align: left;
}

.cjm-time-table td:not(.cjm-time-page-cell) {
  white-space: nowrap;
}

.cjm-time-table tbody tr:last-child td {
  border-bottom: 0;
}

.cjm-time-page-cell {
  max-width: none;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 980px) {
  .cjm-insights-grid {
    grid-template-columns: 1fr;
  }
}

.funnel-wrap {
  margin-top: 10px;
  max-width: 100%;
}

.funnel-card {
  background: #FFFFFF;
  border: 1px solid #E5EAF2;
  border-radius: 14px;
  padding: 14px 16px;
}

.funnel-title {
  font-size: 22px;
  font-weight: 800;
  color: #111111;
  margin-bottom: 0;
}

.funnel-table-wrap {
  overflow: auto;
}

.funnel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

.funnel-table th {
  text-align: center;
  font-size: 18px;
  color: #111111;
  font-weight: 900;
  padding: 8px 6px;
  border-bottom: 1px solid #EAEFF6;
}

.funnel-table td {
  padding: 10px 6px;
  border-bottom: 1px solid #F0F3F8;
  color: #111111;
  font-size: 20px;
  font-weight: 800;
  text-align: center;
}

/* Первая колонка — стадия (пилюля + название), всегда слева */
.funnel-table th:first-child,
.funnel-table td:first-child {
  text-align: left;
}

.funnel-table tbody tr:last-child td {
  border-bottom: 0;
}

.funnel-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  height: 22px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.3px;
  margin-right: 10px;
  color: #FFFFFF;
}

.funnel-pill.pill-red {
  background: #DC2626;
}

.funnel-pill.pill-yellow {
  background: #F59E0B;
  color: #1F2937;
}

.funnel-pill.pill-light-green {
  background: #86EFAC;
  color: #052e16;
}

.funnel-pill.pill-green {
  background: #16A34A;
}

.funnel-num,
.funnel-pct {
  font-weight: 900;
}

.overview-summary {
  margin-top: 10px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.overview-summary-card {
  background: #FFFFFF;
  border: 1px solid #E5EAF2;
  border-radius: 14px;
  padding: 14px 16px;
}

.overview-summary-title {
  font-size: 22px;
  font-weight: 900;
  color: #111111;
  margin-bottom: 0;
}

.overview-summary-table-wrap {
  overflow: auto;
}

.overview-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  min-width: 980px;
}

.overview-summary-table th {
  text-align: center;
  padding: 8px 6px;
  border-bottom: 1px solid #EAEFF6;
  color: #111111;
  font-weight: 900;
  font-size: 18px;
}

.overview-summary-table td {
  padding: 10px 6px;
  border-bottom: 1px solid #F0F3F8;
  color: #111111;
  white-space: nowrap;
  font-size: 20px;
  font-weight: 800;
  text-align: center;
}

/* Первая колонка — версия/язык, всегда слева */
.overview-summary-table th:first-child,
.overview-summary-table td:first-child {
  text-align: left;
}

.overview-summary-table tbody tr:last-child td {
  border-bottom: 0;
}

.overview-summary-table .muted {
  color: #111111;
  font-weight: 800;
  font-size: 20px;
}

.overview-geo-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.overview-geo-subtitle {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #3d3e40;
}

.overview-geo-card .overview-summary-table-wrap {
  overflow-x: hidden;
  overflow-y: visible;
  min-width: 0;
}

.overview-geo-card .overview-summary-table {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
}

.overview-geo-card .overview-summary-table th:first-child,
.overview-geo-card .overview-summary-table td:first-child {
  width: 50%;
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-geo-card .overview-summary-table th:nth-child(2),
.overview-geo-card .overview-summary-table td:nth-child(2),
.overview-geo-card .overview-summary-table th:nth-child(3),
.overview-geo-card .overview-summary-table td:nth-child(3) {
  width: 25%;
}

.overview-geo-card[data-geo-view="full"] .overview-summary-table-wrap {
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
}

@media (max-width: 1100px) {
  .overview-geo-split {
    grid-template-columns: 1fr;
  }
}

/* ——— Страница UTM ——— */

.utm-page {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 100%;
}

.utm-section {
  margin: 0;
}

.utm-section--kpi .utm-kpi-scope {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #64748b;
}

.utm-kpi-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 100%;
}

.utm-kpi-card {
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e3e9f2;
  padding: 12px 14px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.04);
}

.utm-section--kpi .utm-kpi-footnote {
  margin: 10px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  line-height: 1.4;
  max-width: 72ch;
}

.utm-card {
  background: #FFFFFF;
  border: 1px solid #E3E9F2;
  border-radius: 18px;
  padding: 18px 20px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.04);
}

.utm-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.utm-card-head-text {
  flex: 1;
  min-width: 0;
}

.utm-heading {
  margin: 0;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #0f172a;
}

.utm-lede {
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  line-height: 1.45;
  max-width: 52ch;
}

.utm-card--matrix .utm-lede--single-line {
  max-width: none;
  white-space: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.utm-empty-hint {
  margin: 8px 0 0;
  font-size: 15px;
  font-weight: 700;
  color: #94a3b8;
}

/* Подиум топ-3 */

.utm-podium-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.utm-podium-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 14px;
  align-items: stretch;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: #fafbfc;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.utm-podium-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.07);
}

.utm-podium-row--gold {
  border-color: #fcd34d;
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 55%);
}

.utm-podium-row--silver {
  border-color: #cbd5e1;
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 55%);
}

.utm-podium-row--bronze {
  border-color: #fdba74;
  background: linear-gradient(135deg, #fff7ed 0%, #ffffff 55%);
}

.utm-podium-place {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 22px;
  font-weight: 950;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.utm-podium-row--gold .utm-podium-place {
  background: linear-gradient(180deg, #fde68a 0%, #fcd34d 100%);
  border-color: #f59e0b;
  color: #78350f;
}

.utm-podium-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 720px) {
  .utm-podium-body {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }
}

.utm-podium-label {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.35;
  word-break: break-word;
}

.utm-podium-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.utm-podium-metric {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.utm-podium-metric--visits {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
}

.utm-podium-metric--leads {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

/* Таблица всех связок */

.utm-matrix-panel {
  margin-top: 4px;
}

.utm-matrix-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 12px;
}

.utm-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.utm-field--search {
  flex: 1 1 240px;
  min-width: 200px;
}

.utm-field--group {
  flex: 1 1 320px;
  min-width: min(100%, 240px);
}

/* Сводка: тот же паттерн, что переключатель «Создать / Разобрать» в UTM-конструкторе */
.utm-matrix-mode {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.utm-matrix-mode-btn {
  border: 1px solid #dce3ec;
  background: #ffffff;
  color: #4b5568;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  outline: none;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
}

.utm-matrix-mode-btn:hover:not(.active) {
  border-color: #bfc9d8;
  background: #f9fafb;
}

.utm-matrix-mode-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.22);
}

.utm-matrix-mode-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.utm-matrix-toolbar .utm-field-label {
  color: #556176;
  letter-spacing: 0.02em;
}

.utm-field-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  color: #64748b;
}

.utm-field-input {
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #fff;
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  outline: none;
}

.utm-matrix-toolbar .utm-field-input {
  border-color: #dce3ec;
  border-radius: 8px;
}

.utm-field-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.utm-matrix-toolbar .utm-field-input:focus {
  border-color: #bfc9d8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.16);
}

.utm-matrix-meta {
  margin: 0;
  margin-left: auto;
  align-self: center;
  font-size: 13px;
  font-weight: 800;
  color: #64748b;
}

@media (max-width: 640px) {
  .utm-matrix-meta {
    margin-left: 0;
    width: 100%;
  }
}

.utm-matrix-th--aggregate {
  text-align: left;
}

.utm-matrix-td--aggregate-cell {
  font-weight: 700;
}

.utm-matrix-scroll {
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
}

.utm-matrix-expand-bar {
  display: flex;
  justify-content: center;
  padding: 10px 12px;
  margin-top: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.utm-matrix-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.utm-matrix-expand-btn:hover {
  border-color: #94a3b8;
  background: #f1f5f9;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.utm-matrix-expand-chevron {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.utm-matrix {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

.utm-matrix thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  box-shadow: 0 1px 0 #e2e8f0;
}

.utm-matrix-th {
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  color: #475569;
  text-align: center;
  border-bottom: 1px solid #e2e8f0;
}

.utm-matrix-th--dim {
  color: #64748b;
  text-align: left;
}

/* Текстовые ячейки измерений (Source/Medium/Campaign/Content и agg-name) — слева */
.utm-matrix-td:not(.utm-matrix-td--idx):not(.utm-matrix-td--num) {
  text-align: left;
}

.utm-matrix-th--sort {
  text-align: center;
  width: 1%;
}

.utm-matrix-th--sort .utm-sort {
  justify-content: center;
}

.utm-matrix-th--idx {
  width: 44px;
  text-align: center;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  color: #64748b;
}

.utm-matrix-td--idx {
  width: 44px;
  text-align: center;
  vertical-align: middle;
}

.utm-row-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #e2e8f0;
  font-size: 13px;
  font-weight: 900;
  color: #475569;
}

.utm-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  color: #334155;
}

.utm-sort:hover {
  color: #0f172a;
}

.utm-sort-arrow {
  font-size: 12px;
  font-weight: 900;
  color: #4f46e5;
  min-width: 14px;
}

.utm-matrix-tr:nth-child(even) {
  background: #fafbfc;
}

.utm-matrix-tr:hover .utm-matrix-td {
  background: rgba(238, 242, 255, 0.6);
}

.utm-matrix-td {
  padding: 11px 14px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 15px;
  font-weight: 650;
  color: #1e293b;
  vertical-align: middle;
  text-align: center;
}

.utm-matrix-td--num {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.utm-chip {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 8px;
  background: #f1f5f9;
  font-weight: 800;
}

.utm-val {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 8px;
  font-weight: 900;
  font-size: 14px;
}

.utm-val--visits {
  background: #f1f5f9;
  color: #334155;
}

.utm-val--leads {
  background: #ecfdf5;
  color: #065f46;
}

.utm-matrix-empty {
  text-align: center;
  padding: 32px 16px !important;
  font-size: 15px;
  font-weight: 700;
  color: #94a3b8;
}

.overview-top-sections {
  margin-top: 10px;
  max-width: 100%;
}

.overview-top-section {
  margin-top: 14px;
}

.overview-top-section-title {
  font-size: 25px;
  font-weight: 900;
  color: var(--text-strong);
  margin-bottom: 10px;
  letter-spacing: -0.2px;
}

.overview-top-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.overview-top-grid--utm {
  grid-template-columns: minmax(0, 1fr);
}

.overview-top-grid--cjm {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.top3-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.02);
}

.overview-top-grid--cjm .top3-card {
  background: linear-gradient(180deg, #FFFFFF 0%, #F6FAF7 100%);
}

.overview-top-grid--utm .top3-card {
  background: linear-gradient(180deg, #FFFFFF 0%, #F7FAF8 100%);
}

.top3-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-strong);
  margin-bottom: 0;
  line-height: 1.25;
}

.top3-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.top3-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 18px;
  color: #111111;
  font-weight: 800;
  min-width: 0;
  border: 1px solid #E3E8F0;
  border-radius: 10px;
  padding: 6px 8px;
  background: #F8FBF9;
}

.top3-rank {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  color: #35518A;
  background: #E8EEF8;
}

.top3-label {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.top3-value,
.top3-value-visits,
.top3-value-leads {
  font-weight: 900;
  color: #111111;
  border: 1px solid #D4DDE9;
  border-radius: 999px;
  padding: 2px 8px;
  background: #F5F8FC;
  font-size: 18px;
  white-space: nowrap;
}

.top3-card[data-top3-metrics="visits-leads"] .top3-row {
  grid-template-columns: 32px 1fr auto auto;
}

@media (max-width: 980px) {
  .overview-top-grid {
    grid-template-columns: 1fr;
  }
  .top3-label {
    max-width: 220px;
  }
}

.segment-filter {
  margin-left: 2px;
}

.pill-btn,
.tab-btn,
.ghost-btn {
  border: 1px solid transparent;
  background: transparent;
  color: #2C2C2C;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 16px;
  font-weight: 600;
}

.date-range-dropdown {
  position: relative;
}

.date-range-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #E3E8EF;
  background: #FFFFFF;
  color: #2C2C2C;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.date-chevron {
  font-size: 13px;
  color: #6A6F78;
  transform: translateY(1px);
}

.date-range-dropdown.open .date-chevron {
  transform: rotate(180deg);
}

/* Иначе author `display:flex` перебивает UA для [hidden] — панель видна в закрытом состоянии */
.date-dropdown-panel[hidden] {
  display: none !important;
}

.date-dropdown-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: auto;
  width: min(860px, calc(100vw - 220px));
  border: 1px solid #E3E8EF;
  border-radius: 16px;
  box-shadow: 0 12px 24px rgba(20, 28, 45, 0.1);
  background: #FFFFFF;
  z-index: 80;
  padding: 14px 16px 12px;
  /* Нижняя полоса с «Применить» не уезжает: середина прокручивается */
  display: flex;
  flex-direction: column;
  max-height: min(720px, calc(100vh - 24px));
  box-sizing: border-box;
}

.date-dropdown-panel[data-date-panel-dock="fixed"] {
  position: fixed;
  top: auto;
  left: auto;
  right: auto;
}

.date-dropdown-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-shrink: 0;
}

.date-nav-btn {
  border: none;
  background: transparent;
  color: #697383;
  font-size: 24px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 8px;
  cursor: pointer;
}

.date-nav-btn:hover {
  background: #F2F4F8;
}

.date-nav-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  background: transparent;
  color: #A2A9B5;
}

.date-months {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.calendar-month h4 {
  margin: 0 0 10px;
  text-align: center;
  font-size: 30px;
  font-weight: 600;
  color: #2D3340;
}

.calendar-weekhead {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin-bottom: 6px;
}

.calendar-weekhead span {
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: #A2A9B5;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.calendar-day {
  border: none;
  background: transparent;
  width: 100%;
  height: 34px;
  border-radius: 9px;
  font-size: 18px;
  font-weight: 500;
  color: #2D3340;
  cursor: pointer;
  line-height: 34px;
  padding: 0;
}

.calendar-day.empty {
  cursor: default;
}

.calendar-day.disabled {
  background: #F2F4F7 !important;
  color: #A8B1BE !important;
  cursor: not-allowed;
  opacity: 1;
}

.calendar-day.weekend {
  color: #C06A79;
}

.calendar-day.in-range {
  background: #ECEFF5;
}

.calendar-day.range-start,
.calendar-day.range-end {
  background: var(--primary);
  color: #FFFFFF;
}

.calendar-day.range-start {
  border-radius: 10px 0 0 10px;
}

.calendar-day.range-end {
  border-radius: 0 10px 10px 0;
}

.calendar-day.single {
  border-radius: 10px;
}

.date-dropdown-footer {
  margin-top: 12px;
  border-top: 1px solid #E7EAF0;
  padding-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.date-input-inline {
  height: 40px;
  min-width: 130px;
  border: 1px solid #E4E8EF;
  border-radius: 12px;
  padding: 0 12px;
  font-size: 15px;
  color: #2D3340;
  background: #FFFFFF;
}

.date-range-meta {
  color: #7F8794;
  font-size: 15px;
}

.date-apply-btn {
  margin-left: auto;
  height: 40px;
  min-width: 112px;
  border: 0;
  border-radius: 12px;
  padding: 0 16px;
  background: linear-gradient(90deg, #7B46F6 0%, #5E35E5 100%);
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.chat-fab-wrap {
  --chat-width: 420px;
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1400;
}

.chat-fab-wrap.anchored {
  left: var(--chat-anchor-left, auto);
  top: var(--chat-anchor-top, auto);
  right: auto;
  bottom: auto;
}

.chat-fab-btn {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  border: 1px solid #0F5D0F;
  background: var(--primary);
  color: #FFFFFF;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.16);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}

.chat-fab-anchor-slot {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
}

.chat-fab-btn:hover {
  border-color: #0F6B0F;
  background: #0F6B0F;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
}

.chat-fab-icon {
  width: 26px;
  height: 26px;
  display: block;
  filter: brightness(0) invert(1);
}

.chat-backdrop {
  display: none;
}

.chat-panel {
  --chat-width: 420px;
  position: fixed;
  top: 0;
  right: calc(-1 * var(--chat-width));
  width: var(--chat-width);
  max-width: min(92vw, 760px);
  height: 100vh;
  background: #0f1115;
  border-left: 1px solid #232833;
  z-index: 1401;
  display: flex;
  flex-direction: column;
  transition: right .26s ease;
  box-shadow: -18px 0 44px rgba(3, 6, 12, 0.45);
}

.chat-fab-wrap.open .chat-panel {
  right: 0;
}

.chat-fab-wrap.open .chat-backdrop {
  display: none;
}

.chat-fab-wrap.open .chat-fab-btn {
  opacity: 0;
  pointer-events: none;
}

:root.profile-menu-open .chat-fab-btn {
  opacity: 0;
  pointer-events: none;
}

.app.chat-open .content-layout {
  padding-right: calc(16px + var(--chat-open-width, 420px));
  transition: padding-right .18s ease;
}

.chat-header {
  min-height: 74px;
  border-bottom: 1px solid #212631;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  color: #E5E7EB;
  background: #111417;
}

.chat-head-strip {
  min-width: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-head-tabs {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding: 0;
  flex: 1;
  cursor: grab;
}

.chat-head-tabs::-webkit-scrollbar {
  height: 0;
}

.chat-head-tab {
  height: 74px;
  min-width: 170px;
  max-width: 240px;
  border: 0;
  border-right: 1px solid #2A2F36;
  border-radius: 0;
  background: #171b1e;
  color: #ffffff;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  flex: 0 0 auto;
}

.chat-head-tab-icon {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: #FFFFFF;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.chat-head-tab-title {
  flex: 1;
  min-width: 0;
  text-align: left;
  font-size: 16px;
  font-weight: 700;
  color: #FFFFFF;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-head-tab-close {
  font-size: 28px;
  color: #FFFFFF;
  line-height: 1;
  flex: 0 0 auto;
}

.chat-head-tab:hover {
  background: #1d2228;
}

.chat-head-tab.active {
  background: #20252c;
}

.chat-head-actions {
  padding-right: 8px;
}

.chat-head-tab.active .chat-head-tab-title,
.chat-head-tab.active .chat-head-tab-close,
.chat-head-tab.active .chat-head-tab-icon,
.chat-add,
.chat-history-btn,
.chat-close {
  color: #FFFFFF;
}

.chat-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.chat-add,
.chat-history-btn,
.chat-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #FFFFFF;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}

.chat-add {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.chat-history-btn svg,
.chat-close svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-add:hover,
.chat-history-btn:hover,
.chat-close:hover {
  background: #171d27;
  border-color: #2B3444;
  color: #FFFFFF;
}

.chat-history {
  position: absolute;
  right: 12px;
  top: 54px;
  width: 420px;
  max-width: min(92vw, 520px);
  height: min(70vh, 560px);
  background: #12161b;
  border: 1px solid #293243;
  border-radius: 14px;
  padding: 10px 10px 8px;
  display: none;
  z-index: 1300;
  box-shadow: 0 14px 30px rgba(3, 6, 12, 0.42);
}

.chat-history.open {
  display: block;
}

.chat-history-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  min-height: 0;
  position: relative;
}

.chat-history-search {
  width: 100%;
  border: 1px solid #2f3743;
  background: #1a2028;
  color: #dfe7f3;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}

.chat-history-search:focus {
  border-color: #46566e;
  box-shadow: 0 0 0 3px rgba(120, 136, 160, 0.18);
}

.chat-history-search::placeholder {
  color: #7f91a9;
}

.chat-history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow-y: scroll;
  overflow-x: hidden;
  padding-right: 12px;
  scrollbar-width: none;
}

.chat-history-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.chat-history-scrollbar {
  position: absolute;
  right: 2px;
  top: 52px;
  bottom: 4px;
  width: 8px;
  border-radius: 999px;
  background: #202833;
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
}

.chat-history-scrollbar-thumb {
  width: 100%;
  min-height: 28px;
  border-radius: 999px;
  background: linear-gradient(180deg, #6c7f9d 0%, #4f5f78 100%);
  transform: translateY(0);
}

.chat-history-shell:hover .chat-history-scrollbar-thumb {
  background: linear-gradient(180deg, #8195b5 0%, #607392 100%);
}

.chat-history-list::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 999px;
}

.chat-history-list::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 999px;
  border: 0;
}

.chat-history-list::-webkit-scrollbar-thumb:hover {
  background: transparent;
}

.chat-history-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-history-title {
  font-size: 12px;
  color: #8a97aa;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.chat-history-item {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: #d6deea;
  border-radius: 10px;
  padding: 8px 8px;
  text-align: left;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chat-history-item-main {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.chat-history-check {
  width: 18px;
  height: 18px;
  color: #b8c2d1;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-history-check svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-history-item-title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chat-history-item-actions {
  display: none;
  align-items: center;
  gap: 8px;
  color: #d7deea;
  flex: 0 0 auto;
}

.chat-history-item:hover,
.chat-history-item.active {
  background: #8b8776;
  border-color: #98937f;
  color: #f7f8fb;
}

.chat-history-item.active .chat-history-item-actions {
  display: inline-flex;
}

.chat-history-item:hover .chat-history-item-actions {
  display: inline-flex;
}

.chat-history-item.active .chat-history-check {
  color: #ffffff;
}

.chat-history-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #d7deea;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-history-action-btn:hover {
  background: #1B2534;
  border-color: #334053;
}

.chat-history-action-btn.active {
  background: #1B2534;
  border-color: #334053;
  color: #ffffff;
}

.chat-history-action-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 11px;
  align-items: center;
  padding: 10px 14px 8px;
  background: #0f1115;
}

.chat-messages-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #5f708a #202833;
  overscroll-behavior: contain;
}

.chat-messages-wrap::-webkit-scrollbar {
  width: 10px;
}

.chat-messages-wrap::-webkit-scrollbar-track {
  background: #202833;
  border-radius: 999px;
}

.chat-messages-wrap::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #6c7f9d 0%, #4f5f78 100%);
  border-radius: 999px;
  border: 2px solid #202833;
}

.chat-messages-wrap::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #8195b5 0%, #607392 100%);
}

.chat-scrollbar {
  display: none;
}

.chat-scrollbar-thumb {
  width: 100%;
  min-height: 28px;
  border-radius: 999px;
  background: linear-gradient(180deg, #6c7f9d 0%, #4f5f78 100%);
  transform: translateY(0);
}

.chat-messages-wrap:hover .chat-scrollbar-thumb {
  background: linear-gradient(180deg, #8195b5 0%, #607392 100%);
}

.chat-msg-row {
  display: flex;
  width: 100%;
  justify-content: center;
}

.chat-msg-row.bot {
  justify-content: flex-start;
}

.chat-msg-row.user {
  justify-content: center;
}

.chat-msg {
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 17px;
  line-height: 1.48;
  letter-spacing: 0.01em;
  box-sizing: border-box;
}

.chat-msg-text {
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Markdown-rendered bot messages ─────────────────────────── */
.chat-msg.bot > .chat-agent-trace + .chat-msg-md {
  margin-top: 12px;
  animation: agentAnswerIn 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes agentAnswerIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg-row--answer {
  animation: agentAnswerIn 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-msg-row--answer .chat-msg-md {
  animation: none;
}

.chat-msg-md {
  color: #e8edf7;
  font-size: 18px;
  line-height: 1.7;
  word-break: break-word;
}

.chat-msg-md h2.chat-h {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin: 16px 0 6px;
  letter-spacing: 0.01em;
}

.chat-msg-md h3.chat-h {
  font-size: 17px;
  font-weight: 600;
  color: #c8d6f0;
  margin: 12px 0 4px;
}

.chat-msg-md h4.chat-h {
  font-size: 16px;
  font-weight: 600;
  color: #a0b8d8;
  margin: 10px 0 3px;
}

.chat-msg-md p.chat-p {
  margin: 3px 0;
}

.chat-msg-md .chat-gap {
  height: 5px;
}

.chat-msg-md ul.chat-ul,
.chat-msg-md ol.chat-ol {
  margin: 10px 0;
  padding: 0;
  list-style: none;
}

.chat-msg-md ul.chat-ul > li,
.chat-msg-md ol.chat-ol > li {
  position: relative;
  margin: 5px 0;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

/* Маркеры bullet — фиксированная колонка */
.chat-msg-md ul.chat-ul > li {
  padding-left: 1.35em;
}

.chat-msg-md ul.chat-ul > li::before {
  content: "•";
  position: absolute;
  left: 0;
  top: 0;
  color: #6b8fc7;
  font-weight: 700;
}

/* Нумерация — tabular-nums + отступ под 2 цифры (10, 11, …) */
.chat-msg-md ol.chat-ol {
  counter-reset: chat-ol;
}

.chat-msg-md ol.chat-ol > li {
  counter-increment: chat-ol;
  padding: 6px 8px 6px 2.85em;
  border-radius: 8px;
}

.chat-msg-md ol.chat-ol > li::before {
  content: counter(chat-ol) ".";
  position: absolute;
  left: 8px;
  top: 6px;
  width: 2em;
  text-align: right;
  color: #7a9bc8;
  font-weight: 700;
  font-size: 0.92em;
  font-variant-numeric: tabular-nums;
  line-height: 1.55;
}

/* Длинные пункты (маршруты с **жирным**) — карточки */
.chat-msg-md ol.chat-ol > li:has(strong) {
  margin: 7px 0;
  padding: 9px 12px 9px 2.85em;
  background: rgba(18, 26, 44, 0.88);
  border: 1px solid rgba(77, 126, 247, 0.18);
  border-left: 3px solid rgba(77, 126, 247, 0.45);
}

.chat-msg-md ol.chat-ol > li:has(strong)::before {
  top: 9px;
  color: #93b4e8;
}

/* Вложенный bullet внутри numbered-пункта */
.chat-msg-md ol.chat-ol > li > ul.chat-ul {
  margin: 6px 0 2px;
}

.chat-msg-md ol.chat-ol > li > ul.chat-ul > li {
  padding-left: 1.2em;
  margin: 3px 0;
  background: none;
  border: none;
}

.chat-msg-md blockquote.chat-bq {
  margin: 10px 0;
  padding: 9px 12px;
  border-left: 3px solid rgba(77, 126, 247, 0.45);
  border-radius: 0 8px 8px 0;
  background: rgba(18, 26, 44, 0.65);
  color: #b8c9e4;
  font-size: 0.94em;
  line-height: 1.55;
}

.chat-msg-md blockquote.chat-bq strong {
  color: #dce8fa;
}

/* Карточки путей (URL в `code`) — единый вид ВСЕХ пунктов списка */
.chat-msg-md ul.chat-ul:has(> li code.chat-code) > li,
.chat-msg-md ol.chat-ol:has(> li code.chat-code) > li {
  margin: 8px 0;
  padding: 10px 12px 10px 2.85em;
  border-radius: 10px;
  background: rgba(18, 26, 44, 0.92);
  border: 1px solid rgba(77, 126, 247, 0.28);
  border-left: 3px solid #4d7ef7;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.chat-msg-md ul.chat-ul:has(> li code.chat-code) > li::before,
.chat-msg-md ol.chat-ol:has(> li code.chat-code) > li::before {
  left: 8px;
  top: 10px;
}

.chat-msg-md ul.chat-ul:has(> li code.chat-code) > li {
  padding-left: 2.85em;
}

.chat-msg-md code.chat-code {
  background: rgba(30, 58, 95, 0.55);
  color: #93d8ff;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 13px;
  font-family: "Fira Code", "JetBrains Mono", "Cascadia Code", monospace;
  border: 1px solid rgba(77, 126, 247, 0.35);
}

.chat-msg-md strong {
  color: #fff;
  font-weight: 600;
}

.chat-msg-md em {
  color: #b0c8e8;
  font-style: italic;
}

.chat-msg-md hr.chat-hr {
  border: none;
  border-top: 1px solid #2d3f5a;
  margin: 10px 0;
}

/* ── GFM tables in chat messages ─────────────────────────────── */
.chat-msg-md .chat-table-wrap {
  margin: 8px 0 10px;
  border: 1px solid #2d3f5a;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(15, 23, 41, 0.55);
}

.chat-msg-md .chat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  line-height: 1.45;
  color: #d6e2f5;
  font-variant-numeric: tabular-nums;
}

.chat-msg-md .chat-table thead th.chat-th {
  background: #1a2237;
  color: #b9c9e5;
  font-weight: 600;
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid #2d3f5a;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.chat-msg-md .chat-table tbody td.chat-td {
  padding: 7px 12px;
  border-bottom: 1px solid rgba(45, 63, 90, 0.55);
  vertical-align: top;
  word-break: break-word;
}

.chat-msg-md .chat-table tbody tr:last-child td.chat-td {
  border-bottom: none;
}

.chat-msg-md .chat-table tbody tr:nth-child(even) td.chat-td {
  background: rgba(26, 34, 55, 0.35);
}

.chat-msg-md .chat-table tbody tr:hover td.chat-td {
  background: rgba(77, 126, 247, 0.08);
}

.chat-msg-md .chat-table td.chat-td code.chat-code {
  font-size: 11.5px;
  padding: 1px 5px;
}

/* По умолчанию первый столбец — пути/названия (длинные), а остальные —
   числа. Делаем их моно-плотными и чуть компактнее. */
.chat-msg-md .chat-table th.chat-th:not(:first-child):not(:last-child),
.chat-msg-md .chat-table td.chat-td:not(:first-child):not(:last-child) {
  text-align: right;
  white-space: nowrap;
}

.chat-msg-md .chat-table th.chat-th:last-child,
.chat-msg-md .chat-table td.chat-td:last-child {
  white-space: normal;
  text-align: left;
  line-height: 1.5;
  font-size: 13px;
  min-width: 0;
}

.chat-msg-md .chat-table td.chat-td:first-child {
  color: #e6eefb;
  font-size: 12px;
}

.chat-msg-md .chat-table td.chat-td:first-child:has(code.chat-code) {
  font-family: "Fira Code", "JetBrains Mono", "Cascadia Code", monospace;
}

/* На очень узких чатах — горизонтальный скролл, без сжатия колонок. */
.chat-msg-md .chat-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Cursor blinking during stream ───────────────────────────── */
.chat-cursor {
  display: inline-block;
  width: 2px;
  height: 0.88em;
  background: #4d7ef7;
  margin-left: 2px;
  vertical-align: text-bottom;
  border-radius: 1px;
  animation: cursorBlink 0.75s steps(1) infinite;
}

@keyframes cursorBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ── Agent trace (Cursor-style thinking stream) ─────────────── */
.chat-agent-trace {
  width: 100%;
  padding: 2px 1.25rem 6px;
  box-sizing: border-box;
}

.chat-agent-trace-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  padding: 2px 0 2px 0;
  border: 0;
  background: transparent;
  color: #7a92ad;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  user-select: none;
  transition: color 0.18s ease;
}

.chat-agent-trace-toggle:hover {
  color: #a8bdd4;
}

.chat-agent-trace-toggle[hidden] {
  display: none !important;
}

.chat-agent-trace-chevron {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.22s ease;
  flex-shrink: 0;
  opacity: 0.9;
}

.chat-agent-trace:not(.is-collapsed) .chat-agent-trace-chevron {
  transform: rotate(45deg) translateY(-1px);
}

.chat-agent-stream {
  overflow: hidden;
  transition: opacity 0.22s ease, max-height 0.32s ease;
  max-height: 4000px;
  opacity: 1;
}

.chat-agent-thinking-line {
  margin: 0 0 8px;
}

.chat-agent-thinking-line[hidden] {
  display: none !important;
}

.chat-agent-slot-viewport {
  overflow: visible;
}

.chat-agent-slot-content {
  transition: opacity 0.26s ease, transform 0.26s ease;
}

.chat-agent-slot-content.is-swapping {
  opacity: 0;
  transform: translateY(5px);
}

.chat-agent-list-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 6px;
}

.chat-agent-list-item:first-child {
  margin-top: 0;
}

.chat-agent-list-item--lead {
  display: block;
  margin-bottom: 6px;
}

.chat-agent-list-n {
  flex-shrink: 0;
  min-width: 1.4em;
  color: #7a94b0;
  font-weight: 500;
}

.chat-agent-list-t {
  flex: 1;
  min-width: 0;
}

.chat-agent-slot-sep {
  height: 1px;
  margin: 10px 0;
  background: linear-gradient(90deg, transparent, rgba(122, 148, 176, 0.22), transparent);
}

.chat-agent-trace.is-collapsed .chat-agent-stream {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.chat-agent-step {
  transition: opacity 0.22s ease;
}

.chat-agent-step.is-settled {
  opacity: 0.4;
}

.chat-agent-step.is-live {
  opacity: 1;
}

.chat-agent-step-text {
  display: block;
  font-size: 17px;
  line-height: 1.55;
  letter-spacing: 0.01em;
  color: #8ea3bb;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-agent-step.is-live .chat-agent-step-text,
.chat-agent-step-text.chat-agent-shimmer {
  font-size: 18px;
  line-height: 1.52;
  color: #b8c9dc;
}

.chat-agent-step.is-settled .chat-agent-step-text {
  font-size: 16px;
  color: #5f748a;
}

.chat-agent-shimmer {
  background-image: linear-gradient(
    100deg,
    #7f97b0 0%,
    #7f97b0 34%,
    #d8e6f5 50%,
    #7f97b0 66%,
    #7f97b0 100%
  );
  background-size: 240% 100%;
  background-position: 120% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: agentWaveGlow 2.4s ease-in-out infinite;
}

.chat-agent-step.is-settled .chat-agent-shimmer {
  animation: none;
  background: none;
  -webkit-text-fill-color: currentColor;
}

@keyframes agentWaveGlow {
  0% { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}

/* legacy alias */
.chat-think {
  display: none;
}

/* ── Citation chips ──────────────────────────────────────────── */
.chat-citations {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #2a3a52;
}

.chat-citation-chip {
  display: inline-block;
  padding: 3px 9px;
  background: #192232;
  border: 1px solid #2d3f5a;
  border-radius: 5px;
  font-size: 11px;
  color: #6a94c8;
  text-decoration: none;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.chat-citation-chip:hover {
  background: #1e2e47;
  border-color: #4d7ef7;
  color: #7aabf7;
}

.chat-msg.bot {
  width: 100%;
  max-width: 100%;
  background: transparent;
  border: 0;
  color: #FFFFFF;
  text-align: left;
  padding: 0;
}

.chat-msg.user {
  background: #3F4653;
  border: 1px solid #545F72;
  color: #FFFFFF;
  width: 100%;
  max-width: 100%;
  position: relative;
}

.chat-msg-user-wrap {
  position: relative;
  padding-right: 4px;
}

.chat-msg-user-wrap .chat-msg-text {
  padding-right: 32px;
}

.chat-msg-edit-btn {
  position: absolute;
  top: 6px;
  right: 2px;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.chat-msg-user-wrap:hover .chat-msg-edit-btn,
.chat-msg-edit-btn:focus-visible {
  opacity: 1;
}

.chat-msg-edit-btn:disabled {
  display: none;
}

.chat-msg-editing {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-radius: 16px;
}

.chat-msg-editing:focus-within {
  border-color: #6E7B8E;
}

.chat-msg-edit-input {
  display: block;
  width: 100%;
  min-height: 44px;
  max-height: 160px;
  resize: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #FFFFFF;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0;
  padding: 0;
  margin: 0;
  outline: none;
  box-sizing: border-box;
  caret-color: #dbe8ff;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #5f708a transparent;
}

.chat-msg-edit-input::-webkit-scrollbar {
  width: 6px;
}

.chat-msg-edit-input::-webkit-scrollbar-thumb {
  background: #5f708a;
  border-radius: 999px;
}

.chat-msg-edit-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.chat-msg-edit-cancel {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #FFFFFF;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.chat-msg-edit-cancel svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-msg-edit-cancel:hover {
  background: #171d27;
  border-color: #2B3444;
  color: #FFFFFF;
}

.chat-msg-edit-submit.chat-send {
  width: 34px;
  height: 34px;
}

/* Кнопка отправки в composer переключается в режим «стоп» во время
   генерации — DOM-элемент тот же, чтобы курсор/фокус не «прыгали». */

.chat-msg.chat-typing {
  padding: 9px 12px;
}

.chat-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chat-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #93A4BC;
  animation: chatTypingPulse 1s ease-in-out infinite;
}

.chat-typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.chat-typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes chatTypingPulse {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.42;
  }
  40% {
    transform: translateY(-2px);
    opacity: 1;
  }
}

.chat-composer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  margin: 12px 12px 12px;
  padding: 12px 14px 10px;
  background: #3F4653;
  border: 1px solid #545F72;
  border-radius: 16px;
  box-shadow: none;
  position: relative;
  box-sizing: border-box;
}

.chat-panel.composer-bottom .chat-messages {
  order: 2;
}

.chat-panel.composer-bottom .chat-composer {
  order: 3;
  margin: 0 12px 12px;
  padding: 10px 12px 8px;
}

.chat-composer:focus-within {
  border-color: #6E7B8E;
}

/* ── Composer input ─────────────────────────────────────────────
   Overlay рисует подсветку токенов поверх прозрачного textarea.
   Стили textarea и overlay должны быть ИДЕНТИЧНЫ (font-family,
   font-size, line-height, letter-spacing, padding), иначе текст
   съезжает относительно курсора. */

.chat-input-shell {
  position: relative;
  display: block;
  width: 100%;
  min-height: 0;
}

.chat-input,
.chat-input-overlay {
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0;
  padding: 0;
  margin: 0;
  border: 0;
  box-sizing: border-box;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
}

.chat-input-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  color: #e8eefc;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.chat-input {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  background: transparent;
  color: transparent !important;
  -webkit-text-fill-color: transparent;
  caret-color: #dbe8ff;
  resize: none;
  min-height: 60px;
  max-height: 220px;
  outline: none;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #5f708a transparent;
}

.chat-input::-webkit-scrollbar {
  width: 6px;
}

.chat-input::-webkit-scrollbar-thumb {
  background: #5f708a;
  border-radius: 999px;
}

.chat-panel.composer-bottom .chat-input {
  min-height: 44px;
  max-height: 160px;
}

.chat-composer-bottom {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.chat-composer-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.chat-mention-menu {
  position: absolute;
  left: 12px;
  right: 12px;
  width: auto;
  max-width: 360px;
  bottom: calc(100% + 6px);
  max-height: 248px;
  padding: 8px 8px 8px 8px;
  border-radius: 12px;
  border: 1px solid #456ea8;
  background: #1f2f48;
  box-shadow: 0 10px 24px rgba(10, 15, 24, 0.35);
  display: block;
  z-index: 5;
}

.chat-mention-menu[hidden] {
  display: none !important;
}

.chat-mention-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #e4ebf7;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  cursor: pointer;
  text-align: left;
  min-width: 0;
}

.chat-mention-list {
  max-height: 228px;
  overflow-y: scroll;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 6px;
  scrollbar-width: none;
}

.chat-mention-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.chat-mention-scrollbar {
  position: absolute;
  right: 2px;
  top: 8px;
  bottom: 8px;
  width: 7px;
  border-radius: 999px;
  background: #2b4367;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.chat-mention-scrollbar-thumb {
  width: 100%;
  min-height: 24px;
  border-radius: 999px;
  background: linear-gradient(180deg, #8eb3f1 0%, #628fd8 100%);
  transform: translateY(0);
}

.chat-mention-item:hover {
  background: #2a446d;
  border-color: #79a8f4;
}

.chat-mention-tag {
  border-radius: 999px;
  border: 1px solid #5790ea;
  background: #24406b;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #dceaff;
  white-space: nowrap;
}

.chat-mention-label {
  font-size: 12px;
  opacity: 0.95;
  color: #c7d8f7;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}

.chat-input::placeholder {
  color: transparent;
}

.chat-input-overlay-placeholder {
  color: rgba(202, 221, 255, 0.5);
  font-weight: 500;
}

/* Токен НЕ должен менять геометрию строки (никаких padding/border/
   font-size/font-weight/margin/border-radius). Иначе ширина
   токена в overlay не совпадёт с шириной такого же текста в
   textarea и весь текст после токена «уплывёт». */
.chat-input-token-inline {
  display: inline;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: #79b8ff;
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  white-space: inherit;
  text-decoration: none;
}

.chat-input:focus,
.chat-input:active {
  background: transparent;
  border: 0;
  outline: none;
  box-shadow: none;
}

.chat-send {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: #2F7D32;
  color: #FFFFFF;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  transition: background .18s ease, transform .15s ease, opacity .18s ease;
}

.chat-send svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-send:hover:not(:disabled) {
  background: #38973C;
  transform: translateY(-1px);
}

.chat-send:active:not(:disabled) {
  transform: translateY(0);
}

.chat-send:disabled {
  background: #4a5363;
  opacity: 0.55;
  cursor: not-allowed;
}

/* Stop-режим: тот же размер/позиция, красный, иконка-квадрат залит. */
.chat-send.is-stop {
  background: #C0392B;
  cursor: pointer;
  opacity: 1;
}

.chat-send.is-stop:hover {
  background: #D14B3D;
  transform: translateY(-1px);
}

.chat-send.is-stop:active {
  transform: translateY(0);
}

.chat-send.is-stop svg {
  fill: currentColor;
  stroke: none;
}

.chat-resize-handle {
  position: absolute;
  left: -5px;
  top: 0;
  width: 10px;
  height: 100%;
  cursor: ew-resize;
  background: transparent;
}

.chat-resize-handle::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0;
  width: 1px;
  height: 100%;
  background: rgba(130, 142, 161, 0.45);
}

.utm-builder {
  margin-top: 12px;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.utm-builder-head h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.utm-builder-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.utm-toggle-btn {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #FFFFFF;
  font-size: 43px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  display: inline-block;
  position: relative;
  padding: 0;
  transition: transform 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
}

.utm-toggle-sign {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transform: translateY(-3px);
}

.utm-toggle-btn:hover {
  background: #0F6B0F;
  box-shadow: 0 6px 14px rgba(15, 93, 15, 0.28);
}

.utm-builder.open .utm-toggle-btn {
  transform: rotate(45deg);
}

.utm-builder-body {
  margin-top: 16px;
  max-width: 980px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.utm-builder-body.show {
  opacity: 1;
  transform: translateY(0);
}

.utm-modes {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.utm-mode-btn {
  height: 30px;
  border: 1px solid #DCE3EC;
  background: #FFFFFF;
  color: #4B5568;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
}

.utm-mode-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #FFFFFF;
}

.utm-builder-head p {
  margin: 6px 0 0;
  color: #6B7586;
  font-size: 13px;
}

.utm-parse {
  margin-bottom: 8px;
}

.utm-inline {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: stretch;
}

.utm-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.utm-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.utm-grid.compact .utm-field-wide {
  grid-column: 1 / -1;
}

.utm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.utm-field span {
  font-size: 18px;
  color: #556176;
  font-weight: 600;
}

.utm-field input,
.utm-field select,
.utm-field textarea {
  width: 100%;
  border: 1px solid #DCE3EC;
  border-radius: 8px;
  background: #FFFFFF;
  color: #1F2937;
  font-size: 18px;
  padding: 8px 10px;
  outline: none;
}

.utm-base-picker {
  position: relative;
}

.utm-base-picker input[data-utm-base] {
  padding-right: 42px;
}

.utm-base-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #5D6779;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.utm-base-toggle:hover {
  background: #F3F6FA;
  border-color: #DCE3EC;
}

.utm-base-options {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  background: #FFFFFF;
  border: 1px solid #DCE3EC;
  border-radius: 10px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.1);
  overflow: hidden;
}

.utm-base-option {
  width: 100%;
  border: 0;
  background: #FFFFFF;
  color: #374151;
  text-align: left;
  padding: 10px 12px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}

.utm-base-option:hover {
  background: #F3F6FA;
}

.utm-base-flag {
  font-size: 18px;
  line-height: 1;
}

.utm-base-link {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.utm-field input:focus,
.utm-field select:focus,
.utm-field textarea:focus {
  border-color: #BFC9D8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.16);
}

.utm-result {
  margin-top: 8px;
  max-width: 980px;
}

.utm-mode-panel[hidden] {
  display: none;
}

.utm-mode-panel[data-utm-mode-panel="parse"] {
  margin-top: 10px;
}

.utm-mode-panel[data-utm-mode-panel="parse"] .utm-inline .utm-btn {
  height: 100%;
  min-height: 48px;
}

.utm-field-wide {
  grid-column: 1 / -1;
}

.utm-actions {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.utm-btn {
  height: 32px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #FFFFFF;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.utm-btn.ghost {
  border-color: #DCE3EC;
  background: #F7F9FC;
  color: #445065;
}

.utm-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.utm-status {
  font-size: 18px;
  color: #607086;
  margin-left: 4px;
}

.utm-status.error {
  color: #B42318;
}

.pill-btn:hover,
.tab-btn:hover,
.ghost-btn:hover {
  background: #FFFFFF;
  border-color: #E3E8EF;
}

.pill-btn.active,
.tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
  font-weight: 600;
}

.admin-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #FFFFFF;
  text-decoration: none;
  font-size: 20px;
  font-weight: 700;
  white-space: nowrap;
}

.admin-link-btn:hover {
  border-color: var(--secondary);
  background: var(--secondary);
}

.content-layout {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 0 16px 16px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.content {
  min-width: 0;
}

.content-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.page-title {
  margin: 0;
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.head-tabs {
  display: flex;
  gap: 6px;
}

.cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.ui-card {
  background: #FFFFFF;
  border: 1px solid #E7EAF0;
  border-radius: 16px;
  padding: 16px;
}

.ui-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
}

.ui-card p {
  margin: 0 0 12px;
  color: #6A6F78;
  font-size: 14px;
  line-height: 1.35;
}

.ghost-btn {
  background: #F7F8FA;
  border-color: #E7EAF0;
  color: #2C2C2C;
}

.canvas {
  width: 100%;
  height: 360px;
  border: 1px solid #E7EAF0;
  border-radius: 16px;
  background: #FFFFFF;
}

@media (max-width: 1200px) {
  .content-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .top {
    grid-column: 1;
    grid-row: 1;
    flex-direction: column;
    align-items: flex-start;
  }

  .content-layout {
    grid-column: 1;
    grid-row: 2;
    grid-template-columns: 1fr;
  }

  .date-dropdown-panel {
    right: 0;
    width: min(360px, calc(100vw - 24px));
    padding: 10px;
  }

  .utm-grid {
    grid-template-columns: 1fr;
  }

  .utm-grid.compact {
    grid-template-columns: 1fr 1fr;
  }

  .utm-inline {
    grid-template-columns: 1fr;
  }

  .utm-actions {
    flex-wrap: wrap;
  }

  .chat-fab-wrap {
    right: 12px;
    bottom: 12px;
  }

  .chat-panel {
    width: 100%;
    max-width: 100%;
    right: -100%;
  }

  .chat-backdrop {
    display: none;
  }

  .chat-fab-wrap.open .chat-fab-btn {
    transform: none;
  }

  .date-dropdown-header {
    align-items: center;
  }

  .date-months {
    grid-template-columns: 1fr;
  }

  .calendar-month h4 {
    font-size: 22px;
  }

  .calendar-day {
    font-size: 16px;
    height: 34px;
    line-height: 34px;
  }

  .date-input-inline {
    min-width: 120px;
    height: 40px;
    font-size: 14px;
    border-radius: 10px;
    padding: 0 10px;
  }

  .date-range-meta {
    font-size: 14px;
  }

  .date-apply-btn {
    height: 40px;
    min-width: 100px;
    font-size: 14px;
    border-radius: 10px;
    padding: 0 12px;
  }

}

/* ——— Страница SEO (дашборд интеграций) ——— */

.seo-dashboard {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 8px;
  max-width: 100%;
}

.seo-card {
  background: #ffffff;
  border: 1px solid #e3e9f2;
  border-radius: 18px;
  padding: 18px 20px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.04);
}

[data-seo-site-audit] {
  position: relative;
  overflow: visible;
}

.seo-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.seo-card-head--site-audit {
  align-items: center;
}

.seo-card-head-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  min-width: 0;
  flex: 1;
}

.seo-card-head-main .seo-card-title {
  flex-shrink: 0;
}

.seo-card-title {
  margin: 0;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #000000;
}

.seo-card-lede {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  line-height: 1.45;
  max-width: 72ch;
}

.seo-code {
  font-size: 13px;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 6px;
}

.seo-table-wrap {
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-top: 8px;
}

.seo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

.seo-table th {
  text-align: center;
  padding: 12px 14px;
  background: #f8fafc;
  font-weight: 900;
  color: #000000;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.seo-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #000000;
  font-weight: 800;
  text-align: center;
}

/* В SEO-таблицах вторая колонка — это запрос/страница (текст), её всегда слева.
   Первая колонка (№) и числовые остаются по центру. */
.seo-table th:nth-child(2),
.seo-table td:nth-child(2) {
  text-align: left;
}

.seo-table-th-num,
.seo-table-td-num {
  width: 48px;
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.seo-site-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.seo-site-fold {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.seo-site-fold-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  margin: 0;
  border: none;
  background: #f8fafc;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

.seo-site-fold-trigger:hover {
  background: #f1f5f9;
}

.seo-site-fold-num {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 8px;
  background: #e2e8f0;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  color: #000000;
}

.seo-site-fold-plus {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  color: #000000;
}

.seo-site-fold-label {
  font-size: 18px;
  font-weight: 900;
  color: #000000;
  letter-spacing: -0.02em;
  word-break: break-word;
}

.seo-site-fold-body {
  padding: 14px 16px 16px;
  border-top: 1px solid #e2e8f0;
  background: #ffffff;
}

.seo-domain-line {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
}

.seo-domain-line .seo-code {
  font-size: 12px;
  word-break: break-all;
}

.seo-psi-strat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  align-items: start;
}

.seo-psi-legend {
  margin: 0 0 10px;
  font-size: 13px;
  color: #64748b;
}

.seo-psi-legend-summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  list-style: none;
}

.seo-psi-legend-summary::-webkit-details-marker {
  display: none;
}

.seo-psi-legend-summary::before {
  content: "▸ ";
  font-size: 11px;
}

.seo-psi-legend[open] .seo-psi-legend-summary::before {
  content: "▾ ";
}

.seo-psi-legend-list {
  margin: 6px 0 0;
  padding: 0 0 0 1.1em;
  line-height: 1.45;
}

.seo-psi-legend-term {
  font-weight: 800;
  color: #334155;
}

.seo-psi-legend-note {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.35;
}

.seo-psi-strat-col {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px 12px;
  background: #f8fafc;
}

.seo-psi-strat-head {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #000000;
}

.seo-psi-metrics {
  margin: 0;
}

.seo-psi-metric-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 10px;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid #e2e8f0;
  color: #000000;
}

.seo-psi-metric-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.seo-psi-metric-row dt {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: #000000;
}

.seo-psi-metric-row dd {
  margin: 0;
  text-align: right;
  font-size: 14px;
  font-weight: 900;
  color: #000000;
  font-variant-numeric: tabular-nums;
}

.seo-psi-domain-line {
  font-size: 14px;
  font-weight: 900;
  color: #000000;
}

.seo-psi-domain-line .seo-code {
  font-size: 14px;
  font-weight: 800;
}

.seo-lh-seo-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.seo-lh-seo-head {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #64748b;
}

.seo-lh-score {
  margin: 0 0 4px;
  font-size: 28px;
  font-weight: 900;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: #000000;
}

.seo-lh-score--good {
  color: #15803d;
}

.seo-lh-score--mid {
  color: #b45309;
}

.seo-lh-score--bad {
  color: #b91c1c;
}

.seo-lh-audit-list {
  margin: 8px 0 0;
  padding: 0 0 0 1.1em;
  font-size: 13px;
  line-height: 1.4;
  color: #334155;
}

.seo-lh-audit-fail {
  margin: 0 0 6px;
}

.seo-lh-audit-fail strong {
  display: block;
  font-weight: 800;
  color: #000000;
}

.seo-lh-audit-desc {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: #64748b;
}

.seo-lh-all-pass {
  margin: 8px 0 0;
  color: #15803d;
}

.seo-lh-report-link {
  font-weight: 700;
  color: #1d4ed8;
  text-decoration: none;
}

.seo-lh-report-link:hover {
  text-decoration: underline;
}

.seo-site-audit-locale-pills {
  margin: 0;
}

.seo-site-audit-score {
  margin: 0;
  flex: 0 0 auto;
  font-size: clamp(52px, 8vw, 72px);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: #b91c1c;
  transition: color 80ms linear;
}

.seo-site-audit-hero-copy .seo-mini {
  margin: 0;
  line-height: 1.4;
  color: #64748b;
}

.seo-site-audit-pages strong {
  color: #334155;
  font-weight: 800;
}

.seo-site-audit-cat-score.seo-site-audit-score--excellent {
  color: #15803d;
}

.seo-site-audit-cat-score.seo-site-audit-score--good {
  color: #16a34a;
}

.seo-site-audit-cat-score.seo-site-audit-score--fair {
  color: #ca8a04;
}

.seo-site-audit-cat-score.seo-site-audit-score--needs {
  color: #b45309;
}

.seo-site-audit-cat-score.seo-site-audit-score--critical {
  color: #b91c1c;
}

.seo-site-audit-grade {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.seo-site-audit-method {
  line-height: 1.35;
  color: #64748b;
}

.range-notice-slot:empty,
.range-notice-slot[hidden] {
  display: none;
}

.range-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 6px 0 10px;
  padding: 7px 11px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #3f4653;
}

.range-notice--partial {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.range-notice--empty {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.range-notice--info {
  border-color: #dbe3ef;
  background: #f2f6fc;
  color: #3f4653;
}

.range-notice-icon {
  flex: 0 0 auto;
  margin-top: 1px;
  color: currentColor;
  opacity: 0.9;
}

.range-notice-text {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

.range-notice-text strong {
  font-weight: 800;
}

.seo-site-audit-subhead {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 10px;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #000000;
}

.seo-site-audit-subhead-label {
  font-size: 13px;
  font-weight: 600;
  color: #5c5c5c;
  letter-spacing: 0;
}

.seo-site-audit-top {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 8px;
}

.seo-site-audit-hero {
  display: flex;
  align-items: center;
  gap: 18px 24px;
  flex-wrap: wrap;
  margin: 0;
  padding: 2px 0;
}

.seo-site-audit-hero-score-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.seo-site-audit-hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  flex: 1 1 280px;
  max-width: 640px;
  min-width: min(100%, 240px);
  padding-top: 2px;
}

.seo-site-audit-hero-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: 2px;
}

.seo-site-audit-hero-meta-line {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.seo-site-audit-meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.seo-site-audit-meta-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #475569;
}

.seo-site-audit-text-detail {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  color: #0f172a;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.seo-site-audit-text-detail:hover {
  color: #334155;
}

.seo-site-audit-growth-meta {
  margin-top: 2px;
}

.seo-site-audit-growth-meta .seo-mini strong {
  font-weight: 800;
}

.seo-site-audit-tables-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, max-content));
  gap: 16px 24px;
  align-items: start;
  justify-content: start;
  margin: 4px 0 8px;
  overflow: visible;
  position: relative;
  z-index: 2;
}

.seo-site-audit-tables-row--single {
  grid-template-columns: minmax(0, max-content);
}

.seo-site-audit-table-panel {
  position: relative;
  z-index: auto;
  min-width: 0;
  width: max-content;
  max-width: 100%;
  overflow: visible;
}

.seo-site-audit-table-panel .seo-site-audit-subhead {
  margin-top: 14px;
}

.seo-site-audit-table-panel .seo-table-wrap {
  margin-top: 0;
  width: fit-content;
  max-width: 100%;
  overflow: visible;
}

[data-seo-site-audit] .seo-site-audit-table {
  table-layout: auto;
  width: max-content;
  max-width: 100%;
  font-size: 18px;
}

/* В аудите не применяем глобальное «2-я колонка слева» из SEO-запросов */
[data-seo-site-audit] .seo-site-audit-table th:nth-child(2),
[data-seo-site-audit] .seo-site-audit-table td:nth-child(2) {
  text-align: center;
}

[data-seo-site-audit] .seo-site-audit-table th,
[data-seo-site-audit] .seo-site-audit-table td {
  font-size: 18px;
  line-height: 1.35;
}

[data-seo-site-audit] .seo-site-audit-table th {
  padding: 14px 18px;
  vertical-align: bottom;
}

[data-seo-site-audit] .seo-site-audit-table td {
  padding: 12px 18px;
  vertical-align: middle;
}

[data-seo-site-audit] .seo-table-th-label,
[data-seo-site-audit] .seo-table-td-label {
  text-align: left;
  width: 1%;
  white-space: nowrap;
  padding-right: 20px;
  font-weight: 800;
  color: #0f172a;
  overflow: visible;
  position: relative;
}

[data-seo-site-audit] .seo-site-audit-table .seo-table-th-num,
[data-seo-site-audit] .seo-site-audit-table .seo-table-td-num {
  text-align: center;
  width: 88px;
  min-width: 88px;
  padding-left: 14px;
  padding-right: 14px;
}

[data-seo-site-audit] .seo-table-th-text,
[data-seo-site-audit] .seo-table-td-text {
  text-align: left;
  width: 1%;
  white-space: nowrap;
  padding-left: 16px;
}

.seo-site-audit-cat-score {
  font-weight: 900;
}

.seo-site-audit-issues-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 100%;
  overflow: visible;
}

.seo-site-audit-issues-panel .utm-matrix-expand-bar {
  margin-top: 12px;
}

.seo-site-audit-issues {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
  align-items: stretch;
  overflow: visible;
}

.seo-site-audit-issue {
  position: relative;
  z-index: 1;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0;
  background: #f8fafc;
  overflow: visible;
  height: 100%;
}

.seo-site-audit-issue-help {
  position: relative;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #ffffff;
  color: #475569;
  cursor: default;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.seo-site-audit-issue-help--corner {
  position: absolute;
  top: 10px;
  right: 10px;
}

.seo-site-audit-issue-help--inline {
  position: relative;
  top: auto;
  right: auto;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  vertical-align: middle;
}

/* Поднимаем целый блок-предок, иначе popover остаётся под соседними секциями */
.seo-site-audit-top:has(.seo-site-audit-issue-help:is(:hover, :focus-visible, :focus-within)),
.seo-site-audit-tables-row:has(.seo-site-audit-issue-help:is(:hover, :focus-visible, :focus-within)),
.seo-site-audit-table-panel:has(.seo-site-audit-issue-help:is(:hover, :focus-visible, :focus-within)),
.seo-site-audit-subhead:has(.seo-site-audit-issue-help:is(:hover, :focus-visible, :focus-within)),
.seo-site-audit-issues-panel:has(.seo-site-audit-issue-help:is(:hover, :focus-visible, :focus-within)) {
  position: relative;
  z-index: 400;
}

.seo-site-audit-issue:has(.seo-site-audit-issue-help:is(:hover, :focus-visible, :focus-within)),
.seo-site-audit-cat-label-row:has(.seo-site-audit-issue-help:is(:hover, :focus-visible, :focus-within)),
.seo-site-audit-hero:has(.seo-site-audit-issue-help:is(:hover, :focus-visible, :focus-within)),
.seo-site-audit-hero-score-wrap:has(.seo-site-audit-issue-help:is(:hover, :focus-visible, :focus-within)),
.seo-site-audit-hero-meta-line:has(.seo-site-audit-issue-help:is(:hover, :focus-visible, :focus-within)),
.seo-site-audit-issue-score-wrap:has(.seo-site-audit-issue-help:is(:hover, :focus-visible, :focus-within)),
.seo-site-audit-issue-impact:has(.seo-site-audit-issue-help:is(:hover, :focus-visible, :focus-within)) {
  position: relative;
  z-index: 410;
}

.seo-site-audit-subhead .seo-site-audit-issue-help--inline {
  margin-left: 2px;
}

.seo-site-audit-cat-label-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  position: relative;
}

.seo-site-audit-cat-label-row > span:first-child {
  flex: 0 1 auto;
  min-width: 0;
}

.seo-site-audit-issue-help:is(:hover, :focus-visible) {
  z-index: 420;
  border-color: #64748b;
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.14);
  outline: none;
}

.seo-site-audit-issue-help-icon {
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.seo-site-audit-issue-help-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  z-index: 500;
  width: min(320px, calc(100vw - 32px));
  padding: 14px 16px;
  border: 1px solid #94a3b8;
  border-radius: 12px;
  background: #ffffff;
  box-shadow:
    0 18px 40px rgba(15, 23, 42, 0.22),
    0 2px 8px rgba(15, 23, 42, 0.08);
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}

.seo-site-audit-issue-help-popover::before {
  content: "";
  position: absolute;
  top: -7px;
  right: 12px;
  width: 12px;
  height: 12px;
  border-left: 1px solid #94a3b8;
  border-top: 1px solid #94a3b8;
  background: #ffffff;
  transform: rotate(45deg);
}

/* Невидимый мост: курсор не теряет hover между ? и карточкой */
.seo-site-audit-issue-help-popover::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -14px;
  height: 14px;
}

.seo-site-audit-issue-help--below-start .seo-site-audit-issue-help-popover {
  right: auto;
  left: 0;
}

.seo-site-audit-issue-help--below-start .seo-site-audit-issue-help-popover::before {
  right: auto;
  left: 12px;
}

.seo-site-audit-issue-help:is(:hover, :focus-visible, :focus-within) .seo-site-audit-issue-help-popover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.seo-site-audit-issue-help-popover-title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.3;
  color: #0f172a;
}

.seo-site-audit-issue-help-popover-body {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  color: #334155;
}

.seo-site-audit-issue-help-popover-line {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  color: #334155;
}

.seo-site-audit-issue-help-popover-line:last-of-type {
  margin-bottom: 0;
}

.seo-site-audit-issue-help-popover-kicker {
  display: block;
  margin-bottom: 2px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.seo-site-audit-issue-help-popover-metrics {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  color: #334155;
}

.seo-site-audit-issue-help-popover-metrics strong {
  font-weight: 800;
  color: #0f172a;
}

.seo-site-audit-issue-help-popover-fix {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  color: #334155;
}

.seo-site-audit-issue-help-popover-fix strong {
  font-weight: 800;
  color: #0f172a;
}

.seo-site-audit-issue-help-popover-actions {
  display: flex;
  justify-content: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.seo-site-audit-issue-help-popover-actions .seo-site-audit-issue-detail-btn {
  margin: 0;
  pointer-events: auto;
}

.seo-site-audit-issue-help--align-left .seo-site-audit-issue-help-popover {
  right: auto;
  left: 0;
}

.seo-site-audit-issue-help--align-left .seo-site-audit-issue-help-popover::before {
  right: auto;
  left: 12px;
}

.seo-site-audit-issue-help--align-right .seo-site-audit-issue-help-popover {
  left: auto;
  right: 0;
}

.seo-site-audit-issue-help--align-right .seo-site-audit-issue-help-popover::before {
  left: auto;
  right: 12px;
}

.seo-site-audit-issue-score-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}

.seo-site-audit-issue--critical {
  border-color: #fecaca;
  background: #fff5f5;
  box-shadow: inset 4px 0 0 #dc2626;
}

.seo-site-audit-issue--high {
  border-color: #fed7aa;
  background: #fffaf5;
  box-shadow: inset 4px 0 0 #ea580c;
}

.seo-site-audit-issue--medium {
  box-shadow: inset 4px 0 0 #ca8a04;
}

.seo-site-audit-issue--low {
  box-shadow: inset 4px 0 0 #94a3b8;
}

.seo-site-audit-issue-main {
  height: 100%;
  padding: 14px 40px 14px 18px;
  display: flex;
  flex-direction: column;
}

.seo-site-audit-issue-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 8px;
}

.seo-site-audit-issue-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.seo-site-audit-issue-impact {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
  color: #1e293b;
}

.seo-site-audit-issue-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 14px;
}

.seo-site-audit-issue-traffic {
  margin: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
}

.seo-site-audit-issue-traffic--empty {
  flex: 1 1 auto;
}

.seo-site-audit-issue-traffic-value {
  font-size: 15px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.seo-site-audit-issue-traffic-period {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #64748b;
}

.seo-site-audit-issue--critical .seo-site-audit-issue-traffic-value {
  color: #b91c1c;
}

.seo-site-audit-issue--high .seo-site-audit-issue-traffic-value {
  color: #c2410c;
}

.seo-site-audit-issue-desc {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  color: #64748b;
}

.seo-site-audit-issue-score {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  color: #475569;
  white-space: nowrap;
}

.seo-site-audit-issue--critical .seo-site-audit-issue-score {
  border-color: #fecaca;
  background: #fff;
  color: #b91c1c;
}

.seo-site-audit-sev {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
}

.seo-site-audit-sev--critical {
  background: #dc2626;
  color: #ffffff;
}

.seo-site-audit-sev--high {
  background: #ea580c;
  color: #ffffff;
}

.seo-site-audit-sev--medium {
  background: #fef9c3;
  color: #854d0e;
}

.seo-site-audit-sev--low {
  background: #e2e8f0;
  color: #475569;
}

.seo-site-audit-issue-examples {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
}

.seo-site-audit-issue-examples-label {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #64748b;
}

.seo-site-audit-issue-urls {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  line-height: 1.4;
}

.seo-site-audit-issue-urls .seo-code {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.seo-site-audit-all-pass {
  color: #15803d;
}

.seo-site-audit-issue-detail-btn {
  margin-top: 0;
  margin-left: auto;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.seo-site-audit-issue-detail-btn:hover {
  border-color: #94a3b8;
  background: #f8fafc;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

body.seo-audit-issue-modal-open {
  overflow: hidden;
}

.seo-audit-issue-modal[hidden] {
  display: none !important;
}

.seo-audit-issue-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.seo-audit-issue-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.seo-audit-issue-modal--visible .seo-audit-issue-modal-backdrop {
  opacity: 1;
}

.seo-audit-issue-modal-panel {
  --modal-accent: #2563eb;
  --modal-accent-soft: #eff6ff;
  position: relative;
  z-index: 1;
  width: min(800px, 100%);
  max-height: min(90vh, 920px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid #dbe3ef;
  background: #ffffff;
  box-shadow:
    0 28px 80px rgba(15, 23, 42, 0.22),
    0 8px 24px rgba(15, 23, 42, 0.08);
  outline: none;
  opacity: 0;
  transform: translateY(18px) scale(0.96);
  transition:
    opacity 0.24s ease,
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.seo-audit-issue-modal-panel[data-severity="critical"] {
  --modal-accent: #dc2626;
  --modal-accent-soft: #fef2f2;
}

.seo-audit-issue-modal-panel[data-severity="high"] {
  --modal-accent: #ea580c;
  --modal-accent-soft: #fff7ed;
}

.seo-audit-issue-modal-panel[data-severity="medium"] {
  --modal-accent: #ca8a04;
  --modal-accent-soft: #fefce8;
}

.seo-audit-issue-modal-panel[data-severity="low"] {
  --modal-accent: #64748b;
  --modal-accent-soft: #f8fafc;
}

.seo-audit-issue-modal--visible .seo-audit-issue-modal-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.custom-scroll-host {
  position: relative;
  max-width: 100%;
}

.custom-scroll-host--fill {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.custom-scroll-view {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.custom-scroll-host--x > .custom-scroll-view {
  overflow-x: auto;
  overflow-y: hidden;
}

.custom-scroll-host--both > .custom-scroll-view {
  overflow: auto;
}

.custom-scroll-view::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.custom-scroll-track {
  position: absolute;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.custom-scroll-track--y {
  top: 8px;
  right: 6px;
  bottom: 8px;
  width: 6px;
  background: rgba(148, 163, 184, 0.14);
}

.custom-scroll-track--x {
  left: 8px;
  right: 8px;
  bottom: 6px;
  height: 6px;
  background: rgba(148, 163, 184, 0.14);
}

.custom-scroll-host:hover .custom-scroll-track,
.custom-scroll-host.is-scrolling .custom-scroll-track {
  opacity: 1;
}

.custom-scroll-thumb {
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.55);
  transform: translateY(0);
  transition: background 0.15s ease;
}

.custom-scroll-track--x .custom-scroll-thumb {
  height: 100%;
  min-height: 0;
  min-width: 48px;
}

.custom-scroll-host:hover .custom-scroll-thumb,
.custom-scroll-host.is-scrolling .custom-scroll-thumb {
  background: rgba(71, 85, 105, 0.78);
}

.custom-scroll-host--both .custom-scroll-track--y {
  bottom: 16px;
}

.custom-scroll-host--both .custom-scroll-track--x {
  right: 14px;
}

.seo-audit-issue-modal-panel > .custom-scroll-host--fill {
  max-height: min(90vh, 920px);
}

.seo-audit-issue-modal-scroll.custom-scroll-view {
  max-height: min(90vh, 920px);
}

.seo-audit-issue-modal-x {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  font-size: 28px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
  transition: transform 0.15s ease, background 0.15s ease;
}

.seo-audit-issue-modal-x:hover {
  background: #ffffff;
  transform: scale(1.04);
}

.seo-audit-issue-modal-hero {
  padding: 28px 32px 24px;
  padding-right: 72px;
  background: linear-gradient(165deg, var(--modal-accent-soft) 0%, #ffffff 72%);
  border-bottom: 1px solid #e8edf4;
}

.seo-audit-issue-modal-eyebrow {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.seo-audit-issue-modal-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 14px;
}

.seo-audit-issue-modal-sev {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.seo-audit-issue-modal-sev--critical {
  background: #dc2626;
  color: #ffffff;
}

.seo-audit-issue-modal-sev--high {
  background: #ea580c;
  color: #ffffff;
}

.seo-audit-issue-modal-sev--medium {
  background: #fef08a;
  color: #854d0e;
}

.seo-audit-issue-modal-sev--low {
  background: #e2e8f0;
  color: #475569;
}

.seo-audit-issue-modal-score-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid #dbe3ef;
  background: #ffffff;
  font-size: 15px;
  font-weight: 800;
  color: #334155;
}

.seo-audit-issue-modal-title {
  margin: 0 0 12px;
  font-size: clamp(26px, 4vw, 32px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: #0f172a;
}

.seo-audit-issue-modal-lead {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.55;
  color: #475569;
  max-width: 62ch;
}

.seo-audit-issue-modal-body {
  padding: 24px 32px 28px;
}

.seo-audit-issue-modal-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.seo-audit-issue-modal-metric {
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.seo-audit-issue-modal-metric--bad {
  border-color: #fecaca;
  background: #fff5f5;
}

.seo-audit-issue-modal-metric--good {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.seo-audit-issue-modal-metric--warn {
  border-color: #fed7aa;
  background: #fff7ed;
}

.seo-audit-issue-modal-metric--neutral {
  border-color: #dbeafe;
  background: #eff6ff;
}

.seo-audit-issue-modal-metric-value {
  margin: 0;
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.seo-audit-issue-modal-metric--bad .seo-audit-issue-modal-metric-value {
  color: #b91c1c;
}

.seo-audit-issue-modal-metric--good .seo-audit-issue-modal-metric-value {
  color: #15803d;
}

.seo-audit-issue-modal-metric--warn .seo-audit-issue-modal-metric-value {
  color: #c2410c;
}

.seo-audit-issue-modal-metric-label {
  margin: 8px 0 0;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
  color: #0f172a;
}

.seo-audit-issue-modal-metric-hint {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: #64748b;
}

.seo-audit-issue-modal-action {
  margin-bottom: 22px;
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid #dbeafe;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
  box-shadow: inset 4px 0 0 var(--modal-accent);
}

.seo-audit-issue-modal-action-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 900;
  color: #0f172a;
}

.seo-audit-issue-modal-action-text {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.55;
  color: #334155;
}

.seo-audit-issue-modal-lists {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.seo-audit-issue-modal-section {
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.seo-audit-issue-modal-section-title {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.25;
  color: #0f172a;
}

.seo-audit-issue-modal-count {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background: #e2e8f0;
  font-size: 14px;
  font-weight: 800;
  color: #334155;
  vertical-align: middle;
}

.seo-audit-issue-modal-urls {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.seo-audit-issue-modal-url {
  padding: 12px 14px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  font-size: 15px;
  line-height: 1.45;
}

.seo-audit-issue-modal-link {
  color: #1d4ed8;
  font-weight: 700;
  text-decoration: none;
  word-break: break-all;
}

.seo-audit-issue-modal-link:hover {
  text-decoration: underline;
}

.seo-audit-issue-modal-expand {
  margin-top: 12px;
}

.seo-audit-issue-modal-expand .utm-matrix-expand-btn {
  font-size: 15px;
  padding: 10px 20px;
}

.seo-audit-issue-modal-empty {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #64748b;
}

@media (prefers-reduced-motion: reduce) {
  .seo-audit-issue-modal-backdrop,
  .seo-audit-issue-modal-panel {
    transition: none;
  }

  .seo-audit-issue-modal-panel {
    transform: none;
  }
}

@media (max-width: 640px) {
  .seo-audit-issue-modal-hero,
  .seo-audit-issue-modal-body {
    padding-left: 20px;
    padding-right: 20px;
  }

  .seo-audit-issue-modal-hero {
    padding-top: 24px;
    padding-right: 64px;
  }

  .seo-audit-issue-modal-metrics {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 900px) {
  .seo-site-audit-tables-row {
    grid-template-columns: 1fr;
  }

  .seo-site-audit-issues {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .seo-site-audit-hero {
    align-items: flex-start;
    gap: 10px 16px;
  }

  .seo-site-audit-hero-copy {
    padding-top: 0;
  }
}

.seo-mini--totals {
  font-size: 15px;
  font-weight: 900;
  color: #000000;
}

.seo-expand-bar {
  display: flex;
  justify-content: center;
  padding: 10px 12px;
  margin-top: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.seo-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  font-size: 15px;
  font-weight: 900;
  color: #000000;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.seo-expand-btn:hover {
  border-color: #94a3b8;
  background: #f1f5f9;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.seo-expand-chevron {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.seo-mini {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
}

.seo-hint,
.seo-empty {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #94a3b8;
}

.seo-error {
  color: #b91c1c;
  font-weight: 700;
  font-size: 14px;
}

/* CMR: периоды сравнения */
.cmr-dashboard {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.cmr-compare-target-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-top: 8px;
}

.cmr-seo-source-row {
  margin-top: 0;
}

.cmr-seo-source-row[hidden] {
  display: none !important;
}

.cmr-compare-target-label {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}

.cmr-compare-target-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  padding: 6px;
  background: #eef1f5;
  border: 1px solid #e3e8ef;
  border-radius: 14px;
}

/* Календарь в шапке таблицы */
.cmr-table-outer {
  display: flex;
  align-items: flex-start;
  flex-wrap: nowrap;
  gap: 12px;
  width: fit-content;
  max-width: 100%;
}

/* «+» в одной горизонтали с триггерами дат (шапка), а не внизу таблицы */
.cmr-table-add-slot {
  flex-shrink: 0;
  padding-top: 8px;
}

.cmr-picker-toolbar {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.cmr-picker-slot {
  min-width: 0;
  flex: 1 1 auto;
}

.cmr-th-picker {
  text-align: right;
  vertical-align: bottom;
  padding: 12px 14px 10px;
  border-right: 1px solid #e8ecf2;
  border-bottom: 1px solid #dce3ec;
  background: #eef2f7;
}

.cmr-head-row .cmr-th-picker:last-child {
  border-right: none;
}

.cmr-date-slot-remove {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.cmr-date-slot-remove:hover {
  background: #f1f5f9;
  color: #64748b;
}

.cmr-picker-slot .date-range-trigger {
  padding: 12px 18px;
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  border-radius: 14px;
}

/* Открываем вправо от колонки: при right:0 широкая панель уезжает влево и режется overflow скролла */
.cmr-picker-slot .date-dropdown-panel {
  left: 0;
  right: auto;
}

/* Пока календарь открыт — не клипать панель горизонтальным скроллом таблицы */
.cmr-table-scroll:has(.date-range-dropdown.open) {
  overflow-x: visible;
}

/* CMR: таблица сравнения (OVR) */
.cmr-table-panel {
  min-height: 88px;
}

.cmr-table-loading,
.cmr-table-placeholder {
  font-size: 14px;
  color: #64748b;
  padding: 6px 0 2px;
}

.cmr-table-placeholder--err {
  color: #b91c1c;
  font-weight: 700;
}

.cmr-table-outer .cmr-table-scroll {
  flex: 1 1 auto;
  min-width: 0;
}

.cmr-table-scroll {
  overflow-x: auto;
  width: fit-content;
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid #e3e8ef;
  background: #ffffff;
}

.cmr-table {
  width: auto;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  /* Как подпись периода в шапке: .cmr-picker-slot .date-range-trigger → 18px / 700 */
  font-size: 18px;
  font-weight: 700;
}

.cmr-table col.cmr-col-metric {
  width: 13.5rem;
}

.cmr-table col.cmr-col-data {
  width: auto;
  min-width: 13.5rem;
}

.cmr-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cmr-th-metric,
.cmr-td-metric {
  position: sticky;
  left: 0;
  z-index: 4;
  text-align: left;
  padding: 12px 14px;
  border-right: 1px solid #e3e8ef;
  white-space: nowrap;
}

thead .cmr-head-row .cmr-th-metric {
  z-index: 6;
  font-size: 18px;
  font-weight: 700;
  vertical-align: bottom;
  background: #eef2f7;
  border-bottom: 1px solid #dce3ec;
  color: #2c2c2c;
}

.cmr-td-metric {
  font-size: 18px;
  background: #f8fafc;
  border-bottom: 1px solid #eef1f5;
  color: #2c2c2c;
  font-weight: 700;
}

.cmr-td-val {
  text-align: center;
  vertical-align: middle;
  padding: 12px 14px;
  font-size: 18px;
  font-weight: 700;
  border-bottom: 1px solid #eef1f5;
  border-right: 1px solid #dce3ec;
}

.cmr-td-val:last-child {
  border-right: none;
}

.cmr-val-stack {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
  max-width: 100%;
}

.cmr-num {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #2c2c2c;
}

.cmr-delta {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.cmr-delta--up {
  color: #15803d;
}

.cmr-delta--down {
  color: #b91c1c;
}

tbody tr:last-child .cmr-td-metric,
tbody tr:last-child .cmr-td-val {
  border-bottom: none;
}

/* Плюс периода рядом с таблицей */
.cmr-table-add-slot .cmr-add-date-slot.utm-toggle-btn {
  margin-bottom: 0;
}

/* --- Theme: Dark --- */
:root[data-theme="dark"] {
  --bg: #0f172a;
  --ui-1: #0b1220;
  --surface: #111827;
  --border: #243042;
  --text-main: #e5e7eb;
  --text-strong: #f3f4f6;
  --text-muted: #94a3b8;
  --text-subtle: #9ca3af;
  --primary: #095909;
  --secondary: #095909;
}

:root[data-theme="dark"] body {
  background: #0b1220;
  color: #e5e7eb;
}

:root[data-theme="dark"] .top,
:root[data-theme="dark"] .sidebar,
:root[data-theme="dark"] .content-layout {
  background: transparent;
}

:root[data-theme="dark"] .menu a { color: #d1d5db; }
:root[data-theme="dark"] .menu a:hover { background: #172033; }

:root[data-theme="dark"] .top-pills,
:root[data-theme="dark"] .cmr-compare-target-pills {
  background: #121a2a;
  border-color: #253247;
}

:root[data-theme="dark"] .meta-value-chip {
  background: #111827;
  border-color: #2a3649;
  color: #cbd5e1;
}

:root[data-theme="dark"] .meta-value-chip:hover {
  background: #172033;
  border-color: #334155;
}

:root[data-theme="dark"] .meta-dot {
  color: #64748b;
}

:root[data-theme="dark"] .profile-trigger,
:root[data-theme="dark"] .profile-dropdown,
:root[data-theme="dark"] .report-download-btn,
:root[data-theme="dark"] .report-download-menu,
:root[data-theme="dark"] .chat-panel,
:root[data-theme="dark"] .chat-history,
:root[data-theme="dark"] .date-dropdown-panel {
  background: #111827;
  border-color: #2a3649;
  color: #e5e7eb;
}

:root[data-theme="dark"] .profile-dropdown-item,
:root[data-theme="dark"] .report-download-menu-item,
:root[data-theme="dark"] .chat-add,
:root[data-theme="dark"] .chat-history-btn,
:root[data-theme="dark"] .chat-close {
  color: #e5e7eb;
}

:root[data-theme="dark"] .profile-dropdown-item:hover,
:root[data-theme="dark"] .report-download-menu-item:hover,
:root[data-theme="dark"] .chat-add:hover,
:root[data-theme="dark"] .chat-history-btn:hover,
:root[data-theme="dark"] .chat-close:hover {
  background: #1b2638;
  border-color: #334155;
}

:root[data-theme="dark"] .kpi-card,
:root[data-theme="dark"] .utm-kpi-card,
:root[data-theme="dark"] .nvr-card,
:root[data-theme="dark"] .funnel-card,
:root[data-theme="dark"] .overview-summary-card,
:root[data-theme="dark"] .top3-card,
:root[data-theme="dark"] .cjm-insight-card,
:root[data-theme="dark"] .settings-card,
:root[data-theme="dark"] .utm-card,
:root[data-theme="dark"] .seo-card,
:root[data-theme="dark"] .cmr-table-scroll {
  background: #111827;
  border-color: #273449;
  box-shadow: none;
}

:root[data-theme="dark"] .utm-kpi-scope,
:root[data-theme="dark"] .utm-section--kpi .utm-kpi-footnote {
  color: #94a3b8;
}

:root[data-theme="dark"] .cjm-insight-card--rank,
:root[data-theme="dark"] .cjm-insight-card--routes,
:root[data-theme="dark"] .cjm-insight-card--heat,
:root[data-theme="dark"] .cjm-insight-card--time,
:root[data-theme="dark"] .overview-top-grid--cjm .top3-card,
:root[data-theme="dark"] .overview-top-grid--utm .top3-card {
  background: #111827;
}

:root[data-theme="dark"] .cjm-route-item,
:root[data-theme="dark"] .cjm-heat-row,
:root[data-theme="dark"] .cjm-transition-row,
:root[data-theme="dark"] .top3-row {
  background: #172033;
  border-color: #2b3a50;
}

:root[data-theme="dark"] .cjm-transition-count,
:root[data-theme="dark"] .top3-value,
:root[data-theme="dark"] .top3-value-visits,
:root[data-theme="dark"] .top3-value-leads {
  background: #0f172a;
  border-color: #334155;
  color: #e5e7eb;
}

:root[data-theme="dark"] .cjm-route-chip,
:root[data-theme="dark"] .top3-rank {
  background: #1d2a3d;
  border-color: #334155;
  color: #d1d5db;
}

:root[data-theme="dark"] .cjm-card-expand {
  background: #1d2a3d;
  border-color: #334155;
  color: #cbd5e1;
}

:root[data-theme="dark"] .cjm-card-expand:hover {
  background: #243349;
  border-color: #475569;
  color: #e2e8f0;
}

:root[data-theme="dark"] .cjm-rank-line {
  background: linear-gradient(90deg, #095909 var(--cjm-rank), #233043 var(--cjm-rank));
}

:root[data-theme="dark"] .cjm-bar-track {
  background: #233043;
}

:root[data-theme="dark"] .cjm-route-sep,
:root[data-theme="dark"] .cjm-transition-arrow {
  color: #94a3b8;
}

:root[data-theme="dark"] .nvr-title,
:root[data-theme="dark"] .funnel-title,
:root[data-theme="dark"] .overview-summary-title,
:root[data-theme="dark"] .seo-card-title,
:root[data-theme="dark"] .top3-row,
:root[data-theme="dark"] .cjm-rank-label,
:root[data-theme="dark"] .cjm-rank-value,
:root[data-theme="dark"] .cjm-bar-label,
:root[data-theme="dark"] .cjm-bar-value,
:root[data-theme="dark"] .cjm-route-count,
:root[data-theme="dark"] .cjm-heat-label,
:root[data-theme="dark"] .cjm-heat-value,
:root[data-theme="dark"] .cjm-transition-from,
:root[data-theme="dark"] .cjm-transition-to,
:root[data-theme="dark"] .cjm-time-table th,
:root[data-theme="dark"] .cjm-time-table td,
:root[data-theme="dark"] .nvr-table th,
:root[data-theme="dark"] .nvr-table td,
:root[data-theme="dark"] .funnel-table th,
:root[data-theme="dark"] .funnel-table td,
:root[data-theme="dark"] .overview-summary-table th,
:root[data-theme="dark"] .overview-summary-table td,
:root[data-theme="dark"] .seo-table th,
:root[data-theme="dark"] .seo-table td,
:root[data-theme="dark"] .cmr-num,
:root[data-theme="dark"] .cmr-td-val,
:root[data-theme="dark"] .cmr-td-metric,
:root[data-theme="dark"] .cmr-th-metric,
:root[data-theme="dark"] .cmr-th-picker {
  color: #e5e7eb;
}

:root[data-theme="dark"] .cmr-th-metric,
:root[data-theme="dark"] .cmr-th-picker {
  background: #172033;
  border-color: #2a3649;
}

:root[data-theme="dark"] .cmr-td-metric {
  background: #131d2e;
  border-color: #26354a;
}

:root[data-theme="dark"] .cmr-td-val {
  border-right: 1px solid #2b3a50;
  border-bottom-color: #233043;
}

:root[data-theme="dark"] .cmr-td-val:last-child {
  border-right: none;
}

:root[data-theme="dark"] .pill-btn,
:root[data-theme="dark"] .date-range-trigger,
:root[data-theme="dark"] .date-input-inline,
:root[data-theme="dark"] .utm-field-input,
:root[data-theme="dark"] .utm-field input,
:root[data-theme="dark"] .utm-field select,
:root[data-theme="dark"] .utm-field textarea {
  background: #0f172a;
  border-color: #2a3649;
  color: #e5e7eb;
}

:root[data-theme="dark"] .pill-btn:hover,
:root[data-theme="dark"] .date-nav-btn:hover {
  background: #1a2436;
  border-color: #334155;
}

:root[data-theme="dark"] .pill-btn.active,
:root[data-theme="dark"] .tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

:root[data-theme="dark"] .calendar-month h4,
:root[data-theme="dark"] .calendar-day,
:root[data-theme="dark"] .date-range-meta,
:root[data-theme="dark"] .chat-header {
  color: #e5e7eb;
}

:root[data-theme="dark"] .chat-composer {
  background: #2a2a2a;
  border-color: transparent;
}

:root[data-theme="dark"] .chat-composer:focus-within {
  border-color: transparent;
}

:root[data-theme="dark"] .chat-input {
  background: transparent;
  color: transparent !important;
  -webkit-text-fill-color: transparent;
  caret-color: #dbe8ff;
}

:root[data-theme="dark"] .chat-panel,
:root[data-theme="dark"] .chat-messages {
  background: #0f1115 !important;
}

:root[data-theme="dark"] .calendar-day.in-range { background: #243244; }
:root[data-theme="dark"] .calendar-day.disabled { background: #1f2937 !important; color: #6b7280 !important; }

:root[data-theme="dark"] .date-chevron {
  color: #9ca3af;
}

:root[data-theme="dark"] .date-dropdown-panel {
  box-shadow: 0 16px 30px rgba(2, 6, 23, 0.55);
}

:root[data-theme="dark"] .date-dropdown-header {
  border-bottom: 0;
}

:root[data-theme="dark"] .date-nav-btn {
  color: #cbd5e1;
}

:root[data-theme="dark"] .date-nav-btn:disabled {
  color: #64748b;
  opacity: 0.5;
}

:root[data-theme="dark"] .calendar-weekhead span {
  color: #94a3b8;
}

:root[data-theme="dark"] .calendar-day {
  color: #e5e7eb;
}

:root[data-theme="dark"] .calendar-day.weekend {
  color: #fda4af;
}

:root[data-theme="dark"] .calendar-day.empty {
  background: transparent;
}

:root[data-theme="dark"] .calendar-day.range-start,
:root[data-theme="dark"] .calendar-day.range-end {
  background: var(--primary);
  color: #ffffff;
}

:root[data-theme="dark"] .date-dropdown-footer {
  border-top-color: #2a3649;
}

:root[data-theme="dark"] .date-input-inline::placeholder {
  color: #64748b;
}

:root[data-theme="dark"] .date-range-meta {
  color: #94a3b8;
}

:root[data-theme="dark"] .date-apply-btn {
  background: linear-gradient(90deg, #095909 0%, #0b6a0b 100%);
  color: #ffffff;
}

:root[data-theme="dark"] .date-apply-btn:hover {
  background: linear-gradient(90deg, #0b6a0b 0%, #0d7a0d 100%);
}

/* UTM: полный dark-pass */
:root[data-theme="dark"] .utm-heading,
:root[data-theme="dark"] .utm-podium-label,
:root[data-theme="dark"] .utm-field span,
:root[data-theme="dark"] .utm-status,
:root[data-theme="dark"] .utm-matrix-meta,
:root[data-theme="dark"] .utm-sort,
:root[data-theme="dark"] .utm-matrix-th,
:root[data-theme="dark"] .utm-matrix-td,
:root[data-theme="dark"] .utm-base-link {
  color: #e5e7eb;
}

:root[data-theme="dark"] .utm-lede,
:root[data-theme="dark"] .utm-empty-hint,
:root[data-theme="dark"] .utm-field-label,
:root[data-theme="dark"] .utm-matrix-th--dim,
:root[data-theme="dark"] .utm-matrix-th--idx {
  color: #94a3b8;
}

:root[data-theme="dark"] .utm-matrix-toolbar,
:root[data-theme="dark"] .utm-matrix-expand-bar,
:root[data-theme="dark"] .utm-base-options {
  background: #111827;
  border-color: #2a3649;
}

:root[data-theme="dark"] .utm-matrix-scroll,
:root[data-theme="dark"] .utm-card,
:root[data-theme="dark"] .utm-kpi-card {
  background: #111827;
  border-color: #273449;
}

:root[data-theme="dark"] .utm-podium-row,
:root[data-theme="dark"] .utm-matrix-tr:nth-child(even) {
  background: #172033;
  border-color: #2b3a50;
}

:root[data-theme="dark"] .utm-podium-row--gold,
:root[data-theme="dark"] .utm-podium-row--silver,
:root[data-theme="dark"] .utm-podium-row--bronze {
  background: #172033;
  border-color: #2b3a50;
}

:root[data-theme="dark"] .utm-podium-place {
  background: #1d2a3d;
  border-color: #334155;
  color: #e5e7eb;
}

:root[data-theme="dark"] .utm-podium-row--gold .utm-podium-place {
  background: #334155;
  border-color: #475569;
  color: #e5e7eb;
}

:root[data-theme="dark"] .utm-podium-metric--visits,
:root[data-theme="dark"] .utm-row-num,
:root[data-theme="dark"] .utm-chip,
:root[data-theme="dark"] .utm-val--visits {
  background: #1f2937;
  border-color: #334155;
  color: #cbd5e1;
}

:root[data-theme="dark"] .utm-podium-metric--leads,
:root[data-theme="dark"] .utm-val--leads {
  background: #113226;
  border-color: #1f5c43;
  color: #bbf7d0;
}

:root[data-theme="dark"] .utm-modes .utm-mode-btn,
:root[data-theme="dark"] .utm-matrix-mode-btn,
:root[data-theme="dark"] .utm-btn.ghost,
:root[data-theme="dark"] .utm-matrix-expand-btn,
:root[data-theme="dark"] .utm-base-option {
  background: #0f172a;
  border-color: #334155;
  color: #e5e7eb;
}

:root[data-theme="dark"] .utm-modes .utm-mode-btn.active,
:root[data-theme="dark"] .utm-matrix-mode-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

:root[data-theme="dark"] .utm-matrix-mode-btn:hover:not(.active),
:root[data-theme="dark"] .utm-btn.ghost:hover,
:root[data-theme="dark"] .utm-matrix-expand-btn:hover,
:root[data-theme="dark"] .utm-base-option:hover {
  background: #1a2436;
  border-color: #475569;
}

:root[data-theme="dark"] .utm-btn {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

:root[data-theme="dark"] .utm-btn:hover:not(:disabled) {
  background: #0b6a0b;
  border-color: #0b6a0b;
}

:root[data-theme="dark"] .utm-sort-arrow {
  color: #86efac;
}

:root[data-theme="dark"] .utm-matrix thead {
  background: #131d2e;
  box-shadow: 0 1px 0 #2a3649;
}

:root[data-theme="dark"] .utm-matrix-th {
  border-bottom-color: #2a3649;
}

:root[data-theme="dark"] .utm-matrix-td {
  border-bottom-color: #233043;
}

:root[data-theme="dark"] .utm-matrix-tr:hover .utm-matrix-td {
  background: #1d2a3d;
}

:root[data-theme="dark"] .utm-matrix-empty {
  color: #94a3b8;
}

/* SEO: полный dark-pass */
:root[data-theme="dark"] .seo-dashboard {
  color: #e5e7eb;
}

:root[data-theme="dark"] .seo-source-pills {
  background: #121a2a;
  border-color: #253247;
}

:root[data-theme="dark"] .seo-card-lede {
  color: #94a3b8;
}

:root[data-theme="dark"] .seo-mini,
:root[data-theme="dark"] .seo-hint,
:root[data-theme="dark"] .seo-empty {
  color: #94a3b8;
}

:root[data-theme="dark"] .range-notice {
  border-color: #3a4252;
  background: #252b36;
  color: #e2e8f0;
}

:root[data-theme="dark"] .range-notice--info {
  border-color: #3a4252;
  background: #1f2530;
  color: #cbd5e1;
}

:root[data-theme="dark"] .range-notice--partial {
  border-color: #854d0e;
  background: #2a2318;
  color: #fcd34d;
}

:root[data-theme="dark"] .range-notice--empty {
  border-color: #7f1d1d;
  background: #2a1818;
  color: #fca5a5;
}

:root[data-theme="dark"] .seo-mini--totals {
  color: #e5e7eb;
}

:root[data-theme="dark"] .seo-error {
  color: #fca5a5;
}

:root[data-theme="dark"] .seo-code {
  background: #1f2937;
  color: #e5e7eb;
  border: 1px solid #334155;
}

:root[data-theme="dark"] .seo-table-wrap {
  background: #111827;
  border-color: #2a3649;
}

:root[data-theme="dark"] .seo-table th {
  background: #131d2e;
  color: #e5e7eb;
  border-bottom-color: #2a3649;
}

:root[data-theme="dark"] .seo-table td {
  color: #e5e7eb;
  border-bottom-color: #233043;
}

:root[data-theme="dark"] .seo-site-fold {
  background: #111827;
  border-color: #2a3649;
}

:root[data-theme="dark"] .seo-site-fold-trigger {
  background: #172033;
  color: #e5e7eb;
}

:root[data-theme="dark"] .seo-site-fold-trigger:hover {
  background: #1d2a3d;
}

:root[data-theme="dark"] .seo-site-fold-body {
  background: #111827;
  border-top-color: #2a3649;
}

:root[data-theme="dark"] .seo-domain-line {
  color: #94a3b8;
}

:root[data-theme="dark"] .seo-psi-strat-col {
  background: #0f172a;
  border-color: #2a3649;
}

:root[data-theme="dark"] .seo-psi-strat-head {
  color: #f3f4f6;
}

:root[data-theme="dark"] .seo-psi-metric-row {
  border-bottom-color: #2a3649;
  font-size: 16px;
  font-weight: 900;
  color: #e5e7eb;
}

:root[data-theme="dark"] .seo-psi-legend-summary {
  color: #94a3b8;
}

:root[data-theme="dark"] .seo-psi-legend-term {
  color: #cbd5e1;
}

:root[data-theme="dark"] .seo-psi-metric-row dt {
  font-size: 14px;
  font-weight: 800;
  color: #e5e7eb;
}

:root[data-theme="dark"] .seo-psi-metric-row dd {
  font-size: 14px;
  font-weight: 900;
  color: #f8fafc;
}

:root[data-theme="dark"] .seo-psi-domain-line {
  color: #e5e7eb;
}

:root[data-theme="dark"] .seo-lh-seo-block {
  border-top-color: #334155;
}

:root[data-theme="dark"] .seo-lh-seo-head {
  color: #94a3b8;
}

:root[data-theme="dark"] .seo-lh-score {
  color: #f8fafc;
}

:root[data-theme="dark"] .seo-lh-score--good {
  color: #4ade80;
}

:root[data-theme="dark"] .seo-lh-score--mid {
  color: #fbbf24;
}

:root[data-theme="dark"] .seo-lh-score--bad {
  color: #f87171;
}

:root[data-theme="dark"] .seo-lh-audit-list {
  color: #cbd5e1;
}

:root[data-theme="dark"] .seo-lh-audit-fail strong {
  color: #f8fafc;
}

:root[data-theme="dark"] .seo-lh-audit-desc {
  color: #94a3b8;
}

:root[data-theme="dark"] .seo-lh-all-pass {
  color: #4ade80;
}

:root[data-theme="dark"] .seo-lh-report-link {
  color: #93c5fd;
}

:root[data-theme="dark"] .seo-site-audit-score:not([data-seo-audit-score]) {
  color: #f8fafc;
}

:root[data-theme="dark"] .seo-site-audit-grade {
  color: #e2e8f0;
}

:root[data-theme="dark"] .seo-site-audit-hero-copy .seo-mini {
  color: #94a3b8;
}

:root[data-theme="dark"] .seo-site-audit-pages strong {
  color: #e2e8f0;
}

:root[data-theme="dark"] .seo-site-audit-subhead {
  color: #f8fafc;
}

:root[data-theme="dark"] .seo-site-audit-subhead-label {
  color: #ffffff;
}

:root[data-theme="dark"] .seo-site-audit-issue {
  background: #1e293b;
  border-color: #334155;
  box-shadow: none;
}

:root[data-theme="dark"] .seo-site-audit-issue--critical {
  background: #3f1d24;
  border-color: #7f1d1d;
  box-shadow: inset 4px 0 0 #ef4444;
}

:root[data-theme="dark"] .seo-site-audit-issue--high {
  background: #3b2618;
  border-color: #9a3412;
  box-shadow: inset 4px 0 0 #f97316;
}

:root[data-theme="dark"] .seo-site-audit-issue--medium {
  box-shadow: inset 4px 0 0 #eab308;
}

:root[data-theme="dark"] .seo-site-audit-issue--low {
  box-shadow: inset 4px 0 0 #64748b;
}

:root[data-theme="dark"] .seo-site-audit-issue-title {
  color: #f8fafc;
}

:root[data-theme="dark"] .seo-site-audit-issue-impact {
  color: #e2e8f0;
}

:root[data-theme="dark"] .seo-site-audit-issue-traffic-value {
  color: #ffffff;
}

:root[data-theme="dark"] .seo-site-audit-issue-traffic-period {
  color: #94a3b8;
}

:root[data-theme="dark"] .seo-site-audit-issue--critical .seo-site-audit-issue-traffic-value {
  color: #fca5a5;
}

:root[data-theme="dark"] .seo-site-audit-issue--high .seo-site-audit-issue-traffic-value {
  color: #fdba74;
}

:root[data-theme="dark"] .seo-site-audit-issue-desc {
  color: #94a3b8;
}

:root[data-theme="dark"] .seo-site-audit-issue-score {
  background: #0f172a;
  border-color: #475569;
  color: #cbd5e1;
}

:root[data-theme="dark"] .seo-site-audit-issue--critical .seo-site-audit-issue-score {
  border-color: #7f1d1d;
  color: #fca5a5;
}

:root[data-theme="dark"] .seo-site-audit-issue-examples {
  border-top-color: rgba(148, 163, 184, 0.2);
}

:root[data-theme="dark"] .seo-site-audit-issue-help {
  background: #0f172a;
  border-color: #475569;
  color: #cbd5e1;
}

:root[data-theme="dark"] .seo-site-audit-issue-help:hover,
:root[data-theme="dark"] .seo-site-audit-issue-help:focus-visible {
  background: #1e293b;
  border-color: #64748b;
  color: #f8fafc;
}

:root[data-theme="dark"] .seo-site-audit-issue-help-popover {
  background: #1e293b;
  border-color: #64748b;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}

:root[data-theme="dark"] .seo-site-audit-issue-help-popover::before {
  border-left-color: #64748b;
  border-top-color: #64748b;
  background: #1e293b;
}

:root[data-theme="dark"] .seo-site-audit-issue-help-popover-title {
  color: #ffffff;
}

:root[data-theme="dark"] .seo-site-audit-issue-help-popover-body,
:root[data-theme="dark"] .seo-site-audit-issue-help-popover-line {
  color: #f1f5f9;
}

:root[data-theme="dark"] .seo-site-audit-issue-help-popover-kicker {
  color: #cbd5e1;
}

:root[data-theme="dark"] .seo-site-audit-issue-help-popover-metrics {
  border-top-color: #334155;
  color: #cbd5e1;
}

:root[data-theme="dark"] .seo-site-audit-issue-help-popover-metrics strong {
  color: #f1f5f9;
}

:root[data-theme="dark"] .seo-site-audit-issue-help-popover-fix {
  color: #cbd5e1;
}

:root[data-theme="dark"] .seo-site-audit-issue-help-popover-fix strong {
  color: #f1f5f9;
}

:root[data-theme="dark"] .seo-site-audit-issue-help-popover-actions {
  border-top-color: #334155;
}

:root[data-theme="dark"] .seo-site-audit-issue-detail-btn {
  background: #0f172a;
  border-color: #475569;
  color: #e2e8f0;
}

:root[data-theme="dark"] .seo-site-audit-issue-detail-btn:hover {
  background: #1e293b;
  border-color: #64748b;
}

:root[data-theme="dark"] .seo-site-audit-meta-chip {
  border-color: #334155;
  background: #1e293b;
  color: #cbd5e1;
}

:root[data-theme="dark"] .seo-site-audit-issue-examples-label {
  color: #ffffff;
}

:root[data-theme="dark"] .seo-site-audit-text-detail {
  color: #e2e8f0;
}

:root[data-theme="dark"] .seo-audit-issue-modal-panel {
  background: #1e293b;
  border-color: #475569;
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.45),
    0 8px 24px rgba(0, 0, 0, 0.25);
}

:root[data-theme="dark"] .seo-audit-issue-modal-panel[data-severity="critical"] {
  --modal-accent-soft: rgba(220, 38, 38, 0.14);
}

:root[data-theme="dark"] .seo-audit-issue-modal-panel[data-severity="high"] {
  --modal-accent-soft: rgba(234, 88, 12, 0.14);
}

:root[data-theme="dark"] .seo-audit-issue-modal-panel[data-severity="medium"] {
  --modal-accent-soft: rgba(202, 138, 4, 0.14);
}

:root[data-theme="dark"] .seo-audit-issue-modal-panel[data-severity="low"] {
  --modal-accent-soft: rgba(100, 116, 139, 0.18);
}

:root[data-theme="dark"] .seo-audit-issue-modal-hero {
  background: linear-gradient(165deg, var(--modal-accent-soft) 0%, #1e293b 72%);
  border-bottom-color: #334155;
}

:root[data-theme="dark"] .seo-audit-issue-modal-eyebrow {
  color: #ffffff;
}

:root[data-theme="dark"] .seo-audit-issue-modal-score-pill {
  background: #0f172a;
  border-color: #475569;
  color: #e2e8f0;
}

:root[data-theme="dark"] .seo-audit-issue-modal-x {
  background: rgba(15, 23, 42, 0.88);
  border-color: #475569;
  color: #f1f5f9;
}

:root[data-theme="dark"] .seo-audit-issue-modal-x:hover {
  background: #0f172a;
}

:root[data-theme="dark"] .seo-audit-issue-modal-title,
:root[data-theme="dark"] .seo-audit-issue-modal-action-title,
:root[data-theme="dark"] .seo-audit-issue-modal-section-title,
:root[data-theme="dark"] .seo-audit-issue-modal-metric-label {
  color: #f8fafc;
}

:root[data-theme="dark"] .seo-audit-issue-modal-lead,
:root[data-theme="dark"] .seo-audit-issue-modal-action-text,
:root[data-theme="dark"] .seo-audit-issue-modal-metric-hint {
  color: #cbd5e1;
}

:root[data-theme="dark"] .seo-audit-issue-modal-metric {
  background: #0f172a;
  border-color: #334155;
}

:root[data-theme="dark"] .seo-audit-issue-modal-metric-value {
  color: #f8fafc;
}

:root[data-theme="dark"] .seo-audit-issue-modal-metric--bad {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(127, 29, 29, 0.22);
}

:root[data-theme="dark"] .seo-audit-issue-modal-metric--bad .seo-audit-issue-modal-metric-value {
  color: #fca5a5;
}

:root[data-theme="dark"] .seo-audit-issue-modal-metric--good {
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(20, 83, 45, 0.22);
}

:root[data-theme="dark"] .seo-audit-issue-modal-metric--good .seo-audit-issue-modal-metric-value {
  color: #86efac;
}

:root[data-theme="dark"] .seo-audit-issue-modal-metric--warn {
  border-color: rgba(251, 146, 60, 0.4);
  background: rgba(124, 45, 18, 0.22);
}

:root[data-theme="dark"] .seo-audit-issue-modal-metric--warn .seo-audit-issue-modal-metric-value {
  color: #fdba74;
}

:root[data-theme="dark"] .seo-audit-issue-modal-metric--neutral {
  border-color: rgba(96, 165, 250, 0.35);
  background: rgba(30, 58, 138, 0.22);
}

:root[data-theme="dark"] .seo-audit-issue-modal-metric--neutral .seo-audit-issue-modal-metric-value {
  color: #93c5fd;
}

:root[data-theme="dark"] .seo-audit-issue-modal-action {
  background: linear-gradient(180deg, rgba(30, 58, 138, 0.18) 0%, #1e293b 100%);
  border-color: #334155;
}

:root[data-theme="dark"] .seo-audit-issue-modal-section {
  background: #0f172a;
  border-color: #334155;
}

:root[data-theme="dark"] .seo-audit-issue-modal-count {
  background: #334155;
  color: #e2e8f0;
}

:root[data-theme="dark"] .seo-audit-issue-modal-url {
  background: #1e293b;
  border-color: #334155;
}

:root[data-theme="dark"] .seo-audit-issue-modal-link {
  color: #93c5fd;
}

:root[data-theme="dark"] .seo-audit-issue-modal-empty {
  color: #94a3b8;
}

:root[data-theme="dark"] .custom-scroll-track--y,
:root[data-theme="dark"] .custom-scroll-track--x {
  background: rgba(51, 65, 85, 0.55);
}

:root[data-theme="dark"] .custom-scroll-thumb {
  background: rgba(148, 163, 184, 0.42);
}

:root[data-theme="dark"] .custom-scroll-host:hover .custom-scroll-thumb,
:root[data-theme="dark"] .custom-scroll-host.is-scrolling .custom-scroll-thumb {
  background: rgba(203, 213, 225, 0.62);
}

:root[data-theme="dark"] [data-seo-site-audit] .seo-table-td-label,
:root[data-theme="dark"] [data-seo-site-audit] .seo-table-th-label {
  color: #f1f5f9;
}

:root[data-theme="dark"] .seo-site-audit-method {
  color: #94a3b8;
}

:root[data-theme="dark"] .seo-psi-domain-line .seo-code {
  color: #e5e7eb;
}

:root[data-theme="dark"] .seo-site-fold-num {
  background: #1f2937;
  color: #e5e7eb;
  border-color: #334155;
}

:root[data-theme="dark"] .seo-site-fold-plus {
  background: #0f172a;
  border-color: #334155;
  color: #e5e7eb;
}

:root[data-theme="dark"] .seo-site-fold-label {
  color: #f3f4f6;
}

:root[data-theme="dark"] .seo-expand-bar {
  background: #111827;
  border-color: #2a3649;
}

:root[data-theme="dark"] .seo-expand-btn {
  background: #0f172a;
  border-color: #334155;
  color: #e5e7eb;
}

:root[data-theme="dark"] .seo-expand-btn:hover {
  background: #1a2436;
  border-color: #475569;
}

:root[data-theme="dark"] .seo-expand-chevron {
  color: #cbd5e1;
}

/* Тулбокс карточек (SEO использует те же классы, что CJM) */
:root[data-theme="dark"] .cjm-card-tool {
  background: #172033;
  border-color: #334155;
  color: #cbd5e1;
}

:root[data-theme="dark"] .cjm-card-tool:hover {
  background: #1d2a3d;
  border-color: #475569;
}

:root[data-theme="dark"] .cjm-card-menu {
  background: #111827;
  border-color: #2a3649;
}

:root[data-theme="dark"] .cjm-card-menu-item {
  color: #e5e7eb;
}

:root[data-theme="dark"] .cjm-card-menu-item:hover {
  background: #1a2436;
  border-color: #334155;
}

/* Настройки: полный dark-pass */
:root[data-theme="dark"] .settings-goals-card,
:root[data-theme="dark"] .settings-card {
  box-shadow: none;
}

:root[data-theme="dark"] .settings-card-head {
  border-bottom-color: #2a3649;
}

:root[data-theme="dark"] .settings-field-value {
  color: var(--text-main);
}

:root[data-theme="dark"] .settings-block--tint {
  background: #131d2e;
  border-color: #2a3649;
}

:root[data-theme="dark"] .settings-chip {
  background: #113226;
  border-color: #1f5c43;
  color: #bbf7d0;
}

:root[data-theme="dark"] .settings-chip--muted {
  background: #1f2937;
  border-color: #334155;
  color: #94a3b8;
}

:root[data-theme="dark"] .settings-path-row {
  background: #172033;
  border-color: #2b3a50;
}

:root[data-theme="dark"] .settings-path-code,
:root[data-theme="dark"] .settings-lang-code {
  color: #e5e7eb;
}

:root[data-theme="dark"] .settings-error {
  color: #fca5a5;
}

:root[data-theme="dark"] .settings-error code {
  background: #1f2937;
  color: #e5e7eb;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid #334155;
}

:root[data-theme="dark"] .settings-user-photo {
  background: #131d2e;
  border-color: #2a3649;
}

:root[data-theme="dark"] .settings-user-photo--empty {
  color: #64748b;
}

:root[data-theme="dark"] .settings-user-photo-input {
  background: #0f172a;
  border-color: #334155;
  color: #e5e7eb;
}

:root[data-theme="dark"] .settings-user-photo-input::file-selector-button {
  background: #1a2436;
  border-color: #334155;
  color: #cbd5e1;
}

:root[data-theme="dark"] .settings-user-photo-remove {
  background: #131d2e;
  border-color: #334155;
  color: #cbd5e1;
}

:root[data-theme="dark"] .profile-avatar-placeholder {
  background: #1a2436;
  color: #94a3b8;
}

:root[data-theme="dark"] .settings-user-photo-status,
:root[data-theme="dark"] .settings-user-photo-hint {
  color: #94a3b8;
}

:root[data-theme="dark"] .auth-page {
  background: linear-gradient(180deg, #0b1220 0%, #111827 100%);
}

:root[data-theme="dark"] .auth-card {
  background: #111827;
  border-color: #2a3649;
  box-shadow: 0 18px 36px rgba(2, 6, 23, 0.55);
}

:root[data-theme="dark"] .auth-title {
  color: #f3f4f6;
}

:root[data-theme="dark"] .auth-subtitle,
:root[data-theme="dark"] .auth-label {
  color: #94a3b8;
}

:root[data-theme="dark"] .auth-tabs {
  background: #131d2e;
  border-color: #2a3649;
}

:root[data-theme="dark"] .auth-tab {
  color: #cbd5e1;
}

:root[data-theme="dark"] .auth-input {
  background: #0f172a;
  border-color: #334155;
  color: #e5e7eb;
}

:root[data-theme="dark"] .auth-error {
  background: #2a1318;
  border-color: #7f1d1d;
  color: #fca5a5;
}

:root[data-theme="dark"] .app-status {
  border-color: #334155;
  background: rgba(15, 23, 42, 0.96);
  color: #e2e8f0;
  box-shadow: 0 10px 28px rgba(2, 6, 23, 0.45);
}

:root[data-theme="dark"] .app-status--success {
  border-color: #1f5d43;
  background: rgba(8, 39, 24, 0.96);
  color: #bbf7d0;
}

:root[data-theme="dark"] .app-status--warn {
  border-color: #7c5f2a;
  background: rgba(54, 37, 8, 0.96);
  color: #fcd34d;
}

:root[data-theme="dark"] .app-status--error {
  border-color: #7f1d1d;
  background: rgba(48, 14, 14, 0.96);
  color: #fecaca;
}
