/* ========================================
   SILVA ADMIN TEMPLATE
   White Sidebar, Modern Design
   
   ИЗМЕНЕНИЯ:
   - Добавлена кнопка создания клиента в header (иконка 38px)
   - Добавлены стили для модальных окон создания клиентов
   - Стили для полей в модальных окнах (фон #fafafa, без рамки)
   - Стили для блоков в международной форме (белый фон, рамка #d0d0d0)
======================================== */

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

/* ========== LOADING SPINNER - Silva Style ========== */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    gap: 1rem;
}

.loading-spinner-icon {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner-text {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

/* ========== EMPTY STATE - Silva Style ========== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    gap: 0.75rem;
}

.empty-state-icon {
    width: 3rem;
    height: 3rem;
    color: var(--text-muted);
    opacity: 0.5;
}

.empty-state-icon svg {
    width: 100%;
    height: 100%;
}

.empty-state-text {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

:root {
    /* Silva Primary - teal/бирюзовый */
    --primary: #287f71;
    --primary-hover: #1f6a5e;
    --primary-light: rgba(40, 127, 113, 0.1);
    
    /* Status Colors */
    --success: #1cc88a;
    --warning: #f6c23e;
    --danger: #e74a3b;
    --info: #36b9cc;
    
    /* Sidebar - бирюзовый #1f6a5e */
    --sidebar-bg: #1f6a5e;
    --sidebar-text: rgba(255, 255, 255, 0.7);
    --sidebar-text-active: #ffffff;
    --sidebar-hover: rgba(255, 255, 255, 0.1);
    --sidebar-border: rgba(255, 255, 255, 0.15);
    
    /* Content Colors */
    --bg-body: #f8f9fc;
    --bg-white: #ffffff;
    --bg-light: #f8f9fc;
    
    /* Text Colors */
    --text-primary: #5a5c69;
    --text-dark: #3a3b45;
    --text-secondary: #858796;
    --text-muted: #b7b9cc;
    --text-inverse: #ffffff;
    
    /* Borders */
    --border-color: #e3e6f0;
    --border-light: #eaecf4;
    
    /* Typography */
    --font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-base: 1rem;
    --font-size-sm: 0.875rem;
    --font-size-xs: 0.75rem;
    --font-size-lg: 1.25rem;
    --font-size-xl: 1.5rem;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 1rem;
    --space-4: 1.5rem;
    --space-5: 2rem;
    
    /* Radius */
    --radius-sm: 0.2rem;
    --radius: 0.35rem;
    --radius-lg: 0.5rem;
    --radius-pill: 10rem;
    
    /* Shadows - Silva style */
    --shadow-sm: 0 0.125rem 0.25rem 0 rgba(58, 59, 69, 0.2);
    --shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    
    /* Layout */
    --sidebar-width: 14rem;
    --header-height: 4.375rem;
}

/* ========== OPERATOR PRODUCT/COMBO CARDS ========== */
.operator-product-card {
    /* Silva style: компактная карточка товара, max 46rem (~736px) */
    max-width: min(46rem, 95vw) !important;
    padding: 0 !important;
}

.operator-card-body {
    padding: 0 !important;
    display: flex;
    min-height: 380px;
}

.operator-card-image-section {
    width: 280px;
    background: var(--bg-light);
    position: relative;
    padding: 32px;
}

.operator-image-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.operator-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: none;
}

.operator-image-placeholder {
    width: 140px;
    height: 140px;
    border-radius: 70px;
    background: var(--bg-white);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    opacity: 0.3;
}

.operator-badge {
    position: absolute;
    height: 32px;
    padding: 0 12px;
    border-radius: 16px;
    background: rgba(40, 127, 113, 0.14);
    border: 1px solid rgba(40, 127, 113, 0.22);
    display: none;
    align-items: center;
    box-shadow: none;
    z-index: 10;
}

.operator-badge span {
    font-size: var(--font-size-xs);
    font-weight: 500;
    letter-spacing: 0.5px;
    color: var(--primary);
    text-transform: uppercase;
    font-family: var(--font-family);
}

.operator-badge-category {
    top: 24px;
    left: 24px;
}

.operator-badge-unit {
    top: -14px;
    right: 16px;
    height: 28px;
    opacity: 0.9;
}

.operator-card-info-section {
    flex: 1;
    background: var(--bg-white);
    padding: 24px;
}

.operator-card-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 14px;
}

.operator-product-name {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-dark);
    margin: 0;
    line-height: 1.3;
    word-wrap: break-word;
    font-family: var(--font-family);
}

.operator-price-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.operator-price-label {
    font-size: var(--font-size-xs);
    font-weight: 500;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-family: var(--font-family);
}

.operator-price-value {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.operator-price-amount {
    font-size: 22px;
    font-weight: 500;
    color: var(--primary);
    font-family: var(--font-family);
}

.operator-price-currency {
    font-size: 16px;
    font-weight: 500;
    color: var(--primary);
    font-family: var(--font-family);
}

.operator-price-request {
    font-size: var(--font-size-base);
    font-weight: 500;
    color: var(--text-secondary);
    font-family: var(--font-family);
}

.operator-divider {
    width: 100%;
    height: 1px;
    background: var(--border-color);
}

.operator-info-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.operator-info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.operator-info-row {
    display: flex;
    gap: 8px;
}

.operator-info-icon {
    width: 32px;
    height: 32px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--primary);
}

.operator-info-icon svg {
    width: 16px;
    height: 16px;
}

.operator-icon-company {
    background: var(--primary-light);
}

.operator-icon-generic {
    background: rgba(54, 185, 204, 0.1);
    color: var(--info);
}

.operator-info-content {
    flex: 1;
}

.operator-info-label {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 2px;
    font-family: var(--font-family);
}

.operator-info-value {
    font-size: 0.8125rem;
    color: var(--text-dark);
    word-wrap: break-word;
    font-family: var(--font-family);
}

.operator-info-value.operator-warning {
    font-weight: 500;
    color: var(--warning);
}

.operator-combo-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    overflow-y: auto;
}

.operator-combo-items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.operator-combo-item {
    padding: 8px;
    background: var(--bg-light);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

.operator-combo-item-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 4px;
    word-wrap: break-word;
    font-family: var(--font-family);
}

.operator-combo-item-generic {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-bottom: 4px;
    word-wrap: break-word;
    font-family: var(--font-family);
}

.operator-combo-item-qty {
    display: flex;
    gap: 6px;
    align-items: center;
}

.operator-combo-item-qty-label {
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--text-secondary);
    font-family: var(--font-family);
}

.operator-combo-item-qty-value {
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--primary);
    font-family: var(--font-family);
}

