/* =====================================================================
   Arushan · UI polish layer v1  (подключается ПОСЛЕДНИМ)
   - Кабинет: карточки ссылок без сжатых названий и кнопок, сетка
     настроек, нижнее меню на телефоне, аккуратное боковое меню.
   - Редактор: крупное вписанное превью на телефоне, кнопка
     «Во весь экран» не перекрывает телефон, удобное сохранение,
     колонки на планшете/ноутбуке.
   - Зоны нажатия, фокус, мягкие анимации (учитывают reduced-motion).
   ===================================================================== */

:root {
  --uip-ink: #171717;
  --uip-card: #ffffff;
  --uip-line: #e8e8e8;
  --uip-muted: #6b6f76;
  --uip-focus: #6d5efc;
  --uip-ease: cubic-bezier(.2, .8, .2, 1);
  --uip-spring: cubic-bezier(.16, 1, .3, 1);
  --uip-safe-b: env(safe-area-inset-bottom, 0px);
}

/* 1. Базовое взаимодействие ---------------------------------------- */
#root button, #root a, #editorModal button, #editorModal a, .uip-bnav button {
  -webkit-tap-highlight-color: transparent;
}
html body #root :is(button, a):focus-visible,
html body #editorModal :is(button, a, [tabindex]):focus-visible,
html body .uip-bnav button:focus-visible {
  outline: 2px solid var(--uip-focus) !important;
  outline-offset: 2px !important;
}

/* 2. Кабинет · список ссылок ------------------------------------- */
/* Телефон и планшет: каждая ссылка — карточка. Название сверху (до 2 строк),
   адрес и счётчики ниже, действия — ровной панелью на всю ширину. */
@media (max-width: 1280px) {
  html body #root .app .main .table {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)) !important;
    gap: 12px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
  }
  html body #root .app .main .table > :not(.row) { grid-column: 1 / -1 !important; }
  html body #root .app .main .table .thead { display: none !important; }
  html body #root .app .main .table .row {
    display: grid !important;
    grid-template-columns: minmax(0, max-content) auto auto minmax(0, 1fr) auto !important;
    grid-template-rows: auto auto auto !important;
    grid-template-areas: "name name name name status" "slug views clicks . ." "act act act act act" !important;
    align-items: center !important;
    gap: 10px 12px !important;
    margin: 0 !important;
    padding: 14px !important;
    width: auto !important;
    min-width: 0 !important;
    border: 1px solid var(--cb-line, var(--uip-line)) !important;
    border-radius: 18px !important;
    background: var(--cb-card, var(--uip-card)) !important;
    box-shadow: 0 1px 3px rgba(23, 25, 28, .05) !important;
  }
  html body #root .app .main .table .row::after { content: none !important; display: none !important; }
  html body #root .app .main .table .row > .row-name {
    grid-area: name !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
  }
  html body #root .app .main .table .row > .row-name b {
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    white-space: normal !important;
    overflow: hidden !important;
    text-overflow: clip !important;
    overflow-wrap: anywhere !important;
    line-height: 1.28 !important;
  }
  html body #root .app .main .table .row > .status {
    grid-area: status !important;
    align-self: start !important;
    justify-self: end !important;
    white-space: nowrap !important;
  }
  html body #root .app .main .table .row > .slug {
    grid-area: slug !important;
    justify-self: start !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
    white-space: nowrap !important;
  }
  html body #root .app .main .table .row > .num {
    grid-area: views !important;
    justify-self: start !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    overflow: visible !important;
    white-space: nowrap !important;
  }
  html body #root .app .main .table .row > .num ~ .num { grid-area: clicks !important; }
  html body #root .app .main .table .row > .rowact {
    grid-area: act !important;
    display: grid !important;
    grid-auto-flow: column !important;
    grid-auto-columns: minmax(0, 1fr) !important;
    gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    justify-self: stretch !important;
    margin: 2px 0 0 !important;
    padding: 12px 0 0 !important;
    border-top: 1px solid var(--cb-line, var(--uip-line)) !important;
  }
  html body #root .app .main .table .row > .rowact > * {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 40px !important;
    margin: 0 !important;
    border-radius: 12px !important;
  }
}

