/* APIExport — корпоративный B2B-стиль (в духе evrotechlab.ru):
   светлый фон, тёмная верхняя полоса у гостя, акцент navy + бирюза, шрифты Open Sans + Source Serif 4. */

:root {
  color-scheme: light;
  --font: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;

  --bg: #e8ecf3;
  --bg-accent: linear-gradient(180deg, #e2e8f0 0%, #eef2f7 42%, #e8ecf3 100%);
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --text: #1e293b;
  --text-heading: #1a2d42;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --navy: #1a2d42;
  --navy-deep: #0f1b2e;

  --accent: #0d9488;
  --accent-hover: #0f766e;
  --accent-soft: rgba(13, 148, 136, 0.12);
  --accent-ring: rgba(13, 148, 136, 0.25);

  --primary: #0f766e;
  --primary-hover: #0d5c56;
  --primary-soft: var(--accent-soft);
  --primary-ring: var(--accent-ring);

  --danger-bg: #fef2f2;
  --danger: #b91c1c;
  --danger-border: #fecaca;

  --success-bg: #ecfdf5;
  --success: #047857;
  --success-border: #a7f3d0;

  --warn-bg: #fffbeb;
  --warn-text: #92400e;
  --warn-border: #fde68a;

  --info-bg: #f0fdfa;
  --info-text: #0f766e;
  --info-border: #99f6e4;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.1);

  --radius: 16px;
  --radius-sm: 10px;

  --table-th-bg: linear-gradient(180deg, #f0fdfa 0%, #ecfdf5 100%);
  --input-focus-bg: #ffffff;
  --btn-ghost-hover-bg: #ffffff;
  --code-text: #334155;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f172a;
  --bg-accent: linear-gradient(180deg, #0c1222 0%, #111827 45%, #0f172a 100%);
  --surface: #1e293b;
  --surface-muted: #334155;
  --text: #e2e8f0;
  --text-heading: #f1f5f9;
  --muted: #94a3b8;
  --border: #334155;
  --border-strong: #475569;
  --navy: #e2e8f0;
  --navy-deep: #020617;
  --accent: #2dd4bf;
  --accent-hover: #5eead4;
  --accent-soft: rgba(45, 212, 191, 0.14);
  --accent-ring: rgba(45, 212, 191, 0.28);
  --primary: #14b8a6;
  --primary-hover: #2dd4bf;
  --primary-soft: rgba(45, 212, 191, 0.14);
  --primary-ring: rgba(45, 212, 191, 0.28);
  --danger-bg: rgba(127, 29, 29, 0.28);
  --danger: #fca5a5;
  --danger-border: #7f1d1d;
  --success-bg: rgba(6, 78, 59, 0.32);
  --success: #6ee7b7;
  --success-border: #065f46;
  --warn-bg: rgba(120, 53, 15, 0.32);
  --warn-text: #fde68a;
  --warn-border: #b45309;
  --info-bg: rgba(19, 78, 74, 0.32);
  --info-text: #99f6e4;
  --info-border: #0f766e;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 4px 22px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 22px 55px rgba(0, 0, 0, 0.55);
  --table-th-bg: linear-gradient(180deg, #134e4a 0%, #115e59 100%);
  --input-focus-bg: #1e293b;
  --btn-ghost-hover-bg: #475569;
  --code-text: #cbd5e1;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100vh;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-accent);
  background-attachment: fixed;
}

/* ——— Гость: шапка сайта (полоса + логотип + навигация) ——— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(26, 45, 66, 0.08), 0 8px 24px rgba(15, 23, 42, 0.06);
}

.site-topbar {
  background: linear-gradient(90deg, var(--navy-deep) 0%, var(--navy) 55%, #1e3a5f 100%);
  color: rgba(248, 250, 252, 0.92);
  font-size: 13px;
  padding: 9px 0;
}

[data-theme="dark"] .site-topbar {
  background: linear-gradient(90deg, #020617 0%, #0f172a 52%, #1e293b 100%);
}

.site-topbar__inner {
  display: flex;
  /* baseline: в одну строку кнопки садятся на линию текста, а не на геометрический центр «высокой» line-box */
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  row-gap: 8px;
  column-gap: 16px;
  text-align: center;
}

.site-topbar__text {
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: 0.01em;
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(100%, 42rem);
  text-align: center;
}

@media (max-width: 520px) {
  .site-topbar {
    font-size: 12px;
    padding: 8px 0;
  }
}

.site-navband {
  border-bottom: 1px solid var(--border);
}

.site-navband__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding: 16px 0 14px;
}

.site-logo {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--navy);
  text-decoration: none;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.site-logo span {
  color: var(--accent);
  font-weight: 700;
}

.top-nav {
  display: flex;
  gap: 2px;
  align-items: center;
  flex-wrap: wrap;
}

.top-nav a {
  display: inline-block;
  padding: 10px 16px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-sm);
}

.top-nav a:hover {
  color: var(--accent-hover);
  background: var(--accent-soft);
}

.theme-switcher {
  display: inline-flex;
  align-items: stretch;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  gap: 2px;
}

.theme-switcher--sidebar {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: fit-content;
  max-width: calc(100% - 24px);
  min-width: 0;
  margin: 0 auto 14px;
  padding: 0;
  gap: 4px;
  border: none;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}

.theme-switcher__btn {
  flex: 1;
  min-width: 0;
  padding: 7px 12px;
  border: none;
  border-radius: calc(var(--radius-sm) - 3px);
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.theme-switcher:not(.theme-switcher--sidebar):not(.theme-switcher--topbar) .theme-switcher__btn {
  flex: 0 0 auto;
  padding: 6px 11px;
}

.theme-switcher--topbar {
  flex-shrink: 0;
  /* auto — иначе align-self: center «перетягивает» к центру короба строки и визуально опускает блок иконок */
  align-self: auto;
  align-items: center; /* вместо stretch у .theme-switcher — убирает «пустой» фон сверху иконок */
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.theme-switcher--topbar .theme-switcher__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 0;
  padding: 3px 7px;
  font-size: 14px;
  line-height: 1;
  color: rgba(248, 250, 252, 0.88);
}

.theme-switcher--topbar .theme-switcher__btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.theme-switcher--topbar .theme-switcher__btn.is-active {
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
  box-shadow: none;
}

.theme-switcher--topbar .theme-switcher__btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

.theme-switcher__btn:hover {
  color: var(--text-heading);
  background: var(--accent-soft);
}

.theme-switcher__btn.is-active {
  background: var(--surface);
  color: var(--accent-hover);
  box-shadow: var(--shadow-sm);
}

.theme-switcher__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Идут после .theme-switcher__btn, иначе flex:1 снова затирает и кнопки растягивают на всю ширину */
.theme-switcher--sidebar .theme-switcher__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 0;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  box-sizing: border-box;
  font-size: 15px;
  line-height: 1;
}

.theme-switcher--sidebar .theme-switcher__icon {
  line-height: 1;
  display: block;
}

.theme-switcher__icon {
  display: inline-block;
  pointer-events: none;
}

.theme-switcher--topbar .theme-switcher__icon {
  display: block;
  line-height: 1;
  font-size: 1.1rem;
}

/* ——— Приложение: боковое меню (тёмное, как на многих корп. порталах) ——— */
body.layout-app {
  display: flex;
  min-height: 100vh;
  margin: 0;
  align-items: stretch;
}

@media (min-width: 961px) {
  /* Одна колонка контента прокручивается; сайдбар остаётся на экране. */
  body.layout-app {
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
  }

  body.layout-app .main-area {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  body.layout-app .sidebar {
    align-self: stretch;
    max-height: 100vh;
  }
}

.sidebar {
  width: 260px;
  flex-shrink: 0;
  min-width: 0; /* в layout-app (flex) не раздувать колонку из-за min-content внутри */
  padding: 24px 0 28px;
  overflow-x: hidden;
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 32px rgba(15, 23, 42, 0.04);
}

.sidebar-brand {
  padding: 0 20px 18px;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--navy);
  border-bottom: 1px solid var(--border);
  margin: 0 12px 10px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
}

.sidebar-link {
  display: block;
  padding: 12px 14px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sidebar-link:hover {
  color: var(--navy);
  background: var(--surface-muted);
}

.sidebar-link.is-active {
  color: var(--accent-hover);
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

.sidebar-link--muted {
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-weight: 500;
  color: var(--muted);
}

.sidebar-link--muted:hover {
  color: var(--navy);
}

/* Десктоп: полное меню (подписи без декоративных глифов). */
@media (min-width: 961px) {
  body.layout-app .sidebar .theme-switcher--sidebar {
    width: auto;
    max-width: none;
    margin: 0 12px 10px;
    padding: 8px 8px 12px;
    border-bottom: 1px solid var(--border);
    box-sizing: border-box;
  }

  body.layout-app .sidebar .sidebar-brand__glyph {
    display: none;
  }

  body.layout-app .sidebar .sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
  }

  body.layout-app .sidebar .sidebar-link__glyph {
    display: none;
  }

  body.layout-app .sidebar .sidebar-link__text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1 1 auto;
  }
}

/* ——— Основная область ——— */
.main-area {
  flex: 1;
  min-width: 0;
  padding: 32px 24px 72px;
}

.shell {
  max-width: 1320px;
  margin: 0 auto;
  width: 100%;
}

/* Кнопка «Заказать консультацию»: плашка fixed у верха вьюпорта, всегда полностью видна */
.consultation-cta-portal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 45;
  display: flex;
  justify-content: center;
  padding: env(safe-area-inset-top, 0px) max(24px, env(safe-area-inset-right, 0px)) 0
    max(24px, env(safe-area-inset-left, 0px));
  box-sizing: border-box;
  pointer-events: none;
}