/* ========== 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-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;
}

/* ========== CARDS - Silva Style ========== */
.card {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Hover эффект для карточек Dashboard */
.dashboard-stats .card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.card-header {
    padding: 0.75rem var(--space-3);
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: var(--font-size-base);
    font-weight: 500;
    color: var(--primary);
    text-transform: uppercase;
    margin: 0;
}

/* ========== FILTERS ========== */
.filters-bar {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
    align-items: center;
}

.filter-input,
.filter-select {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    background: var(--bg-white);
    color: var(--text-primary);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.filter-input {
    min-width: 16rem;
    flex: 1;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: #80c9be;
    box-shadow: 0 0 0 0.2rem rgba(40, 127, 113, 0.25);
}

/* ========== BUTTONS - Silva Style ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: var(--font-size-base);
    font-weight: 400;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.btn svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.btn-primary {
    background: linear-gradient(180deg, #287f71 10%, #1f6a5e 100%);
    color: var(--text-inverse);
    border-color: transparent;
    box-shadow: 0 0.125rem 0.25rem 0 rgba(40, 127, 113, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(180deg, #1f6a5e 10%, #155647 100%);
    box-shadow: 0 0.25rem 0.5rem 0 rgba(40, 127, 113, 0.3);
}

.btn-secondary {
    background: var(--bg-white);
    color: var(--text-secondary);
    border-color: var(--border-color);
}

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

.btn-success {
    background: linear-gradient(180deg, #1cc88a 10%, #13855c 100%);
    color: var(--text-inverse);
    box-shadow: 0 0.125rem 0.25rem 0 rgba(28, 200, 138, 0.2);
}

.btn-danger {
    background: linear-gradient(180deg, #e74a3b 10%, #be2617 100%);
    color: var(--text-inverse);
    box-shadow: 0 0.125rem 0.25rem 0 rgba(231, 74, 59, 0.2);
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: var(--font-size-xs);
}

/* Совместимость: где-то используется btn-sm */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: var(--font-size-xs);
    line-height: 1.2;
}

/* ========== TABLES - Silva Style ========== */
.table-wrapper {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-compact {
    width: 100%;
    border-collapse: collapse;
}

.table-compact thead {
    background: var(--bg-light);
}

.table-compact th {
    padding: 0.75rem var(--space-3);
    text-align: left;
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    border-bottom: 1px solid var(--border-color);
}

.table-compact td {
    padding: 0.75rem var(--space-3);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

/* Стили для сортируемых заголовков таблицы клиентов - маленькие серые стрелки в стиле Silva */
.clients-sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 24px !important;
    transition: color 0.15s;
}

.clients-sortable-header:hover {
    color: var(--primary);
}

.clients-sortable-header::after {
    content: '⇅';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #788d98;
    opacity: 0.5;
    font-weight: normal;
    line-height: 1;
}

.clients-sortable-header.sorted-asc::after {
    content: '↑';
    opacity: 1;
    color: var(--primary);
}

.clients-sortable-header.sorted-desc::after {
    content: '↓';
    opacity: 1;
    color: var(--primary);
}

.clients-sortable-header.sorted-asc,
.clients-sortable-header.sorted-desc {
    color: var(--primary);
}

/* Стили для сортируемых заголовков таблицы заказов - аналогично клиентам */
.deals-sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 24px !important;
    transition: color 0.15s;
}

.deals-sortable-header:hover {
    color: var(--primary);
}

.deals-sortable-header::after {
    content: '⇅';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #788d98;
    opacity: 0.5;
    font-weight: normal;
    line-height: 1;
}

.deals-sortable-header.sorted-asc::after {
    content: '↑';
    opacity: 1;
    color: var(--primary);
}

.deals-sortable-header.sorted-desc::after {
    content: '↓';
    opacity: 1;
    color: var(--primary);
}

.deals-sortable-header.sorted-asc,
.deals-sortable-header.sorted-desc {
    color: var(--primary);
}

/* Стили для сортируемых заголовков таблицы товаров - аналогично клиентам */
.products-sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 24px !important;
    transition: color 0.15s;
}

.products-sortable-header:hover {
    color: var(--primary);
}

.products-sortable-header::after {
    content: '⇅';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #788d98;
    opacity: 0.5;
    font-weight: normal;
    line-height: 1;
}

.products-sortable-header.sorted-asc::after {
    content: '↑';
    opacity: 1;
    color: var(--primary);
}

.products-sortable-header.sorted-desc::after {
    content: '↓';
    opacity: 1;
    color: var(--primary);
}

.products-sortable-header.sorted-asc,
.products-sortable-header.sorted-desc {
    color: var(--primary);
}

/* Фиксированные ширины для таблицы клиентов */
#section-clients .table-compact th:nth-child(2),
#section-clients .table-compact td.client-name-cell {
    min-width: 200px;
    max-width: 250px;
}

#section-clients .table-compact th:nth-child(3),
#section-clients .table-compact td.client-phone-cell {
    min-width: 150px;
    white-space: nowrap;
}

#section-clients .table-compact th:nth-child(4),
#section-clients .table-compact td.client-email-cell {
    min-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#section-clients .table-compact th:nth-child(5),
#section-clients .table-compact td.client-country-cell {
    min-width: 120px;
    white-space: nowrap;
}

#section-clients .table-compact th:nth-child(6),
#section-clients .table-compact td.client-date-cell {
    min-width: 100px;
    white-space: nowrap;
    text-align: center;
}

.table-compact tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

.table-compact tbody tr:hover {
    background: var(--bg-light);
}

.table-compact tbody tr:last-child td {
    border-bottom: none;
}

/* ========== DEAL ROW STATUS BORDERS ========== */
.table-compact tbody tr.deal-row {
    position: relative;
    border-left: 2px solid transparent;
}

.table-compact tbody tr.deal-row-invoice_issued {
    border-left-color: #36b9cc;
}

.table-compact tbody tr.deal-row-paid {
    border-left-color: #1cc88a;
}

.table-compact tbody tr.deal-row-sent {
    border-left-color: #f6c23e;
}

.table-compact tbody tr.deal-row-customs {
    border-left-color: #e74a3b;
}

.table-compact tbody tr.deal-row-completed {
    border-left-color: #9c27b0;
}

.table-compact tbody tr.deal-row-archive {
    border-left-color: #858796;
}

/* ========== STATUS BADGES ========== */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 1rem;
    border-radius: 1rem;
    font-size: var(--font-size-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    white-space: nowrap;
}

.status-badge.invoice_issued {
    background: rgba(54, 185, 204, 0.1);
    color: #2c9fb3;
}

.status-badge.paid {
    background: rgba(28, 200, 138, 0.1);
    color: #1a9e6f;
}

.status-badge.sent {
    background: rgba(246, 194, 62, 0.1);
    color: #b38620;
}

.status-badge.customs {
    background: rgba(231, 74, 59, 0.1);
    color: #c43d2e;
}

.status-badge.completed {
    background: rgba(156, 39, 176, 0.1);
    color: #7d1f8f;
}

.status-badge.archive {
    background: rgba(133, 135, 150, 0.1);
    color: #6c6f7f;
}

/* ========== DASHBOARD STATS ========== */
.dashboard-stats {
    padding: var(--space-4);
}

.telegram-users-table-wrapper {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    border-radius: 8px;
}

.telegram-users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.telegram-users-table thead {
    position: sticky;
    top: 0;
    background: var(--bg-light);
    z-index: 1;
}

.telegram-users-table th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}

.telegram-users-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

.telegram-users-table tbody tr:hover {
    background: var(--bg-light);
}

.telegram-users-table .telegram-username {
    font-family: 'Courier New', monospace;
    color: var(--info);
    font-size: 0.75rem;
}

.telegram-users-table .client-link {
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
}

.telegram-users-table .client-link:hover {
    text-decoration: underline;
}

.telegram-users-table .deal-badge {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.6875rem;
    margin-right: 4px;
}

.telegram-users-table .deal-badge-link {
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.telegram-users-table .deal-badge-link:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

@media (max-width: 992px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
}

/* ========== DASHBOARD STAT CARDS ========== */

/* Ряды карточек */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.stats-row-2 {
    grid-template-columns: repeat(2, 1fr);
}

.stats-row-1 {
    grid-template-columns: 1fr;
}

.stats-row-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 992px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .stats-row-2 {
        grid-template-columns: 1fr;
    }
    .stats-row-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
    .stats-row-4 {
        grid-template-columns: 1fr;
    }
}

/* Базовая карточка */
.stat-card {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
    border: 1px solid var(--border-light);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

/* Иконки в кружках */
.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.stat-card:hover .stat-icon {
    transform: scale(1.1);
}

.stat-icon svg {
    width: 26px;
    height: 26px;
}

/* Цвета иконок */
.stat-icon-teal {
    background: linear-gradient(135deg, #26a69a 0%, #00897b 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(38, 166, 154, 0.4);
}

.stat-icon-blue {
    background: linear-gradient(135deg, #42a5f5 0%, #1e88e5 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(66, 165, 245, 0.4);
}

.stat-icon-purple {
    background: linear-gradient(135deg, #ab47bc 0%, #8e24aa 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(171, 71, 188, 0.4);
}

.stat-icon-green {
    background: linear-gradient(135deg, #66bb6a 0%, #43a047 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(102, 187, 106, 0.4);
}

.stat-icon-orange {
    background: linear-gradient(135deg, #ffa726 0%, #fb8c00 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(255, 167, 38, 0.4);
}

/* Контент */
.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.2;
}

.stat-value-lg {
    font-size: 1.5rem;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 2px;
}

.stat-label-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Селектор месяца - Silva style */
.stat-month-select {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px 34px 8px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--primary);
    cursor: pointer;
    font-family: inherit;
    text-transform: none;
    box-shadow: 0 2px 10px rgba(58, 59, 69, 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23287f71' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    min-width: 170px;
}

.stat-month-select:hover {
    border-color: rgba(40, 127, 113, 0.35);
    box-shadow: 0 6px 18px rgba(58, 59, 69, 0.10);
    transform: translateY(-1px);
}

.stat-month-select:focus {
    outline: none;
    border-color: rgba(40, 127, 113, 0.55);
    box-shadow: 0 0 0 3px rgba(40, 127, 113, 0.12), 0 6px 18px rgba(58, 59, 69, 0.10);
}

.stat-month-select option {
    background: #fff;
    color: var(--text-dark);
    padding: 10px;
}

/* Широкие карточки с графиками */
.stat-card-wide {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
}

.stat-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.stat-chart {
    padding-top: 1rem;
    height: 70px;
}

.stat-chart canvas {
    width: 100% !important;
}

/* Карточка с bar диаграммой */
.stat-card-chart {
    flex-direction: column;
    align-items: stretch;
    padding: 1.25rem;
}

.stat-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light);
}

.docs-informer {
    padding: 0.25rem 0;
}
.docs-informer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.docs-informer-block {
    background: var(--bg-light);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border-light);
}
.docs-informer-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}
.docs-informer-total {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}
.docs-informer-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.docs-informer-sources strong {
    color: var(--text-dark);
}
@media (max-width: 640px) {
    .docs-informer-grid {
        grid-template-columns: 1fr;
    }
}

.stat-bar-chart {
    width: 100%;
}

/* Карточка с товарами */
.stat-card-products {
    flex-direction: column;
    align-items: stretch;
    padding: 1.25rem;
}

.stat-card-header-compact {
    margin-bottom: 0.5rem;
}

.top-products-list {
    padding: 0.25rem 0 0 0;
}

.top-products-list::-webkit-scrollbar {
    width: 6px;
}

.top-products-list::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 3px;
}

