/* Настройки · Подключения */
.foxy-ui .fx-traffix > .fx-traffix-head {
  height: auto;
  padding-block-end: 24px;
}

/* Обзор · Отчёт по кликам */
.foxy-report-bar {
  container: foxy-report-toolbar / inline-size;
}

.foxy-report-bar > :is(select.foxy-report-bar__field, .fx-select-control) {
  flex: 0 1 240px;
  min-inline-size: min(190px, 100%);
  max-inline-size: min(260px, 100%);
}

.foxy-report-bar > select.foxy-report-bar__field,
.foxy-report-bar > .fx-select-control > .fx-select-trigger {
  min-block-size: 50px;
}

.foxy-report-bar > select.foxy-report-bar__field {
  padding-inline: 15px 44px;
  border-radius: 12px;
  background-color: var(--fx-subtle, var(--fx-surface, #fff));
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 18px 18px;
  font-size: 16px;
  font-weight: 500;
  text-overflow: ellipsis;
}

.foxy-report-bar > select.foxy-report-bar__field:dir(rtl) {
  background-position: left 15px center;
}

/* На средней ширине поиск завершает ряд, список и форматы занимают следующий. */
@container foxy-report-toolbar (max-width: 1070px) {
  .foxy-report-bar > .foxy-report-bar__search {
    flex: 1 1 40%;
  }

  .foxy-report-bar > :is(select.foxy-report-bar__field, .fx-select-control) {
    flex-basis: 60%;
    max-inline-size: 100%;
  }
}

@container foxy-report-toolbar (max-width: 550px) {
  .foxy-report-bar > :is(select.foxy-report-bar__field, .fx-select-control) {
    flex-basis: 100%;
  }
}

/* Звонки · Карточка истории */
#root .call-info > .call-info-header {
  padding-right: 0;
  row-gap: 8px;
}

#root .call-info-header > .red-btn {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: none;
  width: fit-content;
  max-width: 100%;
  height: auto;
  min-height: 44px;
  margin: 0;
  margin-inline-start: auto;
  padding: 8px 12px;
  box-sizing: border-box;
}

#root .call-info-header > .red-btn > svg {
  flex: none;
}

#root .call-info .call-info-header > button.red-btn > .fx-delete-label {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* При смене раздела оформление настроек остаётся рядом с общим контейнером. */
body.foxy-ui[data-layout-section]:not([data-layout-section="settings"]) .fx-native-slot.fx-settings-layout:not([hidden]) {
  display: block;
}