.consultation-cta-portal .consultation-cta {
  pointer-events: auto;
}

.consultation-cta {
  position: relative;
  width: auto;
  max-width: none;
  margin: 0 auto 18px;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
  cursor: default;
}

.consultation-cta__inner {
  display: inline-flex;
  align-items: stretch;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 0;
  min-width: min-content;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  /* Розовый акцент: отличается от основного бирюзового бренда */
  background: linear-gradient(180deg, #f472b6 0%, #db2777 100%);
  border: 1px solid rgba(190, 24, 93, 0.42);
  border-top: none;
  box-shadow: 0 2px 12px rgba(219, 39, 119, 0.32);
  overflow: hidden;
}

[data-theme="dark"] .consultation-cta__inner {
  background: linear-gradient(180deg, #f9a8d4 0%, #be185d 100%);
  border-color: rgba(244, 114, 182, 0.38);
  box-shadow: 0 4px 18px rgba(236, 72, 153, 0.35);
}

body.has-consultation-cta .main-area {
  padding-top: calc(32px + 52px);
}

.consultation-cta__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  margin: 0;
  border-radius: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  transition: filter 0.15s;
}

.consultation-cta__link:hover {
  filter: brightness(1.06);
  color: #fff;
}

.consultation-page .consultation-form {
  max-width: 560px;
}

body.layout-guest .main-area {
  padding-top: 28px;
}

body.layout-guest.has-consultation-cta .main-area {
  padding-top: calc(28px + 52px);
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(1.65rem, 2.5vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-heading);
  line-height: 1.2;
}

.page-head h1 {
  font-family: var(--font-serif);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--navy);
}

h2 {
  margin: 22px 0 10px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-heading);
}

p {
  margin: 10px 0 16px;
  color: var(--muted);
  line-height: 1.55;
}

.page-eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.page-head {
  margin-bottom: 28px;
  max-width: 1200px;
}

.page-lead {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
  line-height: 1.55;
  max-width: 640px;
}

/* Отчёты VK / Яндекс: подпись и h1 слева узким блоком, абзац — на всю ширину main */
.page-head--report {
  max-width: none;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
  box-sizing: border-box;
}

.page-head--report .page-head__titles {
  max-width: min(30rem, 100%);
}

.page-head--report .page-lead {
  max-width: none;
  width: 100%;
}

/* Подпись поля + «?» с title (отчёты VK Реклама / агентство) */
#dashboard-params-form .field-label-text,
#agency-params-form .field-label-text {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35em;
}

#dashboard-params-form .field-hint,
#agency-params-form .field-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15em;
  min-width: 1.15em;
  height: 1.15em;
  font-size: 0.72em;
  line-height: 1;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: help;
  user-select: none;
  flex-shrink: 0;
  vertical-align: middle;
}

#dashboard-params-form .field-hint:hover,
#dashboard-params-form .field-hint:focus-visible,
#agency-params-form .field-hint:hover,
#agency-params-form .field-hint:focus-visible {
  color: var(--accent-hover);
  border-color: var(--accent);
  outline: none;
}

#dashboard-params-form .field-hint:focus-visible,
#agency-params-form .field-hint:focus-visible {
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.panel-title {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-heading);
}

.form-subheading {
  margin: 22px 0 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-heading);
}

/* ——— Герой (главная): фон-картинка + затемнение + текст (как на корп. лендингах) ——— */
.hero {
  position: relative;
  border-radius: calc(var(--radius) + 4px);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 90% 70% at 100% 0%, rgba(13, 148, 136, 0.07) 0%, transparent 55%);
}

.hero--home {
  margin-top: 4px;
}

/* Баннер: фон через <img> (надёжнее, чем url() в CSS при 404), затемнение, светлый текст */
.hero--banner {
  border: none;
  min-height: min(440px, 58vh);
  background-color: var(--navy-deep);
  box-shadow: var(--shadow-lg);
}

.hero--banner::after {
  display: none;
}

.hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  border-radius: inherit;
}

.hero__bg-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.hero__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    118deg,
    rgba(8, 18, 32, 0.92) 0%,
    rgba(15, 27, 46, 0.62) 42%,
    rgba(8, 18, 32, 0.78) 100%
  );
}

.hero__inner {
  position: relative;
  z-index: 2;
  max-width: 44rem;
  padding: 44px 40px 48px;
}

.hero__eyebrow {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(94, 234, 212, 0.95);
}

.hero--banner .hero__eyebrow {
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.35);
}

.hero__title {
  margin: 0 0 16px;
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 3.2vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--navy);
  line-height: 1.2;
}

.hero--banner .hero__title {
  color: #fff;
  font-size: clamp(2rem, 4vw, 2.75rem);
  text-shadow: 0 2px 28px rgba(0, 0, 0, 0.45);
}

.hero__lead {
  margin: 0 0 28px;
  max-width: 46ch;
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1.65;
}

.hero--banner .hero__lead {
  max-width: 52rem;
  font-size: 1.06rem;
  color: rgba(248, 250, 252, 0.92);
  line-height: 1.65;
  text-shadow: 0 1px 16px rgba(0, 0, 0, 0.35);
}

.hero__lead strong {
  color: var(--text-heading);
  font-weight: 700;
}

.hero--banner .hero__lead strong {
  color: #fff;
  font-weight: 700;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

/* Главная: цвета отчётов (синий VK, оранжевый Яндекс) */
.hero--home .hero__btn--vk-blue {
  color: #fff;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  border: 1px solid rgba(37, 99, 235, 0.55);
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.4);
}

.hero--home .hero__btn--vk-blue:hover {
  color: #fff;
  filter: brightness(1.05);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.48);
}

.hero--home .hero__btn--vk-blue:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

