/* вынесен из nav.js (SEC-11: style-src без unsafe-inline); подключается ссылкой <link> на страницах и страховочно из скрипта */
/* Дизайн «Б2»: на ПК (от 1100px) боковое меню + верхняя полоса с балансом,
   уведомлениями и входом; уже 1100px — шапка и нижняя панель из 5 вкладок,
   «Ещё» открывает выдвижной список. Цвета и кнопки из design-system.css (--ui-*, .ui-*).
   Граница 1100, а не 900: с сайдбаром 240px на 901px страницам оставалось бы
   ~660px, а их собственные медиазапросы считали бы это десктопом. */

/* ═══ Общее ═══════════════════════════════════════════ */
.nv-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; user-select: none; color: var(--ui-text);
}
.nv-brand-mark {
  width: 24px; height: 24px; border-radius: 7px;
  background: var(--ui-accent-deep); flex-shrink: 0;
}
.nv-brand-text { font-weight: 700; font-size: 16px; white-space: nowrap; color: var(--ui-text); }

.nv-ico { display: inline-flex; flex: none; }
.nv-ico svg { width: 18px; height: 18px; }

.nv-unread-dot,
.nv-side-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  font-size: 11px; font-weight: 700; line-height: 1;
  background: var(--ui-accent); color: var(--ui-bg); border-radius: 99px;
}
.nv-side-badge { margin-left: auto; }
.nv-unread-dot {
  position: absolute; top: -6px; right: -6px;
  border: 2px solid var(--ui-bg);
}

/* ═══ ПК: боковое меню ═════════════════════════════════ */
.nv-side {
  display: none;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 100;
  width: var(--ui-side-w);
  flex-direction: column;
  padding: 24px 16px;
  background: var(--ui-bg);
  border-right: 1px solid var(--ui-line);
  overflow-y: auto; overscroll-behavior: contain;
  box-sizing: border-box;
}
.nv-side .nv-brand { padding: 0 12px 20px; }
.nv-side-cta { width: 100%; margin-bottom: 18px; padding: 11px 0; }
.nv-side-cta svg { width: 16px; height: 16px; }
.nv-side-list { display: flex; flex-direction: column; gap: 2px; }
.nv-side-foot { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--ui-line); }
.nv-side-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 9px;
  font-size: 14px; font-weight: 500; color: var(--ui-text-2);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.nv-side-link:hover { background: var(--ui-surface); color: var(--ui-text); }
.nv-side-link--active,
.nv-side-link--active:hover { background: var(--ui-accent-soft); color: var(--ui-accent); }

/* ═══ ПК: верхняя полоса ═══════════════════════════════ */
.nv-topbar {
  display: none;
  align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 16px 32px;
  background: var(--ui-bg);
  border-bottom: 1px solid var(--ui-line);
  position: sticky; top: 0; z-index: 90;
}
.nv-topbar-title { font-size: 15px; color: var(--ui-text-2); }
.nv-topbar-actions { display: flex; align-items: center; gap: 10px; }
.nv-account { padding: 10px 18px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }

/* ═══ Телефон: шапка ═══════════════════════════════════ */
.nv-mtop {
  display: none;
  align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0));
  background: var(--ui-bg);
  border-bottom: 1px solid var(--ui-line);
  position: sticky; top: 0; z-index: 100;
}
.nv-mtop .nv-brand { gap: 8px; min-width: 0; }
.nv-mtop .nv-brand-mark { width: 22px; height: 22px; border-radius: 6px; }
.nv-mtop .nv-brand-text { font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.nv-mtop-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.nv-mtop .ui-chip-balance { padding: 6px 12px 6px 8px; font-size: 12px; gap: 6px; }
.nv-mtop .ui-chip-balance svg { width: 13px; height: 13px; }

/* ═══ Телефон: нижняя панель ═══════════════════════════ */
.nv-bn {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0));
  background: var(--ui-surface-low);
  border-top: 1px solid var(--ui-line);
}
.nv-bn-tab {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 0; min-height: 48px; box-sizing: border-box;
  color: var(--ui-text-4); font-size: 11px; font-weight: 500;
  text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.nv-bn-tab:hover { color: var(--ui-text-2); }
.nv-bn-tab--active, .nv-bn-tab--active:hover { color: var(--ui-accent); }
.nv-bn-icon { position: relative; display: flex; }
.nv-bn-icon svg { width: 20px; height: 20px; }
.nv-bn-label { line-height: 1; white-space: nowrap; }

/* ═══ Телефон: «Ещё» ═══════════════════════════════════ */
.nv-drw-backdrop {
  position: fixed; inset: 0; z-index: 199;
  background: rgba(0,0,0,0.55);
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.nv-drw-backdrop--open { opacity: 1; pointer-events: auto; }
.nv-drw {
  position: fixed; z-index: 200;
  left: 12px; right: 12px;
  bottom: calc(72px + env(safe-area-inset-bottom, 0));
  max-width: 480px; margin: 0 auto;
  max-height: calc(100vh - 110px - env(safe-area-inset-bottom, 0)); overflow-y: auto;
  background: var(--ui-surface-low);
  border: 1px solid var(--ui-line-hi); border-radius: 16px;
  padding: 10px 10px 12px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  opacity: 0; transform: translateY(16px); pointer-events: none;
  transition: opacity .25s, transform .28s;
}
.nv-drw--open { opacity: 1; transform: none; pointer-events: auto; }
.nv-drw-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 10px 12px; }
.nv-drw-title { font-weight: 700; font-size: 16px; color: var(--ui-text); }
.nv-drw-list { display: flex; flex-direction: column; gap: 2px; }
.nv-drw-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; min-height: 48px; box-sizing: border-box;
  border-radius: 9px; color: var(--ui-text-2);
  font-size: 15px; font-weight: 500; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.nv-drw-item:hover, .nv-drw-item:active { background: var(--ui-surface); color: var(--ui-text); }
.nv-drw-item--active { background: var(--ui-accent-soft); color: var(--ui-accent); }
.nv-drw-label { flex: 1; }
.nv-drw-logout { width: 100%; border: none; background: none; font: inherit; cursor: pointer; text-align: left; }

/* ═══ Переключение ПК / телефон ════════════════════════ */
@media (min-width: 1100px) {
  html.nv-shell body { padding-left: var(--ui-side-w); }
  .nv-side { display: flex; }
  .nv-topbar { display: flex; }
  /* На страницах с обёрткой .site-shell (отступы 14px 20px, styles.css) полоса
     выходит на всю ширину, как на страницах без обёртки. */
  .site-shell > #nav-root .nv-topbar { margin: -14px -20px 14px; }
  .nv-mtop, .nv-bn, .nv-drw, .nv-drw-backdrop { display: none !important; }
}
@media (max-width: 1099px) {
  .nv-mtop { display: flex; }
  .nv-bn { display: flex; }
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom, 0)) !important; }
}
@media (max-width: 380px) {
  .nv-mtop .nv-brand-text { display: none; }
}
/* Телефон в альбомной ориентации: вкладки без подписей, резерв места меньше. */
@media (max-width: 1099px) and (orientation: landscape) and (max-height: 700px) {
  .nv-bn-tab { min-height: 38px; padding: 6px 0; }
  .nv-bn-label { display: none; }
  body { padding-bottom: calc(52px + env(safe-area-inset-bottom, 0)) !important; }
}
