
       

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        html,
        body {
            height: 100%;
            width: 100%;
            overflow: hidden;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: var(--cor-fundo-chat);

            height: 100%;
            display: flex;
        }

        /* Container fullscreen */
        .chat-container {
            width: 100%;
            height: 100%;
            display: flex;
            position: relative;
            overflow: hidden;
        }

        /* ==================== LOGIN MELHORADO ==================== */
        .login-overlay {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: linear-gradient(135deg, #0f1c24 0%, #1a2e38 50%, #0f1c24 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 100;
            padding: 20px;
        }

        .login-box {
            background: linear-gradient(145deg, #1e3a47, #1a2e38);
            padding: 40px;
            border-radius: 20px;
            width: 100%;
            max-width: 420px;
            border: 1px solid rgba(0, 168, 132, 0.2);
            box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
        }

        .login-logo {
            text-align: center;
            margin-bottom: 24px;
        }

        .login-logo-icon {
            width: 90px;
            height: 90px;
            background: linear-gradient(135deg, var(--cor-primaria), var(--cor-secundaria));
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 16px;
            box-shadow: 0 8px 25px rgba(0, 168, 132, 0.35);
        }

        .login-logo-icon img {
            width: 55px;
            height: 55px;
            object-fit: contain;
        }

        .login-logo-icon svg {
            width: 45px;
            height: 45px;
            fill: white;
        }

        .login-logo h2 {
            color: var(--cor-texto);
            font-size: 22px;
            font-weight: 600;
            margin-bottom: 6px;
        }

        .login-logo p {
            color: var(--cor-texto-secundario);
            font-size: 14px;
        }

        /* Seção de segurança LGPD */
        .security-section {
            background: linear-gradient(135deg, rgba(0, 168, 132, 0.1), rgba(0, 212, 170, 0.05));
            border: 1px solid rgba(0, 168, 132, 0.25);
            border-radius: 14px;
            padding: 18px;
            margin-bottom: 24px;
        }

        .security-header {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 12px;
        }

        .security-icon {
            width: 38px;
            height: 38px;
            background: rgba(0, 168, 132, 0.2);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }

        .security-icon svg {
            width: 20px;
            height: 20px;
            fill: var(--cor-primaria);
        }

        .security-header h4 {
            color: var(--cor-primaria);
            font-size: 14px;
            font-weight: 600;
        }

        .security-items {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .security-item {
            display: flex;
            align-items: center;
            gap: 8px;
            color: var(--cor-texto-secundario);
            font-size: 12px;
        }

        .security-item svg {
            width: 14px;
            height: 14px;
            fill: var(--cor-primaria);
            flex-shrink: 0;
        }

        .lgpd-badge {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: rgba(0, 168, 132, 0.15);
            border: 1px solid rgba(0, 168, 132, 0.35);
            border-radius: 20px;
            padding: 6px 12px;
            margin-top: 12px;
            font-size: 11px;
            color: var(--cor-primaria);
            font-weight: 500;
        }

        .lgpd-badge svg {
            width: 14px;
            height: 14px;
            fill: var(--cor-primaria);
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: block;
            color: var(--cor-texto-secundario);
            font-size: 13px;
            margin-bottom: 8px;
            font-weight: 500;
        }

        .form-group input {
            width: 100%;
            padding: 14px 16px;
            background: rgba(45, 74, 90, 0.6);
            border: 1px solid var(--cor-borda);
            border-radius: 12px;
            color: var(--cor-texto);
            font-size: 16px;
            transition: all 0.2s;
        }

        .form-group input:focus {
            outline: none;
            border-color: var(--cor-primaria);
            box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.15);
            background: rgba(45, 74, 90, 0.8);
        }

        .form-group input::placeholder {
            color: var(--cor-texto-secundario);
        }

        /* Checkbox para lembrar CPF */
        .remember-cpf {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 20px;
            cursor: pointer;
        }

        .remember-cpf input[type="checkbox"] {
            width: 18px;
            height: 18px;
            accent-color: var(--cor-primaria);
            cursor: pointer;
        }

        .remember-cpf span {
            color: var(--cor-texto-secundario);
            font-size: 13px;
        }

        .extra-fields {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.3s ease;
        }

        .extra-fields.show {
            max-height: 200px;
        }

        .btn {
            width: 100%;
            padding: 16px;
            border: none;
            border-radius: 12px;
            font-size: 15px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

        .btn-primary {
            background: linear-gradient(135deg, var(--cor-primaria), var(--cor-secundaria));
            color: white;
            box-shadow: 0 4px 15px rgba(0, 168, 132, 0.35);
        }

        .btn-primary:hover:not(:disabled) {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(0, 168, 132, 0.45);
        }

        .btn-primary:disabled {
            opacity: 0.6;
            cursor: not-allowed;
            transform: none;
        }

        .spinner {
            width: 20px;
            height: 20px;
            border: 2px solid rgba(255, 255, 255, 0.3);
            border-top-color: white;
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }

        @keyframes spin {
            to {
                transform: rotate(360deg);
            }
        }

        .welcome-msg {
            background: rgba(0, 168, 132, 0.12);
            border: 1px solid rgba(0, 168, 132, 0.3);
            border-radius: 12px;
            padding: 14px;
            margin-bottom: 20px;
            color: var(--cor-texto);
            font-size: 14px;
            text-align: center;
            line-height: 1.5;
        }

        .welcome-msg strong {
            color: var(--cor-primaria);
        }

        /* ==================== SIDEBAR ==================== */
        .sidebar {
            width: 400px;
            min-width: 400px;
            max-width: 400px;
            background: linear-gradient(180deg, var(--cor-sidebar) 0%, #152028 100%);
            border-right: 1px solid var(--cor-borda);
            display: flex;
            flex-direction: column;
            height: 100%;
        }

        .sidebar-header {
            padding: 16px;
            background: var(--cor-header);
            display: flex;
            align-items: center;
            gap: 12px;
            min-height: 68px;
            border-bottom: 1px solid rgba(0, 0, 0, 0.2);
        }

        .user-avatar {
            width: 46px;
            height: 46px;
            background: linear-gradient(135deg, var(--cor-primaria), var(--cor-secundaria));
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            cursor: pointer;
            overflow: hidden;
            position: relative;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        }

        .user-avatar:hover {
            opacity: 0.9;
        }

        .user-avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .user-avatar svg {
            width: 24px;
            height: 24px;
            fill: white;
        }

        .user-avatar-overlay {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            transition: opacity 0.2s;
        }

        .user-avatar:hover .user-avatar-overlay {
            opacity: 1;
        }

        .user-avatar-overlay svg {
            width: 16px;
            height: 16px;
        }

        .user-details {
            flex: 1;
            min-width: 0;
        }

        .user-name {
            color: var(--cor-texto);
            font-weight: 600;
            font-size: 15px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .user-cpf {
            color: var(--cor-texto-secundario);
            font-size: 12px;
        }

        /* Botão de nova conversa melhorado */
        .new-chat-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            padding: 10px 18px;
            background: linear-gradient(135deg, var(--cor-primaria), var(--cor-secundaria));
            border: none;
            border-radius: 24px;
            cursor: pointer;
            transition: all 0.2s;
            position: relative;
            flex-shrink: 0;
            color: white;
            font-size: 13px;
            font-weight: 600;
            box-shadow: 0 3px 12px rgba(0, 168, 132, 0.35);
        }

        .new-chat-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 18px rgba(0, 168, 132, 0.45);
        }

        .new-chat-btn svg {
            width: 18px;
            height: 18px;
            fill: white;
        }

        .new-chat-btn .btn-text {
            display: inline;
        }

        .notification-badge-global {
            position: absolute;
            top: -6px;
            right: -6px;
            background: #ef4444;
            color: white;
            font-size: 10px;
            font-weight: bold;
            min-width: 20px;
            height: 20px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0 5px;
            border: 2px solid var(--cor-header);
        }

        /* Lista de conversas */
        .conversations-list {
            flex: 1;
            overflow-y: auto;
        }

        .conversations-list::-webkit-scrollbar {
            width: 6px;
        }

        .conversations-list::-webkit-scrollbar-track {
            background: transparent;
        }

        .conversations-list::-webkit-scrollbar-thumb {
            background: var(--cor-texto-secundario);
            border-radius: 3px;
        }

        .conversation-item {
            padding: 14px 16px;
            cursor: pointer;
            transition: all 0.15s;
            display: flex;
            align-items: center;
            gap: 12px;
            border-bottom: 1px solid rgba(45, 74, 90, 0.4);
        }

        .conversation-item:hover {
            background: var(--cor-hover);
        }

        .conversation-item.active {
            background: linear-gradient(90deg, rgba(0, 168, 132, 0.15), transparent);
            border-left: 3px solid var(--cor-primaria);
        }

        .conv-icon {
            width: 50px;
            height: 50px;
            background: rgba(45, 74, 90, 0.6);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            position: relative;
        }

        .conv-icon svg {
            width: 24px;
            height: 24px;
            fill: var(--cor-texto-secundario);
        }

        .conv-badge {
            position: absolute;
            bottom: -2px;
            right: -2px;
            background: var(--cor-primaria);
            color: white;
            font-size: 11px;
            font-weight: bold;
            min-width: 20px;
            height: 20px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0 5px;
        }

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

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

        .conv-protocolo {
            color: var(--cor-texto);
            font-size: 15px;
            font-weight: 500;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .conv-date {
            color: var(--cor-texto-secundario);
            font-size: 12px;
            flex-shrink: 0;
        }

        .conv-meta {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .conv-status {
            font-size: 11px;
            padding: 3px 10px;
            border-radius: 12px;
            font-weight: 500;
        }

        .conv-status.bot {
            background: rgba(251, 191, 36, 0.15);
            color: #fbbf24;
        }

        .conv-status.aguardando {
            background: rgba(0, 168, 132, 0.15);
            color: var(--cor-primaria);
        }

        .conv-status.em_atendimento {
            background: rgba(59, 130, 246, 0.15);
            color: #3b82f6;
        }

        .conv-status.finalizado {
            background: rgba(148, 163, 184, 0.15);
            color: #94a3b8;
        }

        .conv-setor {
            color: var(--cor-texto-secundario);
            font-size: 12px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .empty-state {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100%;
            color: var(--cor-texto-secundario);
            padding: 40px;
            text-align: center;
        }

        .empty-state svg {
            width: 70px;
            height: 70px;
            fill: var(--cor-texto-secundario);
            opacity: 0.5;
            margin-bottom: 15px;
        }

        /* ==================== CHAT AREA ==================== */
        .chat-area {
            flex: 1;
            display: flex;
            flex-direction: column;

            .chat-area {
                background: linear-gradient(180deg,
                        color-mix(in srgb, var(--cor-fundo-chat) 90%, #000 10%) 0%,
                        color-mix(in srgb, var(--cor-fundo-chat) 75%, #000 25%) 100%);
            }

            position: relative;
            min-width: 0;
            height: 100%;
        }

        /* Background pattern WhatsApp style */
        .chat-area::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: url("data:image/svg+xml,%3Csvg width='400' height='400' viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M20 20h8v8h-8zM60 20h8v8h-8zM100 20h8v8h-8zM140 20h8v8h-8zM180 20h8v8h-8zM220 20h8v8h-8zM260 20h8v8h-8zM300 20h8v8h-8zM340 20h8v8h-8zM380 20h8v8h-8zM40 40h8v8h-8zM80 40h8v8h-8zM120 40h8v8h-8zM160 40h8v8h-8zM200 40h8v8h-8zM240 40h8v8h-8zM280 40h8v8h-8zM320 40h8v8h-8zM360 40h8v8h-8z'/%3E%3C/g%3E%3C/svg%3E");
            pointer-events: none;
            z-index: 0;
        }

        .chat-header {
            padding: 12px 16px;
            background: var(--cor-header);
            display: flex;
            align-items: center;
            gap: 12px;
            min-height: 68px;
            position: relative;
            z-index: 1;
            border-bottom: 1px solid rgba(0, 0, 0, 0.2);
        }

        .back-btn {
            display: none;
            width: 40px;
            height: 40px;
            background: none;
            border: none;
            cursor: pointer;
            border-radius: 50%;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }

        .back-btn:hover {
            background: var(--cor-hover);
        }

        .back-btn svg {
            width: 24px;
            height: 24px;
            fill: var(--cor-texto-secundario);
        }

        .chat-header-icon {
            width: 44px;
            height: 44px;
            background: linear-gradient(135deg, var(--cor-primaria), var(--cor-secundaria));
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            overflow: hidden;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        }

        .chat-header-icon img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .chat-header-icon svg {
            width: 24px;
            height: 24px;
            fill: white;
        }

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

        .chat-header-info h3 {
            color: var(--cor-texto);
            font-size: 16px;
            font-weight: 600;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .chat-header-info p {
            color: var(--cor-texto-secundario);
            font-size: 13px;
            display: flex;
            align-items: center;
            gap: 5px;
        }

        .online-dot {
            width: 8px;
            height: 8px;
            background: var(--cor-primaria);
            border-radius: 50%;
            display: inline-block;
            box-shadow: 0 0 6px var(--cor-primaria);
        }

        /* Welcome state */
        .welcome-state {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            color: var(--cor-texto-secundario);
            padding: 40px;
            text-align: center;
            position: relative;
            z-index: 1;
        }

        .welcome-state svg {
            width: 100px;
            height: 100px;
            fill: var(--cor-texto-secundario);
            opacity: 0.3;
            margin-bottom: 20px;
        }

        .welcome-state h3 {
            color: var(--cor-texto);
            font-size: 24px;
            font-weight: 400;
            margin-bottom: 10px;
        }

        .welcome-state p {
            font-size: 14px;
            max-width: 400px;
            line-height: 1.5;
        }

        /* Chat content */
        .chat-content {
            flex: 1;
            display: none;
            flex-direction: column;
            min-height: 0;
            position: relative;
            z-index: 1;
        }

        .messages-container {
            flex: 1;
            overflow-y: auto;
            padding: 20px 60px;
            /* Adicionar flex para alinhar mensagens corretamente */
            display: flex;
            flex-direction: column;
        }

        .messages-container::-webkit-scrollbar {
            width: 6px;
        }

        .messages-container::-webkit-scrollbar-track {
            background: transparent;
        }

        .messages-container::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.2);
            border-radius: 3px;
        }

        /* ==================== MENSAGENS ==================== */
        /* CSS completamente reescrito para garantir alinhamento correto */
        .message {
            max-width: 65%;
            margin-bottom: 4px;
            animation: fadeIn 0.2s ease;
            display: flex;
            flex-direction: column;
            width: fit-content;
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(5px);
            }

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

        /* Cliente - lado DIREITO */
        .message.sent {
            margin-left: auto !important;
            margin-right: 0 !important;
            align-items: flex-end !important;
            align-self: flex-end !important;
        }

        /* Bot/Atendente - lado ESQUERDO */
        .message.received {
            margin-right: auto !important;
            margin-left: 0 !important;
            align-items: flex-start !important;
            align-self: flex-start !important;
        }

        .message-bubble {
            padding: 8px 12px 8px 12px;
            border-radius: 8px;
            position: relative;
            word-wrap: break-word;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
            max-width: 100%;
        }

        /* Cor da mensagem do cliente (enviada) - usa cor secundária do banco */
        .message.sent .message-bubble {
            background-color: var(--cor-mensagem-enviada) !important;
            color: #ffffff !important;
            border-top-right-radius: 0;
        }

        /* Cor da mensagem do bot/atendente (recebida) - usa cor primária do banco */
        .message.received .message-bubble {
            background-color: var(--cor-mensagem-recebida) !important;
            color: #ffffff !important;
            border-top-left-radius: 0;
        }

        /* Seta da mensagem do cliente - direita */
        .message.sent .message-bubble::before {
            content: '';
            position: absolute;
            top: 0;
            right: -8px;
            width: 0;
            height: 0;
            border-style: solid;
            border-width: 0 0 10px 10px;
            border-color: transparent transparent transparent var(--cor-mensagem-enviada);
        }

        /* Seta da mensagem do bot/atendente - esquerda */
        .message.received .message-bubble::before {
            content: '';
            position: absolute;
            top: 0;
            left: -8px;
            width: 0;
            height: 0;
            border-style: solid;
            border-width: 0 10px 10px 0;
            border-color: transparent var(--cor-mensagem-recebida) transparent transparent;
        }

        /* Nome do remetente */
        .message-sender {
            font-size: 12px;
            font-weight: 600;
            margin-bottom: 4px;
            display: block;
        }

        .message.sent .message-sender {
            color: rgba(255, 255, 255, 0.85);
            text-align: right;
        }

        .message.received .message-sender {
            color: #dcf8c6;
            text-align: left;
        }

        .message-text {
            font-size: 14px;
            line-height: 1.4;
            white-space: pre-wrap;
            word-wrap: break-word;
        }

        .message-footer {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 4px;
            margin-top: 4px;
        }

        .message-time {
            font-size: 11px;
            color: rgba(255, 255, 255, 0.7);
        }

        /* Checks de leitura */
        .message-status {
            display: flex;
            align-items: center;
        }

        .message-status svg {
            width: 16px;
            height: 11px;
        }

        .message-status.sent svg {
            fill: rgba(255, 255, 255, 0.5);
        }

        .message-status.delivered svg {
            fill: rgba(255, 255, 255, 0.5);
        }

        .message-status.read svg {
            fill: #53bdeb;
        }

        .message-image {
            max-width: 330px;
            border-radius: 6px;
            cursor: pointer;
            display: block;
        }

        /* ==================== AUDIO PLAYER ==================== */
        .audio-player {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 4px;
            min-width: 240px;
            max-width: 100%;
        }

        .play-btn {
            width: 34px;
            height: 34px;
            background: transparent;
            border: none;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }

        .play-btn svg {
            width: 34px;
            height: 34px;
            fill: var(--cor-texto-secundario);
        }

        .audio-wave {
            flex: 1;
            display: flex;
            align-items: center;
            gap: 2px;
            height: 26px;
            min-width: 100px;
        }

        .audio-wave span {
            width: 3px;
            background: var(--cor-texto-secundario);
            border-radius: 2px;
            opacity: 0.7;
        }

        .audio-wave.playing span {
            animation: waveAnim 0.4s ease-in-out infinite alternate;
        }

        .audio-wave span:nth-child(1) {
            height: 6px;
        }

        .audio-wave span:nth-child(2) {
            height: 10px;
        }

        .audio-wave span:nth-child(3) {
            height: 14px;
        }

        .audio-wave span:nth-child(4) {
            height: 8px;
        }

        .audio-wave span:nth-child(5) {
            height: 16px;
        }

        .audio-wave span:nth-child(6) {
            height: 10px;
        }

        .audio-wave span:nth-child(7) {
            height: 12px;
        }

        .audio-wave span:nth-child(8) {
            height: 6px;
        }

        .audio-wave span:nth-child(9) {
            height: 14px;
        }

        .audio-wave span:nth-child(10) {
            height: 8px;
        }

        @keyframes waveAnim {
            to {
                height: 20px;
                opacity: 1;
            }
        }

        .audio-time {
            font-size: 11px;
            color: var(--cor-texto-secundario);
            min-width: 35px;
            text-align: right;
        }

        .speed-btn {
            background: rgba(255, 255, 255, 0.1);
            border: none;
            color: var(--cor-texto-secundario);
            font-size: 11px;
            padding: 2px 5px;
            border-radius: 3px;
            cursor: pointer;
            font-weight: 500;
        }

        /* ==================== INPUT AREA ==================== */
        /* Aviso de conversa finalizada com botão de nova conversa */
        .readonly-notice {
            display: none;
            flex-direction: column;
            align-items: center;
            padding: 20px;
            background: linear-gradient(to bottom, rgba(251, 191, 36, 0.05), var(--cor-header));
            border-top: 1px solid rgba(251, 191, 36, 0.2);
            text-align: center;
            gap: 16px;
        }

        .readonly-notice-text {
            color: #fbbf24;
            font-size: 14px;
            font-style: italic;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .readonly-notice-text svg {
            width: 18px;
            height: 18px;
            fill: #fbbf24;
        }

        .new-conversation-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            padding: 12px 24px;
            background: linear-gradient(135deg, var(--cor-primaria), var(--cor-secundaria));
            border: none;
            border-radius: 24px;
            cursor: pointer;
            transition: all 0.2s;
            color: white;
            font-size: 14px;
            font-weight: 600;
            box-shadow: 0 3px 12px rgba(0, 168, 132, 0.35);
        }

        .new-conversation-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 18px rgba(0, 168, 132, 0.45);
        }

        .new-conversation-btn svg {
            width: 18px;
            height: 18px;
            fill: white;
        }

        .input-area {
            padding: 10px 16px;
            background: var(--cor-header);
            display: flex;
            align-items: flex-end;
            gap: 8px;
        }

        .input-actions {
            display: flex;
            gap: 4px;
        }

        .input-action-btn {
            width: 40px;
            height: 40px;
            background: none;
            border: none;
            cursor: pointer;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background 0.15s;
            flex-shrink: 0;
        }

        .input-action-btn:hover {
            background: var(--cor-hover);
        }

        .input-action-btn svg {
            width: 24px;
            height: 24px;
            fill: var(--cor-texto-secundario);
        }

        .message-input-wrapper {
            flex: 1;
            display: flex;
            align-items: center;
            background: var(--cor-input);
            border-radius: 8px;
            padding: 0 12px;
            min-height: 42px;
        }

        .message-input {
            flex: 1;
            background: none;
            border: none;
            color: var(--cor-texto);
            font-size: 15px;
            padding: 10px 0;
            outline: none;
            min-width: 0;
            resize: none;
            max-height: 100px;
            line-height: 20px;
        }

        .message-input::placeholder {
            color: var(--cor-texto-secundario);
        }

        /* Recording UI */
        .recording-ui {
            display: none;
            flex: 1;
            align-items: center;
            gap: 10px;
            padding: 10px 15px;
            background: var(--cor-input);
            border-radius: 8px;
        }

        .recording-ui.active {
            display: flex;
        }

        .recording-indicator {
            width: 10px;
            height: 10px;
            background: #ef4444;
            border-radius: 50%;
            animation: pulse 1s ease-in-out infinite;
        }

        @keyframes pulse {

            0%,
            100% {
                opacity: 1;
                transform: scale(1);
            }

            50% {
                opacity: 0.6;
                transform: scale(0.9);
            }
        }

        .recording-time {
            color: var(--cor-texto);
            font-size: 14px;
            font-weight: 500;
            min-width: 45px;
        }

        .recording-waveform {
            display: flex;
            align-items: center;
            gap: 3px;
            flex: 1;
        }

        .recording-waveform span {
            width: 3px;
            background: #ef4444;
            border-radius: 2px;
            animation: wave 0.5s ease-in-out infinite alternate;
        }

        @keyframes wave {
            from {
                height: 8px;
            }

            to {
                height: 20px;
            }
        }

        .cancel-record-btn {
            background: none;
            border: none;
            color: #ef4444;
            cursor: pointer;
            font-size: 13px;
            padding: 5px 10px;
            border-radius: 4px;
            transition: background 0.15s;
        }

        .cancel-record-btn:hover {
            background: rgba(239, 68, 68, 0.1);
        }

        .send-btn {
            width: 48px;
            height: 48px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--cor-primaria), var(--cor-secundaria));
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            transition: all 0.15s;
            box-shadow: 0 2px 8px rgba(0, 168, 132, 0.3);
        }

        .send-btn:hover {
            transform: scale(1.05);
            box-shadow: 0 4px 12px rgba(0, 168, 132, 0.4);
        }

        .send-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .send-btn svg {
            width: 24px;
            height: 24px;
            fill: white;
        }

        .message-input-wrapper.hidden,
        .input-actions.hidden {
            display: none;
        }

        /* ==================== EMOJI PICKER ==================== */
        .emoji-picker {
            display: none;
            position: absolute;
            bottom: 70px;
            left: 16px;
            background: var(--cor-sidebar);
            border: 1px solid var(--cor-borda);
            border-radius: 8px;
            padding: 10px;
            box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
            z-index: 50;
            max-width: 300px;
        }

        .emoji-grid {
            display: grid;
            grid-template-columns: repeat(8, 1fr);
            gap: 4px;
        }

        .emoji-btn {
            width: 32px;
            height: 32px;
            background: none;
            border: none;
            cursor: pointer;
            font-size: 20px;
            border-radius: 4px;
            transition: background 0.15s;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .emoji-btn:hover {
            background: var(--cor-hover);
        }

        /* ==================== TOAST ==================== */
        .toast-container {
            position: fixed;
            bottom: 100px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 1000;
        }

        .toast {
            background: var(--cor-sidebar);
            color: var(--cor-texto);
            padding: 12px 24px;
            border-radius: 8px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
            font-size: 14px;
            animation: toastIn 0.3s ease;
            border: 1px solid var(--cor-borda);
        }

        .toast.success {
            border-color: var(--cor-primaria);
        }

        .toast.error {
            border-color: #ef4444;
        }

        @keyframes toastIn {
            from {
                opacity: 0;
                transform: translateY(20px);
            }

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

        /* ==================== RESPONSIVIDADE ==================== */
        @media (max-width: 1024px) {
            .sidebar {
                width: 350px;
                min-width: 350px;
                max-width: 350px;
            }

            .messages-container {
                padding: 16px 40px;
            }

            .new-chat-btn .btn-text {
                display: none;
            }

            .new-chat-btn {
                padding: 10px;
                border-radius: 50%;
                width: 44px;
                height: 44px;
            }
        }

        @media (max-width: 768px) {
            .sidebar {
                position: absolute;
                top: 0;
                left: 0;
                bottom: 0;
                width: 100%;
                min-width: 100%;
                max-width: 100%;
                z-index: 10;
                transform: translateX(0);
                transition: transform 0.25s ease;
            }

            .sidebar.hidden {
                transform: translateX(-100%);
            }

            .back-btn {
                display: flex;
            }

            .messages-container {
                padding: 12px 16px;
            }

            .message {
                max-width: 85%;
            }

            .login-box {
                padding: 30px 20px;
                margin: 10px;
            }

            .emoji-picker {
                left: 10px;
                right: 10px;
                max-width: none;
            }

            .new-chat-btn .btn-text {
                display: none;
            }

            .new-chat-btn {
                padding: 10px;
                border-radius: 50%;
                width: 44px;
                height: 44px;
            }
        }

        @media (max-width: 480px) {
            .login-logo h2 {
                font-size: 18px;
            }

            .chat-header {
                padding: 8px 12px;
            }

            .chat-header-info h3 {
                font-size: 15px;
            }

            .message {
                max-width: 90%;
            }

            .audio-player {
                min-width: 180px;
            }

            .input-area {
                padding: 8px 12px;
            }

            .security-section {
                padding: 12px;
            }
        }

        @supports (padding: env(safe-area-inset-bottom)) {
            .input-area {
                padding-bottom: calc(10px + env(safe-area-inset-bottom));
            }

            .sidebar-header {
                padding-top: calc(16px + env(safe-area-inset-top));
            }

            .chat-header {
                padding-top: calc(10px + env(safe-area-inset-top));
            }
        }
