/* VibeDesk shell: sidebar, topbar, main offset, footer. Load after palettes.
   Motion: --vd-shell-chrome-* / --vd-shell-inner-* / --vd-shell-inner-delay on :root in Views/Shared/_Layout.cshtml */

/* =====================================================
   VibeDesk chrome: vd-sidebar + vd-topbar + vd-main
   ===================================================== */
.vd-app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.vd-sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: var(--vd-z-sidebar, 1050);
    display: flex;
    flex-direction: column;
    background: var(--vd-chrome-bg);
    color: var(--vd-chrome-text);
    border-right: 1px solid var(--vd-chrome-border);
    transition: width var(--vd-shell-chrome-duration) var(--vd-shell-chrome-ease);
    overflow-x: hidden;
    overflow-y: visible;
}
body[data-color-palette="vibe"] .vd-sidebar {
    background: linear-gradient(165deg, rgba(30, 20, 50, 0.88) 0%, rgba(18, 12, 34, 0.92) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.vd-sidebar.collapsed,
.sidebar-is-collapsed .vd-sidebar {
    width: var(--sidebar-collapsed-width);
}

.vd-side-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Sidebar header: бургер + бренд (на десктопе дубликат в topbar скрыт) */
.vd-side-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.55rem;
    padding: 0.85rem 0.85rem 0.8rem;
    min-width: 0;
}
.vd-side-brand {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.12;
    min-width: 0;
    flex: 1;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    transition: opacity var(--vd-shell-inner-duration) var(--vd-shell-inner-ease),
        max-width var(--vd-shell-inner-duration) var(--vd-shell-inner-ease),
        margin var(--vd-shell-inner-duration) var(--vd-shell-inner-ease);
    transition-delay: var(--vd-shell-inner-delay);
    max-width: 220px;
    opacity: 1;
}
.vd-side-brand-title {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--vd-chrome-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.vd-side-brand-sub {
    font-size: 0.64rem;
    font-weight: 500;
    color: var(--vd-chrome-text-muted);
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.vd-sidebar.collapsed .vd-side-brand,
.sidebar-is-collapsed .vd-sidebar .vd-side-brand {
    max-width: 0;
    opacity: 0;
    margin: 0;
    pointer-events: none;
    transition-delay: var(--vd-shell-inner-delay-collapse);
}
.vd-side-hamburger {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 0.5rem;
    border: 1px solid var(--vd-chrome-border);
    background: rgba(255, 255, 255, 0.06);
    color: var(--vd-chrome-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.vd-side-hamburger:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--vd-accent-soft-2);
    color: #ffffff;
}
/* Бургер всегда слева в одном месте — без «прыжка» при сворачивании */
.vd-sidebar.collapsed .vd-side-header,
.sidebar-is-collapsed .vd-sidebar .vd-side-header {
    justify-content: flex-start;
    padding: 0.85rem 0.65rem 0.8rem;
    gap: 0;
}

.vd-side-primary {
    padding: 0 1rem 0.85rem;
}
.vd-side-primary .vd-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    padding: 0.6rem 0.9rem;
    font-weight: 600;
    font-size: 0.88rem;
    color: #fff;
    background: var(--vd-accent);
    border: 1px solid var(--vd-accent-strong);
    border-radius: 0.5rem;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.2s ease;
}
.vd-side-primary .vd-btn-primary:hover {
    background: var(--vd-accent-strong);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}
.vd-side-primary .vd-btn-primary span {
    display: inline-block;
    max-width: 280px;
    opacity: 1;
    overflow: hidden;
    white-space: nowrap;
    vertical-align: middle;
    transition: max-width var(--vd-shell-inner-duration) var(--vd-shell-inner-ease),
        opacity var(--vd-shell-inner-duration) var(--vd-shell-inner-ease),
        margin var(--vd-shell-inner-duration) var(--vd-shell-inner-ease);
    transition-delay: var(--vd-shell-inner-delay);
}
.vd-sidebar.collapsed .vd-side-primary .vd-btn-primary span,
.sidebar-is-collapsed .vd-sidebar .vd-side-primary .vd-btn-primary span {
    max-width: 0;
    opacity: 0;
    margin-left: 0 !important;
    transition-delay: var(--vd-shell-inner-delay-collapse);
}
body[data-color-palette="vibe"] .vd-side-primary .vd-btn-primary {
    background: linear-gradient(135deg, var(--vd-accent) 0%, var(--vd-accent-strong) 100%);
    box-shadow: var(--vd-accent-glow);
    border-radius: 0.85rem;
}
.vd-side-nav {
    padding: 0 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.vd-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.85rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--vd-chrome-text-muted);
    text-decoration: none;
    border-radius: 0.45rem;
    border-left: 3px solid transparent;
    transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
    white-space: nowrap;
    min-height: 40px;
}
.vd-nav-link i {
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 1.3rem;
    text-align: center;
}
.vd-nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}
.vd-nav-link.active {
    color: var(--vd-chrome-active-text);
    background: var(--vd-chrome-active-bg);
    border-left-color: var(--vd-accent);
}
.vd-nav-link.active i { color: var(--vd-accent); }
.vd-nav-link-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 1;
    transition: opacity var(--vd-shell-inner-duration) var(--vd-shell-inner-ease),
        max-width var(--vd-shell-inner-duration) var(--vd-shell-inner-ease),
        margin var(--vd-shell-inner-duration) var(--vd-shell-inner-ease);
    transition-delay: var(--vd-shell-inner-delay);
    max-width: 40rem;
}
.vd-nav-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.10);
    color: var(--vd-chrome-text);
    border: 1px solid var(--vd-chrome-border);
    flex-shrink: 0;
    opacity: 1;
    max-width: 6rem;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity var(--vd-shell-inner-duration) var(--vd-shell-inner-ease),
        max-width var(--vd-shell-inner-duration) var(--vd-shell-inner-ease);
    transition-delay: var(--vd-shell-inner-delay);
}
body[data-color-palette="vibe"] .vd-nav-link {
    border-radius: 0.75rem;
    border-left: none;
    border: 1px solid transparent;
}
body[data-color-palette="vibe"] .vd-nav-link.active {
    border-color: var(--vd-border-strong);
    box-shadow: 0 0 14px rgba(139, 92, 246, 0.22), inset 0 0 14px rgba(139, 92, 246, 0.08);
}

