/* =========================== */
/* НАВИГАЦИЯ ВНУТРИ МЕНЕДЖЕРА */
/* =========================== */
.manager-sub-nav {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 15px;
}

.m-nav-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #9a9a9a;
    padding: 12px 25px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.m-nav-btn.active {
    background: var(--accent-alt);
    color: white;
    border-color: var(--accent-alt);
    box-shadow: 0 0 15px rgba(29, 140, 248, 0.3);
}

/* =========================== */
/* СЕКЦИИ */
/* =========================== */
.m-section {
    animation: fadeIn 0.3s ease;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    margin: 0;
    font-size: 18px;
    color: #fff;
    font-weight: 600;
}

.btn-save-script-top {
    background: var(--success);
    color: #1e1e2f;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    transition: 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-save-script-top:hover {
    filter: brightness(1.2);
}

/* =========================== */
/* ПЛАШКИ СКРИПТОВ */
/* =========================== */
.scripts-layout {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.script-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.script-plate {
    background: var(--bg-panel);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 25px;
    border-radius: 15px;
    cursor: pointer;
    transition: 0.3s;
    position: relative;
    overflow: hidden;
}

.script-plate:hover {
    border-color: var(--accent);
    transform: translateY(-5px);
    background: rgba(225, 78, 202, 0.05);
}

.plate-tag {
    font-size: 9px;
    background: var(--accent);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    width: fit-content;
    margin-bottom: 15px;
    font-weight: 800;
    text-transform: uppercase;
}

.script-plate h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #fff;
}

.script-plate p {
    font-size: 12px;
    color: #888;
    line-height: 1.5;
    margin: 0;
}

/* =========================== */
/* ОКНО РЕДАКТОРА */
/* =========================== */
.script-editor-window {
    background: #1a1a2e;
    border-radius: 15px;
    border: 1px solid var(--accent);
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-weight: bold;
    color: var(--accent);
}

.editor-header span {
    font-size: 16px;
    text-transform: uppercase;
}

.close-editor {
    background: none;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    transition: 0.2s;
}

.close-editor:hover {
    color: #fff;
}

#mainScriptTextarea {
    width: 100%;
    height: 350px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 20px;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    line-height: 1.6;
    outline: none;
    resize: none;
    box-sizing: border-box;
}

/* =========================== */
/* ОЧЕРЕДЬ ЗВОНКОВ */
/* =========================== */
.queue-list-modern {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.queue-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 242, 195, 0.05);
    border-left: 3px solid var(--success);
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.empty-state {
    color: #888;
    text-align: center;
    padding: 40px 20px;
    font-size: 14px;
}

/* ========================================== */
/* ЕДИНЫЙ КОНТРОЛЬ ПРАВОЙ ПАНЕЛИ (FIX)       */
/* ========================================== */

.sidebar-right {
    width: 400px;
    min-width: 400px;
    background: var(--bg-panel);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    perspective: 1500px;
    z-index: 5;
}

.sidebar-right .sidebar-content {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.sidebar-right.flipped .sidebar-content {
    transform: rotateY(180deg);
}

.sidebar-right .view-front,
.sidebar-right .view-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    background: var(--bg-panel);
    padding: 30px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.sidebar-right .view-back {
    transform: rotateY(180deg);
    border-left: 2px solid var(--accent);
}

/* =========================== */
/* ШАПКА И СТАТУСЫ (z-index) */
/* =========================== */
.top-bar {
    position: relative;
    z-index: 9999 !important;
}

.status-dropdown {
    z-index: 10000 !important;
}

.status-menu {
    z-index: 10001 !important;
    position: absolute;
}

/* =========================== */
/* ФИКС ТЕКСТОВЫХ ПОЛЕЙ */
/* =========================== */
textarea,
.manager-textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    padding: 15px;
    font-family: 'Montserrat', sans-serif;
    outline: none;
    resize: none;
    box-sizing: border-box;
    transition: 0.3s;
}

textarea:focus,
.manager-textarea:focus {
    border-color: var(--accent);
}

/* =========================== */
/* ВНУТРЕННЯЯ ВЕРСТКА МЕНЕДЖЕРА */
/* =========================== */
.header-with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-shrink: 0;
}

.header-with-action h3 {
    color: var(--accent);
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
}

.btn-save-mini {
    background: var(--success);
    color: #1e1e2f;
    border: none;
    padding: 6px 15px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 11px;
    cursor: pointer;
    text-transform: uppercase;
}

