/**
 * sidebar.css — ліве CRM-меню (#sidebar) + create-document hover.
 * Підключення: base.html після tokens.css / app-shell.css.
 * Розмітка: templates/menu.html
 */

/* Только навигационные элементы для sidebar - НЕ основний контент */
.sidebar .sidebar-header,
.sidebar .sidebar-menu,
.sidebar .sidebar-link,
.sidebar .sidebar-brand {
    color: #ffffff !important;
}
/* === LIGHT CLEAN SIDEBAR === */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #2c3136 0%, #1a1d23 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* КРАСИВЫЙ СКРОЛЛБАР для sidebar */
.sidebar::-webkit-scrollbar {
    width: 8px;
    display: none; /* Прячем скролбар */
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    margin: 4px 0;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(var(--color-brand-rgb), 0.4);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: all 0.3s ease;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--color-brand-rgb), 0.7);
    border: 2px solid transparent;
    background-clip: padding-box;
}        .sidebar::-webkit-scrollbar-thumb:active {
    background: rgba(var(--color-brand-rgb), 0.9);
}        /* Sidebar завжди відкритий */
.sidebar.collapsed {
    width: var(--sidebar-width) !important;
    min-width: var(--sidebar-width) !important;
    max-width: var(--sidebar-width) !important;
}

/* COLLAPSED HEADER - ВИДИМІСТЬ КНОПКИ */
.collapsed .sidebar-header {
    padding: 12px 8px;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
}

.collapsed .sidebar-brand {
    display: none;
}

.collapsed .sidebar-toggle {
    margin: 0 auto;
    background: rgba(14, 165, 233, 0.25);
    border-color: rgba(14, 165, 233, 0.5);
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

.collapsed .sidebar-toggle:hover {
    background: rgba(14, 165, 233, 0.35);
    border-color: rgba(14, 165, 233, 0.7);
    box-shadow: 0 0 20px rgba(14, 165, 233, 0.6);
}        .sidebar-header {
    padding: 0 8px;
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--page-header-height, 50px);
    min-height: var(--page-header-height, 50px);
    max-height: var(--page-header-height, 50px);
    box-sizing: border-box;
    background: var(--sidebar-header-bg, var(--color-shell, #0f172a));
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.06);
    gap: 6px;
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-brand {
    color: #ffffff;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    flex: 0 1 auto;
    min-width: 0;
    text-align: center;
    width: 100%;
    max-width: 100%;
}

.sidebar-brand-img {
    display: block;
    height: 36px;
    width: auto;
    max-width: 176px;
    object-fit: contain;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.sidebar-brand-icon i {
    font-size: 16px;
    color: #fff;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    line-height: 1;
    min-width: 0;
    width: max-content;
    max-width: 100%;
    margin-inline: auto;
}

.sidebar-brand-name {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 1.38rem;
    font-weight: 400;
    color: #fff;
    letter-spacing: 0.055em;
    white-space: nowrap;
    line-height: 1;
    text-transform: uppercase;
    text-align: center;
    overflow: hidden;
}

.sidebar-brand-tagline {
    display: block;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.5rem;
    font-weight: 500;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-top: 3px;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
}        /* === SIDEBAR TOGGLE BUTTON === */
.sidebar-toggle {
    display: none !important; /* Прихована - sidebar завжди відкритий */
}

.sidebar-toggle:hover {
    background: rgba(14, 165, 233, 0.25);
    border-color: rgba(14, 165, 233, 0.5);
    transform: scale(1.08);
    box-shadow: 0 0 15px rgba(14, 165, 233, 0.4);
}

.sidebar-toggle:active {
    transform: scale(0.96);
}

.sidebar-toggle i {
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}        .collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

/* Tooltip для кнопки toggle - ВИМКНЕНО, використовуємо JavaScript */
/*
.sidebar-toggle::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 15px);
    top: 50%;
    transform: translateY(-50%);
    padding: 8px 14px;
    background: rgba(33, 37, 41, 0.96);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    pointer-events: none;
    z-index: 2000;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    letter-spacing: 0.3px;
}

.sidebar-toggle::before {
    content: '';
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 7px 7px 7px 0;
    border-color: transparent rgba(33, 37, 41, 0.96) transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    pointer-events: none;
    z-index: 2000;
}

.sidebar-toggle:hover::after,
.sidebar-toggle:hover::before {
    opacity: 1;
    visibility: visible;
}

.collapsed .sidebar-toggle::after {
    content: attr(data-tooltip-collapsed);
    position: fixed;
    left: calc(var(--sidebar-collapsed-width) + 20px);
    top: var(--toggle-tooltip-top, 28px);
    transform: translateY(-50%);
    padding: 8px 14px;
    background: rgba(33, 37, 41, 0.96);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    border-radius: 8px;
    z-index: 99999;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    letter-spacing: 0.3px;
}

.collapsed .sidebar-toggle::before {
    position: fixed;
    left: calc(var(--sidebar-collapsed-width) + 12px);
    top: var(--toggle-tooltip-top, 28px);
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 7px 7px 7px 0;
    border-color: transparent rgba(33, 37, 41, 0.96) transparent transparent;
    z-index: 99999;
}

.collapsed .sidebar-toggle:hover::after,
.collapsed .sidebar-toggle:hover::before {
    opacity: 1;
    visibility: visible;
}
*/
  .sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    min-height: 0;
}

.sidebar-menu::-webkit-scrollbar {
    width: 6px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.15);
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(var(--color-brand-rgb), 0.4);
    border-radius: 3px;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--color-brand-rgb), 0.7);
}
  /* В звичайному режимі — скрол по вертикалі */