.top-products-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.top-products-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.top-products-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
    transition: all 0.2s ease;
    gap: 0.5rem;
}

.top-products-item:last-child {
    border-bottom: none;
}

.top-products-item:hover {
    background: var(--bg-light);
    margin: 0 -0.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    border-radius: 8px;
}

.top-products-rank {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #42a5f5 0%, #1e88e5 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 0.75rem;
    flex-shrink: 0;
    margin-right: 0.625rem;
    box-shadow: 0 2px 6px rgba(66, 165, 245, 0.25);
}

.top-products-rank.top-products-rank-1 {
    background: linear-gradient(135deg, #ffd700 0%, #ffb300 100%);
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

.top-products-rank.top-products-rank-2 {
    background: linear-gradient(135deg, #c0c0c0 0%, #a0a0a0 100%);
    box-shadow: 0 2px 8px rgba(192, 192, 192, 0.3);
}

.top-products-rank.top-products-rank-3 {
    background: linear-gradient(135deg, #cd7f32 0%, #b87333 100%);
    box-shadow: 0 2px 8px rgba(205, 127, 50, 0.3);
}

.top-products-info {
    flex: 1;
    min-width: 0;
    margin-right: 1rem;
}

.top-products-name {
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--text-dark);
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.top-products-stats {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.top-products-quantity {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--primary);
    margin-right: 0.625rem;
}

.top-products-amount {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 400;
    white-space: nowrap;
}

.top-products-loading,
.top-products-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Карточка с диаграммой и списком */
.card-chart-wide {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.card-chart-wide .card-header {
    padding: 0.75rem var(--space-3);
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-light);
}

.card-chart-wide .card-title {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--primary);
    margin: 0;
    text-transform: uppercase;
}

.card-chart-wide .card-body {
    padding: var(--space-3);
}

.chart-container {
    display: flex;
    align-items: center;
}

.chart-donut {
    flex: 0 0 180px;
    display: flex;
    justify-content: center;
}

.chart-stats {
    flex: 1;
    padding-left: var(--space-4);
}

#clients-by-type-chart {
    width: 100%;
    max-width: 100%;
}

#clients-by-type-chart .apexcharts-canvas,
#clients-by-type-chart svg {
    width: 100% !important;
}

#clients-by-type-chart .apexcharts-canvas {
    margin: 0;
}

.stats-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: var(--space-4);
    max-height: 240px;
    overflow: auto;
    padding-right: var(--space-2);
}

.stats-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.25rem 0;
    font-size: var(--font-size-xs);
}

.stats-list .stat-label {
    display: flex;
    align-items: center;
    color: var(--text-dark);
}

.stats-list .stat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.625rem;
    flex-shrink: 0;
}

.stats-list .stat-name {
    font-weight: 400;
}

.stats-list .stat-value {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-left: 1rem;
}

@media (max-width: 576px) {
    .chart-container {
        flex-direction: column;
    }
    .chart-stats {
        padding-left: 0;
        padding-top: 1rem;
        width: 100%;
    }
    .stats-list {
        grid-template-columns: 1fr;
        max-height: 320px;
    }
}

/* Dashboard widgets (Silva) */
.card .card-body {
    padding: var(--space-3);
}

.stat-widget {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-height: 92px;
}

.stat-widget-head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.stat-text {
    display: flex;
    flex-direction: column;
}

.stat-title {
    font-size: var(--font-size-sm);
    font-weight: 400;
    color: var(--text-dark);
}

.stat-widget-foot {
    display: flex;
    align-items: flex-end;
}

.stat-value {
    font-size: var(--font-size-lg);
    font-weight: 500;
    color: var(--text-dark);
    letter-spacing: 0.2px;
}

/* Внешний круг с рамкой */
.stat-icon-outer {
    padding: 0.5rem;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 50px;
    margin-right: 0.5rem;
}

/* Внутренний цветной круг */
.stat-icon-inner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Цвета */
.stat-icon-outer.stat-secondary {
    background: rgba(108, 117, 125, 0.1);
    border-color: rgba(108, 117, 125, 0.2);
}
.stat-icon-outer.stat-secondary .stat-icon-inner {
    background: #6c757d;
}

.stat-icon-outer.stat-success {
    background: rgba(25, 135, 84, 0.1);
    border-color: rgba(25, 135, 84, 0.2);
}
.stat-icon-outer.stat-success .stat-icon-inner {
    background: #198754;
}

.stat-icon-outer.stat-warning {
    background: rgba(255, 193, 7, 0.1);
    border-color: rgba(255, 193, 7, 0.2);
}
.stat-icon-outer.stat-warning .stat-icon-inner {
    background: #ffc107;
}

/* ========== STATUS FILTERS ========== */
.status-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}

.status-filter {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    font-size: var(--font-size-sm);
    font-weight: 400;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    background: var(--bg-white);
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.status-filter:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.status-filter.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-inverse);
    box-shadow: 0 0.125rem 0.25rem 0 rgba(40, 127, 113, 0.3);
}

.status-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-pill);
    font-size: 0.6875rem;
    font-weight: 400;
    opacity: 0.85;
}

.status-filter:not(.active) .status-count {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-muted);
    opacity: 0.7;
}

/* ========== MODALS - Silva Style ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    overflow-y: auto;
    padding: var(--space-4);
}

.modal.show,
.modal.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 5vh;
}

/* Стили для наложения модалок (лид + клиент) */
#lead-modal.show,
#lead-modal.active {
    z-index: 1000;
}

#client-modal.show.over-lead,
#client-modal.active.over-lead {
    z-index: 1001;
}

#client-modal.over-lead .modal-content {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
}

.modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    border: 1px solid var(--border-light);
}

/* Переопределяем width для deal-card-modal ЯВНО */
.modal-content.deal-card-modal {
    width: min(56rem, 95vw);
}

/* Карточки каталога (admin): товар/комбо — одинаковая ширина по Silva */
.modal-content.catalog-card-modal {
    max-width: min(42rem, 95vw) !important;
}