.hero--home .hero__btn--yandex {
  color: #fff;
  background: linear-gradient(180deg, #fb923c 0%, #ea580c 100%);
  border: 1px solid rgba(234, 88, 12, 0.6);
  box-shadow: 0 2px 12px rgba(234, 88, 12, 0.38);
}

.hero--home .hero__btn--yandex:hover {
  color: #fff;
  filter: brightness(1.05);
  box-shadow: 0 4px 16px rgba(234, 88, 12, 0.45);
}

.hero--home .hero__btn--yandex:focus-visible {
  outline: 2px solid #fdba74;
  outline-offset: 2px;
}

/* ——— Кнопки (ссылки-CTA и обычные) ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.btn-primary {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(13, 148, 136, 0.38);
  border-color: rgba(13, 148, 136, 0.45);
}

.btn-primary:hover {
  filter: brightness(1.04);
  box-shadow: 0 4px 18px rgba(13, 148, 136, 0.45);
}

.btn-ghost {
  background: var(--surface-muted);
  border-color: var(--border-strong);
  color: var(--navy);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
  background: var(--btn-ghost-hover-bg);
}

.btn--on-dark {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.45);
  color: #fff;
  box-shadow: none;
}

.btn--on-dark:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.65);
  color: #fff;
}

/*
 * Кнопка VK ID (основная): бренд Azure #0077FF, типографика и высота по гайдлайнам.
 * https://id.vk.com/about/business/go/docs/ru/vkid/latest/vk-id/connection/guidelines/design-rules
 */
.vkid-btn {
  --vkid-blue: #0077ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  color: #fff;
  background: var(--vkid-blue);
  border: 1px solid transparent;
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  transition: filter 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.vkid-btn:hover {
  filter: brightness(0.97);
}

.vkid-btn:focus {
  outline: none;
}

.vkid-btn:focus-visible {
  outline: 2px solid var(--vkid-blue);
  outline-offset: 2px;
}

.vkid-btn__icon {
  display: inline-flex;
  flex-shrink: 0;
  color: inherit;
}

.vkid-btn__icon svg {
  display: block;
}

.vkid-btn__text {
  white-space: nowrap;
}

/* Обязательный пробел между «VK» и «ID» — в разметке используем VK&nbsp;ID */
.vkid-btn__brand {
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* Дополнительная кнопка (белая с обводкой) — рядом с другими действиями */
.vkid-btn--secondary {
  color: #191919;
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.vkid-btn--secondary:hover {
  filter: none;
  background: #f7f7f7;
}

.vkid-btn--secondary:focus-visible {
  outline-color: #191919;
}

.vkid-btn--secondary .vkid-btn__icon {
  color: #0077ff;
}

[data-theme="dark"] .vkid-btn:not(.vkid-btn--secondary) {
  /* Брендовый синий сохраняем на тёмной теме */
  background: var(--vkid-blue);
  color: #fff;
}

[data-theme="dark"] .vkid-btn--secondary {
  background: #ffffff;
  color: #191919;
  border-color: rgba(0, 0, 0, 0.12);
}

.btn-row .vkid-btn {
  flex: 0 1 auto;
}

.text-link {
  color: var(--accent-hover);
  font-weight: 600;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

/* ——— Авторизация ——— */
.auth-layout {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px 0 40px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 36px 32px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.auth-card__title {
  margin-bottom: 20px;
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--navy);
}

.auth-card__footer {
  margin: 20px 0 0;
  font-size: 14px;
  text-align: center;
  color: var(--muted);
}

.auth-card__footer a {
  color: var(--accent-hover);
  font-weight: 600;
  text-decoration: none;
}

.auth-card__footer a:hover {
  text-decoration: underline;
}

.form-compact label:first-child {
  margin-top: 0;
}

/* ——— Формы ——— */
form {
  margin: 12px 0 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 22px 24px;
  box-shadow: var(--shadow);
}

.auth-card form {
  margin-top: 0;
  padding: 0;
  border: none;
  box-shadow: none;
  background: transparent;
}

label {
  display: block;
  margin-top: 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-heading);
}

label:first-child {
  margin-top: 0;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="date"],
textarea {
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-muted);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

input:hover {
  border-color: var(--border-strong);
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  background: var(--input-focus-bg);
  box-shadow: 0 0 0 4px var(--accent-ring);
}

select {
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-muted);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  outline: none;
  cursor: pointer;
}

select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}

button[type="submit"],
button {
  margin-top: 18px;
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(13, 148, 136, 0.4);
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(13, 148, 136, 0.28);
  transition: filter 0.15s, transform 0.1s;
}

button:hover {
  filter: brightness(1.05);
}

button:active {
  transform: translateY(1px);
}

button.btn-secondary {
  background: var(--surface-muted);
  border: 1px solid var(--border-strong);
  color: var(--text-heading);
  box-shadow: none;
  margin-top: 10px;
}

button.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
  background: var(--btn-ghost-hover-bg);
}

.main-area p[style*="color:red"] {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  color: var(--danger) !important;
  border: 1px solid var(--danger-border);
}

.callout {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.5;
}

.callout-warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn-text);
}

.callout a {
  color: var(--accent-hover);
  font-weight: 700;
}

.callout-info {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  color: var(--info-text);
}

/* Пошаговая инструкция VK API (oauth.vk.ru) на странице «Интеграции» */
.vk-auth-guide {
  margin-top: 1.25rem;
  padding: 1.25rem 1.35rem 1.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.vk-auth-guide__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.vk-auth-guide__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
}

.vk-auth-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.vk-auth-status--ok {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.vk-auth-status--no {
  background: var(--warn-bg);
  color: var(--warn-text);
  border: 1px solid var(--warn-border);
}

.vk-auth-steps {
  counter-reset: vkstep;
  margin: 0;
  padding: 0;
  list-style: none;
}

.vk-auth-step {
  position: relative;
  margin: 0 0 1.15rem;
  padding: 0 0 0 2.65rem;
  min-height: 1.5rem;
}

.vk-auth-step:last-child {
  margin-bottom: 0;
}

.vk-auth-step::before {
  counter-increment: vkstep;
  content: counter(vkstep);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.85rem;
  height: 1.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  line-height: 1;
}

[data-theme="dark"] .vk-auth-step::before {
  color: #0f172a;
}

.vk-auth-step__title {
  margin: 0 0 0.35rem;
  font-size: 0.98rem;
  font-weight: 700;
}

.vk-auth-step p {
  margin: 0 0 0.4rem;
  font-size: 14px;
  line-height: 1.55;
}

.vk-auth-step p:last-child {
  margin-bottom: 0;
}

.vk-auth-step code,
.vk-auth-guide code {
  font-size: 0.9em;
}

.integrations-section-title {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
  font-weight: 700;
}

/* Вкладки: VK / Яндекс на странице «Интеграции» */
.integrations-service {
  margin-top: 1rem;
}

.integrations-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1.25rem;
  padding: 0;
  border: none;
  background: transparent;
}

