/* Взаимно — общие стили оболочки и набора элементов (/shared/kit.js): кнопки, листы, поля, переключатели, нижнее меню,
   шапка ПК. Стили экранов приложения — web/app/screens.css, пульта — web/admin/admin.css.
   Цвета, шрифты и тёмная тема — только из /shared/tokens.css («сумерки»: ягода — главное действие, фиалка — второй
   акцент, абрикос — только графика); фирменные элементы — /shared/ui.css.
   Телефон в первую очередь (390 px, без прокрутки вбок от 360 px). С 900 px — шапка сверху и колонка по центру
   (у .app.side — боковое меню слева). Внутри O. Message (html.in-omsg) справа сверху капсула «⋯ ×» мессенджера —
   шапкам экранов отступ справа 100 px. */

:root {
  --hdr: 0px;                                          /* высота шапки ПК */
  --tabbar: calc(62px + env(safe-area-inset-bottom));  /* высота нижнего меню телефона */
  --side: 0px;                                         /* ширина бокового меню ПК */
  --col: 560px;                                        /* ширина колонки содержимого */
  --omsg-gap: 0px;                                     /* место под капсулу O. Message справа сверху */
}
@media (min-width: 900px) { :root { --hdr: 64px; --tabbar: 0px; } }
html.in-omsg { --omsg-gap: 100px; }

html { scroll-padding-top: calc(var(--hdr) + 64px); }
html.no-scroll { overflow: hidden; }
body { min-height: 100dvh; overflow-x: hidden; }
#app { min-height: 100dvh; }