.modal-header {
    padding: var(--space-3);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.btn-close {
    width: 2rem;
    height: 2rem;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 1.5rem;
    line-height: 1;
    transition: all 0.15s;
}

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

.modal-body {
    padding: var(--space-3);
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

.modal-footer {
    padding: var(--space-3);
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    background: var(--bg-light);
}

/* ========== FORMS ========== */
.form-group {
    margin-bottom: var(--space-3);
    position: relative;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-dark);
}

.form-input,
.input {
    width: 100%;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    background: var(--bg-white);
    color: var(--text-primary);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus {
    outline: none;
    border-color: #80c9be;
    box-shadow: 0 0 0 0.2rem rgba(40, 127, 113, 0.25);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* Стили для полей в модальных окнах создания клиента (как в десктопе) */
/* Шрифт для почтового индекса (как на конвертах) */
@font-face {
    font-family: 'Pechkin';
    src: url('/static/fonts/Pechkin.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: block;
}

/* ========== CLIENT FORM - Silva Style ========== */
.client-modal {
    max-width: 420px !important;
    max-height: 90vh;
}

.client-modal .modal-body {
    padding: 12px;
}

.client-modal .data-block {
    margin-bottom: 10px;
}

.client-modal .data-block-header {
    padding: 6px 10px;
}

.client-modal .data-block-header h4 {
    font-size: 0.6875rem;
    letter-spacing: 0.03em;
}

/* Courier checkbox */
.client-courier-checkbox {
    margin-bottom: 4px !important;
}

.client-courier-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
}

.client-courier-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: var(--primary);
}

.client-courier-toggle label {
    margin: 0;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Create client footer with index */
.create-client-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.create-client-index-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.create-client-index-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.create-client-index-input {
    width: 90px;
    height: 32px;
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 14px;
    letter-spacing: 2px;
    text-align: center;
    color: var(--text-primary);
}

.create-client-index-input::placeholder {
    opacity: 0.4;
    letter-spacing: 1px;
}

.create-client-buttons {
    display: flex;
    gap: 8px;
}

/* Post index field - special Pechkin font */
.post-index-input {
    width: 100%;
    height: 50px !important;
    background: #fafafa !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-sm) !important;
    font-family: 'Pechkin', 'Courier New', monospace !important;
    font-size: 28px !important;
    letter-spacing: 6px !important;
    text-align: center !important;
    color: #333 !important;
    padding: 0 8px !important;
    box-sizing: border-box;
}

.post-index-input::placeholder {
    font-size: 28px !important;
    letter-spacing: 6px !important;
    opacity: 0.3;
}

.post-index-input:focus {
    border-color: var(--primary) !important;
    background: var(--bg-white) !important;
    outline: none;
}

/* Validation error */
.client-validation-error {
    display: none;
    color: var(--danger);
    padding: 8px 10px;
    background: rgba(231, 74, 59, 0.1);
    border-radius: var(--radius);
    margin-bottom: 10px;
    font-size: 0.75rem;
}

/* International link */
.client-international-link {
    text-align: center;
    margin-top: 8px;
}

.client-international-link a {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-decoration: none;
}

.client-international-link a:hover {
    color: var(--primary);
}

/* Duplicates warning */
.duplicates-warning {
    background: rgba(246, 194, 62, 0.15);
    border: 1px solid rgba(246, 194, 62, 0.4);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 10px;
    font-size: 0.75rem;
}

.duplicates-warning-title {
    font-weight: 500;
    color: #b38620;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.duplicates-warning-title svg {
    width: 14px;
    height: 14px;
}

.duplicates-warning-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.15s;
    border: 1px solid rgba(246, 194, 62, 0.3);
}

.duplicates-warning-item:last-child {
    margin-bottom: 0;
}

.duplicates-warning-item:hover {
    background: rgba(255, 255, 255, 0.9);
}


.duplicates-warning-section {
    margin-bottom: 8px;
}

.duplicates-warning-section:last-child {
    margin-bottom: 0;
}

.duplicates-warning-section-title {
    font-size: 0.6875rem;
    color: #b38620;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Подсветка совпадений */

.duplicate-match {
    color: #b38620;
    font-weight: 500;
    animation: duplicatePulse 1.5s ease-in-out infinite;
    background-color: rgba(246, 194, 62, 0.2);
    padding: 1px 4px;
    border-radius: 3px;
}

/* 100% совпадение - особое выделение */
.duplicates-full-match-container {
    border-color: #dc3545 !important;
    background-color: rgba(220, 53, 69, 0.08) !important;
}

.duplicates-warning-title.duplicates-full-match {
    color: #dc3545;
    font-weight: 700;
    font-size: 14px;
}

.duplicates-warning-title.duplicates-full-match svg {
    stroke: #dc3545;
}

.duplicates-warning-item-full {
    background-color: rgba(220, 53, 69, 0.15) !important;
    border: 2px solid #dc3545 !important;
    animation: flicker-red 1s ease-in-out infinite;
}

@keyframes flicker-red {
    0%, 100% {
        background-color: rgba(220, 53, 69, 0.15);
        border-color: rgba(220, 53, 69, 0.5);
    }
    50% {
        background-color: rgba(220, 53, 69, 0.25);
        border-color: rgba(220, 53, 69, 0.8);
    }
}

.duplicates-warning-item-address {
    display: block;
    font-size: 11px;
    color: #6c757d;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Новый формат отображения дубликата */
.duplicate-item-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 2px;
    font-size: 12px;
    line-height: 1.4;
}

.duplicate-item-row:last-child {
    margin-bottom: 0;
}

.duplicate-item-label {
    color: #6c757d;
    flex-shrink: 0;
    min-width: 45px;
}

.duplicate-item-value {
    color: #333;
    word-break: break-word;
}

@keyframes duplicatePulse {
    0%, 100% {
        opacity: 1;
        background: transparent;
    }
    50% {
        opacity: 1;
        background: rgba(246, 194, 62, 0.3);
        border-radius: 2px;
    }
}

/* DaData suggestions - prevent clipping in modals */
.client-modal,
.client-modal .modal-body,
.client-modal .data-block,
.client-modal .data-block-content,
.client-modal .int-form-content,
.client-modal .int-form-row,
.client-card-modal,
.client-card-modal .modal-body,
.client-card-modal .data-block,
.client-card-modal .data-block-content,
#create-client-modal .modal-content,
#create-client-modal .modal-body,
#create-client-modal .data-block,
#create-client-modal .data-block-content,
#create-client-modal .form-row,
#create-client-modal .form-group {
    overflow: visible !important;
}

/* DaData wrapper in client card (data-row structure: label 7rem + input) */
.client-card-modal .data-row .suggestions-wrapper {
    position: static !important;
}

/* DaData dropdown in client card positioned below input */
.client-card-modal .data-row .suggestions-suggestions {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    margin-top: 2px !important;
    z-index: 999999 !important;
}

/* Suggestions container - must be under the input */
.int-form-row {
    position: relative;
}

#create-client-modal .form-group {
    position: relative;
}

/* DaData suggestions positioning */
.suggestions-wrapper {
    position: absolute !important;
    z-index: 100000 !important;
}

/* For int-form-row (label on left) */
.int-form-row .suggestions-wrapper {
    top: 100% !important;
    left: 78px !important;
    right: 0 !important;
}

/* For regular form-group (label on top) - create client modal */
#create-client-modal .form-group .suggestions-wrapper {
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    margin-top: -4px !important;
}

.suggestions-suggestions {
    position: relative !important;
    z-index: 100000 !important;
    max-height: 200px !important;
    overflow-y: auto !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius) !important;
    background: var(--bg-white) !important;
    width: 100% !important;
}

.suggestions-suggestion {
    padding: 8px 12px !important;
    font-size: 0.8125rem !important;
}

.suggestions-suggestion-current {
    background: var(--primary-light) !important;
}

/* ========== INTERNATIONAL CLIENT FORM - Silva Style ========== */
.international-client-modal {
    max-width: 420px !important;
    max-height: 90vh;
    overflow-y: auto;
}

.international-client-modal .modal-body {
    padding: 12px;
}

.international-client-modal .data-block {
    margin-bottom: 10px;
}

.international-client-modal .data-block-header {
    padding: 6px 10px;
}

.international-client-modal .data-block-header h4 {
    font-size: 0.6875rem;
    letter-spacing: 0.03em;
}

.int-form-content {
    padding: 10px !important;
}

.int-form-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.int-form-row:last-child {
    margin-bottom: 0;
}

