/* ========== RESET ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ========== BASE ========== */
body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-body);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-hover);
}

/* ========== LAYOUT ========== */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ========== SIDEBAR - БЕЛЫЙ как Silva ========== */
.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--sidebar-border);
}

.admin-sidebar::-webkit-scrollbar {
    width: 0.25rem;
}

.admin-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-pill);
}

.sidebar-header {
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    border-bottom: 1px solid var(--sidebar-border);
}

/* Логотип - квадратик с закругленными углами */
.sidebar-logo {
    width: 126px;
    height: 76px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    flex-shrink: 0;
    margin: 0 auto;
    overflow: hidden;
}

.sidebar-logo img {
    width: 126px;
    height: auto;
    object-fit: cover;
    object-position: top center;
}

.sidebar-header h1 {
    font-size: var(--font-size-lg);
    font-weight: 500;
    color: #ffffff;
}

.sidebar-nav {
    padding: var(--space-3) 0;
    flex: 1;
}

/* Nav Group */
.nav-group {
    margin-bottom: 0.125rem;
}

/* Nav Item - для темного сайдбара */
.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem var(--space-3);
    color: var(--sidebar-text);
    cursor: pointer;
    transition: all 0.2s;
    font-size: var(--font-size-sm);
    font-weight: 400;
    text-decoration: none;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}

.nav-item.active {
    color: var(--sidebar-text-active);
    background: var(--sidebar-hover);
    font-weight: 500;
}

.nav-icon {
    width: 1rem;
    height: 1rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
    opacity: 0.9;
}

.nav-item span {
    flex: 1;
}

.nav-item .nav-support-chat-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.125rem;
    height: 1.125rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    margin-left: 0.35rem;
    line-height: 1;
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.95);
    background: rgba(40, 127, 113, 0.42);
    border: 1px solid rgba(72, 180, 164, 0.35);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.nav-item .nav-support-chat-badge:empty {
    display: none !important;
}

.nav-item .nav-support-chat-orders-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.125rem;
    height: 1.125rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    margin-left: 0.25rem;
    line-height: 1;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.98);
    background: rgba(180, 100, 20, 0.55);
    border: 1px solid rgba(200, 130, 40, 0.45);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.nav-item .nav-support-chat-orders-badge:empty {
    display: none !important;
}

.support-chat-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.125rem;
    height: 1.125rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.98);
    background: rgba(180, 100, 20, 0.75);
    border: 1px solid rgba(200, 130, 40, 0.5);
}

.nav-arrow {
    width: 0.875rem;
    height: 0.875rem;
    margin-left: auto;
    transition: transform 0.2s;
    opacity: 0.7;
}

.nav-group.open .nav-arrow {
    transform: rotate(180deg);
}

/* Submenu */
.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0, 0, 0, 0.1);
}

.nav-group.open .nav-submenu {
    max-height: 500px;
}

.nav-subitem {
    display: block;
    padding: 0.5rem var(--space-3) 0.5rem 2.75rem;
    color: var(--sidebar-text);
    font-size: var(--font-size-sm);
    font-weight: 400;
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
}

.nav-subitem:hover {
    color: var(--sidebar-text-active);
}

.nav-subitem.active {
    color: var(--sidebar-text-active);
    font-weight: 500;
}

.submenu-count {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.6);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.125rem;
    padding: 0 0.375rem;
    border-radius: 1rem;
    font-size: 0.6875rem;
    font-weight: 400;
    margin-left: 0.5rem;
    line-height: 1;
}

.nav-subitem.active .submenu-count {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.7);
}

/* Стили для групп комбо */
.combo-group-header {
    background-color: var(--bg-light) !important;
    border-top: 2px solid var(--border-light);
}

.combo-group-header:hover {
    background-color: var(--primary-light) !important;
}

.combo-group-header td {
    font-weight: 500;
    color: var(--text-primary);
    padding: 12px !important;
}

.combo-item-row {
    transition: background-color 0.2s;
}

/* ========== HEADER - Silva Style ========== */
.admin-header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: var(--bg-white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-4);
    z-index: 999;
    box-shadow: var(--shadow);
    border-bottom: 1px solid var(--border-light);
}

.header-title {
    font-size: var(--font-size-xl);
    font-weight: 400;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.header-user {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    background: var(--bg-light);
    border-radius: var(--radius-pill);
}

.header-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary), #1e6f65);
}

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

.header-user-avatar #header-avatar-initials {
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-create-client {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    background: var(--bg-light);
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.btn-create-client:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.btn-create-client-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.btn-create-client-text {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .btn-create-client-text {
        display: none;
    }
    .btn-create-client {
        padding: 0.5rem;
        width: 2.5rem;
        height: 2.5rem;
        justify-content: center;
    }
}

.btn-header {
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.btn-header:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.btn-header svg {
    width: 1.25rem;
    height: 1.25rem;
}

.btn-header img {
    width: 2.375rem;
    height: 2.375rem;
    object-fit: contain;
}

/* ========== MAIN CONTENT ========== */
.admin-main {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: var(--space-4);
    min-height: calc(100vh - var(--header-height));
    width: calc(100% - var(--sidebar-width));
}

/* ========== SECTIONS ========== */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.section-title {
    font-size: var(--font-size-xl);
    font-weight: 500;
    color: var(--text-dark);
    margin: 0;
}