/* ───────── типографика и утилиты ───────── */
.h1 { font-size: 30px; letter-spacing: -.02em; }
.h2 { font-size: 24px; letter-spacing: -.015em; }
.h3 { font-size: 19px; letter-spacing: -.01em; }
.h4 { font-size: 16px; }
.muted { color: var(--muted); }
.sm { font-size: var(--fs-sm); }
.block { display: block; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grow { flex: 1 1 auto; }
.min0 { min-width: 0; }
.row { display: flex; align-items: center; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; }
.center { text-align: center; justify-content: center; }
.center-col { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; }
.stack { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.ok-t { color: var(--ok); }
.accent-t { color: var(--accent-ink); }
.brand-t { color: var(--primary-ink); }
.urgent-t { color: var(--urgent); }
.danger-t { color: var(--danger); }
.err { color: var(--danger); font-size: 14px; }
.link { color: var(--primary-ink); background: none; border: 0; padding: 0; font-weight: 500; cursor: pointer; min-height: 32px; }
.link:disabled { color: var(--muted); cursor: default; }
.hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.d-only, .d-inline { display: none !important; }
.m-only { display: flex; }
@media (min-width: 900px) { .d-only { display: inline-flex !important; } .d-inline { display: inline !important; } .m-only { display: none !important; } }

.skip { position: absolute; left: -999px; top: 8px; z-index: 1000; background: var(--surface); padding: 10px 14px; border-radius: 12px; box-shadow: var(--sh-2); }
.skip:focus { left: 12px; }

/* ───────── раскладка ───────── */
.main { padding-bottom: calc(var(--tabbar) + 12px); outline: none; }
.app.bare { --tabbar: 0px; }   /* экран без нижнего меню */
.pad { padding-inline: 16px; max-width: calc(var(--col) + 32px); margin-inline: auto; }
.pad.wide { max-width: 1100px; }
@media (min-width: 900px) { .main { padding-bottom: 56px; } }
.page { min-height: 40vh; }
.route { animation: page-in .28s var(--ease) both; }
/* экран во всю область (full: true): стопка карточек, чат. Страница не прокручивается — экран сам решает, что внутри */
.app.full { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.app.full .main { flex: 1 1 auto; min-height: 0; padding: 0; margin-bottom: var(--tabbar); overflow: hidden; position: relative; }
.app.full .route { height: 100%; }
/* появление (кривые и кадры Brain Motion) */
.in-up { animation: bm-fade-up var(--bm-slow, .42s) var(--bm-ease-out, var(--ease)) var(--d, 0ms) both; }
.in-pop { animation: bm-pop .6s var(--bm-ease, var(--ease)) var(--d, 0ms) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }

/* заголовок экрана */
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 4px; min-height: 56px;
  padding: calc(4px + env(safe-area-inset-top)) calc(8px + var(--omsg-gap)) 4px 6px; background: color-mix(in oklab, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3); }
.tb-title { flex: 1; min-width: 0; padding-inline: 4px; }
.tb-title h1 { font-size: 18px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-title p { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-gap { width: 8px; flex: none; }
.tb-gap + .tb-title h1 { font-family: var(--font-display); font-style: italic; font-weight: 700; font-size: 30px; letter-spacing: -.01em; }
.tb-act { display: flex; gap: 2px; align-items: center; }
/* поверх фото: без фона, кнопки — на «стекле» */
.topbar.float { position: absolute; left: 0; right: 0; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; pointer-events: none; }
.topbar.float > * { pointer-events: auto; }
.topbar.float .icon-btn { background: rgba(20, 12, 28, .38); color: #fff; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
@media (min-width: 900px) {
  .topbar { position: static; max-width: calc(var(--col) + 32px); margin: 0 auto; padding: 22px 8px 6px; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .topbar.float { position: absolute; max-width: none; padding: 12px; }
  .tb-title h1 { font-size: 24px; }
  .tb-gap + .tb-title h1 { font-size: 36px; }
}

.offline { position: sticky; top: 0; z-index: 60; display: flex; gap: 8px; align-items: center; justify-content: center; padding: 6px 12px; background: var(--ink); color: var(--bg); font-size: 13px; flex: none; }

/* ───────── кнопки ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 22px; border-radius: var(--r-full);
  border: 1px solid transparent; font: 500 16px/1.1 var(--font); text-decoration: none !important; white-space: nowrap; letter-spacing: -.005em;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background var(--t) var(--ease), box-shadow var(--t) var(--ease), transform .22s var(--ease-spring), opacity var(--t); }
.btn > span { overflow: hidden; text-overflow: ellipsis; }
.btn:not(:disabled):active { transform: scale(.96); transition-duration: .08s; }
/* главная — ягода с тёплым свечением; одна на экран */
.btn-primary { background: linear-gradient(135deg, color-mix(in oklab, var(--primary) 84%, var(--apricot)) 0%, var(--primary) 55%); color: var(--on-primary); box-shadow: var(--glow-like); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-dark { background: var(--ink); color: var(--bg); }
.btn-dark:hover { background: var(--ink-2); }
.btn-soft { background: var(--primary-soft); color: var(--primary-soft-ink); }
.btn-soft:hover { background: color-mix(in oklab, var(--primary-soft) 86%, var(--brand-500)); }
.btn-accent { background: var(--grad-super); color: #fff; box-shadow: var(--glow-super); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-outline { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-outline:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: var(--on-danger); }
.btn-ghost-danger { background: transparent; color: var(--danger); border-color: var(--line-strong); }
.btn-ghost-danger:hover { background: var(--danger-soft); }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 14.5px; }
.btn-lg { min-height: 58px; padding: 0 28px; font-size: 17px; }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.is-loading > span:not(.spin) { opacity: .8; }
.spin { display: inline-block; width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: vz-spin .7s linear infinite; flex: none; }
@keyframes vz-spin { to { transform: rotate(360deg); } }
.row-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }

.icon-btn { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-2); flex: none;
  text-decoration: none !important; transition: background var(--t) var(--ease), transform .2s var(--ease-spring); -webkit-tap-highlight-color: transparent; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.9); }
.icon-btn.on { color: var(--primary-soft-ink); background: var(--primary-soft); }
.badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--primary); color: #fff;
  font: 600 11px/18px var(--font); text-align: center; box-shadow: 0 0 0 2px var(--surface); }
.badge.dot { min-width: 0; width: 10px; height: 10px; padding: 0; top: 2px; right: 8px; }
.badge.in { position: static; box-shadow: none; display: inline-block; }

/* ───────── заготовки загрузки и картинки ───────── */
.sk { display: block; border-radius: 12px; background: linear-gradient(100deg, var(--surface-2) 40%, var(--surface-3) 50%, var(--surface-2) 60%) 0 0 / 200% 100%; animation: vz-shimmer 1.3s linear infinite; }
@keyframes vz-shimmer { to { background-position: -200% 0; } }
.img { position: relative; overflow: hidden; background: var(--surface-2); }
.img img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .35s var(--ease); }
.img.ok img { opacity: 1; }
.img.ph { display: grid; place-items: center; background: var(--surface-2); }
.img.ph .ph-mark { color: var(--faint); width: 34%; height: auto; max-width: 72px; }

.ava { border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-2); }
.ava-ph { display: inline-grid; place-items: center; font-weight: 600; color: hsl(var(--h) 45% 30%); background: hsl(var(--h) 60% 90%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ava-ph { color: hsl(var(--h) 60% 84%); background: hsl(var(--h) 26% 24%); } }
:root[data-theme="dark"] .ava-ph { color: hsl(var(--h) 60% 84%); background: hsl(var(--h) 26% 24%); }

/* ───────── чипы и метки ───────── */
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 15px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); font: 500 14.5px/1.1 var(--font); color: var(--ink-2); white-space: nowrap; flex: none; text-decoration: none !important;
  transition: background var(--t), border-color var(--t), color var(--t), transform .22s var(--ease-spring); -webkit-tap-highlight-color: transparent; }