.vd-sidebar.collapsed .vd-nav-link,
.sidebar-is-collapsed .vd-sidebar .vd-nav-link {
    justify-content: center;
    padding: 0.65rem 0;
}
.vd-sidebar.collapsed .vd-nav-link-label,
.sidebar-is-collapsed .vd-sidebar .vd-nav-link-label {
    flex: 0 1 0;
    max-width: 0;
    opacity: 0;
    margin: 0 !important;
    pointer-events: none;
    transition-delay: var(--vd-shell-inner-delay-collapse);
}
.vd-sidebar.collapsed .vd-nav-badge,
.sidebar-is-collapsed .vd-sidebar .vd-nav-badge {
    max-width: 0;
    opacity: 0;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin: 0 !important;
    border-width: 0 !important;
    pointer-events: none;
    transition-delay: var(--vd-shell-inner-delay-collapse);
}

.vd-side-section-title {
    padding: 0.9rem 1rem 0.35rem;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--vd-chrome-text-muted);
    max-height: 4rem;
    opacity: 1;
    overflow: hidden;
    transition: max-height var(--vd-shell-inner-duration) var(--vd-shell-inner-ease),
        opacity var(--vd-shell-inner-duration) var(--vd-shell-inner-ease);
    transition-delay: var(--vd-shell-inner-delay);
}
.vd-sidebar.collapsed .vd-side-section-title,
.sidebar-is-collapsed .vd-sidebar .vd-side-section-title {
    max-height: 0;
    opacity: 0;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none;
    transition-delay: var(--vd-shell-inner-delay-collapse);
}