.sidebar:not(.collapsed) .sidebar-menu {
    overflow-x: hidden;
    overflow-y: auto;
}

/* Clean scrollbar для sidebar-menu - НЕ ПОТРІБЕН, бо скрол на .sidebar */

/* === SIDEBAR MENU ITEMS === */
.sidebar-item {
    margin: 0;
    padding: 0 8px;
    overflow: visible;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* === USER INFO === */
.sidebar-user-info {
    margin-top: 8px;
    padding: 8px 8px 4px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info-content {
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 8px;
    padding: 8px 10px;
}

.user-avatar {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.user-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
}

/* Collapsed режим -ховаємо текст */
.collapsed .sidebar-user-info .user-details {
    display: none;
}

.collapsed .sidebar-user-info .user-avatar {
    margin: 0 auto;
    font-size: 1.5rem;
}

.collapsed .sidebar-user-info {
    padding: 10px 5px !important;
    display: flex;
    justify-content: center;
}

#sidebar.sidebar .sidebar-header {
    justify-content: center !important;
    gap: 6px;
}

#sidebar.sidebar .sidebar-brand {
    width: 100% !important;
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
}

#sidebar.sidebar .sidebar-brand-text {
    margin-inline: auto !important;
    align-items: center;
}

.sidebar-header-tools {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    margin-right: 0;
}

.sidebar-lang {
    flex: 0 0 auto;
    position: relative;
    display: flex;
    align-items: center;
}

.sidebar-bell {
    flex: 0 0 auto;
    position: relative;
    display: flex;
    align-items: center;
}

#sidebar.sidebar .sidebar-bell-btn {
    position: relative;
    width: 26px;
    height: 26px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 6px;
    background: var(--color-shell);
    color: var(--sidebar-text, #ffffff) !important;
    cursor: pointer;
}

#sidebar.sidebar .sidebar-bell-btn i {
    font-size: 0.85rem;
    line-height: 1;
    color: var(--sidebar-text, #ffffff) !important;
}

.sidebar-bell-count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--color-brand);
    color: var(--color-on-brand) !important;
    font-size: 0.58rem;
    font-weight: 700;
    line-height: 1;
}

.sidebar-bell-count[hidden] {
    display: none !important;
}

.sidebar-bell-menu {
    position: fixed;
    z-index: 1040;
    width: 400px;
    max-height: 420px;
    margin: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.sidebar-bell-menu[hidden] {
    display: none !important;
}

.sidebar-bell-head {
    padding: 10px 14px 8px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--text-primary);
}

.sidebar-bell-list {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 370px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-input) var(--bg-primary);
}

.sidebar-bell-list::-webkit-scrollbar {
    width: 8px;
}

.sidebar-bell-list::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.sidebar-bell-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-md);
}

.sidebar-bell-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.sidebar-bell-empty {
    padding: 14px 14px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
}

.sidebar-bell-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    text-decoration: none;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-bell-item:last-child {
    border-bottom: 0;
}

.sidebar-bell-item:hover {
    background: var(--bg-primary);
}