/* ПК: таблица с колонкой действий по размеру кнопок, названия в 2 строки. */
@media (min-width: 1281px) {
  html body #root .app .main .table :is(.thead, .row) {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) 64px 64px 112px 280px !important;
  }
  html body #root .app .main .table .row > .rowact {
    justify-content: flex-end !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
  }
  html body #root .app .main .table .row > .row-name b {
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    white-space: normal !important;
    overflow: hidden !important;
  }
}

/* 3. Кабинет · настройки ------------------------------------------ */
html body #root .settings-grid > * { min-width: 0 !important; }
html body #root .settings-card { max-width: 100% !important; box-sizing: border-box !important; }
html body #root .settings-card :is(input, select, textarea) { max-width: 100% !important; box-sizing: border-box !important; }
@media (max-width: 640px) {
  html body #root .settings-grid { grid-template-columns: minmax(0, 1fr) !important; }
}
html body #root #botTokenInput {
  width: 100% !important;
  min-height: 44px !important;
  padding: 10px 14px !important;
  border: 1px solid var(--cb-line2, #e0e0e0) !important;
  border-radius: 12px !important;
  background: var(--cb-card, var(--uip-card)) !important;
  color: var(--cb-ink, var(--uip-ink)) !important;
  font: 500 14px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
  box-sizing: border-box !important;
}
html body #root #botTokenInput:focus {
  outline: none !important;
  border-color: var(--cb-ink, var(--uip-ink)) !important;
  box-shadow: 0 0 0 3px rgba(23, 25, 28, .08) !important;
}

/* 4. Боковое меню (телефон/планшет) ------------------------------- */
@media (max-width: 1000px) {
  html body #root .app aside.side:not(.open) { box-shadow: none !important; }
}
html body #sideOverlay.open { -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }

/* 5. Нижнее меню кабинета на телефоне ------------------------------ */
.uip-bnav { display: none; }
@media (max-width: 768px) {
  body.uip-has-bnav:not(.uip-editor-open):not(.uip-overlay-open):not(.uip-drawer-open) .uip-bnav {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + var(--uip-safe-b));
    z-index: 45;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 6px;
    border-radius: 22px;
    background: rgba(255, 254, 251, .9);
    -webkit-backdrop-filter: saturate(1.6) blur(18px);
    backdrop-filter: saturate(1.6) blur(18px);
    border: 1px solid rgba(23, 25, 28, .08);
    box-shadow: 0 14px 34px -14px rgba(17, 19, 23, .32), 0 2px 6px rgba(17, 19, 23, .06);
  }
  .uip-bnav button {
    -webkit-appearance: none;
    appearance: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    min-height: 52px;
    margin: 0;
    padding: 6px 2px;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: var(--uip-muted);
    font-family: inherit;
    font-size: 11px;
    font-weight: 650;
    line-height: 1.1;
    letter-spacing: .01em;
    cursor: pointer;
    transition: background-color .2s var(--uip-ease), color .2s var(--uip-ease), transform .14s var(--uip-ease);
  }
  .uip-bnav button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .uip-bnav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
  .uip-bnav button.is-active { color: var(--uip-ink); background: rgba(23, 25, 28, .07); }
  .uip-bnav button.uip-bnav-new { color: #fff; background: var(--uip-ink); box-shadow: 0 8px 18px -10px rgba(17, 19, 23, .6); }
  .uip-bnav button:active { transform: scale(.94); }
  body.uip-has-bnav #root .app .main { padding-bottom: calc(96px + var(--uip-safe-b)) !important; }
}

