/**
 * app-inline.css
 * 
 * Этот файл будет содержать стили, вынесенные из inline <style> блоков
 * файла resources/views/layouts/app.blade.php
 * 
 * Phase 5 — Performance Recovery: CSS Extraction
 * Created: 2025-12-29
 */

/* ═══════════════════════════════════════════════════════════════════════════════
   GLOBAL SEARCH DROPDOWN
   ═══════════════════════════════════════════════════════════════════════════════ */
.gs-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: rgba(20, 28, 45, 0.98);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    max-height: 400px;
    overflow-y: auto;
    z-index: 99999;
}
/* Sidebar-specific adjustments */
.ss-search .gs-dropdown {
    left: 12px;
    right: 12px;
}
.gs-result-item {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    cursor: pointer;
    transition: background 0.15s;
}
.gs-result-item:hover, .gs-result-item.active {
    background: rgba(99,102,241,0.15);
}
.gs-result-item:last-child { border-bottom: none; }
.gs-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.gs-result-title {
    font-weight: 600;
    font-size: 13px;
    color: #f1f5f9;
}
.gs-result-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}
.gs-result-badge--new { background: #3b82f6; color: #fff; }
.gs-result-badge--payment { background: #f59e0b; color: #1e1e1e; }
.gs-result-badge--in_work { background: #8b5cf6; color: #fff; }
.gs-result-badge--done { background: #22c55e; color: #fff; }
.gs-result-badge--reject { background: #ef4444; color: #fff; }
.gs-result-name {
    font-size: 14px;
    font-weight: 500;
    color: #e2e8f0;
    margin-bottom: 4px;
}
.gs-result-phone {
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 3px;
}
.gs-result-address {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 3px;
}
.gs-result-info {
    font-size: 12px;
    color: #22d3ee;
    margin-bottom: 3px;
}
.gs-result-comment {
    font-size: 11px;
    color: #64748b;
    font-style: italic;
}
.gs-empty {
    padding: 20px;
    text-align: center;
    color: #64748b;
    font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   DASH-TOP-LAYOUT — 4-column grid: Stats | Revenue | Recalls | Notes
   Статистика СЛЕВА, Оборот компактный в центре, Перезвоны и Заметки расширены СПРАВА
   ═══════════════════════════════════════════════════════════════════════════════ */
.dash-top-layout {
    display: grid;
    grid-template-columns: 200px 240px 1fr 1fr;
    grid-template-areas: "stats revenue recalls notes";
    gap: 0;
    align-items: stretch;
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.dash-top-stats   { grid-area: stats; }
.dash-top-recalls { grid-area: recalls; }
.dash-top-notes   { grid-area: notes; }
.dash-top-revenue { grid-area: revenue; }

/* All grid items: prevent overflow */
.dash-top-layout > div {
    min-width: 0;
    min-height: 0;
}

/* Panels: flex column structure */
.dash-top-recalls,
.dash-top-notes {
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    border-left: 1px solid rgba(255, 255, 255, 0.04);
}

/* Override command-center.css max-height */
.dash-top-recalls.cc-callbacks {
    max-height: none;
}

/* Header: fixed, never scrolls */
.dash-top-recalls .cc-callbacks-header,
.dash-top-notes .cc-notes-header {
    flex-shrink: 0;
}

/* List: scrolls after 3 items (4th triggers scroll) */
.dash-top-recalls .cc-callbacks-list {
    flex: 1;
    min-height: 0;
    max-height: 270px;
    overflow-y: auto;
    overscroll-behavior: contain;
    margin-bottom: 8px;
    padding-bottom: 4px;
}

.dash-top-notes .cc-notes-list {
    flex: 1;
    min-height: 0;
    max-height: 270px;
    overflow-y: auto;
    overscroll-behavior: contain;
    margin-bottom: 8px;
    padding-bottom: 4px;
}

/* Footer: fixed at bottom */
.dash-top-recalls .cc-last-update {
    flex-shrink: 0;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* Revenue (center column - compact) */
.dash-top-revenue {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.dash-top-revenue .cc-revenue-label {
    font-size: 9px;
    margin-bottom: 4px;
}

.dash-top-revenue .cc-revenue-amount {
    font-size: 26px;
}

.dash-top-revenue .cc-revenue-currency {
    font-size: 14px;
}

.dash-top-revenue .cc-period-switcher {
    margin-top: 10px;
    padding: 2px;
}

.dash-top-revenue .cc-period-btn {
    font-size: 10px;
    padding: 4px 8px;
}

/* Responsive: tablet */
@media (max-width: 1200px) {
    .dash-top-layout {
        grid-template-columns: 180px 200px 1fr 1fr;
    }
}

/* Responsive: small tablet */
@media (max-width: 1024px) {
    .dash-top-layout {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "revenue revenue"
            "recalls notes";
        min-height: auto;
    }
    
    .dash-top-stats {
        display: none;
    }
    
    .dash-top-recalls,
    .dash-top-notes {
        border-bottom: none;
        border-top: 1px solid rgba(255, 255, 255, 0.04);
    }
    
    .dash-top-recalls {
        border-left: none;
        border-right: 1px solid rgba(255, 255, 255, 0.04);
    }
    
    .dash-top-revenue {
        flex-direction: row;
        gap: 16px;
        padding: 12px 20px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    }
    
    .dash-top-revenue .cc-period-switcher {
        margin-top: 0;
    }
}

/* Responsive: mobile */
@media (max-width: 768px) {
    .dash-top-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "revenue"
            "recalls"
            "notes";
    }
    
    .dash-top-recalls,
    .dash-top-notes {
        border-left: none;
    }
    
    .dash-top-revenue {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   CALLBACK SCHEDULE MODAL — Premium Compact Design
   ═══════════════════════════════════════════════════════════════════════════════ */
.cb-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    z-index: 10500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.cb-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
.cb-modal {
    width: 340px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(15, 23, 42, 0.05);
    transform: translateY(12px) scale(0.97);
    transition: transform 0.2s ease;
    overflow: hidden;
}
.cb-modal-overlay.active .cb-modal {
    transform: translateY(0) scale(1);
}
.cb-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid #f1f5f9;
}
.cb-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}
.cb-modal-title svg {
    width: 18px;
    height: 18px;
    color: #6366f1;
}
.cb-modal-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    transition: all 0.15s;
}
.cb-modal-close:hover {
    background: #f1f5f9;
    color: #64748b;
}
.cb-modal-close svg {
    width: 16px;
    height: 16px;
}
.cb-modal-body {
    padding: 18px;
}
.cb-quick-picks {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
}
.cb-quick-btn {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}
.cb-quick-btn:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
}
.cb-quick-btn.selected {
    border-color: #6366f1;
    background: #eef2ff;
    color: #4f46e5;
}
.cb-field-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}
.cb-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.cb-field.full {
    grid-column: 1 / -1;
}
.cb-field-label {
    font-size: 11px;
    font-weight: 500;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.cb-field-input {
    padding: 9px 11px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    color: #1e293b;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.cb-field-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
.cb-field-input::placeholder {
    color: #94a3b8;
}
.cb-field-textarea {
    resize: none;
    min-height: 56px;
    font-family: inherit;
    line-height: 1.4;
}
.cb-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 3px solid #6366f1;
    margin-bottom: 14px;
}
.cb-preview-icon {
    width: 16px;
    height: 16px;
    color: #6366f1;
    flex-shrink: 0;
}
.cb-preview-text {
    font-size: 12px;
    color: #475569;
    font-weight: 500;
}
.cb-modal-footer {
    display: flex;
    gap: 8px;
    padding: 14px 18px;
    border-top: 1px solid #f1f5f9;
    background: #fafbfc;
}
.cb-btn {
    flex: 1;
    padding: 9px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    text-align: center;
}
.cb-btn-secondary {
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #64748b;
}
.cb-btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}
.cb-btn-primary {
    background: #6366f1;
    color: #fff;
}
.cb-btn-primary:hover {
    background: #4f46e5;
}
.cb-btn-primary:disabled {
    background: #c7d2fe;
    cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   EXTRACTED FROM app.blade.php: first inline style block (L23–L118)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════
   ✨ PREMIUM HEADER 2025 — Скрыто (перенесено в левое меню)
   ═══════════════════════════════════════════════════════════════════════ */
.crm-navbar {
    display: none !important;
}

/* ========== TOOLBAR — Скрыто (перенесено в левое меню) ========== */
.toolbar-left {
    display: none !important;
}

.header-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.header-menu__item {
    position: relative;
    z-index: 6;
    border: 0;
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 500;
    font-family: 'Inter', 'Segoe UI', Roboto, Arial, sans-serif;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), inset 0 1px 0 rgba(255,255,255,0.6);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ниточка к кнопке */
.header-menu__item::before {
    display: none;
}

/* Колечко/петелька */
.header-menu__item::after {
    display: none;
}

.header-menu__item:hover {
    background: rgba(255, 255, 255, 0.85);
    color: #334155;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.9);
    transform: translateY(-1px);
}

.header-menu__item--active {
    background: rgba(255, 255, 255, 0.92);
    color: #3b82f6;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.12), inset 0 1px 0 rgba(255,255,255,0.9);
}

/* Индикатор снизу */
.header-menu__indicator {
    position: absolute;
    bottom: -5px;
    left: 0;
    height: 2.5px;
    width: 60px;
    border-radius: 3px;
    background: linear-gradient(90deg, #3b82f6, #6366f1);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    flex-shrink: 0;
}

.btn-label {
    line-height: 1;
}

@media (max-width: 1100px) {
    .header-menu { gap: 6px; }
    .header-menu__item { padding: 5px 10px; font-size: 11px; }
}

@media (max-width: 640px) {
    .toolbar-left { margin-left: 12px; }
    .header-menu__item { padding: 5px 8px; }
    .header-menu__item .btn-label { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   EXTRACTED: calendar inline style block (app.blade.php L349–L367)
   ═══════════════════════════════════════════════════════════════════════════════ */

.cal-day {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px; font-size: 12px;
    color: rgba(255,255,255,0.7); background: transparent;
    border: none; cursor: pointer; position: relative;
    transition: background 0.2s;
}
.cal-day:hover:not(.cal-day--muted) { background: rgba(255,255,255,0.08); }
.cal-day--muted { color: rgba(255,255,255,0.2); cursor: default; }
.cal-day--today { background: #3b82f6 !important; color: #fff !important; font-weight: 600; }
.cal-day--selected { background: rgba(59, 130, 246, 0.3) !important; color: #93c5fd !important; border: 1px solid rgba(59, 130, 246, 0.5); }
.cal-day--has-events::after { content: ''; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); width: 3px; height: 3px; border-radius: 50%; background: #10b981; }
.cal-weekday { width: 32px; height: 24px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 500; color: rgba(255,255,255,0.4); text-transform: uppercase; }

/* ═══════════════════════════════════════════════════════════════════════════════
   EXTRACTED: chat selector menu inline style block (app.blade.php L3216–L3303)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ========== CHAT SELECTOR MENU ========== */
.chat-selector-wrapper {
    position: relative;
}

.chat-selector-menu {
    position: absolute;
    bottom: 60px;
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 8px 0;
    min-width: 180px;
    display: none;
    z-index: 10000;
}

.chat-selector-wrapper.menu-open .chat-selector-menu {
    display: block;
    animation: chatMenuFadeIn 0.2s ease;
}

@keyframes chatMenuFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-selector-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 14px;
    color: #1e293b;
    font-family: inherit;
}

.chat-selector-item:hover {
    background: #f1f5f9;
}

.chat-selector-item__icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-selector-item__icon.crm {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.chat-selector-item__icon.tg {
    background: linear-gradient(135deg, #0088cc 0%, #00a2e8 100%);
}

.chat-selector-item__icon svg {
    width: 16px;
    height: 16px;
    color: #fff;
}

.chat-selector-item__badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    border-radius: 9px;
    display: none;
    align-items: center;
    justify-content: center;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   EXTRACTED: bottom action panel inline style block (app.blade.php L3216–L3294)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ========== BOTTOM ACTION PANEL ========== */
.bottom-action-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    gap: 10px;
    z-index: 9998;
}

.bottom-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
}

.bottom-action-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.bottom-action-btn:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(139, 92, 246, 0.3));
    border-color: rgba(59, 130, 246, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.bottom-action-btn:active {
    transform: translateY(0);
}

.bottom-action-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #ef4444;
    border-radius: 9px;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .bottom-action-panel {
        bottom: 16px;
        right: 16px;
    }
    
    .bottom-action-btn {
        padding: 8px 14px;
        font-size: 12px;
    }
    
    .bottom-action-btn svg {
        width: 16px;
        height: 16px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   EXTRACTED: feature-category-select (from app.blade.php inline <style>)
   ═══════════════════════════════════════════════════════════════════════════════ */

.feature-category-select { position: relative; }
.feature-category-selected {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: #fff; font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.feature-category-selected:hover { border-color: rgba(99,102,241,0.4); }
.feature-category-selected svg { width: 18px; height: 18px; color: #a78bfa; }
.feature-category-selected .chevron { width: 16px; height: 16px; margin-left: auto; color: rgba(255,255,255,0.4); transition: transform 0.2s; }
.feature-category-select.open .feature-category-selected .chevron { transform: rotate(180deg); }
.feature-category-dropdown {
    position: absolute; top: 100%; left: 0; right: 0;
    margin-top: 4px;
    background: #1e293b;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 6px;
    display: none; z-index: 100;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.feature-category-select.open .feature-category-dropdown { display: block; }
.feature-category-option {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}
.feature-category-option:hover { background: rgba(99,102,241,0.15); color: #fff; }
.feature-category-option svg { width: 18px; height: 18px; color: #a78bfa; }

/* ═══════════════════════════════════════════════════════════════════════════════
   EXTRACTED: CHAT STYLES Block 1 (TG badge/widget/sidebar/profile)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ===== TG PERSONAL BADGE ===== */
.tg-personal-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

/* ===== TG PERSONAL WIDGET - PREMIUM DESIGN ===== */
.tgp-widget {
    position: fixed;
    bottom: 90px;
    right: 24px;
    z-index: 9998;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.tgp-window {
    width: 480px;
    height: 520px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.tgp-widget.active .tgp-window {
    display: flex;
}

/* Chat Selector Menu */
.chat-selector {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
}

.chat-selector__toggle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: #0088cc;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0, 136, 204, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
}

.chat-selector__toggle:hover {
    background: #0077b5;
    box-shadow: 0 4px 16px rgba(0, 136, 204, 0.4);
}

.chat-selector__toggle svg {
    width: 24px;
    height: 24px;
    color: #fff;
}

.chat-selector__badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #e53935;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    border-radius: 9px;
    display: none;
    align-items: center;
    justify-content: center;
}

.chat-selector__menu {
    position: absolute;
    bottom: 64px;
    right: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    padding: 4px 0;
    min-width: 160px;
    display: none;
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.15s ease;
}

.chat-selector.menu-open .chat-selector__menu {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.chat-selector__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 13px;
    color: #222;
}

.chat-selector__item:hover {
    background: #f4f4f5;
}

.chat-selector__item-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-selector__item-icon.crm {
    background: #5865f2;
}

.chat-selector__item-icon.tg {
    background: #0088cc;
}

.chat-selector__item-icon svg {
    width: 16px;
    height: 16px;
    color: #fff;
}

.chat-selector__item-badge {
    margin-left: auto;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #e53935;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    border-radius: 8px;
    display: none;
    align-items: center;
    justify-content: center;
}

/* Header - Telegram Style */
.tgp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #517da2;
    color: #fff;
    cursor: move;
    user-select: none;
}

.tgp-header.dragging {
    cursor: grabbing;
}

.tgp-header__left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tgp-header__status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #7bc862;
}

.tgp-header__status.offline {
    background: #fc5c51;
}

.tgp-header__title {
    font-size: 14px;
    font-weight: 600;
}

.tgp-header__subtitle {
    font-size: 11px;
    opacity: 0.85;
}

.tgp-header__close {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.tgp-header__close:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Layout */
.tgp-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar - Telegram Style */
.tgp-sidebar {
    width: 200px;
    min-width: 200px;
    background: #fff;
    border-right: 1px solid #e6e6e6;
    display: flex;
    flex-direction: column;
}

.tgp-sidebar__header {
    padding: 10px 12px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e6e6e6;
}

.tgp-sidebar__header span {
    font-size: 12px;
    font-weight: 600;
    color: #707579;
    text-transform: uppercase;
}

/* Search in sidebar */
.tgp-search {
    padding: 8px 10px;
    border-bottom: 1px solid #e6e6e6;
    position: relative;
}

.tgp-search__icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: #a2acb4;
    pointer-events: none;
}

.tgp-search__input {
    width: 100%;
    padding: 6px 10px 6px 30px;
    background: #f4f4f5;
    border: none;
    border-radius: 18px;
    color: #222;
    font-size: 12px;
    outline: none;
    transition: background 0.15s;
}

.tgp-search__input::placeholder {
    color: #a2acb4;
}

.tgp-search__input:focus {
    background: #ebedef;
}

.tgp-sidebar__list {
    flex: 1;
    overflow-y: auto;
}

.tgp-sidebar__list::-webkit-scrollbar {
    width: 4px;
}

.tgp-sidebar__list::-webkit-scrollbar-track {
    background: transparent;
}

.tgp-sidebar__list::-webkit-scrollbar-thumb {
    background: #c4c9cc;
    border-radius: 2px;
}

/* Chat Item - Telegram Style */
.tgp-chat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    cursor: pointer;
    transition: background 0.1s;
    position: relative;
}

.tgp-chat-item:hover {
    background: #f4f4f5;
}

.tgp-chat-item.active {
    background: #3390ec;
}

.tgp-chat-item.active .tgp-chat-item__name,
.tgp-chat-item.active .tgp-chat-item__preview {
    color: #fff;
}

.tgp-chat-item.pinned {
    background: #f0f7ff;
}

/* Закрепленный И активный чат - белый текст */
.tgp-chat-item.pinned.active {
    background: #3390ec;
}

.tgp-chat-item.pinned.active .tgp-chat-item__name,
.tgp-chat-item.pinned.active .tgp-chat-item__preview,
.tgp-chat-item.pinned.active .tgp-chat-item__pin {
    color: #fff;
}

.tgp-chat-item__pin {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 9px;
    color: #707579;
}

.tgp-chat-item__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #54a3e3;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tgp-chat-item__avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.tgp-chat-item__info {
    flex: 1;
    min-width: 0;
}

.tgp-chat-item__name {
    font-size: 13px;
    font-weight: 500;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tgp-chat-item__preview {
    font-size: 12px;
    color: #707579;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.tgp-chat-item__badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #3390ec;
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main area */
.tgp-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: #e6ebee;
    overflow: hidden;
}

/* Chat header */
.tgp-chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #fff;
    border-bottom: 1px solid #e6e6e6;
}

.tgp-chat-header__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #54a3e3;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.tgp-chat-header__avatar:hover {
    opacity: 0.9;
}

.tgp-chat-header__avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.tgp-chat-header__info {
    flex: 1;
    min-width: 0;
}

.tgp-chat-header__name {
    font-size: 13px;
    font-weight: 600;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tgp-chat-header__username {
    font-size: 11px;
    color: #707579;
}

.tgp-chat-header__actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.tgp-chat-header__btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #707579;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.tgp-chat-header__btn:hover {
    background: #f4f4f5;
    color: #222;
}

.tgp-chat-header__btn.pinned {
    color: #3390ec;
}

.tgp-chat-header__btn svg {
    width: 16px;
    height: 16px;
}

/* User Profile Modal */
.tgp-profile-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.tgp-profile-modal.active {
    display: flex;
}

.tgp-profile-modal__content {
    position: relative;
}

.tgp-profile-modal__close {
    position: absolute;
    top: -36px;
    right: 0;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tgp-profile-modal__close:hover {
    background: rgba(0, 0, 0, 0.5);
}

.tgp-profile-card {
    width: 280px;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.tgp-profile-card__avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #54a3e3;
    color: #fff;
    font-size: 28px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.tgp-profile-card__avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.tgp-profile-card__name {
    font-size: 16px;
    font-weight: 600;
    color: #222;
    margin-bottom: 2px;
}

.tgp-profile-card__status {
    font-size: 12px;
    color: #707579;
    margin-bottom: 16px;
}

.tgp-profile-card__info {
    text-align: left;
    background: #f4f4f5;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.tgp-profile-card__row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #e6e6e6;
}

.tgp-profile-card__row:last-child {
    border-bottom: none;
}

.tgp-profile-card__label {
    font-size: 12px;
    color: #707579;
}

.tgp-profile-card__value {
    font-size: 12px;
    color: #222;
    font-weight: 500;
}

.tgp-profile-card__buttons {
    display: flex;
    gap: 8px;
}

.tgp-profile-card__btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.15s;
}

.tgp-profile-card__btn--primary {
    background: #3390ec;
    color: #fff;
}

.tgp-profile-card__btn--primary:hover {
    background: #2b7fd4;
}

.tgp-profile-card__btn:not(.tgp-profile-card__btn--primary) {
    background: #f4f4f5;
    color: #222;
}

.tgp-profile-card__btn:not(.tgp-profile-card__btn--primary):hover {
    background: #ebedef;
}

.tgp-profile-card__btn svg {
    width: 14px;
    height: 14px;
}

.tgp-profile-card__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   EXTRACTED: CHAT STYLES Block 2 (messages + voice UI + keyframes pulse-red/wave/tgp-spin)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Messages - Telegram Style */
.tgp-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #e6ebee url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cpattern id='p' width='20' height='20' patternUnits='userSpaceOnUse'%3E%3Ccircle cx='10' cy='10' r='1' fill='%23d1d5db' opacity='0.3'/%3E%3C/pattern%3E%3C/defs%3E%3Crect fill='url(%23p)' width='200' height='200'/%3E%3C/svg%3E");
    min-height: 0;
}

.tgp-messages::-webkit-scrollbar {
    width: 6px;
}

.tgp-messages::-webkit-scrollbar-track {
    background: transparent;
}

.tgp-messages::-webkit-scrollbar-thumb {
    background: #c4c9cc;
    border-radius: 3px;
}

.tgp-msg {
    display: flex;
    max-width: 80%;
}

.tgp-msg--in {
    align-self: flex-start;
}

.tgp-msg--out {
    align-self: flex-end;
}

.tgp-msg__bubble {
    padding: 6px 10px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.tgp-msg--in .tgp-msg__bubble {
    background: #fff;
    color: #222;
    border-bottom-left-radius: 4px;
}

.tgp-msg--out .tgp-msg__bubble {
    background: #eeffde;
    color: #222;
    border-bottom-right-radius: 4px;
}

.tgp-msg__time {
    font-size: 10px;
    margin-top: 2px;
    text-align: right;
    color: #8d969c;
}

/* Media Messages */
.tgp-msg__image {
    max-width: 180px;
    max-height: 180px;
    border-radius: 8px;
    cursor: pointer;
}

.tgp-msg__voice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(0,0,0,0.05);
    border-radius: 16px;
    min-width: 150px;
}

.tgp-msg__voice-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: #3390ec;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tgp-msg__voice-wave {
    flex: 1;
    height: 20px;
    background: linear-gradient(90deg, #c4c9cc 0%, #e6e6e6 100%);
    border-radius: 3px;
}

.tgp-msg__voice-dur {
    font-size: 10px;
    color: #707579;
}

.tgp-msg__file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(0,0,0,0.03);
    border-radius: 8px;
    cursor: pointer;
}

.tgp-msg__file:hover {
    background: rgba(0,0,0,0.06);
}

.tgp-msg__file-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #3390ec;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
}

.tgp-msg__file-info {
    flex: 1;
}

.tgp-msg__file-name {
    font-size: 12px;
    color: #222;
    font-weight: 500;
}

.tgp-msg__file-size {
    font-size: 10px;
    color: #707579;
}

/* Empty state */
.tgp-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
    color: #707579;
    flex: 1;
    background: #e6ebee;
}

.tgp-empty__icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.tgp-empty__text {
    font-size: 13px;
}

/* Auth */
.tgp-auth {
    padding: 24px;
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #e6ebee;
}

.tgp-auth__title {
    font-size: 15px;
    font-weight: 600;
    color: #222;
    margin-bottom: 6px;
}

.tgp-auth__text {
    font-size: 12px;
    color: #707579;
    margin-bottom: 12px;
}

.tgp-auth__input {
    width: 100%;
    max-width: 180px;
    padding: 10px 12px;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
    margin-bottom: 10px;
    background: #fff;
    color: #222;
}

.tgp-auth__input:focus {
    border-color: #3390ec;
    outline: none;
}

.tgp-auth__input::placeholder {
    color: #a2acb4;
}

.tgp-auth__btn {
    padding: 10px 24px;
    background: #3390ec;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.tgp-auth__btn:hover {
    background: #2b7fd4;
}

/* Input area */
.tgp-input {
    padding: 8px 10px;
    background: #fff;
    border-top: 1px solid #e6e6e6;
    display: flex;
    align-items: flex-end;
    gap: 6px;
}

.tgp-input__actions {
    display: flex;
    align-items: center;
}

.tgp-input__action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #707579;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.tgp-input__action-btn:hover {
    background: #f4f4f5;
    color: #222;
}

.tgp-input__action-btn svg {
    width: 18px;
    height: 18px;
}

.tgp-input__field {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e6e6e6;
    border-radius: 18px;
    font-size: 13px;
    resize: none;
    outline: none;
    max-height: 80px;
    transition: border-color 0.15s;
    background: #fff;
    color: #222;
}

.tgp-input__field::placeholder {
    color: #a2acb4;
}

.tgp-input__field:focus {
    border-color: #3390ec;
}

.tgp-input__send {
    width: 34px;
    height: 34px;
    border: none;
    background: #3390ec;
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.tgp-input__send:hover {
    background: #2b7fd4;
}

.tgp-input__send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tgp-input__send svg {
    width: 16px;
    height: 16px;
}

/* Voice Recording UI */
.tgp-voice-recording {
    display: none;
    flex: 1;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 18px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.tgp-voice-recording.active {
    display: flex;
}

.tgp-voice-recording__indicator {
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    animation: pulse-red 1s ease-in-out infinite;
    animation-play-state: paused; /* CPU: paused by default */
}

/* CPU: run pulse animation only when recording is active */
.tgp-voice-recording.active .tgp-voice-recording__indicator {
    animation-play-state: running;
}

/* A11y: disable animation for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .tgp-voice-recording__indicator,
    .tgp-voice-recording__bar,
    .tgp-loading__spinner,
    .tg-wave-bar,
    .tg-chat-toggle__ring,
    .tg-rec-dot,
    .phone-widget__spinner {
        animation: none !important;
    }
}

@keyframes pulse-red {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

.tgp-voice-recording__time {
    font-size: 13px;
    font-weight: 600;
    color: #ef4444;
    min-width: 45px;
}

.tgp-voice-recording__wave {
    flex: 1;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.tgp-voice-recording__bar {
    width: 3px;
    height: 100%;
    background: rgba(239, 68, 68, 0.5);
    border-radius: 2px;
    animation: wave 0.5s ease-in-out infinite alternate;
    animation-play-state: paused; /* CPU: paused by default */
}

/* CPU: run wave animation only when recording is active */
.tgp-voice-recording.active .tgp-voice-recording__bar {
    animation-play-state: running;
}

.tgp-voice-recording__bar:nth-child(1) { animation-delay: 0s; height: 40%; }
.tgp-voice-recording__bar:nth-child(2) { animation-delay: 0.1s; height: 70%; }
.tgp-voice-recording__bar:nth-child(3) { animation-delay: 0.2s; height: 100%; }
.tgp-voice-recording__bar:nth-child(4) { animation-delay: 0.3s; height: 60%; }
.tgp-voice-recording__bar:nth-child(5) { animation-delay: 0.4s; height: 80%; }
.tgp-voice-recording__bar:nth-child(6) { animation-delay: 0.5s; height: 50%; }
.tgp-voice-recording__bar:nth-child(7) { animation-delay: 0.6s; height: 90%; }

@keyframes wave {
    from { transform: scaleY(0.5); }
    to { transform: scaleY(1); }
}

.tgp-voice-recording__cancel {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.tgp-voice-recording__cancel:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #fff;
}

/* Typing indicator */
.tgp-typing {
    display: none;
    padding: 6px 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

.tgp-typing.active {
    display: block;
}

/* Loading */
.tgp-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    flex: 1;
}

.tgp-loading__spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #0088cc;
    border-radius: 50%;
    animation: tgp-spin 0.8s linear infinite;
    animation-play-state: paused; /* CPU: paused by default */
}

/* CPU: run spin animation only when widget is active */
.tgp-widget.active .tgp-loading__spinner {
    animation-play-state: running;
}

@keyframes tgp-spin {
    to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   EXTRACTED: CHAT STYLES Block 3 (chat widget + bubbles + keyframes tg-*)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ===== CHAT WIDGET ===== */
.tg-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Hidden state for non-admin placeholder only (scoped selector) */
[data-chat-widget="crm"][hidden] {
    display: none;
}

/* Hidden state for admin widget; protects against display overrides */
#tgChatWidget[hidden] {
    display: none;
}

/* Toggle Button - скрываем, используем кнопку из bottom-action-panel */
.tg-chat-toggle {
    display: none;
}

.tg-chat-toggle__ring {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid rgba(102, 126, 234, 0.3);
    animation: tg-ring-pulse 2s ease-out infinite;
    /* Reduce idle animations: paused while parent is hidden (no JS state to enable) */
    animation-play-state: paused;
}

@keyframes tg-ring-pulse {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.4); opacity: 0; }
}

.tg-chat-toggle__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.tg-chat-toggle__icon svg {
    width: 28px;
    height: 28px;
    color: #fff;
    transition: all 0.3s ease;
}

.tg-icon-close {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.tg-chat-widget.active .tg-icon-chat {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

.tg-chat-widget.active .tg-icon-close {
    opacity: 1;
    transform: rotate(0) scale(1);
}

.tg-chat-toggle__badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: #ef4444;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: tg-badge-bounce 0.5s ease;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

@keyframes tg-badge-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Chat Window */
.tg-chat-window {
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 480px;
    height: 480px;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    border-radius: 16px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tg-chat-widget.active .tg-chat-window {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Two-panel Layout */
.tg-chat-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.tg-chat-sidebar {
    width: 140px;
    min-width: 140px;
    background: rgba(0, 0, 0, 0.3);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
}

.tg-chat-sidebar__header {
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tg-chat-sidebar__list {
    flex: 1;
    overflow-y: auto;
}

.tg-chat-sidebar__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.tg-chat-sidebar__item:hover {
    background: rgba(102, 126, 234, 0.15);
}

.tg-chat-sidebar__item.active {
    background: rgba(102, 126, 234, 0.25);
}

.tg-chat-sidebar__avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    background: rgba(15, 23, 42, 0.95);
}

.tg-chat-sidebar__avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(248, 250, 252, 0.95);
}

.tg-chat-sidebar__info {
    flex: 1;
    min-width: 0;
}

.tg-chat-sidebar__name {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tg-chat-sidebar__preview {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
}

.tg-chat-sidebar__badge {
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: linear-gradient(135deg, #fb923c, #f97316);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.85), 0 2px 6px rgba(0, 0, 0, 0.35);
}

/* Main chat area */
.tg-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Header */
.tg-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    cursor: move;
    user-select: none;
}

.tg-chat-header.dragging {
    cursor: grabbing;
}

.tg-chat-header__left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tg-chat-avatar {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.95);
}

.tg-chat-avatar__icon {
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tg-chat-avatar__icon svg {
    color: rgba(255, 255, 255, 0.5);
}

.tg-chat-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(15, 23, 42, 0.9);
}

.tg-chat-info {
    display: flex;
    flex-direction: column;
}

.tg-chat-name {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

.tg-chat-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.tg-chat-header__actions {
    display: flex;
    gap: 8px;
}

.tg-chat-action {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.tg-chat-action:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.tg-chat-action svg {
    width: 18px;
    height: 18px;
}

/* Search Panel */
.tg-chat-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tg-chat-search input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 8px 12px;
    color: #fff;
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
}

.tg-chat-search input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.tg-chat-search input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(99, 102, 241, 0.5);
}

.tg-chat-search button {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s ease;
}

.tg-chat-search button:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Messages Area */
.tg-chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 320px;
    scroll-behavior: smooth;
}

.tg-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.tg-chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.tg-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.tg-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Welcome Screen */
.tg-chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    flex: 1;
}

.tg-chat-welcome__icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.tg-chat-welcome__icon svg {
    width: 40px;
    height: 40px;
    color: #667eea;
}

.tg-chat-welcome__title,
.tg-chat-welcome h3 {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px;
}

.tg-chat-welcome__text,
.tg-chat-welcome p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    margin: 0;
    max-width: 260px;
}

/* Message Bubbles */
.tg-msg {
    max-width: 88%;
    display: flex;
    flex-direction: column;
    animation: tg-msg-appear 0.3s ease;
}

@keyframes tg-msg-appear {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tg-msg--in {
    align-self: flex-start;
}

.tg-msg--out {
    align-self: flex-end;
}

.tg-msg__bubble {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.tg-msg--in .tg-msg__bubble {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-bottom-left-radius: 6px;
}

.tg-msg--out .tg-msg__bubble {
    background: #dcf8c6;
    color: #111827;
    border-bottom-right-radius: 6px;
}

.tg-msg__meta-inline {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    margin-left: 8px;
    vertical-align: middle;
    opacity: 0.6;
    white-space: nowrap;
}

.tg-msg__time {
    font-size: 11px;
}

.tg-msg--out .tg-msg__time {
    color: #111827;
}

.tg-msg--in .tg-msg__time {
    color: rgba(255, 255, 255, 0.7);
}

.tg-msg__status {
    display: inline-flex;
    align-items: center;
    margin-left: 2px;
    font-size: 10px;
    letter-spacing: -0.15em;
}

.tg-msg--out .tg-msg__status {
    color: #34a853;
}

/* Image in message */
.tg-msg__image {
    max-width: 200px;
    max-height: 200px;
    object-fit: cover;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.tg-msg__image:hover {
    transform: scale(1.02);
}

/* Video in message */
.tg-msg__video {
    max-width: 250px;
    max-height: 200px;
    border-radius: 12px;
    cursor: pointer;
}

/* Report card */
.tg-msg__report {
    background: linear-gradient(135deg, #2d2d3a 0%, #1a1a24 100%);
    border-radius: 12px;
    padding: 12px 16px;
    border-left: 3px solid #ffc107;
    max-width: 320px;
}

.tg-msg__report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.tg-msg__report-title {
    font-weight: 600;
    color: #ffc107;
    font-size: 14px;
}

.tg-msg__report-download {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    text-decoration: none;
    transition: background 0.2s ease;
}

.tg-msg__report-download:hover {
    background: rgba(255, 193, 7, 0.4);
}

.tg-msg__report-info {
    font-size: 12px;
    color: rgba(255,255,255,0.8);
    line-height: 1.5;
}

.tg-msg__report-info div {
    margin-bottom: 4px;
}

.tg-msg__report-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.tg-msg__report-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.tg-msg__report-thumb:hover {
    transform: scale(1.1);
}

video.tg-msg__report-thumb {
    width: 100px;
    height: 80px;
}

/* Voice message */
.tg-msg__voice {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
    max-width: 280px;
}

.tg-msg__voice-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.tg-msg__voice-play {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #3ba55d;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.15s;
}

.tg-msg__voice-play:hover {
    background: #2d8a4a;
}

.tg-msg__voice-dur {
    font-size: 11px;
    color: #3ba55d;
    font-weight: 500;
}

.tg-msg__voice-center {
    flex: 1;
    min-width: 80px;
}

.tg-msg__voice-bars {
    height: 28px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 140 28'%3E%3Crect x='0' y='12' width='3' height='4' rx='1' fill='%233ba55d'/%3E%3Crect x='5' y='9' width='3' height='10' rx='1' fill='%233ba55d'/%3E%3Crect x='10' y='4' width='3' height='20' rx='1' fill='%233ba55d'/%3E%3Crect x='15' y='10' width='3' height='8' rx='1' fill='%233ba55d'/%3E%3Crect x='20' y='5' width='3' height='18' rx='1' fill='%233ba55d'/%3E%3Crect x='25' y='11' width='3' height='6' rx='1' fill='%233ba55d'/%3E%3Crect x='30' y='6' width='3' height='16' rx='1' fill='%233ba55d'/%3E%3Crect x='35' y='2' width='3' height='24' rx='1' fill='%233ba55d'/%3E%3Crect x='40' y='8' width='3' height='12' rx='1' fill='%233ba55d'/%3E%3Crect x='45' y='5' width='3' height='18' rx='1' fill='%233ba55d'/%3E%3Crect x='50' y='10' width='3' height='8' rx='1' fill='%233ba55d'/%3E%3Crect x='55' y='4' width='3' height='20' rx='1' fill='%233ba55d'/%3E%3Crect x='60' y='7' width='3' height='14' rx='1' fill='%233ba55d'/%3E%3Crect x='65' y='11' width='3' height='6' rx='1' fill='%233ba55d'/%3E%3Crect x='70' y='5' width='3' height='18' rx='1' fill='%233ba55d'/%3E%3Crect x='75' y='8' width='3' height='12' rx='1' fill='%233ba55d'/%3E%3Crect x='80' y='3' width='3' height='22' rx='1' fill='%233ba55d'/%3E%3Crect x='85' y='7' width='3' height='14' rx='1' fill='%233ba55d'/%3E%3Crect x='90' y='10' width='3' height='8' rx='1' fill='%233ba55d'/%3E%3Crect x='95' y='5' width='3' height='18' rx='1' fill='%233ba55d'/%3E%3Crect x='100' y='8' width='3' height='12' rx='1' fill='%233ba55d'/%3E%3Crect x='105' y='4' width='3' height='20' rx='1' fill='%233ba55d'/%3E%3Crect x='110' y='11' width='3' height='6' rx='1' fill='%233ba55d'/%3E%3Crect x='115' y='7' width='3' height='14' rx='1' fill='%233ba55d'/%3E%3Crect x='120' y='9' width='3' height='10' rx='1' fill='%233ba55d'/%3E%3Crect x='125' y='12' width='3' height='4' rx='1' fill='%233ba55d'/%3E%3C/svg%3E") left center/contain no-repeat;
}

.tg-msg__voice-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.tg-msg__bubble--voice {
    padding: 6px 8px !important;
}

/* Document */
.tg-msg__doc {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    text-decoration: none;
    color: #fff;
    font-size: 13px;
}

.tg-msg__doc:hover {
    background: rgba(0,0,0,0.3);
}

/* extracted: CHAT STYLES Block 4 (input/file preview/voice UI + keyframes tg-recording-pulse/tg-rec-blink/tg-wave-bar-animate) */

/* Input Area */
.tg-chat-input-area {
    padding: 12px 16px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.tg-chat-attachments {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.tg-attach-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.tg-attach-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.tg-attach-btn svg {
    width: 18px;
    height: 18px;
}

.tg-attach-btn.recording {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    animation: tg-recording-pulse 1s ease infinite;
}

@keyframes tg-recording-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.tg-chat-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 8px 8px 8px 16px;
    transition: border-color 0.2s ease;
}

.tg-chat-input-wrap:focus-within {
    border-color: rgba(102, 126, 234, 0.5);
}

.tg-chat-input-wrap textarea {
    flex: 1;
    background: none;
    border: none;
    color: #fff;
    font-size: 14px;
    resize: none;
    outline: none;
    max-height: 120px;
    line-height: 1.4;
}

.tg-chat-input-wrap textarea::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.tg-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0.5;
}

.tg-send-btn:not(:disabled) {
    opacity: 1;
}

.tg-send-btn:not(:disabled):hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.tg-send-btn svg {
    width: 18px;
    height: 18px;
}

/* File Preview */
.tg-file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0;
}

.tg-file-preview__item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    max-width: 200px;
}

.tg-file-preview__item img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
}

.tg-file-preview__info {
    flex: 1;
    min-width: 0;
}

.tg-file-preview__name {
    font-size: 12px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tg-file-preview__size {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
}

.tg-file-preview__remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: #ef4444;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Voice Recording UI */
.tg-voice-recording {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.15);
    border-radius: 12px;
    margin-top: 10px;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.tg-rec-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tg-rec-dot {
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
    animation: tg-rec-blink 1s ease-in-out infinite;
    /* Paused by default; enabled when recording is active */
    animation-play-state: paused;
}

.tg-voice-recording.active .tg-rec-dot {
    animation-play-state: running;
}

@keyframes tg-rec-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.tg-rec-label {
    font-size: 11px;
    font-weight: 700;
    color: #ef4444;
    letter-spacing: 1px;
}

.tg-voice-wave-bars {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 32px;
    padding: 0 8px;
}

.tg-wave-bar {
    width: 3px;
    background: linear-gradient(180deg, #ef4444, #f87171);
    border-radius: 2px;
    animation: tg-wave-bar-animate 0.5s ease-in-out infinite;
    animation-play-state: paused; /* CPU: paused by default */
}

/* CPU: run wave animation only when recording is active */
.tg-voice-recording.active .tg-wave-bar {
    animation-play-state: running;
}

.tg-wave-bar:nth-child(1) { animation-delay: 0.0s; height: 8px; }
.tg-wave-bar:nth-child(2) { animation-delay: 0.1s; height: 16px; }
.tg-wave-bar:nth-child(3) { animation-delay: 0.2s; height: 24px; }
.tg-wave-bar:nth-child(4) { animation-delay: 0.15s; height: 12px; }
.tg-wave-bar:nth-child(5) { animation-delay: 0.25s; height: 28px; }
.tg-wave-bar:nth-child(6) { animation-delay: 0.05s; height: 20px; }
.tg-wave-bar:nth-child(7) { animation-delay: 0.3s; height: 14px; }
.tg-wave-bar:nth-child(8) { animation-delay: 0.12s; height: 26px; }
.tg-wave-bar:nth-child(9) { animation-delay: 0.22s; height: 10px; }
.tg-wave-bar:nth-child(10) { animation-delay: 0.08s; height: 22px; }
.tg-wave-bar:nth-child(11) { animation-delay: 0.18s; height: 18px; }
.tg-wave-bar:nth-child(12) { animation-delay: 0.28s; height: 30px; }
.tg-wave-bar:nth-child(13) { animation-delay: 0.13s; height: 16px; }
.tg-wave-bar:nth-child(14) { animation-delay: 0.23s; height: 24px; }
.tg-wave-bar:nth-child(15) { animation-delay: 0.03s; height: 12px; }

@keyframes tg-wave-bar-animate {
    0%, 100% { transform: scaleY(0.4); opacity: 0.6; }
    50% { transform: scaleY(1); opacity: 1; }
}

.tg-voice-time {
    font-size: 14px;
    font-weight: 600;
    color: #ef4444;
    min-width: 40px;
}

.tg-voice-cancel,
.tg-voice-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.tg-voice-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.tg-voice-send {
    background: #ef4444;
    color: #fff;
}

.tg-voice-send svg {
    width: 16px;
    height: 16px;
}

/* extracted: CHAT STYLES Block 5 (toast + mobile responsive + keyframes tg-toast-in/tg-toast-out) */

/* Toast Notifications */
.tg-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.tg-toast {
    background: linear-gradient(135deg, #1e1e2e 0%, #2d2d3a 100%);
    border-radius: 50px;
    padding: 10px 16px 10px 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 320px;
    max-width: 500px;
    animation: tg-toast-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: auto;
}

.tg-toast.tg-toast--out {
    animation: tg-toast-out 0.3s ease forwards;
}

.tg-toast__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.2);
}

.tg-toast__body {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tg-toast__name {
    font-weight: 600;
    color: #fff;
    font-size: 13px;
    white-space: nowrap;
}

.tg-toast__text {
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tg-toast__time {
    color: rgba(255,255,255,0.4);
    font-size: 11px;
    white-space: nowrap;
}

.tg-toast__close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 18px;
    line-height: 1;
    transition: color 0.2s;
    margin-left: 4px;
}

.tg-toast__close:hover {
    color: #fff;
}

@keyframes tg-toast-in {
    from { opacity: 0; transform: translateX(100px) scale(0.8); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes tg-toast-out {
    to { opacity: 0; transform: translateX(100px) scale(0.8); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .tg-chat-window {
        width: 100%;
        max-width: 560px;
    }
    .tg-chat-sidebar {
        width: 130px;
        min-width: 130px;
    }
    .tg-chat-sidebar__name {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .tg-chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    .tg-chat-sidebar {
        width: 60px;
        min-width: 60px;
    }
    .tg-chat-sidebar__header {
        padding: 10px;
        font-size: 11px;
        text-align: center;
    }
    .tg-chat-sidebar__item {
        padding: 10px;
        justify-content: center;
    }
    .tg-chat-sidebar__info {
        display: none;
    }
    .tg-chat-toggle {
        width: 56px;
        height: 56px;
    }
}

/* extracted: Calculator Widget (floating calculator) */

.calculator-window {
    position: fixed;
    bottom: 100px;
    right: 80px;
    width: 320px;
    background: rgba(15,20,35,0.97);
    border: 1px solid rgba(40,224,255,0.25);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    z-index: 1040;
    font-family: inherit;
}

.calculator-header {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(40,224,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
    background: linear-gradient(135deg, rgba(40,224,255,0.08), transparent);
}

.calc-close-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.calc-close-btn:hover {
    color: rgba(255,255,255,0.9);
    transform: rotate(90deg);
}

.calculator-body {
    padding: 12px;
}

.calc-display {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 8px;
    border: 1px solid rgba(40,224,255,0.2);
    background: rgba(255,255,255,0.04);
    color: rgba(40,224,255,0.95);
    font-size: 18px;
    font-weight: 500;
    text-align: right;
    font-family: monospace;
    box-sizing: border-box;
}

.calc-buttons-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}

.calc-btn {
    width: 100%;
    padding: 11px 6px;
    border-radius: 6px;
    border: 1px solid rgba(40,224,255,0.15);
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.9);
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    box-sizing: border-box;
}

.calc-btn:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(40,224,255,0.3);
    box-shadow: 0 2px 8px rgba(40,224,255,0.1);
}

.calc-btn:active {
    transform: scale(0.92);
}

.calc-operator {
    background: rgba(40,224,255,0.08);
    border-color: rgba(40,224,255,0.2);
    color: rgba(40,224,255,0.95);
}

.calc-equals {
    background: linear-gradient(135deg, rgba(40,224,255,0.25), rgba(40,224,255,0.1));
    border-color: rgba(40,224,255,0.35);
    color: rgba(40,224,255,0.95);
    font-weight: 600;
}

.calc-equals:hover {
    background: linear-gradient(135deg, rgba(40,224,255,0.35), rgba(40,224,255,0.2));
}

.calc-history-section {
    border-top: 1px solid rgba(40,224,255,0.1);
    padding-top: 10px;
}

.calc-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.calc-history-clear-btn {
    padding: 2px 8px;
    font-size: 9px;
    color: rgba(255,255,255,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.calc-history-clear-btn:hover {
    color: rgba(255,255,255,0.7);
    border-color: rgba(255,255,255,0.2);
}

.calc-history-list {
    max-height: 140px;
    overflow-y: auto;
    border-radius: 6px;
    background: rgba(255,255,255,0.02);
    padding: 8px;
    border: 1px solid rgba(40,224,255,0.1);
}

.calc-history-list::-webkit-scrollbar {
    width: 4px;
}

.calc-history-list::-webkit-scrollbar-track {
    background: transparent;
}

.calc-history-list::-webkit-scrollbar-thumb {
    background: rgba(40,224,255,0.2);
    border-radius: 2px;
}

.calc-history-list::-webkit-scrollbar-thumb:hover {
    background: rgba(40,224,255,0.3);
}

.calc-history-item {
    padding: 6px;
    margin: 2px 0;
    border-radius: 4px;
    background: rgba(255,255,255,0.03);
    border-left: 2px solid rgba(40,224,255,0.2);
    cursor: pointer;
    transition: all 0.12s ease;
    font-size: 9px;
}

.calc-history-item:hover {
    background: rgba(255,255,255,0.06);
    border-left-color: rgba(40,224,255,0.6);
}

.calc-history-time {
    font-size: 8px;
    color: rgba(255,255,255,0.3);
}

.calc-history-expr {
    font-size: 9px;
    color: rgba(255,255,255,0.6);
}

.calc-history-result {
    font-size: 10px;
    color: rgba(40,224,255,0.9);
    font-weight: 500;
}

/* extracted: Connect Modal (request connect) */

/* ========== МОДАЛЬНОЕ ОКНО ЗАЯВКИ НА ПОДКЛЮЧЕНИЕ ========== */
.connect-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.connect-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
}

.connect-modal__content {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: linear-gradient(145deg, rgba(30, 36, 50, 0.98), rgba(20, 26, 40, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    animation: connectModalIn 0.25s ease-out;
}

@keyframes connectModalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.connect-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.connect-modal__title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.connect-modal__close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s;
}

.connect-modal__close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.connect-modal__close svg {
    width: 18px;
    height: 18px;
}

.connect-modal__body {
    padding: 20px;
}

.connect-modal__subtitle {
    margin: 0 0 20px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.5;
}

.connect-modal__field {
    margin-bottom: 16px;
}

.connect-modal__field:last-child {
    margin-bottom: 0;
}

.connect-modal__field label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
}

.connect-modal__field input,
.connect-modal__field textarea {
    width: 100%;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    transition: all 0.2s;
}

.connect-modal__field input::placeholder,
.connect-modal__field textarea::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.connect-modal__field input:focus,
.connect-modal__field textarea:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.connect-modal__field textarea {
    resize: vertical;
    min-height: 80px;
}

.connect-modal__footer {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.connect-modal__btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.connect-modal__btn--cancel {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
}

.connect-modal__btn--cancel:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.connect-modal__btn--submit {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.connect-modal__btn--submit:hover {
    background: linear-gradient(135deg, #34d399, #10b981);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

/* Кнопка "Подключить" в виджетах */
.phone-widget__info-btn--connect {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, #10b981, #059669) !important;
    border: none !important;
    border-radius: 10px;
    color: #fff !important;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.phone-widget__info-btn--connect:hover {
    background: linear-gradient(135deg, #34d399, #10b981) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.phone-widget__info-btn--connect svg {
    flex-shrink: 0;
}

/* Кнопка подключения чата (фиолетовая) */
.phone-widget__info-btn--chat {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed) !important;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.phone-widget__info-btn--chat:hover {
    background: linear-gradient(135deg, #a78bfa, #8b5cf6) !important;
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

/* Информационное окно чата для не-админов */
.tg-chat-widget--info .tg-chat-window--info {
    width: 280px !important;
    min-width: 280px !important;
    max-width: 280px !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(26, 32, 44, 0.98), rgba(17, 24, 39, 0.98));
}

.tg-chat-widget--info .tg-chat-window--info .phone-widget__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tg-chat-widget--info .tg-chat-window--info .phone-widget__info-body {
    padding: 20px 16px;
}

.tg-chat-widget--info .tg-chat-window--info .phone-widget__info-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(168, 85, 247, 0.08));
}

.tg-chat-widget--info .tg-chat-window--info .phone-widget__info-icon svg {
    width: 28px;
    height: 28px;
}

.tg-chat-widget--info .tg-chat-window--info .phone-widget__info-title {
    text-align: center;
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.tg-chat-widget--info .tg-chat-window--info .phone-widget__info-text {
    margin: 0 0 16px;
    font-size: 13px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.7);
}
/* extracted: Phone Widget Part A (base/header/tabs) */
/* ========== ТЕЛЕФОННЫЙ ВИДЖЕТ СТИЛИ ========== */
.phone-widget {
    position: fixed;
    bottom: 80px;
    right: 24px;
    width: 260px;
    background: linear-gradient(145deg, rgba(26, 32, 44, 0.98), rgba(17, 24, 39, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    z-index: 10000;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Информационная версия для не-админов */
.phone-widget--info {
    width: 280px;
}

.phone-widget__info-body {
    padding: 24px 20px;
    text-align: center;
}

.phone-widget__info-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.phone-widget__info-icon svg {
    width: 28px;
    height: 28px;
    color: #3b82f6;
}

.phone-widget__info-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 12px;
}

.phone-widget__info-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.5;
    margin: 0 0 20px;
    text-align: left;
}

.phone-widget__info-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s;
}

.phone-widget__info-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
    color: #fff;
}

.phone-widget__info-btn--disabled {
    background: rgba(100, 100, 120, 0.3);
    cursor: not-allowed;
    opacity: 0.7;
}

.phone-widget__info-btn--disabled:hover {
    transform: none;
    box-shadow: none;
}

.phone-widget__header {
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.15));
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
}

.phone-widget__header-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.phone-widget__status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
}

.phone-widget__status-dot.error {
    background: #ef4444;
}

.phone-widget__title {
    font-weight: 600;
    font-size: 13px;
    color: #fff;
}

.phone-widget__status-text {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
}

.phone-widget__header-actions {
    display: flex;
    gap: 4px;
}

.phone-widget__btn-minimize,
.phone-widget__btn-close {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.phone-widget__btn-minimize:hover,
.phone-widget__btn-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.phone-widget__btn-minimize svg,
.phone-widget__btn-close svg {
    width: 12px;
    height: 12px;
}

.phone-widget__body {
    padding: 0;
}

/* Табы */
.phone-widget__tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
}

.phone-widget__tab {
    flex: 1;
    padding: 8px 6px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.phone-widget__tab svg {
    width: 14px;
    height: 14px;
}

.phone-widget__tab:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.05);
}

.phone-widget__tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

/* Панели */
.phone-widget__panel {
    display: none;
    padding: 12px;
}

.phone-widget__panel.active {
    display: block;
}

/* extracted: Phone Widget Part B (dialpad/call/history/contacts) */
/* Дисплей номера */
.phone-widget__display {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 6px 6px 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
}

.phone-widget__number-input {
    flex: 1;
    background: none;
    border: none;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1px;
    outline: none;
}

.phone-widget__number-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-size: 12px;
    font-weight: 400;
}

.phone-widget__backspace {
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: rgba(239, 68, 68, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    position: relative;
    right: 5px;
}

.phone-widget__backspace:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.phone-widget__backspace svg {
    width: 14px;
    height: 14px;
}

/* Клавиатура */
.phone-widget__dialpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-bottom: 12px;
    max-width: 150px;
    margin-left: auto;
    margin-right: auto;
}

.phone-widget__key {
    aspect-ratio: 1;
    max-height: 36px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    position: relative;
    overflow: hidden;
}

.phone-widget__key::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(139, 92, 246, 0.3));
    opacity: 0;
    transition: opacity 0.15s;
}

.phone-widget__key:hover::before {
    opacity: 1;
}

.phone-widget__key:active {
    transform: scale(0.95);
}

/* Кнопка звонка */
.phone-widget__actions {
    display: flex;
    justify-content: center;
}

.phone-widget__call-btn {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.phone-widget__call-btn svg {
    width: 22px;
    height: 22px;
}

.phone-widget__call-btn--green {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}

.phone-widget__call-btn--green:hover {
    background: linear-gradient(135deg, #34d399, #10b981);
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(16, 185, 129, 0.4);
}

.phone-widget__call-btn--red {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}

.phone-widget__call-btn--red:hover {
    background: linear-gradient(135deg, #f87171, #ef4444);
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(239, 68, 68, 0.4);
}

.phone-widget__call-btn--red svg {
    transform: rotate(135deg);
}

/* Панель активного звонка */
.phone-widget__call-info {
    text-align: center;
    padding: 20px 0;
}

.phone-widget__call-avatar {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(139, 92, 246, 0.3));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.8);
}

.phone-widget__call-avatar svg {
    width: 40px;
    height: 40px;
}

.phone-widget__call-number {
    font-size: 22px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.phone-widget__call-status {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.phone-widget__call-status.calling {
    color: #f59e0b;
}

.phone-widget__call-status.connected {
    color: #10b981;
}

.phone-widget__call-timer {
    font-size: 28px;
    font-weight: 300;
    color: #10b981;
    margin-top: 8px;
    font-variant-numeric: tabular-nums;
}

.phone-widget__call-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 16px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin: 16px 0;
}

.phone-widget__action-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    padding: 8px;
    border-radius: 12px;
}

.phone-widget__action-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.phone-widget__action-btn.active {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.2);
}

.phone-widget__action-btn svg {
    width: 24px;
    height: 24px;
}

.phone-widget__action-btn span {
    font-size: 10px;
    font-weight: 500;
}

.phone-widget__hangup-wrapper {
    display: flex;
    justify-content: center;
    padding-top: 8px;
}

/* История */
.phone-widget__history-list {
    max-height: 300px;
    overflow-y: auto;
}

.phone-widget__history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 6px;
}

.phone-widget__history-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.phone-widget__history-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.phone-widget__history-icon svg {
    width: 18px;
    height: 18px;
}

.phone-widget__history-icon--outgoing {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.phone-widget__history-icon--incoming {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.phone-widget__history-icon--missed {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.phone-widget__history-info {
    flex: 1;
    min-width: 0;
}

.phone-widget__history-number {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.phone-widget__history-meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    gap: 8px;
}

.phone-widget__history-call-btn {
    width: 36px;
    height: 36px;
    background: rgba(16, 185, 129, 0.2);
    border: none;
    border-radius: 10px;
    color: #10b981;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s;
}

.phone-widget__history-item:hover .phone-widget__history-call-btn {
    opacity: 1;
}

.phone-widget__history-call-btn:hover {
    background: rgba(16, 185, 129, 0.3);
}

.phone-widget__history-call-btn svg {
    width: 16px;
    height: 16px;
}

/* Контакты */
.phone-widget__search {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.phone-widget__search svg {
    width: 16px;
    height: 16px;
    color: rgba(255, 255, 255, 0.4);
}

.phone-widget__search input {
    flex: 1;
    background: none;
    border: none;
    color: #fff;
    font-size: 13px;
    outline: none;
}

.phone-widget__search input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.phone-widget__contacts-list {
    max-height: 280px;
    overflow-y: auto;
}

.phone-widget__contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.phone-widget__contact-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.phone-widget__contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(139, 92, 246, 0.3));
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
    font-size: 14px;
}

.phone-widget__contact-info {
    flex: 1;
    min-width: 0;
}

.phone-widget__contact-name {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.phone-widget__contact-phone {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

/* extracted: Phone Widget Part C (loading/minimized/scrollbar + keyframes phone-pulse/phone-spin) */
/* Загрузка */
.phone-widget__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    gap: 12px;
}

.phone-widget__spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: phone-spin 0.8s linear infinite;
    /* Paused by default; enabled only inside loading container */
    animation-play-state: paused;
}

.phone-widget__loading .phone-widget__spinner {
    animation-play-state: running;
}

/* Spinner active during call state (call panel spinner only) */
.phone-widget.is-loading #callPanel .phone-widget__spinner {
    animation-play-state: running;
}

@keyframes phone-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes phone-spin {
    to { transform: rotate(360deg); }
}

/* Пустое состояние */
.phone-widget__empty {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.5);
}

.phone-widget__empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.phone-widget__empty-text {
    font-size: 13px;
}

/* Свернутый виджет */
.phone-widget.minimized {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    bottom: 100px;
    right: 90px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.phone-widget.minimized .phone-widget__header,
.phone-widget.minimized .phone-widget__body {
    display: none;
}

.phone-widget.minimized::after {
    content: '';
    width: 28px;
    height: 28px;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z'/%3E%3C/svg%3E");
    background-size: contain;
}

/* Скроллбар */
.phone-widget__history-list::-webkit-scrollbar,
.phone-widget__contacts-list::-webkit-scrollbar {
    width: 4px;
}

.phone-widget__history-list::-webkit-scrollbar-track,
.phone-widget__contacts-list::-webkit-scrollbar-track {
    background: transparent;
}

.phone-widget__history-list::-webkit-scrollbar-thumb,
.phone-widget__contacts-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}