/* ==========================================================================
   CSS РџРђРќР•Р›Р РЈРџР РђР’Р›Р•РќРРЇ v3.0 (РџРћР›РќРђРЇ Р’Р•Р РЎРРЇ)
   ========================================================================== */

@import url("fonts.css");

:root {
    /* РћСЃРЅРѕРІРЅС‹Рµ С†РІРµС‚Р° */
    --primary: #ff6d00;
    --primary-hover: #e66200;
    --sidebar-bg: #f2f2f2;
    --border-color: #e0ddd7;
    --bg-checkbox: #b9b9b9;
    
    /* РўРµРєСЃС‚ */
    --text-main: #000000;
    --text-muted: #b9b9b9;
    --text-placeholder: #b9b9b9;
    
    /* Р Р°Р·РјРµСЂС‹ Рё СЂР°РґРёСѓСЃС‹ */
    --sidebar-width: 265px;
    --sidebar-collapsed-width: 105px;
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;
    
    /* Р”РµСЂРµРІРѕ Рё Р»РёРЅРёРё */
    --tree-line: #b9b9b9;
    --tree-stroke: 1.5px;
    
    /* РђРЅРёРјР°С†РёРё */
    --transition-speed: 0s;
    --transition-curve: cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- 1. РЎР‘Р РћРЎ Р Р‘РђР—РћР’Р«Р• РЎРўРР›Р --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #ffffff;
    color: var(--text-main);
    overflow-x: hidden;
}

/* --- 2. РљРћРќРўР•Р™РќР•Р  РЎРђР™Р”Р‘РђР Рђ --- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--sidebar-bg);
    padding: 80px 24px 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    border-right: none;
    transition:
        width var(--transition-speed) var(--transition-curve),
        padding var(--transition-speed) var(--transition-curve),
        transform var(--transition-speed) var(--transition-curve);
}

.sidebar.collapsed {
    transform: none;
    width: var(--sidebar-collapsed-width);
    padding: 80px 12px 20px;
}

.sidebar-scroll-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    margin-top: 15px;
    padding-right: 4px;
}

.sidebar-scroll-area::-webkit-scrollbar { width: 4px; }
.sidebar-scroll-area::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll-area::-webkit-scrollbar-thumb {
    background-color: #d1ccc2;
    border-radius: 10px;
}

.sidebar.collapsed .profile-section-new {
    justify-content: center;
    position: relative;
    padding-right: 0;
    gap: 0;
}

.sidebar.collapsed .username-group,
.sidebar.collapsed .nav-title-main,
.sidebar.collapsed .btn-tariffs-lava,
.sidebar.collapsed .tree-container,
.sidebar.collapsed .processing-content,
.sidebar.collapsed .nav-title-muted {
    display: none !important;
}

.sidebar.collapsed .btn-collapse-right {
    display: none !important;
}

.sidebar.collapsed .nav-section {
    margin-bottom: 10px;
}

.sidebar.collapsed .section-header {
    justify-content: center;
    padding: 10px 0;
}

.sidebar.collapsed .section-title-black {
    gap: 0;
    justify-content: center;
}

.sidebar.collapsed .section-title-black > span:not(.icon-shopper):not(.icon-processing-new) {
    display: none !important;
}

.sidebar.collapsed .section-header .arrow-collapse {
    display: none !important;
}

.sidebar.collapsed .section-bottom {
    margin-top: auto;
    margin-bottom: 0;
    padding-top: 12px;
    padding-bottom: 6px;
    position: sticky;
    bottom: 0;
    background: var(--sidebar-bg);
    z-index: 2;
}

.sidebar.collapsed .bottom-link {
    justify-content: center;
    padding: 10px 0;
}

.sidebar.collapsed .bottom-link span {
    display: none !important;
}

.sidebar.collapsed .bottom-link svg {
    margin-right: 0 !important;
}

.sidebar,
.sidebar *,
.settings-popover,
.settings-popover * {
    font-family: "Onest", "Segoe UI", sans-serif !important;
    font-size: 13px !important;
    font-weight: 500 !important;
}

/* --- 3. РџР РћР¤РР›Р¬ (Р‘Р•Р— Р¤РћРќРђ) Р РљРќРћРџРљРђ РЎР›Р•Р’Рђ --- */
.profile-section-new {
    display: flex;
    align-items: center;
    width: 100%; 
    gap: 12px;
    padding-top: 0;
    padding-bottom: 0;
    position: relative;
}

.username-group {
    flex: 1; 
    display: flex;
    flex-direction: column;
}

.btn-collapse-right {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    padding: 5px;
    margin-left: auto;
}

.user-avatar-mini {
    width: 42px;
    height: 42px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
    overflow: hidden;
    text-decoration: none;
}

.user-avatar-mini img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.username-group {
    display: flex;
    flex-direction: column;
}

.username {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-main);
}

.user-email {
    display: inline-block;
    color: #000000;
    margin-top: 4px;
    line-height: 1.2;
    word-break: break-word;
    font-size: 15px !important;
    font-weight: 500 !important;
}

.plan-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: #ff7300;
    color: #ffffff;
    border-radius: 999px;
    padding: 2px 16px;
    font-weight: 600;
    text-transform: none;
    line-height: 1.1;
    margin-top: 0;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.08);
}

/* --- 4. РќРђР’РР“РђР¦РРЇ Р Р—РђР“РћР›РћР’РљР --- */
.nav-title-main {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin: 20px 0 15px 4px;
    font-weight: 700;
}
/* ==========================================================================
   РљРќРћРџРљРђ РўРђР РР¤Р« (Р›РђР’РћР’РђРЇ)
   ========================================================================== */
.btn-tariffs-lava {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    width: 200px;
    margin: 15px auto 10px auto;
    padding: 0;
    height: 44px;
    border-radius: 14px;
    color: #fff !important;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    position: relative;
    border: 1px solid #f7f7f7;
    cursor: pointer;
    z-index: 1;
    overflow: hidden;
    background: transparent;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.75),
        0 0 0 1.5px rgba(220, 220, 220, 0.65),
        0 4px 10px rgba(255, 120, 30, 0.22);
    transition: transform 0.3s ease, box-shadow 0.3s ease, width 0.3s ease;
}