/* 6. Редактор · шапка, поля, колонки ----------------------------------- */
html body #editorModal .editorhead h3 {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}
@media (max-width: 900px) {
  html body #editorModal .editorhead h3:after { content: none !important; display: none !important; }
}
/* подпись следующего поля больше не прилипает к предыдущему инпуту */
html body #editorModal :not(.formgrid) > :is(.formgrid, .input) + :is(.formgrid, .input) { margin-top: 14px !important; }

@media (min-width: 901px) and (max-width: 1280px) {
  html body #editorModal#editorModal .builder-shell {
    grid-template-columns: minmax(212px, 240px) minmax(0, 1fr) minmax(320px, 372px) !important;
  }
  html body #editorModal .builder-node .node-copy { min-width: 0 !important; }
  html body #editorModal .builder-node .node-copy b {
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    white-space: normal !important;
    overflow: hidden !important;
    text-overflow: clip !important;
    line-height: 1.22 !important;
  }
  html body #editorModal .device-preview-toolbar .device-label { display: none !important; }
  html body #editorModal .device-preview-toolbar { width: auto !important; min-width: 0 !important; max-width: 100% !important; justify-content: center !important; }
}
html body #editorModal .builder-tree { padding-bottom: 20px !important; scroll-padding-bottom: 20px; }

/* темы оформления не вылезают за правый край */
html body #editorModal :has(> .themeopt) {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)) !important;
  gap: 8px !important;
}
html body #editorModal .themeopt { min-width: 0 !important; max-width: none !important; }

/* 7. Редактор на телефоне: превью и сохранение --------------------- */
.uip-bar-save { display: none; }
@media (max-width: 768px) {
  html body #editorModal#editorModal:not(.mobile-fullscreen-preview) .builder-stage {
    height: clamp(286px, 40svh, 380px) !important;
    min-height: 0 !important;
    max-height: none !important;
  }
  html body #editorModal#editorModal:not(.mobile-fullscreen-preview) .builder-stage .phone-scale-shell {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    flex: 1 1 auto !important;
    align-self: stretch !important;
  }
  /* масштаб считает 16-ui-polish.js под свободное место */
  html body #editorModal#editorModal:not(.mobile-fullscreen-preview) .builder-stage .mini-phone {
    transform: scale(var(--uip-phone-scale, .72)) !important;
    transform-origin: 50% 0 !important;
    margin: 10px 0 0 !important;
  }
  /* «Во весь экран» — сбоку от телефона, не накрывает кнопки в превью */
  html body #editorModal#editorModal:not(.mobile-fullscreen-preview) .builder-stage .mobile-preview-badge {
    top: 50% !important;
    bottom: auto !important;
    right: 8px !important;
    left: auto !important;
    transform: translateY(-50%) !important;
    flex-direction: column !important;
    justify-content: center !important;
    width: 76px !important;
    height: auto !important;
    min-height: 66px !important;
    padding: 10px 6px !important;
    gap: 6px !important;
    border-radius: 18px !important;
    white-space: normal !important;
    text-align: center !important;
    line-height: 1.15 !important;
    font-size: 11px !important;
  }
  html body #editorModal#editorModal:not(.mobile-fullscreen-preview) .builder-stage .mobile-preview-badge b {
    font-size: 11px !important;
    line-height: 1.15 !important;
    white-space: normal !important;
  }
  html body #editorModal .editorfoot {
    padding-bottom: calc(10px + var(--uip-safe-b)) !important;
    box-shadow: 0 -10px 24px -18px rgba(17, 19, 23, .35) !important;
  }
  html body #editorModal.mobile-fullscreen-preview .mobile-return-bar .uip-bar-save {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    height: 38px;
    margin-left: auto;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: var(--uip-ink);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .55);
  }
}

/* метка «есть несохранённые изменения» на кнопке сохранения */
html body #editorModal #saveLinkBtn.uip-dirty { position: relative !important; }
html body #editorModal #saveLinkBtn .uip-dirty-dot {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f5a524;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .95);
  pointer-events: none;
}