.int-form-label {
    width: 70px;
    flex-shrink: 0;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.int-form-input {
    flex: 1;
    height: 30px !important;
    padding: 0 8px !important;
    font-size: 0.8125rem !important;
    background: #fafafa !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-sm) !important;
}

.int-form-input:focus {
    border-color: var(--primary) !important;
    background: var(--bg-white) !important;
}

.int-form-input::placeholder {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.int-form-input[readonly] {
    background: #f0f0f0 !important;
    color: var(--text-secondary);
}

/* Translator row */
.int-translator-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.int-translator-arrow {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Validation error */
#create-international-client-validation-error {
    display: none;
    color: var(--danger);
    padding: 8px 10px;
    background: rgba(231, 74, 59, 0.1);
    border-radius: var(--radius);
    margin-bottom: 10px;
    font-size: 0.75rem;
}

/* Form footer */
.int-form-footer {
    padding-top: 8px;
}

.int-form-footer .btn {
    width: 100%;
    padding: 8px 16px;
    font-size: 0.8125rem;
}

textarea.form-input {
    min-height: 5rem;
    resize: vertical;
}

select.form-input {
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

.form-hint {
    margin-top: 0.25rem;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.form-group input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
    accent-color: var(--primary);
}

/* ========== DATA BLOCKS (Card sections) ========== */
.data-block {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    min-width: 0;
    box-sizing: border-box;
}

.data-block-header {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-light);
}

.data-block-header h4 {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--primary);
    text-transform: uppercase;
    flex: 1;
    margin: 0;
}

.data-block-content {
    padding: var(--space-3);
    overflow-x: hidden;
    min-width: 0;
    box-sizing: border-box;
}

.data-row {
    display: flex;
    padding: 0.375rem 0;
    border-bottom: 1px solid var(--border-light);
    min-width: 0;
    position: relative;
}

.data-row:last-child {
    border-bottom: none;
}

.data-label {
    width: 7rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.data-value {
    flex: 1;
    font-size: 0.8125rem;
    color: var(--text-primary);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Inline input - выглядит как текст, редактируется как поле */
.data-input-inline {
    flex: 1;
    font-size: 0.8125rem;
    color: var(--text-primary);
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    outline: none;
    font-family: inherit;
    min-width: 0;
}

.data-input-inline:read-only {
    cursor: default;
}

.data-input-inline:not(:read-only) {
    border-bottom: 1px solid var(--primary);
    background: rgba(40, 127, 113, 0.05);
}

.data-input-inline:focus {
    outline: none;
}

/* Select в inline режиме */
.data-select-inline {
    flex: 1;
    font-size: 0.8125rem;
    color: var(--text-primary);
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    font-family: inherit;
    min-width: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: default;
}

.data-select-inline:disabled {
    opacity: 1;
    color: var(--text-primary);
    pointer-events: none;
}

.data-select-inline:not(:disabled) {
    border-bottom: 1px solid var(--primary);
    background: rgba(40, 127, 113, 0.05);
    cursor: pointer;
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
    appearance: menulist;
}

.data-select-inline:focus {
    outline: none;
}

/* Поле ввода в режиме редактирования (как в desktop) */
.data-input {
    flex: 1;
    font-size: 0.8125rem;
    color: var(--text-primary);
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    padding: 0;
    margin: 0;
    outline: none;
    font-family: inherit;
}

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

.data-row-edit {
    position: relative;
    min-width: 0;
}

/* Edit buttons */
.btn-edit, .btn-save, .btn-cancel {
    width: 1.75rem;
    height: 1.75rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    margin-left: 0.25rem;
}

.btn-edit {
    background: transparent;
    color: var(--text-secondary);
}

.btn-edit:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.btn-save {
    background: var(--success);
    color: var(--text-inverse);
}

.btn-cancel {
    background: var(--bg-light);
    color: var(--text-secondary);
}

/* ========== FILE UPLOAD ZONE ========== */
.file-upload-zone {
    margin-top: var(--space-2);
}

.file-upload-area {
    width: 100%;
    min-height: 80px;
    padding: var(--space-3);
    border: 2px dashed var(--border-light);
    border-radius: var(--radius);
    background: #f5f5f5;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.file-upload-area:hover {
    border-color: #64B5F6;
    background: #e3f2fd;
}

.file-upload-area.drag-over {
    border-color: #64B5F6;
    background: #e3f2fd;
}

.file-upload-text {
    font-size: var(--font-size-sm);
    color: #666;
    margin: 0;
    text-align: center;
}

.file-upload-status {
    font-size: var(--font-size-xs);
    color: #999;
    margin: 0;
    text-align: center;
}

.file-upload-status.has-file {
    color: #4caf50;
}

.file-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.file-status-text {
    flex: 1;
    font-size: var(--font-size-xs);
}

.btn-icon {
    width: 1.75rem;
    height: 1.75rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    margin-left: 0.25rem;
    background: transparent;
    color: var(--text-secondary);
}

.btn-icon:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.btn-icon-delete:hover {
    color: var(--danger);
}

/* ========== CLIENT CARD MODAL ========== */
.client-card-modal {
    /* Silva style: карточка клиента, max 56rem (~896px) */
    max-width: min(56rem, 95vw) !important;
}

/* Модальные окна - переключение между ними */
.modal.show {
    cursor: pointer;
}

.modal.show .modal-content {
    cursor: default;
}

.client-card-body {
    padding: 0 !important;
}

.client-card-layout {
    display: grid;
    grid-template-columns: 15rem 1fr;
    min-height: 18rem;
}

.client-deals-panel {
    background: var(--bg-light);
    border-right: 1px solid var(--border-light);
    padding: 0.75rem;
    overflow-y: auto;
    max-height: 60vh;
}

.client-deals-panel h4 {
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: var(--space-3);
}

.client-data-panel {
    padding: 0.75rem;
    overflow-y: auto;
    max-height: 60vh;
}

.client-deal-item {
    position: relative;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    margin-bottom: 0.375rem;
    transition: all 0.2s;
    overflow: hidden;
}

.client-deal-item:hover {
    box-shadow: var(--shadow-sm);
}

.client-deal-status-line {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    border-radius: var(--radius) 0 0 var(--radius);
}

.client-deal-content {
    margin-left: 8px;
    padding: 5px 8px;
}

.client-deal-header {
    cursor: pointer;
    margin-bottom: 3px;
}

.client-deal-header:hover {
    opacity: 0.8;
}

.client-deal-header-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.client-deal-number {
    font-weight: 500;
    font-size: var(--font-size-xs);
    color: var(--text-primary);
    min-width: 55px;
}

.client-deal-date {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    min-width: 65px;
}

.client-deal-amount {
    font-weight: 500;
    font-size: var(--font-size-xs);
    color: var(--text-primary);
    margin-left: auto;
    text-align: right;
    min-width: 70px;
}

.client-deal-items-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px 0;
    transition: color 0.15s;
}

.client-deal-items-toggle:hover {
    color: var(--primary);
}

.client-deal-items-arrow {
    font-size: 10px;
    color: var(--text-tertiary);
    width: 22px;
    text-align: center;
    transition: color 0.15s;
}

.client-deal-items-toggle:hover .client-deal-items-arrow {
    color: var(--primary);
}

.client-deal-items-text {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    flex: 1;
    transition: color 0.15s;
}

/* В левой колонке заказов статус-бейдж чуть спокойнее и компактнее */
.client-deals-panel .status-badge {
    font-size: 0.6875rem;
    padding: 0.25rem 0.75rem;
}

.client-deal-items-list {
    margin-top: 4px;
    animation: slideDown 0.2s ease-out;
}

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

.client-deal-items-divider {
    width: 100%;
    height: 1px;
    background: var(--border-light);
    margin-bottom: 4px;
}

.client-deal-item-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 1px 0;
    min-height: 20px;
}

.client-deal-item-name {
    font-size: 0.6875rem;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-deal-item-delivery .client-deal-item-name {
    color: var(--text-secondary);
}

.client-deal-item-quantity {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    min-width: 28px;
    text-align: right;
}

.client-deal-item-total {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 60px;
    text-align: right;
}

.client-deal-info {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

/* ========== DEAL CARD MODAL ========== */
.deal-card-modal {
    /* Базовая ширина без отслеживания: 56rem (~896px), но не больше 95vw - Silva style */
    max-width: min(56rem, 95vw) !important;
    width: min(56rem, 95vw) !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    box-sizing: border-box !important;
}

/* Карточка с трек-номером: компактная как клиент (56rem = ~896px) */
.modal-content.deal-card-modal.with-tracking,
.deal-card-modal.with-tracking {
    max-width: min(56rem, 95vw) !important;
    width: min(56rem, 95vw) !important;
}

#deal-content-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    display: flex !important;
    gap: 15px !important;
    align-items: flex-start !important;
}

#deal-main-content {
    flex: 1 1 56rem !important;
    min-width: 0 !important;
    max-width: 56rem !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    box-sizing: border-box !important;
}

/* При трек-номере модалка расширяется, и основной контент должен использовать ширину (не быть зажатым в 56rem) */
.deal-card-modal.with-tracking #deal-main-content {
    flex: 1 1 auto !important;
    max-width: none !important;
}

#deal-tracking-block {
    flex: 0 0 350px !important;
    min-width: 0 !important;
    max-width: 350px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
}

.deal-items-list {
    /* Список товаров - отступы наследуются от .data-block-content (padding: var(--space-3) = 1rem) */
    /* Список сам по себе не имеет padding, чтобы не дублировать отступы */
    display: block;
}

.deal-item-row,
.deal-item-row.view-mode {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem !important;
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}

.deal-item-row:last-child {
    margin-bottom: 0;
}