.chip:hover { border-color: var(--faint); }
.chip:not(:disabled):active { transform: scale(.94); }
.chip .ic { color: var(--muted); }
.chip.on { background: var(--primary-soft); color: var(--primary-soft-ink); border-color: color-mix(in oklab, var(--primary) 45%, transparent); }
.chip.on .ic { color: var(--primary-ink); }
.chip:disabled { opacity: .45; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--tone-mute-bg); color: var(--tone-mute); white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.info { background: var(--info-soft); color: var(--info); }
.tag.brand { background: var(--primary-soft); color: var(--primary-soft-ink); }
.tag.urgent { background: var(--urgent-soft); color: var(--urgent); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
/* прокрутка вбок «до края экрана»: поля выносятся на --bleed (по умолчанию 16 px — как у .pad) */
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--bleed, 16px) * -1); padding: 2px var(--bleed, 16px); }
.chips.scroll.flush { --bleed: 0px; }
.chips.scroll::-webkit-scrollbar { display: none; }

/* ───────── формы ───────── */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.field-l { font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.field-h { font-size: 12.5px; color: var(--muted); }
.field-err { font-size: 13px; color: var(--danger); }
.input { width: 100%; min-height: 52px; padding: 13px 16px; border-radius: 18px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 16px; color: var(--ink);
  transition: border-color var(--t), box-shadow var(--t); }
.input::placeholder { color: var(--faint); }
.input:hover { border-color: var(--field-line); }
.input:focus { outline: none; border-color: var(--primary-ink); box-shadow: var(--ring); }
textarea.input { resize: none; min-height: 96px; line-height: 1.45; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 22px) 50%, calc(100% - 17px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 40px; }
.has-err .input { border-color: var(--danger); }
.checkline { display: flex; gap: 10px; align-items: center; font-size: 15px; min-height: 44px; cursor: pointer; }
.checkline input { width: 22px; height: 22px; accent-color: var(--primary); margin: 0; flex: none; }
.radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--field-line); flex: none; transition: border var(--t-fast); }
.radio.on { border: 7px solid var(--primary); }

/* вкладки-«пилюли»: выбранная — белая плашка, которая переезжает */
.seg { position: relative; display: flex; gap: 2px; padding: 4px; border-radius: 999px; background: var(--surface-2); max-width: 100%; overflow-x: auto; scrollbar-width: none; isolation: isolate; }
.seg::-webkit-scrollbar { display: none; }
.seg-glider { position: absolute; z-index: -1; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: 999px; background: var(--surface); box-shadow: var(--sh-1), 0 4px 14px -6px rgba(42,22,64,.25);
  transform: translateX(var(--gx, 0)); width: var(--gw, 0); transition: transform .38s var(--ease-spring), width .3s var(--ease); }
.seg-i { position: relative; flex: 1 1 auto; min-width: 0; min-height: 38px; padding: 0 12px; border: 0; background: transparent; border-radius: 999px; font: 500 14px/1 var(--font);
  color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: color var(--t); }
.seg-i.on { color: var(--ink); }
.seg-t { overflow: hidden; text-overflow: ellipsis; }
.seg-n { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--primary); color: #fff; font: 600 11.5px/20px var(--font); text-align: center; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg-glider { background: var(--surface-3); } }
:root[data-theme="dark"] .seg-glider { background: var(--surface-3); }

.switch { position: relative; width: 52px; height: 32px; border-radius: 999px; border: 0; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-strong); flex: none; transition: background var(--t); cursor: pointer; }
.switch i { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(30,20,40,.28); transition: transform .3s var(--ease-spring); }
.switch.on { background: var(--primary); box-shadow: none; }
.switch.on i { transform: translateX(20px); }
.switch:disabled { opacity: .5; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 18px; background: var(--info-soft); color: var(--ink); font-size: 14px; margin: 10px 0; }
.notice > .ic { margin-top: 1px; color: var(--info); }
.notice.warn { background: var(--warn-soft); } .notice.warn > .ic { color: var(--warn); }
.notice.err { background: var(--danger-soft); } .notice.err > .ic { color: var(--danger); }
.notice.ok { background: var(--ok-soft); } .notice.ok > .ic { color: var(--ok); }
.notice.brand { background: var(--primary-soft); } .notice.brand > .ic { color: var(--primary-ink); }