/* 8. Зоны нажатия на сенсорных экранах ------------------------------ */
@media (pointer: coarse) {
  html body #root button[data-lang] { min-width: 40px !important; min-height: 36px !important; }
  html body #root a.ds-f-login { min-height: 40px !important; display: inline-flex !important; align-items: center !important; }
  html body #editorModal .context-action { min-height: 36px !important; }
  html body #editorModal #customBgClearBtn { min-height: 40px !important; }
}

/* 9. Анимации ---------------------------------------------------------- */
@keyframes uip-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes uip-fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes uip-pop { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes uip-sheet { from { opacity: 0; transform: translateY(32px); } to { opacity: 1; transform: none; } }
@keyframes uip-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes uip-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.4); opacity: .55; } }

@media (prefers-reduced-motion: no-preference) {
  html body #editorModal.open .editor { animation: uip-pop .34s var(--uip-spring) backwards; }
  html body #editorModal .pane,
  html body #editorModal .sectionbox:not(.ctx-hidden) { animation: uip-fade .24s ease-out backwards; }
  html body.uip-enter #root .app .main :is(.cards > .stat, .table .row, .settings-card) {
    animation: uip-fade-up .42s var(--uip-spring) backwards;
  }
  html body.uip-enter #root .app .main :is(.cards > .stat, .table .row, .settings-card):nth-child(2) { animation-delay: .035s; }
  html body.uip-enter #root .app .main :is(.cards > .stat, .table .row, .settings-card):nth-child(3) { animation-delay: .07s; }
  html body.uip-enter #root .app .main :is(.cards > .stat, .table .row, .settings-card):nth-child(4) { animation-delay: .105s; }
  html body.uip-enter #root .app .main :is(.cards > .stat, .table .row, .settings-card):nth-child(5) { animation-delay: .14s; }
  html body.uip-enter #root .app .main :is(.cards > .stat, .table .row, .settings-card):nth-child(6) { animation-delay: .175s; }
  html body.uip-enter #root .app .main :is(.cards > .stat, .table .row, .settings-card):nth-child(n+7) { animation-delay: .21s; }
  html body :is(#root, #editorModal) :is(.btn, .iconbtn, .builder-node, .mobile-segment-tab, .context-action):active:not(:disabled) { transform: scale(.97); }
  .uip-bnav { animation: uip-rise .45s var(--uip-spring) backwards; }
  html body #editorModal #saveLinkBtn .uip-dirty-dot { animation: uip-pulse 1.6s ease-in-out infinite; }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 768px) {
  html body #editorModal.open .editor { animation-name: uip-sheet; animation-duration: .4s; }
}

/* =========================================================
   10. Правки после проверки на всех экранах (v2)
   ========================================================= */

/* 10.1 Кнопка «Аналитика трафика»: плавающая, больше не удлиняет страницу */
html body #splOpenAnalytics.spl-fab {
  position: fixed !important;
  right: 24px;
  bottom: calc(24px + var(--uip-safe-b));
  z-index: 46;
  margin: 0 !important;
  white-space: nowrap;
}
html body.uip-editor-open #splOpenAnalytics.spl-fab,
html body.uip-overlay-open #splOpenAnalytics.spl-fab,
html body.uip-drawer-open #splOpenAnalytics.spl-fab,
html body.uip-dash-settings #splOpenAnalytics.spl-fab,
html body.uip-dash-admin #splOpenAnalytics.spl-fab { display: none !important; }

@media (min-width: 769px) {
  html body.uip-has-bnav #root .app .main { padding-bottom: 96px !important; }
}

@media (max-width: 768px) {
  /* на телефоне — только в разделе «Аналитика», над нижним меню */
  html body #splOpenAnalytics.spl-fab { display: none !important; }
  html body.uip-dash-analytics:not(.uip-editor-open):not(.uip-overlay-open):not(.uip-drawer-open) #splOpenAnalytics.spl-fab {
    display: inline-flex !important;
    left: 0;
    right: 0;
    width: max-content;
    max-width: calc(100vw - 32px);
    margin: 0 auto !important;
    bottom: calc(88px + var(--uip-safe-b));
  }
  html body.uip-dash-analytics.uip-has-bnav #root .app .main { padding-bottom: calc(150px + var(--uip-safe-b)) !important; }
  /* нижнее меню на планшетах не растягиваем во всю ширину */
  html body .uip-bnav { max-width: 520px !important; margin-left: auto !important; margin-right: auto !important; }
}