.sidebar-bell-item-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.sidebar-bell-item-title {
    flex: 1;
    min-width: 0;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
}

.sidebar-bell-item-at {
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    color: var(--text-muted);
}

.sidebar-bell-item-text {
    font-size: 0.74rem;
    font-weight: 500;
    line-height: 1.3;
    color: var(--text-muted);
}

.collapsed .sidebar-header-tools {
    display: none;
}

#sidebar.sidebar .sidebar-lang-btn {
    height: 26px;
    min-width: 2.6rem;
    padding: 0 6px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 6px;
    background: var(--color-shell);
    color: var(--sidebar-text, #ffffff) !important;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1;
    cursor: pointer;
}

.sidebar-lang-menu {
    position: fixed;
    z-index: 1040;
    min-width: 7.5rem;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: var(--color-shell);
    color: var(--color-on-brand, #ffffff) !important;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.sidebar-lang-menu[hidden] {
    display: none !important;
}

.sidebar-lang-menu li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--color-on-brand, #ffffff) !important;
    line-height: 1.2;
}

.sidebar-lang-menu li.is-on {
    background: var(--color-shell-mid);
    color: var(--color-on-brand, #ffffff) !important;
}

.sidebar-lang-menu li.is-off {
    opacity: 1;
    cursor: default;
    color: rgba(255, 255, 255, 0.78) !important;
}

.sidebar-lang-flag {
    flex: 0 0 auto;
    width: 18px;
    height: 12px;
    object-fit: cover;
    border-radius: 2px;
    display: block;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.collapsed .sidebar-lang {
    display: none;
}

/* === SIDEBAR LINKS === */
.sidebar-link {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
    position: relative;
    overflow: hidden;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 8px;
    margin: 2px 0;
    border: none;
    border-left: none;
    line-height: 1.2;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    background: transparent;
}

.sidebar-link::before {
    display: none;
}

.sidebar-link:hover {
    color: #ffffff;
    background: rgba(var(--color-brand-rgb), 0.22);
    text-decoration: none;
}

.sidebar-link.active {
    color: #ffffff;
    background: rgba(var(--color-brand-rgb), 0.32);
    font-weight: 600;
}

.sidebar-sep {
    list-style: none;
    height: 1px;
    margin: 10px 12px 8px;
    background: rgba(255, 255, 255, 0.14);
    flex-shrink: 0;
    padding: 0;
    pointer-events: none;
}

.sidebar-link.is-disabled,
span.sidebar-link.is-disabled {
    opacity: 0.42;
    cursor: default;
    pointer-events: none;
}

.sidebar-link.is-disabled:hover {
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
}

#sidebar.sidebar button.sidebar-link {
    cursor: pointer;
    font: inherit;
    text-align: left;
    appearance: none;
    -webkit-appearance: none;
}

/* === SIDEBAR ICONS === */
.sidebar-icon {
    font-size: 0.9rem;
    min-width: 16px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-right: 8px;
    color: rgba(255, 255, 255, 0.78);
    flex-shrink: 0;
    font-weight: 400;
    background: none;
    border-radius: 0;
    padding: 0;
    transform: none;
    transition: color 0.15s ease;
}

.sidebar-link:hover .sidebar-icon,
.sidebar-link.active .sidebar-icon {
    color: #ffffff;
    transform: none;
    font-weight: 400;
    background: none;
}

/* === SIDEBAR TEXT === */
.sidebar-text {
    font-weight: 500;
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.3s ease, width 0.3s ease;
    font-size: 0.8rem;
    flex: 1;
    line-height: 1.25;
    overflow: hidden; /* Ховаємо переповнення */
    text-overflow: ellipsis; /* Три крапки для довгих назв */
    max-width: 100%; /* Обмежуємо максимальну ширину */
}/* Collapsed state */
.collapsed .sidebar-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.collapsed .sidebar-brand .sidebar-text {
    display: none;
}

.collapsed .sidebar-icon {
    margin-right: 0;
}

.collapsed .sidebar-link {
    justify-content: center;
    padding: 14px 10px;
    margin: 2px 4px;
    border-radius: 8px;
    border-left: none;
}

.collapsed .sidebar-link:hover,
.collapsed .sidebar-link.active {
    background: rgba(var(--color-brand-rgb), 0.28);
}          /* ВАЖЛИВО: В collapsed стрілка dropdown НЕ повинна ховатися */
.collapsed .sidebar-dropdown-toggle {
    position: relative !important;
    justify-content: center !important;
    padding: 14px 10px !important;
    margin: 2px 4px !important;
    border-radius: 6px !important;
}

.collapsed .sidebar-dropdown-toggle::after {
    display: block !important;
    opacity: 1 !important;
    position: absolute !important;
    right: 4px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    font-size: 0.7rem !important;
    color: rgba(255, 255, 255, 0.8) !important;
    font-weight: 700 !important;
}

.collapsed .sidebar-item.open .sidebar-dropdown-toggle::after {
    transform: translateY(-50%) rotate(180deg) !important;
    color: var(--accent-primary) !important;
}

/* === SUBMENU (ПІДКАТЕГОРІЇ) — вкладені відносно батька === */
.sidebar-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    background: transparent;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

.sidebar-item.open .sidebar-submenu {
    max-height: 1000px;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-submenu li {
    margin: 0;
    padding: 0;
}

.sidebar-submenu .sidebar-link {
    padding: 6px 10px 6px 28px;
    font-size: 0.72rem;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    border-radius: 8px;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    color: rgba(255, 255, 255, 0.78) !important;
}

.sidebar-submenu .sidebar-text {
    color: rgba(255, 255, 255, 0.78) !important;
    font-size: 0.72rem;
    font-weight: 400;
}

.sidebar-submenu .sidebar-icon {
    font-size: 0.75rem;
    min-width: 14px;
    width: 14px;
    height: 14px;
    margin-right: 0;
    opacity: 0.8;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7) !important;
    background: none !important;
    border-radius: 0;
    padding: 0;
    transform: none;
}

.sidebar-submenu .sidebar-link:hover {
    background: rgba(var(--color-brand-rgb), 0.22) !important;
    color: #ffffff !important;
}

.sidebar-submenu .sidebar-link:hover .sidebar-icon {
    opacity: 1;
    color: #ffffff !important;
    transform: none;
    background: none !important;
}

.sidebar-submenu .sidebar-link:hover .sidebar-text {
    color: #ffffff !important;
}

.sidebar-submenu .sidebar-link.active {
    background: rgba(var(--color-brand-rgb), 0.32);
    font-weight: 600;
}

/* Стрілка dropdown */
.sidebar-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-dropdown-toggle::after {
    content: '\F285'; /* chevron-right */
    font-family: "bootstrap-icons";
    font-size: 0.7rem;
    opacity: 0.7;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    flex-shrink: 0;
    margin-left: auto;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.sidebar-item.open .sidebar-dropdown-toggle::after {
    transform: rotate(90deg);
    color: rgba(255, 255, 255, 0.9);
    opacity: 1;
}

.sidebar-dropdown-toggle:hover::after {
    color: rgba(255, 255, 255, 0.9);
    opacity: 1;
}

/* === COLLAPSED РЕЖИМ === */
/* В collapsed режимі підменю відкриваються ТІЛЬКИ ВНИЗ! */
.collapsed .sidebar-item {
    position: relative !important;
    overflow: visible !important; /* ЗМІНЕНО: visible для tooltip */
}

/* Підменю відкриваються ВНИЗ в collapsed режимі */
.collapsed .sidebar-submenu {
    position: static !important; /* Не absolute - тільки вниз! */
    display: none; /* Приховане за замовчуванням */
    left: 0 !important;
    top: auto !important;
    right: auto !important;
    min-width: 0 !important;
    width: 100% !important;
    background: rgba(0, 0, 0, 0.35) !important;
    border-left: none !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25) !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 4px 0 !important;
    transform: none !important;
}

/* Коли батьківський пункт відкритий - показуємо підменю */
.collapsed .sidebar-item.open .sidebar-submenu {
    display: block !important;
}

.collapsed .sidebar-submenu .sidebar-link {
    padding: 12px 0 !important;
    justify-content: center !important;
    text-align: center !important;
    border-left: none !important;
    border-radius: 4px !important;
    margin: 2px 4px !important;
}

.collapsed .sidebar-submenu .sidebar-text {
    display: none !important;
}

.collapsed .sidebar-submenu .sidebar-icon {
    margin-right: 0 !important;
    margin-left: 0 !important;
    font-size: 1.2rem !important;
    color: rgba(255, 255, 255, 0.95) !important;
    font-weight: 600 !important;
}

.collapsed .sidebar-submenu .sidebar-link:hover {
    background: rgba(var(--color-brand-rgb), 0.28) !important;
}

.collapsed .sidebar-submenu .sidebar-link:hover .sidebar-icon {
    color: #ffffff !important;
    transform: none !important;
}

/* === CLEAN CREATE DOCUMENT BUTTON === */
.create-document-item {
    position: relative !important;
    margin: 8px !important;
    padding: 0 !important;
    overflow: visible !important;
}

.create-document-btn {
    background: var(--color-brand) !important;
    color: var(--color-on-brand) !important;
    border: none !important;
    border-radius: 8px !important;
    margin: 0 !important;
    font-weight: 600 !important;
    box-shadow: none !important;
    transform: none !important;
    transition: background-color 0.15s ease !important;
}

.create-document-btn:hover {
    background: var(--color-brand-dark) !important;
    transform: none !important;
    box-shadow: none !important;
}

.create-document-btn::before {
    display: none;
}

.create-document-btn .sidebar-icon {
    color: var(--color-on-brand) !important;
    font-weight: 600;
}

/* Hover menu - clean style with proper positioning */
/* sidebar-menu overflow керується вище, не перевизначаємо тут */

.create-document-right-menu {
    position: absolute !important;
    left: calc(100% + 12px) !important;
    top: 0 !important;
    width: 280px !important;
    background: white !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateX(-10px) !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 1050 !important;
    pointer-events: none !important;
}

.create-document-item:hover .create-document-right-menu {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(0) !important;
    pointer-events: all !important;
}

.right-menu-list {
    list-style: none !important;
    padding: 8px 0 !important;
    margin: 0 !important;
}

.right-menu-list li {
    margin: 0 !important;
}

.right-menu-link {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 12px 16px !important;
    color: #212529 !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    border-radius: 0 !important;
}

.right-menu-link:hover {
    background: #f0f7ff !important;
    color: var(--accent-success) !important;
    text-decoration: none !important;
}

.right-menu-link i {
    font-size: 1.2rem !important;
    width: 24px !important;
    min-width: 24px !important;
    text-align: center !important;
    color: #6c757d !important;
    opacity: 1 !important;
}

.right-menu-link:hover i {
    color: var(--accent-success) !important;
}

/* Fix для collapsed sidebar */
.sidebar.collapsed .create-document-right-menu {
    left: calc(100% + 8px) !important;
}
/* === MAIN CONTENT - LIGHT CLEAN === */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 0;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    width: calc(100% - var(--sidebar-width));
    overflow-y: auto;
    overflow-x: hidden;
}