/* Р¤РѕРЅ Р»Р°РІС‹ (Р°РЅРёРјРёСЂРѕРІР°РЅРЅС‹Р№ СЃР»РѕР№) */
.btn-tariffs-lava::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    z-index: -1;
    overflow: hidden;
    background:
        linear-gradient(90deg, #ff2b22 0%, #ff3a1f 12%, #ff5a12 24%, #ff8a00 40%, #ffb000 54%, #ffd000 64%, #ffa23a 78%, #ffac55 90%, #ffb16a 100%);
    background-image: 
        radial-gradient(circle at 10% 35%, rgba(255, 43, 34, 0.95) 0%, rgba(255, 58, 31, 0.82) 28%, transparent 58%),
        radial-gradient(circle at 48% 62%, rgba(255, 208, 0, 0.92) 0%, rgba(255, 176, 0, 0.82) 34%, transparent 64%),
        radial-gradient(circle at 86% 42%, rgba(255, 172, 85, 0.9) 0%, rgba(255, 177, 106, 0.78) 38%, transparent 70%),
        linear-gradient(90deg, #ff2b22 0%, #ff3a1f 12%, #ff5a12 24%, #ff8a00 40%, #ffb000 54%, #ffd000 64%, #ffa23a 78%, #ffac55 90%, #ffb16a 100%);
    background-size: 200% 200%;
    animation: lavaFlow 8s ease-in-out infinite alternate;
}

/* РџСѓР·С‹СЂСЊРєРё Р»Р°РІС‹ */
.btn-tariffs-lava::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    z-index: -1;
    background-image: 
        radial-gradient(circle at 50% 92%, rgba(255, 255, 255, 0.18) 0%, rgba(255, 210, 180, 0.22) 36%, transparent 72%),
        radial-gradient(circle at 84% 88%, rgba(255, 255, 255, 0.14) 0%, transparent 55%);
    opacity: 0.72;
    filter: blur(4px);
    animation: lavaBubbles 5s linear infinite alternate;
}

.btn-tariffs-lava:hover {
    transform: translateY(-1px);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.75),
        0 0 0 1.5px rgba(220, 220, 220, 0.65),
        0 5px 12px rgba(255, 120, 30, 0.2);
    filter: saturate(1.03) brightness(1.01);
}

/* Р›РѕРіРёРєР° РґР»СЏ СЃРІРµСЂРЅСѓС‚РѕРіРѕ СЃР°Р№РґР±Р°СЂР° */
.sidebar.collapsed .btn-tariffs-lava,
body.sidebar-is-collapsed .btn-tariffs-lava {
    width: 44px;
    padding: 10px 0;
}
.sidebar.collapsed .btn-tariffs-lava span,
body.sidebar-is-collapsed .btn-tariffs-lava span {
    display: none;
}

/* ==========================================================================
   РљРќРћРџРљРђ РџР РРњР•РќРРўР¬ (Р“Р РђР”РР•РќРўРќРђРЇ)
   ========================================================================== */
.btn-tariffs-gradient {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: linear-gradient(135deg, #ff6d00 0%, #ff9e00 100%) !important;
    color: #ffffff !important;
    border: none;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255, 109, 0, 0.2);
    position: relative;
    z-index: 1;
}

/* Р’Р°Р¶РЅРѕ: РѕС‚РєР»СЋС‡Р°РµРј Р»Р°РІРѕРІС‹Рµ СЃР»РѕРё, РµСЃР»Рё РѕРЅРё РїСЂРёРјРµРЅРёР»РёСЃСЊ СЃР»СѓС‡Р°Р№РЅРѕ */
.btn-tariffs-gradient::before,
.btn-tariffs-gradient::after {
    display: none !important;
}

.btn-tariffs-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 109, 0, 0.4);
    filter: brightness(1.1);
}

.btn-tariffs-gradient:disabled {
    background: #cbd5e1 !important;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================================================
   РђРќРРњРђР¦РР Р РЈРўРР›РРўР«
   ========================================================================== */
@keyframes lavaFlow {
    0% { background-position: 0% 0%; }
    100% { background-position: 100% 100%; }
}

@keyframes lavaBubbles {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-2%, 2%) scale(1.1); }
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }


/* --- 5. Р”Р•Р Р•Р’Рћ РњРђР РљР•РўРџР›Р•Р™РЎРћР’ (РРЎРџР РђР’Р›Р•РќРќРћР•) --- */
.nav-section {
    margin-bottom: 4px;
}