/* Collapsible sidebar groups */
.vd-side-group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: calc(100% - 0.65rem);
    margin: 0.65rem 0.325rem 0.15rem;
    padding: 0.45rem 0.6rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--vd-chrome-text-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0.45rem;
    cursor: pointer;
    text-align: left;
    max-height: 4rem;
    opacity: 1;
    overflow: hidden;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease,
        max-height var(--vd-shell-inner-duration) var(--vd-shell-inner-ease),
        opacity var(--vd-shell-inner-duration) var(--vd-shell-inner-ease),
        margin var(--vd-shell-inner-duration) var(--vd-shell-inner-ease),
        padding var(--vd-shell-inner-duration) var(--vd-shell-inner-ease),
        border-width var(--vd-shell-inner-duration) var(--vd-shell-inner-ease);
}
.vd-side-group-title:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--vd-chrome-text);
}
.vd-side-group-title-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    flex: 1;
}
.vd-side-group-title-label .vd-side-group-badge {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.08rem 0.42rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: var(--vd-chrome-text);
    border: 1px solid var(--vd-chrome-border);
    line-height: 1.3;
}
.vd-side-group-title .vd-side-group-chevron {
    font-size: 0.8rem;
    transition: transform 0.22s ease;
    color: var(--vd-chrome-text-faint);
}
.vd-side-group.is-collapsed .vd-side-group-chevron { transform: rotate(-90deg); }

.vd-side-group-items {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.25s ease, opacity 0.2s ease;
    overflow: hidden;
    opacity: 1;
}
.vd-side-group-items > .vd-side-group-items-inner {
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.vd-side-group.is-collapsed .vd-side-group-items {
    grid-template-rows: 0fr;
    opacity: 0;
}

.vd-sidebar.collapsed .vd-side-group-title,
.sidebar-is-collapsed .vd-sidebar .vd-side-group-title {
    max-height: 0;
    opacity: 0;
    margin: 0 !important;
    padding: 0 !important;
    border-width: 0 !important;
    pointer-events: none;
    transition-delay: var(--vd-shell-inner-delay-collapse);
}
.vd-sidebar.collapsed .vd-side-group.is-collapsed .vd-side-group-items,
.sidebar-is-collapsed .vd-sidebar .vd-side-group.is-collapsed .vd-side-group-items {
    grid-template-rows: 1fr;
    opacity: 1;
}

/* Гамбургер в topbar — только на мобильных; на десктопе живёт в sidebar */
.vd-topbar-hamburger {
    width: 38px;
    height: 38px;
    border-radius: 0.45rem;
    border: 1px solid var(--vd-topbar-btn-border, var(--vd-border));
    background: var(--vd-topbar-btn-bg, var(--vd-panel-soft));
    color: var(--vd-topbar-btn-fg, var(--vd-text));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.vd-topbar-hamburger:hover {
    background: var(--vd-topbar-btn-hover-bg, var(--vd-accent-soft));
    border-color: var(--vd-topbar-btn-hover-border, var(--vd-accent));
    color: var(--vd-topbar-btn-hover-fg, var(--vd-text-strong));
}
.vd-topbar-hamburger i { font-size: 1.15rem; }

/* Мини-лого в topbar — удалено (бренд только в sidebar); стили оставлены на случай legacy-разметки */
.vd-topbar-brand {
    display: none !important;
}
.vd-topbar-brand-logo {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--vd-accent);
    color: #fff;
    font-size: 1.05rem;
}
body[data-color-palette="vibe"] .vd-topbar-brand-logo {
    background: linear-gradient(135deg, var(--vd-accent), var(--vd-accent-strong));
    box-shadow: 0 3px 10px rgba(139, 92, 246, 0.32);
}
.vd-topbar-brand-logo img { width: 22px; height: 22px; object-fit: contain; border-radius: 4px; }
.vd-topbar-brand-text {
    display: inline-flex;
    flex-direction: column;
    line-height: 1.1;
    min-width: 0;
}
.vd-topbar-brand-title {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--vd-text-strong);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
body[data-color-palette="vibe"] .vd-topbar-brand-title {
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 50%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}
.vd-topbar-brand-sub {
    font-size: 0.66rem;
    color: var(--vd-text-muted);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .vd-topbar-brand-text { display: none; }
}

.vd-side-footer {
    padding: 0.85rem 1rem 1rem;
    border-top: 1px solid var(--vd-chrome-border);
    display: flex;
    align-items: center;
    gap: 0.65rem;
}
.vd-side-avatar-wrap {
    flex-shrink: 0;
}
.vd-side-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--vd-chrome-border);
    flex-shrink: 0;
}
.vd-side-user-name { font-size: 0.85rem; font-weight: 600; color: var(--vd-chrome-text); line-height: 1.2; }
.vd-side-user-mail { font-size: 0.72rem; color: var(--vd-chrome-text-muted); line-height: 1.2; }
.vd-side-bell {
    position: relative;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--vd-chrome-text-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0.45rem;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.vd-side-bell:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--vd-chrome-text);
    border-color: var(--vd-chrome-border);
}
.vd-side-bell-dot {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--vd-accent);
    display: none;
}
.vd-side-bell.has-unread .vd-side-bell-dot { display: block; animation: vd-chip-pulse 1.6s ease-in-out infinite; }