/* Убеждаемся, что контейнер товаров имеет правильные отступы */
#deal-items-view.data-block-content {
    padding: var(--space-3);
    overflow-x: hidden;
    min-width: 0;
    box-sizing: border-box;
}

.deal-item-name-block {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.deal-item-name {
    font-size: var(--font-size-sm);
    font-weight: 400;
    color: var(--text-primary);
}

.deal-item-generic-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.deal-item-qty,
.deal-item-quantity {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin: 0 1rem;
}

.deal-item-price,
.deal-item-total {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--primary);
}

.deal-item-delivery {
    background: rgba(54, 185, 204, 0.1);
    border-color: rgba(54, 185, 204, 0.3);
}

.deal-item-delivery .deal-item-name,
.deal-item-delivery .deal-item-price {
    color: var(--info);
}

/* ========== PAGINATION ========== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: var(--space-3);
    padding: 0.75rem var(--space-2);
}

.pagination .btn {
    padding: 0.25rem 0.5rem;
    font-size: var(--font-size-xs);
    min-width: 2rem;
    transition: all 0.2s ease;
}

.pagination .btn:not(:disabled):hover {
    transform: scale(1.05);
}

.pagination .btn svg {
    width: 14px;
    height: 14px;
}

#clients-page-info,
#deals-page-info,
#products-page-info,
#leads-page-info {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 3.5rem;
    text-align: center;
}

.pagination-per-page {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 0.75rem;
}

.pagination-per-page-label {
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
}

.pagination-per-page .form-input {
    width: auto;
    min-width: 3.5rem;
    padding: 0.25rem 0.5rem;
    font-size: var(--font-size-xs);
}

/* ========== TOAST NOTIFICATIONS - Silva Style ========== */
#toast-container {
    position: fixed;
    top: calc(var(--header-height) + var(--space-3));
    right: var(--space-4);
    z-index: 11000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
    max-width: min(24rem, calc(100vw - var(--sidebar-width) - 3rem));
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: auto;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    border-left: 4px solid var(--primary);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.hiding {
    transform: translateX(120%);
    opacity: 0;
}

.toast-icon {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-icon svg {
    width: 0.875rem;
    height: 0.875rem;
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--text-dark);
    margin-bottom: 0.125rem;
}

.toast-message {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.4;
    word-wrap: break-word;
}

.toast-close {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
    margin: -0.25rem -0.25rem -0.25rem 0;
}

.toast-close:hover {
    background: var(--bg-light);
    color: var(--text-secondary);
}

.toast-close svg {
    width: 1rem;
    height: 1rem;
}

/* Success toast */
.toast.success {
    border-left-color: var(--success);
}

.toast.success .toast-icon {
    background: rgba(28, 200, 138, 0.15);
    color: var(--success);
}

.toast.success .toast-title {
    color: #0f6848;
}

/* Error toast */
.toast.error {
    border-left-color: var(--danger);
}

.toast.error .toast-icon {
    background: rgba(231, 74, 59, 0.15);
    color: var(--danger);
}

.toast.error .toast-title {
    color: #9e2a1e;
}

/* Warning toast */
.toast.warning {
    border-left-color: var(--warning);
}

.toast.warning .toast-icon {
    background: rgba(246, 194, 62, 0.15);
    color: #b7791f;
}

.toast.warning .toast-title {
    color: #7a4b00;
}

/* Info toast */
.toast.info {
    border-left-color: var(--info);
}

.toast.info .toast-icon {
    background: rgba(54, 185, 204, 0.15);
    color: var(--info);
}

.toast.info .toast-title {
    color: #1a6d7d;
}

/* Mobile responsive */
@media (max-width: 768px) {
    #toast-container {
        left: var(--space-2);
        right: var(--space-2);
        max-width: none;
    }
}

/* ========== CONFIRM MODAL - Silva Style ========== */
.confirm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 12000;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.confirm-modal.show {
    display: flex;
    opacity: 1;
}

.confirm-modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.2s ease;
}

.confirm-modal.show .confirm-modal-content {
    transform: scale(1);
}

.confirm-modal-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-modal-icon svg {
    width: 2rem;
    height: 2rem;
}

.confirm-modal-icon.danger {
    background: rgba(231, 74, 59, 0.12);
    color: var(--danger);
}

.confirm-modal-icon.warning {
    background: rgba(246, 194, 62, 0.15);
    color: #b7791f;
}

.confirm-modal-icon.info {
    background: rgba(54, 185, 204, 0.15);
    color: var(--info);
}

.confirm-modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
}

.confirm-modal-message {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1.5rem;
    white-space: pre-line;
}

.confirm-modal-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.confirm-modal-buttons .btn {
    min-width: 100px;
    padding: 0.625rem 1.25rem;
}

/* ========== COMBO BADGE ========== */
.combo-badge-preview {
    position: absolute;
    top: 0.25rem;
    left: 0.25rem;
    background: rgba(40, 127, 113, 0.14);
    color: var(--primary);
    font-size: 0.6rem;
    font-weight: 500;
    padding: 0.1rem 0.35rem;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    z-index: 2;
}

/* ========== DEAL ITEM ROWS (combo view + deal edit) ========== */
#combo-items-list-view .deal-item-row,
#deal-items-edit .deal-item-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: var(--font-size-sm);
}

#combo-items-list-view .deal-item-name,
#deal-items-edit .deal-item-name {
    flex: 1;
    color: var(--text-dark);
}

#combo-items-list-view .deal-item-qty,
#deal-items-edit .deal-item-qty {
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
}

#combo-items-list-view .deal-item-price {
    color: var(--primary);
    font-weight: 500;
}

/* Deal items edit - новый стиль карточек */
#deal-items-edit .deal-item-row {
    background: #fff;
    border: 1px solid #e3e6f0;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
    display: grid;
    grid-template-columns: 1fr 110px 110px 110px auto;
    gap: 10px;
    align-items: end;
    transition: box-shadow 0.2s;
}

#deal-items-edit .deal-item-row:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

#deal-items-edit .deal-item-field {
    display: flex;
    flex-direction: column;
}

#deal-items-edit .deal-item-field label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 3px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

#deal-items-edit .deal-item-field select,
#deal-items-edit .deal-item-field input {
    width: 100%;
    font-size: 13px;
    padding: 6px 10px;
}

#deal-items-edit .deal-item-total {
    font-weight: 600;
    color: var(--primary);
    font-size: 13px;
    white-space: nowrap;
    padding-top: 20px;
}

#deal-items-edit .btn-remove-item {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background 0.2s;
    margin-top: 20px;
}

#deal-items-edit .btn-remove-item:hover {
    background: #c82333;
}

/* ========== TABS ========== */
.tabs-container {
    display: flex;
    gap: 0;
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    padding: 0.75rem var(--space-3);
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 400;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
    margin-bottom: -1px;
}

.tab-btn:hover {
    color: var(--text-dark);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

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

/* ========== UTILITIES ========== */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--text-secondary) !important; }

.font-bold { font-weight: 500 !important; }

/* ========== OVERLAY для мобильного меню ========== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ========== RESPONSIVE ========== */
/* Средние экраны - вертикальная компоновка для карточки заказа если не хватает места */
@media (max-width: 1200px) {
    .deal-card-modal.with-tracking #deal-content-wrapper {
        flex-direction: column !important;
    }
    
    .deal-card-modal.with-tracking #deal-main-content {
        flex: 1 1 auto !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }
    
    .deal-card-modal.with-tracking #deal-tracking-block {
        flex: 1 1 auto !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }
}