.section-header {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.section-header:hover { background: rgba(0,0,0,0.03); }

.section-title-black {
    color: var(--text-main);
    font-weight: 700;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* РРєРѕРЅРєР° С€РѕРїРїРµСЂР° */
.icon-shopper {
    width: 20px;
    height: 20px;
    background-color: var(--text-main);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z'/%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M16 10a4 4 0 0 1-8 0'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z'/%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M16 10a4 4 0 0 1-8 0'/%3E%3C/svg%3E") no-repeat center;
}


.tree-container {
    margin-left: 20px; /* РЎРґРІРёРЅСѓР»Рё РЅР° 1px РІР»РµРІРѕ, РєР°Рє С‚С‹ РїСЂРѕСЃРёР» СЂР°РЅРµРµ */
    border-left: var(--tree-stroke) solid var(--tree-line);
    margin-top: -6px;
    margin-bottom: 4px;
}

.tree-branch {
    position: relative;
    padding-left: 21px;
    height: 38px;
    display: flex;
    align-items: center;
}

.tree-branch::before {
    content: "";
    position: absolute;
    /* РЎРґРІРёРіР°РµРј РІР»РµРІРѕ РЅР° С‚РѕР»С‰РёРЅСѓ Р»РёРЅРёРё, С‡С‚РѕР±С‹ РїРµСЂРµРєСЂС‹С‚СЊ РѕСЃРЅРѕРІРЅСѓСЋ РЅРёС‚СЊ */
    left: calc(var(--tree-stroke) * -1); 
    top: 0;
    width: 18px;
    height: 19px;
    
    /* РћСЃС‚Р°РІР»СЏРµРј С‚РІРѕРё РіСЂР°РЅРёС†С‹ */
    border-left: var(--tree-stroke) solid var(--tree-line);
    border-bottom: var(--tree-stroke) solid var(--tree-line);
    border-bottom-left-radius: 12px;
}

/* РўРІРѕСЏ Р»РѕРіРёРєР° СЃРєСЂС‹С‚РёСЏ С…РІРѕСЃС‚Р° Сѓ РїРѕСЃР»РµРґРЅРµРіРѕ СЌР»РµРјРµРЅС‚Р° */
.tree-branch:last-child {
    /* Р¦РІРµС‚ РґРѕР»Р¶РµРЅ Р±С‹С‚СЊ #fcfcfc РґР»СЏ Р±РµСЃС€РѕРІРЅРѕСЃС‚Рё */
    border-left: 2px solid #f2f2f2; 
    /* РџРѕРґРіРѕРЅСЏРµРј РїРѕРґ РЅР°С…Р»РµСЃС‚ */
    margin-left: calc(var(--tree-stroke) * -1); 
}

.branch-link {
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.2s;
}

.branch-link:hover { color: var(--text-main); }
.branch-link.active { color: var(--text-main); font-weight: 700; }

.sidebar-beta-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #d9480f;
    background: linear-gradient(135deg, #fff4eb 0%, #ffe8d7 100%);
    border: 1px solid #ff8833;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(255, 115, 0, 0.12);
    vertical-align: middle;
    transition: all 0.18s ease;
}

.branch-link:hover .sidebar-beta-pill,
.branch-link.active .sidebar-beta-pill {
    background: linear-gradient(135deg, #ff7300 0%, #ff8c00 100%);
    border-color: #ff7300;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(255, 115, 0, 0.25);
}

/* --- 6. РћР‘Р РђР‘РћРўРљРђ Р Р§Р•РљР‘РћРљРЎР« (РќРћР’РђРЇ РРљРћРќРљРђ) --- */
.icon-processing-new {
    width: 20px;
    height: 20px;
    background-color: var(--text-main);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-4l-3 9L9 3l-3 9H2'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-4l-3 9L9 3l-3 9H2'/%3E%3C/svg%3E") no-repeat center;
}

.processing-content {
    margin-left: 20px;
    border-left: var(--tree-stroke) solid var(--tree-line);
    margin-top: -6px;
    margin-bottom: 4px;
}

.processing-content > div {
    padding-top: 0 !important;
    gap: 0 !important;
}

.processing-item {
    display: flex;
    align-items: center;
    position: relative;
    height: 38px;
    padding: 0 12px 0 21px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.processing-item::before {
    content: "";
    position: absolute;
    left: calc(var(--tree-stroke) * -1);
    top: 0;
    width: 18px;
    height: 19px;
    border-left: var(--tree-stroke) solid var(--tree-line);
    border-bottom: var(--tree-stroke) solid var(--tree-line);
    border-bottom-left-radius: 12px;
}

.processing-item:last-child {
    border-left: 2px solid #f2f2f2;
    margin-left: calc(var(--tree-stroke) * -1);
}

.processing-item:hover { background: rgba(0,0,0,0.03); }

.processing-label-muted {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: 12px;
}

.checkbox-engine {
    position: relative;
    width: 16px;
    height: 16px;
    border: 1.5px solid #aaaaaa;
    border-radius: 5px;
    background-color: transparent;
    transition: all 0.1s ease;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    overflow: hidden;
}

.checkbox-engine::after {
    content: "";
    position: absolute;
    inset: 15%;
    background-color: #ff9500;
    border-radius: 30%;
    transform: scale(0);
    opacity: 0;
    transform-origin: center;
}

.processing-item input { display: none; }

/* РџСЂРё РЅР°РІРµРґРµРЅРёРё РјРѕР¶РЅРѕ С‡СѓС‚СЊ РїРѕРґСЃРІРµС‚РёС‚СЊ СЃРµСЂСѓСЋ СЂР°РјРєСѓ */
.processing-item:hover .checkbox-engine {
    border-color: #aaaaaa;
}

/* РљРѕРіРґР° С‡РµРєР±РѕРєСЃ Р°РєС‚РёРІРёСЂРѕРІР°РЅ */
.processing-item input:checked + .checkbox-engine::after {
    transform: scale(1);
    opacity: 1;
    clip-path: none;
    animation: checkbox-zoom 0.1s ease-out;
}

#analyzeToggleItem:not(.analyze-state-full):not(.analyze-state-partial) #analyzeCheckbox:checked + .checkbox-engine::after {
    transform: scale(0);
    opacity: 0;
    animation: none;
}

#analyzeToggleItem.analyze-state-full #analyzeCheckbox:checked + .checkbox-engine::after,
#analyzeToggleItem.analyze-state-full .checkbox-engine::after {
    transform: scale(1);
    opacity: 1;
    clip-path: none;
    border-radius: 30%;
    animation: checkbox-zoom 0.1s ease-out;
}

#analyzeToggleItem.analyze-state-partial #analyzeCheckbox:checked + .checkbox-engine::after,
#analyzeToggleItem.analyze-state-partial .checkbox-engine::after {
    transform: scale(1);
    opacity: 1;
    clip-path: polygon(0 100%, 100% 0, 100% 100%);
    border-radius: 30%;
    animation: checkbox-zoom 0.1s ease-out;
}

/* РќРµРѕР±СЏР·Р°С‚РµР»СЊРЅРѕ: Р»РµРіРєР°СЏ Р°РЅРёРјР°С†РёСЏ РґР»СЏ РїСЂРёСЏС‚РЅРѕРіРѕ РѕС‚РєР»РёРєР° */
@keyframes checkbox-zoom {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* --- 7. РќРђРЎРўР РћР™РљР РђРќРђР›РР—Рђ --- */
.settings-popover {
    position: fixed;
    top: 80px;
    left: calc(var(--sidebar-width) + 20px);
    width: 340px;
    
    /* РЈР±РёСЂР°РµРј С„РёРєСЃРёСЂРѕРІР°РЅРЅСѓСЋ РІС‹СЃРѕС‚Сѓ РґР»СЏ Р°РІС‚Рѕ-РїРѕРґСЃС‚СЂРѕР№РєРё */
    height: auto; 
    max-height: calc(100vh - 100px); /* Р§С‚РѕР±С‹ РЅРµ СѓС…РѕРґРёР»Рѕ Р·Р° РєСЂР°Р№ СЌРєСЂР°РЅР° */
    
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 15px 45px rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 2000;
    
    /* РџР»Р°РІРЅС‹Р№ РїРµСЂРµС…РѕРґ РїСЂРё РёР·РјРµРЅРµРЅРёРё РІС‹СЃРѕС‚С‹ РєРѕРЅС‚РµРЅС‚Р° */
    transition: opacity 0.3s var(--transition-curve), 
                transform 0.3s var(--transition-curve),
                height 0.3s ease; 
    overflow: hidden;
}

.settings-popover .analyze-form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.settings-popover.hidden {
    transform: scale(0.95) translateX(-20px);
    opacity: 0;
    pointer-events: none;
}

.popover-header-compact {
    padding: 18px 24px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* РЁР°РїРєР° РЅРµ СЃР¶РёРјР°РµС‚СЃСЏ */
}

.popover-title-new {
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -0.5px;
    color: var(--text-main);
}

.btn-close-popover {
    background: #f2f2f7;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-close-popover:hover {
    background: #e5e5ea;
}

.popover-body-compact {
    padding: 16px 24px;
    /* Р Р°Р·СЂРµС€Р°РµРј СЃРєСЂРѕР»Р» С‚РѕР»СЊРєРѕ РµСЃР»Рё РєРѕРЅС‚РµРЅС‚ СЂРµР°Р»СЊРЅРѕ РѕРіСЂРѕРјРЅС‹Р№ */
    overflow-y: auto; 
    flex: 1 1 auto;
    min-height: 0;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.settings-popover .analyze-form > div:last-child {
    flex: 0 0 auto;
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid #f0f0f0;
}

.analysis-setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px; /* Р§СѓС‚СЊ СѓРјРµРЅСЊС€РёР»Рё РѕС‚СЃС‚СѓРї */
    background: #f8f8f8;
    padding: 10px 14px;
    border-radius: 12px;
    transition: background 0.2s;
}

.analysis-setting-row:hover {
    background: #f2f2f2;
}

.analysis-setting-row span {
    font-weight: 600;
    font-size: 14px;
}

/* --- Р’Р›РћР–Р•РќРќР«Р• РћРџР¦РР (РђРќРћРњРђР›РР / SEO) --- */
.analyze-cfg-sub {
    background: #ffffff;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    padding: 8px;
    margin-bottom: 12px;
    margin-top: -4px; /* Р§С‚РѕР±С‹ "РїСЂРёРєР»РµРёС‚СЊ" Рє РѕСЃРЅРѕРІРЅРѕРјСѓ СЂСЏРґСѓ */
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: fadeInSlide 0.3s ease; /* РџР»Р°РІРЅРѕРµ РїРѕСЏРІР»РµРЅРёРµ */
}

@keyframes fadeInSlide {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.analysis-setting-row-sub {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
}

.sub-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

/* KMeans feature checkboxes — same skin as WB products list price-edit-checkbox */
/* (also: limit-lock + submit tip for feature count) */
.settings-popover .analysis-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 12px !important;
    font-weight: 500 !important;
    color: #4b4b52;
}

.settings-popover .analysis-check .price-edit-checkbox {
    position: relative;
    flex: 0 0 auto;
    width: 13px;
    height: 13px;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid #999999;
    border-radius: 4px;
    background: #ffffff;
    cursor: pointer;
}

.settings-popover .analysis-check .price-edit-checkbox:checked::after {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: 3px;
    background: #ff931e;
}

.settings-popover .analysis-check span {
    font-size: 12px !important;
    font-weight: 500 !important;
    line-height: 1.25;
    color: #4b4b52;
}

.settings-popover .analysis-check.is-locked {
    opacity: 0.45;
    cursor: not-allowed;
}

.settings-popover .analysis-check.is-locked .price-edit-checkbox {
    cursor: not-allowed;
}

#kmeansFeaturesField {
    position: relative;
}

.kmeans-features-tip {
    position: absolute;
    left: 8px;
    top: calc(100% + 6px);
    z-index: 30;
    max-width: calc(100% - 16px);
    padding: 8px 10px;
    border-radius: 10px;
    background: #1f1f22;
    color: #ffffff;
    font-size: 12px !important;
    font-weight: 500 !important;
    line-height: 1.35;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    pointer-events: none;
}

.kmeans-features-tip::before {
    content: "";
    position: absolute;
    left: 16px;
    top: -5px;
    width: 10px;
    height: 10px;
    background: #1f1f22;
    transform: rotate(45deg);
}

.kmeans-features-tip.hidden {
    display: none;
}

.compact-input {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    outline: none;
    width: 65px;
    text-align: center;
    transition: border-color 0.2s;
}

.compact-input:focus {
    border-color: var(--primary);
}

/* Убираем стрелочки-спиннеры у числовых полей (значение меняется колесиком мыши) */
.compact-input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.compact-input[type="number"]::-webkit-outer-spin-button,
.compact-input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* --- Чипсы «Исключить слова» (SEO) --- */
.chips-field {
    margin-top: 8px;
}

.chips-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.chips-list:empty {
    margin-bottom: 0;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    padding: 3px 6px 3px 10px;
    background: #fff6ef;
    border: 1px solid #ffd9c2;
    color: #c2410c;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
}

.chip__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chip__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(194, 65, 12, 0.12);
    color: #c2410c;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.chip__remove:hover {
    background: var(--primary);
    color: #fff;
}

