/* Бизнес-радар на телефоне — отдельная раскладка, как в мобильном банке, а не сжатая версия для компьютера.
   Подключается только на узком экране (media в index.html); разметку дополняет mobile.js. */

/* ---------- Шапка: кто я и о какой компании, поиск и уведомления ---------- */
body:not(.logged-out) .topbar { position: sticky; top: 0; z-index: 40; gap: 10px; padding: 10px 16px; flex-wrap: nowrap;
  background: color-mix(in srgb, var(--bg) 86%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-bottom: 0; }
body .topbar .brand, body .topbar .ctx-btn, body .topbar #themeBtn, body .topbar .tour-btn, body .topbar .install-btn, body .topbar .user-chip, body .topbar .cmd-kbd { display: none !important; }
body .top-actions { flex: none; margin-left: auto; gap: 4px; }
body .top-actions .icon-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); }
.m-id { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; border: 0; background: none; padding: 0; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.m-ava { width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font: 700 15px var(--display); letter-spacing: .02em; }
.m-who { display: grid; min-width: 0; line-height: 1.2; }
.m-who b { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-who small { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-who small::after { content: " ▾"; font-size: 10px; }

/* Компания и роль — лист снизу */
body .topbar.ctx-open .session { display: grid !important; position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; width: auto; margin: 0;
  grid-template-columns: 1fr; gap: 14px; padding: 12px 18px calc(22px + env(safe-area-inset-bottom)); border: 0;
  background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: 0 0 0 100vmax rgba(8, 8, 10, .45); animation: mSheet .25s var(--ease, ease-out); }
body .topbar.ctx-open .session::before { content: "Компания и роль"; font: 700 18px var(--display); padding-top: 18px;
  background: linear-gradient(var(--line), var(--line)) center 4px / 40px 4px no-repeat; }
body .topbar.ctx-open .session .sw select { width: 100%; max-width: none !important; padding: 14px 40px 14px 14px; font-size: 16px; border-radius: 14px; }
body .topbar.ctx-open .sess-user { justify-content: space-between; }
@keyframes mSheet { from { transform: translateY(100%); } to { transform: none; } }

/* ---------- Нижняя панель разделов: плавающая, с подсветкой активного ---------- */
body:not(.logged-out) { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
body .sidebar { left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); padding: 6px; border: 0; border-radius: 24px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  box-shadow: 0 10px 30px rgba(16, 18, 22, .16), 0 0 0 1px color-mix(in srgb, var(--line) 70%, transparent); }
body .sidebar .nav-item { padding: 8px 2px 6px; border-radius: 18px; font-size: 10.5px; color: var(--muted); }
body .sidebar .nav-item.active { color: var(--red-ink); background: color-mix(in srgb, var(--red) 10%, transparent); }
body .sidebar .nav-item svg { width: 23px; height: 23px; }
body.nav-open .sidebar { left: 0; right: 0; bottom: 0; border-radius: 24px 24px 0 0; padding: 12px 12px calc(14px + env(safe-area-inset-bottom));
  display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-content: start; }
body.nav-open .sidebar .nav-more { grid-column: 1 / -1; }
body.nav-open .sidebar .nav-item:not(.nav-more) { flex-direction: column !important; align-items: center; justify-content: center; text-align: center; gap: 8px !important;
  padding: 14px 6px !important; font-size: 12.5px !important; white-space: normal; background: var(--soft); border-radius: 18px; min-height: 86px; }
body.nav-open .sidebar .nav-item span:not(.badge) { white-space: normal; overflow: visible; line-height: 1.2; }
body.nav-open .sidebar .nav-item .badge { position: absolute !important; top: 8px; right: 10px; left: auto; }
body.nav-open .sidebar .nav-line { display: none; }
body.nav-open .sidebar .nav-team { display: contents; }
body.nav-open .sidebar .nav-sep { grid-column: 1 / -1; margin: 8px 4px 0; }
#toast { bottom: calc(104px + env(safe-area-inset-bottom)) !important; }

/* ---------- Главная: карта «деньги на кону», круглые быстрые действия, плитки дел ---------- */
main { padding: 4px 16px 16px; }
body .home-quick { display: flex !important; flex-wrap: nowrap; overflow-x: auto; gap: 4px; margin: 4px -16px 14px; padding: 0 12px; scrollbar-width: none; scroll-snap-type: x proximity; }
body .home-quick::-webkit-scrollbar { display: none; }
body .qa { flex: 0 0 76px; flex-direction: column; gap: 7px; padding: 4px 2px; background: none; box-shadow: none; border-radius: 0; font-size: 11.5px; font-weight: 600;
  text-align: center; line-height: 1.2; color: var(--ink2); scroll-snap-align: start; }
body .qa-i { width: 60px; height: 60px; border-radius: 50%; background: var(--surface); box-shadow: 0 4px 14px rgba(16, 18, 22, .08); }
body .qa-i img { width: 42px; height: 42px; }

body .hero { display: flex; flex-direction: column; height: auto; min-height: 0; padding: 20px 18px 0; border-radius: 26px; gap: 0; }
body .hero h1 { font-size: 24px; line-height: 1.15; margin: 0 0 12px; max-width: none; }
body .hero h1::after { display: none; }
body .hero-money { order: 0; }
body .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0 14px; max-width: none; }
body .hero-cta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
body .hero-cta .btn { width: 100%; justify-content: center; padding: 13px 10px; font-size: 14.5px; border-radius: 14px; }
body .hero-deals { display: grid !important; gap: 0; margin: 16px 0 4px; position: static; padding: 6px 12px; border-radius: 18px; }
body .hero-deals h3 { margin: 6px 0 4px; font-size: 13px; }
body .hero-deals .deal { padding: 11px 2px; font-size: 14px; border-radius: 0; }
body .hero-deals .deal + .deal { border-top: 1px solid rgba(255, 255, 255, .08); }
body .hero-deals .deal .hs-spark { display: none !important; }
body .hero-globe { position: relative !important; inset: auto !important; min-height: 280px; height: 280px; margin: 8px -18px 0; }
body .hero-globe canvas { top: 0 !important; height: 100% !important; }
body .hero-globe .globe-period { position: absolute; top: auto; bottom: 10px; left: 50%; right: auto; transform: translateX(-50%); flex-direction: row; }
body .globe-legend { display: none !important; }
body .ticker { margin: 0 -18px; }
body .home-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
body .home-tools { display: none; }

/* ---------- Лента: фильтры по кнопке, круглая кнопка «проверить новость» ---------- */
body .feed-head { align-items: center; margin-bottom: 8px; }
body .feed-head h2 { font-size: 24px; }
body #analyzeBtn { display: none; }
.m-fab { position: fixed; right: 18px; bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 36; width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: var(--red); color: #fff; font-size: 28px; line-height: 1; box-shadow: 0 10px 24px rgba(239, 49, 36, .4); cursor: pointer; display: none; }
body.m-on-radar:not(.m-detail):not(.nav-open) .m-fab { display: grid; place-items: center; }
body .feed-tools .seg { display: flex; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; margin: 0 -16px 10px; padding: 0 16px; background: none; gap: 6px; }
body .feed-tools .seg::-webkit-scrollbar { display: none; }
body .feed-tools .seg button { flex: none; border-radius: 999px; padding: 8px 14px; background: var(--surface); }
body .feed-tools .seg button.on { background: var(--ink); color: var(--on-ink); }
body .feed-tools .tool-row:not(.small) { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
body .feed-tools .tool-row:not(.small) > :not(#fText):not(.m-filt) { display: none; }
body.m-filters .feed-tools .tool-row:not(.small) > * { display: flex; }
body.m-filters .feed-tools .tool-row:not(.small) > select { grid-column: 1 / -1; width: 100%; }
body .feed-tools #fText { border-radius: 14px; padding: 12px 14px; }
.m-filt { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 14px; padding: 0 14px; background: var(--surface); color: var(--ink); font: 600 14px var(--font); cursor: pointer; }
.m-filt svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
body.m-filters .m-filt { background: var(--ink); color: var(--on-ink); }
body .feed-tools .qf-row { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 8px -16px 4px; padding: 0 16px; gap: 6px; }
body .feed-tools .qf-row::-webkit-scrollbar { display: none; }
body .feed-tools .qf { flex: none; }

body .feed-item { padding: 14px 14px 12px; border-radius: 20px; }
body .feed-item .title { font-size: 16.5px; line-height: 1.3; }
body .feed-item .meta { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px; }
body .feed-item .chips { display: none; }
body .feed-item .reasons { font-size: 13.5px; }

/* ---------- Разбор: отдельный экран с панелью «назад» сверху ---------- */
body.m-detail #insightPanel .crumbs { display: none; }
body.m-detail .m-back { position: sticky !important; top: 60px; left: auto; bottom: auto !important; z-index: 20; margin: -4px -16px 8px; padding: 6px 12px;
  background: color-mix(in srgb, var(--bg) 86%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
body.m-detail .m-back .btn { box-shadow: none; background: none; padding: 8px 4px; font-size: 15px; color: var(--ink); }
body .insight { padding: 16px; border-radius: 22px; }
body .insight > h2 { font-size: 21px; }
body .detail-cta { position: sticky; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 6; }
body .ins-bar { bottom: calc(86px + env(safe-area-inset-bottom)); overflow-x: auto; flex-wrap: nowrap; }
body .ins-bar .btn { flex: none; }
body #insightPanel .tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
body #insightPanel .tabs::-webkit-scrollbar { display: none; }
body #insightPanel .tab { flex: none; }
body .focus-art { width: 72px; height: 72px; }

/* ---------- Прочие разделы: заголовки и карточки под палец ---------- */
body .page-head h2 { font-size: 24px; }
body .card { border-radius: 20px; }
body .kanban { grid-template-columns: minmax(0, 1fr); gap: 10px; }
body .kb-col .kb-empty { padding: 8px 6px; }
body.m-detail #view-radar .insight-col { margin-top: 0 !important; padding-top: 0 !important; }
/* размытие фона шапки делает её «контейнером» для fixed-элементов — на время листа снизу его выключаем */
body .topbar.ctx-open { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--bg); }
body:has(.topbar.ctx-open) .m-fab { display: none !important; }
body .home-col { grid-template-columns: minmax(0, 1fr); }