/* 10.2 Карточки ссылок: просмотры и переходы не наезжают на адрес */
@media (max-width: 1280px) {
  html body #root .app .main .table .row > .num:nth-child(n) { grid-area: views !important; }
  html body #root .app .main .table .row > .num ~ .num:nth-child(n) { grid-area: clicks !important; }
}
html body #root .app .main .table .row > a.slug {
  display: inline-block !important;
  min-width: 0;
  max-width: 100% !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

/* 10.3 Таблица на ПК: заголовки колонок помещаются целиком */
@media (min-width: 1281px) {
  html body #root .app .main .table :is(.thead, .row) {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) 96px 84px 120px 280px !important;
  }
  html body #root .app .main .table .thead > * { white-space: nowrap; }
}

/* 10.4 Отступы между полями в настройках элемента */
html body #editorModal#editorModal .builder-inspector :not(.formgrid) > :is(.formgrid, .input) + :is(.formgrid, .input) { margin-top: 12px !important; }

/* 10.5 Кнопки «Аватар / Обложка / Удалить» — ровная сетка на любой ширине */
html body #editorModal#editorModal .stage9-action-col {
  display: grid !important;
  grid-template-columns: none !important;
  grid-auto-flow: column !important;
  grid-auto-columns: minmax(0, 1fr) !important;
  gap: 8px !important;
}
html body #editorModal#editorModal .stage9-action-col > .stage9-btn {
  width: 100% !important;
  min-width: 0 !important;
  justify-content: center !important;
  padding-left: 10px !important;
  padding-right: 10px !important;
  white-space: nowrap;
  overflow: hidden;
}

/* 10.6 Редактор на планшете (769–900px): подписи в структуре, аккуратная панель превью */
@media (min-width: 769px) and (max-width: 900px) {
  html body #editorModal#editorModal.open .builder-shell.builder-shell { grid-template-columns: 200px minmax(0, 1fr) 320px !important; }
  html body #editorModal#editorModal.open .builder-outline .builder-panel-head strong { display: block !important; }
  html body #editorModal#editorModal.open .builder-outline .builder-node { justify-content: flex-start !important; gap: 10px !important; }
  html body #editorModal#editorModal.open .builder-outline .builder-node .node-copy { display: block !important; flex: 1 1 auto !important; min-width: 0 !important; }
  html body #editorModal#editorModal.open .builder-outline .builder-node .node-copy :is(b, small) { display: block !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  html body #editorModal#editorModal.open .builder-outline .builder-add::before { content: none !important; display: none !important; }
  html body #editorModal#editorModal.open .builder-outline .builder-add { white-space: nowrap !important; height: auto !important; min-height: 46px !important; }
  html body #editorModal#editorModal.open .builder-stage { justify-content: flex-start !important; padding-top: 18px !important; }
  html body #editorModal#editorModal.open .builder-stage .device-preview-toolbar { width: auto !important; min-width: 0 !important; max-width: calc(100% - 20px) !important; margin-left: auto !important; margin-right: auto !important; padding-left: 8px !important; padding-right: 8px !important; }
  html body #editorModal#editorModal.open .builder-stage .device-preview-toolbar .device-label { display: none !important; }
}