@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
        z-index: 1000;
    }
    
    .admin-sidebar.open {
        transform: translateX(0);
    }
    
    .admin-header {
        left: 0;
    }
    
    .admin-main {
        margin-left: 0;
        width: 100%;
        padding: var(--space-2);
    }

    .message {
        left: var(--space-2);
        right: var(--space-2);
        width: calc(100vw - (2 * var(--space-2)));
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
    }
    
    .section-header > div {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-2);
    }
    
    .section-header .btn {
        flex: 1;
        min-width: 120px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .client-card-layout {
        grid-template-columns: 1fr;
    }
    
    .client-deals-panel {
        border-right: none;
        border-bottom: 1px solid var(--border-light);
        max-height: 15rem;
    }
    
    /* Фильтры статусов - перенос на новую строку */
    .status-filters {
        gap: 0.375rem;
        margin-bottom: var(--space-3);
    }
    
    .status-filter {
        font-size: var(--font-size-xs);
        padding: 0.25rem 0.5rem;
        white-space: nowrap;
    }
    
    /* Панель фильтров - вертикальная на мобильных */
    .filters-bar {
        flex-direction: column;
        gap: var(--space-2);
    }
    
    .filter-input,
    .filter-select {
        width: 100%;
    }
    
    /* Горизонтальный скролл для таблиц на мобильных */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 calc(-1 * var(--space-2));
        padding: 0 var(--space-2);
    }
    
    /* Минимальная ширина таблицы, чтобы все колонки помещались */
    .table-compact {
        min-width: 600px;
    }
    
    /* Закрепляем колонку "Действия" справа на мобильных для лучшей видимости */
    .table-compact th:last-child,
    .table-compact td:last-child {
        position: sticky;
        right: 0;
        background: var(--bg-white);
        box-shadow: -2px 0 4px rgba(0, 0, 0, 0.1);
        z-index: 10;
    }
    
    .table-compact thead th:last-child {
        background: var(--bg-light);
    }
    
    .table-compact tbody tr:hover td:last-child {
        background: var(--bg-light);
    }
    
    /* Модальные окна на мобильных */
    .modal {
        padding: var(--space-2);
        padding-top: 2vh;
    }
    
    .modal-content {
        max-width: 100%;
        max-height: 90vh;
        margin: 0;
    }
    
    /* Уменьшаем ширину меток в data-row на мобильных */
    .data-label {
        width: 6rem;
        font-size: var(--font-size-xs);
    }
    
    .data-value {
        font-size: var(--font-size-xs);
    }
    
    /* Кнопки в футере модальных окон */
    .modal-footer {
        flex-wrap: wrap;
    }
    
    .modal-footer .btn {
        flex: 1;
        min-width: 100px;
    }
    
    /* Карточки клиентов и заказов */
    .client-card-modal,
    .deal-card-modal {
        max-width: 95vw !important;
        width: 95vw !important;
    }
    
    .deal-card-modal.with-tracking {
        max-width: 95vw !important;
        width: 95vw !important;
    }
    
    #deal-main-content {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }
    
    #deal-tracking-block {
        width: 100% !important;
    }
    
    /* Пагинация */
    .pagination {
        flex-wrap: wrap;
        gap: var(--space-1);
    }
    
    .pagination .btn {
        min-width: 40px;
        padding: 0.375rem 0.5rem;
    }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 0.375rem;
    height: 0.375rem;
}

::-webkit-scrollbar-track {
    background: var(--bg-light);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========================================
   TRACKING META (данные отправления)
======================================== */

.tracking-meta {
    margin-bottom: 12px;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    line-height: 1.6;
}

.tracking-meta-row {
    padding: 1px 0;
}

.tracking-meta-label {
    color: var(--text-tertiary);
}

/* ========================================
   TRACKING TIMELINE (как на Почте России)
======================================== */

.tracking-timeline {
    position: relative;
    margin-top: 8px;
}

.tracking-timeline::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #287f71;
}

.tracking-timeline-item {
    position: relative;
    margin-bottom: 20px;
    padding-left: 24px;
}

.tracking-timeline-item:last-child {
    margin-bottom: 0;
}

.tracking-timeline-item-latest {
    background: rgba(40, 127, 113, 0.05);
    padding: 8px 12px 8px 36px; /* Увеличиваем padding-left для отступа от кружочка */
    border-radius: 4px;
    margin-left: -12px;
    margin-right: -12px;
}

.tracking-timeline-dot {
    position: absolute;
    left: 6px; /* Центр линии (5px + 2px/2 = 6px) */
    top: 50%;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #287f71;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px #287f71;
    z-index: 2;
    transform: translate(-50%, -50%);
}

.tracking-timeline-item-latest .tracking-timeline-dot {
    background: #287f71;
    box-shadow: 0 0 0 2px #287f71, 0 0 0 4px rgba(40, 127, 113, 0.2);
    width: 14px;
    height: 14px;
    /* Компенсируем margin-left: -12px родителя */
    left: 18px; /* 6px + 12px */
    transform: translate(-50%, -50%);
}

.tracking-timeline-content {
    background: transparent;
    padding: 0;
}

.tracking-timeline-item-latest .tracking-timeline-content {
    padding-left: 0;
    margin-left: 0;
}

.tracking-timeline-status {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.4;
}

.tracking-timeline-date {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    margin-bottom: 2px;
    line-height: 1.4;
}

.tracking-timeline-address {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    line-height: 1.4;
}

/* ========== ADMIN FOOTER ========== */
.admin-footer {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
    padding: 0.5rem 1.5rem;
    z-index: 100;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.05);
}

.footer-content {
    max-width: 1000px;
    margin: 0 auto;
}

.global-search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.global-search-input {
    width: 100%;
    padding: 0.5rem 2rem 0.5rem 2rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    transition: all 0.2s;
    background: var(--bg-white);
    color: var(--text-primary);
    font-family: var(--font-family);
}

.global-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.global-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #dee2e6;
    border: none;
    color: #495057;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    border-radius: 50%;
    padding: 0;
    display: none;
}

.global-search-clear.visible {
    display: block;
}

.global-search-clear:hover {
    background: var(--danger);
    color: white;
}

.global-search-container .search-icon {
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    pointer-events: none;
}

.global-search-results {
    position: absolute;
    bottom: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-height: 450px;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
}

.global-search-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-light);
    padding: 0;
    margin: 0;
    flex-shrink: 0;
}

.global-search-tab {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
    position: relative;
    font-family: var(--font-family);
}

.global-search-tab:hover {
    color: var(--text-primary);
    background: var(--bg-white);
}

.global-search-tab.active {
    color: var(--primary);
    background: var(--bg-white);
    border-bottom-color: var(--primary);
}

.global-search-tab-count {
    margin-left: 0.25rem;
    color: var(--text-muted);
    font-size: var(--font-size-xs);
}

.global-search-tab.active .global-search-tab-count {
    color: var(--primary);
}

.global-search-tab-goto {
    margin-left: 6px;
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0;
    transition: all 0.2s;
    padding: 2px 4px;
    border-radius: 3px;
}

.global-search-tab:hover .global-search-tab-goto {
    opacity: 1;
}

.global-search-tab-goto:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.global-search-tab-content {
    display: none;
    flex-direction: column;
    max-height: 350px;
    overflow-y: auto;
}

.global-search-tab-content.active {
    display: flex;
}

.global-search-result-item {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.global-search-result-item:last-child {
    border-bottom: none;
}

.global-search-result-item:hover {
    background: var(--primary-light);
}

.global-search-result-item .result-icon {
    width: 18px;
    height: 18px;
    color: var(--primary);
    flex-shrink: 0;
}

.global-search-result-item .result-content {
    flex: 1;
    min-width: 0;
}

.global-search-result-item .result-title {
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.125rem;
    font-size: var(--font-size-sm);
}

.global-search-result-item .result-subtitle {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.global-search-no-results {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

/* Отступ для контента, чтобы footer не перекрывал */
.admin-main {
    padding-bottom: 60px;
}

@media (max-width: 768px) {
    .admin-footer {
        left: 0;
        padding: 0.5rem 1rem;
    }
    
    .global-search-results {
        max-height: 350px;
    }
    
    .global-search-tab-content {
        max-height: 280px;
    }
}

/* ===== LEADS STYLES ===== */
.lead-drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-light);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    min-height: 100px;
    transition: border-color 0.2s;
}

.lead-drop-zone:hover,
.lead-drop-zone.drag-over {
    border-color: var(--primary);
}

.lead-zone-icon {
    width: 32px;
    height: 32px;
    color: var(--text-muted);
    opacity: 0.4;
}

.lead-zone-text {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.lead-drop-zone.has-content .lead-zone-icon,
.lead-drop-zone.has-content .lead-zone-text {
    display: none;
}

.lead-drop-zone textarea {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    resize: none;
    padding: 16px;
    padding-right: 36px;
    font-size: var(--font-size-sm);
    line-height: 1.5;
    color: transparent;
    caret-color: var(--text-dark);
}

.lead-drop-zone.has-content textarea {
    color: var(--text-dark);
    background: var(--bg-light);
}

.lead-drop-zone textarea:focus {
    outline: none;
}

.lead-clear-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: var(--bg-hover);
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 10;
    transition: background 0.2s;
}

.lead-clear-btn svg {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

.lead-clear-btn:hover {
    background: var(--border-color);
}

.lead-clear-btn:hover svg {
    color: var(--text-dark);
}

.lead-drop-zone.has-content .lead-clear-btn {
    display: flex;
}

#lead-image-preview {
    display: none;
    width: 100%;
    text-align: center;
    position: relative;
    z-index: 5;
}

#lead-image-preview img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 8px;
}

