/* Навигация ЛК (FR-850): D1 боковая панель · T3 док · M3 хаб · M1 таб-бар.
   Какой вид виден, решают брейкпоинты ниже:
     ≥1180px          — D1 панель;
     768–1179px       — T3 плавающий док + лист «Ещё»;
     <768px           — M3 кнопка меню в шапке → полноэкранный хаб;
     html.ax-app      — Android-оболочка 0.5+: M1 таб-бар + лист «Ещё» (<1180px).
   Цвета и шрифты — из tokens.css. */

:root { --nav-w: 272px; --nav-side-bg: #FBF8F3; --nav-dark: #241F19; --nav-dark-2: #332A22; --nav-gold: #D9A55E; }

/* ---------------------------------------------------------- общие элементы */
.ax-logo { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.ax-word { display: flex; align-items: baseline; font-family: var(--head); font-weight: 650; font-size: 22px; letter-spacing: -.015em; color: var(--ink); }
.ax-word .ax-plus { color: var(--accent); }
.ax-ic { display: inline-grid; place-items: center; flex: none; line-height: 0; }
.ax-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ax-av { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center;
         background: var(--accent-soft); color: var(--ink); font: 700 13px var(--head); border: 1px solid #ecdcc4; }
.neg { color: var(--neg); } .pos { color: var(--pos); }

/* счётчики: число в data-n, рисуется ::after (textContent ссылки — только подпись) */
.ax-cnt::after { content: attr(data-n); }
.ax-cnt.is-zero { display: none; }
.ax-cnt--pill { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; box-sizing: border-box;
                background: var(--accent); color: #fff; font: 600 11px/20px var(--mono); text-align: center; }
.ax-cnt--warm { background: var(--neg); }
.ax-cnt--dot { position: absolute; top: 2px; left: 50%; margin-left: 5px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px;
               background: var(--neg); color: #fff; font: 700 9.5px/16px var(--mono); text-align: center; border: 2px solid var(--surface); box-sizing: content-box; }
.ax-cnt--accent { background: var(--accent); }

/* ===================================================== D1 · боковая панель */
.ax-side {
  position: sticky; top: 0; height: 100vh; width: var(--nav-w); flex: none; z-index: 40;
  background: var(--nav-side-bg); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; font-family: var(--body);
}
.ax-side__logo { padding: 24px 22px 16px; flex: none; }
.ax-search {
  margin: 0 16px 12px; height: 38px; padding: 0 12px; border-radius: 11px; flex: none;
  display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line);
  color: var(--muted); font: 500 13.5px var(--body); cursor: pointer; text-align: left;
}
.ax-search:hover { border-color: #DCCDB8; color: var(--ink); }
.ax-search kbd { margin-left: auto; font: 500 11px var(--mono); padding: 2px 6px; border-radius: 6px; background: var(--bg); color: var(--muted); }

.ax-pf { margin: 0 16px 6px; padding: 13px 14px 8px; border-radius: 16px; flex: none; background: var(--surface); border: 1px solid var(--line);
         display: block; text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.ax-pf:hover { border-color: #DCCDB8; box-shadow: 0 8px 20px -14px rgba(60,40,15,.45); }
.ax-pf.is-empty { display: none; }
.ax-pf-l { display: block; font: 600 10.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ax-pf-row { display: flex; align-items: baseline; gap: 8px; margin: 5px 0 3px; flex-wrap: wrap; }
.ax-pf-v { font: 650 21px var(--head); letter-spacing: -.01em; }
.ax-pf-c { font: 600 11.5px var(--mono); color: var(--muted); }
.ax-pf-s:empty { display: none; }

.ax-side__scroll { flex: 1; min-height: 0; position: relative; }
.ax-nav { height: 100%; overflow-y: auto; padding: 2px 12px 10px; scrollbar-width: none; }
.ax-nav::-webkit-scrollbar { display: none; }
.ax-group { font: 600 10.5px var(--mono); letter-spacing: .09em; text-transform: uppercase; color: #A79C90; padding: 14px 12px 5px; }
.ax-nav > a {
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 11px;
  color: #5E554C; font-size: 14.5px; font-weight: 500; text-decoration: none; transition: background .15s, color .15s;
}
.ax-nav > a .ax-ic { color: #8E8378; }
.ax-nav > a:hover { background: #F3ECE1; color: var(--ink); }
.ax-nav > a.is-active { background: var(--surface); color: var(--ink); font-weight: 600;
                        box-shadow: 0 1px 0 var(--line), 0 6px 16px -10px rgba(60,40,15,.35); }
.ax-nav > a.is-active .ax-ic { color: var(--accent); }
.ax-nav-personal { display: flex; gap: 4px; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.ax-iconlink { flex: 1; height: 40px; border-radius: 11px; display: grid; place-items: center; position: relative; color: #7A7066; }
.ax-iconlink:hover { background: #F3ECE1; color: var(--ink); }
.ax-iconlink.is-active { background: var(--surface); color: var(--accent); box-shadow: 0 1px 0 var(--line); }
.ax-iconlink .ax-cnt--dot { border-color: var(--nav-side-bg); top: 3px; }

.ax-side__foot { padding: 10px 12px 14px; flex: none; }
.ax-me { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 8px; border-radius: 14px; text-decoration: none;
         background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.ax-me:hover { border-color: #DCCDB8; }
.ax-me-t { min-width: 0; flex: 1; }
.ax-me-t b { display: block; font: 600 13.5px var(--body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ax-me-t span { font-size: 12px; color: var(--muted); }
.ax-me > .ax-ic { color: var(--muted); }

/* поиск в шапке дублирует поиск панели — на десктопе его нет */
@media (min-width: 1180px) { .topbar .kbd { display: none; } }

/* ============================================ общий фон оверлеев и блокировка */
.ax-overlay { display: none; position: fixed; inset: 0; z-index: 80; background: rgba(28,20,12,.38); backdrop-filter: blur(2px); }
.ax-overlay.is-open { display: block; }
html.ax-lock, html.ax-lock body { overflow: hidden; }

/* логотип в шапке — когда боковой панели нет */
.top-logo { display: none; }

/* =========================================== T3 · док + M1 таб-бар + лист */
.ax-dock, .ax-tabs, .ax-burger, .ax-hub, .ax-sheet { display: none; }

.ax-dock {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 70; gap: 4px; padding: 8px;
  background: rgba(36,31,25,.95); backdrop-filter: blur(14px); border-radius: 26px; box-shadow: 0 24px 60px -18px rgba(30,20,10,.6);
  font-family: var(--body);
}
.ax-dock > a, .ax-dock .ax-more {
  width: 92px; height: 60px; border-radius: 19px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  color: #BFB3A6; font: 500 11.5px var(--body); text-decoration: none; position: relative; background: none; border: 0; cursor: pointer; padding: 0;
}
.ax-dock > a > span:not(.ax-ic):not(.ax-cnt), .ax-dock .ax-more > span:not(.ax-ic):not(.ax-cnt) { max-width: 88px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ax-dock > a:hover, .ax-dock .ax-more:hover { color: #F4EEE5; }
.ax-dock > a.is-active, .ax-dock .ax-more.is-active, .ax-dock .ax-more.is-open { background: #F4EEE5; color: var(--ink); font-weight: 650; }
.ax-dock > a.is-active .ax-ic, .ax-dock .ax-more.is-active .ax-ic { color: var(--accent); }
.ax-dock .ax-cnt--dot { border-color: #2a241e; }
.ax-dock-sep { width: 1px; background: #4A4037; margin: 10px 4px; }

.ax-tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; height: 66px; padding: 0 4px;
  background: rgba(255,255,255,.97); backdrop-filter: blur(12px); border-top: 1px solid var(--line); font-family: var(--body);
}
.ax-tabs > a, .ax-tabs .ax-more {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; position: relative;
  color: #8A7F74; font: 500 10.5px var(--body); letter-spacing: -.01em; text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer;
}
.ax-tabs > a > span:not(.ax-tab-pill):not(.ax-cnt), .ax-tabs .ax-more > span:not(.ax-ic):not(.ax-cnt) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 1px; }
.ax-tab-pill, .ax-tabs .ax-more .ax-ic { width: 54px; height: 30px; border-radius: 99px; display: grid; place-items: center; }
.ax-tabs > a.is-active, .ax-tabs .ax-more.is-active, .ax-tabs .ax-more.is-open { color: var(--ink); font-weight: 650; }
.ax-tabs > a.is-active .ax-tab-pill, .ax-tabs .ax-more.is-active .ax-ic, .ax-tabs .ax-more.is-open .ax-ic { background: var(--accent-soft); color: var(--accent); }
.ax-tabs .ax-cnt--dot { top: 3px; margin-left: 8px; }

/* лист «Ещё»: у планшета — карточка над доком, у Android — снизу во всю ширину */
.ax-sheet {
  position: fixed; z-index: 90; background: var(--surface); font-family: var(--body); flex-direction: column; gap: 12px;
  box-shadow: 0 30px 80px -24px rgba(30,20,10,.55);
}
.ax-sheet.is-open { display: flex; }
.ax-sheet-grab { display: none; width: 40px; height: 5px; border-radius: 9px; background: #DDD2C3; margin: 0 auto 2px; flex: none; }
.ax-sheet-me { display: flex; align-items: center; gap: 12px; }
.ax-sheet-me .ax-me { flex: 1; min-width: 0; background: var(--nav-side-bg); border-color: #F0E8DC; }
.ax-sheet-v { text-align: right; font: 650 18px var(--head); white-space: nowrap; }
.ax-sheet-v small { display: block; font: 600 11.5px var(--mono); }
.ax-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ax-tile { display: flex; flex-direction: column; gap: 9px; padding: 13px; border-radius: 16px; background: var(--nav-side-bg); border: 1px solid #F0E8DC;
           font-size: 14px; font-weight: 550; color: var(--ink); text-decoration: none; position: relative; }
.ax-tile .ax-ic { color: var(--accent); }
.ax-tile:hover { border-color: #DCCDB8; }
.ax-tile.is-active { border-color: var(--accent); box-shadow: var(--ring); }
.ax-tile .ax-cnt--dot { left: auto; right: 10px; top: 10px; margin: 0; border-color: var(--nav-side-bg); }
.ax-sheet-app { display: none; }
.ax-sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 2px; }
.ax-logout { display: flex; align-items: center; gap: 6px; background: none; border: 0; padding: 8px 4px; color: var(--neg); font: 500 14px var(--body); cursor: pointer; }

/* ============================================================= M3 · хаб */
.ax-burger {
  width: 40px; height: 40px; border-radius: 12px; flex: none; place-items: center; cursor: pointer;
  background: var(--nav-dark); color: #F4EEE5; border: 0; padding: 0;
}
.ax-hub {
  position: fixed; inset: 0; z-index: 95; overflow-y: auto; overscroll-behavior: contain;
  background: linear-gradient(180deg, #2A231C 0%, #1C1712 100%); color: #F4EEE5; font-family: var(--body);
  padding: 14px 16px calc(20px + env(safe-area-inset-bottom)); flex-direction: column;
}
.ax-hub.is-open { display: flex; }
.ax-hub-hd { display: flex; align-items: center; margin-bottom: 18px; }
.ax-hub-hd .ax-word { color: #F4EEE5; }
.ax-hub-x { margin-left: auto; width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: #F4EEE5; color: var(--ink); border: 0; cursor: pointer; }
.ax-hub-who { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; color: #F4EEE5; text-decoration: none; }
.ax-hub-who .ax-av { width: 44px; height: 44px; background: #3A3027; color: #F4EEE5; border-color: #4A3E33; }
.ax-hub-who b { display: block; font-size: 16px; font-weight: 600; }
.ax-hub-who-v { font: 500 13px var(--mono); color: var(--nav-gold); }
.ax-hub-who-v .neg { color: #E39A72; } .ax-hub-who-v .pos { color: #8FC7A3; }
.ax-hub-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.ax-hub-tile { padding: 14px; border-radius: 18px; background: var(--nav-dark-2); border: 1px solid #43382E; display: flex; flex-direction: column; gap: 4px;
               color: #F4EEE5; text-decoration: none; position: relative; min-height: 104px; }
.ax-hub-tile .ax-ic { color: var(--nav-gold); margin-bottom: 10px; }
.ax-hub-tile b { font-size: 15.5px; font-weight: 600; }
.ax-hub-tile small { font-size: 12px; color: #A99D90; }
.ax-hub-tile.is-active { background: #F4EEE5; color: var(--ink); border-color: #F4EEE5; }
.ax-hub-tile.is-active small { color: var(--muted); } .ax-hub-tile.is-active .ax-ic { color: var(--accent); }
.ax-hub-tile .ax-cnt--pill { position: absolute; top: 12px; right: 12px; background: var(--nav-gold); color: #211B15; }
.ax-hub-list a { display: flex; align-items: center; gap: 14px; min-height: 48px; padding: 0 4px; font-size: 15.5px; color: #E8DFD2;
                 border-bottom: 1px solid #3A3128; text-decoration: none; }
.ax-hub-list a .ax-ic { color: #A99D90; }
.ax-hub-list a i { margin-left: auto; color: #6E6358; display: grid; }
.ax-hub-list a.is-active { color: var(--nav-gold); } .ax-hub-list a.is-active .ax-ic { color: var(--nav-gold); }
.ax-hub .ax-sheet-foot { margin-top: auto; padding-top: 18px; }
.ax-hub .lang-switch { background: #332A22; border-color: #43382E; }
.ax-hub .lang-switch button { color: #A99D90; }
.ax-hub .lang-switch button.active { background: #F4EEE5; color: var(--ink); }
.ax-hub .ax-logout { color: #E39A72; }

/* ================================================================ брейкпоинты */
@media (max-width: 1179px) {
  .ax-side { display: none; }
  .top-logo { display: flex; margin-right: 6px; }
  .top-logo .ax-mark { display: none; }
  .top-logo .ax-word { font-size: 20px; }
}

/* T3 · планшет */
@media (min-width: 768px) and (max-width: 1179px) {
  html:not(.ax-app):not(.ax-shell) .ax-dock { display: flex; }
  html:not(.ax-app) .main { padding-bottom: 104px; }
  html:not(.ax-app) .ax-sheet { left: 50%; bottom: 102px; transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); border-radius: 26px; padding: 16px; }
}

/* M3 · телефон в браузере */
@media (max-width: 767px) {
  html:not(.ax-app) .ax-burger { display: grid; }
  .ax-sheet-me .ax-sheet-v { display: none; }
}

/* M1 · Android-приложение (оболочка 0.5+) */
@media (max-width: 1179px) {
  html.ax-app .ax-tabs { display: flex; }
  html.ax-app .main { padding-bottom: 76px; }
  html.ax-app .ax-sheet { left: 0; right: 0; bottom: 0; border-radius: 26px 26px 0 0; padding: 10px 16px 18px; }
  html.ax-app .ax-sheet-grab { display: block; }
  html.ax-app .ax-sheet-tablet { display: none; }
  html.ax-app .ax-sheet-app { display: block; }
  html.ax-app .ax-sheet .ax-tiles { grid-template-columns: repeat(4, 1fr); }
  html.ax-app .ax-sheet .ax-tile { align-items: center; text-align: center; padding: 12px 2px 10px; font-size: 11.5px; gap: 7px; line-height: 1.15; }
}

@media (prefers-reduced-motion: no-preference) {
  .ax-hub.is-open { animation: axfade .18s ease-out; }
  .ax-sheet.is-open { animation: axrise .2s ease-out; }
  html:not(.ax-app) .ax-sheet.is-open { animation: axrise-c .2s ease-out; }
}
@keyframes axfade { from { opacity: 0; } }
@keyframes axrise { from { transform: translateY(24px); opacity: 0; } }
@keyframes axrise-c { from { transform: translate(-50%, 16px); opacity: 0; } }

:focus-visible.ax-search, .ax-nav a:focus-visible, .ax-dock a:focus-visible, .ax-tabs a:focus-visible,
.ax-more:focus-visible, .ax-burger:focus-visible, .ax-hub a:focus-visible, .ax-tile:focus-visible, .ax-hub-x:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* старая Android-оболочка (без веб-навигации): меню ЛК в ней не рисуется,
   поэтому язык остаётся в шапке, как раньше */
html.ax-shell:not(.ax-app) .topbar .lang-switch { display: flex; }
