.crm-shell-frame,
.crm-shell-frame *{ box-sizing:border-box; }

/*
  Жестко изолируем shell от page-level CSS.
  Во многих admin/report шаблонах есть общие селекторы a/button/nav/svg/body,
  из-за которых sidebar меняет шрифт/вес/паддинги на разных страницах.
*/
.crm-shell-frame{
  --crm-ease-sidebar: cubic-bezier(.22, 1, .36, 1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif !important;
  font-style: normal !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  word-spacing: normal !important;
}
.crm-shell-frame :where(a,button,div,span,strong,small,p,nav,aside){
  font-family: inherit !important;
  font-style: normal !important;
  letter-spacing: inherit !important;
  text-transform: none !important;
}

.crm-shell-frame .crm-brand,
.crm-shell-frame .crm-mini-link,
.crm-shell-frame .crm-nav__item,
.crm-shell-frame .crm-theme-switch__btn,
.crm-shell-frame .crm-sidebar-toggle{
  text-decoration: none !important;
  -webkit-appearance: none;
  appearance: none;
}

.crm-shell-frame .crm-brand,
.crm-shell-frame .crm-brand:link,
.crm-shell-frame .crm-brand:visited{
  display:flex !important;
  align-items:center !important;
  gap:12px !important;
  color:inherit !important;
  text-decoration:none !important;
  background:transparent !important;
  border:none !important;
  box-shadow:none !important;
  padding:0 !important;
  margin:0 !important;
  min-height:auto !important;
}

.crm-shell-frame .crm-brand__logo{
  width:44px !important;
  height:44px !important;
  border-radius:14px !important;
  display:grid !important;
  place-items:center !important;
  background: linear-gradient(135deg, color-mix(in srgb, var(--crm-accent) 18%, var(--crm-surface) 82%), color-mix(in srgb, var(--crm-accent-2) 12%, var(--crm-surface) 88%)) !important;
  border:1px solid color-mix(in srgb, var(--crm-accent) 30%, var(--crm-border) 70%) !important;
  overflow:hidden !important;
  flex:0 0 auto !important;
}
.crm-shell-frame .crm-brand__logo img{ width:100% !important; height:100% !important; object-fit:cover !important; display:block !important; transform:scale(1.02) !important; transition: transform .28s var(--crm-ease-sidebar) !important; }
.crm-shell-frame .crm-brand__text{ display:flex !important; flex-direction:column !important; gap:2px !important; min-width:0 !important; max-width:180px !important; overflow:hidden !important; transition: opacity .18s ease, transform .28s var(--crm-ease-sidebar), max-width .28s var(--crm-ease-sidebar), visibility 0s linear 0s !important; }
.crm-shell-frame .crm-brand__text strong{ font-size:15px !important; font-weight:700 !important; line-height:1.15 !important; color:var(--crm-text) !important; }
.crm-shell-frame .crm-brand__text span{ font-size:12px !important; line-height:1.3 !important; color:var(--crm-muted) !important; }

.crm-shell-frame .crm-sidebar__head,
.crm-shell-frame .crm-sidebar__footer-actions,
.crm-shell-frame .crm-theme-switch{ display:flex !important; align-items:center !important; }
.crm-shell-frame .crm-sidebar__head{ justify-content:flex-start !important; gap:12px !important; }
.crm-shell-frame .crm-sidebar-toggle{
  width:32px !important;
  height:32px !important;
  min-height:32px !important;
  border-radius:999px !important;
  border:1px solid var(--crm-border) !important;
  background:color-mix(in srgb, var(--crm-surface) 90%, var(--crm-bg) 10%) !important;
  color:var(--crm-text) !important;
  cursor:pointer !important;
  display:grid !important;
  place-items:center !important;
  padding:0 !important;
  box-shadow: var(--crm-shadow-sm) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
}
.crm-shell-frame .crm-sidebar-toggle:hover{
  transform: translateX(50%) scale(1.04) !important;
  border-color: color-mix(in srgb, var(--crm-accent) 38%, var(--crm-border) 62%) !important;
  box-shadow: var(--crm-shadow-md) !important;
}
.crm-shell-frame .crm-sidebar-toggle:active{
  transform: translateX(50%) scale(.98) !important;
}
.crm-shell-frame .crm-sidebar-toggle__icon{
  position:relative !important;
  width:14px !important;
  height:14px !important;
  display:block !important;
}
.crm-shell-frame .crm-sidebar-toggle__icon::before{
  content:"";
  position:absolute;
  inset:1px auto 1px 0;
  width:2px;
  border-radius:999px;
  background:currentColor;
  opacity:.24;
}
.crm-shell-frame .crm-sidebar-toggle__icon::after{
  content:"";
  position:absolute;
  top:50%;
  right:1px;
  width:6px;
  height:6px;
  border-top:2px solid currentColor;
  border-right:2px solid currentColor;
  transform: translateY(-50%) rotate(225deg);
  transition: transform .28s var(--crm-ease-sidebar);
}
body.crm-sidebar-collapsed .crm-shell-frame .crm-sidebar-toggle__icon::after{
  transform: translateY(-50%) rotate(45deg);
}
.crm-shell-frame .crm-nav{
  display:grid !important;
  gap:8px !important;
  align-content:start !important;
}
.crm-shell-frame .crm-nav__item,
.crm-shell-frame .crm-nav__item:link,
.crm-shell-frame .crm-nav__item:visited{
  display:flex !important;
  align-items:center !important;
  justify-content:flex-start !important;
  width:100% !important;
  min-height:48px !important;
  padding:0 14px !important;
  margin:0 !important;
  border-radius:14px !important;
  border:1px solid transparent !important;
  background:transparent !important;
  color:var(--crm-muted) !important;
  text-decoration:none !important;
  font-size:15px !important;
  font-weight:600 !important;
  line-height:1.2 !important;
  box-shadow:none !important;
  outline:none !important;
  white-space:nowrap !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
  cursor:pointer !important;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, width .28s var(--crm-ease-sidebar), padding .28s var(--crm-ease-sidebar) !important;
}
.crm-shell-frame .crm-nav__item:hover,
.crm-shell-frame .crm-nav__item:focus-visible{
  color:var(--crm-text) !important;
  background:var(--crm-surface-2) !important;
  border-color:var(--crm-border) !important;
  box-shadow:none !important;
}
.crm-shell-frame .crm-nav__item.is-active,
.crm-shell-frame .crm-nav__item.is-active:link,
.crm-shell-frame .crm-nav__item.is-active:visited,
.crm-shell-frame .crm-nav__item.is-active:hover{
  color:#fff !important;
  background:linear-gradient(135deg, var(--crm-accent), color-mix(in srgb, var(--crm-accent) 55%, var(--crm-accent-2) 45%)) !important;
  border-color:transparent !important;
  box-shadow: 0 12px 28px rgba(47,108,246,.25) !important;
}
.crm-shell-frame .crm-nav__icon{
  width:18px !important;
  height:18px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  margin-right:12px !important;
  flex:0 0 auto !important;
  color:currentColor !important;
  transition: margin-right .28s var(--crm-ease-sidebar), transform .28s var(--crm-ease-sidebar) !important;
}
.crm-shell-frame .crm-nav__icon svg{
  width:18px !important;
  height:18px !important;
  display:block !important;
  flex:0 0 auto !important;
  color:currentColor !important;
  stroke:currentColor !important;
}
.crm-shell-frame .crm-nav__label{
  display:block !important;
  min-width:0 !important;
  max-width:180px !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
  white-space:nowrap !important;
  font: inherit !important;
  color:inherit !important;
  transition: opacity .18s ease, transform .28s var(--crm-ease-sidebar), max-width .28s var(--crm-ease-sidebar), visibility 0s linear 0s !important;
}

.crm-shell-frame .crm-sidebar__footer{ margin-top:auto !important; padding-top:14px !important; border-top:1px solid var(--crm-border) !important; display:grid !important; gap:14px !important; transition: gap .28s var(--crm-ease-sidebar) !important; }
.crm-shell-frame .crm-profile{ display:flex !important; align-items:center !important; gap:12px !important; min-width:0 !important; padding:2px 0 !important; transition: justify-content .28s var(--crm-ease-sidebar), gap .28s var(--crm-ease-sidebar) !important; }
.crm-profile__avatar{
  position: relative;
  width: 56px;
  height: 56px;
  min-width: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;

  background:
    radial-gradient(circle at 30% 30%, rgba(59,130,246,.18), rgba(59,130,246,.06) 58%, rgba(59,130,246,0) 100%),
    linear-gradient(180deg, #f7faff 0%, #edf3ff 100%);

  border: 1px solid rgba(96,125,185,.22);
  box-shadow:
    0 10px 22px rgba(44, 85, 160, .12),
    inset 0 1px 0 rgba(255,255,255,.78);
}

.crm-profile__avatar img{
  width: 44px;
  height: 44px;
  object-fit: cover;
  display: block;
  filter: drop-shadow(0 4px 10px rgba(25, 44, 84, .18));
  animation: crmAvatarFloat 5.5s ease-in-out infinite;
  transform-origin: center;
}

.crm-profile__avatar-glow{
  display: none !important;
}

@keyframes crmAvatarFloat{
  0%   { transform: translateY(0px) scale(1); }
  50%  { transform: translateY(-2px) scale(1.02); }
  100% { transform: translateY(0px) scale(1); }
}
@keyframes crmAvatarPulse{
  0%,100%{ transform:scale(.96); opacity:.72; }
  50%{ transform:scale(1.08); opacity:1; }
}
@keyframes crmAvatarFloat{
  0%,100%{ transform:translateY(0); }
  50%{ transform:translateY(-2px); }
}
.crm-shell-frame .crm-profile__body{ min-width:0 !important; display:grid !important; gap:4px !important; max-width:180px !important; overflow:hidden !important; transition: opacity .18s ease, transform .28s var(--crm-ease-sidebar), max-width .28s var(--crm-ease-sidebar), visibility 0s linear 0s !important; }
.crm-shell-frame .crm-profile__name{ font-weight:800 !important; font-size:14px !important; line-height:1.2 !important; color:var(--crm-text) !important; }
.crm-shell-frame .crm-profile__line{ font-size:12px !important; line-height:1.35 !important; color:var(--crm-muted) !important; }
.crm-shell-frame .crm-profile__label{ color:var(--crm-text) !important; font-weight:700 !important; margin-right:4px !important; }
.crm-shell-frame .crm-sidebar__footer-actions{ justify-content:space-between !important; gap:8px !important; max-height:48px !important; overflow:hidden !important; transition: opacity .18s ease, transform .28s var(--crm-ease-sidebar), max-height .28s var(--crm-ease-sidebar), visibility 0s linear 0s !important; }
.crm-shell-frame .crm-mini-link,
.crm-shell-frame .crm-mini-link:link,
.crm-shell-frame .crm-mini-link:visited{
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  min-height:38px !important;
  padding:0 14px !important;
  border-radius:12px !important;
  text-decoration:none !important;
  font-size:14px !important;
  font-weight:600 !important;
  line-height:1 !important;
  border:1px solid var(--crm-border) !important;
  background:var(--crm-surface-2) !important;
  color:var(--crm-text) !important;
  flex:1 1 0 !important;
  box-shadow:none !important;
}
.crm-shell-frame .crm-mini-link.is-danger,
.crm-shell-frame .crm-mini-link.is-danger:link,
.crm-shell-frame .crm-mini-link.is-danger:visited{ background:var(--crm-accent) !important; color:#fff !important; border-color:transparent !important; }
.crm-shell-frame .crm-theme-switch{
  gap:4px !important;
  padding:4px !important;
  border-radius:14px !important;
  border:1px solid var(--crm-border) !important;
  background:var(--crm-surface-2) !important;
}
.crm-shell-frame .crm-sidebar__section{
  overflow:hidden !important;
  max-height:180px !important;
  transition: opacity .18s ease, transform .28s var(--crm-ease-sidebar), max-height .28s var(--crm-ease-sidebar), padding .28s var(--crm-ease-sidebar), margin .28s var(--crm-ease-sidebar), visibility 0s linear 0s !important;
}
.crm-shell-frame .crm-theme-switch__btn{
  min-height:34px !important;
  padding:0 12px !important;
  border-radius:10px !important;
  border:none !important;
  background:transparent !important;
  cursor:pointer !important;
  color:var(--crm-muted) !important;
  font-size:12px !important;
  font-weight:600 !important;
  line-height:1 !important;
  box-shadow:none !important;
}
.crm-shell-frame .crm-theme-switch__btn.is-active{ background:var(--crm-surface) !important; color:var(--crm-text) !important; box-shadow: var(--crm-shadow-sm) !important; }
.crm-shell-frame .crm-sidebar__section{ display:grid !important; gap:8px !important; }
.crm-shell-frame .crm-sidebar__section-title{ font-size:12px !important; font-weight:700 !important; letter-spacing:.04em !important; text-transform:uppercase !important; color:var(--crm-muted) !important; }
.crm-shell-frame .crm-theme-switch--sidebar{ width:100% !important; display:grid !important; grid-template-columns: repeat(3, minmax(0,1fr)) !important; }
.crm-shell-frame .crm-theme-switch--sidebar .crm-theme-switch__btn{ width:100% !important; padding-inline:8px !important; font-size:12px !important; }


/* ===== 2026-03 full shell pass ===== */
.crm-shell-frame .crm-sidebar-toggle{
  width:36px !important;
  height:36px !important;
  min-height:36px !important;
  border-radius:999px !important;
  background:color-mix(in srgb, var(--crm-surface) 96%, var(--crm-bg) 4%) !important;
}
.crm-shell-frame .crm-sidebar-toggle:hover{
  transform:scale(1.04) !important;
}
.crm-shell-frame .crm-sidebar-toggle:active{
  transform:scale(.98) !important;
}
.crm-shell-frame .crm-sidebar{
  overscroll-behavior: contain;
}
.crm-shell-frame .crm-nav{
  gap:6px !important;
}
.crm-shell-frame .crm-nav__item,
.crm-shell-frame .crm-nav__item:link,
.crm-shell-frame .crm-nav__item:visited{
  min-height:46px !important;
  padding:0 13px !important;
  border-radius:16px !important;
}
.crm-shell-frame .crm-nav__item.is-active,
.crm-shell-frame .crm-nav__item.is-active:hover{
  box-shadow: 0 18px 28px rgba(47,108,246,.22) !important;
}
.crm-shell-frame .crm-nav__icon{
  width:20px !important;
  height:20px !important;
}
.crm-shell-frame .crm-nav__label{
  max-width:190px !important;
}
.crm-shell-frame .crm-sidebar__footer{
  gap:12px !important;
}
.crm-profile__avatar{
  width:58px;
  height:58px;
  min-width:58px;
  border-radius:18px;
}
.crm-profile__avatar img{
  width:100% !important;
  height:100% !important;
  object-fit:cover !important;
  padding:4px;
  filter:none !important;
}
.crm-shell-frame .crm-sidebar__section-title{ font-size:11px !important; }
.crm-shell-frame .crm-theme-switch--sidebar .crm-theme-switch__btn{ font-size:11px !important; }
@media (min-width:1180px) and (max-width:1440px){
  .crm-shell-frame .crm-brand__text strong{ font-size:14px !important; }
  .crm-shell-frame .crm-brand__text span,
  .crm-shell-frame .crm-profile__line,
  .crm-shell-frame .crm-mini-link{ font-size:11px !important; }
  .crm-shell-frame .crm-nav__item,
  .crm-shell-frame .crm-nav__item:link,
  .crm-shell-frame .crm-nav__item:visited{ min-height:44px !important; }
}
@media (min-width:1180px) and (max-height:820px){
  .crm-shell-frame .crm-brand__logo{ width:42px !important; height:42px !important; }
  .crm-shell-frame .crm-brand__text strong{ font-size:14px !important; }
  .crm-shell-frame .crm-brand__text span,
  .crm-shell-frame .crm-profile__line{ font-size:11px !important; }
  .crm-profile__avatar{ width:52px; height:52px; min-width:52px; }
  .crm-shell-frame .crm-sidebar__footer{ padding-top:12px !important; gap:10px !important; }
  .crm-shell-frame .crm-theme-switch__btn{ min-height:30px !important; }
}


/* ===== admin segmented scope switches ===== */
/* ===== admin/report segmented scope switches ===== */
body.crm-admin-page,
body.crm-report-page{
  --crm-inline-switch-accent: var(--accent3, var(--info, 59,130,246));
}

.crm-admin-page .crm-segmented-row,
.crm-report-page .crm-segmented-row{
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
  gap:12px !important;
  flex-wrap:wrap !important;
}

.crm-admin-page .crm-segmented,
.crm-report-page .crm-segmented{
  display:inline-grid !important;
  grid-auto-flow:column !important;
  grid-auto-columns:minmax(0, 1fr) !important;
  align-items:center !important;
  gap:4px !important;
  padding:4px !important;
  border-radius:14px !important;
  border:1px solid rgba(var(--crm-inline-switch-accent), .18) !important;
  background:var(--surface3, rgba(255,255,255,.04)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.05),
    0 10px 24px rgba(0,0,0,.12) !important;
  max-width:100% !important;
}

.crm-admin-page .crm-segmented__btn.scope-tab,
.crm-admin-page .crm-segmented__btn.scope-tab[type="button"],
.crm-report-page .crm-segmented__btn.scope-tab,
.crm-report-page .crm-segmented__btn.scope-tab[type="button"]{
  min-height:34px !important;
  padding:0 14px !important;
  border:none !important;
  border-radius:10px !important;
  background:transparent !important;
  color:var(--muted) !important;
  font-size:12px !important;
  font-weight:700 !important;
  line-height:1 !important;
  letter-spacing:.01em !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  white-space:nowrap !important;
  box-shadow:none !important;
  transition:
    background-color .18s ease,
    color .18s ease,
    box-shadow .18s ease,
    transform .18s ease !important;
}

.crm-admin-page .crm-segmented__btn.scope-tab:hover,
.crm-report-page .crm-segmented__btn.scope-tab:hover{
  background:var(--btnBgHover, rgba(255,255,255,.08)) !important;
  color:var(--text) !important;
  transform:translateY(-1px) !important;
}

.crm-admin-page .crm-segmented__btn.scope-tab:focus-visible,
.crm-report-page .crm-segmented__btn.scope-tab:focus-visible{
  outline:2px solid rgba(var(--crm-inline-switch-accent), .32) !important;
  outline-offset:2px !important;
}

.crm-admin-page .crm-segmented__btn.scope-tab.is-active,
.crm-admin-page .crm-segmented__btn.scope-tab[aria-pressed="true"],
.crm-report-page .crm-segmented__btn.scope-tab.is-active,
.crm-report-page .crm-segmented__btn.scope-tab[aria-pressed="true"]{
  background:var(--surface, rgba(255,255,255,.08)) !important;
  color:rgba(var(--crm-inline-switch-accent), 1) !important;
  box-shadow:
    inset 0 0 0 1px rgba(var(--crm-inline-switch-accent), .24),
    0 10px 24px rgba(47,108,246,.18) !important;
}

.crm-admin-page .crm-segmented__btn.scope-tab.is-active:hover,
.crm-admin-page .crm-segmented__btn.scope-tab[aria-pressed="true"]:hover,
.crm-report-page .crm-segmented__btn.scope-tab.is-active:hover,
.crm-report-page .crm-segmented__btn.scope-tab[aria-pressed="true"]:hover{
  background:var(--surface, rgba(255,255,255,.08)) !important;
  color:rgba(var(--crm-inline-switch-accent), 1) !important;
}

.crm-admin-page .crm-segmented-row > .pill,
.crm-report-page .crm-segmented-row > .pill{
  min-height:42px !important;
  display:inline-flex !important;
  align-items:center !important;
  padding:0 14px !important;
  border-radius:14px !important;
  border:1px solid var(--border) !important;
  background:var(--surface2, rgba(255,255,255,.05)) !important;
  color:var(--muted) !important;
  font-weight:800 !important;
  box-shadow:var(--shadow2, 0 10px 30px rgba(0,0,0,.24)) !important;
}

html[data-theme="light"] .crm-admin-page .crm-segmented,
html[data-theme="light"] .crm-report-page .crm-segmented{
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.7),
    0 12px 28px rgba(15,23,42,.08) !important;
}

html[data-theme="light"] .crm-admin-page .crm-segmented__btn.scope-tab.is-active,
html[data-theme="light"] .crm-admin-page .crm-segmented__btn.scope-tab[aria-pressed="true"],
html[data-theme="light"] .crm-report-page .crm-segmented__btn.scope-tab.is-active,
html[data-theme="light"] .crm-report-page .crm-segmented__btn.scope-tab[aria-pressed="true"]{
  box-shadow:
    inset 0 0 0 1px rgba(var(--crm-inline-switch-accent), .18),
    0 10px 22px rgba(47,108,246,.12) !important;
}

@media (max-width: 720px){
  .crm-admin-page .crm-segmented-row,
  .crm-report-page .crm-segmented-row{
    align-items:stretch !important;
  }

  .crm-admin-page .crm-segmented,
  .crm-report-page .crm-segmented{
    width:100% !important;
  }

  .crm-admin-page .crm-segmented__btn.scope-tab,
  .crm-admin-page .crm-segmented__btn.scope-tab[type="button"],
  .crm-report-page .crm-segmented__btn.scope-tab,
  .crm-report-page .crm-segmented__btn.scope-tab[type="button"]{
    width:100% !important;
  }

  .crm-admin-page .crm-segmented-row > .pill,
  .crm-report-page .crm-segmented-row > .pill{
    width:100% !important;
    justify-content:center !important;
    text-align:center !important;
  }
}