.leads-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    padding: 6px 12px;
    background: var(--bg-light);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.leads-stats .stats-item strong {
    color: var(--primary);
}

.leads-stats .stats-divider {
    color: var(--border-color);
}

/* Lead probability badges */
.lead-probability {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: var(--font-size-xs);
    font-weight: 500;
}

.lead-probability.likely {
    background: rgba(28, 200, 138, 0.1);
    color: var(--success);
}

.lead-probability.unlikely {
    background: rgba(231, 74, 59, 0.1);
    color: var(--danger);
}

.lead-probability.researching {
    background: rgba(246, 194, 62, 0.1);
    color: var(--warning);
}

/* Lead probability badges - new style */
.lead-prob {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: var(--font-size-xs);
    font-weight: 500;
}

.lead-prob.prob-likely {
    background: rgba(28, 200, 138, 0.15);
    color: var(--success);
}

.lead-prob.prob-unlikely {
    background: rgba(231, 74, 59, 0.15);
    color: var(--danger);
}

.lead-prob.prob-researching {
    background: rgba(246, 194, 62, 0.15);
    color: var(--warning);
}

.lead-prob.prob-unknown {
    color: var(--text-muted);
}

.lead-prob.prob-placed {
    background: rgba(78, 115, 223, 0.15);
    color: rgba(78, 115, 223, 1);
}

/* Lead checkmarks */
.lead-check {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 20px;
    height: 20px;
}

.lead-check.checked svg {
    color: var(--success);
}

/* Lead products block */
.lead-products-block {
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--bg-light);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.lead-products-found {
    font-size: var(--font-size-sm);
    color: var(--success);
}

.lead-products-section {
    margin-bottom: 4px;
}

.lead-products-section:last-child {
    margin-bottom: 0;
}

.lead-products-section strong {
    color: var(--primary);
}

.lead-no-products {
    color: var(--danger);
    font-size: var(--font-size-sm);
}

/* Lead product item (selectable) */
.lead-product-item {
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 1px 4px;
    border-radius: 3px;
    color: #999;
    text-decoration: line-through;
}

.lead-product-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.lead-product-item.selected {
    color: var(--success);
    text-decoration: none;
    background: rgba(40, 167, 69, 0.1);
}

.lead-product-item.selected:hover {
    background: rgba(40, 167, 69, 0.2);
}

/* Lead client block */
.lead-client-block {
    margin-top: 6px;
    font-size: var(--font-size-sm);
}

.lead-client-found {
    color: var(--success);
}

.lead-client-found a {
    color: var(--primary);
    text-decoration: underline;
}

/* Lead modal styles */
#lead-modal .modal-content {
    max-width: 600px;
}

#lead-modal .data-block {
    margin-bottom: 12px;
}

#lead-modal .data-block-header {
    padding: 8px 12px;
}

#lead-modal .data-block-header h4 {
    font-size: 0.75rem;
    letter-spacing: 0.03em;
    margin: 0;
}

#lead-modal .data-block-content {
    padding: 12px;
}

#lead-modal .form-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

#lead-modal .form-input {
    font-size: 0.8125rem;
    padding: 8px 10px;
}

#lead-modal .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Lead status checkboxes */
.lead-status-row {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.lead-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--text-dark);
}

.lead-checkbox-label:hover {
    color: var(--primary);
}

.lead-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.lead-client-found a:hover {
    color: var(--primary-dark);
}

.lead-client-not-found {
    color: var(--text-muted);
    font-style: italic;
}

/* Leads table */
#section-leads .table-compact {
    table-layout: fixed;
    font-size: 12px;
}

#section-leads .table-compact th,
#section-leads .table-compact td {
    padding: 8px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#section-leads .table-compact tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

#section-leads .table-compact tbody tr:hover {
    background: var(--bg-light);
}

/* Cell helpers */
.cell-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-nowrap {
    white-space: nowrap;
}

.cell-center {
    text-align: center;
}

/* Sortable headers */
#section-leads th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 16px !important;
}

#section-leads th.sortable:hover {
    background: rgba(40, 127, 113, 0.08);
}

#section-leads th.sortable.sorted {
    color: var(--primary);
}

#section-leads th .sort-arrow {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    opacity: 0.8;
}

/* ========================================
   Форма создания заказа - Silva Style
   ======================================== */
.create-deal-modal-content {
    max-width: min(42rem, 95vw) !important;
}

#create-deal-modal .modal-body {
    overflow-y: visible;
}

#create-deal-modal .form-group {
    margin-bottom: var(--space-3);
}

#create-deal-modal .form-label {
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-1);
    font-weight: 500;
    color: var(--text-secondary);
}

#create-deal-modal .form-input {
    padding: var(--space-2);
    font-size: var(--font-size-base);
}

#create-deal-product-search {
    margin-bottom: var(--space-2);
}

.create-deal-selected-section {
    margin-top: var(--space-3);
}

.create-deal-selected-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
    font-weight: 500;
}

.create-deal-submit {
    width: 100%;
    padding: var(--space-2);
    font-size: var(--font-size-base);
    margin-top: var(--space-3);
}

.create-deal-list {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: var(--space-2);
    background: var(--bg-white);
}

.create-deal-selected {
    min-height: 50px;
    max-height: 120px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: var(--space-2);
    background: var(--bg-light);
}

.create-deal-placeholder {
    text-align: center;
    padding: var(--space-3);
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    margin: 0;
}

.create-deal-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--primary-light);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-weight: 500;
}

.create-deal-total span:last-child {
    color: var(--primary);
}

.create-deal-error {
    display: none;
    color: var(--danger);
    padding: 0.5rem;
    background: rgba(231, 74, 59, 0.1);
    border-radius: var(--radius);
    margin-top: 0.5rem;
    font-size: 0.75rem;
}

/* Карточки комбо/товаров в списке выбора */
.create-deal-list .combo-card,
.create-deal-list .product-select-card {
    padding: var(--space-2);
    margin-bottom: var(--space-1);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    font-size: var(--font-size-sm);
}

.create-deal-list .combo-card:hover,
.create-deal-list .product-select-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.create-deal-list .combo-card.selected,
.create-deal-list .product-select-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.create-deal-list .combo-card:last-child,
.create-deal-list .product-select-card:last-child {
    margin-bottom: 0;
}

/* Выбранные позиции в создании заказа */
.selected-combo-group {
    padding: var(--space-2);
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    margin-bottom: var(--space-1);
    font-size: var(--font-size-base);
}

.selected-product-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2);
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    margin-bottom: var(--space-1);
    font-size: var(--font-size-base);
}

/* Счетчик количества */
.qty-control {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
}

.qty-control button {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--bg-light);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: var(--font-size-base);
    line-height: 1;
    padding: 0;
    font-weight: 500;
}

.qty-control button:hover {
    background: var(--bg-hover);
}

.qty-control input {
    width: 40px;
    height: 28px;
    text-align: center;
    border: none;
    font-size: var(--font-size-base);
    border-left: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
    font-size: 10px;
    padding: 0;
    -moz-appearance: textfield;
}

.qty-control input::-webkit-outer-spin-button,
.qty-control input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Переключатель Комбо/Товары */
.deal-type-switcher {
    display: flex;
    gap: var(--space-1);
    margin-bottom: var(--space-3);
    background: var(--bg-light);
    padding: 4px;
    border-radius: var(--radius);
}

.deal-type-switcher button {
    flex: 1;
    padding: var(--space-2);
    font-size: var(--font-size-sm);
    border-radius: calc(var(--radius) - 2px);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 500;
}

.deal-type-switcher button:hover {
    color: var(--text-primary);
}

.deal-type-switcher button.active {
    background: var(--primary);
    color: white;
}

/* ========== USER AVATAR STYLES ========== */
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
    overflow: hidden;
    flex-shrink: 0;
}

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

.user-avatar-initials {
    background: linear-gradient(135deg, var(--primary), #1e6f65);
}

#section-users .table-compact td:first-child {
    width: 50px;
    padding-right: 8px;
}

/* Стили для загрузки аватара в модальном окне */
.avatar-upload-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: #fafafa;
    border-radius: 8px;
    margin-bottom: 20px;
}

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

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

.avatar-upload-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.avatar-upload-btn:hover {
    background: #f8f9fc;
    border-color: var(--primary);
}

.avatar-upload-btn input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    cursor: pointer;
}