.chips-input-wrap {
    position: relative;
}

.chips-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 12px;
    outline: none;
    transition: border-color 0.2s;
}

.chips-input:focus {
    border-color: var(--primary);
}

.chips-suggest {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 20;
    max-height: 180px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    padding: 4px;
}

.chips-suggest__item {
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-main);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chips-suggest__item:hover,
.chips-suggest__item.is-active {
    background: #fff6ef;
    color: #c2410c;
}

.analysis-revenue-source {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 4px 8px 2px;
}

.analysis-revenue-source__option {
    position: relative;
    display: flex;
    min-width: 0;
    cursor: pointer;
    user-select: none;
}

.analysis-revenue-source__option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.analysis-revenue-source__option span {
    width: 100%;
    min-width: 0;
    padding: 7px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    color: #242428;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.analysis-revenue-source__option input:checked + span {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 6px 14px rgba(255, 109, 0, 0.22);
}

.analysis-revenue-source__option input:focus-visible + span {
    outline: 2px solid rgba(255, 109, 0, 0.35);
    outline-offset: 2px;
}

/* --- iOS-Style Switch (РћР РђРќР–Р•Р’Р«Р™) --- */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #e5e5ea;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px; width: 18px;
    left: 2px; bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Р¦РІРµС‚ РїСЂРё РІРєР»СЋС‡РµРЅРёРё - РћР РђРќР–Р•Р’Р«Р™ */
input:checked + .slider { 
    background-color: var(--primary) !important; 
}

input:checked + .slider:before { 
    transform: translateX(18px); 
}


body.popover-open {
    /* Прокрутку страницы НЕ блокируем: попап fixed и имеет свой скролл,
       поэтому при открытой вкладке «Отчеты и анализ» страница листается как обычно. */
    padding-right: 0px; /* Если появляется зазор, отрегулируй это значение */
}


/* --- 8. Р РђР—Р”Р•Р› "Р”Р РЈР“РћР•" (РќРР–РќРЇРЇ Р§РђРЎРўР¬) --- */

.nav-title-muted {
    font-size: 13px;
    text-transform: none;
    letter-spacing: 0.5px;
    color: var(--text-muted); 
    margin: 10px 0 10px 12px;
    font-weight: 700;
}

/* РљРѕРЅС‚РµР№РЅРµСЂ РґР»СЏ РїСЂРѕРєСЂСѓС‚РєРё */
.sidebar-scroll-area {
    display: flex;
    flex-direction: column;
    height: 100%; /* Р“Р°СЂР°РЅС‚РёСЂСѓРµРј, С‡С‚Рѕ flex-РєРѕРЅС‚РµР№РЅРµСЂ Р·Р°РЅРёРјР°РµС‚ РІСЃСЋ РІС‹СЃРѕС‚Сѓ */
}

.section-bottom {
    margin-top: auto; /* РўРѕР»РєР°РµС‚ Р±Р»РѕРє РІРЅРёР· */
    padding-top: 14px;
    margin-bottom: 0;
    padding-bottom: 8px;
    position: sticky;
    bottom: 0;
    background: var(--sidebar-bg);
    z-index: 2;
    border-top: 1px solid var(--border-color);
}