.integrations-tabs__tab {
  flex: 1 1 200px;
  margin: 0;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

/* VK — сине-голубой */
.integrations-tabs__tab--vk {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #93c5fd;
}

.integrations-tabs__tab--vk:hover {
  color: #1e3a8a;
  background: #dbeafe;
  border-color: #60a5fa;
}

.integrations-tabs__tab--vk.is-active {
  color: #fff;
  background: #2563eb;
  border-color: #1d4ed8;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

/* Яндекс Директ — оранжевый */
.integrations-tabs__tab--yandex {
  color: #c2410c;
  background: #fff7ed;
  border-color: #fdba74;
}

.integrations-tabs__tab--yandex:hover {
  color: #9a3412;
  background: #ffedd5;
  border-color: #fb923c;
}

.integrations-tabs__tab--yandex.is-active {
  color: #fff;
  background: #ea580c;
  border-color: #c2410c;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.35);
}

[data-theme="dark"] .integrations-tabs__tab--vk:not(.is-active) {
  color: #93c5fd;
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(59, 130, 246, 0.45);
}

[data-theme="dark"] .integrations-tabs__tab--vk:hover:not(.is-active) {
  background: rgba(37, 99, 235, 0.3);
  color: #bfdbfe;
}

[data-theme="dark"] .integrations-tabs__tab--vk.is-active {
  background: #3b82f6;
  border-color: #60a5fa;
  color: #fff;
}

[data-theme="dark"] .integrations-tabs__tab--yandex:not(.is-active) {
  color: #fdba74;
  background: rgba(234, 88, 12, 0.15);
  border-color: rgba(251, 146, 60, 0.45);
}

[data-theme="dark"] .integrations-tabs__tab--yandex:hover:not(.is-active) {
  background: rgba(234, 88, 12, 0.28);
  color: #fed7aa;
}

[data-theme="dark"] .integrations-tabs__tab--yandex.is-active {
  background: #f97316;
  border-color: #fb923c;
  color: #fff;
}

.integrations-panel[hidden] {
  display: none !important;
}

.integrations-panel:not([hidden]) {
  display: block;
}

/* Страница «Интеграции»: одна ширина для всех вкладок; контент шире прежнего «Агентского» (52rem) */
.integrations-page {
  box-sizing: border-box;
  width: min(100%, 72rem);
  max-width: min(100%, 72rem);
  min-width: 0;
  margin-left: auto;
  margin-right: auto;
  font-size: 0.5rem; /* 8px from 16px root — в 2× меньше базового текста форм */
  line-height: 1.4;
}

.integrations-page .page-head {
  margin-bottom: 0.75rem;
  max-width: none;
}

.integrations-page h1 {
  font-size: 3.1em; /* заметно крупнее остального текста на странице (база 0.5rem) */
  margin-bottom: 0.4em;
}

.integrations-page .success-msg,
.integrations-page .error-msg {
  font-size: 1.5em;
  margin: 0.5em 0;
  padding: 0.5em 0.65em;
}

.integrations-page .integrations-service {
  margin-top: 0.5em;
}

.integrations-page .integrations-tabs {
  margin-bottom: 0.5rem;
  padding: 0;
  gap: 4px;
  border: none;
  background: transparent;
}

.integrations-page .integrations-tabs__tab {
  padding: 0.4em 0.65em;
  font-size: 1.5em; /* 12px */
  font-weight: 600;
  flex: 1 1 0;
  min-width: 0;
}

/* «Яндекс Директ» — чуть шире в ряду (как раньше), длинная подпись не ломает сетку */
.integrations-page .integrations-tabs__tab--yandex {
  flex: 1.35 1 12em;
  min-width: 9em;
}

.integrations-page .integrations-section-title {
  margin: 0.5em 0 0.35em;
  font-size: 1.75em; /* 14px */
  font-weight: 700;
}

.integrations-page .integrations-vk-section {
  margin-bottom: 1.35em;
  padding-bottom: 0.25em;
}

.integrations-page .integrations-vk-section + .integrations-vk-section {
  margin-top: 1.1em;
  padding-top: 0.35em;
}

/* Блок «Токен VK API»: единая шкала; Redirect URI — мельче, как URL */
.integrations-page .integrations-vk-section--token .vk-auth-guide__head {
  margin-bottom: 0.55em;
}

.integrations-page .integrations-vk-section--token .integrations-section-title {
  font-size: 1.6em;
  font-weight: 700;
  margin: 0.35em 0 0.3em;
}

.integrations-page .integrations-vk-section--token .vk-auth-status {
  font-size: 1.25em;
  padding: 0.2em 0.45em;
}

.integrations-page .integrations-vk-section--token input[type="password"],
.integrations-page .integrations-vk-section--token input[type="text"]:not(.integrations-redirect-uri) {
  font-size: 0.8125rem;
  line-height: 1.4;
  font-weight: 400;
}

.integrations-page .integrations-vk-section--token input.integrations-redirect-uri {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 0.3em;
  padding: 0.35rem 0.45rem;
  font-size: 0.75rem;
  line-height: 1.4;
  font-weight: 400;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  letter-spacing: 0.01em;
  color: var(--muted);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  word-break: break-all;
}

.integrations-page .integrations-vk-section--token .vkid-btn {
  font-size: 0.75rem;
  line-height: 1.2;
  padding: 0.4rem 0.65rem;
}

.integrations-page .integrations-vk-section--token .integrations-form--vk-token__vkid-row {
  margin: 0.4em 0 0.25em;
}

.integrations-page .integrations-vk-section--token .integrations-form--vk-token__check-row {
  margin-top: 0.45em;
}

.integrations-page .integrations-vk-section--token .integrations-form--vk-token__submit {
  /* отступ с «Сохранить» задаёт .integrations-form__submit */
  margin-top: 0.65rem;
}

.integrations-page .panel-title {
  margin: 0.5em 0 0.35em;
  font-size: 1.5em;
  font-weight: 700;
}

/* Раздел «Агентский аккаунт» на Интеграциях: основной заголовок чуть крупнее .panel-title */
.integrations-page .integrations-agency-main-title {
  font-size: 2.05em;
  margin: 2rem 0 0.45em;
}

/* Подзаголовок внутри формы agency credentials */
.integrations-page .integrations-form--agency-creds .integrations-agency-form__subtitle {
  margin-top: 0;
  margin-bottom: 0.4em;
}

/* Единый формат полей на странице «Интеграции» (размеры от root, не от 0.5rem контейнера) */
.integrations-page form.integrations-form-block {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.integrations-page .integrations-form-block > label {
  margin-top: 0.5em;
  font-size: 0.75rem;
  line-height: 1.35;
  font-weight: 600;
}

.integrations-page .integrations-form-block > h2 + label,
.integrations-page .integrations-form-block > h3 + label,
.integrations-page .integrations-form-block > label:first-of-type {
  margin-top: 0.35em;
}

.integrations-page .field-label-text {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4em;
}

.integrations-page .field-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1em;
  min-width: 1.1em;
  height: 1.1em;
  font-size: 0.85em;
  line-height: 1;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: help;
  user-select: none;
  position: relative;
  top: -0.04em;
}

.integrations-page .field-hint:hover,
.integrations-page .field-hint:focus-visible {
  color: var(--accent-hover);
  border-color: var(--accent);
  outline: none;
}

.integrations-page .field-hint:focus-visible {
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.integrations-page .integrations-form-block input[type="text"],
.integrations-page .integrations-form-block input[type="email"],
.integrations-page .integrations-form-block input[type="password"],
.integrations-page .integrations-form-block input[type="date"] {
  box-sizing: border-box;
  margin-top: 0.35em;
  padding: 0.4rem 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  font-weight: 400;
  border-radius: 4px;
}

/* Плейсхолдеры — на шаг мельче текста поля */
.integrations-page .integrations-form-block input::placeholder {
  font-size: 0.7rem;
  line-height: 1.3;
  letter-spacing: 0.01em;
  color: var(--muted);
  opacity: 0.65;
}

.integrations-page .integrations-form-block input::-webkit-input-placeholder {
  font-size: 0.7rem;
  line-height: 1.3;
}

.integrations-page .integrations-form-block input::-moz-placeholder {
  font-size: 0.7rem;
  line-height: 1.3;
  opacity: 0.65;
}

/* Кнопка «Сохранить» — компактная, слева */
.integrations-page .integrations-form__submit {
  align-self: flex-start;
  width: auto;
  max-width: 100%;
  margin-top: 0.65rem;
  font-size: 0.75rem;
  line-height: 1.2;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border-radius: 4px;
}

/* Скрытая форма для программного POST (удаление аккаунта; форма может быть вне .integrations-page) */
.integrations-page .integrations-hidden-post-form,
form.integrations-hidden-post-form {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.integrations-page .integrations-section-title.integrations-client-apps-table-heading {
  margin-top: 1.5rem;
  font-size: 0.95rem;
}

.integrations-page .integrations-client-apps-table-wrap {
  margin-top: 0.5rem;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-strong, var(--border));
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.integrations-page .integrations-client-apps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.integrations-page .integrations-client-apps-table th,
.integrations-page .integrations-client-apps-table td {
  padding: 0.5rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.integrations-page .integrations-client-apps-table:not(.integrations-yandex-accounts-table) th {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: none;
  color: var(--text);
  background: var(--table-th-bg);
  border-bottom-color: var(--info-border, var(--border));
}

.integrations-page .integrations-client-apps-table th {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: none;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.integrations-page .integrations-client-apps-table:not(.integrations-yandex-accounts-table) tbody tr:nth-child(odd) td {
  background: var(--info-bg);
}

.integrations-page .integrations-client-apps-table:not(.integrations-yandex-accounts-table) tbody tr:nth-child(even) td {
  background: var(--surface-muted);
}

.integrations-page .integrations-client-apps-table:not(.integrations-yandex-accounts-table) tr:last-child td {
  border-bottom: none;
}

.integrations-page .integrations-client-apps-table__code {
  font-size: 0.8em;
  word-break: break-all;
}

.integrations-page .integrations-client-apps-table__secret {
  color: var(--muted);
  letter-spacing: 0.12em;
}

.integrations-page .integrations-client-apps-table__th-actions {
  width: 1%;
  white-space: nowrap;
}

.integrations-page .integrations-client-apps-table__actions {
  text-align: right;
  white-space: nowrap;
}

/* Таблица «Сохранённые аккаунты» (Яндекс Директ): нейтральные цвета, фиксированные колонки, без горизонтального скролла */
.integrations-page .integrations-yandex-accounts-wrap {
  margin-top: 0.5rem;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.integrations-page .integrations-yandex-accounts-table {
  table-layout: fixed;
}

.integrations-page .integrations-yandex-accounts-col--remove {
  width: 2.5rem;
}

.integrations-page .integrations-yandex-accounts-col--label {
  width: 24%;
}

.integrations-page .integrations-yandex-accounts-col--token {
  width: 7%;
}

.integrations-page .integrations-yandex-accounts-col--login {
  width: 36%;
}

.integrations-page .integrations-yandex-accounts-col--actions {
  width: auto;
  min-width: 8.5rem;
}

.integrations-page .integrations-yandex-accounts-table th,
.integrations-page .integrations-yandex-accounts-table td {
  padding: 0.4rem 0.45rem;
  vertical-align: middle;
}

.integrations-page .integrations-yandex-accounts-table thead th:nth-child(1),
.integrations-page .integrations-yandex-accounts-table thead th:nth-child(3) {
  text-align: center;
}

.integrations-page .integrations-yandex-accounts-table thead th:nth-child(2),
.integrations-page .integrations-yandex-accounts-table thead th:nth-child(4),
.integrations-page .integrations-yandex-accounts-table thead th:nth-child(5) {
  text-align: left;
}

.integrations-page .integrations-yandex-accounts-table th {
  background: var(--surface-muted);
  color: var(--text-heading);
  border-bottom: 1px solid var(--border-strong, var(--border));
  font-size: 0.72rem;
}

.integrations-page .integrations-yandex-accounts-th-remove {
  width: 2.5rem;
  padding-left: 0.35rem;
  padding-right: 0.25rem;
}

.integrations-page .integrations-yandex-accounts-th-actions {
  text-align: left;
}

.integrations-page .integrations-yandex-accounts__cell-remove {
  text-align: center;
  vertical-align: middle;
  padding-left: 0.35rem;
  padding-right: 0.25rem;
}

.integrations-page .integrations-yandex-accounts__row-data:nth-child(4n + 1) td {
  background: var(--surface);
}

.integrations-page .integrations-yandex-accounts__row-data:nth-child(4n + 3) td {
  background: var(--surface-muted);
}

.integrations-page .integrations-yandex-accounts__row-goals td {
  padding-top: 0.2rem;
  padding-bottom: 0.5rem;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
}

.integrations-page .integrations-yandex-accounts-table tbody tr.integrations-yandex-accounts__row-goals:last-child td {
  border-bottom: none;
}

.integrations-page .integrations-yandex-accounts__cell-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  text-align: left;
}

.integrations-page .integrations-yandex-accounts__cell-login {
  text-align: left;
}

.integrations-page .integrations-yandex-accounts__cell-token {
  text-align: center;
}

.integrations-page .integrations-yandex-accounts__cell-login .integrations-client-apps-table__code {
  display: inline-block;
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.35;
  vertical-align: middle;
}

.integrations-page .integrations-yandex-accounts-table .btn,
.integrations-page .integrations-yandex-accounts-table button.integrations-yandex-account-remove {
  width: auto;
  max-width: none;
  margin-top: 0;
  margin-bottom: 0;
  box-sizing: border-box;
}

.integrations-page .integrations-yandex-accounts__actions {
  text-align: left;
  vertical-align: middle;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.integrations-page .integrations-yandex-accounts__action-btns {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
  flex-wrap: nowrap;
  flex: 0 0 auto;
}

.integrations-page .integrations-yandex-goals-toggle {
  margin-right: 0;
  padding: 0.22rem 0.5rem;
  font-size: 0.78rem;
  line-height: 1.25;
  flex-shrink: 0;
}

.integrations-page tr.integrations-yandex-accounts__row-goals td {
  padding-top: 0;
  border-top: none;
  text-align: left;
}

.integrations-page .integrations-yandex-goals-body {
  margin: 0 0 0.65rem;
  padding: 0.5rem 0.35rem 0.15rem;
  text-align: left;
}

.integrations-page .integrations-yandex-goals-list {
  margin: 0.15rem 0 0;
  padding-left: 1.2rem;
}

.integrations-page .integrations-yandex-goals-list li {
  margin: 0.2rem 0;
}

.integrations-page button.integrations-yandex-account-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 1.2rem;
  width: 1.2rem;
  height: 1.2rem;
  margin: 0;
  padding: 0;
  font-size: 0.95rem;
  line-height: 1;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  box-shadow: none;
  cursor: pointer;
}

.integrations-page button.integrations-yandex-account-remove:hover {
  color: var(--text, #000);
  border-color: var(--muted);
  background: var(--surface-muted, rgba(0, 0, 0, 0.04));
}

.integrations-page .integrations-client-app-remove,
.integrations-agency-app-remove,
button.integrations-agency-app-remove,
button[type="submit"].integrations-agency-app-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: none;
  min-width: 1.75rem;
  height: 1.75rem;
  margin: 0;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 400;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: none;
  filter: none;
  cursor: pointer;
}

.integrations-page .integrations-client-app-remove:hover,
.integrations-agency-app-remove:hover,
button.integrations-agency-app-remove:hover,
button[type="submit"].integrations-agency-app-remove:hover {
  color: var(--text, #000);
  border-color: var(--muted);
  background: var(--surface-muted, rgba(0, 0, 0, 0.04));
  filter: none;
  transform: none;
}

/* Диалог вынесен из .integrations-page — селекторы и с префиксом, и на dialog. */
.integrations-page .integrations-dialog,
dialog.integrations-dialog {
  box-sizing: border-box;
  max-width: min(100vw - 2rem, 22rem);
  width: 100%;
  min-width: 16rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  color: var(--text);
  background: var(--surface);
}

.integrations-page .integrations-dialog::backdrop,
dialog.integrations-dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.integrations-page .integrations-dialog__title,
dialog.integrations-dialog .integrations-dialog__title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.integrations-page .integrations-dialog__text,
dialog.integrations-dialog .integrations-dialog__text {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--text, inherit);
}

.integrations-page .integrations-dialog__actions,
dialog.integrations-dialog .integrations-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
  width: 100%;
  box-sizing: border-box;
}

/* Две кнопки в одну строку, равная ширина — не обрезается «Отмена» */
.integrations-page .integrations-dialog__actions--row,
dialog.integrations-dialog .integrations-dialog__actions--row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: stretch;
  gap: 0.5rem;
}

.integrations-page .integrations-dialog__btn,
dialog.integrations-dialog .integrations-dialog__btn {
  font-size: 0.75rem;
  line-height: 1.2;
  padding: 0.45rem 0.75rem;
  border-radius: 4px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  justify-content: center;
  text-align: center;
  white-space: normal;
  word-break: break-word;
}

.integrations-page .integrations-dialog__btn--danger,
dialog.integrations-dialog .integrations-dialog__btn--danger {
  color: #fff;
  font-weight: 600;
  border: 1px solid #991b1b;
  background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
  box-shadow: 0 2px 10px rgba(185, 28, 28, 0.35);
}

.integrations-page .integrations-dialog__btn--danger:hover,
dialog.integrations-dialog .integrations-dialog__btn--danger:hover {
  filter: brightness(1.05);
  box-shadow: 0 3px 14px rgba(185, 28, 28, 0.42);
}

[data-theme="dark"] .integrations-page .integrations-dialog__btn--danger,
[data-theme="dark"] dialog.integrations-dialog .integrations-dialog__btn--danger {
  border-color: #7f1d1d;
  background: linear-gradient(180deg, #dc2626 0%, #991b1b 100%);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.integrations-page .integrations-vk-section--token .btn.btn-ghost {
  font-size: 0.75rem;
  line-height: 1.2;
  padding: 0.4rem 0.7rem;
  border-radius: 4px;
  margin-top: 0;
}

.integrations-page .btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem !important;
  align-self: flex-start;
  width: 100%;
  justify-content: flex-start;
}

.integrations-page .btn-row .btn,
.integrations-page .btn-row button {
  flex: 0 0 auto;
  width: auto;
  margin-top: 0;
}

.integrations-page .vkid-btn {
  font-size: 0.75rem;
  line-height: 1.2;
  padding: 0.4rem 0.6rem;
}

.integrations-page .vkid-btn .vkid-btn__text,
.integrations-page .vkid-btn__brand {
  font-size: 1em;
}

.integrations-page .vk-auth-guide__head {
  margin-bottom: 0.4em !important;
}

.integrations-page .vk-auth-status {
  font-size: 1.4em;
  padding: 0.2em 0.45em;
  border-radius: 4px;
}

.integrations-page .integrations-fetch-out {
  font-size: 1.5em !important;
  margin-top: 0.35em !important;
}

.integrations-page .integrations-vk-section--token .integrations-form--vk-token__fetch-out {
  font-size: 1.3em !important;
  margin-top: 0.4em !important;
  min-height: 1.2em;
}

.integrations-page .archive-list,
.integrations-page .archive-item {
  font-size: 1.4em;
}

@media (max-width: 700px) {
  .integrations-page {
    width: 100%;
    max-width: 22rem;
  }
}

/* Временно: скрыт UI «VK Сообщества» (страница /communities, OAuth, API — без изменений). Удалите класс с разметки или правило, чтобы показать снова. */
.apx-ui-hidden-communities {
  display: none !important;
}

.error-msg {
  margin-top: 0;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  color: var(--danger) !important;
  border: 1px solid var(--danger-border);
  font-size: 14px;
}

.success-msg {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success);
  font-size: 14px;
}

.small-note {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
  margin: 8px 0 14px;
}

.small-note a {
  color: var(--accent-hover);
  font-weight: 600;
  text-decoration: none;
}

.small-note a:hover {
  text-decoration: underline;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(300px, 0.88fr);
  gap: 28px;
  align-items: start;
}

/* Отчёты VK / Яндекс: слева форма (~36%), справа архив с широкой таблицей */
.dashboard-layout--report {
  grid-template-columns: minmax(280px, 0.4fr) minmax(0, 0.6fr);
  gap: 24px;
  margin-top: 1rem;
}

.dashboard-layout--report .dashboard-layout__params {
  min-width: 0;
}

.dashboard-layout--report .dashboard-ads {
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

.dashboard-layout--report .dashboard-archive--vk-wide.dashboard-archive--in-grid {
  margin-top: 0;
  min-width: 0;
}

.dashboard-layout__archive {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
  align-self: start;
}

h2.dashboard-archive-heading {
  margin: 0;
  font-size: clamp(1.28rem, 3.2vw, 1.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-heading);
  line-height: 1.25;
}

.dashboard-archive-stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1.5rem;
  width: 100%;
  max-width: none;
}

h2.report-params-heading {
  margin: 0 0 16px;
  font-size: clamp(1.28rem, 3.2vw, 1.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-heading);
  line-height: 1.25;
}

/* Архив в двухколоночной сетке: без sticky, скролл вместе со страницей, верх совпадает с колонкой параметров. */
.dashboard-archive.dashboard-archive--in-grid {
  position: static;
  top: auto;
  align-self: start;
}

/* Отчёт VK Реклама: узкая колонка по центру (~30–50% шире, чем «на весь main») */
.dashboard-ads {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.75rem;
  width: 100%;
  max-width: min(30rem, 92vw);
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.dashboard-ads__params {
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

.dashboard-ads .dashboard-params-card {
  padding: 18px 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

/* Глобальный `form` задаёт вторую рамку и фон — убираем внутри карточки «Отчёт VK Реклама» */
.dashboard-params-card #dashboard-params-form {
  margin-top: 0;
  margin-bottom: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.dashboard-params-card #form-request-report {
  margin-top: 0;
  margin-bottom: 0;
  padding: 18px 0 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  border-top: 1px solid var(--border);
}

/* Базовый вид карточных подзаголовков (без .report-params-heading) */
.dashboard-ads .dashboard-params > .dashboard-params-card-heading:not(.report-params-heading) {
  font-size: clamp(1rem, 2.6vw, 1.15rem);
  margin-bottom: 12px;
}

.dashboard-params form + .panel-title,
.dashboard-params .form-export,
.dashboard-params .form-request-report {
  margin-top: 12px;
}

.form-export {
  margin-top: 12px;
}

/* Полоска прогресса при выгрузке в Google Таблицы (request_google.html) */
.google-upload-progress {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-muted);
}

.google-upload-progress__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}

.google-upload-progress__track {
  height: 10px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

.google-upload-progress__fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transition: width 0.32s ease;
}

[data-theme="dark"] .google-upload-progress__track {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* Кнопка «Запросить отчёт» — визуально продолжение блока параметров */
#dashboard-params-form,
#agency-params-form {
  margin-bottom: 0;
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
}

#form-request-report,
#form-request-report-agency {
  margin-top: 0;
  padding-top: 18px;
  border-radius: 0 0 var(--radius) var(--radius);
  border-top: 1px solid var(--border);
}

.dashboard-save-status {
  margin: 10px 0 0;
  font-size: 13px;
  min-height: 1.45em;
  color: var(--muted);
}

.dashboard-save-status--ok {
  color: var(--success);
}

.dashboard-save-status--err {
  color: var(--danger);
}

.dashboard-save-status--pending {
  color: var(--muted);
}

.dashboard-entity-filter-wrap {
  margin-top: 16px;
  padding: 0;
  border-radius: 0;
  border: none;
  background: transparent;
}

.dashboard-entity-filter-label {
  font-weight: 600;
  color: var(--text-heading);
  margin: 0 0 4px;
}

.dashboard-entity-filter-sub {
  margin: 0 0 10px;
}

.dashboard-entity-field-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 6px;
}

.dashboard-entity-selected-box {
  min-height: 52px;
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.dashboard-entity-chips-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 28px;
}

.dashboard-entity-selected-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Перекрываем глобальное button { width: 100% } — ширина по тексту */
.dashboard-entity-selected-actions button.dashboard-entity-chip--select-all,
.dashboard-entity-selected-actions button.dashboard-entity-chip--clear-all {
  width: fit-content;
  max-width: none;
  margin-top: 0;
  box-shadow: none;
  filter: none;
}

.dashboard-entity-chip--select-all,
.dashboard-entity-chip--clear-all {
  margin: 0;
  flex: 0 0 auto;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  border-style: dashed;
  white-space: nowrap;
}

.dashboard-entity-chip--select-all {
  border-color: var(--accent);
  background: var(--surface-muted);
  color: var(--primary);
}

.dashboard-entity-chip--select-all:hover {
  background: var(--accent-soft);
  border-style: solid;
}

.dashboard-entity-chip--clear-all {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
}

.dashboard-entity-chip--clear-all:hover {
  border-style: solid;
  background: var(--danger-border);
}

.dashboard-entity-selected-empty {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.dashboard-entity-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 8px 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.3;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  color: var(--text);
}

.dashboard-entity-chip__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(280px, 100%);
}

