/* ==========================================================================
   Content/ui/shell.css — каркас страницы ТГУ.Аккаунтов (редизайн, вариант Б):
   шапка с меню в навбаре и выпадающими списками, мобильная панель меню (бургер до 1024 px), подвал.
   Источник: docs/design/profile/shell.css и shell-snippets.md (классы kit.css переименованы в sh-*,
   токены — --tsu-* из accounts.css, потому что имена .row/.col/.nav/.btn заняты Bootstrap 4).
   Подключение: в _Layout после accounts.css. Действует только на <body class="tsu sh-page">.
   Ширины: ≥1200 — полная шапка; 1024–1199 — у языка «RU», у пользователя только аватар;
   <1024 — бургер и панель; <768 — телефон (поля 16 px, подвал в одну колонку).
   ========================================================================== */

/* ---------- 1. Страница и контейнер ---------- */
html.sh-lock { overflow: hidden; }
body.sh-page {
  --sh-max: 1280px;   /* ширина шапки, страницы и подвала (с полями) */
  --sh-gutter: 24px;  /* боковые поля */
  --sh-hdr-h: 64px;   /* высота шапки */
  display: flex; flex-direction: column; min-height: 100vh;
}
.sh-cont { width: 100%; max-width: var(--sh-max); margin-left: auto; margin-right: auto; padding-left: var(--sh-gutter); padding-right: var(--sh-gutter); }
.sh-main { flex: 1 0 auto; padding: 28px 0 48px; outline: 0; }
.sh-page :is(a, button, summary, label, [tabindex]):focus-visible { outline: 2px solid var(--tsu-primary); outline-offset: 2px; }
.sh-page address { font-style: normal; }
.sh-ml { margin-left: auto; }
.sh-hr { flex-shrink: 0; width: 100%; height: 1px; margin: 2px 0; background: var(--tsu-border); }

/* ---------- 2. Шапка ---------- */
.sh-hdr { position: relative; z-index: 40; flex-shrink: 0; height: var(--sh-hdr-h); border-bottom: 1px solid var(--tsu-border); background: var(--tsu-surface); }
.sh-hdr-in { display: flex; align-items: center; gap: 24px; height: 100%; }
.sh-brand { display: flex; flex-shrink: 0; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; line-height: 1; white-space: nowrap; color: var(--tsu-text); }
.sh-brand:hover, .sh-brand:focus { color: var(--tsu-text); text-decoration: none; }
.sh-brand img { display: block; width: 25px; height: 28px; }
.sh-brand-dot { margin-left: -8px; color: var(--tsu-primary); }

.sh-nav { display: flex; align-items: center; gap: 4px; min-width: 0; }
.sh-nav > a, .sh-nav-btn {
  display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 8px 12px; border: 0; border-radius: var(--tsu-radius-sm);
  background: transparent; font-family: inherit; font-size: 15px; font-weight: 500; line-height: 1.45; white-space: nowrap; color: var(--tsu-text-muted);
}
.sh-nav-btn { padding-right: 10px; cursor: pointer; }
.sh-nav > a:hover, .sh-nav > a:focus, .sh-nav-btn:hover, .sh-dd.is-open > .sh-nav-btn { background: var(--tsu-surface-muted); color: var(--tsu-text); text-decoration: none; }
.sh-nav > a.on, .sh-nav > a.on:hover { background: var(--tsu-primary-soft); color: var(--tsu-primary); }