.bottom-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    font-size: 16px;
    border-radius: 10px;
    transition: 0.2s;
}

.bottom-link:hover { 
    background: rgba(0,0,0,0.04); 
}

.logout-link { 
    color: #ff4d4f !important; 
}





.sidebar-limits-trigger {
    cursor: pointer;
    font: inherit;
}

.sidebar-button.sidebar-limits-trigger {
    border: 0;
    background: transparent;
    color: #cccccc;
}

.sidebar-button.sidebar-limits-trigger:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.sidebar-limits-icon {
    display: inline-flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    width: 22px;
    height: 22px;
}

.sidebar-limits-icon > span {
    display: block;
    width: 4px;
    border-radius: 999px;
    background: currentColor;
}

.sidebar-limits-icon > span:nth-child(1) { height: 9px; }
.sidebar-limits-icon > span:nth-child(2) { height: 15px; }
.sidebar-limits-icon > span:nth-child(3) { height: 12px; }

.bottom-link--limits {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
}

.sidebar-calculator-trigger {
    cursor: pointer;
    font: inherit;
}

.sidebar-button.sidebar-calculator-trigger {
    border: 0;
    background: transparent;
    color: #cccccc;
}

.sidebar-button.sidebar-calculator-trigger:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.sidebar-calculator-trigger > svg {
    display: none;
}

.sidebar-calculator-trigger::before {
    content: "";
    display: block;
    width: 21px;
    height: 21px;
    flex: 0 0 21px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='1.8'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Crect%20x='5'%20y='2.5'%20width='14'%20height='19'%20rx='2.5'/%3E%3Crect%20x='8'%20y='5.5'%20width='8'%20height='4'%20rx='1'/%3E%3Cpath%20d='M8.5%2013.5h1M12%2013.5h1M15.5%2013.5h1M8.5%2017h1M12%2017h1M15.5%2017h1'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='1.8'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Crect%20x='5'%20y='2.5'%20width='14'%20height='19'%20rx='2.5'/%3E%3Crect%20x='8'%20y='5.5'%20width='8'%20height='4'%20rx='1'/%3E%3Cpath%20d='M8.5%2013.5h1M12%2013.5h1M15.5%2013.5h1M8.5%2017h1M12%2017h1M15.5%2017h1'/%3E%3C/svg%3E") center / contain no-repeat;
}

.bottom-link--calculator {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
}

.bottom-link--calculator::before {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
}

.sidebar-calculator-popover {
    overflow: hidden;
    padding: 10px;
}

.sidebar-calculator-popover__title {
    padding: 2px 4px 9px;
    color: #8a8a91;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.sidebar-calculator-popover__list {
    display: grid;
    gap: 6px;
}

.sidebar-calculator-popover__item {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: #242426;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.sidebar-calculator-popover__item:hover,
.sidebar-calculator-popover__item:focus-visible {
    border-color: #f0ded1;
    background: #fff7f1;
    outline: none;
    transform: translateX(2px);
}

.sidebar-calculator-popover__item.is-active {
    border-color: #ffd7ba;
    background: #fff4eb;
}

.sidebar-calculator-popover__brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    color: #fff;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: -.02em;
}

.sidebar-calculator-popover__brand--wb {
    background: linear-gradient(135deg, #8b32ff, #ef4aa8);
}

.sidebar-calculator-popover__brand--ozon {
    background: linear-gradient(135deg, #005bff, #32a7ff);
}

.sidebar-calculator-popover__item b,
.sidebar-calculator-popover__item small {
    display: block;
}

.sidebar-calculator-popover__item b {
    font-size: 13px;
    line-height: 1.2;
}

.sidebar-calculator-popover__item small {
    margin-top: 2px;
    color: #98989f;
    font-size: 11px;
    line-height: 1.2;
}

.sidebar-calculator-popover__arrow {
    color: #aaaab1;
    font-size: 22px;
    line-height: 1;
}

.sidebar-limits-popover {
    position: fixed;
    left: calc(var(--sidebar-width) + 12px);
    bottom: 24px;
    width: 246px;
    max-height: min(420px, calc(100vh - 48px));
    overflow: auto;
    padding: 12px;
    border: 1px solid #e4e4e7;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 46px rgba(15, 15, 18, 0.16), 0 2px 8px rgba(15, 15, 18, 0.08);
    z-index: 1200;
    transform-origin: left bottom;
}

body.sidebar-is-collapsed .sidebar-limits-popover {
    left: calc(var(--sidebar-collapsed-width) + 12px);
}

.sidebar-limits-popover--up {
    transform-origin: left bottom;
}

.sidebar-limits-popover__list {
    display: grid;
    gap: 10px;
}

.sidebar-limits-popover__row {
    display: grid;
    gap: 6px;
}

.sidebar-limits-popover__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sidebar-limits-popover__name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #232326;
    font-size: 12.5px;
    line-height: 1.2;
    font-weight: 600;
}

.sidebar-limits-popover__percent {
    color: #111111;
    font-size: 12.5px;
    line-height: 1.2;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.sidebar-limits-popover__track {
    display: block;
    height: 5px;
    border-radius: 999px;
    background: #e6e6e8;
    overflow: hidden;
}

.sidebar-limits-popover__track > span {
    display: block;
    height: 100%;
    min-width: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, #ff1d25 0%, #ff840b 100%);
}
/* --- 9. РЈРўРР›РРўР« Р РђР”РђРџРўРР’РќРћРЎРўР¬ --- */
.hidden { display: none !important; }

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        max-width: 100%;
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .settings-popover {
        left: 10px;
        right: 10px;
        width: auto;
        top: 20px;
    }
}

.settings-popover {
    /* Р”РѕР±Р°РІР»СЏРµРј Р±Р»СЋСЂ С„РѕРЅР° РєР°Рє РІ iOS (РїРѕ Р¶РµР»Р°РЅРёСЋ) */
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.btn-apply {
    /* Р•СЃР»Рё РёСЃРїРѕР»СЊР·СѓРµС‚Рµ СЌС‚РѕС‚ РєР»Р°СЃСЃ РґР»СЏ РєРЅРѕРїРєРё РІРЅРёР·Сѓ РїРѕРїРѕРІРµСЂР° */
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-apply:hover {
    opacity: 0.9;
}

/* РљРЅРѕРїРєР° СЂР°Р·РІРµСЂС‚С‹РІР°РЅРёСЏ (РїРѕРєР°Р·С‹РІР°РµС‚СЃСЏ РєРѕРіРґР° СЃР°Р№РґР±Р°СЂ СЃРєСЂС‹С‚) */
.btn-expand-sidebar {
    position: fixed;
    left: 20px;
    top: 20px;
    z-index: 999;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--primary);
    border: none;
    color: white;
    box-shadow: 0 4px 12px rgba(255,109,0,0.3);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}

.sidebar.collapsed + .btn-expand-sidebar {
    display: flex;
}

/* ==========================================================================
   Свернутый disabled sidebar: визуально повторяет ozonapi/sidebar_disabled
   ========================================================================== */
:root {
    --sidebar-padding-y: 24px;
    --sidebar-gap: 20px;
    --separator-width: 39px;
    --separator-height: 2px;
    --accent-left: #ff1d25;
    --accent-right: #ff840b;
    --accent-ring: #ff6600;
    --avatar-glow-start: #f75f03;
    --avatar-glow-end: #ff9966;
    --avatar-shell-size: 56px;
    --avatar-size: 44px;
    --avatar-inner-size: 36px;
}

.icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    pointer-events: none;
}

.sidebar-view {
    width: 100%;
    min-height: 0;
}

.sidebar:not(.collapsed) .sidebar-view--expanded {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

.sidebar:not(.collapsed) .sidebar-view--collapsed,
.sidebar.collapsed .sidebar-view--expanded {
    display: none !important;
}

.sidebar.collapsed {
    top: var(--header-height, 70px);
    width: var(--sidebar-collapsed-width);
    height: calc(100vh - var(--header-height, 70px));
    padding: 0;
    overflow: hidden;
    background: var(--sidebar-bg);
}

.sidebar.collapsed .sidebar-view--collapsed {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    height: 100%;
    padding-block: var(--sidebar-padding-y);
}

.sidebar-view--collapsed .sidebar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sidebar-gap);
}

