/* ============================================================
   AI Asist — V2 (редизайн 1c). Верхний тулбар, две темы.
   Токены и разметка портированы из дизайн-бандла Claude Design.
   Тема: data-theme="light" | "dark" на <html>.
   ============================================================ */

:root, [data-theme="light"] {
    --accent: #5A4BF2;
    --accent-hover: #4A3CE0;
    --accent-soft: #EEEDFD;
    --accent-on-soft: #4A3CE0;
    --pos: #0E9F6E;
    --pos-bg: #E6F6EF;
    --neg: #E5484D;
    --neg-bg: #FCEDED;
    --wb: #8B3FD6;
    --ozon: #1F6BFF;

    --bg: #F6F7F9;
    --topbar: #FFFFFF;
    --surface: #FFFFFF;
    --border: #ECEEF1;
    --border-strong: #E2E5EA;
    --row-sep: #F1F2F5;
    --text: #16181D;
    --text-2: #5A6072;
    --muted: #8B92A1;
    --col-head: #9AA0AB;
    --track: #EFF0F3;
    --seg-active-bg: #FFFFFF;
    --seg-active-text: #4A3CE0;
    --menu-hover: #F5F6F8;

    --shadow-card: 0 1px 2px rgba(16,24,40,.04), 0 18px 44px -20px rgba(16,24,40,.16);
    --shadow-menu: 0 14px 36px -10px rgba(16,24,40,.28);
    --shadow-accent: 0 4px 14px -4px rgba(90,75,242,.6);

    --hero-bg: #F4F3FE;
    --hero-border: #E7E4FB;
    --hero-text: #2C2856;
    --hero-sub: #6B6694;
    --trend-line: #5A4BF2;
    --trend-grid: #F0F1F4;
    --trend-dot: #ffffff;
    --donut-track: #F0F1F4;
    --wb-dot: #8B3FD6;
}