.vd-sidebar.collapsed .vd-side-footer,
.sidebar-is-collapsed .vd-sidebar .vd-side-footer { justify-content: center; padding: 0.85rem 0.25rem; }
.vd-side-user,
.vd-side-bell {
    transition: opacity var(--vd-shell-inner-duration) var(--vd-shell-inner-ease),
        max-width var(--vd-shell-inner-duration) var(--vd-shell-inner-ease),
        max-height var(--vd-shell-inner-duration) var(--vd-shell-inner-ease);
    transition-delay: var(--vd-shell-inner-delay);
    max-width: 280px;
    max-height: 80px;
    opacity: 1;
    overflow: hidden;
}
.vd-sidebar.collapsed .vd-side-user,
.vd-sidebar.collapsed .vd-side-bell,
.sidebar-is-collapsed .vd-sidebar .vd-side-user,
.sidebar-is-collapsed .vd-sidebar .vd-side-bell {
    flex: 0 0 0 !important;
    min-width: 0 !important;
    max-width: 0;
    max-height: 0;
    opacity: 0;
    margin: 0 !important;
    padding: 0 !important;
    border-width: 0 !important;
    pointer-events: none;
}

/* =====================================================
   Top-bar (тонкая полоса над контентом)
   ===================================================== */
.vd-topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    z-index: var(--vd-z-topbar, 1040);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0 1.25rem;
    background: var(--vd-panel);
    border-bottom: 1px solid var(--vd-border);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
    transition: left var(--vd-shell-chrome-duration) var(--vd-shell-chrome-ease);
    /* Sprint 2: защита topbar — кнопки всегда кликабельны */
    isolation: isolate;
}
/* Sprint 2: все интерактивные элементы topbar явно поверх фона */
.vd-topbar > * {
    position: relative;
    z-index: 1;
}
body[data-color-palette="vibe"] .vd-topbar {
    background: rgba(11, 8, 22, 0.55);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
/* Professional Blue + Soft Dark: topbar в тон сайдбару, светлый текст как в «Последние обращения» */
body[data-color-palette="blue"] .vd-topbar,
body[data-color-palette="dark"] .vd-topbar {
    background: linear-gradient(180deg, var(--vd-chrome-bg-soft) 0%, var(--vd-chrome-bg) 100%);
    color: var(--vd-chrome-text);
    border-bottom: 1px solid var(--vd-chrome-border);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}
body[data-color-palette="blue"] .vd-topbar-brand,
body[data-color-palette="dark"] .vd-topbar-brand {
    color: var(--vd-chrome-text);
}
body[data-color-palette="blue"] .vd-topbar-brand-title,
body[data-color-palette="dark"] .vd-topbar-brand-title {
    color: #f8fafc !important;
    -webkit-text-fill-color: #f8fafc;
    background: none !important;
}
body[data-color-palette="blue"] .vd-topbar-brand-sub,
body[data-color-palette="dark"] .vd-topbar-brand-sub {
    color: var(--vd-chrome-text-muted) !important;
}
body[data-color-palette="blue"] .vd-topbar .vd-crumbs,
body[data-color-palette="cyber-blue"] .vd-topbar .vd-crumbs,
body[data-color-palette="dark"] .vd-topbar .vd-crumbs {
    color: var(--vd-chrome-text-muted);
}
body[data-color-palette="blue"] .vd-topbar .vd-crumbs a,
body[data-color-palette="cyber-blue"] .vd-topbar .vd-crumbs a,
body[data-color-palette="dark"] .vd-topbar .vd-crumbs a {
    color: rgba(248, 250, 252, 0.78);
}
body[data-color-palette="blue"] .vd-topbar .vd-crumbs a:hover,
body[data-color-palette="cyber-blue"] .vd-topbar .vd-crumbs a:hover,
body[data-color-palette="dark"] .vd-topbar .vd-crumbs a:hover {
    color: #f8fafc;
}
body[data-color-palette="blue"] .vd-topbar .vd-crumbs .vd-crumbs-current,
body[data-color-palette="cyber-blue"] .vd-topbar .vd-crumbs .vd-crumbs-current,
body[data-color-palette="dark"] .vd-topbar .vd-crumbs .vd-crumbs-current {
    color: #f8fafc !important;
}
body[data-color-palette="blue"] .vd-topbar-tabs .vd-tab,
body[data-color-palette="dark"] .vd-topbar-tabs .vd-tab {
    color: rgba(248, 250, 252, 0.78);
}
body[data-color-palette="blue"] .vd-topbar-tabs .vd-tab:hover,
body[data-color-palette="dark"] .vd-topbar-tabs .vd-tab:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--vd-chrome-border);
}
body[data-color-palette="blue"] .vd-topbar-tabs .vd-tab.is-active,
body[data-color-palette="dark"] .vd-topbar-tabs .vd-tab.is-active {
    color: #dbeafe !important;
    background: rgba(59, 130, 246, 0.22);
    border-color: rgba(147, 197, 253, 0.45);
}
body[data-color-palette="blue"] .vd-topbar-tabs .vd-tab.is-active i,
body[data-color-palette="dark"] .vd-topbar-tabs .vd-tab.is-active i {
    color: #93c5fd !important;
}
body[data-color-palette="blue"] button.vd-topbar-search,
body[data-color-palette="dark"] button.vd-topbar-search {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--vd-chrome-border);
    color: rgba(248, 250, 252, 0.82);
}
body[data-color-palette="blue"] button.vd-topbar-search:hover,
body[data-color-palette="dark"] button.vd-topbar-search:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #f8fafc;
    border-color: rgba(255, 255, 255, 0.2);
}
body[data-color-palette="blue"] .vd-topbar-search i,
body[data-color-palette="dark"] .vd-topbar-search i {
    color: rgba(248, 250, 252, 0.65);
}
body[data-color-palette="blue"] .vd-cmdk-trigger-kbd,
body[data-color-palette="dark"] .vd-cmdk-trigger-kbd {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(248, 250, 252, 0.88);
}
body[data-color-palette="blue"] .vd-topbar-actions .vd-icon-btn,
body[data-color-palette="dark"] .vd-topbar-actions .vd-icon-btn {
    color: rgba(248, 250, 252, 0.78);
}
body[data-color-palette="blue"] .vd-topbar-actions .vd-icon-btn:hover,
body[data-color-palette="dark"] .vd-topbar-actions .vd-icon-btn:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--vd-chrome-border);
}
/* Topbar icon buttons — токены палитры (hamburger и др.) */
body.zen-body {
    --vd-topbar-btn-bg: var(--vd-panel-soft);
    --vd-topbar-btn-border: var(--vd-border);
    --vd-topbar-btn-fg: var(--vd-text);
    --vd-topbar-btn-hover-bg: var(--vd-accent-soft);
    --vd-topbar-btn-hover-fg: var(--vd-text-strong);
    --vd-topbar-btn-hover-border: var(--vd-accent);
}