.dashboard-entity-chip__remove {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  background: transparent;
}

.dashboard-entity-chip__remove:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

.dashboard-entity-pick-heading {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 8px;
}

.dashboard-entity-pick-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 2px 8px;
  margin: 0 -2px;
}

.dashboard-entity-pick-btn {
  display: inline-block;
  max-width: 100%;
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.dashboard-entity-pick-btn:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.dashboard-entity-pick-btn--on {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--text-heading);
  font-weight: 600;
}

/* Кампании: компактный выпадающий список с чекбоксами */
#dashboard-params-form,
#agency-params-form,
#dashboard-filter-ad-plans-wrap,
#agency-filter-ad-plans-wrap {
  overflow: visible;
}

.dashboard-entity-ms {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin-top: 4px;
}

/* Виджет перенесён в body (портал) — выше оверлея. Внутри main z-index не помог бы. */
.dashboard-entity-ms.is-portal {
  position: fixed;
  margin: 0;
  box-sizing: border-box;
  z-index: 10001;
}

.dashboard-entity-ms-placeholder {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
}

/* Клик по экрану вне — закрытие; под порталом виджета */
.dashboard-entity-ms__backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: transparent;
  cursor: default;
  touch-action: none;
}

.dashboard-entity-ms__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  margin-top: 0;
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
  filter: none;
  transition: border-color 0.15s, background 0.15s;
}