/* ───────── листы ───────── */
.sheet-wrap { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(18, 10, 26, .52); animation: vz-fade .22s var(--ease); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.sheet { position: relative; width: 100%; max-height: 92dvh; background: var(--surface); border-radius: 30px 30px 0 0; display: flex; flex-direction: column;
  box-shadow: var(--sh-3); animation: vz-up .4s var(--bm-ease-out, var(--ease)); padding-bottom: env(safe-area-inset-bottom); outline: none;
  transition: transform .26s var(--ease); }
.sheet-grip { width: 44px; height: 5px; border-radius: 5px; background: var(--line-strong); margin: 0 auto; flex: none; box-sizing: content-box; border: 8px solid transparent; background-clip: padding-box; touch-action: none; cursor: grab; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 8px 2px 20px; touch-action: none; }
.sheet-head h2 { font-size: 20px; font-weight: 500; min-width: 0; }
.sheet-x { position: absolute; top: 10px; right: 10px; z-index: 3; background: var(--surface-2); }
.sheet-body { padding: 8px 20px 22px; overflow: auto; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.sheet-foot { padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
@keyframes vz-fade { from { opacity: 0; } }
@keyframes vz-up { from { transform: translateY(60px); opacity: 0; } }
@media (min-width: 700px) {
  .sheet-wrap { align-items: center; padding: 24px; }
  .sheet { max-width: 480px; border-radius: 30px; max-height: 88vh; animation-name: vz-pop; }
  .sheet.wide { max-width: 880px; }
  .sheet-grip { display: none; }
  .sheet-head { padding-top: 14px; }
}
@keyframes vz-pop { from { transform: scale(.95) translateY(10px); opacity: 0; } }
/* лист почти во весь экран на телефоне */
@media (max-width: 699px) { .sheet.full { height: 92dvh; } }

.list { display: flex; flex-direction: column; }
.row-i { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 4px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; width: 100%; color: var(--ink); text-decoration: none !important; font-size: 15px; }
.row-i:last-child { border-bottom: 0; }
.row-i.on { color: var(--primary-ink); font-weight: 500; }

/* ───────── шапка ПК ───────── */
.hdr { display: none; }
@media (min-width: 900px) {
  .hdr { display: block; position: sticky; top: 0; z-index: 50; height: 64px; flex: none; background: color-mix(in oklab, var(--bg) 84%, transparent);
    backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); border-bottom: 1px solid var(--line); }
  .hdr-in { max-width: 1200px; margin: 0 auto; height: 64px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 0 24px; }
  .hdr-nav { display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface-2); }
  .hdr-link { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; color: var(--muted); font-weight: 500; font-size: 14.5px;
    text-decoration: none !important; transition: background var(--t) var(--ease), color var(--t); }
  .hdr-link:hover { color: var(--ink); }
  .hdr-link.on { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
  .hdr-link .badge.in { margin: 0 -6px 0 0; }
  .hdr-r { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
  .hdr-me { border-radius: 50%; margin-left: 4px; display: block; padding: 2px; background: var(--grad-brand); }
  .hdr-me .ava { border: 2px solid var(--bg); }
}
@media (min-width: 900px) and (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hdr-link.on { background: var(--surface-3); } }
@media (min-width: 900px) { :root[data-theme="dark"] .hdr-link.on { background: var(--surface-3); } }

/* ───────── нижнее меню телефона ─────────
   Пункты поровну (число — переменной --tabs); выбранный — полоска цвета знака сверху. */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: grid; grid-template-columns: repeat(var(--tabs, 4), minmax(0, 1fr));
  height: var(--tabbar); padding: 0 8px env(safe-area-inset-bottom); background: color-mix(in oklab, var(--surface) 92%, transparent);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); border-top: 1px solid var(--line); }
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font: 500 11px/1 var(--font);
  text-decoration: none !important; -webkit-tap-highlight-color: transparent; }
.tab-ic { position: relative; display: grid; place-items: center; height: 28px; min-width: 28px; transition: transform .25s var(--ease-spring); }
.tab.on { color: var(--ink); }
.tab.on::after { content: ''; position: absolute; top: 0; left: 50%; width: 22px; height: 3px; margin-left: -11px; border-radius: 0 0 3px 3px; background: var(--grad-brand); }
.tab:active .tab-ic { transform: scale(.86); }
.tab-ic .badge { top: -4px; left: 15px; right: auto; }
.tab-ic .badge.dot { top: -1px; left: 20px; }
.tab-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; padding: 0 2px; }
@media (min-width: 900px) { .tabbar { display: none; } }