/* =========================== */
/* ПЛАШКИ СКРИПТОВ (мини) */
/* =========================== */
.manager-scroll-area {
    height: calc(100vh - 160px);
    /* Жесткое ограничение высоты под Mac */
    overflow-y: auto !important;
    margin-top: 10px;
    padding-right: 5px;
    transform: translateZ(0);
    /* Включение аппаратного ускорения */
    -webkit-overflow-scrolling: touch;
    /* Плавный скролл для iOS/macOS */
}

.script-plate-mini {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: 0.3s;
}

.script-plate-mini:hover {
    border-color: var(--accent);
    background: rgba(225, 78, 202, 0.05);
    transform: translateX(5px);
}

.script-plate-mini h4 {
    margin: 0 0 8px 0;
    color: #fff;
    font-size: 14px;
    text-transform: uppercase;
}

.script-plate-mini p {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* =========================== */
/* ТЕКСТОВОЕ ПОЛЕ МЕНЕДЖЕРА */
/* =========================== */
.manager-textarea {
    width: 100%;
    height: 350px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--accent);
    color: #fff;
    padding: 15px;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.6;
    outline: none;
    resize: none;
    box-sizing: border-box;
}

/* =========================== */
/* АНИМАЦИИ */
/* =========================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================== */
/* КАРТОЧКИ ЗВОНКОВ */
/* =========================== */
.call-card {
    margin-bottom: 8px;
    padding: 10px 14px;
    border-radius: 8px;
}

.call-card.active-call {
    background: rgba(0, 242, 195, 0.05);
    border: 1px solid rgba(0, 242, 195, 0.15);
}

.call-card.queue-call {
    background: rgba(255, 255, 255, 0.03);
}

.call-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.call-info {
    flex: 1;
}

.call-number {
    font-weight: 700;
    color: #fff;
    font-size: 13px;
}

.call-agent {
    font-size: 10px;
    color: var(--accent);
    margin-top: 2px;
}

.call-meta {
    text-align: right;
}

.call-direction {
    font-size: 10px;
    font-weight: 700;
    margin-bottom: 2px;
}

.call-direction.dir-in {
    color: #00f2c3;
}

.call-direction.dir-out {
    color: #ff8d72;
}

.call-timer {
    font-family: monospace;
    font-weight: 700;
    font-size: 14px;
}

.active-call .call-timer {
    color: #00f2c3;
}

.queue-call .call-timer {
    color: var(--success);
}

/* =========================== */
/* ЗАГОЛОВКИ СЕКЦИЙ ОЧЕРЕДИ */
/* =========================== */
.queue-section-title {
    font-size: 10px;
    font-weight: 800;
    margin: 15px 0 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 3px;
    color: var(--accent);
    text-transform: uppercase;
}

.queue-section-title.active-title {
    color: #00f2c3;
    border-bottom-color: rgba(0, 242, 195, 0.2);
}

.queue-empty {
    color: var(--text-muted);
    font-size: 11px;
    padding: 4px 8px;
}

/* =========================== */
/* РЕДАКТОР СКРИПТОВ */
/* =========================== */
.editor-label {
    margin-bottom: 10px;
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 700;
}

.btn-back {
    margin-top: 15px;
    width: 100%;
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 12px;
    transition: 0.3s;
}

.btn-back:hover {
    background: var(--accent);
    color: #fff;
}



/* ========================================== */
/* 530+ СТИЛИ ДЛЯ ОТЧЕТОВ И КАЛЕНДАРЯ (FIX)   */
/* ========================================== */

.report-config-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 25px;
    border-radius: 16px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.4);
}

.report-config-card h4 {
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-top: 0;
    margin-bottom: 20px;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 12px;
}

/* Смерть белому уродству: стилизуем инпут даты */
input[type="date"].search-in {
    color-scheme: dark;
    /* ГЛАВНЫЙ ФИКС: заставляет браузер рендерить сам попап-календарь ТЕМНЫМ */
    position: relative;
    appearance: none;
    -webkit-appearance: none;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 600;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.25s ease;
}

input[type="date"].search-in:focus {
    border-color: var(--accent-alt);
    box-shadow: 0 0 15px rgba(29, 140, 248, 0.2);
    background: rgba(255, 255, 255, 0.06);
}