.dashboard-entity-ms__toggle:hover {
  border-color: var(--accent);
  background: var(--surface-muted);
}

.dashboard-entity-ms__toggle .dashboard-entity-ms__toggle-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.dashboard-entity-ms__chev {
  flex-shrink: 0;
  font-size: 9px;
  line-height: 1;
  opacity: 0.75;
  transition: transform 0.15s ease;
}

.dashboard-entity-ms__toggle[aria-expanded="true"] .dashboard-entity-ms__chev {
  transform: rotate(180deg);
}

.dashboard-entity-ms__panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 200;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-height: min(52vh, 360px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.15);
}

/* display:flex выше перебивает [hidden] в UA — панель без клика не показывать */
.dashboard-entity-ms__panel[hidden] {
  display: none !important;
}

.datalens-goals-ms__search {
  flex-shrink: 0;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.datalens-goals-ms__search input {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
}

/* Панель «приколота» к viewport — координаты из JS, не обрезается overflow предков */
.dashboard-entity-ms__panel.dashboard-entity-ms__panel--anchored {
  position: fixed !important;
  right: auto !important;
  box-sizing: border-box;
  margin: 0;
  z-index: 10001;
}

.dashboard-entity-ms__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
  flex-shrink: 0;
}

.dashboard-entity-ms__toolbar-btn {
  margin: 0;
  padding: 4px 10px;
  width: auto;
  min-width: 0;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px dashed var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--accent-hover);
  box-shadow: none;
  filter: none;
  line-height: 1.3;
}