/* ───────── боковое меню ПК (<div class="app side">) ───────── */
.sidenav { display: none; }
@media (min-width: 900px) {
  .app.side { --side: 248px; --hdr: 0px; }
  .app.side .hdr { display: none; }
  .app.side .main { margin-left: var(--side); }
  .app.side .pad { max-width: calc(1040px + 32px); }
  .app.side .topbar { max-width: calc(1040px + 32px); }
  .sidenav { position: fixed; top: 0; left: 0; bottom: 0; z-index: 50; width: var(--side); display: flex; flex-direction: column; gap: 4px;
    padding: 18px 14px; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
  .sidenav .logo { padding: 4px 8px 18px; }
  .side-link { position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 14px; color: var(--ink-2);
    font-weight: 500; font-size: 15px; text-decoration: none !important; transition: background var(--t) var(--ease); }
  .side-link:hover { background: var(--surface-2); }
  .side-link.on { background: var(--primary-soft); color: var(--primary-soft-ink); }
  .side-link .badge.in { margin: 0 0 0 auto; }
  .side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding-top: 14px; border-top: 1px solid var(--line); }
  .side-me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 14px; color: var(--ink); text-decoration: none !important; min-width: 0; }
  .side-me:hover { background: var(--surface-2); }
}

/* ───────── разделы, карточки, меню ───────── */
.sec { margin-top: 28px; }
.sec-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sec-h h2 { font-size: 20px; font-weight: 500; }
.sec-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.sec-more { display: inline-flex; align-items: center; gap: 2px; min-height: 40px; font-weight: 500; font-size: 14px; white-space: nowrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 16px; margin: 12px 0; display: flex; flex-direction: column; gap: 12px; }
.menu { background: var(--surface); border-radius: 24px; border: 1px solid var(--line); overflow: hidden; margin-top: 12px; }
.menu-i { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 16px; border: 0; border-bottom: 1px solid var(--line); background: transparent; width: 100%; text-align: left;
  color: var(--ink); text-decoration: none !important; font-size: 15.5px; cursor: pointer; }
.menu-i:last-child { border-bottom: 0; }
button.menu-i:hover, a.menu-i:hover { background: color-mix(in oklab, var(--surface-2) 60%, transparent); }
.menu-i.static { cursor: default; }
.menu-i > .ic:last-child { color: var(--faint); }
.menu-i.danger { color: var(--danger); }
.menu-ic { width: 36px; height: 36px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-2); flex: none; }
.menu-ic.brand { background: var(--primary-soft); color: var(--primary-ink); }
.menu-ic.violet { background: var(--accent-soft); color: var(--accent-ink); }
.menu-ic.danger { background: var(--danger-soft); color: var(--danger); }
.menu-i .grow { min-width: 0; flex: 1 1 0; }
.menu-h { font-size: 13px; color: var(--muted); margin: 24px 6px 8px; font-weight: 500; }

/* ───────── нет доступа ───────── */
.gate { min-height: 70dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; padding: 40px 20px; }
.gate h1 { font-family: var(--font-display); font-style: italic; font-weight: 700; font-size: 30px; }
.gate p { max-width: 420px; }
.gate-act { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }

/* ───────── пусто, ошибки, заглушки ───────── */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 44px 16px; }
.empty-ic { width: 80px; height: 80px; border-radius: 28px; background: var(--primary-soft); color: var(--primary-ink); display: grid; place-items: center; margin-bottom: 8px; }
.empty h3 { font-family: var(--font-display); font-style: italic; font-weight: 700; font-size: 25px; }
.empty p { color: var(--muted); max-width: 340px; }
.empty-act { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.stub { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 36px 16px; margin: 16px 0; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: 24px; }
.stub p { max-width: 460px; }
.stub code { font-size: 12.5px; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }

/* ───────── тосты Brain Motion — в стиле Взаимно ───────── */
.bm-toasts { bottom: calc(var(--tabbar) + 24px); width: max-content; max-width: calc(100vw - 32px); }
.bm-toast { font: 500 14.5px/1.35 var(--font); background: var(--ink); color: var(--bg); border-radius: 18px; text-align: center; padding: 12px 18px; box-shadow: var(--sh-3); }
@media (min-width: 900px) { .bm-toasts { bottom: 28px; } }