body[data-color-palette="blue"],
body[data-color-palette="dark"],
body[data-color-palette="cyber-blue"],
body[data-color-palette="gray-office"] {
    --vd-topbar-btn-bg: rgba(255, 255, 255, 0.08);
    --vd-topbar-btn-border: var(--vd-chrome-border);
    --vd-topbar-btn-fg: rgba(248, 250, 252, 0.85);
    --vd-topbar-btn-hover-bg: rgba(255, 255, 255, 0.12);
    --vd-topbar-btn-hover-fg: var(--vd-chrome-text, #f8fafc);
    --vd-topbar-btn-hover-border: var(--vd-chrome-border);
}

body[data-color-palette="sky-lake"],
body[data-color-palette="rising-sun"],
body[data-color-palette="light"],
body[data-color-palette="light-office"] {
    --vd-topbar-btn-bg: rgba(255, 255, 255, 0.72);
    --vd-topbar-btn-border: var(--vd-border);
    --vd-topbar-btn-fg: var(--vd-text-muted);
    --vd-topbar-btn-hover-bg: rgba(230, 238, 248, 0.95);
    --vd-topbar-btn-hover-fg: var(--vd-text-strong);
    --vd-topbar-btn-hover-border: var(--vd-accent);
}

body[data-color-palette="glass"] {
    --vd-topbar-btn-bg: rgba(255, 255, 255, 0.35);
    --vd-topbar-btn-border: rgba(255, 255, 255, 0.45);
    --vd-topbar-btn-fg: var(--vd-text-muted);
    --vd-topbar-btn-hover-bg: rgba(255, 255, 255, 0.52);
    --vd-topbar-btn-hover-fg: var(--vd-text-strong);
    --vd-topbar-btn-hover-border: rgba(255, 255, 255, 0.62);
}

body[data-color-palette="vibe"] {
    --vd-topbar-btn-bg: rgba(255, 255, 255, 0.08);
    --vd-topbar-btn-border: rgba(255, 255, 255, 0.14);
    --vd-topbar-btn-fg: rgba(248, 250, 252, 0.78);
    --vd-topbar-btn-hover-bg: rgba(255, 255, 255, 0.14);
    --vd-topbar-btn-hover-fg: #f8fafc;
    --vd-topbar-btn-hover-border: rgba(255, 255, 255, 0.22);
}

body[data-color-palette="cats-temple"] {
    --vd-topbar-btn-bg: rgba(255, 252, 245, 0.75);
    --vd-topbar-btn-border: var(--vd-border);
    --vd-topbar-btn-fg: var(--vd-text-muted);
    --vd-topbar-btn-hover-bg: rgba(248, 240, 228, 0.95);
    --vd-topbar-btn-hover-fg: var(--vd-text-strong);
    --vd-topbar-btn-hover-border: var(--vd-accent);
}
body[data-color-palette="blue"] .vd-topbar .zen-user-dropdown-lg .vd-icon-btn .fw-semibold,
body[data-color-palette="dark"] .vd-topbar .zen-user-dropdown-lg .vd-icon-btn .fw-semibold,
body[data-color-palette="blue"] .vd-topbar .zen-user-dropdown-lg .vd-icon-btn .bi-chevron-down,
body[data-color-palette="dark"] .vd-topbar .zen-user-dropdown-lg .vd-icon-btn .bi-chevron-down {
    color: rgba(248, 250, 252, 0.92) !important;
}
.sidebar-is-collapsed .vd-topbar,
.vd-sidebar.collapsed ~ .vd-topbar { left: var(--sidebar-collapsed-width); }

.vd-topbar .vd-crumbs {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    color: var(--vd-text-muted);
    min-width: 0;
    flex-wrap: nowrap;
    overflow: hidden;
}
.vd-topbar .vd-crumbs a { color: var(--vd-text-muted); text-decoration: none; white-space: nowrap; }
.vd-topbar .vd-crumbs a:hover { color: var(--vd-text); }
.vd-topbar .vd-crumbs .vd-crumbs-sep { opacity: 0.5; font-size: 0.7rem; flex-shrink: 0; }
.vd-topbar .vd-crumbs .vd-crumbs-current {
    color: var(--vd-text);
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Контекстные вкладки раздела в topbar (Tickets.* / Admin.*) */
.vd-topbar-tabs {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: thin;
    animation: vdTabsFadeIn 0.12s ease-out;
}
.vd-topbar-tabs::-webkit-scrollbar { height: 4px; }
.vd-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    padding: 0.36rem 0.7rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--vd-text-muted);
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 0.4rem;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
    white-space: nowrap;
    flex-shrink: 0;
}
.vd-tab i { font-size: 0.95rem; }
.vd-tab:hover {
    color: var(--vd-text-strong);
    background: var(--vd-accent-soft);
    border-color: var(--vd-border);
}
.vd-tab.is-active {
    color: var(--vd-accent-strong);
    background: var(--vd-accent-soft);
    border-color: var(--vd-accent);
}
.vd-tab.is-active i { color: var(--vd-accent); }
body[data-color-palette="vibe"] .vd-tab.is-active,
body[data-color-palette="dark"] .vd-tab.is-active {
    color: var(--vd-chrome-active-text);
}

