        :root {
            --primary: #6c5ce7;
            --primary-light: #a29bfe;
            --success: #00b894;
            --success-light: #55efc4;
            --warning: #fdcb6e;
            --danger: #d63031;
            --dark: #2d3436;
            --grey: #636e72;
            --light-grey: #f5f6fa;
            --white: #ffffff;
            
            --sleeping: #ffeaa7;
            --sleeping-text: #d63031;
            --active-dialog: #74b9ff;
            --active-dialog-text: #ffffff;
            --paused-ai: #b2bec3;
            --paused-ai-text: #2d3436;
            --reactivated: #00b894;
            --reactivated-text: #ffffff;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Inter', sans-serif;
            background: linear-gradient(135deg, #0f0c20 0%, #15102a 50%, #090714 100%);
            color: #e2e8f0;
            min-height: 100vh;
            padding: 20px;
        }

        .app-container {
            max-width: 1400px;
            margin: 0 auto;
            background: rgba(25, 20, 46, 0.65);
            backdrop-filter: blur(15px);
            border: 1px solid rgba(255, 255, 255, 0.08);
            border-radius: 20px;
            box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
            overflow: hidden;
            display: flex;
            flex-direction: column;
        }

        .header {
            background: linear-gradient(135deg, rgba(108, 92, 231, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
            padding: 25px 30px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.08);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .header-title h1 {
            font-family: 'Outfit', sans-serif;
            font-size: 2.2rem;
            font-weight: 700;
            background: linear-gradient(to right, #a29bfe, #e0c3fc);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            margin-bottom: 5px;
        }

        .header-title p {
            font-size: 0.95rem;
            color: #a0aec0;
            letter-spacing: 0.5px;
        }

        .stats-panel {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 15px;
            padding: 25px 30px;
            background: rgba(10, 7, 20, 0.4);
            border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        }

        .stat-card {
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid rgba(255, 255, 255, 0.05);
            padding: 20px;
            border-radius: 12px;
            text-align: center;
            transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        }

        .stat-card:hover {
            transform: translateY(-4px);
            background: rgba(255, 255, 255, 0.06);
            border-color: rgba(108, 92, 231, 0.3);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
        }

        .stat-card .stat-value {
            font-size: 2.2rem;
            font-weight: 700;
            color: #a29bfe;
            margin: 5px 0;
            font-family: 'Outfit', sans-serif;
        }

        .stat-card .stat-label {
            color: #cbd5e0;
            font-size: 0.8rem;
            text-transform: uppercase;
            letter-spacing: 1px;
            font-weight: 600;
        }

        .main-layout {
            display: grid;
            grid-template-columns: 1fr 450px;
            min-height: 600px;
        }

        @media (max-width: 1100px) {
            .main-layout {
                grid-template-columns: 1fr;
            }
        }

        /* Left Side: Client List & Controls */
        .workspace-left {
            padding: 30px;
            border-right: 1px solid rgba(255, 255, 255, 0.08);
            overflow-y: auto;
        }

        .controls-section {
            background: rgba(255, 255, 255, 0.02);
            border: 1px solid rgba(255, 255, 255, 0.04);
            padding: 20px;
            border-radius: 12px;
            margin-bottom: 25px;
        }

        .quick-actions {
            display: flex;
            gap: 10px;
            margin-bottom: 15px;
            flex-wrap: wrap;
        }

        .quick-action-btn {
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.08);
            color: #e2e8f0;
            padding: 8px 14px;
            border-radius: 8px;
            font-size: 0.85rem;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .quick-action-btn:hover {
            background: rgba(108, 92, 231, 0.2);
            border-color: var(--primary-light);
        }

        .control-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
            font-size: 0.9rem;
            color: #cbd5e0;
        }

        #campaign-prompt {
            width: 100%;
            height: 90px;
            padding: 12px;
            background: rgba(10, 7, 20, 0.5);
            border: 1px solid rgba(255, 255, 255, 0.1);
            color: #e2e8f0;
            border-radius: 8px;
            font-size: 0.95rem;
            resize: vertical;
            transition: all 0.3s;
            font-family: inherit;
        }

        #campaign-prompt:focus {
            outline: none;
            border-color: var(--primary-light);
            box-shadow: 0 0 10px rgba(108, 92, 231, 0.2);
        }

        .button-group {
            display: flex;
            gap: 12px;
            margin-top: 15px;
            flex-wrap: wrap;
        }

        .btn {
            padding: 10px 20px;
            border: none;
            border-radius: 8px;
            font-size: 0.9rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .btn-primary {
            background: linear-gradient(135deg, #6c5ce7 0%, #8e2de2 100%);
            color: white;
            box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
        }

        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
        }

        .btn-secondary {
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid rgba(255, 255, 255, 0.1);
            color: #e2e8f0;
        }

        .btn-secondary:hover {
            background: rgba(255, 255, 255, 0.15);
        }

        .loading {
            display: none;
            text-align: center;
            padding: 15px;
            color: var(--primary-light);
            font-weight: 500;
        }

        .search-filter-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            gap: 15px;
            flex-wrap: wrap;
        }

        .search-box {
            position: relative;
            flex-grow: 1;
            max-width: 400px;
        }

        .search-box i {
            position: absolute;
            left: 12px;
            top: 12px;
            color: #718096;
        }

        .search-input {
            width: 100%;
            padding: 10px 15px 10px 38px;
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid rgba(255, 255, 255, 0.1);
            color: white;
            border-radius: 8px;
            font-size: 0.9rem;
            transition: all 0.3s;
        }

        .search-input:focus {
            outline: none;
            border-color: var(--primary-light);
            background: rgba(255, 255, 255, 0.07);
        }

        .filter-chips {
            display: flex;
            gap: 6px;
        }

        .filter-chip {
            padding: 6px 12px;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.08);
            border-radius: 20px;
            font-size: 0.8rem;
            color: #cbd5e0;
            cursor: pointer;
            transition: all 0.2s;
        }

        .filter-chip:hover {
            background: rgba(255, 255, 255, 0.1);
        }

        .filter-chip.active {
            background: var(--primary);
            color: white;
            border-color: var(--primary-light);
        }

        .client-table-container {
            border-radius: 12px;
            overflow: hidden;
            border: 1px solid rgba(255, 255, 255, 0.08);
            background: rgba(255, 255, 255, 0.01);
        }

        .client-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.9rem;
        }

        .client-table th {
            background: rgba(255, 255, 255, 0.04);
            color: #a0aec0;
            padding: 12px 15px;
            text-align: left;
            font-weight: 600;
            border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        }

        .client-table td {
            padding: 12px 15px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.05);
            color: #cbd5e0;
        }

        .client-table tr {
            cursor: pointer;
            transition: background 0.2s;
        }

        .client-table tr:hover {
            background: rgba(108, 92, 231, 0.06);
        }

        .client-table tr.selected {
            background: rgba(108, 92, 231, 0.12);
            border-left: 3px solid var(--primary-light);
        }

        .client-table tr.broadcast-selected {
            background: rgba(0, 184, 148, 0.08);
        }

        .client-table tr.selected.broadcast-selected {
            background: rgba(108, 92, 231, 0.2);
        }

        .client-cb {
            cursor: pointer;
            width: 17px;
            height: 17px;
            accent-color: #00b894;
            vertical-align: middle;
        }

        .status-badge {
            padding: 4px 10px;
            border-radius: 20px;
            font-size: 0.75rem;
            font-weight: 600;
            display: inline-block;
            text-align: center;
        }

        .badge-sleeping {
            background: rgba(253, 203, 110, 0.15);
            color: #ffeaa7;
            border: 1px solid rgba(253, 203, 110, 0.3);
        }

        .badge-active {
            background: rgba(116, 185, 255, 0.15);
            color: #74b9ff;
            border: 1px solid rgba(116, 185, 255, 0.3);
        }

        .badge-paused {
            background: rgba(214, 48, 49, 0.2);
            color: #ff7675;
            border: 1px solid rgba(214, 48, 49, 0.4);
            animation: pulse-paused 2s infinite;
        }

        @keyframes pulse-paused {
            0% { box-shadow: 0 0 0 0 rgba(214, 48, 49, 0.4); }
            70% { box-shadow: 0 0 0 6px rgba(214, 48, 49, 0); }
            100% { box-shadow: 0 0 0 0 rgba(214, 48, 49, 0); }
        }

        .badge-reactivated {
            background: rgba(0, 184, 148, 0.15);
            color: #55efc4;
            border: 1px solid rgba(0, 184, 148, 0.3);
        }

        /* Paused Alert Banner */
        .paused-alert-banner {
            background: linear-gradient(135deg, rgba(214, 48, 49, 0.85), rgba(225, 112, 85, 0.85));
            color: white;
            padding: 10px 16px;
            border-radius: 10px;
            margin-bottom: 12px;
            font-size: 0.85rem;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 10px;
            cursor: pointer;
            box-shadow: 0 4px 15px rgba(214, 48, 49, 0.3);
            transition: transform 0.2s, box-shadow 0.2s;
        }

        .paused-alert-banner:hover {
            transform: translateY(-1px);
            box-shadow: 0 6px 20px rgba(214, 48, 49, 0.4);
        }

        .badge-chip-count {
            background: #d63031;
            color: white;
            border-radius: 10px;
            padding: 2px 6px;
            font-size: 0.7rem;
            margin-left: 4px;
        }

        /* Right Side: Chat & Interruption Controls */
        .workspace-right {
            background: rgba(10, 8, 22, 0.5);
            display: flex;
            flex-direction: column;
            overflow: hidden;
            border-radius: 0 0 20px 0;
            border-left: 1px solid rgba(255, 255, 255, 0.08);
        }

        @media (max-width: 1100px) {
            .workspace-right {
                border-radius: 0 0 20px 20px;
                border-top: 1px solid rgba(255, 255, 255, 0.08);
            }
        }

        .chat-placeholder {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            flex-grow: 1;
            padding: 40px;
            text-align: center;
            color: #718096;
        }

        .chat-placeholder i {
            margin-bottom: 15px;
            opacity: 0.5;
        }

        .chat-placeholder p {
            font-size: 0.95rem;
            max-width: 250px;
            line-height: 1.5;
        }

        .chat-panel {
            display: flex;
            flex-direction: column;
            height: 100%;
        }

        .chat-header {
            padding: 20px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.08);
            background: rgba(255, 255, 255, 0.01);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .chat-client-info h3 {
            font-size: 1.05rem;
            font-weight: 600;
            color: white;
            margin-bottom: 4px;
        }

        .chat-client-info p {
            font-size: 0.8rem;
            color: #a0aec0;
        }

        .ai-status-control {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .ai-status-indicator {
            padding: 4px 8px;
            border-radius: 4px;
            font-size: 0.75rem;
            font-weight: 700;
        }

        .ai-status-on {
            background: rgba(0, 184, 148, 0.2);
            color: #00b894;
            border: 1px solid rgba(0, 184, 148, 0.3);
        }

        .ai-status-off {
            background: rgba(214, 48, 49, 0.2);
            color: #ff7675;
            border: 1px solid rgba(214, 48, 49, 0.3);
        }

        .ai-status-sleeping {
            background: rgba(108, 92, 231, 0.2);
            color: #a29bfe;
            border: 1px solid rgba(108, 92, 231, 0.3);
        }

        .btn-toggle-ai {
            background: rgba(255, 255, 255, 0.06);
            border: 1px solid rgba(255, 255, 255, 0.1);
            color: white;
            font-size: 0.75rem;
            padding: 6px 12px;
            border-radius: 6px;
            cursor: pointer;
            font-weight: 600;
            transition: all 0.2s;
        }

        .btn-toggle-ai:hover {
            background: rgba(255, 255, 255, 0.12);
        }

        .btn-reset-client {
            background: rgba(255, 118, 117, 0.1);
            border: 1px solid rgba(255, 118, 117, 0.3);
            color: #ff7675;
            font-size: 0.75rem;
            padding: 6px 12px;
            border-radius: 6px;
            cursor: pointer;
            font-weight: 600;
            transition: all 0.2s;
            margin-left: 8px;
        }

        .btn-reset-client:hover {
            background: rgba(255, 118, 117, 0.2);
            box-shadow: 0 0 8px rgba(255, 118, 117, 0.2);
        }


        .chat-history {
            flex-grow: 1;
            padding: 20px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 12px;
            background: rgba(0, 0, 0, 0.2);
        }

        .chat-bubble {
            max-width: 80%;
            padding: 10px 14px;
            border-radius: 12px;
            font-size: 0.88rem;
            line-height: 1.4;
            word-wrap: break-word;
            white-space: pre-wrap;
        }

        .chat-bubble.client {
            background: rgba(255, 255, 255, 0.08);
            color: #e2e8f0;
            align-self: flex-start;
            border-bottom-left-radius: 2px;
        }

        .chat-bubble.assistant {
            background: var(--primary);
            color: white;
            align-self: flex-end;
            border-bottom-right-radius: 2px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }

        .chat-bubble-actions {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 5px;
            margin-top: 6px;
            padding-top: 5px;
            border-top: 1px dashed rgba(255, 255, 255, 0.2);
            font-size: 0.72rem;
        }

        .chat-fb-btn {
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 6px;
            color: rgba(255, 255, 255, 0.8);
            padding: 2px 7px;
            font-size: 0.72rem;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 4px;
            transition: all 0.2s ease;
        }

        .chat-fb-btn:hover {
            background: rgba(255, 255, 255, 0.25);
            color: #fff;
        }

        .chat-fb-btn.active-positive {
            background: rgba(16, 185, 129, 0.3);
            border-color: rgba(16, 185, 129, 0.6);
            color: #34d399;
            font-weight: 600;
        }

        .chat-fb-btn.active-negative {
            background: rgba(239, 68, 68, 0.3);
            border-color: rgba(239, 68, 68, 0.6);
            color: #f87171;
            font-weight: 600;
        }

        .chat-fb-status {
            font-size: 0.68rem;
            color: #34d399;
            margin-left: 4px;
            display: inline-flex;
            align-items: center;
            gap: 3px;
        }

        .chat-correction-box {
            margin-top: 8px;
            padding: 8px;
            background: rgba(0, 0, 0, 0.35);
            border: 1px solid rgba(139, 92, 246, 0.4);
            border-radius: 8px;
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .chat-correction-box textarea {
            width: 100%;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.15);
            border-radius: 6px;
            color: white;
            padding: 6px;
            font-size: 0.78rem;
            resize: vertical;
            min-height: 55px;
        }

        .chat-correction-actions {
            display: flex;
            justify-content: flex-end;
            gap: 6px;
        }

        .chat-bubble-sender {
            font-size: 0.7rem;
            font-weight: bold;
            margin-bottom: 4px;
            opacity: 0.8;
            display: block;
        }

        .chat-input-area {
            padding: 15px 20px;
            border-top: 1px solid rgba(255, 255, 255, 0.08);
            background: rgba(10, 8, 22, 0.8);
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .draft-tip {
            background: rgba(108, 92, 231, 0.1);
            border: 1px solid rgba(108, 92, 231, 0.2);
            border-radius: 8px;
            padding: 8px 12px;
            font-size: 0.8rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            color: #cbd5e0;
        }

        .draft-text {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            max-width: 260px;
        }

        .btn-use-draft {
            background: var(--primary);
            border: none;
            color: white;
            padding: 4px 10px;
            border-radius: 4px;
            font-size: 0.75rem;
            font-weight: 600;
            cursor: pointer;
            transition: background 0.2s;
        }

        .btn-use-draft:hover {
            background: #5b4bc4;
        }

        #manual-message-input {
            width: 100%;
            height: 130px;
            min-height: 130px;
            max-height: 400px;
            padding: 10px;
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid rgba(255, 255, 255, 0.1);
            color: white;
            border-radius: 8px;
            font-size: 0.9rem;
            line-height: 1.45;
            resize: vertical;
            font-family: inherit;
        }

        #manual-message-input:focus {
            outline: none;
            border-color: var(--primary-light);
        }

        .btn-send-message {
            align-self: flex-end;
            background: var(--success);
            color: white;
            padding: 8px 16px;
        }

        .btn-send-message:hover {
            background: #009477;
            transform: translateY(-1px);
        }

        .terminal-section {
            padding: 20px 30px;
            background: rgba(10, 7, 20, 0.8);
            border-top: 1px solid rgba(255, 255, 255, 0.08);
            color: #e2e8f0;
            max-height: 250px;
            overflow-y: auto;
        }

        .terminal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px;
        }

        .terminal-header h3 {
            font-size: 0.95rem;
            color: #a29bfe;
            font-family: 'Outfit', sans-serif;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .terminal-body {
            font-family: 'Courier New', Courier, monospace;
            font-size: 0.8rem;
            line-height: 1.5;
            background: rgba(0,0,0,0.3);
            padding: 12px;
            border-radius: 6px;
            border: 1px solid rgba(255, 255, 255, 0.05);
            max-height: 180px;
            overflow-y: auto;
        }

        .terminal-row {
            padding: 2px 0;
            border-bottom: 1px solid rgba(255, 255, 255, 0.02);
        }

        .terminal-row.system { color: #74b9ff; }
        .terminal-row.success { color: #55efc4; font-weight: bold; }
        .terminal-row.error { color: #ff7675; }

        .btn-success {
            background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
            color: white;
            box-shadow: 0 4px 15px rgba(0, 184, 148, 0.3);
        }

        .btn-success:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(0, 184, 148, 0.4);
        }

        .wa-status-pill {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 8px 14px;
            border-radius: 20px;
            font-size: 0.85rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
        }

        .wa-status-ready {
            background: rgba(0, 184, 148, 0.15);
            color: #00b894;
            border: 1px solid rgba(0, 184, 148, 0.4);
        }

        .wa-status-qr {
            background: rgba(253, 203, 110, 0.15);
            color: #fdcb6e;
            border: 1px solid rgba(253, 203, 110, 0.4);
            animation: pulse 1.5s infinite;
        }

        .wa-status-disconnected {
            background: rgba(214, 48, 49, 0.15);
            color: #ff7675;
            border: 1px solid rgba(214, 48, 49, 0.4);
        }

        @keyframes pulse {
            0% { opacity: 0.7; }
            50% { opacity: 1; }
            100% { opacity: 0.7; }
        }

        .modal-backdrop {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0, 0, 0, 0.75);
            backdrop-filter: blur(8px);
            z-index: 9999;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .modal-content {
            background: #15102a;
            border: 1px solid rgba(255, 255, 255, 0.15);
            border-radius: 16px;
            width: 90%;
            max-width: 450px;
            box-shadow: 0 25px 50px rgba(0,0,0,0.5);
            overflow: hidden;
        }

        .modal-header {
            padding: 20px;
            background: rgba(108, 92, 231, 0.2);
            border-bottom: 1px solid rgba(255, 255, 255, 0.08);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .modal-header h3 { color: white; font-size: 1.1rem; }
        .close-btn { background: none; border: none; color: #a0aec0; font-size: 1.5rem; cursor: pointer; }
        .modal-body { padding: 25px; text-align: center; color: #e2e8f0; }