.dashboard-entity-ms__toolbar-btn:hover {
  border-style: solid;
  background: var(--accent-soft);
}

.dashboard-entity-ms__list {
  display: block;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 0 6px;
  margin: 0;
  max-height: min(44vh, 300px);
  -webkit-overflow-scrolling: touch;
}

.dashboard-entity-ms__row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 10px;
  margin: 0;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
  border: none;
  background: transparent;
  box-sizing: border-box;
}

.dashboard-entity-ms__row:hover {
  background: var(--info-bg, var(--surface-muted));
}

.dashboard-entity-ms__cb {
  margin: 0.15em 0 0 0;
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--accent, #0d9488);
}

.dashboard-entity-ms__row-text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.dashboard-entity-filter-hint {
  margin: 8px 0 0;
}

.btn-row--request {
  margin-top: 0;
}

#form-request-report .btn-request-report {
  width: auto;
  min-width: 200px;
  margin-top: 0;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.btn-row button {
  flex: 1 1 168px;
  width: auto;
  margin-top: 0;
}

.dashboard-archive {
  position: sticky;
  top: 20px;
  padding: 22px 20px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.dashboard-archive--bottom {
  position: static;
  top: auto;
  align-self: stretch;
  max-width: none;
  width: 100%;
  padding: 16px 14px 16px;
}

.dashboard-archive--vk-wide.dashboard-archive--bottom .small-note {
  font-size: 0.8rem;
  line-height: 1.45;
}

.dashboard-archive-table-wrap {
  margin-top: 0;
}

/* Архив отчёта VK: не в узкой колонке параметров — на ширину .shell; таблица с комфортным min-width, при необходимости — горизонтальный скролл только у обёртки. */
.dashboard-archive--vk-wide {
  width: 100%;
  box-sizing: border-box;
  margin-top: 1.5rem;
}

.dashboard-archive--vk-wide .dashboard-archive-table-wrap.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.dashboard-archive--vk-wide .dashboard-archive-table-wrap .dashboard-archive-table {
  width: 100%;
  min-width: 58rem;
  table-layout: auto;
}

.dashboard-archive--vk-wide .dashboard-archive-table-wrap .dashboard-archive-table th,
.dashboard-archive--vk-wide .dashboard-archive-table-wrap .dashboard-archive-table td {
  word-break: normal;
  overflow-wrap: anywhere;
}

.dashboard-archive--vk-wide .dashboard-archive-table__metrics {
  max-width: 18rem;
}

.dashboard-archive-table__metrics {
  max-width: 12rem;
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
  color: var(--text);
}

.dashboard-archive-table__export-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  align-items: center;
}

.dashboard-archive-table__export-links .text-link {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.dashboard-archive-table__export-links--datalens {
  justify-content: center;
}

.dashboard-archive-table__export-links--datalens .btn.btn-ghost {
  width: auto;
  max-width: none;
  min-width: 0;
  margin-top: 0;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.datalens-archive-table__details .small-note {
  display: block;
}

.datalens-archive-table__details .error-msg {
  margin: 0.35rem 0 0;
}

.datalens-form input[type="date"][readonly] {
  opacity: 0.92;
  cursor: default;
}

.dashboard-archive-table__th-action,
.dashboard-archive-table__action {
  width: 1%;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.dashboard-archive .small-note {
  margin-top: 0;
}

.archive-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.archive-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.archive-item:last-child {
  border-bottom: none;
}

.archive-item__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.archive-item__badge {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  letter-spacing: 0.04em;
}

.archive-item__level {
  font-size: 13px;
  color: var(--muted);
}

.archive-item__period {
  font-size: 14px;
  font-weight: 700;
  margin-top: 6px;
  color: var(--text-heading);
}

.archive-item__sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.archive-item__link {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-hover);
  text-decoration: none;
}

.archive-item__link:hover {
  text-decoration: underline;
}

.archive-empty {
  margin: 14px 0 0;
  font-size: 14px;
  color: var(--muted);
}

code {
  font-size: 0.88em;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--code-text);
}

@media (max-width: 960px) {
  body.layout-app {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
  }

  .sidebar-brand__glyph {
    display: none !important;
  }

  .sidebar-brand__text {
    position: static !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
    border: 0 !important;
  }

  .sidebar-link__glyph {
    display: none !important;
  }

  .sidebar-link__text {
    position: static !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    overflow: visible !important;
    clip: auto !important;
  }

  .sidebar-link {
    justify-content: flex-start !important;
  }

  .theme-switcher--sidebar {
    flex-direction: row !important;
    margin: 0 12px 10px !important;
    padding: 0 8px !important;
    border-bottom: none !important;
  }

  .sidebar-brand {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 12px;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 4px 10px;
  }

  .sidebar-link {
    border-left: none;
  }

  .sidebar-link.is-active {
    border-left: none;
    background: var(--accent-soft);
  }

  .sidebar-link--muted {
    margin-top: 0;
    border-top: none;
    padding-top: 12px;
  }

  .main-area {
    padding: 24px 16px 48px;
  }

  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .dashboard-layout--report .dashboard-archive--in-grid {
    margin-top: 1.25rem;
  }

  .dashboard-archive {
    position: static;
  }

  .hero__inner {
    padding: 32px 22px 36px;
  }

  .hero--banner {
    min-height: min(400px, 52vh);
  }
}

@media (max-width: 520px) {
  .top-nav a {
    padding: 8px 10px;
    font-size: 13px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .auth-card {
    padding: 28px 20px 24px;
  }
}

.table-wrap {
  overflow-x: auto;
  margin-top: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.table-wrap table {
  border-collapse: collapse;
  width: 100%;
  min-width: 720px;
  background: var(--surface);
}

.table-wrap th,
.table-wrap td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  font-size: 13px;
}

.table-wrap th {
  background: var(--table-th-bg);
  text-align: left;
  font-weight: 700;
  color: var(--navy);
}

.table-wrap td {
  color: var(--text);
}

.preview-file-name code {
  font-size: 0.9em;
  word-break: break-all;
}

.preview-toolbar {
  margin: 16px 0 20px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.preview-toolbar__row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  margin-bottom: 14px;
}

.preview-toolbar__check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  color: var(--text-heading);
  cursor: pointer;
  max-width: 100%;
}

.preview-toolbar__check input {
  margin-top: 3px;
  flex-shrink: 0;
}

.preview-toolbar__columns {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px 14px;
  margin-bottom: 12px;
}

.preview-toolbar__label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  padding-top: 4px;
}

