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

.support-chat-wrap {
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color, #e2e6ef);
    background: #fff;
}

.support-chat-main-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color, #e2e6ef);
    padding-bottom: 8px;
}

.support-chat-main-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    background: transparent;
    font: inherit;
    font-weight: 600;
    color: var(--text-secondary, #5c6473);
    cursor: pointer;
    border-radius: 8px;
}

.support-chat-main-tab:hover {
    background: #f8f9fc;
    color: var(--text-primary, #1a1d26);
}

.support-chat-main-tab.active {
    color: var(--primary, #287f71);
    background: rgba(40, 127, 113, 0.08);
}

.support-chat-config-error {
    color: #c0392b;
    margin-bottom: 12px;
}

.support-chat-session-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    max-height: 120px;
    overflow-y: auto;
}

.support-chat-session-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid var(--border-color, #e2e6ef);
    border-radius: 8px;
    background: #f8f9fc;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    max-width: 100%;
}

.support-chat-session-tab:hover {
    border-color: var(--primary, #287f71);
    background: #f1f5f4;
}

.support-chat-session-tab.active {
    border-color: var(--primary, #287f71);
    background: rgba(40, 127, 113, 0.12);
    color: var(--primary, #287f71);
    font-weight: 600;
}

.support-chat-session-tab.selected {
    border-color: #d98880;
    background: rgba(192, 57, 43, 0.07);
}

.support-chat-session-tab.selected::before {
    content: "✓";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    margin-right: 2px;
    border-radius: 4px;
    background: #c0392b;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    flex: 0 0 auto;
}

.support-chat-session-tab.selected.active {
    border-color: var(--primary, #287f71);
    background: rgba(40, 127, 113, 0.12);
}

.support-chat-session-tab .sid-short {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}

.support-chat-log, #sc-widget-log-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    min-height: 32px;
}

.support-chat-log, #sc-widget-log-toolbar-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #5c6473);
}

.support-chat-tabs-hint {
    margin: -4px 0 10px;
    font-size: 11px;
    color: var(--text-secondary, #9aa1ad);
    line-height: 1.3;
}

.support-chat-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.support-chat-btn-delete-all {
    padding: 0.25rem 0.6rem;
    font: inherit;
    font-size: 12px;
    border: 1px solid #e0b4ae;
    border-radius: 8px;
    background: #fff;
    color: #b03a2e;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.support-chat-btn-delete-all:hover:not(:disabled) {
    background: rgba(192, 57, 43, 0.07);
    border-color: #c0392b;
    color: #a93226;
}

.support-chat-btn-delete-all:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.support-chat-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border-color, #e2e6ef);
    border-radius: 8px;
    background: #fff;
    color: var(--text-secondary, #5c6473);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.support-chat-close-btn:hover:not(:disabled) {
    background: rgba(192, 57, 43, 0.06);
    border-color: rgba(192, 57, 43, 0.35);
    color: #a93226;
}

.support-chat-close-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.support-chat-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.05rem;
    height: 1.05rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    margin-left: 4px;
    line-height: 1;
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--primary, #287f71);
    background: rgba(40, 127, 113, 0.08);
    border: 1px solid rgba(40, 127, 113, 0.22);
}

.support-chat-log, #sc-widget-log {
    min-height: 280px;
    max-height: 480px;
    overflow-y: auto;
    padding: 12px;
    border: 1px solid var(--border-color, #e2e6ef);
    border-radius: 8px;
    background: #fafafa;
    font-size: 14px;
    line-height: 1.45;
}

.support-chat-typing {
    margin: 0 0 8px;
    padding: 0 4px;
    font-size: 13px;
    color: var(--text-secondary, #5c6473);
    font-style: italic;
}

.support-chat-log, #sc-widget-log .sc-line {
    margin-bottom: 8px;
    word-break: break-word;
}

.support-chat-log, #sc-widget-log .sc-line.sys {
    color: var(--text-secondary, #5c6473);
    font-size: 13px;
}

.support-chat-log, #sc-widget-log .sc-msg {
    display: block;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid transparent;
}

.support-chat-log, #sc-widget-log .sc-msg-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
    opacity: 0.75;
}

.support-chat-log, #sc-widget-log .sc-msg-time {
    font-size: 10px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0.02em;
    opacity: 0.7;
    white-space: nowrap;
    margin-left: 12px;
}

.support-chat-log, #sc-widget-log .sc-msg-body {
    display: block;
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
}

.support-chat-log, #sc-widget-log .sc-msg-meta {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary, #5c6473);
}