/* Кастомная неоновая иконка календаря взамен стандартной стрелки */
input[type="date"]::-webkit-calendar-picker-indicator {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%231d8cf8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 18px;
    cursor: pointer;
    filter: drop-shadow(0 0 5px var(--accent-alt));
    transition: all 0.2s ease;
    opacity: 0.8;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px var(--accent));
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23e14eca' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
    opacity: 1;
}

/* Чистим внутренности инпута от дефолтной разметки */
input[type="date"]::-webkit-datetime-edit-fields-wrapper {
    padding: 0;
}

input[type="date"]::-webkit-datetime-edit-text {
    color: rgba(255, 255, 255, 0.2);
    padding: 0 4px;
}

input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-year-field {
    color: #fff;
    font-weight: 600;
}

/* Выделение сегментов даты при вводе */
input[type="date"]::-webkit-datetime-edit-month-field:focus,
input[type="date"]::-webkit-datetime-edit-day-field:focus,
input[type="date"]::-webkit-datetime-edit-year-field:focus {
    background-color: var(--accent-alt);
    color: #fff;
    border-radius: 3px;
}

/* Анимация крутящихся часиков загрузки */
.loading-clock {
    font-size: 46px;
    margin-bottom: 12px;
    display: inline-block;
    animation: rotate 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    filter: drop-shadow(0 0 8px var(--accent-alt));
}

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

    to {
        transform: rotate(360deg);
    }
}

/* Блок готового к скачиванию файла */
.report-ready-card {
    background: rgba(0, 242, 195, 0.04);
    border: 1px solid var(--success);
    padding: 20px;
    border-radius: 14px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 242, 195, 0.1);
    animation: fadeIn 0.3s ease-out forwards;
}

.report-ready-card div {
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.5px;
    color: var(--success);
    text-transform: uppercase;
    margin-bottom: 12px;
}


/* ========================================== */
/*   ОБНОВЛЕННЫЕ СТИЛИ КАРТОЧЕК ОЧЕРЕДИ       */
/* ========================================== */

.call-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* Фиксированный отступ между строками в карточке */
    min-width: 0;
}

/* Строки с иконками */
.q-row-fio,
.q-row-phone,
.q-row-operator {
    display: flex;
    align-items: center;
    gap: 8px;
    /* Отступ от иконки до текста */
    line-height: 1.2;
}

.q-inline-svg {
    flex-shrink: 0;
    opacity: 0.8;
}

/* ФИО или Номер (если ФИО нет) — верхняя главная строка */
.q-row-fio {
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
}

.q-row-fio .q-inline-svg {
    color: var(--success);
    /* Зеленый акцент для ФИО клиента */
}

/* Номер телефона (если ушел на вторую строчку) */
.q-row-phone {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.q-row-phone .q-inline-svg {
    color: var(--accent-alt);
    /* Синий акцент для телефона */
}

/* Строка оператора */
.q-row-operator {
    font-size: 11px;
    font-weight: 600;
    color: #ba54f1;
    /* Фиолетовый под цвет темы */
    margin-top: 2px;
}

.q-row-operator .q-inline-svg {
    color: #ba54f1;
}

/* Пустые линии с новой иконкой */
.q-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    text-align: center;
}

.q-empty-state span {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.icon-file-check {
    filter: drop-shadow(0 0 8px var(--success));
}

/* =========================== */
/* ИСТОРИЯ СОТРУДНИКОВ (МЕНЕДЖЕР) */
/* =========================== */
.emp-list-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.emp-card {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.emp-card:hover {
    background: rgba(225, 78, 202, 0.05);
    border-color: var(--accent);
    transform: translateX(4px);
    box-shadow: 0 4px 15px rgba(225, 78, 202, 0.15);
}

.emp-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #ba54f1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 15px;
    margin-right: 15px;
    flex-shrink: 0;
    box-shadow: 0 0 10px rgba(225, 78, 202, 0.3);
}

.emp-info {
    flex: 1;
    min-width: 0;
}

.emp-name {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.emp-login {
    font-size: 11px;
    color: var(--text-muted);
    font-family: monospace;
    font-weight: 600;
}

.chevron-right {
    color: var(--text-muted);
    opacity: 0.5;
    transition: 0.2s;
}

.emp-card:hover .chevron-right {
    opacity: 1;
    color: var(--accent);
    transform: translateX(2px);
}

#mgrHistList::-webkit-scrollbar {
    width: 4px;
}

#mgrHistList::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}