.preview-column-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  flex: 1;
  min-width: 0;
}

.preview-col-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  max-width: 100%;
}

.preview-col-toggle span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.preview-show-all-btn {
  flex-shrink: 0;
  margin-top: 0 !important;
  width: fit-content !important;
  max-width: 100% !important;
  padding: 8px 14px !important;
  font-size: 13px !important;
  background: var(--surface-muted) !important;
  border: 1px solid var(--border-strong) !important;
  color: var(--navy) !important;
  box-shadow: none !important;
  filter: none !important;
}

.preview-hidden-cols-wrap {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.preview-hidden-cols-empty {
  margin: 0;
  color: var(--muted);
}

.preview-hidden-cols-empty[hidden] {
  display: none !important;
}

.preview-hidden-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.preview-hidden-chips[hidden] {
  display: none !important;
}

/* Ширина по тексту: перекрываем глобальное button { width: 100% } */
.preview-hidden-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  margin-top: 0 !important;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.3;
  color: var(--text-heading);
  background: var(--surface-muted);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  box-shadow: none !important;
  filter: none !important;
}

.preview-hidden-chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent-hover);
}

#preview-table .preview-col-hidden {
  display: none !important;
}

#preview-table tbody tr.preview-row-zero-hidden {
  display: none;
}

.table-wrap--preview {
  margin-top: 8px;
}

/* Крупные отчёты: браузер откладывает отрисовку невидимых строк (Chromium / современный Firefox). */
#preview-table tbody tr {
  content-visibility: auto;
  contain-intrinsic-size: auto 2.75rem;
}

.archive-item__links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 10px;
  align-items: center;
}

.archive-item__links .archive-item__link {
  margin-top: 0;
}

.archive-item__delete-form {
  display: inline;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}

.archive-item__link--delete {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  color: var(--danger);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.archive-item__link--delete:hover {
  color: var(--text-heading);
}

.archive-item__params {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.archive-item__param {
  display: block;
}

.export-actions-fieldset {
  margin: 0 0 16px;
  padding: 0;
  border: none;
}

.export-action-radios {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.export-action-radios__item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-heading);
  cursor: pointer;
}

.export-format-wrap {
  margin-bottom: 12px;
}

.export-google-panel {
  margin: 12px 0 16px;
  padding: 16px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.form-export .btn-export-submit {
  margin-top: 8px;
}

.preview-meta {
  margin: 0 0 16px;
  padding-left: 1.2em;
  max-width: 52rem;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
}

.preview-meta li {
  margin: 4px 0;
}

.preview-toolbar__hint {
  font-weight: 500;
  color: var(--muted);
  font-size: 12px;
}

#preview-table thead th {
  vertical-align: middle;
}

.preview-th-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.preview-th-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
}

.preview-col-eye {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--accent-hover);
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.preview-col-eye__icon {
  display: block;
  flex-shrink: 0;
}

.preview-col-eye:hover {
  background: var(--accent-soft);
}

.preview-col-eye--off {
  opacity: 0.45;
  color: var(--muted);
}

.preview-toolbar .preview-show-all-btn {
  margin-top: 8px;
}

/* --- Обратная связь / форум --- */
.forum-page .page-lead {
  max-width: 52rem;
}

.card-panel {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.forum-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 20px;
}

.forum-filter {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-heading);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  transition: background 0.15s, border-color 0.15s;
}

.forum-filter:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.forum-filter.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-hover);
}

.forum-new.card-panel,
.forum-list-section {
  margin-bottom: 28px;
}

/* Одна рамка у блока «Новая запись», без внутреннего контура у формы (глобальный стиль form) */
.forum-new.card-panel .forum-new-form {
  margin-top: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.forum-new-form textarea {
  min-height: 120px;
  resize: vertical;
}

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

.forum-topic-row__link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.forum-topic-row__link:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .forum-topic-row__link:hover {
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
}

.forum-topic-row__badge {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-hover);
}

.forum-topic-row__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-heading);
}

.forum-topic-row__meta {
  font-size: 13px;
  color: var(--muted);
}

.forum-topic-badge {
  display: inline-block;
  margin-right: 8px;
  font-size: 12px;
  font-weight: 700;
  vertical-align: middle;
  color: var(--accent-hover);
}

.forum-topic-meta.page-lead {
  margin-top: 0;
}

.forum-body {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
  font-size: 15px;
  color: var(--text-body);
}

.forum-reply-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.forum-reply {
  padding: 14px 16px;
}

.forum-reply__meta {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.forum-reply-form textarea {
  min-height: 100px;
  resize: vertical;
}

.forum-file-hint {
  display: block;
  margin-top: 6px;
}

.forum-attachments {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.forum-attachments__item {
  margin: 0;
  padding: 0;
}

.forum-attachments__link {
  display: block;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  line-height: 0;
}

.forum-attachments__link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.forum-attachments img {
  display: block;
  max-width: min(100%, 420px);
  max-height: 280px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.forum-attachments--reply img {
  max-width: min(100%, 360px);
  max-height: 240px;
}

.forum-topic-page .page-eyebrow a {
  color: inherit;
  text-decoration: none;
}

.forum-topic-page .forum-replies {
  margin-top: 28px;
}

.forum-topic-page .page-eyebrow a:hover {
  text-decoration: underline;
}

.forum-mod-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-hover);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 999px;
  vertical-align: middle;
}

.forum-topic-meta-row {
  margin: 0;
}

.forum-topic-meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.forum-topic-meta-line .forum-mod-badge {
  margin-left: 0;
}

.forum-mod-delete-topic,
.forum-reply-delete-form {
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}

.forum-reply__head {
  margin-bottom: 8px;
}

.forum-reply-meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.forum-reply-meta-line .forum-mod-badge {
  margin-left: 0;
}

.forum-reply__meta.forum-reply-meta-line {
  margin: 0;
}

/* Специфичнее глобального button[type="submit"] — иначе остаются width:100%, padding и 15px шрифт */
button.forum-btn-delete {
  margin: 0;
  margin-top: 0;
  padding: 2px 8px;
  min-height: 0;
  width: auto;
  max-width: max-content;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.04em;
  color: #fff;
  background: #dc3545;
  border: 1px solid #dc3545;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  box-sizing: border-box;
  vertical-align: middle;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
  transition: color 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

button.forum-btn-delete:hover {
  filter: none;
  color: #fff;
  background: #bb2d3b;
  border-color: #bb2d3b;
  box-shadow: 0 1px 4px rgba(220, 53, 69, 0.35);
}

button.forum-btn-delete:active {
  transform: none;
}

button.forum-btn-delete:focus-visible {
  outline: none;
  filter: none;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px #dc3545;
}

[data-theme="light"] button.forum-btn-delete {
  color: #fff;
  background: #dc3545;
  border-color: #dc3545;
}

[data-theme="light"] button.forum-btn-delete:hover {
  filter: none;
  color: #fff;
  background: #bb2d3b;
  border-color: #bb2d3b;
  box-shadow: 0 1px 4px rgba(220, 53, 69, 0.35);
}

[data-theme="light"] button.forum-btn-delete:focus-visible {
  filter: none;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px #dc3545;
}

[data-theme="dark"] button.forum-btn-delete {
  color: #fff;
  background: #c62828;
  border-color: #c62828;
}

[data-theme="dark"] button.forum-btn-delete:hover {
  filter: none;
  color: #fff;
  background: #e53935;
  border-color: #e53935;
  box-shadow: 0 1px 4px rgba(229, 57, 53, 0.35);
}

[data-theme="dark"] button.forum-btn-delete:focus-visible {
  filter: none;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px #ef5350;
}

/* Кабинет модератора (/cabinet) */
.cabinet-page .page-lead {
  max-width: 52rem;
}

.cabinet-table-wrap {
  overflow-x: auto;
}

.cabinet-users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.cabinet-users-table th,
.cabinet-users-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.cabinet-users-table th {
  font-weight: 700;
  color: var(--text-heading);
  background: var(--surface-muted);
}

.cabinet-users-table tbody tr:hover td {
  background: var(--surface-muted);
}

.cabinet-users-table td:last-child .forum-mod-badge {
  margin-left: 0;
}