/* === FIX ДЛЯ WAREHOUSE И DASHBOARD СТРАНИЦ === */
/* Контейнери всередині main-content — без додаткового зсуву (sidebar вже на .main-content) */
.inventory-page,
.income-page,
.stock-income-page,
.writeoff-page,
.writeoff-container,
.return-wrapper,
.transfer-page,
.transfers-page,
.money-container,
.modern-dashboard {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

/* Оверлей тільки для мобільних */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
    display: none;
}

@media (max-width: 768px) {
    .sidebar-overlay.active {
        display: block;
        opacity: 1;
        visibility: visible;
    }
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* Анимации */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.sidebar-item {
    animation: slideIn 0.3s ease forwards;
}

/* Позиціонування для згорнутого sidebar */
.collapsed ~ .sidebar-hover-menu {
    left: 58px !important;
}        /* === TOOLTIP ДЛЯ COLLAPSED РЕЖИМУ === */
/* ВАЖЛИВО: Tooltip повинен бути ПОВЕРХ sidebar! */
.collapsed .sidebar-link {
    position: relative;
    z-index: 1;
    overflow: visible !important;
}
  .collapsed .sidebar-link::after {
    display: none !important; /* Прибираємо tooltip */
}

.collapsed .sidebar-link::before {
    display: none !important; /* Прибираємо стрілку */
}
  /* Не показувати tooltip для кнопки "Створити документ" */
.collapsed .create-document-btn::after,
.collapsed .create-document-btn::before,
.collapsed .delivery-menu-btn::after,
.collapsed .delivery-menu-btn::before {
    display: none !important;
}


/* === SIDEBAR HOVER MENUS (create document, delivery) === */
.sidebar-hover-menu {
    position: fixed;
    left: calc(var(--sidebar-width) + 8px);
    top: 150px;
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}
.sidebar-hover-menu.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}
.sidebar-hover-menu .cdm-inner { padding: 4px 0; }
.sidebar-hover-menu .cdm-title {
    padding: 8px 10px 6px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 0;
}
.sidebar-hover-menu .cdm-title h6 {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.35px;
    line-height: 1.2;
}
.sidebar-hover-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    min-height: 36px;
    color: #212529 !important;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.25;
    margin: 2px 8px;
    border-radius: 8px;
    box-sizing: border-box;
    width: calc(100% - 16px);
}
.sidebar-hover-menu a i {
    color: #6c757d;
    font-size: 0.9rem;
    width: 16px;
    flex-shrink: 0;
    text-align: center;
    background: none;
}
.sidebar-hover-menu a:hover {
    background: rgba(var(--color-brand-rgb), 0.12);
    border-radius: 8px;
    margin: 2px 8px;
}
.sidebar-hover-menu a:hover i {
    color: var(--color-brand);
}
.sidebar-hover-menu .cdm-cat {
    padding: 10px 10px 4px;
    margin: 4px 8px 2px;
    border-top: 1px solid #e5e7eb;
    font-size: 0.8rem;
    font-weight: 600;
    color: #6c757d;
    line-height: 1.2;
}