[data-theme="dark"] {
    --accent: #7E72FF;
    --accent-hover: #6E63FF;
    --accent-soft: #221E48;
    --accent-on-soft: #C9C3FF;
    --pos: #2BD68A;
    --pos-bg: #0F2A1E;
    --neg: #FF5A5F;
    --neg-bg: #2A1518;
    --wb: #A95BE8;
    --ozon: #1F6BFF;

    --bg: #0C0D11;
    --topbar: #101116;
    --surface: #15161D;
    --border: #23252F;
    --border-strong: #2A2D38;
    --row-sep: #20222B;
    --text: #F4F4F8;
    --text-2: #9A9DAC;
    --muted: #7A7E8C;
    --col-head: #6B6E7D;
    --track: #15161D;
    --seg-active-bg: #2E3150;
    --seg-active-text: #C9C3FF;
    --menu-hover: #23252F;

    --shadow-card: 0 1px 2px rgba(0,0,0,.2), 0 18px 50px -20px rgba(0,0,0,.5);
    --shadow-menu: 0 14px 36px -10px rgba(0,0,0,.5);
    --shadow-accent: 0 4px 14px -4px rgba(90,75,242,.6);

    --hero-text: #F4F4F8;
    --hero-sub: #9A9DAC;
    --trend-line: #8E84FF;
    --trend-grid: #23252F;
    --trend-dot: #16171E;
    --donut-track: #23252F;
    --wb-dot: #A95BE8;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.v2 {
    font-family: 'Golos Text', -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
body.v2 { font-variant-numeric: tabular-nums; }
@keyframes v2fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------- Топ-бар ---------------- */
.v2-topbar {
    display: flex; align-items: center; gap: 14px;
    padding: 11px 16px;
    background: var(--topbar);
    border-bottom: 1px solid var(--border);
    flex-wrap: nowrap;
    position: sticky; top: 0; z-index: 50;
}
.v2-brand { display: flex; align-items: center; gap: 9px; }
.v2-logo {
    width: 30px; height: 30px; border-radius: 9px;
    background: linear-gradient(135deg, #6E63FF, #5A4BF2);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 15px;
}
.v2-brand-name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; color: var(--text); }
.v2-brand-tag { font-size: 10px; font-weight: 700; color: var(--accent-on-soft); background: var(--accent-soft); border-radius: 6px; padding: 2px 6px; }

.v2-nav { display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; }
.v2-nav a {
    font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap;
    border-radius: 9px; padding: 6px 9px; cursor: pointer; text-decoration: none;
    transition: background .12s, color .12s;
}
.v2-nav a:hover { background: var(--menu-hover); color: var(--text); }
.v2-nav a.active { font-weight: 600; color: var(--accent-on-soft); background: var(--accent-soft); }

.v2-spacer { flex: 1; min-width: 8px; }

/* На широком экране — всё в одну строку (nowrap выше). На узком — разрешаем перенос. */
@media (max-width: 1280px) {
    .v2-topbar, .v2-nav, .v2-controls { flex-wrap: wrap; }
    .v2-spacer { flex-basis: 100%; height: 0; }
}

/* «Ещё» — триггер как пункт навигации */
.v2-morebtn {
    font-family: inherit; font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap;
    background: transparent; border: none; cursor: pointer;
    border-radius: 9px; padding: 6px 9px; display: flex; align-items: center; gap: 5px;
    transition: background .12s, color .12s;
}
.v2-morebtn:hover { background: var(--menu-hover); color: var(--text); }
.v2-morebtn.active { font-weight: 600; color: var(--accent-on-soft); background: var(--accent-soft); }
.v2-nav .v2-menu-wrap { position: relative; }
.v2-nav .v2-menu { min-width: 210px; }

/* «Войти» */
.v2-login {
    display: inline-flex; align-items: center; height: 34px; padding: 0 16px;
    border-radius: 10px; background: var(--accent); color: #fff;
    font-size: 13px; font-weight: 600; text-decoration: none; box-shadow: var(--shadow-accent);
}
.v2-login:hover { background: var(--accent-hover); }

/* Контролы тулбара */
.v2-controls { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.v2-seg { display: flex; background: var(--track); border-radius: 11px; padding: 3px; gap: 2px; flex-shrink: 0; }
.v2-seg a {
    border: none; cursor: pointer; font-size: 13px; font-weight: 500; white-space: nowrap;
    padding: 6px 11px; border-radius: 9px; text-decoration: none;
    color: var(--muted); background: transparent; transition: all .15s;
}
.v2-seg a.active { font-weight: 600; background: var(--seg-active-bg); color: var(--seg-active-text); box-shadow: 0 1px 2px rgba(16,24,40,.10); }
[data-theme="dark"] .v2-seg a.active { box-shadow: none; }

.v2-tbtn {
    display: flex; align-items: center; gap: 7px; white-space: nowrap; flex-shrink: 0;
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: 11px; padding: 7px 10px; cursor: pointer;
    font: inherit; font-size: 13px; font-weight: 600; color: var(--text);
    text-decoration: none;
}
.v2-tbtn:hover { border-color: var(--accent); }
.v2-tbtn .caret { color: var(--muted); font-size: 10px; }
.v2-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

.v2-cmp {
    display: flex; align-items: center; gap: 7px; white-space: nowrap; flex-shrink: 0;
    border: 1px solid var(--border-strong); background: var(--surface);
    color: var(--muted); border-radius: 11px; padding: 7px 10px;
    cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; text-decoration: none;
}
.v2-cmp.on { border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-soft); color: var(--accent-on-soft); }
.v2-switch { width: 30px; height: 17px; border-radius: 9px; background: #CFD3DB; position: relative; flex-shrink: 0; transition: background .15s; }
[data-theme="dark"] .v2-switch { background: #3A3D49; }
.v2-cmp.on .v2-switch { background: var(--accent); }
.v2-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .15s; }
.v2-cmp.on .v2-switch::after { left: 15px; }

.v2-theme-btn {
    width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
    border: 1px solid var(--border-strong); background: var(--surface);
    color: var(--text-2); cursor: pointer; font-size: 15px;
    display: flex; align-items: center; justify-content: center;
}
.v2-theme-btn:hover { border-color: var(--accent); color: var(--accent); }
.v2-avatar {
    width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
    background: var(--accent-soft); color: var(--accent-on-soft);
    display: flex; align-items: center; justify-content: center; font-weight: 700;
    text-decoration: none; font-size: 14px;
}

/* store dropdown */
.v2-menu-wrap { position: relative; }
.v2-menu {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
    min-width: 212px; background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: 12px; box-shadow: var(--shadow-menu); padding: 6px;
    display: none; animation: v2fade .14s ease both;
}
.v2-menu.right { left: auto; right: 0; min-width: 232px; }
.v2-menu-wrap.open .v2-menu { display: block; }
.v2-menu-group { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 9px 10px 4px; }
.v2-menu a {
    display: flex; align-items: center; gap: 9px; width: 100%;
    border-radius: 8px; padding: 8px 10px; text-decoration: none;
    font-size: 13px; font-weight: 500; color: var(--text);
}
.v2-menu a:hover, .v2-menu a.sel { background: var(--menu-hover); }
.v2-menu a .check { margin-left: auto; color: var(--accent); font-size: 12px; }

/* ---------------- Контент ---------------- */
.v2-main { padding: 22px 24px 40px; max-width: 1480px; width: 100%; margin: 0 auto; flex: 1; animation: v2fade .5s both; }
.v2-page-head { margin-bottom: 16px; }
.v2-page-head h1 { font-size: 23px; font-weight: 700; letter-spacing: -.02em; margin: 0; color: var(--text); }
.v2-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* AI-герой */
.v2-hero {
    position: relative; overflow: hidden;
    border: 1px solid var(--hero-border, var(--border));
    border-radius: 18px; padding: 22px 24px;
    background: var(--hero-bg, var(--surface));
    margin-bottom: 16px;
}
[data-theme="dark"] .v2-hero {
    border-color: #2A2740;
    background: radial-gradient(130% 170% at 0% 0%, #1C1830 0%, #15131E 40%, #111219 100%);
}
[data-theme="dark"] .v2-hero::before {
    content: ""; position: absolute; top: -50px; right: -30px; width: 220px; height: 220px;
    border-radius: 50%; background: radial-gradient(circle, rgba(126,114,255,.26), rgba(126,114,255,0) 70%);
    pointer-events: none;
}
.v2-hero > * { position: relative; }
.v2-hero-top { display: flex; align-items: center; gap: 12px; }
.v2-hero-badge {
    width: 38px; height: 38px; border-radius: 11px;
    background: linear-gradient(135deg, #6E63FF, #5A4BF2); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px;
    box-shadow: 0 6px 18px -4px rgba(110,99,255,.7);
}
.v2-hero-title { font-size: 16px; font-weight: 700; color: var(--hero-text); }
.v2-hero-meta { font-size: 12px; color: var(--hero-sub); margin-top: 1px; }
.v2-hero-live { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.v2-hero-live .v2-dot { background: #2BD68A; width: 6px; height: 6px; }
.v2-hero-summary { font-size: 15.5px; line-height: 1.6; color: var(--hero-text); margin-top: 15px; max-width: 860px; }
[data-theme="dark"] .v2-hero-summary { color: #D7D8E2; }
.v2-hero-alerts { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.v2-alert { display: flex; align-items: center; gap: 8px; border-radius: 10px; padding: 7px 12px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.v2-alert .v2-dot { width: 8px; height: 8px; }
.v2-alert.loss { color: var(--neg); } .v2-alert.loss .v2-dot { background: var(--neg); }
.v2-alert.drr  { color: #F0A23B; } .v2-alert.drr .v2-dot { background: #F0A23B; }
.v2-alert.lead { color: var(--pos); } .v2-alert.lead .v2-dot { background: var(--pos); }
[data-theme="dark"] .v2-alert.loss { background: #2A1518; border-color: #3A2024; color: #E6E7EE; }
[data-theme="dark"] .v2-alert.drr  { background: #2A2113; border-color: #3A2E18; color: #E6E7EE; }
[data-theme="dark"] .v2-alert.lead { background: #0F2A1E; border-color: #173A2A; color: #E6E7EE; }
.v2-ask {
    display: flex; align-items: center; gap: 10px; margin-top: 18px;
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: 13px; padding: 11px 13px;
}
[data-theme="dark"] .v2-ask { background: #0D0E15; border-color: #2A2C38; }
.v2-ask span.ph { flex: 1; font-size: 13.5px; color: var(--muted); }
.v2-ask .go { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.v2-soon { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--border-strong); border-radius: 6px; padding: 2px 6px; }

/* KPI-карточки */
.v2-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 14px; margin-bottom: 16px; }
.v2-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.v2-card-label { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--col-head); }
.v2-card-value { font-size: 27px; font-weight: 700; letter-spacing: -.02em; color: var(--text); line-height: 1; }
.v2-card-unit { font-size: 15px; font-weight: 600; color: var(--muted); }
.v2-delta { display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; min-height: 18px; }
.v2-delta.up, .v2-delta.good { color: var(--pos); }
.v2-delta.down, .v2-delta.bad { color: var(--neg); }
.v2-delta.flat { color: var(--muted); }
.v2-delta .arr { font-size: 8px; }
.v2-delta .to { color: var(--muted); font-weight: 500; }

/* Ряд «график + пончик» */
.v2-grid-2 { display: grid; grid-template-columns: 1.7fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 900px) { .v2-grid-2 { grid-template-columns: 1fr; } }

.v2-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 20px 22px; }
.v2-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.v2-panel-title { font-size: 14px; font-weight: 700; color: var(--text); }
.v2-panel-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.v2-legend { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); font-weight: 500; }
.v2-legend .sq { width: 9px; height: 9px; border-radius: 3px; background: var(--trend-line); }
.v2-empty { color: var(--muted); font-size: 13px; padding: 22px 4px; text-align: center; }

/* Пончик «Площадки» */
.v2-donut-row { display: flex; align-items: center; gap: 16px; margin-top: 6px; }
.v2-donut-legend { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.v2-donut-legend .lg-top { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--text); }
.v2-donut-legend .sq { width: 9px; height: 9px; border-radius: 3px; }
.v2-donut-legend .lg-sub { font-size: 12.5px; color: var(--muted); margin-left: 16px; }

/* Структура расходов */
.v2-stack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--track); gap: 2px; margin-top: 4px; }
.v2-stack > span { display: block; height: 100%; }
.v2-exp-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 18px; margin-top: 12px; }
.v2-exp-item { display: flex; align-items: center; gap: 9px; min-width: 0; }
.v2-exp-item .sq { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.v2-exp-item .lb { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.v2-exp-item .vl { font-size: 12.5px; font-weight: 600; color: var(--text); }
.v2-exp-item .pc { font-size: 11px; color: var(--muted); width: 36px; text-align: right; }

/* ---------------- Таблица «По магазинам» ---------------- */
.v2-table-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 20px 22px 10px; overflow: hidden; }
.v2-table-card > h2 { font-size: 15px; font-weight: 700; margin: 0 0 4px; padding: 0; color: var(--text); border: none; display: flex; justify-content: space-between; align-items: baseline; }
.v2-hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.v2-table-scroll { overflow-x: auto; }
table.v2-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 820px; }
table.v2-table th, table.v2-table td { padding: 12px 10px; text-align: right; white-space: nowrap; }
table.v2-table th:first-child, table.v2-table td:first-child { text-align: left; }
table.v2-table thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--col-head); font-weight: 600; }
table.v2-table thead th.sortable { cursor: pointer; }
table.v2-table thead th .sort-arrow { color: var(--accent); font-size: 9px; margin-left: 3px; }
table.v2-table tbody tr td { border-top: 1px solid var(--row-sep); }
table.v2-table tbody tr:hover td { background: var(--menu-hover); }
table.v2-table tr.v2-total td { font-weight: 700; border-top: 2px solid var(--border-strong); background: transparent; }
.v2-shop { font-weight: 600; color: var(--text); }
.v2-mp { font-size: 10px; font-weight: 600; letter-spacing: .04em; color: var(--muted); margin-left: 6px; }
.v2-name-cell { display: inline-flex; align-items: center; gap: 9px; }
td.pos, .pos { color: var(--pos); } td.neg, .neg { color: var(--neg); }
.v2-muted { color: var(--muted); }
.v2-roi-pill { display: inline-block; font-weight: 600; font-size: 12px; padding: 3px 8px; border-radius: 7px; color: var(--pos); background: var(--pos-bg); }
.v2-roi-pill.neg { color: var(--neg); background: var(--neg-bg); }

/* Разворот магазин → артикулы (Финансы/Заказы/Реклама) */
.hidden { display: none; }
tr.v2-shop-row.expandable, tr.v2-report tr.v2-shop-row.expandable { cursor: pointer; }
.v2-chevron, .v2-chevron-spacer { display: inline-block; width: 15px; color: var(--muted); }
.v2-chevron { transition: transform .12s; }
tr.v2-shop-row.expanded .v2-chevron { transform: rotate(90deg); }
tr.v2-sku-row td { font-size: 13px; }
.v2-sku-cell { color: var(--muted); padding-left: 30px !important; }

/* Футер */
.v2-footer { border-top: 1px solid var(--border); background: var(--topbar); }
.v2-footer-inner {
    max-width: 1480px; margin: 0 auto; padding: 14px 24px;
    display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.v2-footer-brand { font-size: 13px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 7px; }
.v2-footer-nav { display: flex; align-items: center; gap: 6px; }
.v2-footer-nav a { font-size: 12.5px; color: var(--text-2); text-decoration: none; border-radius: 8px; padding: 5px 10px; }
.v2-footer-nav a:hover { background: var(--menu-hover); color: var(--text); }
.v2-footer-nav a.active { color: var(--accent-on-soft); background: var(--accent-soft); font-weight: 600; }
.v2-footer-meta { margin-left: auto; font-size: 12px; color: var(--muted); }

/* Тост */
.v2-toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 240; background: #16181D; color: #fff; font-size: 13px; font-weight: 500; padding: 11px 18px; border-radius: 12px; box-shadow: 0 12px 30px -8px rgba(0,0,0,.45); display: none; align-items: center; gap: 10px; }
.v2-toast.show { display: flex; animation: v2fade .2s ease both; }
.v2-toast .v2-dot { background: #34D399; width: 8px; height: 8px; }

/* ============================================================
   МОБИЛЬНАЯ ВЕРСИЯ (≤640px). Полные таблицы (гориз. скролл),
   бургер+drawer, липкая строка периода, шторка «Фильтры».
   Десктоп не меняется — всё ниже скрыто по умолчанию.
   ============================================================ */
:root { --scrim: rgba(16,18,29,.4); }
[data-theme="dark"] { --scrim: rgba(6,7,10,.62); }

/* Новые элементы скрыты на десктопе */
.v2-burger, .v2-m-avatar, .v2-mobile-bar, .v2-drawer, .v2-sheet, .v2-scrim { display: none; }

/* Аккордеон «Структура расходов» — на десктопе всегда раскрыт, заголовок как обычный */
.v2-acc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; background: none; border: none; padding: 0; margin: 0; font: inherit; color: inherit; text-align: left; cursor: default; }
.v2-acc-caret { display: none; }

@media (max-width: 640px) {
    /* --- Каркас --- */
    .v2-main { padding: 16px 14px 34px; }
    body.v2-lock { overflow: hidden; }

    /* --- Шапка: бургер + лого + аватар --- */
    .v2-topbar { flex-wrap: nowrap; gap: 10px; padding: 9px 14px; }
    .v2-nav, .v2-controls { display: none; }
    .v2-spacer { flex: 1; flex-basis: auto; height: auto; min-width: 0; }
    .v2-brand-tag { display: inline; }
    .v2-burger {
        display: flex; flex-direction: column; justify-content: center; gap: 4px;
        width: 38px; height: 38px; flex-shrink: 0; padding: 0 9px;
        background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; cursor: pointer;
    }
    .v2-burger span { display: block; height: 2px; border-radius: 2px; background: var(--text); }
    .v2-m-avatar {
        display: flex; align-items: center; justify-content: center; flex-shrink: 0;
        width: 34px; height: 34px; border-radius: 10px; text-decoration: none; font-weight: 700; font-size: 14px;
        background: var(--accent-soft); color: var(--accent-on-soft);
    }
    .v2-m-avatar-login { background: var(--accent); color: #fff; }

    /* --- Липкая строка контролов под шапкой --- */
    .v2-mobile-bar {
        display: flex; align-items: center; gap: 10px;
        position: sticky; top: 48px; z-index: 40;
        padding: 9px 14px; background: var(--bg); border-bottom: 1px solid var(--border);
    }
    .v2-m-seg { flex: 1; }
    .v2-m-seg a { flex: 1; text-align: center; padding: 7px 6px; }
    .v2-m-seg-spacer { flex: 1; }
    .v2-m-filters {
        position: relative; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
        width: 40px; height: 40px; border-radius: 11px; cursor: pointer;
        background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-2);
    }
    .v2-m-filters.on { border-color: var(--accent); color: var(--accent); }
    .v2-m-filters-dot { display: none; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
    .v2-m-filters.on .v2-m-filters-dot { display: block; }

    /* --- Контент: компактнее --- */
    .v2-page-head h1 { font-size: 21px; }
    .v2-hero { padding: 18px 16px; border-radius: 16px; }
    .v2-hero-summary { font-size: 14.5px; margin-top: 12px; }
    .v2-hero-live { display: none; }
    .v2-ask { margin-top: 14px; }

    .v2-cards { grid-template-columns: 1fr 1fr; gap: 10px; }
    .v2-card { padding: 14px 15px; border-radius: 15px; gap: 6px; }
    .v2-card-value { font-size: 23px; }
    .v2-card-unit { font-size: 13px; }
    /* последняя одинокая карточка (нечётная по счёту) — во всю ширину */
    .v2-cards > .v2-card:last-child:nth-child(odd) { grid-column: 1 / -1; }

    .v2-panel { padding: 16px; border-radius: 16px; }
    .v2-grid-2 { gap: 12px; margin-bottom: 12px; }

    /* Аккордеон расходов — сворачиваем */
    .v2-acc-head { cursor: pointer; }
    .v2-acc-caret { display: inline-block; color: var(--muted); font-size: 12px; transition: transform .18s; }
    .v2-acc:not(.open) .v2-acc-body { display: none; }
    .v2-acc.open .v2-acc-caret { transform: rotate(180deg); }
    .v2-exp-legend { grid-template-columns: 1fr; gap: 8px; }

    /* --- Полные таблицы: гориз. скролл во всю ширину экрана --- */
    .v2-table-card { padding: 16px 14px 6px; border-radius: 16px; }
    .v2-table-card > h2 { flex-direction: column; align-items: flex-start; gap: 2px; }
    .v2-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 4px -14px 0; padding: 0 14px 4px; }
    table.v2-table { font-size: 13px; }
    table.v2-table th, table.v2-table td { padding: 10px 9px; }

    /* --- Футер компактный --- */
    .v2-footer-inner { flex-direction: column; gap: 8px; text-align: center; padding: 16px 14px; }
    .v2-footer-meta { margin-left: 0; }

    /* --- Затемнение --- */
    .v2-scrim {
        display: block; position: fixed; inset: 0; z-index: 90; background: var(--scrim);
        opacity: 0; visibility: hidden; transition: opacity .25s;
    }
    .v2-scrim.show { opacity: 1; visibility: visible; }

    /* --- Drawer навигации (слева) --- */
    .v2-drawer {
        display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0;
        width: 82%; max-width: 320px; z-index: 100; overflow-y: auto;
        background: var(--surface); border-right: 1px solid var(--border-strong);
        transform: translateX(-100%); transition: transform .28s cubic-bezier(.4,0,.2,1);
    }
    .v2-drawer.open { transform: none; }
    .v2-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
    .v2-x { background: none; border: none; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px; }
    .v2-drawer-nav { flex: 1; padding: 8px; overflow-y: auto; }
    .v2-drawer-nav a { display: block; padding: 11px 12px; border-radius: 10px; text-decoration: none; font-size: 14px; font-weight: 500; color: var(--text-2); }
    .v2-drawer-nav a:active { background: var(--menu-hover); }
    .v2-drawer-nav a.active { font-weight: 600; color: var(--accent-on-soft); background: var(--accent-soft); }
    .v2-drawer-group { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 14px 12px 5px; }
    .v2-drawer-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--border); }
    .v2-drawer-user { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .v2-drawer-logout { font-size: 13px; font-weight: 600; color: var(--neg); text-decoration: none; flex-shrink: 0; }

    /* --- Шторка «Фильтры» (снизу) --- */
    .v2-sheet {
        display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
        background: var(--surface); border-top: 1px solid var(--border-strong);
        border-radius: 22px 22px 0 0; box-shadow: var(--shadow-menu);
        padding: 8px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 84vh; overflow-y: auto;
        transform: translateY(100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
    }
    .v2-sheet.open { transform: none; }
    .v2-sheet-handle { width: 40px; height: 4px; border-radius: 3px; background: var(--border-strong); margin: 4px auto 10px; }
    .v2-sheet-head { display: flex; align-items: center; justify-content: space-between; font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
    .v2-sheet-block { padding: 12px 0; border-top: 1px solid var(--row-sep); }
    .v2-sheet-block:first-of-type { border-top: none; }
    .v2-sheet-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 9px; }
    .v2-sheet-stores { display: flex; flex-direction: column; gap: 2px; }
    .v2-sheet-store { display: flex; align-items: center; gap: 10px; padding: 11px 10px; border-radius: 10px; text-decoration: none; font-size: 14px; font-weight: 500; color: var(--text); }
    .v2-sheet-store.sel { background: var(--menu-hover); }
    .v2-sheet-store .check { margin-left: auto; color: var(--accent); }
    .v2-sheet-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 12px 10px; border-radius: 10px; background: none; border: none; font: inherit; font-size: 14px; font-weight: 500; color: var(--text); text-decoration: none; cursor: pointer; }
    .v2-sheet-row.on { color: var(--accent-on-soft); }
    .v2-sheet-row.on .v2-switch { background: var(--accent); }
    .v2-sheet-row.on .v2-switch::after { left: 15px; }
    .v2-sheet-exports { display: flex; gap: 8px; }
    .v2-sheet-exports button { flex: 1; padding: 11px 8px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border-strong); font: inherit; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; }
    .v2-sheet-exports button:active { border-color: var(--accent); }
}

/* Планшет: слегка ужимаем отступы, десктоп-раскладка сохраняется */
@media (min-width: 641px) and (max-width: 1024px) {
    .v2-main { padding: 20px 18px 36px; }
}