.sh-hdr-right { display: flex; flex-shrink: 0; align-items: center; gap: 4px; margin-left: auto; }
.sh-guest .sh-hdr-right .tsu-btn { margin-left: 8px; }
.sh-hbtn {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; margin: 0; padding: 0 8px 0 10px; border: 0; border-radius: var(--tsu-radius-sm);
  background: transparent; font-family: inherit; font-size: 14px; font-weight: 500; white-space: nowrap; color: var(--tsu-text-muted); cursor: pointer;
}
.sh-hbtn:hover, .sh-dd.is-open > .sh-hbtn { background: var(--tsu-surface-muted); color: var(--tsu-text); }
.sh-hbtn > .tsu-icon:first-child { width: 18px; height: 18px; }
.sh-lang-short { display: none; }
.sh-user-btn { display: flex; align-items: center; gap: 8px; margin: 0; padding: 4px; border: 0; border-radius: var(--tsu-radius-sm); background: transparent; font-family: inherit; color: var(--tsu-text); cursor: pointer; }
.sh-user-btn:hover, .sh-dd.is-open > .sh-user-btn { background: var(--tsu-surface-muted); }
.sh-uname { max-width: 200px; overflow: hidden; font-size: 14px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.sh-avatar { display: inline-flex; flex-shrink: 0; width: 32px; height: 32px; overflow: hidden; border-radius: 50%; background: var(--tsu-surface-muted); box-shadow: 0 0 0 1px var(--tsu-border); }
.sh-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sh-chev { width: 14px; height: 14px; color: var(--tsu-text-subtle); transition: transform .15s ease; }
.sh-dd.is-open > button .sh-chev { transform: rotate(180deg); }

/* выпадающие списки: обёртка .sh-dd, кнопка [data-dd-btn], список .sh-dd-menu; открытый — .is-open у .sh-dd */
.sh-dd { position: relative; display: flex; align-items: center; }
.sh-dd-menu {
  position: absolute; top: calc(50% + var(--sh-hdr-h) / 2 + 4px); left: 0; z-index: 60; display: none; flex-direction: column; gap: 2px;
  min-width: 200px; padding: 8px; border: 1px solid var(--tsu-border); border-radius: var(--tsu-radius-md); background: var(--tsu-surface); box-shadow: var(--tsu-shadow-overlay);
}
.sh-dd-menu.sh-end { left: auto; right: 0; }
.sh-dd.is-open > .sh-dd-menu { display: flex; }
.sh-mi { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 6px 8px; border-radius: var(--tsu-radius-sm); font-size: 13px; line-height: 1.4; color: var(--tsu-text); }
.sh-mi:hover, .sh-mi:focus { background: var(--tsu-surface-muted); color: var(--tsu-text); text-decoration: none; }
.sh-mi.on, .sh-mi.on:hover { background: var(--tsu-primary-soft); color: var(--tsu-primary); font-weight: 500; }
.sh-mi > .tsu-icon { color: var(--tsu-text-muted); }
.sh-mi.on > .tsu-icon { color: var(--tsu-primary); }
.sh-umenu { width: 300px; }
.sh-uhead { display: flex; flex-direction: column; padding: 8px; line-height: 1.4; }
.sh-uhead b { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.sh-uhead span { font-size: 13px; color: var(--tsu-text-muted); }

/* список «Сервисы ТГУ» */
.sh-svc-menu { width: 360px; }
.sh-svc { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: var(--tsu-radius-sm); color: var(--tsu-text); }
.sh-svc:hover, .sh-svc:focus { background: var(--tsu-surface-muted); color: var(--tsu-text); text-decoration: none; }
.sh-svc-ico { display: flex; flex-shrink: 0; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: var(--tsu-radius-sm); background: var(--tsu-primary-soft); color: var(--tsu-primary); }
.sh-svc-ico .tsu-icon, .sh-svc-ico svg { width: 18px; height: 18px; }
.sh-svc-txt { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.sh-svc-name { font-size: 14px; font-weight: 500; line-height: 1.35; }
.sh-svc-host { font-size: 12px; line-height: 1.4; color: var(--tsu-text-subtle); }
.sh-ext { width: 14px; height: 14px; margin-left: auto; color: var(--tsu-text-subtle); }

/* бургер */
.sh-burger { display: none; align-items: center; justify-content: center; width: 40px; height: 40px; margin: 0 -10px 0 auto; padding: 0; border: 0; border-radius: var(--tsu-radius-sm); background: transparent; color: var(--tsu-text); cursor: pointer; }
.sh-burger:hover { background: var(--tsu-surface-muted); }
.sh-burger .tsu-icon { width: 20px; height: 20px; }
.sh-burger .sh-i-close, .sh-burger[aria-expanded="true"] .sh-i-open { display: none; }
.sh-burger[aria-expanded="true"] .sh-i-close { display: block; }

/* ---------- 3. Мобильная панель меню ---------- */
.sh-mnav { position: fixed; top: var(--sh-hdr-h); right: 0; bottom: 0; left: 0; z-index: 45; display: none; background: rgb(13 16 23 / .32); }
.sh-mnav.is-open { display: block; }
.sh-mnav-sheet {
  position: absolute; top: 0; right: 0; bottom: 0; display: flex; flex-direction: column; gap: 2px; width: min(100%, 400px);
  padding: 12px 12px 88px; overflow-y: auto; overscroll-behavior: contain; background: var(--tsu-surface); box-shadow: var(--tsu-shadow-overlay);
}
.sh-mnav-sheet .sh-hr { margin: 6px 0; }
.sh-mnav-sheet > a, .sh-mnav-sub > a, .sh-acc {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; margin: 0; padding: 0 12px; border: 0; border-radius: var(--tsu-radius-sm);
  background: transparent; font-family: inherit; font-size: 15px; font-weight: 500; line-height: 1.35; text-align: left; color: var(--tsu-text);
}
.sh-acc { cursor: pointer; }
.sh-mnav-sheet a:hover, .sh-mnav-sheet a:focus, .sh-acc:hover { background: var(--tsu-surface-muted); color: var(--tsu-text); text-decoration: none; }
.sh-mnav-sheet > a.on, .sh-mnav-sheet > a.on:hover { background: var(--tsu-primary-soft); color: var(--tsu-primary); }
.sh-mnav-sheet > a > .tsu-icon, .sh-acc > .tsu-icon:first-child, .sh-mnav-lang > .tsu-icon { width: 20px; height: 20px; color: var(--tsu-text-muted); }
.sh-mnav-sheet > a.on > .tsu-icon { color: var(--tsu-primary); }
.sh-mnav-user { display: flex; align-items: center; gap: 12px; padding: 12px; line-height: 1.4; }
.sh-mnav-user .sh-avatar { width: 40px; height: 40px; }
.sh-mnav-user b { display: block; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.sh-mnav-user span { display: block; font-size: 12px; color: var(--tsu-text-muted); }
.sh-acc .sh-chev { width: 16px; height: 16px; margin-left: auto; }
.sh-acc[aria-expanded="true"] .sh-chev { transform: rotate(180deg); }
.sh-mnav-sub { display: none; flex-direction: column; gap: 2px; padding-left: 32px; }
.sh-acc[aria-expanded="true"] + .sh-mnav-sub { display: flex; }
.sh-mnav-sub > a { min-height: 52px; padding: 6px 12px; font-size: 14px; }
.sh-mnav-sub .sh-svc-host { display: block; font-weight: 400; }
.sh-mnav-sub .sh-ext { width: 16px; height: 16px; }
.sh-mnav-lang { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 12px; font-size: 15px; font-weight: 500; }
.sh-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; margin-left: auto; padding: 3px; border-radius: var(--tsu-radius-sm); background: var(--tsu-surface-muted); }
.sh-seg a { display: block; padding: 6px 12px; border-radius: 4px; font-size: 13px; font-weight: 500; line-height: 1.45; color: var(--tsu-text-muted); }
.sh-seg a:hover, .sh-seg a:focus { color: var(--tsu-text); text-decoration: none; }
.sh-seg a.on { background: var(--tsu-surface); color: var(--tsu-text); box-shadow: var(--tsu-shadow-card); }

/* ---------- 4. Подвал ---------- */
.sh-ftr { flex-shrink: 0; border-top: 1px solid var(--tsu-border); background: var(--tsu-surface); color: var(--tsu-text); }
.sh-ftr-in { padding-top: 56px; padding-bottom: 32px; }
.sh-ftr-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 48px; }
.sh-ftr-brand { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.sh-ftr-logo { display: block; width: 100%; max-width: 508px; height: auto; }
.sh-socs { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.sh-soc { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--tsu-radius-sm); background: var(--tsu-primary); color: var(--tsu-primary-fg); }
.sh-soc:hover, .sh-soc:focus { background: var(--tsu-primary-hover); color: var(--tsu-primary-fg); }
.sh-soc svg { width: 20px; height: 20px; }
.sh-ftr-sec { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.sh-ftr-h { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.45; letter-spacing: .06em; text-transform: uppercase; color: var(--tsu-text-muted); }
.sh-ftr-list { display: flex; flex-direction: column; gap: 6px; }
.sh-ftr-note { margin: 0; font-size: 13px; line-height: 1.45; color: var(--tsu-text-muted); }
.sh-ftr-sub { padding-left: 24px; }
.sh-ftr-link { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--tsu-primary); overflow-wrap: anywhere; }
.sh-ftr-link:hover { color: var(--tsu-primary-hover); text-decoration: underline; }
.sh-ftr-end { justify-self: end; }
.sh-addr { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: 15px; line-height: 1.5; }
.sh-addr > .tsu-icon { margin-top: 3px; color: var(--tsu-text-muted); }
.sh-ftr-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--tsu-border); font-size: 13px; color: var(--tsu-text-muted); }
.sh-ftr-bottom a { color: inherit; }
.sh-ftr-bottom a:hover { color: var(--tsu-primary); text-decoration: underline; }
/* Кнопка виджета «Сервисы ТГУ» закрывает правый край нижней строки подвала, пока поле справа узкое: запас снизу
   (замена #services-widget-scroll-spacer: под контентом теперь подвал). */
@media (max-width: 1559.98px) { .sh-ftr-in { padding-bottom: 76px; } }

/* Плашки TempData и заголовок прежних страниц внутри нового контейнера */
.sh-main .tsu-notices { margin-bottom: 20px; }

/* ---------- 5. Адаптив ---------- */
@media (max-width: 1199.98px) {
  .sh-uname, .sh-lang-full { display: none; }
  .sh-lang-short { display: inline; }
  .sh-ftr-grid { grid-template-columns: minmax(0, 1fr) auto auto; gap: 40px; }
}
@media (max-width: 1023.98px) {
  body.sh-page { --sh-hdr-h: 56px; }
  .sh-hdr { position: sticky; top: 0; }
  .sh-hdr-in { gap: 12px; }
  .sh-brand { font-size: 16px; }
  .sh-brand img { width: 21px; height: 24px; }
  .sh-hdr .sh-nav, .sh-hdr .sh-hdr-right { display: none; }
  .sh-hdr.sh-guest .sh-hdr-right { display: flex; }   /* гость: язык и «Войти» без бургера */
  .sh-burger { display: inline-flex; }
  .sh-ftr-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 48px; }
  .sh-ftr-brand { grid-column: 1 / -1; }
  .sh-ftr-end { justify-self: start; }
}
@media (min-width: 1024px) {
  .sh-mnav, .sh-mnav.is-open { display: none; }
}
@media (max-width: 767.98px) {
  body.sh-page { --sh-gutter: 16px; }
  .sh-main { padding: 16px 0 32px; }
  .sh-ftr-in { padding-top: 40px; padding-bottom: 84px; }
  .sh-ftr-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .sh-ftr-bottom { flex-direction: column; margin-top: 32px; }
}
@media (max-width: 399.98px) {
  .sh-guest .sh-hbtn { gap: 2px; padding: 0 6px; }
  .sh-guest .sh-lang-short { display: none; }
  .sh-guest .sh-hdr-right .tsu-btn { margin-left: 4px; padding: 0 12px; }
}
@media (prefers-reduced-motion: reduce) { .sh-chev { transition: none; } }
@media print { .sh-hdr, .sh-mnav, .sh-ftr { display: none; } }