/* Меню CRM — білий текст (фінальний пріоритет після brutal CSS) */
#sidebar.sidebar,
#sidebar.sidebar a,
#sidebar.sidebar button,
#sidebar.sidebar span,
#sidebar.sidebar i,
#sidebar.sidebar .sidebar-text,
#sidebar.sidebar .sidebar-link,
#sidebar.sidebar .sidebar-icon,
#sidebar.sidebar .create-document-btn,
#sidebar.sidebar .create-document-btn *,
#sidebar.sidebar .chat-unread-badge,
#sidebar.sidebar .orders-unprocessed-badge {
    color: #ffffff !important;
}
#sidebar.sidebar .sidebar-submenu .sidebar-link,
#sidebar.sidebar .sidebar-submenu .sidebar-text,
#sidebar.sidebar .sidebar-submenu .sidebar-icon {
    color: rgba(255, 255, 255, 0.78) !important;
}
#sidebar.sidebar .sidebar-submenu .sidebar-link:hover,
#sidebar.sidebar .sidebar-submenu .sidebar-link:hover .sidebar-text,
#sidebar.sidebar .sidebar-submenu .sidebar-link:hover .sidebar-icon,
#sidebar.sidebar .sidebar-submenu .sidebar-link.active,
#sidebar.sidebar .sidebar-submenu .sidebar-link.active .sidebar-text,
#sidebar.sidebar .sidebar-submenu .sidebar-link.active .sidebar-icon {
    color: #ffffff !important;
}