/* 10.7 Полноэкранное превью на телефоне: большой телефон и понятная панель сверху */
@media (max-width: 768px) {
  html body #editorModal#editorModal.mobile-fullscreen-preview .builder-stage {
    padding: max(12px, env(safe-area-inset-top, 0px)) 12px max(14px, env(safe-area-inset-bottom, 0px)) !important;
    background: radial-gradient(120% 70% at 50% 0%, #2b2542 0%, #14121c 55%, #0b0a10 100%) !important;
    overflow: hidden !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
  }
  html body #editorModal#editorModal.mobile-fullscreen-preview .builder-stage .phone-scale-shell {
    flex: 1 1 auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
    align-items: flex-start !important;
    justify-content: center !important;
  }
  html body #editorModal#editorModal.mobile-fullscreen-preview .builder-stage .epreview {
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
  }
  html body #editorModal#editorModal.mobile-fullscreen-preview .builder-stage .mini-phone {
    width: 210px !important;
    height: 380px !important;
    transform: scale(var(--uip-fs-scale, 1.5)) !important;
    transform-origin: 50% 0 !important;
    margin: var(--uip-fs-offset, 0px) 0 0 !important;
    border-radius: 34px !important;
    box-shadow: 0 30px 70px rgba(0, 0, 0, .5) !important;
  }
  html body #editorModal#editorModal.mobile-fullscreen-preview .builder-stage :is(.mobile-preview-badge, .device-preview-toolbar) { display: none !important; }
  html body #editorModal#editorModal.mobile-fullscreen-preview .builder-stage .mobile-return-bar {
    display: flex !important;
    width: 100% !important;
    max-width: 520px !important;
    margin: 0 auto 10px !important;
    gap: 8px !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex: none !important;
  }
  html body #editorModal#editorModal.mobile-fullscreen-preview .mobile-return-bar .btn-close-fullscreen { display: none !important; }
  html body #editorModal#editorModal.mobile-fullscreen-preview .mobile-return-bar .btn-return-edit {
    flex: 0 1 auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }
  html body #editorModal#editorModal.mobile-fullscreen-preview .mobile-return-bar .btn-return-edit span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  html body #editorModal#editorModal.mobile-fullscreen-preview .mobile-return-bar .uip-bar-save {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    justify-content: center !important;
    height: 42px !important;
    padding: 0 20px !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: #6847ee !important;
    color: #fff !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    box-shadow: 0 10px 26px rgba(104, 71, 238, .45) !important;
    cursor: pointer;
  }
}

/* 10.8 Аналитика на телефоне: периоды помещаются, строки — карточками с подписями */
@media (max-width: 600px) {
  html body .rs-periods {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  html body .rs-periods > button {
    min-width: 0 !important;
    padding-left: 2px !important;
    padding-right: 2px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  html body #root .app .main .analytics-list {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  html body #root .app .main .analytics-list > .analytics-row:not(.head) {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-template-areas: "name name name" "v o r" !important;
    gap: 12px 8px !important;
    align-items: start !important;
    padding: 14px !important;
    margin: 0 0 10px !important;
    border: 1px solid var(--cb-line, #e8e8e8) !important;
    border-radius: 16px !important;
    background: var(--cb-card, #ffffff) !important;
  }
  html body #root .app .main .analytics-list > .analytics-row:not(.head) > b {
    grid-area: name !important;
    min-width: 0;
    font-size: 15px !important;
    line-height: 1.3 !important;
    overflow-wrap: anywhere;
  }
  html body #root .app .main .analytics-list > .analytics-row:not(.head) > span {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 3px !important;
    text-align: left !important;
    font-size: 16px !important;
    font-weight: 750 !important;
    padding: 0 !important;
    border: 0 !important;
  }
  html body #root .app .main .analytics-list > .analytics-row:not(.head) > span:nth-of-type(1) { grid-area: v !important; }
  html body #root .app .main .analytics-list > .analytics-row:not(.head) > span:nth-of-type(2) { grid-area: o !important; }
  html body #root .app .main .analytics-list > .analytics-row:not(.head) > span:nth-of-type(3) { grid-area: r !important; }
  html body #root .app .main .analytics-list > .analytics-row:not(.head) > span[data-uip-label]::before {
    content: attr(data-uip-label);
    font-size: 10.5px;
    font-weight: 650;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--uip-muted);
  }
}