@keyframes vdTabsFadeIn {
    from { opacity: 0; transform: translateY(-2px); }
    to { opacity: 1; transform: translateY(0); }
}

.vd-topbar-search {
    flex: 1;
    max-width: 460px;
    position: relative;
}
.vd-topbar-search i {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--vd-text-muted);
    font-size: 0.9rem;
}
.vd-topbar-search input {
    width: 100%;
    height: 36px;
    padding: 0 0.85rem 0 2.1rem;
    background: var(--vd-panel-soft);
    border: 1px solid var(--vd-border);
    border-radius: 0.45rem;
    color: var(--vd-text);
    font-size: 0.85rem;
}
.vd-topbar-search input:focus {
    outline: none;
    border-color: var(--vd-accent);
    box-shadow: 0 0 0 3px var(--vd-accent-soft);
    background: var(--vd-panel);
}
.vd-topbar-search input::placeholder { color: var(--vd-text-faint); }

/* Кнопка-триггер Ctrl+K в topbar (заменяет input) */
button.vd-topbar-search {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    height: 36px;
    padding: 0 0.9rem 0 2.1rem;
    background: var(--vd-panel-soft);
    border: 1px solid var(--vd-border);
    border-radius: 0.45rem;
    color: var(--vd-text-muted);
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
button.vd-topbar-search:hover {
    background: var(--vd-accent-soft);
    border-color: var(--vd-accent);
    color: var(--vd-text-strong);
}
.vd-cmdk-trigger-label {
    flex: 1;
    min-width: 0;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.vd-cmdk-trigger-kbd { display: inline-flex; flex-shrink: 0; }

.vd-topbar-actions { display: flex; align-items: center; gap: 0.35rem; }
.vd-topbar-actions .vd-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 0.45rem;
    color: var(--vd-text-muted);
    background: transparent;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    text-decoration: none;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.vd-topbar-actions .vd-icon-btn:hover {
    background: var(--vd-accent-soft);
    color: var(--vd-text-strong);
    border-color: var(--vd-border);
}
.vd-topbar-actions .vd-icon-btn .badge { position: absolute; top: 2px; right: 2px; font-size: 0.6rem; }

/* Onboarding replay — distinctive «?» + mortarboard badge (always findable for AI/help copy) */
.vd-topbar-actions .vd-onboarding-restart {
    border-color: color-mix(in srgb, var(--vd-accent, #0d6efd) 35%, transparent);
}
.vd-topbar-actions .vd-onboarding-restart .vd-onboarding-restart__badge {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    line-height: 1;
    color: #fff;
    background: var(--vd-accent, #0d6efd);
    border: 1px solid var(--vd-surface, #fff);
    pointer-events: none;
}
.vd-topbar-actions .vd-onboarding-restart.is-pending {
    color: var(--vd-text-strong, inherit);
    animation: vd-onboarding-pending-pulse 2.2s ease-in-out infinite;
}
@keyframes vd-onboarding-pending-pulse {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--vd-accent, #0d6efd) 0%, transparent); }
    50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--vd-accent, #0d6efd) 22%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
    .vd-topbar-actions .vd-onboarding-restart.is-pending { animation: none; }
}

/* =====================================================
   Main wrapper + footer
   ===================================================== */
.main-wrapper {
    margin-top: var(--topbar-height);
    margin-left: var(--sidebar-width);
    padding: 1.25rem 1.5rem 3.5rem;
    flex-grow: 1;
    transition: margin-left var(--vd-shell-chrome-duration) var(--vd-shell-chrome-ease);
    position: relative;
    z-index: 1;
}
.sidebar-is-collapsed .main-wrapper,
.vd-sidebar.collapsed ~ .main-wrapper { margin-left: var(--sidebar-collapsed-width); }

/* Футер на всю ширину окна; сдвиг только если есть сайдбар (.footer--with-sidebar) */
.footer {
    background: var(--vd-panel);
    color: var(--vd-text-muted) !important;
    border-top: 1px solid var(--vd-border) !important;
    padding: 0.5rem 0;
    padding-left: 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--vd-z-footer, 1045);
    font-size: 0.78rem;
    transition: padding-left var(--vd-shell-chrome-duration) var(--vd-shell-chrome-ease);
}
.footer.footer--with-sidebar {
    padding-left: var(--sidebar-width);
}
body[data-color-palette="vibe"] .footer {
    background: rgba(11, 8, 22, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
html.sidebar-is-collapsed .footer.footer--with-sidebar,
.vd-sidebar.collapsed ~ .footer.footer--with-sidebar {
    padding-left: var(--sidebar-collapsed-width);
}

/* Guest layout: нет сайдбара/топбара, просто центрируем */
.vd-guest-shell {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem 1rem 5rem;
}

/* Эффекты кнопок и карточек */
.btn { transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); border-radius: var(--app-radius-md); }
.btn:active { transform: scale(0.97); }
.card {
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow-sm);
}
.main-wrapper .card:hover { box-shadow: var(--app-shadow-md); }
.table td, .table th {
    padding-top: var(--app-table-cell-y);
    padding-bottom: var(--app-table-cell-y);
}

@media (max-width: 768px) {
    .vd-topbar-search { display: none; }
    .vd-topbar-hamburger { display: inline-flex; }
    .vd-sidebar { transform: translateX(-100%); transition: transform var(--vd-shell-chrome-duration) var(--vd-shell-chrome-ease); }
    .vd-sidebar.is-open { transform: translateX(0); }
    .vd-sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: calc(var(--vd-z-sidebar, 1050) - 1);
        background: rgba(0, 0, 0, 0.35);
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--vd-shell-chrome-duration) var(--vd-shell-chrome-ease);
    }
    .vd-sidebar-backdrop.is-visible {
        opacity: 1;
        pointer-events: auto;
    }
    .main-wrapper,
    .vd-topbar,
    .footer { left: 0 !important; margin-left: 0 !important; padding-left: 0 !important; }
}

/* Reports */
#reports-container .card.bg-white > .card-header.bg-transparent.border-0.p-4 {
    background: linear-gradient(145deg, rgba(81, 101, 125, 0.85), rgba(91, 112, 140, 0.75)) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-top-left-radius: 1rem;
    border-top-right-radius: 1rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
#reports-container .card.bg-white > .card-header.bg-transparent.border-0.p-4 .text-dark,
#reports-container .card.bg-white > .card-header.bg-transparent.border-0.p-4 h5 {
    color: #ffffff !important;
}

#reports-container .row.g-4.mb-4 > .col-md-3:nth-child(1) .card {
    background: linear-gradient(145deg, rgba(75, 95, 121, 0.85), rgba(91, 112, 140, 0.75)) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
#reports-container .row.g-4.mb-4 > .col-md-3:nth-child(2) .card {
    background: linear-gradient(145deg, rgba(62, 80, 104, 0.85), rgba(81, 101, 125, 0.75)) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
#reports-container .row.g-4.mb-4 > .col-md-3:nth-child(3) .card {
    background: linear-gradient(145deg, rgba(91, 112, 140, 0.85), rgba(104, 126, 154, 0.75)) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
#reports-container .row.g-4.mb-4 > .col-md-3:nth-child(4) .card {
    background: linear-gradient(145deg, rgba(104, 126, 154, 0.85), rgba(91, 112, 140, 0.75)) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
#reports-container .row.g-4.mb-4 > .col-md-3 .card {
    color: #ffffff !important;
}
#reports-container .row.g-4.mb-4 > .col-md-3 .card h6 {
    opacity: 0.95 !important;
    letter-spacing: 0.08em;
}
