/* --- СВЕТЛАЯ ПАНЕЛЬ ВВОДА ДАННЫХ --- */
.sales-entry-panel {
    background-color: #CED3DC; /* Общий фон панели ввода данных */
    border: 1px solid #E0E7FF; /* Светло-синяя граница */
    border-radius: var(--border-radius);
    padding: 40px;
    margin-top: 2rem;
    color: var(--text-color); /* Стандартный цвет текста */
    box-shadow: 0 10px 40px rgba(74, 108, 253, 0.06); /* Мягкая синяя тень */
}

.sales-entry-panel .sales-control-header h3 {
    color: var(--heading-color); /* Стандартный цвет заголовка */
}

.sales-entry-panel .sales-control-header p {
    color: #7f8c8d; /* Слегка приглушенный текст */
}

/* Стилизация компактных фильтров в стиле iOS */
.sales-filters-compact {
    display: flex;
    gap: 12px;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.sales-filter-item {
    position: relative;
}

.sales-filter-trigger {
    background: #ffffff; /* Белый фон для кнопок */
    border: 1px solid #E0E7FF; /* Светло-синяя граница */
    padding: 12px 24px;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #475569; /* Темно-серый текст */
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    corner-shape: continuous;
}

.sales-filter-trigger:hover {
    background: #ffffff;
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.sales-filter-trigger.active {
    background: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
    color: #ffffff !important;
    box-shadow: 0 8px 25px rgba(74, 108, 253, 0.35);
}

.sales-filter-trigger .arrow-icon {
    width: 10px;
    height: 10px;
    transition: transform 0.3s;
    opacity: 0.7;
    filter: none; /* Убираем инвертирование для светлой темы */
    stroke: currentColor;
}

.sales-filter-popover {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    background: rgba(255, 255, 255, 0.85); /* Полупрозрачный фон */
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid #E0E7FF;
    border-radius: 24px;
    box-shadow: 0 25px 60px rgba(74, 108, 253, 0.15);
    padding: 10px;
    min-width: 200px;
    display: none;
    z-index: 100;
    animation: popoverReveal 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    corner-shape: continuous;
}

.sales-filter-popover.show {
    display: block;
}

.sales-filter-option {
    padding: 10px 16px;
    border-radius: 14px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sales-filter-option:hover {
    background: #eef2ff; /* Светлый акцентный цвет при наведении */
    color: var(--accent-color);
}

.sales-filter-option.selected {
    background: var(--accent-color);
    color: #ffffff;
}

.sales-filter-option .sales-count-badge {
    opacity: 0.9;
}

.sales-control-header {
    margin-bottom: 1.5rem;
    padding-left: 10px;
}

.sales-control-header h3 {
    font-size: 1.4em;
    font-weight: 700;
    color: var(--heading-color);
    margin-bottom: 0.5rem;
}

.sales-control-header p {
    font-size: 0.9em;
    color: #7f8c8d;
}

/* --- НОВЫЕ СТИЛИ ДЛЯ СЕТКИ МЕНЕДЖЕРОВ И КАРТОЧЕК --- */
.sales-entry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.manager-entry-card {
    background-color: #FCF7F8;
    border-radius: 24px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    border: 1px solid #BCC1CA;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.manager-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--heading-color);
    padding-left: 5px;
}

.manager-total-sales {
    font-size: 1.1rem;
    font-weight: 700;
    background-color: #e2e8f0;
    color: #475569;
    padding: 4px 12px;
    border-radius: 12px;
    min-width: 40px;
    text-align: center;
}

/* Сегментированный переключатель форм */
.sales-form-tabs {
    display: flex;
    background-color: #e2e8f0;
    border-radius: 14px;
    padding: 5px;
}

.sales-form-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background-color: transparent;
    border-radius: 10px;
    font-size: 0.85em;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    /* НОВОЕ: Для позиционирования счётчика */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.sales-form-tab.active {
    background-color: #ffffff;
    color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* НОВОЕ: Стиль для круглого счётчика продаж */
.sales-form-badge {
    background-color: var(--accent-color);
    color: white;
    font-size: 0.7em;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sales-form-tab.active .sales-form-badge {
    transform: scale(1.1);
}

/* Список источников */
.sales-source-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.source-entry-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    padding: 8px 12px;
    border-radius: 12px;
}

.source-entry-name {
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.9rem;
}

.sales-controls {
    display: flex;
    align-items: center;
    background-color: #f1f5f9;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    transition: background-color 0.3s, border-color 0.3s;
}

/* ИЗМЕНЕНО: Новая подсветка для контрола */
.source-entry-item.has-sales .sales-controls {
    background-color: #CCFD50;
    border-color: #a9d141; /* Более темный оттенок для границы */
}

.source-entry-item.has-sales .sales-input {
    color: #3b4d00; /* Темный оливково-зеленый текст для контраста */
    border-left-color: #a9d141;
    border-right-color: #a9d141;
}

.source-entry-item.has-sales .sales-btn img {
    /* Фильтр для преобразования черного SVG в темный оливково-зеленый */
    filter: invert(22%) sepia(50%) saturate(1477%) hue-rotate(53deg) brightness(93%) contrast(92%);
    opacity: 1;
}


.sales-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color .2s;
    flex-shrink: 0;
}

.sales-btn img {
    width: 12px;
    height: 12px;
    opacity: 0.5;
    transition: opacity .2s, filter .2s;
    filter: none;
}

.sales-btn:hover {
    background-color: #e2e8f0;
}

.sales-btn:hover img {
    opacity: 1;
}

.sales-input {
    width: 50px;
    height: 32px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-left: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    background-color: transparent;
    color: var(--heading-color);
    padding: 0 4px;
    -moz-appearance: textfield;
    transition: color .2s, border-color .2s;
}

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

.sales-input:focus {
    outline: none;
}


/* --- POPUP УВЕДОМЛЕНИЕ О СОХРАНЕНИИ --- */
.sales-toast-popup {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px); /* Начальное положение за экраном */
    padding: 14px 24px;
    border-radius: 18px;
    color: white;
    font-size: 0.95em;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
    opacity: 0;
    pointer-events: none;
    corner-shape: continuous;
}

.sales-toast-popup.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.sales-toast-popup.saving {
    background-color: #e67e22; /* Оранжевый */
}

.sales-toast-popup.success {
    background-color: var(--success-color); /* Зеленый */
}

.sales-toast-popup.error {
    background-color: #e74c3c; /* Красный */
}


@media (max-width: 900px) {
    .sales-entry-panel {
        padding: 25px;
    }
}