/* Общее боковое меню приложения. Подключается на каждой странице раздела вместе с shell.js.
   Место под меню резервируется сразу (отступ у body), чтобы страница не прыгала, пока меню рисуется. */
@view-transition{navigation:auto}
html{color-scheme:light dark;background:#f3f5f7}
@media (prefers-color-scheme:dark){html{background:#0f141a}}
::view-transition-old(root),::view-transition-new(root){animation-duration:160ms;animation-timing-function:ease-out}

:root{
  --shw:248px;--shs:0px;
  --sh-ink:#dbe7f5;--sh-mut:#88a2c2;--sh-on:rgba(255,255,255,.07);--sh-acc:#4caf50;
  --sh-act-bg:#d8f3dc;--sh-act-ink:#124a1b;--sh-act-bar:#2e7d32;
}
@media (prefers-color-scheme:dark){
  :root{--sh-act-bg:#173c2c;--sh-act-ink:#a7f0b2;--sh-act-bar:#4caf50}
}
body{padding-left:calc(var(--shw) + var(--shs))!important}

#shell,#shell *{box-sizing:border-box}
#shell{position:fixed;top:0;bottom:0;left:0;width:var(--shw);z-index:9;display:flex;flex-direction:column;
  background:linear-gradient(180deg,#0b2447 0%,#071933 100%);color:var(--sh-ink);
  font:14px/1.3 system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;view-transition-name:sh-sidebar}
/* меню не моргает при переходе между страницами */
::view-transition-old(sh-sidebar),::view-transition-new(sh-sidebar){animation:none}

/* шапка с логотипом */
#shell .sh-brand{display:flex;align-items:center;gap:12px;padding:18px 16px 14px;text-decoration:none}
#shell .sh-logo{width:46px;height:46px;border-radius:50%;object-fit:contain;flex:none}
#shell .sh-brand-text-block{display:flex;flex-direction:column;line-height:1.05;min-width:0}
#shell .sh-brand-t{font-size:20px;font-weight:800;color:#fff;letter-spacing:.01em;line-height:1.05}
#shell .sh-brand-crm{color:var(--sh-acc)}
#shell .sh-brand-sub{font-size:10px;font-weight:700;color:#c7d6e8;letter-spacing:.06em;margin-top:3px;text-transform:uppercase;line-height:1.15}

/* меню */
#shell nav{flex:1;overflow:auto;padding:4px 8px;position:relative}
#shell .sh-i{display:flex;align-items:center;gap:11px;width:100%;margin:2px 0;padding:10px 12px;border:0;border-radius:10px;background:none;color:inherit;font:inherit;font-size:14.5px;text-align:left;text-decoration:none;cursor:pointer;position:relative;z-index:1;transition:background-color 140ms ease,color 140ms ease}
#shell .sh-i:hover:not(.on){background:var(--sh-on)}
#shell .sh-i .ic{width:20px;height:20px;display:inline-flex;align-items:center;justify-content:center;opacity:.88;flex:none}
#shell .sh-i .ic svg{width:18px;height:18px;display:block}
#shell .sh-i .ar{margin-left:auto;width:16px;height:16px;display:inline-flex;align-items:center;justify-content:center;color:var(--sh-mut);transition:transform 160ms ease;flex:none}
#shell .sh-i .ar svg{width:16px;height:16px;display:block}
#shell .sh-i.exp .ar{transform:rotate(180deg)}
#shell .sh-badge{margin-left:auto;min-width:20px;padding:1px 6px;border-radius:10px;background:#e5484d;color:#fff;font-size:11px;font-weight:700;line-height:16px;text-align:center}
#shell .sh-i:focus-visible,.sh-sub-i:focus-visible{outline:2px solid var(--sh-acc);outline-offset:2px}

/* группа с подразделами — полупрозрачная карточка в раскрытом виде */
.sh-group{border-radius:12px;margin:4px 0;transition:background-color 150ms ease}
.sh-group.open{background:rgba(255,255,255,.07);padding:4px}
.sh-group .sh-i{margin:0}

/* вложенные подразделы */
.sh-tree{padding:2px 0 2px 0}
.sh-tree[hidden]{display:none}
.sh-sub-i{display:flex;align-items:center;gap:10px;padding:9px 12px;border-radius:10px;font-size:14px;color:var(--sh-ink);text-decoration:none;position:relative;z-index:1;margin:1px 0}
.sh-sub-i.noic{padding-left:38px}
.sh-sub-i .ic{width:20px;height:20px;display:inline-flex;align-items:center;justify-content:center;opacity:.82;flex:none}
.sh-sub-i .ic svg{width:17px;height:17px;display:block}
.sh-sub-i:hover:not(.on){background:var(--sh-on)}

/* активный пункт / подраздел */
#shell .sh-i.on,#shell .sh-sub-i.on{color:var(--sh-act-ink);font-weight:600}
#shell .sh-i.on .ic,#shell .sh-sub-i.on .ic{opacity:1}

/* плавающая мятная плашка активного пункта */
.sh-ind{position:absolute;left:0;top:0;border-radius:10px;background:var(--sh-act-bg);box-shadow:inset 4px 0 0 var(--sh-act-bar);pointer-events:none;z-index:0;view-transition-name:sh-ind}
::view-transition-group(sh-ind){animation-duration:220ms;animation-timing-function:cubic-bezier(0.2,0.8,0.2,1)}
::view-transition-old(sh-ind){display:none}
::view-transition-new(sh-ind){animation:none;height:100%}

/* подвал */
#shell .sh-foot{padding:12px 10px 14px;border-top:1px solid rgba(255,255,255,.09)}
#shell .sh-user{display:flex;align-items:center;gap:10px;padding:4px 8px 12px}
#shell .sh-av{width:34px;height:34px;border-radius:50%;background:rgba(255,255,255,.14);color:#fff;font-weight:700;font-size:13px;display:grid;place-items:center;flex:none}
#shell .sh-uinfo{min-width:0;line-height:1.2}
#shell .sh-uinfo b{display:block;color:#fff;font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#shell .sh-uinfo small{display:block;color:var(--sh-mut);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* тумблер уведомлений и звука */
#shell .sh-bell{margin-left:auto;flex:none;width:30px;height:30px;border-radius:8px;border:0;background:rgba(255,255,255,.08);color:var(--sh-ink);font-size:15px;line-height:1;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;transition:background-color 140ms ease,opacity 140ms ease}
#shell .sh-bell:hover{background:rgba(255,255,255,.18)}
#shell .sh-bell.off{opacity:.5}
#shell .sh-bell:focus-visible{outline:2px solid var(--sh-acc);outline-offset:2px}
#shell .sh-foot .sh-i.sh-settings{background:rgba(255,255,255,.06)}
.sh-foot .sh-i.on,.sh-foot .sh-sub-i.on{background:var(--sh-act-bg);box-shadow:inset 4px 0 0 var(--sh-act-bar);color:var(--sh-act-ink)}

/* узкий экран: компактная верхняя полоса */
@media (max-width:760px){
  body{padding-left:0!important;padding-top:46px!important}
  #shell{bottom:auto;right:0;width:auto;height:46px;flex-direction:row;align-items:center}
  #shell .sh-brand,#shell .sh-user{display:none}
  #shell nav{display:flex;gap:2px;padding:0 6px;overflow-x:auto;overflow-y:hidden}
  #shell .sh-i{width:auto;white-space:nowrap;padding:7px 9px;margin:0;gap:7px;font-size:14px}
  #shell .sh-i .ar{display:none}
  #shell .sh-foot{display:flex;border:0;padding:0 6px}
  #shell .sh-group{display:contents}
  #shell .sh-group.open{background:none;padding:0}
  #shell .sh-tree{display:contents}
  #shell .sh-tree[hidden]{display:none}
  #shell .sh-sub-i{width:auto;white-space:nowrap;padding:7px 9px;margin:0;font-size:14px}
  #shell .sh-sub-i.noic{padding-left:9px}
  #shell .sh-sub-i .ic{display:none}
  .sh-ind{left:0;right:auto}
}
@media print{#shell{display:none}body{padding:0!important}}

/* меньше движения — без анимаций */
@media (prefers-reduced-motion:reduce){
  ::view-transition-group(*),::view-transition-old(*),::view-transition-new(*){animation:none!important}
  #shell .sh-i,.sh-sub-i,.sh-ind,.sh-group{transition:none!important}
}