.sidebar-view--collapsed .sidebar-group--bottom {
    margin-top: auto;
}

.sidebar-view--collapsed .sidebar-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sidebar-gap);
}

.sidebar-view--collapsed .sidebar-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    color: #cccccc;
    cursor: pointer;
    opacity: 0.92;
    text-decoration: none;
    transition: transform 0.18s ease, opacity 0.18s ease, filter 0.18s ease;
}

.sidebar-view--collapsed .sidebar-button:hover {
    opacity: 1;
    transform: translateY(-1px);
}

.sidebar-view--collapsed .sidebar-button.is-active {
    opacity: 1;
    filter: brightness(1.08);
}

.sidebar-view--collapsed .sidebar-button:focus-visible {
    outline: 2px solid var(--accent-ring);
    outline-offset: 4px;
}

.sidebar-view--collapsed .profile-avatar-shell {
    position: relative;
    width: var(--avatar-shell-size);
    height: var(--avatar-shell-size);
    min-width: var(--avatar-shell-size);
    min-height: var(--avatar-shell-size);
}

.sidebar-view--collapsed .profile-avatar-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--avatar-glow-start) 0%, var(--avatar-glow-end) 20%);
    filter: blur(6px);
    opacity: 0.3;
}

.sidebar-view--collapsed .profile-avatar {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--avatar-size);
    height: var(--avatar-size);
    min-width: var(--avatar-size);
    min-height: var(--avatar-size);
    border: 2px solid var(--accent-ring);
    border-radius: 999px;
    background: transparent;
    box-shadow: 0 0 2.5px rgba(255, 102, 0, 0.1);
}

.sidebar-view--collapsed .avatar-portrait {
    width: var(--avatar-inner-size);
    height: var(--avatar-inner-size);
    border-radius: 999px;
    overflow: hidden;
}

.sidebar-view--collapsed .dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 12px);
    gap: 3px;
    width: 27px;
    height: 27px;
}

.sidebar-view--collapsed .dashboard-cell {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    background-color: #cccccc;
}

.sidebar-view--collapsed .dashboard-cell.is-active {
    background-image: linear-gradient(90deg, var(--accent-left) 0%, var(--accent-right) 100%);
    background-repeat: no-repeat;
    background-size: 27px 27px;
}

.sidebar-view--collapsed .dashboard-cell--left.is-active {
    background-position: 0 0;
}

.sidebar-view--collapsed .dashboard-cell--right.is-active {
    background-position: -15px 0;
}

/* Переключатель площадок (ВБ / ОЗОН) в свёрнутом сайдбаре */
.sidebar-view--collapsed .sidebar-nav[data-nav-group="main"] {
    gap: 14px;
}

.sidebar-view--collapsed .sidebar-brand-text {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 27px;
    padding: 0 2px;
    font-size: 20px !important;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.2px;
    color: #cccccc;
    white-space: nowrap;
}