body.foxy-ui[data-layout-section]:not([data-layout-section="settings"]) .fx-settings-layout > .fx-settings-nav,
body.foxy-ui[data-layout-section]:not([data-layout-section="settings"]) .fx-settings-layout > .fx-settings-surface:not(:has(#root)),
body.foxy-ui[data-layout-section]:not([data-layout-section="overview"]) .fx-content :is(.foxy-report-bar, .fxo-overview, .fx-full-nav, #fx-full-nav),
body.foxy-ui[data-layout-section]:not([data-layout-section="pages"]) #root .fx-pages-workspace,
body.foxy-ui[data-layout-section]:not([data-layout-section="calls"], [data-layout-section="domens"]) .fx-native-slot > .fx-native-empty,
body.foxy-ui[data-layout-section]:not([data-layout-section="proxy"]) .fx-content > :is(.fx-proxy-tabs, #fx-proxy-content, .fx-inline-status),
body.foxy-ui[data-layout-section]:not([data-layout-section="proxy"]) .fx-content:has(> #fx-proxy-content) > .fx-page-heading > [data-action="create"] {
  display: none !important;
}

/* Шапка поддерживает перенос, когда боковая панель оставляет мало места. */
@media (min-width: 801px) {
  html[data-foxy-design="studio"] .foxy-ui .fx-topbar {
    height: auto;
    min-height: 80px;
    padding-block: 12px;
    flex-wrap: wrap;
  }

  html[data-foxy-design="studio"] .foxy-ui .fx-topbar .fx-ip-line {
    flex-wrap: wrap;
    max-inline-size: 100%;
  }
}

@media (min-width: 801px) and (max-width: 900px) {
  html[data-foxy-design="studio"] .foxy-ui .fx-topbar .fx-account-region {
    flex-basis: auto;
    order: 0;
  }
}

/* Внутренняя рамка целиком видна внутри прокручиваемого меню. */
html[data-foxy-design="studio"] .foxy-ui .fx-sidebar :is(nav a, .fx-settings-link):focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -4px;
}

/* Обзор · Подписи кнопок остаются читаемыми на оранжевом фоне. */
.foxy-report-bar > .foxy-report-bar__button {
  color: var(--fx-on-accent, #21252a);
}

/* Поля отчёта различимы на поверхности при обеих темах. */
.foxy-report-bar > .foxy-report-bar__field:not(.invalid, [aria-invalid="true"]),
.foxy-report-bar > .fx-select-control > .fx-select-trigger:not(.invalid, [aria-invalid="true"], [aria-expanded="true"]) {
  border-color: color-mix(in srgb, var(--fx-muted, #626b77) 80%, var(--fx-surface, #fff));
}

/* У выбранного значения сохраняется высота нативного списка при длинном тексте. */
.foxy-report-bar > .fx-select-control > .fx-select-trigger > .fx-select-value {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Обводка фокуса контрастирует с поверхностью вокруг кнопки. */
.foxy-report-bar > .foxy-report-bar__button:focus-visible,
#root .fx-pages-tabs > button:focus-visible {
  outline-color: var(--fx-accent-ink, #a74300);
}

/* Длинные названия вкладок переносятся в границах кнопки рядом со счётчиком. */
#root .fx-pages-tabs > button > span:first-child {
  min-inline-size: 0;
  overflow-wrap: break-word;
}

@media (max-width: 500px) {
  html #root .fx-pages-tabs > button {
    flex-basis: min-content;
  }
}

/* Диалог настроек при увеличении или в низком окне. */
@media (max-height: 420px), (max-width: 282px) {
  html .Modal[data-fx-settings-dialog]:not([data-fx-country-picker]) {
    display: block;
    min-width: 0;
    overflow: auto !important;
    overscroll-behavior: contain;
    scroll-padding: 12px;
  }

  html .Modal[data-fx-settings-dialog]:not([data-fx-country-picker]) > .user-create-form {
    overflow: visible;
    scrollbar-gutter: auto;
  }

  html .Modal[data-fx-settings-dialog]:not([data-fx-country-picker]) > .modal-btns {
    flex-wrap: wrap;
  }
}

/* Узкая область пагинации. */
#root .fx-list-pagination {
  container: fx-list-pager / inline-size;
}

@container fx-list-pager (max-width: 210px) {
  #root .fx-list-size {
    flex-wrap: wrap;
  }

  #root .fx-list-size > label {
    white-space: normal;
  }

  #root .fx-list-page-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #root .fx-list-page-status {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  #root .fx-list-page-nav > button {
    min-width: 0;
  }
}

/* Зарезервировать ширину системной полосы прокрутки при смене раздела. */
html.foxy-design[data-study-state="ready"]:has(> body.foxy-ui > .fx-shell) {
  scrollbar-gutter: stable;
}

/* Вкладка остаётся выбранной, даже когда заканчивается переход на «Обзор». */
.foxy-ui .fx-full-nav:has(> #fx-full-tab[aria-selected="true"]) ~ #fx-summary-panel {
  display: none;
}

/* Имена классов совпадают с опубликованной разметкой, включая «leflet». */
.foxy-ui[data-layout-section="overview"] .leflet-map {
  max-width: 100%;
}

html[data-foxy-design="studio"] .foxy-ui .foxy-report-bar > :is(.foxy-report-bar__field, .foxy-report-bar__button),
html[data-foxy-design="studio"] .foxy-ui .foxy-report-bar > .fx-select-control > .fx-select-trigger {
  min-block-size: 44px;
}

html[data-foxy-design="studio"] .foxy-ui .foxy-report-bar > .fx-select-control > .fx-select-trigger {
  padding-block: 8px;
}

/* Контур кнопки мобильного меню при навигации клавишей Tab. */
html[data-foxy-design="studio"] .foxy-ui .fx-menu-button:focus-visible {
  outline-color: var(--fx-accent-ink);
}

.fx-map-host.presentation-frame[data-frame-mode] {
  display: grid;
  grid-template: auto minmax(0, 1fr) / minmax(0, 1fr);
  gap: 8px;
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid #58606a;
  border-radius: 12px;
  background: var(--fx-surface, Canvas);
  color: var(--fx-text, CanvasText);
  overflow: auto;
}
.fx-map-host.presentation-frame[data-frame-mode="popover"]:popover-open {
  position: fixed;
  inset: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
         max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
}
.fx-map-host.presentation-frame[data-frame-mode="inline"] {
  position: relative;
  inset: auto;
  width: 100%;
  max-width: none;
  height: clamp(360px, 75vh, 820px);
}
.fx-map-host.presentation-frame:popover-open::backdrop {
  background: rgb(12 15 20 / 55%);
}
.fx-map-host.presentation-frame[data-frame-mode] > .leaflet-container {
  grid-area: 2 / 1;
  min-inline-size: 0;
  min-block-size: 0;
}
.fx-map-host.presentation-frame[data-frame-mode] > .presentation-frame-toggle {
  position: static;
  grid-area: 1 / 1;
  justify-self: end;
  min-inline-size: 44px;
  min-block-size: 44px;
  max-inline-size: 100%;
  height: auto;
  margin: 0;
  padding: 8px 16px;
  border: 1px solid #475569;
  border-radius: 8px;
  background: #253243;
  color: white;
  font: 600 1rem/1.35 system-ui, sans-serif;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: none;
}
.fx-map-host.presentation-frame[data-frame-mode] > .presentation-frame-toggle:focus-visible {
  outline: 2px solid white;
  outline-offset: -4px;
}

.fx-map-host.presentation-frame[data-frame-mode] > .presentation-frame-toggle::before {
  content: "×";
  margin-inline-end: .4em;
}

.foxy-ui .fx-traffix-head .fx-traffix-kicker {
  color: var(--fx-accent-ink, #a74300);
}

.foxy-ui .fx-traffix-head .fx-traffix-brand > div {
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

/* Компактные строки истории звонков в списке управления. */
html[data-foxy-design="studio"] .foxy-ui #root .fx-admin-pane.fx-admin-calls .admin-controll > .red-btn {
  border-color: color-mix(in srgb, currentColor 70%, var(--fx-surface));
}

#root .fx-admin-calls .admin-controll > .red-btn:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 2px;
}

/* The native overview panel is mounted only on the inner Overview tab. */
body.foxy-ui:not([data-layout-section="overview"]) #fx-full-panel > .fx-offline-map,
body.foxy-ui #fx-full-panel:not(:has(> .fx-native-slot:not([hidden], [inert]) .analytics-div > .admin-overview:not([hidden], [inert]))) > .fx-offline-map {
  display: none !important;
}