#sidebar.sidebar form {
    margin: 0;
    width: 100%;
}

#sidebar.sidebar button.sidebar-link {
    width: 100%;
}

#sidebar.sidebar .sidebar-icon {
    background: none !important;
    box-shadow: none !important;
}

#sidebar.sidebar .sidebar-link:hover:not(.create-document-btn) {
    background: rgba(var(--color-brand-rgb), 0.22) !important;
}

#sidebar.sidebar .sidebar-link.active:not(.create-document-btn) {
    background: rgba(var(--color-brand-rgb), 0.32) !important;
}

#sidebar.sidebar .create-document-btn:hover {
    background: var(--color-brand-dark) !important;
}

#sidebar.sidebar .sidebar-bell-menu,
#sidebar.sidebar .sidebar-bell-menu a,
#sidebar.sidebar .sidebar-bell-menu span,
#sidebar.sidebar .sidebar-bell-head,
#sidebar.sidebar .sidebar-bell-empty,
#sidebar.sidebar .sidebar-bell-item,
#sidebar.sidebar .sidebar-bell-item-title {
    color: var(--text-primary) !important;
}
#sidebar.sidebar .sidebar-bell-empty,
#sidebar.sidebar .sidebar-bell-item-text,
#sidebar.sidebar .sidebar-bell-item-at {
    color: var(--text-muted) !important;
}
#sidebar.sidebar .sidebar-bell-item:hover {
    background: var(--bg-primary) !important;
}