.sidebar-view--collapsed .sidebar-button.sidebar-brand.is-active .sidebar-brand-text {
    color: transparent;
    background-image: linear-gradient(90deg, var(--accent-left) 0%, var(--accent-right) 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

.sidebar-view--collapsed .sidebar-icon {
    color: #cccccc;
    display: block;
}

.sidebar-view--collapsed .sidebar-icon--table {
    width: 33px;
    height: 20px;
}

.sidebar-view--collapsed .sidebar-icon--money {
    width: 30px;
    height: 26px;
    fill: none;
    stroke: currentColor;
}

.sidebar-view--collapsed .sidebar-icon--paper {
    width: 32px;
    height: 28px;
    fill: currentColor !important;
    stroke: #f2f2f2 !important;
}

.sidebar-view--collapsed .sidebar-icon--profile {
    width: 23px;
    height: 23px;
}

.sidebar-view--collapsed .sidebar-icon--support {
    width: 23px;
    height: 23px;
}

.sidebar-view--collapsed .sidebar-icon--settings {
    width: 22px;
    height: 23px;
}

.sidebar-view--collapsed .sidebar-separator {
    width: var(--separator-width);
    height: var(--separator-height);
    border-radius: 999px;
    background: #cccccc;
}

.sidebar-view--collapsed .sidebar-button.is-active {
    fill: url(#gradientFill);
}

.sidebar-view--collapsed .sidebar-button:not(.is-active) {
    fill: currentColor;
}

.sidebar-view--collapsed .sidebar-button.is-active .sidebar-icon--money {
    stroke: url(#gradientFill);
    fill: none;
}

.sidebar-view--collapsed .sidebar-button.is-active .sidebar-icon--paper {
    fill: url(#gradientFill) !important;
    stroke: #f2f2f2 !important;
}

/* MacBook Air 13" and compact screens: golden middle spacing */
@media (max-width: 1366px), (max-height: 850px) {
    :root {
        --sidebar-padding-y: 20px;
        --sidebar-gap: 18px;
        --avatar-shell-size: 54px;
        --avatar-size: 42px;
        --avatar-inner-size: 34px;
        --separator-width: 36px;
    }

    .sidebar-view--collapsed .sidebar-group {
        gap: var(--sidebar-gap);
    }

    .sidebar-view--collapsed .sidebar-nav {
        gap: var(--sidebar-gap);
    }

    .sidebar-view--collapsed .sidebar-nav[data-nav-group="main"] {
        gap: 12px;
    }

    .sidebar-view--collapsed .sidebar-button {
        min-width: 42px;
        min-height: 42px;
    }
}

/* Стили для неавторизованных пользователей: квадратная иконка и замочки */
.sidebar-view--collapsed .profile-avatar.profile-avatar--square {
    border-radius: 10px !important;
    border: none !important;
}
.sidebar-view--collapsed .profile-avatar-shell:has(.profile-avatar--square)::before {
    border-radius: 12px !important;
}

.sidebar-button--locked {
    position: relative !important;
}
.sidebar-lock-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    background: #18181b;
    border: 1px solid rgba(255, 107, 0, 0.45);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}
.branch-lock-icon {
    display: inline-block;
    vertical-align: -1px;
    margin-left: 6px;
    flex-shrink: 0;
}

/* ==========================================================================
   Analysis date range calendar — 1:1 skin from WB campaigns calendar.
   Popover is portaled to document.body so it is not clipped by settings-popover.
   ========================================================================== */

.analysis-date-range-field {
    position: relative;
    width: 100%;
    min-width: 0;
    flex: 1 1 100%;
    box-sizing: border-box;
    padding: 2px 4px;
}

.settings-popover .analysis-date-range-field .date-range-trigger {
    width: 100%;
    min-height: 30px;
    border-radius: 10px;
    border: 1px solid var(--border-color, #e0ddd7);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 10px 0 11px;
    color: #8a8a8a;
    font-family: "Onest", system-ui, sans-serif !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    line-height: 1.15 !important;
    text-align: left;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
    cursor: pointer;
}

.settings-popover .analysis-date-range-field .date-range-trigger:hover,
.settings-popover .analysis-date-range-field.is-open .date-range-trigger {
    border-color: #c4c4c4;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transform: none;
}

.settings-popover .analysis-date-range-field .date-range-trigger-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
}

.settings-popover .analysis-date-range-field .date-range-trigger-icon {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    color: #5c5c5c;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.settings-popover .analysis-date-range-field .date-range-trigger-icon svg {
    width: 14px;
    height: 14px;
    display: block;
    fill: none;
}

/* Portaled calendar popover (lives on document.body, above settings-popover). */
.analysis-calendar-popover {
    position: fixed;
    z-index: 100050 !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
    overscroll-behavior: contain;
}

input[name="history_product_id"] {
    -moz-appearance: textfield;
}

input[name="history_product_id"]::-webkit-outer-spin-button,
input[name="history_product_id"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.analysis-calendar-popover.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.analysis-calendar-popover .actions-calendar-stage {
    --calendar-scale: 0.82;
    width: calc(410px * var(--calendar-scale));
    height: calc(410px * var(--calendar-scale));
}

.analysis-calendar-popover .actions-calendar-card {
    width: 410px;
    height: 410px;
    transform: scale(var(--calendar-scale));
    transform-origin: top left;
    display: grid;
    grid-template-rows: auto auto auto 1fr auto;
    row-gap: 6px;
    padding: 12px 14px 14px;
    border-radius: 30px;
    background: #ffffff;
    box-shadow: 0 3.5px 20px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    overflow: hidden;
    font-family: "Onest", system-ui, sans-serif;
    color: #000000;
}

.analysis-calendar-popover .actions-calendar-card .calendar-head,
.analysis-calendar-popover .actions-calendar-card .calendar-toolbar,
.analysis-calendar-popover .actions-calendar-card .calendar-title-wrap,
.analysis-calendar-popover .actions-calendar-card .calendar-footnote {
    display: flex;
    align-items: center;
}

.analysis-calendar-popover .actions-calendar-card .calendar-head {
    justify-content: space-between;
    gap: 12px;
}

.analysis-calendar-popover .actions-calendar-card .calendar-title-wrap {
    gap: 10px;
    min-width: 0;
}

.analysis-calendar-popover .actions-calendar-card .calendar-title-icon,
.analysis-calendar-popover .actions-calendar-card .calendar-footnote-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    color: #000000;
}

.analysis-calendar-popover .actions-calendar-card .calendar-title-icon svg,
.analysis-calendar-popover .actions-calendar-card .calendar-footnote-icon svg {
    width: 18px;
    height: 18px;
    display: block;
    fill: none;
}

.analysis-calendar-popover .actions-calendar-card .calendar-label,
.analysis-calendar-popover .actions-calendar-card .calendar-code {
    margin: 0;
    font-family: "Onest", system-ui, sans-serif;
    font-size: 18px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.03em;
    color: #000000;
}

.analysis-calendar-popover .actions-calendar-card .calendar-toolbar {
    display: grid;
    grid-template-columns: 16px 1fr;
    align-items: center;
    column-gap: 12px;
}

.analysis-calendar-popover .actions-calendar-card .month-switch {
    display: grid;
    gap: 2px;
}

.analysis-calendar-popover .actions-calendar-card .month-switch-button {
    display: grid;
    place-items: center;
    width: 16px;
    height: 14px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.analysis-calendar-popover .actions-calendar-card .month-arrow {
    position: relative;
    display: block;
    width: 14px;
    height: 10px;
    rotate: 180deg;
}

.analysis-calendar-popover .actions-calendar-card .month-arrow::before,
.analysis-calendar-popover .actions-calendar-card .month-arrow::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 9px;
    height: 2px;
    border-radius: 999px;
    background: #000000;
}

.analysis-calendar-popover .actions-calendar-card .month-arrow-up::before {
    left: 0;
    transform: translateY(-50%) rotate(-45deg);
}

.analysis-calendar-popover .actions-calendar-card .month-arrow-up::after {
    right: 0;
    transform: translateY(-50%) rotate(45deg);
}

.analysis-calendar-popover .actions-calendar-card .month-arrow-down::before {
    left: 0;
    transform: translateY(-50%) rotate(45deg);
}

.analysis-calendar-popover .actions-calendar-card .month-arrow-down::after {
    right: 0;
    transform: translateY(-50%) rotate(-45deg);
}

.analysis-calendar-popover .actions-calendar-card .calendar-month {
    margin: 0;
    font-family: "Onest", system-ui, sans-serif;
    font-size: 32px;
    font-weight: 500;
    line-height: 0.95;
    letter-spacing: -0.05em;
    color: #000000;
}

.analysis-calendar-popover .actions-calendar-card .calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    min-height: 40px;
    padding: 0 4px;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(90deg, #ff1d25 0%, #ff840b 100%);
}

.analysis-calendar-popover .actions-calendar-card .weekday {
    display: grid;
    place-items: center;
    font-family: "Onest", system-ui, sans-serif;
    font-size: 24px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.05em;
    color: #ffffff;
}

.analysis-calendar-popover .actions-calendar-card .calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: 39px;
    row-gap: 2px;
    align-content: start;
    user-select: none;
}

.analysis-calendar-popover .actions-calendar-card .calendar-day {
    position: relative;
}

.analysis-calendar-popover .actions-calendar-card .calendar-day::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0;
    background: rgba(255, 122, 10, 0.12);
}

.analysis-calendar-popover .actions-calendar-card .calendar-day.is-selected::before {
    opacity: 1;
}

.analysis-calendar-popover .actions-calendar-card .calendar-day.is-segment-start::before {
    border-radius: 16px 0 0 16px;
    margin-left: 10px;
}

.analysis-calendar-popover .actions-calendar-card .calendar-day.is-segment-end::before {
    border-radius: 0 16px 16px 0;
    margin-right: 10px;
}

.analysis-calendar-popover .actions-calendar-card .calendar-day.is-segment-start.is-segment-end::before {
    border-radius: 16px;
}

.analysis-calendar-popover .actions-calendar-card .day-button {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.analysis-calendar-popover .actions-calendar-card .day-number {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 39px;
    height: 39px;
    border-radius: 12px;
    font-family: "Onest", system-ui, sans-serif;
    font-size: 18px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.03em;
    color: inherit;
}

.analysis-calendar-popover .actions-calendar-card .calendar-day.is-boundary .day-number::before,
.analysis-calendar-popover .actions-calendar-card .calendar-day.is-boundary .day-number::after {
    content: "";
    position: absolute;
    border-radius: inherit;
}

.analysis-calendar-popover .actions-calendar-card .calendar-day.is-boundary .day-number::before {
    inset: 0;
    z-index: -2;
    background: linear-gradient(90deg, #ff1d25 0%, #ff840b 100%);
}

.analysis-calendar-popover .actions-calendar-card .calendar-day.is-boundary .day-number::after {
    inset: 2px;
    z-index: -1;
    background: #ffffff;
}

.analysis-calendar-popover .actions-calendar-card .calendar-day.is-disabled {
    color: #e6e6e6;
}

.analysis-calendar-popover .actions-calendar-card .calendar-day.is-disabled .day-button {
    cursor: default;
}

.analysis-calendar-popover .actions-calendar-card .calendar-day:not(.is-disabled):not(.is-boundary) .day-button:hover .day-number {
    background: rgba(255, 122, 10, 0.08);
}

.analysis-calendar-popover .actions-calendar-card .calendar-footnote {
    justify-content: center;
    gap: 10px;
    width: 100%;
    text-align: center;
}

.analysis-calendar-popover .actions-calendar-card .calendar-footnote-text {
    margin: 0;
    font-family: "Onest", system-ui, sans-serif;
    font-size: 22px;
    font-weight: 500;
    line-height: 1.05;
    letter-spacing: -0.04em;
    color: #000000;
}

@media (max-width: 640px) {
    .analysis-calendar-popover .actions-calendar-stage {
        --calendar-scale: 0.72;
    }
}

/* Mobile sidebar drawer shared by Ozon/WB parser pages. */
.sidebar-mobile-backdrop {
    display: none;
}

body.sidebar-mobile-open {
    overflow: hidden;
}

@media (max-width: 768px) {
    .sidebar {
        top: var(--header-height, 70px);
        width: min(320px, calc(100vw - 24px));
        max-width: none;
        height: calc(100dvh - var(--header-height, 70px));
        padding: 18px 16px max(18px, env(safe-area-inset-bottom));
        transform: translateX(0);
        box-shadow: 16px 0 42px rgba(22, 22, 25, 0.22);
        transition: transform 0.24s ease, box-shadow 0.24s ease;
        z-index: 14500;
    }

    .sidebar.collapsed {
        width: min(320px, calc(100vw - 24px));
        padding: 18px 16px max(18px, env(safe-area-inset-bottom));
        transform: translateX(-100%);
    }

    .sidebar-scroll-area {
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar .section-header,
    .sidebar .bottom-link,
    .sidebar .branch-link {
        min-height: 44px;
    }

    .sidebar-mobile-backdrop:not([hidden]) {
        position: fixed;
        inset: var(--header-height, 70px) 0 0;
        z-index: 14000;
        display: block;
        width: 100%;
        height: auto;
        padding: 0;
        border: 0;
        background: rgba(18, 18, 20, 0.46);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        cursor: pointer;
    }

    body.app-shell-page .btn-expand-sidebar {
        left: max(10px, env(safe-area-inset-left));
        top: calc(var(--header-height, 70px) + 8px);
        z-index: 15100;
        width: 52px;
        height: 52px;
        display: flex;
        border: 0;
        border-radius: 13px;
        background: #f7f4f2;
        color: #1f1f21;
        box-shadow: none;
    }

    body.app-shell-page .btn-expand-sidebar svg {
        display: block;
        width: 25px;
        height: 25px;
        transform: rotate(180deg);
    }

    body.app-shell-page .btn-expand-sidebar::before {
        content: none;
        display: none;
    }

    .sidebar .btn-collapse-right {
        display: flex !important;
        width: 44px;
        height: 44px;
        flex: 0 0 44px;
        border-radius: 12px;
        background: rgba(0, 0, 0, 0.055);
        color: #1f1f21;
    }

    .sidebar .btn-collapse-right svg {
        display: none;
    }

    .sidebar .btn-collapse-right::before {
        content: "\00d7";
        font-size: 32px;
        font-weight: 300;
        line-height: 1;
    }

    .sidebar-limits-popover {
        left: 12px !important;
        right: 12px !important;
        top: auto !important;
        bottom: max(12px, env(safe-area-inset-bottom)) !important;
        width: auto !important;
        max-height: min(60dvh, 420px) !important;
        z-index: 15200;
        pointer-events: auto;
    }

    /* The calendar is portaled to body. It must sit above the mobile drawer
       backdrop and the analysis settings panel, otherwise taps appear inert. */
    .analysis-calendar-popover {
        z-index: 15500;
    }
}

@media (max-width: 360px) {
    .analysis-calendar-popover .actions-calendar-stage {
        --calendar-scale: 0.64;
    }
}

@media (max-width: 320px) {
    .analysis-calendar-popover .actions-calendar-stage {
        --calendar-scale: 0.58;
    }
}

@media (max-width: 420px) {
    .sidebar,
    .sidebar.collapsed {
        width: calc(100vw - 12px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .sidebar-mobile-backdrop {
        transition: none !important;
    }
}

/* Убираем колбочку напротив ВБ и ОЗОН в свернутом и развернутом сайдбаре на всех страницах */
.sidebar-brand .demo-badge,
.sidebar-marketplace-switch .demo-badge,
.sidebar-marketplace-switch-btn .demo-badge,
[data-mp-switch] .demo-badge,
#nav-marketplaces .demo-badge,
.tree-branch:has(> a[href*="/wb/"]:only-child) .demo-badge,
.tree-branch:has(> a[href*="/ozon/"]:only-child) .demo-badge {
    display: none !important;
}