.support-chat-log, #sc-widget-log .sc-msg-client {
    background: rgba(40, 127, 113, 0.07);
    border-color: rgba(40, 127, 113, 0.2);
    color: var(--text-primary, #1a1d26);
}

.support-chat-log, #sc-widget-log .sc-msg-client .sc-msg-label {
    color: var(--primary, #287f71);
    opacity: 1;
}

.support-chat-log, #sc-widget-log .sc-msg-operator {
    background: rgba(92, 100, 115, 0.06);
    border-color: rgba(92, 100, 115, 0.14);
}

.support-chat-log, #sc-widget-log .sc-msg-operator .sc-msg-label {
    color: var(--text-secondary, #5c6473);
    opacity: 1;
}

.support-chat-log, #sc-widget-log .sc-auto-wrap {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(40, 127, 113, 0.18);
    background: rgba(248, 250, 252, 0.95);
}

.support-chat-log, #sc-widget-log .sc-msg-auto {
    background: rgba(40, 127, 113, 0.06);
    border-color: rgba(40, 127, 113, 0.16);
}

.support-chat-log, #sc-widget-log .sc-auto-subhead {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 10px;
    margin-bottom: 4px;
    color: var(--text-secondary, #5c6473);
}

.support-chat-log, #sc-widget-log .sc-auto-subhead:first-of-type {
    margin-top: 8px;
}

.support-chat-log, #sc-widget-log .sc-auto-faq-q {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #1a1d26);
    margin-bottom: 4px;
}

.support-chat-log, #sc-widget-log .sc-auto-faq-a {
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-primary, #1a1d26);
}

.support-chat-log, #sc-widget-log .sc-auto-search {
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-primary, #1a1d26);
}

.support-chat-input-row {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.support-chat-input-row .form-input {
    flex: 1;
    min-width: 160px;
}

.support-chat-sessions-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary, #5c6473);
}

.support-chat-muted {
    color: var(--text-secondary, #5c6473);
}

.support-chat-orders-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    font-size: 14px;
    color: var(--text-secondary, #5c6473);
}

.support-chat-order-modal-content {
    max-width: 520px;
    width: calc(100% - 32px);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.support-chat-order-modal-content .modal-body {
    overflow-y: auto;
    flex: 1;
}

.support-chat-order-compact {
    font-size: 14px;
    line-height: 1.45;
}

.support-chat-order-loading {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary, #5c6473);
}

.support-chat-order-crm-match {
    margin: 0 0 14px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid rgba(40, 127, 113, 0.28);
    background: rgba(40, 127, 113, 0.06);
}

.support-chat-order-crm-match .support-chat-order-k {
    margin: 0 0 10px;
}

.support-chat-order-crm-item {
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(40, 127, 113, 0.15);
}

.support-chat-order-crm-item:last-child {
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: none;
}

.support-chat-order-crm-item-main {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.support-chat-order-crm-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary, #1a1d26);
}

.support-chat-order-crm-id {
    font-size: 13px;
    color: var(--text-secondary, #5c6473);
}

.support-chat-order-crm-sub {
    font-size: 13px;
    color: var(--text-secondary, #5c6473);
    margin-bottom: 4px;
    word-break: break-word;
}

.support-chat-order-crm-reason {
    font-size: 12px;
    color: var(--text-secondary, #5c6473);
    margin-bottom: 8px;
}

.support-chat-order-crm-open {
    margin-top: 2px;
}

.support-chat-order-meta-line {
    margin: 0 0 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color, #e2e6ef);
    font-size: 13px;
    color: var(--text-secondary, #5c6473);
}

.support-chat-order-compact .support-chat-order-line {
    margin: 0 0 10px;
}

.support-chat-order-compact .support-chat-order-k {
    color: var(--text-secondary, #5c6473);
    font-weight: 600;
    font-size: 13px;
}

.support-chat-order-more {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color, #e2e6ef);
}

.support-chat-order-more summary {
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary, #5c6473);
    user-select: none;
}

.support-chat-order-more-body {
    margin-top: 12px;
}

.support-chat-order-pre {
    font-size: 11px;
    line-height: 1.35;
    max-height: 200px;
    overflow: auto;
    margin: 0;
    padding: 10px 12px;
    background: #f4f5f8;
    border-radius: 8px;
    border: 1px solid var(--border-color, #e2e6ef);
}

.support-chat-order-pre-small {
    max-height: 100px;
    font-size: 11px;
}

.support-chat-order-items-table {
    width: 100%;
    font-size: 13px;
}

.support-chat-order-items-table td {
    padding: 6px 8px 6px 0;
    vertical-align: top;
}

.support-chat-order-items-table td:last-child {
    white-space: nowrap;
    width: 3rem;
}

tr.support-chat-order-row {
    cursor: pointer;
    transition: background 0.12s ease;
}
/* --- Chat order modal (sco-) --- */
.sco-wrap { font-size: 14px; line-height: 1.5; }

.sco-meta {
    margin: 0 0 12px;
    font-size: 12px;
    color: var(--text-secondary, #5c6473);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color, #e2e6ef);
}

.sco-client-link {
    color: var(--primary, #287f71);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.sco-client-link:hover { text-decoration: underline; text-underline-offset: 2px; }

.sco-field {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
}

.sco-label {
    flex-shrink: 0;
    width: 90px;
    color: var(--text-secondary, #5c6473);
    font-weight: 500;
}

.sco-val {
    color: var(--text-primary, #1a1d26);
    word-break: break-word;
}

.sco-items-label {
    margin: 14px 0 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #5c6473);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.sco-items {
    border-radius: 6px;
    border: 1px solid var(--border-color, #e2e6ef);
    overflow: hidden;
}

.sco-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 8px 12px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color, #e2e6ef);
}

.sco-item-l { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sco-item-name { color: var(--text-primary, #1a1d26); font-weight: 600; }
.sco-item-sub { color: var(--text-secondary, #5c6473); font-size: 12px; }
.sco-item-sum { color: var(--text-primary, #1a1d26); white-space: nowrap; }

.sco-item-ship .sco-item-name { font-weight: 400; color: var(--text-secondary, #5c6473); }
.sco-item-ship .sco-item-sum { color: var(--text-secondary, #5c6473); }

.sco-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary, #1a1d26);
    background: rgba(40, 127, 113, 0.05);
}

.sco-status {
    margin-top: 14px;
    padding: 9px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
}

.sco-status-ok {
    background: rgba(40, 127, 113, 0.08);
    border: 1px solid rgba(40, 127, 113, 0.25);
    color: var(--primary, #287f71);
}

.sco-status-manual {
    background: rgba(200, 150, 40, 0.08);
    border: 1px solid rgba(200, 150, 40, 0.25);
    color: #8a6a1a;
}

.sco-status-link {
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    margin-left: 4px;
}
.sco-status-link:hover { text-decoration: none; }

.sco-status-reason {
    margin-top: 4px;
    font-weight: 400;
    font-size: 12px;
    opacity: 0.9;
}



tr.support-chat-order-row:hover {
    background: rgba(40, 127, 113, 0.07);
}

body.admin-privacy-mask .pii-dashboard-host .stat-content .stat-value,
body.admin-privacy-mask .pii-dashboard-host .stat-content .stat-label,
body.admin-privacy-mask .pii-dashboard-host .stat-card-title,
body.admin-privacy-mask .pii-dashboard-host .stat-sub,
body.admin-privacy-mask .pii-dashboard-host .stat-label-row,
body.admin-privacy-mask .pii-dashboard-host .stat-month-select,
body.admin-privacy-mask .pii-dashboard-host .docs-informer-label,
body.admin-privacy-mask .pii-dashboard-host .docs-informer-total,
body.admin-privacy-mask .pii-dashboard-host .docs-informer-sources,
body.admin-privacy-mask .pii-dashboard-host .telegram-users-table thead th {
    filter: blur(5px);
    -webkit-filter: blur(5px);
    user-select: none;
}

body.admin-privacy-mask .pii-dashboard-host .stat-chart,
body.admin-privacy-mask .pii-dashboard-host .stat-bar-chart {
    filter: blur(5px);
    -webkit-filter: blur(5px);
    user-select: none;
}

body.admin-privacy-mask .pii-field {
    filter: blur(6px);
    -webkit-filter: blur(6px);
    user-select: none;
    display: inline-block;
    max-width: 100%;
    vertical-align: bottom;
}

body.admin-privacy-mask .sidebar-logo {
    border-radius: 16px;
}

body.admin-privacy-mask .sidebar-logo img {
    border-radius: 16px;
    filter: blur(22px);
    -webkit-filter: blur(22px);
    opacity: 0.38;
    user-select: none;
    transform: scale(1.08);
    -webkit-mask-image: radial-gradient(ellipse 82% 78% at 50% 40%, #000 0%, #000 62%, transparent 98%);
    mask-image: radial-gradient(ellipse 82% 78% at 50% 40%, #000 0%, #000 62%, transparent 98%);
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
}

body.admin-privacy-mask input.pii-field-input,
body.admin-privacy-mask textarea.pii-field-input {
    filter: blur(5px);
    -webkit-filter: blur(5px);
    user-select: none;
}

body.admin-privacy-mask a.pii-field {
    display: inline-block;
}

body.admin-privacy-mask .submenu-count,
body.admin-privacy-mask #section-deals .status-count,
body.admin-privacy-mask #deals-page-info,
body.admin-privacy-mask #nav-support-chat-orders-badge,
body.admin-privacy-mask #support-chat-tab-orders-badge,
body.admin-privacy-mask .pii-order-count {
    filter: blur(6px);
    -webkit-filter: blur(6px);
    user-select: none;
    display: inline-block;
    vertical-align: middle;
}

body.admin-privacy-mask .pii-dashboard-host #stat-total-deals,
body.admin-privacy-mask .pii-dashboard-host #stat-aprazer-deals,
body.admin-privacy-mask .pii-dashboard-host #stat-price-list-orders,
body.admin-privacy-mask .pii-dashboard-host #stat-month-deals {
    filter: blur(10px);
    -webkit-filter: blur(10px);
}


/* ── Виджет чата оператора (sc-widget) ─────────────────────────── */
#sc-widget-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9990;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary, #287f71);
    border: none;
    cursor: pointer;
    box-shadow: 0 3px 14px rgba(40,127,113,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, transform .12s;
}
#sc-widget-btn:hover { background: var(--primary-hover, #1f6a5e); transform: scale(1.07); }
#sc-widget-btn svg { width: 24px; height: 24px; fill: #fff; flex-shrink: 0; pointer-events: none; }

/* Пульс через box-shadow (как в лендинге) — только когда есть непрочитанные */
#sc-widget-btn.has-unread {
    animation: scw-btn-pulse 2.6s ease-out infinite;
}
@keyframes scw-btn-pulse {
    0%   { box-shadow: 0 3px 14px rgba(40,127,113,.45), 0 0 0 0   rgba(40,127,113,.55); }
    70%  { box-shadow: 0 3px 14px rgba(40,127,113,.45), 0 0 0 18px rgba(40,127,113,0);  }
    100% { box-shadow: 0 3px 14px rgba(40,127,113,.45), 0 0 0 0   rgba(40,127,113,0);  }
}

/* Tooltip */
.scw-tooltip {
    position: absolute;
    bottom: 62px;
    right: 0;
    background: rgba(20,20,20,.82);
    color: #fff;
    font-size: 12px;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .18s, transform .18s;
}
#sc-widget-btn:hover .scw-tooltip { opacity: 1; transform: translateY(0); }

/* Бейдж непрочитанных */
#sc-widget-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e53e3e;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.22);
    pointer-events: none;
    line-height: 1;
    box-sizing: border-box;
}

/* ── Окно виджета ─────────────────────────────────────────────── */
#sc-widget-window {
    position: fixed;
    bottom: 86px;
    right: 24px;
    z-index: 9991;
    width: 400px;
    height: 540px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,.16);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: scw-in .2s ease;
}
#sc-widget-window.open { display: flex; }
@keyframes scw-in {
    from { opacity: 0; transform: translateY(14px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

#sc-widget-header {
    background: var(--sidebar-bg, #1f6a5e);
    color: #fff;
    padding: 11px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
#sc-widget-header-title {
    flex: 1;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#sc-widget-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}
.scw-hdr-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,.65);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
    line-height: 1;
}
.scw-hdr-btn:hover { background: rgba(255,255,255,.15); color: #fff; }
.scw-hdr-btn[title="Удалить этот диалог"]:hover,
.scw-hdr-btn[title="Удалить все диалоги"]:hover { background: rgba(239,68,68,.35); color: #fff; }
.scw-hdr-close { font-size: 20px; padding: 1px 5px; }

/* Вкладки сессий */
#sc-widget-sessions {
    display: none;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 4px;
    padding: 6px 10px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    scrollbar-width: thin;
}
.scw-tab {
    flex-shrink: 0;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    color: #374151;
    transition: background .12s;
}
.scw-tab:hover { background: #e5e7eb; }
.scw-tab.active { background: var(--primary,#287f71); color:#fff; border-color:var(--primary,#287f71); }
.scw-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e53e3e;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    padding: 0 3px;
    margin-left: 4px;
    vertical-align: middle;
}
.scw-tab.active .scw-tab-badge { background: rgba(255,255,255,.3); }

#sc-widget-no-sessions {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 13px;
    text-align: center;
    padding: 20px;
}

/* Лог сообщений */
#sc-widget-log {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scrollbar-width: thin;
}
#sc-widget-log .sc-line { margin: 0; }

#sc-widget-typing {
    padding: 2px 12px 4px;
    font-size: 12px;
    color: #9ca3af;
    font-style: italic;
    display: none;
    flex-shrink: 0;
}

/* Футер */
#sc-widget-footer {
    border-top: 1px solid #e5e7eb;
    padding: 8px 10px;
    display: flex;
    gap: 6px;
    align-items: flex-end;
    flex-shrink: 0;
    background: #fafafa;
}
#sc-widget-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 13px;
    resize: none;
    min-height: 36px;
    max-height: 80px;
    overflow-y: auto;
    font-family: inherit;
    line-height: 1.4;
    outline: none;
    transition: border-color .15s;
    box-sizing: border-box;
}
#sc-widget-input:focus { border-color: var(--primary, #287f71); }
#sc-widget-send {
    background: var(--primary, #287f71);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
    height: 36px;
    transition: background .15s;
    white-space: nowrap;
}
#sc-widget-send:hover { background: var(--primary-hover, #1f6a5e); }
#sc-widget-send:disabled { background: #a7c4be; cursor: default; }

/* ── №5: операторская панель — дизайн как у основного чата ───────── */
#sc-widget-window { width: 520px; }
#sc-widget-body { display: flex; flex: 1; min-height: 0; }
#sc-widget-convo { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* Список клиентов справа */
#sc-widget-clients {
    width: 134px; flex-shrink: 0; overflow-y: auto;
    border-left: 1px solid #e5e7eb; background: #f9fafb;
    scrollbar-width: thin;
}
.scw-client {
    position: relative; display: flex; align-items: center; gap: 6px;
    width: 100%; text-align: left; border: none; background: none;
    border-bottom: 1px solid #eef0f3; padding: 9px 10px;
    font-size: 13px; color: #374151; cursor: pointer; transition: background .12s;
}
.scw-client:hover { background: #eef2f1; }
.scw-client.active { background: #e7f1ee; box-shadow: inset 3px 0 0 var(--primary,#287f71); }
.scw-client.has-unread .scw-client-name { font-weight: 700; color: #111827; }
.scw-client-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scw-client-badge {
    display: inline-flex; align-items: center; justify-content: center;
    background: #e53e3e; color: #fff; font-size: 10px; font-weight: 700;
    min-width: 16px; height: 16px; border-radius: 8px; padding: 0 3px; flex-shrink: 0;
}
.scw-client-del {
    flex-shrink: 0; width: 18px; height: 18px; line-height: 16px; text-align: center;
    border-radius: 50%; color: #9ca3af; font-size: 16px; opacity: 0;
    transition: opacity .12s, background .12s, color .12s;
}
.scw-client:hover .scw-client-del { opacity: 1; }
.scw-client-del:hover { background: rgba(239,68,68,.15); color: #dc2626; }

/* Сообщения — бабблы как в основном чате (клиент слева, оператор справа) */
#sc-widget-log .sc-line { display: flex; flex-direction: column; }
#sc-widget-log .sc-msg {
    display: inline-block; max-width: 84%; padding: 7px 11px; border-radius: 12px;
    border: 1px solid transparent;
}
#sc-widget-log .sc-msg-client {
    align-self: flex-start; background: #f1f3f5; border-color: #e3e6ea;
    border-bottom-left-radius: 4px; color: #1a1d26;
}
#sc-widget-log .sc-msg-operator {
    align-self: flex-end; background: #eef5f3; border-color: rgba(40,127,113,.22);
    border-bottom-right-radius: 4px;
}
#sc-widget-log .sc-msg-from { font-size: 10px; }
#sc-widget-log .sc-msg-body .sc-p { margin: 0 0 4px; }
#sc-widget-log .sc-msg-body .sc-p:last-child { margin-bottom: 0; }
#sc-widget-log .sc-ai-list { margin: 2px 0 4px; padding-left: 18px; }
#sc-widget-log .sc-ai-list li { margin: 1px 0; }
#sc-widget-log .sc-msg-body strong { font-weight: 700; }

/* Авто-обработанные (бот) и FAQ — слева, шире */
#sc-widget-log .sc-auto-wrap,
#sc-widget-log .sc-msg-auto { align-self: flex-start; max-width: 92%; }
#sc-widget-log .sc-faq-rich { display: block; }
#sc-widget-log .sc-faq-rich .sc-p { margin: 0 0 4px; }
#sc-widget-log .sc-faq-tag {
    display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .04em;
    color: var(--primary,#287f71); margin-bottom: 2px;
}
#sc-widget-log .sc-auto-faq-a .sc-p { margin: 0 0 4px; }
#sc-widget-log .sc-auto-faq-a .sc-p:last-child { margin-bottom: 0; }
