/*
 * Athera Academy — Central de Mensagens 1:1
 *
 * CSS isolado para as três superfícies do chat:
 * 1. aluno no dashboard público (#view-chat);
 * 2. administrador/mentor no dashboard da Academy;
 * 3. administrador/mentor na página interna do plugin.
 *
 * Todos os seletores visuais ficam abaixo de .aa-chat-app para impedir
 * interferência de estilos globais do WordPress, Elementor e dashboard.
 */

/* ========================================================================== */
/* 1. VARIÁVEIS E RESET LOCAL                                                 */
/* ========================================================================== */

.aa-chat-app {
    --aa-chat-gold: #cd9c20;
    --aa-chat-gold-strong: #f5cb5c;
    --aa-chat-gold-soft: rgba(205, 156, 32, .12);
    --aa-chat-gold-border: rgba(205, 156, 32, .28);
    --aa-chat-bg: #080909;
    --aa-chat-panel: #101111;
    --aa-chat-panel-2: #171818;
    --aa-chat-panel-3: #1b1c1c;
    --aa-chat-border: rgba(242, 236, 221, .09);
    --aa-chat-border-strong: rgba(242, 236, 221, .15);
    --aa-chat-text: #f2ecdd;
    --aa-chat-muted: rgba(242, 236, 221, .62);
    --aa-chat-soft: rgba(242, 236, 221, .38);
    --aa-chat-danger: #e47b7b;
    --aa-chat-success: #63a879;
    --aa-chat-radius: 14px;

    position: relative;
    display: grid;
    grid-template-columns: clamp(340px, 25vw, 410px) minmax(0, 1fr);
    width: 100%;
    min-width: 0;
    min-height: 620px;
    height: min(780px, calc(100vh - 150px));
    margin: 0;
    overflow: hidden;
    color: var(--aa-chat-text);
    background:
        radial-gradient(circle at 14% 0, rgba(205, 156, 32, .055), transparent 30%),
        linear-gradient(145deg, #090a0a 0%, #060707 68%, #050606 100%);
    border: 1px solid var(--aa-chat-border) !important;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .32) !important;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.4;
    isolation: isolate;
}

.aa-chat-app,
.aa-chat-app *,
.aa-chat-app *::before,
.aa-chat-app *::after {
    box-sizing: border-box;
}

/* Neutraliza estilos azuis e dimensões herdadas do WP/Elementor/dashboard. */
.aa-chat-app button,
.aa-chat-app input,
.aa-chat-app textarea,
.aa-chat-app select,
.aa-chat-app a {
    margin: 0 !important;
    font: inherit;
    letter-spacing: normal;
    text-transform: none;
    text-shadow: none !important;
}

.aa-chat-app button {
    appearance: none;
    -webkit-appearance: none;
    min-width: 0;
    line-height: 1;
    outline: 0 !important;
    box-shadow: none !important;
}

.aa-chat-app button:focus,
.aa-chat-app button:active,
.aa-chat-app input:focus,
.aa-chat-app textarea:focus,
.aa-chat-app select:focus,
.aa-chat-app a:focus {
    outline: 0 !important;
    box-shadow: none !important;
}

.aa-chat-app button:focus-visible,
.aa-chat-app input:focus-visible,
.aa-chat-app textarea:focus-visible,
.aa-chat-app select:focus-visible,
.aa-chat-app a:focus-visible {
    outline: 2px solid rgba(245, 203, 92, .72) !important;
    outline-offset: 2px !important;
    box-shadow: none !important;
}

.aa-chat-app svg {
    display: block;
    flex: 0 0 auto;
    color: inherit;
    fill: none;
    stroke: currentColor;
}

.aa-chat-app [hidden] {
    display: none !important;
}

/* ========================================================================== */
/* 2. WRAPPERS DO ADMIN / PLUGIN                                              */
/* ========================================================================== */

.aa-chat-admin-section {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.aa-chat-admin-section > h3,
.aa-chat-admin-section::before,
.aa-chat-admin-section::after {
    border: 0 !important;
}

.aa-chat-admin-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 14px;
}

.aa-chat-admin-heading h3 {
    margin: 0 0 4px !important;
    padding: 0 !important;
    color: #171717 !important;
    border: 0 !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
}

.aa-chat-admin-heading p {
    margin: 0 !important;
    color: #6f7377 !important;
    font-size: 12px !important;
    line-height: 1.45 !important;
}

.aa-communications-chat-admin,
.aa-communications-chat-admin .aa-chat-admin-section {
    width: 100% !important;
    max-width: none !important;
}

.aa-communications-chat-admin .aa-chat-app {
    width: 100%;
    min-height: 570px;
    height: calc(100vh - 205px);
    max-height: 820px;
}

/* ========================================================================== */
/* 3. AVISO FLUTUANTE                                                         */
/* ========================================================================== */

.aa-chat-app .aa-chat-app-status {
    position: absolute;
    top: 16px;
    left: 50%;
    z-index: 40;
    max-width: min(520px, calc(100% - 32px));
    padding: 10px 14px;
    color: #17130a;
    background: var(--aa-chat-gold-strong);
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .35) !important;
    font-size: 12px;
    font-weight: 750;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -12px);
    transition: opacity .18s ease, transform .18s ease;
}

.aa-chat-app .aa-chat-app-status.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.aa-chat-app .aa-chat-app-status.is-error {
    color: #fff;
    background: #a43b3b;
}

/* ========================================================================== */
/* 4. LISTA DE CONVERSAS / SIDEBAR                                            */
/* ========================================================================== */

.aa-chat-app .aa-chat-sidebar {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(18, 19, 19, .99), rgba(10, 11, 11, .99));
    border: 0 !important;
    border-right: 1px solid var(--aa-chat-border) !important;
}

.aa-chat-app .aa-chat-sidebar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 20px 16px;
}

.aa-chat-app .aa-chat-sidebar-header h2 {
    margin: 0 !important;
    padding: 0 !important;
    color: var(--aa-chat-text) !important;
    border: 0 !important;
    font-family: Inter, system-ui, sans-serif !important;
    font-size: 25px !important;
    font-weight: 650 !important;
    line-height: 1.08 !important;
    letter-spacing: -.025em !important;
}

.aa-chat-app .aa-chat-sidebar-header p {
    max-width: 250px;
    margin: 7px 0 0 !important;
    color: var(--aa-chat-muted) !important;
    font-size: 11px !important;
    line-height: 1.45 !important;
}

/* Botão Nova mensagem */
.aa-chat-app .aa-chat-new-button {
    min-height: 40px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 13px !important;
    color: var(--aa-chat-gold-strong) !important;
    background: rgba(205, 156, 32, .055) !important;
    border: 1px solid var(--aa-chat-gold-border) !important;
    border-radius: 10px !important;
    cursor: pointer;
    font-size: 11px !important;
    font-weight: 700 !important;
    white-space: nowrap;
    transition: color .16s ease, background-color .16s ease, border-color .16s ease, transform .16s ease;
}

.aa-chat-app .aa-chat-new-button svg {
    width: 15px;
    height: 15px;
}

.aa-chat-app .aa-chat-new-button:hover {
    color: #ffe08a !important;
    background: rgba(205, 156, 32, .13) !important;
    border-color: rgba(245, 203, 92, .58) !important;
    transform: translateY(-1px);
}

.aa-chat-app .aa-chat-new-button:active {
    transform: translateY(0);
}

/* Busca e sino */
.aa-chat-app .aa-chat-toolbar {
    display: flex;
    gap: 8px;
    padding: 0 16px 13px;
}

.aa-chat-app .aa-chat-search {
    min-width: 0;
    height: 42px;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 !important;
    padding: 0 12px;
    color: var(--aa-chat-muted);
    background: rgba(255, 255, 255, .035) !important;
    border: 1px solid var(--aa-chat-border) !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    transition: background-color .16s ease, border-color .16s ease;
}

.aa-chat-app .aa-chat-search:focus-within {
    background: rgba(255, 255, 255, .05) !important;
    border-color: var(--aa-chat-gold-border) !important;
}

.aa-chat-app .aa-chat-search svg {
    width: 17px;
    height: 17px;
    color: var(--aa-chat-muted) !important;
}

.aa-chat-app .aa-chat-search input {
    width: 100% !important;
    min-width: 0;
    height: 40px !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    color: var(--aa-chat-text) !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    font-size: 12px !important;
}

.aa-chat-app .aa-chat-search input::placeholder {
    color: var(--aa-chat-soft) !important;
    opacity: 1;
}

.aa-chat-app .aa-chat-notification-button {
    width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    display: grid !important;
    place-items: center;
    flex: 0 0 auto;
    padding: 0 !important;
    color: var(--aa-chat-muted) !important;
    background: rgba(255, 255, 255, .035) !important;
    border: 1px solid var(--aa-chat-border) !important;
    border-radius: 12px !important;
    cursor: pointer;
    transition: color .16s ease, background-color .16s ease, border-color .16s ease;
}

.aa-chat-app .aa-chat-notification-button svg {
    width: 18px;
    height: 18px;
}

.aa-chat-app .aa-chat-notification-button:hover,
.aa-chat-app .aa-chat-notification-button.is-enabled {
    color: var(--aa-chat-gold-strong) !important;
    background: var(--aa-chat-gold-soft) !important;
    border-color: var(--aa-chat-gold-border) !important;
}

/* Filtros */
.aa-chat-app .aa-chat-filters {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 16px 13px;
    overflow-x: auto;
    scrollbar-width: none;
}

.aa-chat-app .aa-chat-filters::-webkit-scrollbar {
    display: none;
}

.aa-chat-app .aa-chat-filters button {
    min-height: 30px !important;
    padding: 0 10px !important;
    color: var(--aa-chat-muted) !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    border-radius: 9px !important;
    cursor: pointer;
    font-size: 10px !important;
    font-weight: 700 !important;
    white-space: nowrap;
    transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}

.aa-chat-app .aa-chat-filters button:hover {
    color: var(--aa-chat-text) !important;
    background: rgba(255, 255, 255, .045) !important;
    border-color: var(--aa-chat-border) !important;
}

.aa-chat-app .aa-chat-filters button.is-active,
.aa-chat-app .aa-chat-filters button.is-active:hover {
    color: #18140a !important;
    background: var(--aa-chat-gold-strong) !important;
    border-color: var(--aa-chat-gold-strong) !important;
}

.aa-chat-app .aa-chat-filters button span:not(:empty) {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    margin-left: 4px;
    padding: 0 5px;
    color: #17130a;
    background: var(--aa-chat-gold-strong);
    border-radius: 10px;
    font-size: 10px;
    font-weight: 800;
}

.aa-chat-app .aa-chat-filters button.is-active span:not(:empty) {
    color: var(--aa-chat-gold-strong);
    background: #17130a;
}

/* Lista e cards */
.aa-chat-app .aa-chat-thread-list {
    min-height: 0;
    flex: 1;
    display: block !important;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 2px 12px 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(205, 156, 32, .28) transparent;
}

.aa-chat-app .aa-chat-thread-list::-webkit-scrollbar,
.aa-chat-app .aa-chat-messages::-webkit-scrollbar {
    width: 5px;
}

.aa-chat-app .aa-chat-thread-list::-webkit-scrollbar-track,
.aa-chat-app .aa-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.aa-chat-app .aa-chat-thread-list::-webkit-scrollbar-thumb,
.aa-chat-app .aa-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(205, 156, 32, .28);
    border-radius: 999px;
}

.aa-chat-app .aa-chat-loading,
.aa-chat-app .aa-chat-no-threads {
    min-height: 170px;
    display: grid;
    place-items: center;
    padding: 25px;
    color: var(--aa-chat-soft) !important;
    text-align: center;
    font-size: 11px !important;
    line-height: 1.6;
}

/*
 * !important aqui é intencional: impede bordas azuis aplicadas por regras
 * globais de botões no dashboard e no wp-admin.
 */
.aa-chat-app button.aa-chat-thread {
    position: relative;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    min-height: 76px !important;
    display: grid !important;
    float: none !important;
    flex: 0 0 100% !important;
    align-self: stretch !important;
    grid-column: 1 / -1 !important;
    grid-template-columns: 50px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    margin: 0 !important;
    padding: 13px 11px !important;
    color: inherit !important;
    background: transparent !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(242, 236, 221, .065) !important;
    border-radius: 11px !important;
    outline: 0 !important;
    box-shadow: none !important;
    text-align: left !important;
    cursor: pointer;
    transition: background-color .15s ease, box-shadow .15s ease;
}

.aa-chat-app button.aa-chat-thread:hover {
    color: inherit !important;
    background: rgba(255, 255, 255, .038) !important;
    border-color: rgba(242, 236, 221, .075) !important;
    outline: 0 !important;
    box-shadow: none !important;
}

.aa-chat-app button.aa-chat-thread:focus,
.aa-chat-app button.aa-chat-thread:active,
.aa-chat-app button.aa-chat-thread:focus-visible {
    color: inherit !important;
    background: rgba(255, 255, 255, .038) !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(242, 236, 221, .075) !important;
    outline: 0 !important;
    box-shadow: inset 2px 0 rgba(205, 156, 32, .55) !important;
}

.aa-chat-app button.aa-chat-thread.is-active,
.aa-chat-app button.aa-chat-thread.is-active:hover,
.aa-chat-app button.aa-chat-thread.is-active:focus,
.aa-chat-app button.aa-chat-thread.is-active:focus-visible {
    color: inherit !important;
    background: linear-gradient(90deg, rgba(205, 156, 32, .14), rgba(205, 156, 32, .035)) !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(205, 156, 32, .18) !important;
    outline: 0 !important;
    box-shadow: inset 2px 0 var(--aa-chat-gold) !important;
}

.aa-chat-app .aa-chat-thread-avatar,
.aa-chat-app .aa-chat-avatar {
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    color: var(--aa-chat-gold-strong) !important;
    background-color: #191a19 !important;
    background-position: center !important;
    background-size: cover !important;
    background-repeat: no-repeat !important;
    border: 1px solid rgba(205, 156, 32, .38) !important;
    border-radius: 50% !important;
    box-shadow: none !important;
}

.aa-chat-app .aa-chat-thread-avatar {
    width: 50px;
    height: 50px;
}

.aa-chat-app .aa-chat-thread-avatar svg {
    width: 22px;
    height: 22px;
}

.aa-chat-app .aa-chat-thread-avatar::after {
    content: "";
    position: absolute;
    right: 1px;
    bottom: 1px;
    width: 8px;
    height: 8px;
    background: var(--aa-chat-gold);
    border: 2px solid #121313;
    border-radius: 50%;
}

.aa-chat-app .aa-chat-thread-copy {
    min-width: 0;
    text-align: left !important;
}

.aa-chat-app .aa-chat-thread-top {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 7px;
    text-align: left !important;
}

.aa-chat-app .aa-chat-thread-top strong {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    color: var(--aa-chat-text) !important;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 18px !important;
    font-weight: 650 !important;
    line-height: 1.12;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aa-chat-app .aa-chat-thread-copy p {
    margin: 5px 0 0 !important;
    overflow: hidden;
    color: var(--aa-chat-muted) !important;
    font-size: 11px !important;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aa-chat-app .aa-chat-thread-subject {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    color: var(--aa-chat-soft) !important;
    font-size: 9px !important;
    letter-spacing: .055em;
    line-height: 1.25;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.aa-chat-app .aa-chat-thread-side {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 7px;
    color: var(--aa-chat-soft) !important;
    font-size: 9px !important;
    white-space: nowrap;
}

.aa-chat-app .aa-chat-thread-badge {
    min-width: 21px;
    height: 21px;
    display: grid;
    place-items: center;
    padding: 0 6px;
    color: #17130a;
    background: var(--aa-chat-gold-strong);
    border-radius: 12px;
    font-size: 10px;
    font-weight: 800;
}

.aa-chat-app .aa-chat-thread-status {
    width: 6px;
    height: 6px;
    background: #656765;
    border-radius: 50%;
}

.aa-chat-app .aa-chat-thread-status.is-pending {
    background: #e2ad3b;
    box-shadow: 0 0 0 3px rgba(226, 173, 59, .1);
}

.aa-chat-app .aa-chat-thread-status.is-answered {
    background: var(--aa-chat-success);
}

.aa-chat-app .aa-chat-thread-status.is-closed {
    background: #656765;
}

/* Rodapé de suporte do aluno */
.aa-chat-app .aa-chat-support-footer {
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 8px 13px 13px;
    padding: 12px;
    color: var(--aa-chat-text);
    background: rgba(255, 255, 255, .025);
    border: 1px solid var(--aa-chat-border) !important;
    border-radius: 12px;
}

.aa-chat-app .aa-chat-support-icon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    color: var(--aa-chat-gold-strong) !important;
    background: rgba(205, 156, 32, .035);
    border: 1px solid var(--aa-chat-gold-border);
    border-radius: 50%;
}

.aa-chat-app .aa-chat-support-icon svg {
    width: 18px;
    height: 18px;
}

.aa-chat-app .aa-chat-support-footer strong,
.aa-chat-app .aa-chat-support-footer small {
    display: block;
}

.aa-chat-app .aa-chat-support-footer strong {
    color: #ddd9cf !important;
    font-size: 10px !important;
}

.aa-chat-app .aa-chat-support-footer small {
    margin-top: 3px;
    color: var(--aa-chat-soft) !important;
    font-size: 9px !important;
}

/* ========================================================================== */
/* 5. ÁREA DA CONVERSA E CABEÇALHO                                            */
/* ========================================================================== */

.aa-chat-app .aa-chat-conversation {
    min-width: 0;
    min-height: 0;
    display: flex;
    overflow: hidden;
    background: linear-gradient(145deg, rgba(8, 9, 9, .99), rgba(12, 13, 13, .99));
    border: 0 !important;
}

.aa-chat-app .aa-chat-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    color: var(--aa-chat-soft);
    text-align: center;
}

.aa-chat-app .aa-chat-empty-icon {
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    margin-bottom: 16px;
    color: var(--aa-chat-gold-strong) !important;
    background: rgba(205, 156, 32, .055);
    border: 1px solid rgba(205, 156, 32, .2);
    border-radius: 50%;
}

.aa-chat-app .aa-chat-empty-icon svg {
    width: 31px;
    height: 31px;
}

.aa-chat-app .aa-chat-empty-state h3 {
    margin: 0 0 6px !important;
    padding: 0 !important;
    color: #cbc7bd !important;
    border: 0 !important;
    font-family: Inter, system-ui, sans-serif !important;
    font-size: 16px !important;
    font-weight: 650 !important;
    line-height: 1.25 !important;
}

.aa-chat-app .aa-chat-empty-state p {
    margin: 0 !important;
    color: var(--aa-chat-soft) !important;
    font-size: 11px !important;
}

.aa-chat-app .aa-chat-conversation-panel {
    width: 100%;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.aa-chat-app .aa-chat-conversation-header {
    position: relative;
    z-index: 30;
    min-height: 68px;
    display: flex;
    align-items: center;
    gap: 11px;
    flex: 0 0 auto;
    padding: 10px 16px;
    background: rgba(16, 17, 17, .97) !important;
    border: 0 !important;
    border-bottom: 1px solid var(--aa-chat-border) !important;
    box-shadow: none !important;
    backdrop-filter: blur(12px);
}

.aa-chat-app .aa-chat-back {
    width: 36px !important;
    height: 36px !important;
    min-height: 36px !important;
    display: none !important;
    place-items: center;
    flex: 0 0 auto;
    padding: 0 !important;
    color: var(--aa-chat-muted) !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    border-radius: 10px !important;
    cursor: pointer;
}

.aa-chat-app .aa-chat-back:hover {
    color: var(--aa-chat-gold-strong) !important;
    background: var(--aa-chat-gold-soft) !important;
    border-color: var(--aa-chat-gold-border) !important;
}

.aa-chat-app .aa-chat-back svg {
    width: 21px;
    height: 21px;
}

.aa-chat-app .aa-chat-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
}

.aa-chat-app .aa-chat-avatar svg,
.aa-chat-app .aa-chat-message-avatar svg {
    width: 15px;
    height: 15px;
    color: var(--aa-chat-gold-strong) !important;
}

.aa-chat-app .aa-chat-header-copy {
    min-width: 0;
    flex: 1;
}

.aa-chat-app .aa-chat-header-copy strong {
    display: block;
    overflow: hidden;
    color: var(--aa-chat-text) !important;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 20px !important;
    font-weight: 650 !important;
    line-height: 1.08;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aa-chat-app .aa-chat-header-copy small {
    display: block;
    margin-top: 4px;
    overflow: hidden;
    color: var(--aa-chat-muted) !important;
    font-size: 10px !important;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aa-chat-app .aa-chat-header-actions {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
}

/* Atribuição / assumir / encerrar / excluir */
/* O select nativo permanece no DOM para compatibilidade, mas o controle visual
   é próprio para evitar o destaque azul imposto pelo navegador/Windows. */
.aa-chat-app .aa-chat-assignee-control {
    position: relative;
    min-width: 0;
    max-width: 190px;
    display: inline-flex;
    flex: 0 1 190px;
}

.aa-chat-app .aa-chat-assignee-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    border: 0 !important;
    white-space: nowrap !important;
}

.aa-chat-app .aa-chat-assignee-button {
    width: 100% !important;
    height: 36px !important;
    min-height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    margin: 0 !important;
    padding: 0 12px 0 11px !important;
    color: #d6d1c7 !important;
    background: #151616 !important;
    border: 1px solid var(--aa-chat-gold-border) !important;
    border-radius: 9px !important;
    outline: 0 !important;
    box-shadow: none !important;
    font-size: 9px !important;
    text-align: left !important;
    cursor: pointer;
}

.aa-chat-app .aa-chat-assignee-button > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aa-chat-app .aa-chat-assignee-button svg {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    margin-left: 4px;
    color: var(--aa-chat-gold-strong) !important;
    transition: transform .16s ease;
}

.aa-chat-app .aa-chat-assignee-control.is-open .aa-chat-assignee-button svg {
    transform: rotate(180deg);
}

.aa-chat-app .aa-chat-assignee-button:hover,
.aa-chat-app .aa-chat-assignee-button:focus-visible,
.aa-chat-app .aa-chat-assignee-control.is-open .aa-chat-assignee-button {
    color: #f2ecdd !important;
    background: #181817 !important;
    border-color: rgba(245, 203, 92, .58) !important;
    box-shadow: 0 0 0 2px rgba(205, 156, 32, .09) !important;
}

.aa-chat-app .aa-chat-assignee-menu {
    position: absolute;
    z-index: 90;
    top: calc(100% + 6px);
    right: 0;
    width: max(100%, 215px);
    max-height: 260px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 4px;
    background: #101111;
    border: 1px solid rgba(205, 156, 32, .42);
    border-radius: 10px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .48);
}

.aa-chat-app .aa-chat-assignee-menu[hidden] {
    display: none !important;
}

.aa-chat-app button.aa-chat-assignee-option {
    width: 100% !important;
    min-height: 34px !important;
    display: flex !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 10px !important;
    color: #d8d4ca !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 7px !important;
    box-shadow: none !important;
    outline: 0 !important;
    font-size: 9px !important;
    text-align: left !important;
    cursor: pointer;
}

.aa-chat-app button.aa-chat-assignee-option:hover,
.aa-chat-app button.aa-chat-assignee-option:focus-visible {
    color: #fff4d0 !important;
    background: rgba(205, 156, 32, .12) !important;
}

.aa-chat-app button.aa-chat-assignee-option.is-selected {
    color: #17130a !important;
    background: linear-gradient(135deg, #f5cb5c, #cd9c20) !important;
    font-weight: 800 !important;
}

.aa-chat-app .aa-chat-claim {
    min-height: 36px !important;
    padding: 0 11px !important;
    color: var(--aa-chat-gold-strong) !important;
    background: rgba(205, 156, 32, .06) !important;
    border: 1px solid var(--aa-chat-gold-border) !important;
    border-radius: 9px !important;
    font-size: 9px !important;
    font-weight: 750 !important;
    cursor: pointer;
}

.aa-chat-app .aa-chat-claim:hover {
    color: #ffe08a !important;
    background: rgba(205, 156, 32, .13) !important;
    border-color: rgba(245, 203, 92, .52) !important;
}

.aa-chat-app .aa-chat-close-thread,
.aa-chat-app .aa-chat-delete-thread {
    width: 36px !important;
    height: 36px !important;
    min-height: 36px !important;
    display: grid !important;
    place-items: center;
    flex: 0 0 auto;
    padding: 0 !important;
    color: var(--aa-chat-muted) !important;
    background: transparent !important;
    border: 1px solid var(--aa-chat-border) !important;
    border-radius: 9px !important;
    cursor: pointer;
    transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}

.aa-chat-app .aa-chat-close-thread svg,
.aa-chat-app .aa-chat-delete-thread svg {
    width: 16px;
    height: 16px;
}

.aa-chat-app .aa-chat-close-thread:hover {
    color: var(--aa-chat-gold-strong) !important;
    background: var(--aa-chat-gold-soft) !important;
    border-color: var(--aa-chat-gold-border) !important;
}

.aa-chat-app .aa-chat-delete-thread:hover {
    color: var(--aa-chat-danger) !important;
    background: rgba(228, 123, 123, .07) !important;
    border-color: rgba(228, 123, 123, .4) !important;
}

.aa-chat-app .aa-chat-delete-thread:disabled {
    opacity: .45;
    cursor: wait;
}

/* ========================================================================== */
/* 6. HISTÓRICO E BALÕES                                                      */
/* ========================================================================== */

.aa-chat-app .aa-chat-messages {
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 11px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 22px clamp(18px, 3vw, 40px);
    background:
        radial-gradient(circle at 90% 10%, rgba(205, 156, 32, .03), transparent 28%),
        linear-gradient(rgba(255, 255, 255, .011) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .009) 1px, transparent 1px);
    background-size: auto, 28px 28px, 28px 28px;
    scrollbar-width: thin;
    scrollbar-color: rgba(205, 156, 32, .28) transparent;
}

.aa-chat-app .aa-chat-message {
    max-width: min(76%, 680px);
    display: flex;
    align-items: flex-end;
    align-self: flex-start;
    gap: 8px;
    color: var(--aa-chat-text);
}

.aa-chat-app .aa-chat-message.is-mine {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.aa-chat-app .aa-chat-message-avatar {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    overflow: hidden;
    background-color: #1b1c1c;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    border: 1px solid rgba(205, 156, 32, .26);
    border-radius: 50%;
}

.aa-chat-app .aa-chat-message-stack {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.aa-chat-app .aa-chat-message.is-mine .aa-chat-message-stack {
    align-items: flex-end;
}

.aa-chat-app .aa-chat-message-sender {
    margin: 0 5px 4px;
    color: var(--aa-chat-soft) !important;
    font-size: 8px !important;
    font-weight: 650;
}

.aa-chat-app .aa-chat-bubble {
    max-width: 100%;
    padding: 10px 13px;
    color: #e8e5dc !important;
    background: #181919 !important;
    border: 1px solid rgba(242, 236, 221, .075) !important;
    border-radius: 15px 15px 15px 4px !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .16) !important;
    font-size: 13px !important;
    line-height: 1.5;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.aa-chat-app .aa-chat-message.is-mine .aa-chat-bubble {
    color: #fff7df !important;
    background: linear-gradient(145deg, rgba(205, 156, 32, .23), rgba(124, 92, 18, .17)) !important;
    border-color: rgba(205, 156, 32, .3) !important;
    border-radius: 15px 15px 4px 15px !important;
}

.aa-chat-app .aa-chat-message-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 4px 5px 0;
    color: var(--aa-chat-soft) !important;
    font-size: 9px !important;
}

.aa-chat-app .aa-chat-message.is-mine .aa-chat-message-meta {
    color: rgba(245, 203, 92, .7) !important;
}

.aa-chat-app .aa-chat-read-mark {
    font-weight: 800;
    letter-spacing: -3px;
}

/* Anexos dentro da bolha */
.aa-chat-app a.aa-chat-attachment {
    min-width: min(260px, 62vw);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px !important;
    padding: 9px 10px;
    color: inherit !important;
    background: rgba(0, 0, 0, .16) !important;
    border: 1px solid rgba(242, 236, 221, .09) !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    text-decoration: none !important;
    transition: background-color .15s ease, border-color .15s ease;
}

.aa-chat-app a.aa-chat-attachment:hover {
    color: inherit !important;
    background: rgba(205, 156, 32, .06) !important;
    border-color: var(--aa-chat-gold-border) !important;
    text-decoration: none !important;
}

.aa-chat-app .aa-chat-attachment-icon {
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    color: var(--aa-chat-gold-strong) !important;
    background: rgba(205, 156, 32, .11);
    border-radius: 8px;
}

.aa-chat-app .aa-chat-attachment-icon svg {
    width: 16px;
    height: 16px;
}

.aa-chat-app .aa-chat-attachment-copy {
    min-width: 0;
    flex: 1;
}

.aa-chat-app .aa-chat-attachment-copy strong,
.aa-chat-app .aa-chat-attachment-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aa-chat-app .aa-chat-attachment-copy strong {
    color: inherit !important;
    font-size: 9px !important;
}

.aa-chat-app .aa-chat-attachment-copy small {
    margin-top: 2px;
    color: var(--aa-chat-soft) !important;
    font-size: 8px !important;
}

.aa-chat-app .aa-chat-day-separator {
    align-self: center;
    padding: 5px 9px;
    color: var(--aa-chat-soft) !important;
    background: rgba(13, 14, 14, .92) !important;
    border: 1px solid var(--aa-chat-border) !important;
    border-radius: 10px;
    font-size: 8px !important;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.aa-chat-app .aa-chat-load-older {
    align-self: center;
    min-height: 31px !important;
    margin: 0 auto 4px !important;
    padding: 0 12px !important;
    color: #d3b55e !important;
    background: rgba(205, 156, 32, .055) !important;
    border: 1px solid var(--aa-chat-gold-border) !important;
    border-radius: 9px !important;
    font-size: 9px !important;
    font-weight: 700 !important;
    cursor: pointer;
}

.aa-chat-app .aa-chat-load-older:hover {
    color: var(--aa-chat-gold-strong) !important;
    background: rgba(205, 156, 32, .11) !important;
    border-color: rgba(245, 203, 92, .48) !important;
}

.aa-chat-app .aa-chat-load-older:disabled {
    opacity: .55;
    cursor: wait;
}

/* ========================================================================== */
/* 7. INDICADOR DIGITANDO E BARRA DE ENVIO                                   */
/* ========================================================================== */

.aa-chat-app .aa-chat-typing {
    height: 22px;
    display: flex;
    align-items: center;
    gap: 3px;
    flex: 0 0 auto;
    padding: 0 26px;
    color: var(--aa-chat-soft) !important;
    background: rgba(12, 13, 13, .97);
    font-size: 9px !important;
}

.aa-chat-app .aa-chat-typing span {
    width: 4px;
    height: 4px;
    background: var(--aa-chat-gold);
    border-radius: 50%;
    animation: aa-chat-typing 1.1s infinite ease-in-out;
}

.aa-chat-app .aa-chat-typing span:nth-child(2) { animation-delay: .14s; }
.aa-chat-app .aa-chat-typing span:nth-child(3) { animation-delay: .28s; }

.aa-chat-app .aa-chat-typing em {
    margin-left: 4px;
    font-style: normal;
}

@keyframes aa-chat-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: .35; }
    30% { transform: translateY(-3px); opacity: 1; }
}

/*
 * Altura única para aluno, dashboard administrativo e wp-admin.
 * O reset de margin/min-height corrige a barra exagerada no admin.
 */
.aa-chat-app form.aa-chat-composer {
    width: 100%;
    min-height: 62px !important;
    height: auto !important;
    display: flex !important;
    align-items: flex-end;
    gap: 9px;
    flex: 0 0 auto;
    margin: 0 !important;
    padding: 10px 13px !important;
    background: rgba(16, 17, 17, .99) !important;
    border: 0 !important;
    border-top: 1px solid var(--aa-chat-border) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.aa-chat-app .aa-chat-attach,
.aa-chat-app .aa-chat-send {
    width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    display: grid !important;
    place-items: center;
    flex: 0 0 auto;
    padding: 0 !important;
    border-radius: 50% !important;
    cursor: pointer;
    transition: color .15s ease, background-color .15s ease, border-color .15s ease, transform .15s ease, filter .15s ease;
}

.aa-chat-app .aa-chat-attach {
    color: var(--aa-chat-muted) !important;
    background: var(--aa-chat-panel-3) !important;
    border: 1px solid var(--aa-chat-border) !important;
}

.aa-chat-app .aa-chat-attach:hover {
    color: var(--aa-chat-gold-strong) !important;
    background: var(--aa-chat-gold-soft) !important;
    border-color: var(--aa-chat-gold-border) !important;
}

.aa-chat-app .aa-chat-attach svg,
.aa-chat-app .aa-chat-send svg {
    width: 17px;
    height: 17px;
}

.aa-chat-app .aa-chat-composer-main {
    min-width: 0;
    min-height: 42px;
    flex: 1;
    margin: 0 !important;
    overflow: hidden;
    background: var(--aa-chat-panel-3) !important;
    border: 1px solid var(--aa-chat-border) !important;
    border-radius: 17px !important;
    box-shadow: none !important;
    transition: background-color .15s ease, border-color .15s ease;
}

.aa-chat-app .aa-chat-composer-main:focus-within {
    background: #1d1e1e !important;
    border-color: var(--aa-chat-gold-border) !important;
}

.aa-chat-app .aa-chat-composer textarea {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 40px !important;
    height: 40px;
    max-height: 118px !important;
    display: block;
    margin: 0 !important;
    padding: 10px 13px !important;
    overflow-y: auto;
    resize: none;
    color: var(--aa-chat-text) !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    font-size: 13px !important;
    line-height: 20px !important;
}

.aa-chat-app .aa-chat-composer textarea::placeholder {
    color: var(--aa-chat-soft) !important;
    opacity: 1;
}

.aa-chat-app .aa-chat-file-preview {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 8px 8px;
    padding: 7px 9px;
    color: #c5c2b9 !important;
    background: rgba(205, 156, 32, .07);
    border-radius: 9px;
    font-size: 9px !important;
}

.aa-chat-app .aa-chat-file-preview span {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aa-chat-app .aa-chat-file-preview button {
    width: 20px !important;
    height: 20px !important;
    min-height: 20px !important;
    padding: 0 !important;
    color: var(--aa-chat-muted) !important;
    background: rgba(255, 255, 255, .06) !important;
    border: 0 !important;
    border-radius: 50% !important;
    cursor: pointer;
}

.aa-chat-app .aa-chat-file-preview button:hover {
    color: #fff !important;
    background: rgba(228, 123, 123, .18) !important;
}

.aa-chat-app .aa-chat-send {
    color: #17130a !important;
    background: linear-gradient(145deg, var(--aa-chat-gold-strong), #bd8a20) !important;
    border: 1px solid rgba(245, 203, 92, .68) !important;
    box-shadow: 0 6px 17px rgba(205, 156, 32, .19) !important;
}

.aa-chat-app .aa-chat-send:hover {
    color: #0d0b07 !important;
    transform: translateY(-1px);
    filter: brightness(1.06);
}

.aa-chat-app .aa-chat-send:active {
    transform: translateY(0);
}

.aa-chat-app .aa-chat-send:disabled,
.aa-chat-app .aa-chat-new-submit:disabled {
    opacity: .5;
    cursor: wait;
    transform: none;
}

/* ========================================================================== */
/* 8. MODAL NOVA CONVERSA                                                     */
/* ========================================================================== */

.aa-chat-app .aa-chat-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: grid;
    place-items: center;
    padding: 18px;
}

.aa-chat-app .aa-chat-modal-backdrop {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    background: rgba(0, 0, 0, .74) !important;
    border: 0 !important;
    border-radius: 0 !important;
    cursor: default;
    backdrop-filter: blur(8px);
}

.aa-chat-app .aa-chat-new-form {
    position: relative;
    z-index: 1;
    width: min(510px, 100%);
    margin: 0 !important;
    padding: 22px !important;
    color: var(--aa-chat-text);
    background: linear-gradient(145deg, #171818, #0d0e0e) !important;
    border: 1px solid var(--aa-chat-gold-border) !important;
    border-radius: 18px !important;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .55) !important;
}

.aa-chat-app .aa-chat-new-form header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 19px;
}

.aa-chat-app .aa-chat-new-form header span {
    color: var(--aa-chat-gold-strong) !important;
    font-size: 9px !important;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.aa-chat-app .aa-chat-new-form h3 {
    margin: 4px 0 0 !important;
    padding: 0 !important;
    color: var(--aa-chat-text) !important;
    border: 0 !important;
    font-size: 22px !important;
    font-weight: 600 !important;
}

.aa-chat-app .aa-chat-new-form header button {
    width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
    padding: 0 !important;
    color: var(--aa-chat-muted) !important;
    background: transparent !important;
    border: 1px solid var(--aa-chat-border) !important;
    border-radius: 50% !important;
    font-size: 20px !important;
    line-height: 1;
    cursor: pointer;
}

.aa-chat-app .aa-chat-new-form header button:hover {
    color: var(--aa-chat-text) !important;
    background: rgba(255, 255, 255, .055) !important;
    border-color: var(--aa-chat-border-strong) !important;
}

.aa-chat-app .aa-chat-new-form label {
    display: block;
    margin: 0 0 13px !important;
    color: var(--aa-chat-muted) !important;
    font-size: 9px !important;
    font-weight: 700;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.aa-chat-app .aa-chat-new-form input[type="text"],
.aa-chat-app .aa-chat-new-form input[type="search"],
.aa-chat-app .aa-chat-new-form select,
.aa-chat-app .aa-chat-new-form textarea {
    width: 100% !important;
    display: block;
    margin: 6px 0 0 !important;
    padding: 11px 12px !important;
    color: var(--aa-chat-text) !important;
    background: #101111 !important;
    border: 1px solid var(--aa-chat-border) !important;
    border-radius: 10px !important;
    outline: 0 !important;
    box-shadow: none !important;
    font-size: 11px !important;
    letter-spacing: 0;
    text-transform: none;
}

.aa-chat-app .aa-chat-new-form input[type="text"]:focus,
.aa-chat-app .aa-chat-new-form input[type="search"]:focus,
.aa-chat-app .aa-chat-new-form select:focus,
.aa-chat-app .aa-chat-new-form textarea:focus {
    border-color: var(--aa-chat-gold-border) !important;
}

.aa-chat-app .aa-chat-new-form textarea {
    min-height: 110px !important;
    resize: vertical;
}

.aa-chat-app .aa-chat-new-file {
    padding: 10px 12px;
    border: 1px dashed var(--aa-chat-gold-border);
    border-radius: 10px;
    cursor: pointer;
}

.aa-chat-app .aa-chat-new-file:hover {
    background: rgba(205, 156, 32, .045);
    border-color: rgba(245, 203, 92, .48);
}

.aa-chat-app .aa-chat-new-file input {
    display: block;
    margin-top: 7px !important;
    color: var(--aa-chat-muted) !important;
    font-size: 9px !important;
    text-transform: none;
}

.aa-chat-app .aa-chat-new-submit {
    width: 100% !important;
    min-height: 43px !important;
    margin: 5px 0 0 !important;
    padding: 0 15px !important;
    color: #17130a !important;
    background: linear-gradient(145deg, var(--aa-chat-gold-strong), #bc8a21) !important;
    border: 1px solid rgba(245, 203, 92, .68) !important;
    border-radius: 10px !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    cursor: pointer;
}

.aa-chat-app .aa-chat-new-submit:hover {
    filter: brightness(1.06);
}

/* Perfis institucionais de resposta */
.aa-chat-app .aa-chat-identity-control {
    position: relative;
    flex: 0 0 auto;
    align-self: center;
}

.aa-chat-app .aa-chat-identity-control[hidden],
.aa-chat-app .aa-chat-identity-menu[hidden],
.aa-chat-app .aa-chat-student-results[hidden],
.aa-chat-app .aa-chat-selected-student[hidden],
.aa-chat-app .aa-chat-new-identities[hidden] {
    display: none !important;
}

.aa-chat-app .aa-chat-identity-button {
    width: 118px !important;
    height: 40px !important;
    min-height: 40px !important;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
    margin: 0 !important;
    padding: 0 10px !important;
    color: var(--aa-chat-gold-strong) !important;
    background: rgba(205, 156, 32, .07) !important;
    border: 1px solid var(--aa-chat-gold-border) !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    font-size: 9px !important;
    font-weight: 750 !important;
    cursor: pointer;
}

.aa-chat-app .aa-chat-identity-button > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aa-chat-app .aa-chat-identity-button svg {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
    transition: transform .16s ease;
}

.aa-chat-app .aa-chat-identity-control.is-open .aa-chat-identity-button svg {
    transform: rotate(180deg);
}

.aa-chat-app .aa-chat-identity-button:hover,
.aa-chat-app .aa-chat-identity-button:focus-visible,
.aa-chat-app .aa-chat-identity-control.is-open .aa-chat-identity-button {
    color: #ffe08a !important;
    background: rgba(205, 156, 32, .13) !important;
    border-color: rgba(245, 203, 92, .58) !important;
}

.aa-chat-app .aa-chat-identity-menu {
    position: absolute;
    z-index: 100;
    left: 0;
    bottom: calc(100% + 8px);
    width: 220px;
    padding: 5px;
    background: #101111;
    border: 1px solid rgba(205, 156, 32, .42);
    border-radius: 11px;
    box-shadow: 0 18px 42px rgba(0, 0, 0, .55);
}

.aa-chat-app button.aa-chat-identity-option {
    width: 100% !important;
    min-height: 42px !important;
    display: flex !important;
    flex-direction: column;
    align-items: flex-start !important;
    justify-content: center;
    gap: 2px;
    margin: 0 !important;
    padding: 7px 10px !important;
    color: #ded9ce !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    text-align: left !important;
    cursor: pointer;
}

.aa-chat-app button.aa-chat-identity-option strong {
    font-size: 10px !important;
    font-weight: 750 !important;
}

.aa-chat-app button.aa-chat-identity-option small {
    color: var(--aa-chat-muted) !important;
    font-size: 8px !important;
}

.aa-chat-app button.aa-chat-identity-option:hover,
.aa-chat-app button.aa-chat-identity-option:focus-visible {
    color: #fff4d0 !important;
    background: rgba(205, 156, 32, .11) !important;
}

.aa-chat-app button.aa-chat-identity-option.is-selected {
    color: #17130a !important;
    background: linear-gradient(135deg, #f5cb5c, #cd9c20) !important;
}

.aa-chat-app button.aa-chat-identity-option.is-selected small {
    color: rgba(23, 19, 10, .72) !important;
}

/* Busca ativa de alunos no modal da equipe */
.aa-chat-app .aa-chat-student-search-field {
    position: relative;
    margin-bottom: 7px !important;
}

.aa-chat-app .aa-chat-student-results {
    max-height: 210px;
    margin: -5px 0 13px;
    padding: 5px;
    overflow-y: auto;
    background: #0d0e0e;
    border: 1px solid var(--aa-chat-border);
    border-radius: 11px;
}

.aa-chat-app .aa-chat-student-searching {
    padding: 13px 10px;
    color: var(--aa-chat-muted);
    font-size: 10px;
    text-align: center;
}

.aa-chat-app button.aa-chat-student-result {
    width: 100% !important;
    min-height: 54px !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px;
    margin: 0 !important;
    padding: 7px 9px !important;
    color: var(--aa-chat-text) !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 9px !important;
    box-shadow: none !important;
    text-align: left !important;
    cursor: pointer;
}

.aa-chat-app button.aa-chat-student-result:hover,
.aa-chat-app button.aa-chat-student-result:focus-visible {
    background: rgba(205, 156, 32, .09) !important;
}

.aa-chat-app .aa-chat-student-result-avatar,
.aa-chat-app .aa-chat-selected-student-avatar {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    background-position: center;
    background-size: cover;
    border: 1px solid rgba(205, 156, 32, .46);
    border-radius: 50%;
}

.aa-chat-app .aa-chat-student-result-copy,
.aa-chat-app .aa-chat-selected-student-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.aa-chat-app .aa-chat-student-result-copy strong,
.aa-chat-app .aa-chat-selected-student-copy strong {
    overflow: hidden;
    color: var(--aa-chat-text) !important;
    font-size: 11px !important;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aa-chat-app .aa-chat-student-result-copy small,
.aa-chat-app .aa-chat-selected-student-copy small {
    overflow: hidden;
    color: var(--aa-chat-muted) !important;
    font-size: 9px !important;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aa-chat-app .aa-chat-selected-student {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 13px;
    padding: 9px 11px;
    background: rgba(205, 156, 32, .07);
    border: 1px solid var(--aa-chat-gold-border);
    border-radius: 11px;
}

.aa-chat-app .aa-chat-new-identities {
    margin: 0 0 13px;
}

.aa-chat-app .aa-chat-new-identities > span {
    display: block;
    margin-bottom: 7px;
    color: var(--aa-chat-muted) !important;
    font-size: 9px !important;
    font-weight: 700;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.aa-chat-app .aa-chat-new-identity-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.aa-chat-app button.aa-chat-new-identity-option {
    min-height: 36px !important;
    margin: 0 !important;
    padding: 0 10px !important;
    color: #c7c3b9 !important;
    background: #101111 !important;
    border: 1px solid var(--aa-chat-border) !important;
    border-radius: 9px !important;
    box-shadow: none !important;
    font-size: 9px !important;
    font-weight: 700 !important;
    cursor: pointer;
}

.aa-chat-app button.aa-chat-new-identity-option:hover,
.aa-chat-app button.aa-chat-new-identity-option:focus-visible {
    color: var(--aa-chat-gold-strong) !important;
    border-color: var(--aa-chat-gold-border) !important;
}

.aa-chat-app button.aa-chat-new-identity-option.is-selected {
    color: #17130a !important;
    background: linear-gradient(135deg, #f5cb5c, #cd9c20) !important;
    border-color: rgba(245, 203, 92, .75) !important;
}

/* ========================================================================== */
/* 9. CONTEXTOS ESPECÍFICOS: DASHBOARD E WP-ADMIN                            */
/* ========================================================================== */

#view-chat.aad-panel-view.active {
    min-width: 0;
    min-height: 0;
}

#view-chat .aa-chat-app {
    height: 100%;
    min-height: 0;
    border-top: 0 !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

#view-chat .aa-chat-sidebar-header {
    padding-top: 26px;
}

/* Reforço contra estilos azuis do dashboard embutido. */
#view-chat .aa-chat-app button,
#view-chat .aa-chat-app select,
.aa-communications-chat-admin .aa-chat-app button,
.aa-communications-chat-admin .aa-chat-app select {
    outline-color: transparent !important;
}

#view-chat .aa-chat-app button.aa-chat-thread,
.aa-communications-chat-admin .aa-chat-app button.aa-chat-thread {
    border-left-color: transparent !important;
    border-right-color: transparent !important;
    border-top-color: transparent !important;
}

/* O formulário do wp-admin não pode herdar margin-bottom nem min-height. */
.aa-communications-chat-admin .aa-chat-composer,
.aa-admin-support-page .aa-chat-composer,
#panel-chat .aa-chat-composer {
    margin-bottom: 0 !important;
    padding-bottom: 10px !important;
}

.aa-communications-chat-admin .aa-chat-composer textarea,
.aa-admin-support-page .aa-chat-composer textarea,
#panel-chat .aa-chat-composer textarea {
    min-height: 40px !important;
    height: 40px;
    margin-bottom: 0 !important;
}


/* Dashboard administrativo e aluno: mesma escala visual do painel interno. */
#view-chat .aa-chat-app[data-mode="support"] .aa-chat-messages,
#view-chat .aa-chat-app[data-mode="student"] .aa-chat-messages {
    gap: 13px !important;
}

#view-chat .aa-chat-app[data-mode="support"] .aa-chat-bubble,
#view-chat .aa-chat-app[data-mode="student"] .aa-chat-bubble {
    padding: 9px 12px !important;
    font-size: 12px !important;
    line-height: 1.4 !important;
}

#view-chat .aa-chat-app[data-mode="support"] .aa-chat-message-sender,
#view-chat .aa-chat-app[data-mode="student"] .aa-chat-message-sender {
    margin-bottom: 5px !important;
    font-size: 8px !important;
    line-height: 1.2 !important;
}

#view-chat .aa-chat-app[data-mode="support"] .aa-chat-message-meta,
#view-chat .aa-chat-app[data-mode="student"] .aa-chat-message-meta {
    margin-top: 6px !important;
    font-size: 8px !important;
    line-height: 1.2 !important;
}

/* O dashboard já ocupa a viewport; não descontar uma barra admin oculta. */
@media (min-width: 781px) {
    #view-chat.aad-panel-view.active {
        height: 100% !important;
        max-height: 100% !important;
        padding-bottom: 0 !important;
    }

    #view-chat .aa-chat-app,
    #view-chat .aa-chat-conversation,
    #view-chat .aa-chat-conversation-panel {
        height: 100% !important;
        max-height: 100% !important;
    }

    #view-chat .aa-chat-composer {
        margin-bottom: 0 !important;
        padding-bottom: 10px !important;
    }
}

/* ========================================================================== */
/* 10. RESPONSIVIDADE                                                         */
/* ========================================================================== */

@media (min-width: 781px) {
    #view-chat.aad-panel-view.active {
        display: flex !important;
        height: 100% !important;
        min-height: 0 !important;
        max-height: 100% !important;
        overflow: hidden !important;
    }

    #view-chat .aa-chat-app {
        width: 100%;
        max-width: none;
        flex: 1;
    }

    .aa-chat-app .aa-chat-sidebar {
        min-width: 340px;
    }
}

@media (max-width: 1100px) {
    .aa-chat-app {
        grid-template-columns: minmax(315px, 360px) minmax(0, 1fr);
    }

    .aa-chat-app .aa-chat-sidebar-header {
        padding-left: 17px;
        padding-right: 17px;
    }

    .aa-chat-app .aa-chat-new-button {
        width: 40px !important;
        padding: 0 !important;
    }

    .aa-chat-app .aa-chat-new-button span {
        display: none;
    }
}

@media (max-width: 780px) {
    .aa-chat-admin-heading {
        padding: 0 4px;
    }

    .aa-chat-app {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
        height: calc(100dvh - 76px);
        min-height: 520px;
        border: 0 !important;
        border-radius: 0;
        box-shadow: none !important;
    }

    .aa-communications-chat-admin .aa-chat-app {
        height: calc(100dvh - 190px);
        min-height: 440px;
        border: 1px solid var(--aa-chat-border) !important;
        border-radius: 14px;
    }

    #view-chat.aad-panel-view.active {
        display: flex !important;
        height: calc(var(--aad-mobile-h, 100dvh) - 126px) !important;
        min-height: 0 !important;
        max-height: calc(var(--aad-mobile-h, 100dvh) - 126px) !important;
        overflow: hidden !important;
    }

    #view-chat .aa-chat-app {
        height: 100%;
        min-height: 0;
        border: 0 !important;
    }

    .aa-chat-app .aa-chat-sidebar,
    .aa-chat-app .aa-chat-conversation {
        grid-area: 1 / 1;
        min-height: 0;
    }

    .aa-chat-app .aa-chat-conversation {
        display: none;
    }

    .aa-chat-app.is-conversation-open .aa-chat-sidebar {
        display: none;
    }

    .aa-chat-app.is-conversation-open .aa-chat-conversation {
        display: flex;
    }

    .aa-chat-app .aa-chat-sidebar {
        border-right: 0 !important;
    }

    .aa-chat-app .aa-chat-sidebar-header {
        padding: 22px 18px 15px;
    }

    .aa-chat-app .aa-chat-sidebar-header h2 {
        font-size: 28px !important;
    }

    .aa-chat-app .aa-chat-sidebar-header p {
        font-size: 11px !important;
    }

    .aa-chat-app .aa-chat-new-button {
        width: auto !important;
        padding: 0 12px !important;
    }

    .aa-chat-app .aa-chat-new-button span {
        display: inline;
    }

    .aa-chat-app .aa-chat-thread-list {
        padding-right: 12px;
        padding-left: 12px;
    }

    .aa-chat-app button.aa-chat-thread {
        grid-template-columns: 50px minmax(0, 1fr) auto;
        padding: 14px 10px !important;
    }

    .aa-chat-app .aa-chat-thread-avatar {
        width: 50px;
        height: 50px;
    }

    .aa-chat-app .aa-chat-thread-top strong {
        font-size: 18px !important;
    }

    .aa-chat-app .aa-chat-thread-copy p {
        font-size: 11px !important;
    }

    .aa-chat-app .aa-chat-support-footer {
        margin-bottom: 10px;
    }

    .aa-chat-app .aa-chat-back {
        display: grid !important;
    }

    .aa-chat-app .aa-chat-conversation-header {
        min-height: 62px;
        padding: 8px 10px;
    }

    .aa-chat-app .aa-chat-avatar {
        width: 39px;
        height: 39px;
    }

    .aa-chat-app .aa-chat-header-copy strong {
        font-size: 17px !important;
    }

    .aa-chat-app .aa-chat-header-actions {
        gap: 5px;
    }

    .aa-chat-app .aa-chat-assignee-control {
        max-width: 116px;
        flex-basis: 116px;
    }

    .aa-chat-app .aa-chat-claim {
        max-width: 94px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .aa-chat-app .aa-chat-close-thread,
    .aa-chat-app .aa-chat-delete-thread {
        width: 34px !important;
        height: 34px !important;
        min-height: 34px !important;
    }

    .aa-chat-app .aa-chat-messages {
        padding: 18px 12px 14px;
    }

    .aa-chat-app .aa-chat-message {
        max-width: 88%;
    }

    .aa-chat-app .aa-chat-message-avatar {
        display: none;
    }

    .aa-chat-app .aa-chat-bubble {
        font-size: 12px !important;
    }

    .aa-chat-app form.aa-chat-composer {
        min-height: 58px !important;
        padding: 8px 9px calc(8px + env(safe-area-inset-bottom)) !important;
    }

    .aa-chat-app .aa-chat-attach,
    .aa-chat-app .aa-chat-send {
        width: 38px !important;
        height: 38px !important;
        min-height: 38px !important;
    }

    .aa-chat-app .aa-chat-identity-button {
        width: 86px !important;
        height: 38px !important;
        min-height: 38px !important;
        padding: 0 8px !important;
        font-size: 8px !important;
    }

    .aa-chat-app .aa-chat-identity-menu {
        width: 205px;
    }

    .aa-chat-app .aa-chat-composer-main {
        min-height: 40px;
    }

    .aa-chat-app .aa-chat-composer textarea {
        min-height: 38px !important;
        height: 38px;
        padding-top: 9px !important;
        padding-bottom: 9px !important;
    }

    .aa-chat-app .aa-chat-new-form {
        max-height: calc(100dvh - 28px);
        overflow-y: auto;
        padding: 19px !important;
    }
}

@media (max-width: 520px) {
    .aa-chat-app .aa-chat-assignee-control {
        max-width: 102px;
        flex-basis: 102px;
    }

    .aa-chat-app .aa-chat-header-copy small {
        max-width: 145px;
    }
}

@media (max-width: 430px) {
    .aa-chat-app .aa-chat-sidebar-header {
        align-items: center;
    }

    .aa-chat-app .aa-chat-sidebar-header p {
        max-width: 230px;
    }

    .aa-chat-app .aa-chat-new-button {
        width: 43px !important;
        height: 43px !important;
        padding: 0 !important;
        border-radius: 12px !important;
    }

    .aa-chat-app .aa-chat-new-button span {
        display: none;
    }

    .aa-chat-app .aa-chat-toolbar,
    .aa-chat-app .aa-chat-filters {
        padding-right: 15px;
        padding-left: 15px;
    }

    .aa-chat-app button.aa-chat-thread {
        grid-template-columns: 46px minmax(0, 1fr) auto;
    }

    .aa-chat-app .aa-chat-thread-avatar {
        width: 46px;
        height: 46px;
    }

    .aa-chat-app .aa-chat-thread-side {
        font-size: 8px !important;
    }

    .aa-chat-app a.aa-chat-attachment {
        min-width: min(245px, 72vw);
    }
}

@media (max-width: 480px) {
    #view-chat.aad-panel-view.active {
        height: calc(var(--aad-mobile-h, 100dvh) - 124px) !important;
        max-height: calc(var(--aad-mobile-h, 100dvh) - 124px) !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .aa-chat-app *,
    .aa-chat-app *::before,
    .aa-chat-app *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* Regra final: preserva o atributo hidden contra qualquer display !important. */
.aa-chat-app [hidden],
.aa-chat-app .aa-chat-conversation-panel[hidden],
.aa-chat-app .aa-chat-claim[hidden],
.aa-chat-app .aa-chat-delete-thread[hidden],
.aa-chat-app .aa-chat-file-preview[hidden],
.aa-chat-app .aa-chat-modal[hidden],
.aa-chat-app .aa-chat-typing[hidden] {
    display: none !important;
}


/* ========================================================================== */
/* 15. CONFIGURAÇÃO DOS AVATARES INSTITUCIONAIS                              */
/* ========================================================================== */

.aa-chat-app .aa-chat-sidebar-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.aa-chat-app .aa-chat-identity-settings-button {
    width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    color: var(--aa-chat-gold-strong) !important;
    background: rgba(205, 156, 32, .055) !important;
    border: 1px solid var(--aa-chat-gold-border) !important;
    border-radius: 10px !important;
    cursor: pointer;
}

.aa-chat-app .aa-chat-identity-settings-button svg {
    width: 17px;
    height: 17px;
}

.aa-chat-app .aa-chat-identity-settings-button:hover,
.aa-chat-app .aa-chat-identity-settings-button:focus-visible {
    color: #ffe08a !important;
    background: rgba(205, 156, 32, .13) !important;
    border-color: rgba(245, 203, 92, .58) !important;
}

.aa-chat-app .aa-chat-identity-button {
    width: 142px !important;
    justify-content: flex-start;
}

.aa-chat-app .aa-chat-identity-button > span[data-chat-identity-label] {
    flex: 1;
}

.aa-chat-app .aa-chat-identity-button-avatar,
.aa-chat-app .aa-chat-identity-option-avatar,
.aa-chat-app .aa-chat-new-identity-avatar,
.aa-chat-app .aa-chat-identity-settings-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    border: 1px solid rgba(205, 156, 32, .46);
    border-radius: 50%;
}

.aa-chat-app .aa-chat-identity-button-avatar {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
}

.aa-chat-app .aa-chat-identity-button-avatar svg,
.aa-chat-app .aa-chat-identity-option-avatar svg,
.aa-chat-app .aa-chat-new-identity-avatar svg,
.aa-chat-app .aa-chat-identity-settings-avatar svg {
    width: 56%;
    height: 56%;
}

.aa-chat-app button.aa-chat-identity-option {
    min-height: 52px !important;
    flex-direction: row;
    align-items: center !important;
    justify-content: flex-start;
    gap: 9px;
}

.aa-chat-app .aa-chat-identity-option-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
}

.aa-chat-app .aa-chat-identity-option-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.aa-chat-app button.aa-chat-new-identity-option {
    min-height: 44px !important;
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

.aa-chat-app .aa-chat-new-identity-avatar {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
}

.aa-chat-app .aa-chat-identity-settings-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: grid;
    place-items: center;
    padding: 18px;
}

.aa-chat-app .aa-chat-identity-settings-form {
    position: relative;
    z-index: 1;
    width: min(680px, 100%);
    max-height: min(720px, calc(100vh - 36px));
    display: flex;
    flex-direction: column;
    margin: 0 !important;
    padding: 22px !important;
    overflow: hidden;
    color: var(--aa-chat-text);
    background: linear-gradient(145deg, #171818, #0d0e0e) !important;
    border: 1px solid var(--aa-chat-gold-border) !important;
    border-radius: 18px !important;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .62) !important;
}

.aa-chat-app .aa-chat-identity-settings-form > header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.aa-chat-app .aa-chat-identity-settings-form > header span {
    color: var(--aa-chat-gold-strong) !important;
    font-size: 9px !important;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.aa-chat-app .aa-chat-identity-settings-form h3 {
    margin: 4px 0 3px !important;
    color: var(--aa-chat-text) !important;
    font-size: 22px !important;
    font-weight: 650 !important;
}

.aa-chat-app .aa-chat-identity-settings-form header p {
    margin: 0 !important;
    color: var(--aa-chat-muted) !important;
    font-size: 10px !important;
}

.aa-chat-app .aa-chat-identity-settings-form > header > button {
    width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
    padding: 0 !important;
    color: var(--aa-chat-muted) !important;
    background: transparent !important;
    border: 1px solid var(--aa-chat-border) !important;
    border-radius: 50% !important;
    font-size: 20px !important;
    cursor: pointer;
}

.aa-chat-app .aa-chat-identity-settings-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding-right: 3px;
    overflow-y: auto;
}

.aa-chat-app .aa-chat-identity-settings-card {
    min-width: 0;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 11px 13px;
    align-items: center;
    margin: 0 !important;
    padding: 14px !important;
    background: rgba(255, 255, 255, .025) !important;
    border: 1px solid var(--aa-chat-border) !important;
    border-radius: 13px !important;
}

.aa-chat-app .aa-chat-identity-settings-avatar {
    width: 58px;
    height: 58px;
    grid-row: 1 / span 2;
}

.aa-chat-app .aa-chat-identity-settings-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.aa-chat-app .aa-chat-identity-settings-copy strong {
    color: var(--aa-chat-text) !important;
    font-size: 12px !important;
    font-weight: 700 !important;
}

.aa-chat-app .aa-chat-identity-settings-copy small {
    overflow: hidden;
    color: var(--aa-chat-muted) !important;
    font-size: 9px !important;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aa-chat-app .aa-chat-identity-settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.aa-chat-app .aa-chat-identity-settings-actions button {
    min-height: 30px !important;
    padding: 0 9px !important;
    color: var(--aa-chat-gold-strong) !important;
    background: rgba(205, 156, 32, .07) !important;
    border: 1px solid var(--aa-chat-gold-border) !important;
    border-radius: 8px !important;
    font-size: 8px !important;
    font-weight: 750 !important;
    cursor: pointer;
}

.aa-chat-app .aa-chat-identity-settings-actions button:hover {
    background: rgba(205, 156, 32, .14) !important;
}

.aa-chat-app .aa-chat-identity-settings-actions .aa-chat-identity-avatar-remove {
    color: var(--aa-chat-danger) !important;
    background: rgba(228, 123, 123, .06) !important;
    border-color: rgba(228, 123, 123, .24) !important;
}

.aa-chat-app .aa-chat-identity-settings-form > footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 18px;
    padding-top: 15px;
    border-top: 1px solid var(--aa-chat-border);
}

.aa-chat-app .aa-chat-identity-settings-form > footer small {
    max-width: 390px;
    color: var(--aa-chat-muted) !important;
    font-size: 9px !important;
    line-height: 1.45;
}

.aa-chat-app .aa-chat-identity-settings-save {
    min-height: 38px !important;
    padding: 0 15px !important;
    color: #17130a !important;
    background: linear-gradient(135deg, #f5cb5c, #cd9c20) !important;
    border: 0 !important;
    border-radius: 9px !important;
    font-size: 9px !important;
    font-weight: 800 !important;
    cursor: pointer;
    white-space: nowrap;
}

@media (max-width: 780px) {
    .aa-chat-app .aa-chat-sidebar-actions {
        gap: 6px;
    }

    .aa-chat-app .aa-chat-identity-settings-list {
        grid-template-columns: 1fr;
    }

    .aa-chat-app .aa-chat-identity-settings-form {
        max-height: calc(100vh - 24px);
        padding: 18px !important;
    }

    .aa-chat-app .aa-chat-identity-settings-form > footer {
        align-items: stretch;
        flex-direction: column;
    }

    .aa-chat-app .aa-chat-identity-settings-save {
        width: 100% !important;
    }
}

/* ========================================================================== */
/* 10.1 HOTFIX MOBILE-FIRST — CHAT / MODAIS / AVATARES                       */
/* ========================================================================== */

@media (max-width: 768px) {
    .aa-chat-app,
    #view-chat .aa-chat-app,
    .aa-communications-chat-admin .aa-chat-app,
    .aa-admin-support-page .aa-chat-app {
        height: 100% !important;
        min-height: 0 !important;
        max-height: none !important;
    }

    .aa-chat-app .aa-chat-sidebar,
    .aa-chat-app .aa-chat-conversation,
    .aa-chat-app .aa-chat-conversation-panel {
        min-height: 0 !important;
        height: 100% !important;
    }

    .aa-chat-app .aa-chat-conversation-panel {
        position: relative;
        overflow: hidden;
    }

    .aa-chat-app .aa-chat-conversation-header {
        position: sticky;
        top: 0;
        z-index: 40;
        gap: 9px;
        padding: 8px 10px;
    }

    .aa-chat-app .aa-chat-header-copy,
    .aa-chat-app .aa-chat-thread-copy,
    .aa-chat-app .aa-chat-thread-top,
    .aa-chat-app .aa-chat-thread-side,
    .aa-chat-app .aa-chat-header-actions,
    .aa-chat-app .aa-chat-identity-settings-copy,
    .aa-chat-app .aa-chat-identity-settings-actions,
    .aa-chat-app .aa-chat-student-result-copy,
    .aa-chat-app .aa-chat-selected-student-copy {
        min-width: 0;
    }

    .aa-chat-app .aa-chat-header-copy strong {
        font-size: 15px !important;
    }

    .aa-chat-app .aa-chat-header-copy small {
        margin-top: 2px;
        font-size: 9px !important;
    }

    .aa-chat-app .aa-chat-header-actions {
        flex: 0 1 auto;
        gap: 4px;
    }

    .aa-chat-app .aa-chat-assignee-control {
        flex: 0 1 108px;
        max-width: 108px;
    }

    .aa-chat-app .aa-chat-assignee-button,
    .aa-chat-app .aa-chat-identity-button,
    .aa-chat-app .aa-chat-claim,
    .aa-chat-app .aa-chat-close-thread,
    .aa-chat-app .aa-chat-delete-thread,
    .aa-chat-app .aa-chat-new-button,
    .aa-chat-app button.aa-chat-new-identity-option,
    .aa-chat-app button.aa-chat-assignee-option,
    .aa-chat-app button.aa-chat-thread {
        min-width: 0;
    }

    .aa-chat-app .aa-chat-assignee-button,
    .aa-chat-app .aa-chat-identity-button {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .aa-chat-app .aa-chat-assignee-button > span,
    .aa-chat-app .aa-chat-identity-button > span[data-chat-identity-label],
    .aa-chat-app .aa-chat-thread-top strong,
    .aa-chat-app .aa-chat-thread-copy p,
    .aa-chat-app .aa-chat-thread-side,
    .aa-chat-app .aa-chat-identity-settings-copy strong,
    .aa-chat-app .aa-chat-identity-settings-copy small,
    .aa-chat-app button.aa-chat-new-identity-option > span:last-child,
    .aa-chat-app .aa-chat-selected-student-copy strong,
    .aa-chat-app .aa-chat-selected-student-copy small {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .aa-chat-app .aa-chat-assignee-menu,
    .aa-chat-app .aa-chat-identity-menu {
        max-width: calc(100vw - 24px);
    }

    .aa-chat-app .aa-chat-messages {
        flex: 1 1 auto;
        min-height: 0;
        padding: 16px 12px;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .aa-chat-app .aa-chat-typing {
        position: sticky;
        bottom: calc(58px + env(safe-area-inset-bottom));
        z-index: 33;
        padding-left: 14px;
        padding-right: 14px;
    }

    .aa-chat-app form.aa-chat-composer {
        position: sticky;
        bottom: 0;
        z-index: 35;
        min-height: 58px !important;
        padding: 8px 9px calc(8px + env(safe-area-inset-bottom)) !important;
    }

    .aa-chat-app .aa-chat-composer-main {
        min-height: 40px;
    }

    .aa-chat-app .aa-chat-composer textarea {
        min-height: 38px !important;
        height: 38px;
    }

    .aa-chat-app .aa-chat-modal,
    .aa-chat-app .aa-chat-identity-settings-modal {
        padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
        align-items: stretch;
    }

    .aa-chat-app .aa-chat-new-form,
    .aa-chat-app .aa-chat-identity-settings-form {
        width: min(100%, 560px);
        max-height: calc(var(--aad-mobile-h, 100dvh) - 16px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .aa-chat-app .aa-chat-new-form header,
    .aa-chat-app .aa-chat-identity-settings-form > header {
        position: sticky;
        top: 0;
        z-index: 2;
        padding-bottom: 10px;
        background: linear-gradient(145deg, #171818, #0d0e0e) !important;
    }

    .aa-chat-app .aa-chat-identity-settings-form > footer {
        position: sticky;
        bottom: 0;
        z-index: 2;
        padding-bottom: calc(6px + env(safe-area-inset-bottom));
        background: linear-gradient(145deg, #171818, #0d0e0e) !important;
    }

    .aa-chat-app .aa-chat-new-identity-options {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .aa-chat-app button.aa-chat-new-identity-option {
        min-height: 44px !important;
        padding: 7px 9px !important;
        justify-content: flex-start;
    }

    .aa-chat-app .aa-chat-identity-settings-card {
        grid-template-columns: 52px minmax(0, 1fr);
        gap: 10px 11px;
    }

    .aa-chat-app .aa-chat-identity-settings-avatar {
        width: 52px;
        height: 52px;
    }

    .aa-chat-app .aa-chat-identity-settings-actions button {
        position: relative;
        z-index: 1;
        pointer-events: auto;
    }
}

@media (max-width: 480px) {
    .aa-chat-app .aa-chat-app-status {
        left: 12px;
        right: 12px;
        width: auto;
        min-width: 0;
    }

    .aa-chat-app .aa-chat-conversation-header {
        min-height: 58px;
        padding: 8px 8px;
    }

    .aa-chat-app .aa-chat-avatar {
        width: 34px;
        height: 34px;
    }

    .aa-chat-app .aa-chat-header-copy strong {
        font-size: 14px !important;
    }

    .aa-chat-app .aa-chat-header-copy small {
        max-width: 112px;
    }

    .aa-chat-app .aa-chat-assignee-control {
        flex-basis: 92px;
        max-width: 92px;
    }

    .aa-chat-app .aa-chat-assignee-button,
    .aa-chat-app .aa-chat-identity-button {
        height: 36px !important;
        min-height: 36px !important;
        font-size: 8px !important;
    }

    .aa-chat-app .aa-chat-close-thread,
    .aa-chat-app .aa-chat-delete-thread,
    .aa-chat-app .aa-chat-attach,
    .aa-chat-app .aa-chat-send {
        width: 36px !important;
        height: 36px !important;
        min-height: 36px !important;
    }

    .aa-chat-app .aa-chat-message {
        max-width: 92%;
    }

    .aa-chat-app .aa-chat-new-form,
    .aa-chat-app .aa-chat-identity-settings-form {
        padding: 16px !important;
        border-radius: 16px !important;
    }

    .aa-chat-app .aa-chat-new-form h3,
    .aa-chat-app .aa-chat-identity-settings-form h3 {
        font-size: 18px !important;
        line-height: 1.15;
    }

    .aa-chat-app .aa-chat-new-identity-options {
        grid-template-columns: 1fr;
    }

    .aa-chat-app .aa-chat-identity-settings-actions {
        gap: 7px;
    }

    .aa-chat-app .aa-chat-identity-settings-actions button {
        flex: 1 1 auto;
        justify-content: center;
    }
}

/* ========================================================================== */
/* 10.2 CORREÇÃO ESTRUTURAL MOBILE — VIEWPORT, TOPO E RODAPÉ                 */
/* ========================================================================== */

@media (max-width: 768px) {
    /* O chat ocupa exatamente o espaço entre o topo e a navegação inferior. */
    #view-chat.aad-panel-view.active {
        position: fixed !important;
        top: 54px !important;
        right: 0 !important;
        bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
        left: 0 !important;
        z-index: 80 !important;
        width: auto !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        background: #090a0a !important;
    }

    #view-chat .aa-chat-app,
    #view-chat .aa-chat-sidebar,
    #view-chat .aa-chat-conversation,
    #view-chat .aa-chat-conversation-panel {
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: hidden !important;
    }

    /* Quatro linhas reais: cabeçalho, mensagens, digitando e compositor. */
    .aa-chat-app .aa-chat-conversation-panel {
        display: grid !important;
        grid-template-rows: auto minmax(0, 1fr) auto auto !important;
        grid-template-columns: minmax(0, 1fr) !important;
        align-content: stretch !important;
    }

    .aa-chat-app .aa-chat-conversation-header {
        position: relative !important;
        top: auto !important;
        grid-row: 1 !important;
        flex: none !important;
        min-width: 0 !important;
    }

    .aa-chat-app .aa-chat-messages {
        grid-row: 2 !important;
        min-width: 0 !important;
        min-height: 0 !important;
        height: auto !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        -webkit-overflow-scrolling: touch;
    }

    .aa-chat-app .aa-chat-typing {
        position: relative !important;
        bottom: auto !important;
        grid-row: 3 !important;
        flex: none !important;
    }

    .aa-chat-app form.aa-chat-composer {
        position: relative !important;
        bottom: auto !important;
        grid-row: 4 !important;
        flex: none !important;
        margin: 0 !important;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* Os modais passam a respeitar a área útil do chat. */
    .aa-chat-app .aa-chat-modal,
    .aa-chat-app .aa-chat-identity-settings-modal {
        position: absolute !important;
        inset: 0 !important;
        z-index: 120 !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        padding: 8px !important;
        overflow: hidden !important;
        align-items: stretch !important;
    }

    .aa-chat-app .aa-chat-new-form,
    .aa-chat-app .aa-chat-identity-settings-form {
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        max-height: none !important;
        margin: 0 !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        -webkit-overflow-scrolling: touch;
    }

    .aa-chat-app .aa-chat-identity-settings-form {
        display: grid !important;
        grid-template-rows: auto minmax(0, 1fr) auto !important;
    }

    .aa-chat-app .aa-chat-identity-settings-list {
        min-height: 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .aa-chat-app .aa-chat-identity-settings-form > footer {
        position: relative !important;
        bottom: auto !important;
        margin-top: 10px !important;
        padding-bottom: 0 !important;
    }

    /* Textos nunca podem empurrar os controles para fora da tela. */
    .aa-chat-app .aa-chat-header-copy,
    .aa-chat-app .aa-chat-header-actions,
    .aa-chat-app .aa-chat-thread-copy,
    .aa-chat-app .aa-chat-thread-top,
    .aa-chat-app .aa-chat-thread-side,
    .aa-chat-app .aa-chat-identity-settings-copy,
    .aa-chat-app .aa-chat-identity-settings-actions,
    .aa-chat-app .aa-chat-new-identity-option,
    .aa-chat-app .aa-chat-new-identity-option > span:last-child {
        min-width: 0 !important;
    }

    .aa-chat-app .aa-chat-header-copy strong,
    .aa-chat-app .aa-chat-header-copy small,
    .aa-chat-app .aa-chat-thread-top strong,
    .aa-chat-app .aa-chat-thread-copy p,
    .aa-chat-app .aa-chat-identity-settings-copy strong,
    .aa-chat-app .aa-chat-identity-settings-copy small,
    .aa-chat-app .aa-chat-new-identity-option > span:last-child {
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .aa-chat-app .aa-chat-identity-settings-actions button,
    .aa-chat-app .aa-chat-identity-avatar-choose,
    .aa-chat-app .aa-chat-identity-avatar-remove {
        pointer-events: auto !important;
        touch-action: manipulation !important;
    }
}

@media (max-width: 480px) {
    #view-chat.aad-panel-view.active {
        top: 52px !important;
        bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
    }

    .aa-chat-app .aa-chat-conversation-header {
        min-height: 58px !important;
        gap: 7px !important;
        padding: 7px 7px !important;
    }

    .aa-chat-app .aa-chat-back {
        width: 30px !important;
        height: 34px !important;
        min-height: 34px !important;
    }

    .aa-chat-app .aa-chat-avatar {
        width: 34px !important;
        height: 34px !important;
        flex-basis: 34px !important;
    }

    .aa-chat-app .aa-chat-header-copy strong {
        font-size: 13px !important;
    }

    .aa-chat-app .aa-chat-header-copy small {
        max-width: 105px !important;
        font-size: 8px !important;
    }

    .aa-chat-app .aa-chat-header-actions {
        gap: 3px !important;
    }

    .aa-chat-app .aa-chat-assignee-control {
        flex: 0 1 88px !important;
        max-width: 88px !important;
    }

    .aa-chat-app .aa-chat-close-thread,
    .aa-chat-app .aa-chat-delete-thread {
        width: 32px !important;
        height: 34px !important;
        min-height: 34px !important;
    }

    .aa-chat-app .aa-chat-new-form,
    .aa-chat-app .aa-chat-identity-settings-form {
        padding: 14px !important;
        border-radius: 14px !important;
    }

    .aa-chat-app .aa-chat-new-identity-options {
        grid-template-columns: 1fr !important;
    }

    .aa-chat-app .aa-chat-identity-settings-card {
        grid-template-columns: 48px minmax(0, 1fr) !important;
        padding: 12px !important;
    }

    .aa-chat-app .aa-chat-identity-settings-avatar {
        width: 48px !important;
        height: 48px !important;
    }

    .aa-chat-app .aa-chat-identity-settings-actions {
        width: 100% !important;
    }

    .aa-chat-app .aa-chat-identity-settings-actions button {
        flex: 1 1 auto !important;
        min-width: 0 !important;
    }
}

/* ========================================================================== */
/* 10.3 AJUSTE FINO MOBILE — LIMITES REAIS DO TOPO E DA NAVEGAÇÃO            */
/* ========================================================================== */

@media (max-width: 768px) {
    /*
     * As alturas são medidas no navegador pelo communications.js.
     * Isso evita sobreposição quando a barra superior ou a navegação inferior
     * mudam de 64px para 70/72px conforme a resolução e o safe-area.
     */
    #view-chat.aad-panel-view.active {
        top: var(--aa-chat-mobile-top, 71px) !important;
        bottom: var(--aa-chat-mobile-bottom, 73px) !important;
    }

    #view-chat .aa-chat-app,
    #view-chat .aa-chat-conversation,
    #view-chat .aa-chat-conversation-panel {
        min-height: 0 !important;
        max-height: 100% !important;
    }

    .aa-chat-app .aa-chat-conversation-header {
        overflow: visible !important;
        box-sizing: border-box !important;
    }

    .aa-chat-app form.aa-chat-composer {
        box-sizing: border-box !important;
        padding-bottom: 8px !important;
    }
}

@media (max-width: 480px) {
    #view-chat.aad-panel-view.active {
        top: var(--aa-chat-mobile-top, 71px) !important;
        bottom: var(--aa-chat-mobile-bottom, 73px) !important;
    }
}


/* Avisos do chat no mobile ficam presos à viewport, fora do overflow interno. */
@media (max-width: 780px) {
    .aa-chat-app .aa-chat-app-status {
        position: fixed !important;
        top: calc(var(--aa-chat-mobile-top, 70px) + 8px) !important;
        left: 12px !important;
        right: 12px !important;
        width: auto !important;
        max-width: none !important;
        z-index: 100050 !important;
        transform: translateY(-10px) !important;
    }

    .aa-chat-app .aa-chat-app-status.is-visible {
        transform: translateY(0) !important;
    }
}

/* ========================================================================== */
/* 12. DESTINATÁRIO DA NOVA CONVERSA DO ALUNO                               */
/* ========================================================================== */

.aa-chat-app .aa-chat-recipient-field {
    display: block;
    margin: 0 0 13px;
}

.aa-chat-app .aa-chat-recipient-caption {
    display: block;
    margin-bottom: 6px;
    color: var(--aa-chat-muted) !important;
    font-size: 9px !important;
    font-weight: 700;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.aa-chat-app .aa-chat-recipient-control {
    position: relative;
    display: block;
    min-width: 0;
}

.aa-chat-app .aa-chat-recipient-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    border: 0 !important;
    white-space: nowrap !important;
}

.aa-chat-app .aa-chat-recipient-button {
    width: 100% !important;
    min-height: 58px !important;
    display: flex !important;
    align-items: center !important;
    gap: 11px;
    margin: 0 !important;
    padding: 8px 12px !important;
    color: var(--aa-chat-text) !important;
    background: #101111 !important;
    border: 1px solid var(--aa-chat-gold-border) !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    text-align: left !important;
    cursor: pointer;
}

.aa-chat-app .aa-chat-recipient-button:hover,
.aa-chat-app .aa-chat-recipient-button:focus-visible,
.aa-chat-app .aa-chat-recipient-control.is-open .aa-chat-recipient-button {
    background: #171817 !important;
    border-color: rgba(245, 203, 92, .62) !important;
    box-shadow: 0 0 0 2px rgba(205, 156, 32, .08) !important;
}

.aa-chat-app .aa-chat-recipient-avatar,
.aa-chat-app .aa-chat-recipient-option-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: #1b1c1c;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    border: 1px solid rgba(205, 156, 32, .46);
    border-radius: 50%;
}

.aa-chat-app .aa-chat-recipient-avatar {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
}

.aa-chat-app .aa-chat-recipient-option-avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
}

.aa-chat-app .aa-chat-recipient-avatar svg,
.aa-chat-app .aa-chat-recipient-option-avatar svg {
    width: 17px;
    height: 17px;
    color: var(--aa-chat-gold-strong) !important;
}

.aa-chat-app .aa-chat-recipient-copy,
.aa-chat-app .aa-chat-recipient-option-copy {
    min-width: 0;
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 3px;
}

.aa-chat-app .aa-chat-recipient-copy strong,
.aa-chat-app .aa-chat-recipient-option-copy strong {
    overflow: hidden;
    color: var(--aa-chat-text) !important;
    font-size: 11px !important;
    font-weight: 750 !important;
    line-height: 1.2 !important;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* A atribuição é deliberadamente menor que o nome de exibição. */
.aa-chat-app .aa-chat-recipient-copy small,
.aa-chat-app .aa-chat-recipient-option-copy small {
    overflow: hidden;
    color: var(--aa-chat-muted) !important;
    font-size: 8px !important;
    font-weight: 600 !important;
    line-height: 1.15 !important;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aa-chat-app .aa-chat-recipient-button > svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    margin-left: 4px;
    color: var(--aa-chat-gold-strong) !important;
    transition: transform .16s ease;
}

.aa-chat-app .aa-chat-recipient-control.is-open .aa-chat-recipient-button > svg {
    transform: rotate(180deg);
}

.aa-chat-app .aa-chat-recipient-menu {
    position: absolute;
    z-index: 120;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    max-height: min(290px, 42vh);
    padding: 5px;
    overflow-x: hidden;
    overflow-y: auto;
    background: #101111;
    border: 1px solid rgba(205, 156, 32, .48);
    border-radius: 11px;
    box-shadow: 0 20px 48px rgba(0, 0, 0, .62);
    scrollbar-width: thin;
    scrollbar-color: rgba(205, 156, 32, .38) transparent;
}

.aa-chat-app .aa-chat-recipient-menu[hidden] {
    display: none !important;
}

.aa-chat-app button.aa-chat-recipient-option {
    width: 100% !important;
    min-height: 54px !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px;
    margin: 0 !important;
    padding: 7px 9px !important;
    color: var(--aa-chat-text) !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 9px !important;
    box-shadow: none !important;
    outline: 0 !important;
    text-align: left !important;
    cursor: pointer;
}

.aa-chat-app button.aa-chat-recipient-option:hover,
.aa-chat-app button.aa-chat-recipient-option:focus-visible {
    background: rgba(205, 156, 32, .1) !important;
}

.aa-chat-app button.aa-chat-recipient-option.is-selected {
    background: rgba(205, 156, 32, .16) !important;
    box-shadow: inset 3px 0 0 var(--aa-chat-gold-strong) !important;
}

@media (max-width: 480px) {
    .aa-chat-app .aa-chat-recipient-button {
        min-height: 56px !important;
        padding: 7px 10px !important;
    }

    .aa-chat-app .aa-chat-recipient-avatar {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }

    .aa-chat-app .aa-chat-recipient-copy strong,
    .aa-chat-app .aa-chat-recipient-option-copy strong {
        font-size: 10px !important;
    }

    .aa-chat-app .aa-chat-recipient-copy small,
    .aa-chat-app .aa-chat-recipient-option-copy small {
        font-size: 7.5px !important;
    }

    .aa-chat-app .aa-chat-recipient-menu {
        max-height: min(270px, 38vh);
    }
}

/* ========================================================================== */
/* 13. TECLADO VIRTUAL MOBILE — ÁREA ÚTIL REAL E CAMPOS SEM ZOOM              */
/* ========================================================================== */
@media (max-width: 780px) {
    .aa-chat-app input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="hidden"]),
    .aa-chat-app select,
    .aa-chat-app textarea {
        font-size: 16px !important;
        -webkit-text-size-adjust: 100%;
        scroll-margin-top: 14px;
        scroll-margin-bottom: 24px;
    }

    body.aad-virtual-keyboard-open #view-chat.aad-panel-view.active {
        bottom: 0 !important;
    }

    body.aad-virtual-keyboard-open #view-chat .aa-chat-app,
    body.aad-virtual-keyboard-open #view-chat .aa-chat-conversation,
    body.aad-virtual-keyboard-open #view-chat .aa-chat-conversation-panel {
        min-height: 0 !important;
        max-height: 100% !important;
    }

    body.aad-virtual-keyboard-open #view-chat .aa-chat-composer {
        padding-bottom: 8px !important;
    }
}

/* ========================================================================== */
/* 14. CHAT MOBILE — MENU FIXO E COMPOSITOR NO FLUXO                         */
/* ========================================================================== */

/* A identidade é definida na criação da conversa e não pode ser trocada
   depois que o histórico já existe. */
.aa-chat-app.is-conversation-open .aa-chat-identity-control {
    display: none !important;
}

@media (max-width: 860px) {
    body.aad-chat-view-active {
        --aa-chat-mobile-header: 54px;
        --aa-chat-mobile-nav: calc(64px + env(safe-area-inset-bottom, 0px));
    }

    /* A navegação pertence ao viewport e permanece fixa quando o teclado está
       fechado. Durante a digitação ela sai completamente do layout. */
    body > .aad-mobile-bottom-nav {
        position: fixed !important;
        inset: auto 0 0 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        width: 100% !important;
        margin: 0 !important;
        transform: none !important;
        -webkit-transform: none !important;
        z-index: 2147483000 !important;
    }

    body.aad-chat-view-active.aad-chat-keyboard-open > .aad-mobile-bottom-nav {
        display: none !important;
    }

    body.aad-chat-view-active #aad-root.aad {
        box-sizing: border-box !important;
        display: block !important;
        width: 100% !important;
        height: var(--aad-mobile-h, 100dvh) !important;
        min-height: var(--aad-mobile-h, 100dvh) !important;
        max-height: var(--aad-mobile-h, 100dvh) !important;
        padding-top: var(--aa-chat-mobile-header) !important;
        padding-bottom: 0 !important;
        overflow: hidden !important;
        background: #050505 !important;
    }

    body.aad-chat-view-active #aad-main-area.aad-main {
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        height: calc(var(--aad-mobile-h, 100dvh) - var(--aa-chat-mobile-header)) !important;
        min-height: 0 !important;
        max-height: calc(var(--aad-mobile-h, 100dvh) - var(--aa-chat-mobile-header)) !important;
        margin: 0 !important;
        padding: 0 0 var(--aa-chat-mobile-nav) !important;
        overflow: hidden !important;
        overscroll-behavior: none !important;
        background: #090a0a !important;
    }

    body.aad-chat-view-active.aad-chat-keyboard-open #aad-main-area.aad-main {
        padding-bottom: 0 !important;
    }

    body.aad-chat-view-active #view-chat.aad-panel-view.active {
        box-sizing: border-box !important;
        position: static !important;
        inset: auto !important;
        display: flex !important;
        flex: 1 1 auto !important;
        flex-direction: column !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        background: #090a0a !important;
        transform: none !important;
        -webkit-transform: none !important;
    }

    body.aad-chat-view-active #view-chat .aa-chat-app {
        position: relative !important;
        display: grid !important;
        flex: 1 1 auto !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        max-height: 100% !important;
        overflow: hidden !important;
        background: #090a0a !important;
        transform: none !important;
        -webkit-transform: none !important;
    }

    body.aad-chat-view-active #view-chat .aa-chat-sidebar,
    body.aad-chat-view-active #view-chat .aa-chat-conversation {
        min-width: 0 !important;
        min-height: 0 !important;
        height: 100% !important;
        max-height: 100% !important;
        overflow: hidden !important;
    }

    body.aad-chat-view-active #view-chat .aa-chat-sidebar {
        display: flex;
        flex-direction: column;
    }

    body.aad-chat-view-active #view-chat .aa-chat-thread-list {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        -webkit-overflow-scrolling: touch !important;
    }

    body.aad-chat-view-active #view-chat .aa-chat-app:not(.is-conversation-open) .aa-chat-sidebar {
        display: flex !important;
    }

    body.aad-chat-view-active #view-chat .aa-chat-app:not(.is-conversation-open) .aa-chat-conversation {
        display: none !important;
    }

    body.aad-chat-view-active #view-chat .aa-chat-app.is-conversation-open .aa-chat-sidebar {
        display: none !important;
    }

    body.aad-chat-view-active #view-chat .aa-chat-app.is-conversation-open .aa-chat-conversation {
        display: flex !important;
        flex: 1 1 auto !important;
        flex-direction: column !important;
    }

    body.aad-chat-view-active #view-chat .aa-chat-conversation-panel:not([hidden]) {
        position: static !important;
        display: flex !important;
        flex: 1 1 auto !important;
        flex-direction: column !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        max-height: 100% !important;
        overflow: hidden !important;
    }

    body.aad-chat-view-active #view-chat .aa-chat-conversation-header,
    body.aad-chat-view-active #view-chat .aa-chat-typing,
    body.aad-chat-view-active #view-chat form.aa-chat-composer {
        position: relative !important;
        inset: auto !important;
        flex: 0 0 auto !important;
        transform: none !important;
        -webkit-transform: none !important;
    }

    body.aad-chat-view-active #view-chat .aa-chat-conversation-header {
        width: 100% !important;
        min-height: 58px !important;
        margin: 0 !important;
        overflow: visible !important;
    }

    body.aad-chat-view-active #view-chat .aa-chat-messages {
        position: relative !important;
        display: block !important;
        flex: 1 1 auto !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        margin: 0 !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        -webkit-overflow-scrolling: touch !important;
        scroll-behavior: auto !important;
    }

    body.aad-chat-view-active #view-chat form.aa-chat-composer {
        box-sizing: border-box !important;
        width: 100% !important;
        min-height: 58px !important;
        margin: 0 !important;
        padding: 8px 9px calc(8px + env(safe-area-inset-bottom, 0px)) !important;
        overflow: visible !important;
        background: #101111 !important;
    }

    body.aad-chat-view-active.aad-chat-keyboard-open #view-chat form.aa-chat-composer {
        padding-bottom: 8px !important;
    }

    body.aad-chat-view-active #view-chat [data-chat-input] {
        box-sizing: border-box !important;
        position: relative !important;
        min-height: 40px !important;
        height: 40px;
        margin: 0 !important;
        font-size: 16px !important;
        line-height: 1.35 !important;
        scroll-margin: 0 !important;
        transform: none !important;
        -webkit-transform: none !important;
        -webkit-text-size-adjust: 100% !important;
        text-size-adjust: 100% !important;
    }

    body.aad-chat-view-active #view-chat .aa-chat-modal[hidden],
    body.aad-chat-view-active #view-chat .aa-chat-identity-settings-modal[hidden],
    body.aad-chat-view-active #view-chat .aa-chat-conversation-panel[hidden],
    body.aad-chat-view-active #view-chat .aa-chat-assignee-menu[hidden],
    body.aad-chat-view-active #view-chat .aa-chat-recipient-menu[hidden],
    body.aad-chat-view-active #view-chat .aa-chat-identity-menu[hidden] {
        display: none !important;
    }
}

/* O cabeçalho real do telefone mede 70px. A regra antiga descontava apenas
   52/54px e deixava o topo da conversa escondido sob a barra da plataforma. */
@media (max-width: 767px) {
    body.aad-chat-view-active {
        --aa-chat-mobile-header: 70px;
    }
}

@media (max-width: 520px) {
    body.aad-chat-view-active {
        --aa-chat-mobile-nav: calc(72px + env(safe-area-inset-bottom, 0px));
    }
}

/* Enquanto o chat está ativo no iOS/WebKit, a página externa deixa de ser o
   scroller. Isso impede que o foco do textarea leve todo o dashboard para cima;
   somente .aa-chat-messages continua rolável. Não há position:fixed no body. */
@media (max-width: 860px) {
    html.aad-chat-ios-active,
    html.aad-chat-ios-active body.aad-dashboard-body {
        box-sizing: border-box !important;
        width: 100% !important;
        height: var(--aad-mobile-h, 100dvh) !important;
        min-height: var(--aad-mobile-h, 100dvh) !important;
        max-height: var(--aad-mobile-h, 100dvh) !important;
        overflow: hidden !important;
        overscroll-behavior: none !important;
        background: #050505 !important;
    }

    html.aad-chat-ios-active body.aad-dashboard-body {
        padding-bottom: 0 !important;
    }

    html.aad-chat-ios-active body.aad-dashboard-body #page,
    html.aad-chat-ios-active body.aad-dashboard-body .site,
    html.aad-chat-ios-active body.aad-dashboard-body .site-content,
    html.aad-chat-ios-active body.aad-dashboard-body .content-area,
    html.aad-chat-ios-active body.aad-dashboard-body .entry-content,
    html.aad-chat-ios-active body.aad-dashboard-body .wp-site-blocks,
    html.aad-chat-ios-active body.aad-dashboard-body .elementor,
    html.aad-chat-ios-active body.aad-dashboard-body .elementor-widget,
    html.aad-chat-ios-active body.aad-dashboard-body .elementor-widget-shortcode,
    html.aad-chat-ios-active body.aad-dashboard-body .elementor-shortcode,
    html.aad-chat-ios-active body.aad-dashboard-body .elementor-widget-container {
        height: 100% !important;
        min-height: 0 !important;
        max-height: 100% !important;
        overflow: hidden !important;
        transform: none !important;
        -webkit-transform: none !important;
    }
}


/* Correção localizada: separador de data compacto no chat mobile. */
@media (max-width: 860px) {
    body.aad-chat-view-active #view-chat .aa-chat-day-separator {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        align-self: center !important;
        width: max-content !important;
        max-width: calc(100% - 24px) !important;
        margin: 0 auto !important;
        flex: 0 0 auto !important;
    }
}


/* ========================================================================== */
/*  PERFIL OBRIGATÓRIO NA PRIMEIRA RESPOSTA                                  */
/* ========================================================================== */

.aa-chat-app .aa-chat-reply-identity-modal {
    position: fixed;
    inset: 0;
    z-index: 100010;
    display: grid;
    place-items: center;
    padding: 18px;
}

.aa-chat-app .aa-chat-reply-identity-modal[hidden] {
    display: none !important;
}

.aa-chat-app .aa-chat-reply-identity-dialog {
    position: relative;
    z-index: 1;
    width: min(560px, 100%);
    max-height: calc(100dvh - 36px);
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin: 0;
    padding: 22px;
    overflow: hidden;
    color: var(--aa-chat-text);
    background: linear-gradient(145deg, #171818, #0d0e0e);
    border: 1px solid var(--aa-chat-gold-border);
    border-radius: 18px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .62);
}

.aa-chat-app .aa-chat-reply-identity-dialog > header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.aa-chat-app .aa-chat-reply-identity-dialog > header > div {
    min-width: 0;
}

.aa-chat-app .aa-chat-reply-identity-dialog > header span {
    display: block;
    margin-bottom: 4px;
    color: var(--aa-chat-gold-strong);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.aa-chat-app .aa-chat-reply-identity-dialog h3 {
    margin: 0;
    color: var(--aa-chat-text);
    font-size: 22px;
    line-height: 1.2;
}

.aa-chat-app .aa-chat-reply-identity-dialog p {
    margin: 8px 0 0;
    color: var(--aa-chat-muted);
    font-size: 13px;
    line-height: 1.55;
}

.aa-chat-app .aa-chat-reply-identity-close {
    width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    flex: 0 0 38px;
    margin: 0 !important;
    padding: 0 !important;
    color: var(--aa-chat-muted) !important;
    background: #111212 !important;
    border: 1px solid var(--aa-chat-border) !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    font-size: 24px !important;
    line-height: 1 !important;
    cursor: pointer;
}

.aa-chat-app .aa-chat-reply-identity-options {
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.aa-chat-app button.aa-chat-reply-identity-option {
    min-height: 76px !important;
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    margin: 0 !important;
    padding: 12px !important;
    text-align: left;
    color: var(--aa-chat-text) !important;
    background: #101111 !important;
    border: 1px solid var(--aa-chat-border) !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    cursor: pointer;
}

.aa-chat-app button.aa-chat-reply-identity-option:hover,
.aa-chat-app button.aa-chat-reply-identity-option:focus-visible {
    color: #ffe08a !important;
    background: rgba(205, 156, 32, .09) !important;
    border-color: rgba(245, 203, 92, .58) !important;
}

.aa-chat-app .aa-chat-reply-identity-avatar {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    border: 1px solid rgba(205, 156, 32, .46);
    border-radius: 50%;
}

.aa-chat-app .aa-chat-reply-identity-avatar svg {
    width: 56%;
    height: 56%;
}

.aa-chat-app .aa-chat-reply-identity-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.aa-chat-app .aa-chat-reply-identity-copy strong,
.aa-chat-app .aa-chat-reply-identity-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aa-chat-app .aa-chat-reply-identity-copy strong {
    font-size: 13px;
}

.aa-chat-app .aa-chat-reply-identity-copy small {
    color: var(--aa-chat-muted);
    font-size: 10px;
}

.aa-chat-app .aa-chat-reply-identity-dialog > footer {
    display: flex;
    justify-content: flex-end;
}

.aa-chat-app .aa-chat-reply-identity-cancel {
    min-height: 40px !important;
    margin: 0 !important;
    padding: 0 16px !important;
    color: var(--aa-chat-muted) !important;
    background: transparent !important;
    border: 1px solid var(--aa-chat-border) !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    cursor: pointer;
}

@media (max-width: 860px) {
    .aa-chat-app .aa-chat-reply-identity-modal {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        min-height: 0;
        padding: 10px;
        align-items: center;
        overflow: hidden;
    }

    .aa-chat-app .aa-chat-reply-identity-dialog {
        width: 100%;
        max-height: calc(var(--aad-mobile-h, 100dvh) - 20px);
        padding: 18px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .aa-chat-app .aa-chat-reply-identity-options {
        grid-template-columns: 1fr;
    }

    .aa-chat-app button.aa-chat-reply-identity-option {
        min-height: 68px !important;
    }
}


/* Correção mobile: data centralizada e respiro antes do remetente. */
@media (max-width: 860px) {
    body.aad-chat-view-active #view-chat .aa-chat-day-separator {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: max-content !important;
        max-width: calc(100% - 24px) !important;
        margin: 0 auto 12px !important;
        text-align: center !important;
    }
}

/* ========================================================================== */
/* 16. REFINO VISUAL — CHAT SUPORTE ESTILO WHATSAPP WEB                      */
/* ========================================================================== */

.aa-chat-app {
    --aa-chat-gold: #C9A96E;
    --aa-chat-gold-strong: #DFC08A;
    --aa-chat-gold-soft: rgba(223, 192, 138, .11);
    --aa-chat-gold-border: rgba(223, 192, 138, .22);
    --aa-chat-bg: #0a0b0d;
    --aa-chat-panel: #121214;
    --aa-chat-panel-2: #15171b;
    --aa-chat-panel-3: #101215;
    --aa-chat-border: rgba(255, 255, 255, .07);
    --aa-chat-border-strong: rgba(255, 255, 255, .12);
    --aa-chat-text: #f3eee5;
    --aa-chat-muted: rgba(243, 238, 229, .68);
    --aa-chat-soft: rgba(243, 238, 229, .45);

    grid-template-columns: clamp(350px, 29vw, 392px) minmax(0, 1fr);
    gap: 14px;
    min-height: 680px;
    height: min(820px, calc(100vh - 148px));
    overflow: visible;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.aa-communications-chat-admin .aa-chat-app {
    min-height: 680px;
    height: calc(100vh - 198px);
    max-height: 860px;
}

.aa-chat-app .aa-chat-sidebar,
.aa-chat-app .aa-chat-conversation {
    min-height: 0;
    background: linear-gradient(180deg, rgba(18, 18, 20, .98) 0%, rgba(11, 12, 14, .99) 100%) !important;
    border: 1px solid rgba(255, 255, 255, .07) !important;
    border-radius: 22px !important;
    box-shadow: 0 18px 38px rgba(0, 0, 0, .24) !important;
}

.aa-chat-app .aa-chat-sidebar {
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, .07) !important;
}

.aa-chat-app .aa-chat-conversation {
    overflow: hidden;
}

.aa-chat-app .aa-chat-sidebar-header {
    align-items: flex-start;
    gap: 16px;
    padding: 26px 24px 16px;
}

.aa-chat-app .aa-chat-sidebar-header h2 {
    color: #f6f0e8 !important;
    font-family: "Cormorant Garamond", Georgia, serif !important;
    font-size: 25px !important;
    font-weight: 650 !important;
    line-height: 1.08 !important;
    letter-spacing: -.02em !important;
}

.aa-chat-app .aa-chat-sidebar-header p {
    max-width: 260px;
    margin-top: 10px !important;
    color: var(--aa-chat-muted) !important;
    font-size: 13px !important;
    line-height: 1.55 !important;
}

.aa-chat-app .aa-chat-new-button {
    min-height: 42px !important;
    gap: 8px;
    padding: 0 16px !important;
    color: #14110b !important;
    background: linear-gradient(180deg, #DFC08A 0%, #D5B06A 100%) !important;
    border: 0 !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 24px rgba(201, 169, 110, .16) !important;
    font-size: 12px !important;
    font-weight: 700 !important;
}

.aa-chat-app .aa-chat-new-button:hover {
    color: #14110b !important;
    background: linear-gradient(180deg, #e8cfa0 0%, #ddb972 100%) !important;
    border: 0 !important;
    transform: translateY(-1px);
}

.aa-chat-app .aa-chat-toolbar {
    gap: 10px;
    align-items: center;
    padding: 0 24px 14px;
}

.aa-chat-app .aa-chat-search {
    height: 46px;
    gap: 10px;
    padding: 0 14px;
    background: rgba(255, 255, 255, .025) !important;
    border: 1px solid rgba(255, 255, 255, .08) !important;
    border-radius: 13px !important;
}

.aa-chat-app .aa-chat-search:hover,
.aa-chat-app .aa-chat-search:focus-within {
    background: rgba(255, 255, 255, .035) !important;
    border-color: rgba(223, 192, 138, .20) !important;
}

.aa-chat-app .aa-chat-search svg {
    width: 18px;
    height: 18px;
    color: rgba(243, 238, 229, .55) !important;
}

.aa-chat-app .aa-chat-search input {
    height: 44px !important;
    color: #f3eee5 !important;
    font-size: 13px !important;
}

.aa-chat-app .aa-chat-search input::placeholder {
    color: rgba(243, 238, 229, .42) !important;
}

.aa-chat-app .aa-chat-notification-button {
    width: 30px !important;
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 !important;
    color: #DFC08A !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
}

.aa-chat-app .aa-chat-notification-button:hover,
.aa-chat-app .aa-chat-notification-button.is-enabled {
    color: #f0d6a4 !important;
    background: transparent !important;
    border: 0 !important;
}

.aa-chat-app .aa-chat-filters {
    gap: 8px;
    padding: 0 24px 14px;
}

.aa-chat-app .aa-chat-filters button {
    min-height: 34px !important;
    padding: 0 14px !important;
    color: rgba(243, 238, 229, .72) !important;
    background: rgba(255, 255, 255, .02) !important;
    border: 1px solid rgba(255, 255, 255, .06) !important;
    border-radius: 11px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
}

.aa-chat-app .aa-chat-filters button:hover {
    color: #fff7ea !important;
    background: rgba(255, 255, 255, .04) !important;
    border-color: rgba(255, 255, 255, .10) !important;
}

.aa-chat-app .aa-chat-filters button.is-active,
.aa-chat-app .aa-chat-filters button.is-active:hover {
    color: #14110b !important;
    background: linear-gradient(180deg, #DFC08A 0%, #D5B06A 100%) !important;
    border-color: transparent !important;
}

.aa-chat-app .aa-chat-filters button span:not(:empty) {
    min-width: 20px;
    height: 20px;
    margin-left: 5px;
    color: #14110b;
    background: rgba(20, 17, 11, .12);
    border-radius: 999px;
    font-size: 10px;
}

.aa-chat-app .aa-chat-filters button.is-active span:not(:empty) {
    color: #14110b;
    background: rgba(20, 17, 11, .14);
}

.aa-chat-app .aa-chat-thread-list {
    padding: 4px 14px 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(223, 192, 138, .18) transparent;
}

.aa-chat-app .aa-chat-thread-list::-webkit-scrollbar,
.aa-chat-app .aa-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.aa-chat-app .aa-chat-thread-list::-webkit-scrollbar-thumb,
.aa-chat-app .aa-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(223, 192, 138, .18);
    border-radius: 999px;
}

.aa-chat-app button.aa-chat-thread {
    grid-template-columns: 54px minmax(0, 1fr) auto;
    gap: 14px;
    min-height: 84px !important;
    margin-bottom: 8px !important;
    padding: 14px 14px !important;
    background: rgba(255, 255, 255, .02) !important;
    border: 1px solid transparent !important;
    border-bottom: 1px solid transparent !important;
    border-radius: 16px !important;
}

.aa-chat-app button.aa-chat-thread:hover,
.aa-chat-app button.aa-chat-thread:focus,
.aa-chat-app button.aa-chat-thread:active,
.aa-chat-app button.aa-chat-thread:focus-visible {
    background: rgba(255, 255, 255, .035) !important;
    border: 1px solid rgba(255, 255, 255, .08) !important;
    border-bottom: 1px solid rgba(255, 255, 255, .08) !important;
    box-shadow: none !important;
}

.aa-chat-app button.aa-chat-thread.is-active,
.aa-chat-app button.aa-chat-thread.is-active:hover,
.aa-chat-app button.aa-chat-thread.is-active:focus,
.aa-chat-app button.aa-chat-thread.is-active:focus-visible {
    background: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .02)) !important;
    border: 1px solid rgba(223, 192, 138, .34) !important;
    border-bottom: 1px solid rgba(223, 192, 138, .34) !important;
    box-shadow: inset 2px 0 0 #DFC08A !important;
}

.aa-chat-app .aa-chat-thread-avatar,
.aa-chat-app .aa-chat-avatar {
    background-color: #1a1e22 !important;
    border: 0 !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05) !important;
}

.aa-chat-app .aa-chat-thread-avatar {
    width: 54px;
    height: 54px;
}

.aa-chat-app .aa-chat-thread-avatar::after {
    right: 2px;
    bottom: 2px;
    width: 10px;
    height: 10px;
    background: #DFC08A;
    border: 2px solid #15171b;
}

.aa-chat-app .aa-chat-thread-top strong {
    color: #f6f0e8 !important;
    font-family: "Cormorant Garamond", Georgia, serif !important;
    font-size: 17px !important;
    font-weight: 650 !important;
}

.aa-chat-app .aa-chat-thread-copy p {
    margin-top: 4px !important;
    color: rgba(243, 238, 229, .66) !important;
    font-size: 12px !important;
    line-height: 1.4;
    text-overflow: initial;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.aa-chat-app .aa-chat-thread-subject {
    margin-top: 4px;
    color: rgba(223, 192, 138, .82) !important;
    font-size: 10px !important;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.aa-chat-app .aa-chat-thread-side {
    gap: 10px;
    color: rgba(243, 238, 229, .58) !important;
    font-size: 11px !important;
}

.aa-chat-app .aa-chat-thread-badge {
    min-width: 22px;
    height: 22px;
    color: #14110b;
    background: #DFC08A;
    border-radius: 999px;
}

.aa-chat-app .aa-chat-thread-status {
    width: 9px;
    height: 9px;
    background: rgba(223, 192, 138, .62);
}

.aa-chat-app .aa-chat-thread-status.is-pending {
    background: #DFC08A;
    box-shadow: 0 0 0 3px rgba(223, 192, 138, .10);
}

.aa-chat-app .aa-chat-conversation-panel,
.aa-chat-app .aa-chat-empty-state {
    background: linear-gradient(180deg, rgba(18, 18, 20, .98) 0%, rgba(11, 12, 14, .99) 100%) !important;
}

.aa-chat-app .aa-chat-empty-state {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg stroke='rgba(223,192,138,0.075)' stroke-width='1.2' fill='none'%3E%3Cpath d='M35 38c0-7 6-13 13-13h19c7 0 13 6 13 13v13c0 7-6 13-13 13H57l-13 10v-10h-9c-7 0-13-6-13-13V38c0-7 6-13 13-13Z'/%3E%3Ccircle cx='132' cy='44' r='10'/%3E%3Cpath d='M118 110l9-14 16 4 4 16-14 9-15-5Z'/%3E%3Cpath d='M36 132h24m-12-12v24'/%3E%3Cpath d='M128 146c0-8 6-14 14-14s14 6 14 14-6 14-14 14-14-6-14-14Z'/%3E%3C/g%3E%3C/svg%3E") !important;
    background-size: 180px 180px !important;
    background-position: center !important;
}

.aa-chat-app .aa-chat-empty-icon {
    width: 92px;
    height: 92px;
    margin-bottom: 18px;
    color: #DFC08A !important;
    background: rgba(223, 192, 138, .05) !important;
    border: 1px solid rgba(223, 192, 138, .12) !important;
    border-radius: 50%;
}

.aa-chat-app .aa-chat-empty-icon svg {
    width: 34px;
    height: 34px;
}

.aa-chat-app .aa-chat-empty-state h3 {
    color: #f6f0e8 !important;
    font-family: "Cormorant Garamond", Georgia, serif !important;
    font-size: 28px !important;
    font-weight: 650 !important;
}

.aa-chat-app .aa-chat-empty-state p {
    max-width: 420px;
    color: rgba(243, 238, 229, .66) !important;
    font-size: 15px !important;
    line-height: 1.65;
}

.aa-chat-app .aa-chat-conversation-header {
    min-height: 82px;
    gap: 14px;
    padding: 18px 20px;
    background: linear-gradient(180deg, rgba(21, 22, 25, .98), rgba(18, 18, 20, .98)) !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, .07) !important;
    box-shadow: none !important;
    backdrop-filter: none;
}

.aa-chat-app .aa-chat-avatar {
    width: 52px;
    height: 52px;
}

.aa-chat-app .aa-chat-header-copy strong {
    color: #f6f0e8 !important;
    font-family: "Cormorant Garamond", Georgia, serif !important;
    font-size: 19px !important;
    font-weight: 650 !important;
}

.aa-chat-app .aa-chat-header-copy small {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    margin-top: 7px;
    padding: 0 11px;
    color: #DFC08A !important;
    background: rgba(223, 192, 138, .08) !important;
    border: 1px solid rgba(223, 192, 138, .16) !important;
    border-radius: 999px;
    font-size: 10px !important;
    font-weight: 700 !important;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.aa-chat-app .aa-chat-header-actions {
    gap: 8px;
}

.aa-chat-app .aa-chat-assignee-button {
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 13px !important;
    color: #efe8dc !important;
    background: rgba(255, 255, 255, .02) !important;
    border: 1px solid rgba(255, 255, 255, .08) !important;
    border-radius: 12px !important;
    font-size: 12px !important;
}

.aa-chat-app .aa-chat-assignee-button svg {
    color: #DFC08A !important;
}

.aa-chat-app .aa-chat-assignee-button:hover,
.aa-chat-app .aa-chat-assignee-button:focus-visible,
.aa-chat-app .aa-chat-assignee-control.is-open .aa-chat-assignee-button {
    background: rgba(255, 255, 255, .04) !important;
    border-color: rgba(223, 192, 138, .20) !important;
    box-shadow: none !important;
}

.aa-chat-app .aa-chat-close-thread,
.aa-chat-app .aa-chat-delete-thread,
.aa-chat-app .aa-chat-back {
    width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    color: rgba(243, 238, 229, .72) !important;
    background: rgba(255, 255, 255, .02) !important;
    border: 1px solid rgba(255, 255, 255, .08) !important;
    border-radius: 12px !important;
}

.aa-chat-app .aa-chat-close-thread:hover,
.aa-chat-app .aa-chat-back:hover {
    color: #DFC08A !important;
    background: rgba(223, 192, 138, .08) !important;
    border-color: rgba(223, 192, 138, .16) !important;
}

.aa-chat-app .aa-chat-delete-thread:hover {
    color: #f1c4c4 !important;
    background: rgba(228, 123, 123, .08) !important;
    border-color: rgba(228, 123, 123, .22) !important;
}

.aa-chat-app .aa-chat-messages {
    gap: 14px;
    padding: 26px clamp(20px, 3vw, 36px);
    background-color: #0d1117 !important;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'%3E%3Cg stroke='rgba(255,255,255,0.032)' stroke-width='1.2' fill='none'%3E%3Cpath d='M26 30c0-6 5-11 11-11h17c6 0 11 5 11 11v12c0 6-5 11-11 11H45l-11 8v-8h-8c-6 0-11-5-11-11V30c0-6 5-11 11-11Z'/%3E%3Ccircle cx='134' cy='36' r='8'/%3E%3Cpath d='M178 28v18M169 37h18'/%3E%3Cpath d='M110 92c0-7 5-12 12-12h17c7 0 12 5 12 12v12c0 7-5 12-12 12h-12l-12 9v-9h-5c-7 0-12-5-12-12V92Z'/%3E%3Cpath d='M30 132h20m-10-10v20'/%3E%3Cpath d='M80 150l8-13 14 3 3 14-12 8-13-4Z'/%3E%3Cpath d='M152 154c0-8 6-14 14-14s14 6 14 14-6 14-14 14-14-6-14-14Z'/%3E%3Cpath d='M32 188c0-6 4-10 10-10h10c6 0 10 4 10 10s-4 10-10 10H42c-6 0-10-4-10-10Z'/%3E%3C/g%3E%3C/svg%3E") !important;
    background-size: 220px 220px !important;
    background-position: center !important;
}

.aa-chat-app .aa-chat-day-separator {
    padding: 8px 14px;
    color: rgba(243, 238, 229, .62) !important;
    background: rgba(17, 20, 24, .96) !important;
    border: 1px solid rgba(255, 255, 255, .08) !important;
    border-radius: 999px;
    font-size: 11px !important;
    letter-spacing: .02em;
    text-transform: none;
}

.aa-chat-app .aa-chat-message {
    max-width: min(68%, 620px);
    gap: 10px;
}

.aa-chat-app .aa-chat-message-avatar {
    width: 34px;
    height: 34px;
    border: 0 !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05) !important;
}

.aa-chat-app .aa-chat-message-avatar svg {
    width: 18px;
    height: 18px;
}

.aa-chat-app .aa-chat-message-sender {
    margin: 0 8px 6px;
    color: rgba(243, 238, 229, .62) !important;
    font-size: 12px !important;
    font-weight: 600;
}

.aa-chat-app .aa-chat-bubble {
    padding: 13px 16px;
    color: #f3eee5 !important;
    background: linear-gradient(180deg, rgba(32, 35, 40, .96), rgba(25, 28, 33, .98)) !important;
    border: 1px solid rgba(255, 255, 255, .06) !important;
    border-radius: 18px 18px 18px 6px !important;
    box-shadow: 0 10px 22px rgba(0, 0, 0, .18) !important;
    font-size: 14px !important;
    line-height: 1.6;
}

.aa-chat-app .aa-chat-message.is-mine .aa-chat-bubble {
    color: #17130a !important;
    background: linear-gradient(180deg, #DFC08A 0%, #D7B574 100%) !important;
    border: 0 !important;
    border-radius: 18px 18px 6px 18px !important;
}

.aa-chat-app .aa-chat-message-meta {
    gap: 6px;
    margin: 6px 8px 0;
    color: rgba(243, 238, 229, .48) !important;
    font-size: 11px !important;
}

.aa-chat-app .aa-chat-message.is-mine .aa-chat-message-meta {
    color: rgba(223, 192, 138, .8) !important;
}

.aa-chat-app form.aa-chat-composer {
    position: relative;
    min-height: 84px !important;
    gap: 10px;
    padding: 14px 18px 18px !important;
    background: linear-gradient(180deg, rgba(18, 18, 20, .98), rgba(16, 17, 19, .99)) !important;
    border: 0 !important;
    border-top: 1px solid rgba(255, 255, 255, .07) !important;
}

.aa-chat-app form.aa-chat-composer::after {
    content: "Suas mensagens são seguras e confidenciais.";
    position: absolute;
    left: 50%;
    bottom: -26px;
    transform: translateX(-50%);
    color: rgba(243, 238, 229, .44);
    font-size: 12px;
    white-space: nowrap;
}

.aa-chat-app .aa-chat-attach,
.aa-chat-app .aa-chat-send {
    width: 46px !important;
    height: 46px !important;
    min-height: 46px !important;
    border-radius: 12px !important;
}

.aa-chat-app .aa-chat-attach {
    color: rgba(243, 238, 229, .72) !important;
    background: #111317 !important;
    border: 1px solid rgba(255, 255, 255, .08) !important;
}

.aa-chat-app .aa-chat-attach:hover {
    color: #DFC08A !important;
    background: rgba(223, 192, 138, .06) !important;
    border-color: rgba(223, 192, 138, .18) !important;
}

.aa-chat-app .aa-chat-composer-main {
    min-height: 46px;
    background: #111317 !important;
    border: 1px solid rgba(255, 255, 255, .08) !important;
    border-radius: 14px !important;
}

.aa-chat-app .aa-chat-composer-main:focus-within {
    background: #13161b !important;
    border-color: rgba(223, 192, 138, .18) !important;
}

.aa-chat-app .aa-chat-composer textarea {
    min-height: 46px !important;
    height: 46px;
    max-height: 140px !important;
    padding: 12px 14px !important;
    font-size: 14px !important;
    line-height: 22px !important;
}

.aa-chat-app .aa-chat-send {
    color: #14110b !important;
    background: linear-gradient(180deg, #DFC08A 0%, #D5B06A 100%) !important;
    border: 0 !important;
    box-shadow: 0 10px 24px rgba(201, 169, 110, .16) !important;
}

.aa-chat-app .aa-chat-send:hover {
    color: #14110b !important;
    filter: brightness(1.03);
    transform: translateY(-1px);
}

.aa-chat-app .aa-chat-file-preview {
    margin: 0 10px 10px;
    padding: 9px 11px;
    background: rgba(223, 192, 138, .08);
    border: 1px solid rgba(223, 192, 138, .16);
    border-radius: 10px;
    font-size: 11px !important;
}

.aa-chat-app .aa-chat-file-preview button {
    width: 22px !important;
    height: 22px !important;
    min-height: 22px !important;
}

@media (max-width: 1180px) {
    .aa-chat-app {
        grid-template-columns: minmax(320px, 360px) minmax(0, 1fr);
        gap: 12px;
    }
}

@media (max-width: 860px) {
    .aa-chat-app {
        gap: 10px;
        min-height: calc(100dvh - 150px);
        height: calc(100dvh - 150px);
        overflow: hidden;
    }

    .aa-chat-app .aa-chat-sidebar,
    .aa-chat-app .aa-chat-conversation {
        border-radius: 18px !important;
    }

    .aa-chat-app .aa-chat-sidebar-header,
    .aa-chat-app .aa-chat-toolbar,
    .aa-chat-app .aa-chat-filters {
        padding-left: 16px;
        padding-right: 16px;
    }

    .aa-chat-app .aa-chat-thread-list {
        padding-left: 10px;
        padding-right: 10px;
    }

    .aa-chat-app .aa-chat-messages {
        padding: 18px 14px;
        background-size: 180px 180px !important;
    }

    .aa-chat-app .aa-chat-message {
        max-width: 84%;
    }

    .aa-chat-app form.aa-chat-composer {
        padding: 10px 12px 14px !important;
    }

    .aa-chat-app form.aa-chat-composer::after {
        display: none;
    }
}

/* ========================================================================== */
/* 17. AJUSTE FINO — RESPIRO DA SIDEBAR / CABEÇALHO / BUSCA NEUTRA           */
/* ========================================================================== */

/* Mantém o cabeçalho no alinhamento atual, mas descola o bloco do chat da
   sidebar principal do sistema. */
.aad #view-chat > .aa-chat-app {
    width: calc(100% - 40px) !important;
    margin-left: 20px !important;
    margin-right: 20px !important;
    margin-bottom: 24px !important;
}

/* O cabeçalho do Chat não usa linha divisória abaixo do subtítulo. */
.aad #view-chat > .aad-panel-hdr {
    border-bottom: 0 !important;
}

/* Busca no mesmo padrão graphite dos inputs de Cursos: nenhuma borda dourada,
   inclusive em hover, foco ou focus-within. */
.aad #view-chat .aa-chat-app .aa-chat-search,
.aad #view-chat .aa-chat-app .aa-chat-search:hover {
    background: rgba(255, 255, 255, .025) !important;
    border: 1px solid rgba(255, 255, 255, .08) !important;
    box-shadow: none !important;
}

.aad #view-chat .aa-chat-app .aa-chat-search:focus-within {
    background: rgba(255, 255, 255, .035) !important;
    border-color: rgba(255, 255, 255, .13) !important;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .025) !important;
}

@media (max-width: 860px) {
    .aad #view-chat > .aa-chat-app {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-bottom: 12px !important;
    }
}

/* ========================================================================== */
/* 18. CHAT — PADRÃO EXATO DE CURSOS / PALETA NEUTRA                         */
/* ========================================================================== */

/* Herda os mesmos dourados homologados na página Cursos. */
.aad #view-chat .aa-chat-app {
    --aa-chat-gold: var(--g, #C9A96E);
    --aa-chat-gold-strong: var(--g2, #DFC08A);
    --aa-chat-gold-soft: rgba(var(--aa-gold-rgb,201,169,110), .08);
    --aa-chat-gold-border: rgba(var(--aa-gold-rgb,201,169,110), .18);
}

/* Buscar conversas = mesmo padrão visual do input Buscar cursos. */
.aad #view-chat .aa-chat-app .aa-chat-search,
.aad #view-chat .aa-chat-app .aa-chat-search:hover {
    height: 43px !important;
    padding: 0 14px !important;
    gap: 10px !important;
    background: #121214 !important;
    border: 1px solid rgba(245,241,232,.060) !important;
    border-radius: 9px !important;
    box-shadow: none !important;
}

.aad #view-chat .aa-chat-app .aa-chat-search:focus-within {
    background: #121214 !important;
    border-color: rgba(var(--aa-gold-rgb,201,169,110),.26) !important;
    box-shadow: 0 0 0 2px rgba(var(--aa-gold-rgb,201,169,110),.035) !important;
}

.aad #view-chat .aa-chat-app .aa-chat-search svg {
    width: 17px !important;
    height: 17px !important;
    color: rgba(245,241,232,.58) !important;
}

.aad #view-chat .aa-chat-app .aa-chat-search input {
    height: 41px !important;
    color: var(--t1, #F5F1E8) !important;
    font-size: 12px !important;
}

.aad #view-chat .aa-chat-app .aa-chat-search input::placeholder {
    color: rgba(245,241,232,.42) !important;
}

/* Mensagem direta = mesmo padrão do CTA Continuar da página Cursos. */
.aad #view-chat .aa-chat-app .aa-chat-new-button {
    min-width: 104px !important;
    min-height: 34px !important;
    height: 34px !important;
    padding: 0 15px !important;
    gap: 7px !important;
    color: #0a0a0a !important;
    background: var(--g, #C9A96E) !important;
    border: 1px solid var(--g, #C9A96E) !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    filter: none !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    transform: none !important;
}

.aad #view-chat .aa-chat-app .aa-chat-new-button:hover {
    color: #080808 !important;
    background: var(--g2, #DFC08A) !important;
    border-color: var(--g2, #DFC08A) !important;
    box-shadow: none !important;
    filter: none !important;
    transform: none !important;
}

/* Raio dos controles principais acompanha o padrão 6px de Cursos. */
.aad #view-chat .aa-chat-app .aa-chat-filters button,
.aad #view-chat .aa-chat-app .aa-chat-assignee-button,
.aad #view-chat .aa-chat-app .aa-chat-claim,
.aad #view-chat .aa-chat-app .aa-chat-close-thread,
.aad #view-chat .aa-chat-app .aa-chat-delete-thread,
.aad #view-chat .aa-chat-app .aa-chat-attach,
.aad #view-chat .aa-chat-app .aa-chat-send,
.aad #view-chat .aa-chat-app .aa-chat-load-older,
.aad #view-chat .aa-chat-app .aa-chat-identity-button {
    border-radius: 6px !important;
}

/* Amarelos de ação seguem o dourado padrão, sem efeito luminoso. */
.aad #view-chat .aa-chat-app .aa-chat-filters button.is-active,
.aad #view-chat .aa-chat-app .aa-chat-filters button.is-active:hover,
.aad #view-chat .aa-chat-app .aa-chat-send,
.aad #view-chat .aa-chat-app button.aa-chat-assignee-option.is-selected {
    color: #0a0a0a !important;
    background: var(--g, #C9A96E) !important;
    border-color: var(--g, #C9A96E) !important;
    box-shadow: none !important;
    filter: none !important;
}

.aad #view-chat .aa-chat-app .aa-chat-send:hover {
    color: #080808 !important;
    background: var(--g2, #DFC08A) !important;
    border-color: var(--g2, #DFC08A) !important;
    box-shadow: none !important;
    filter: none !important;
    transform: none !important;
}

.aad #view-chat .aa-chat-app .aa-chat-notification-button,
.aad #view-chat .aa-chat-app .aa-chat-thread-subject,
.aad #view-chat .aa-chat-app .aa-chat-header-copy small,
.aad #view-chat .aa-chat-app .aa-chat-attachment-icon,
.aad #view-chat .aa-chat-app .aa-chat-support-icon,
.aad #view-chat .aa-chat-app .aa-chat-typing span {
    color: var(--g, #C9A96E) !important;
}

.aad #view-chat .aa-chat-app .aa-chat-thread-status.is-pending,
.aad #view-chat .aa-chat-app .aa-chat-thread-badge {
    background: var(--g, #C9A96E) !important;
    box-shadow: none !important;
}

/* Remove o azul do painel e deixa toda a conversa em tom sobre tom neutro. */
.aad #view-chat .aa-chat-app .aa-chat-conversation,
.aad #view-chat .aa-chat-app .aa-chat-conversation-panel,
.aad #view-chat .aa-chat-app .aa-chat-empty-state {
    background-color: #0d0e0f !important;
    background-image: none !important;
}

.aad #view-chat .aa-chat-app .aa-chat-messages {
    background-color: #0d0e0f !important;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'%3E%3Cg stroke='rgba(245,241,232,0.026)' stroke-width='1.2' fill='none'%3E%3Cpath d='M26 30c0-6 5-11 11-11h17c6 0 11 5 11 11v12c0 6-5 11-11 11H45l-11 8v-8h-8c-6 0-11-5-11-11V30c0-6 5-11 11-11Z'/%3E%3Ccircle cx='134' cy='36' r='8'/%3E%3Cpath d='M178 28v18M169 37h18'/%3E%3Cpath d='M110 92c0-7 5-12 12-12h17c7 0 12 5 12 12v12c0 7-5 12-12 12h-12l-12 9v-9h-5c-7 0-12-5-12-12V92Z'/%3E%3Cpath d='M30 132h20m-10-10v20'/%3E%3Cpath d='M80 150l8-13 14 3 3 14-12 8-13-4Z'/%3E%3Cpath d='M152 154c0-8 6-14 14-14s14 6 14 14-6 14-14 14-14-6-14-14Z'/%3E%3C/g%3E%3C/svg%3E") !important;
    background-size: 220px 220px !important;
    background-position: center !important;
}

.aad #view-chat .aa-chat-app .aa-chat-conversation-header,
.aad #view-chat .aa-chat-app form.aa-chat-composer {
    background: #121214 !important;
}

.aad #view-chat .aa-chat-app .aa-chat-composer-main,
.aad #view-chat .aa-chat-app .aa-chat-attach {
    background: #101112 !important;
}

.aad #view-chat .aa-chat-app .aa-chat-composer-main:focus-within {
    background: #121214 !important;
}

.aad #view-chat .aa-chat-app .aa-chat-bubble {
    background: #1a1b1d !important;
}

/* Mensagem do atendente em dourado padrão sem gradiente berrante. */
.aad #view-chat .aa-chat-app .aa-chat-message.is-mine .aa-chat-bubble {
    color: #0a0a0a !important;
    background: var(--g, #C9A96E) !important;
    border: 0 !important;
    box-shadow: none !important;
}

/* Assunto da conversa: texto simples ao lado do nome, sem cápsula. */
.aad #view-chat .aa-chat-app .aa-chat-header-copy {
    display: flex !important;
    align-items: baseline !important;
    flex-wrap: wrap !important;
    gap: 7px !important;
}

.aad #view-chat .aa-chat-app .aa-chat-header-copy strong {
    display: inline-block !important;
    flex: 0 1 auto !important;
}

.aad #view-chat .aa-chat-app .aa-chat-header-copy small {
    display: inline-block !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    color: var(--g, #C9A96E) !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    letter-spacing: .035em !important;
    text-transform: uppercase !important;
}

/* Mantém o pattern também no estado sem conversa, agora sobre fundo neutro. */
.aad #view-chat .aa-chat-app .aa-chat-empty-state {
    background-color: #0d0e0f !important;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'%3E%3Cg stroke='rgba(245,241,232,0.026)' stroke-width='1.2' fill='none'%3E%3Cpath d='M26 30c0-6 5-11 11-11h17c6 0 11 5 11 11v12c0 6-5 11-11 11H45l-11 8v-8h-8c-6 0-11-5-11-11V30c0-6 5-11 11-11Z'/%3E%3Ccircle cx='134' cy='36' r='8'/%3E%3Cpath d='M178 28v18M169 37h18'/%3E%3Cpath d='M110 92c0-7 5-12 12-12h17c7 0 12 5 12 12v12c0 7-5 12-12 12h-12l-12 9v-9h-5c-7 0-12-5-12-12V92Z'/%3E%3Cpath d='M30 132h20m-10-10v20'/%3E%3Cpath d='M80 150l8-13 14 3 3 14-12 8-13-4Z'/%3E%3Cpath d='M152 154c0-8 6-14 14-14s14 6 14 14-6 14-14 14-14-6-14-14Z'/%3E%3C/g%3E%3C/svg%3E") !important;
    background-size: 220px 220px !important;
    background-position: center !important;
}


/* ========================================================================== */
/* 18. CHAT — AJUSTE ASSUNTO / CABEÇALHO / SELEÇÃO                           */
/* ========================================================================== */

/* Lista de conversas: assunto removido do card (também removido no JS). */
.aad #view-chat .aa-chat-app .aa-chat-thread-subject {
    display: none !important;
}

/* Cabeçalho: nome na primeira linha e assunto logo abaixo, alinhado à esquerda. */
.aad #view-chat .aa-chat-app .aa-chat-header-copy {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: center !important;
    gap: 3px !important;
}

.aad #view-chat .aa-chat-app .aa-chat-header-copy strong {
    display: block !important;
    width: 100% !important;
    flex: 0 0 auto !important;
}

.aad #view-chat .aa-chat-app .aa-chat-header-copy small {
    display: block !important;
    width: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    color: var(--g, #C9A96E) !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    letter-spacing: .035em !important;
    text-transform: uppercase !important;
}

/* Conversa selecionada: sem contorno/barrinha dourada. */
.aad #view-chat .aa-chat-app button.aa-chat-thread.is-active,
.aad #view-chat .aa-chat-app button.aa-chat-thread.is-active:hover,
.aad #view-chat .aa-chat-app button.aa-chat-thread.is-active:focus,
.aad #view-chat .aa-chat-app button.aa-chat-thread.is-active:focus-visible {
    background: rgba(255, 255, 255, .035) !important;
    border: 1px solid rgba(255, 255, 255, .08) !important;
    border-bottom: 1px solid rgba(255, 255, 255, .08) !important;
    box-shadow: none !important;
}

/* ========================================================================== */
/* 19. CHAT — SELETOR NEUTRO + ENCERRAMENTO NO PADRÃO CURSOS                 */
/* ========================================================================== */

/* Seletor de atendente: nenhuma borda dourada, inclusive aberto/foco. */
.aad #view-chat .aa-chat-app .aa-chat-assignee-button,
.aad #view-chat .aa-chat-app .aa-chat-assignee-button:hover,
.aad #view-chat .aa-chat-app .aa-chat-assignee-button:focus,
.aad #view-chat .aa-chat-app .aa-chat-assignee-button:focus-visible,
.aad #view-chat .aa-chat-app .aa-chat-assignee-control.is-open .aa-chat-assignee-button {
    color: #efe8dc !important;
    background: #121214 !important;
    border: 1px solid rgba(245,241,232,.12) !important;
    border-radius: 6px !important;
    outline: 0 !important;
    box-shadow: none !important;
}

.aad #view-chat .aa-chat-app .aa-chat-assignee-menu {
    background: #101112 !important;
    border: 1px solid rgba(245,241,232,.12) !important;
    border-radius: 6px !important;
    box-shadow: 0 14px 34px rgba(0,0,0,.38) !important;
    outline: 0 !important;
}

.aad #view-chat .aa-chat-app button.aa-chat-assignee-option,
.aad #view-chat .aa-chat-app button.aa-chat-assignee-option:hover,
.aad #view-chat .aa-chat-app button.aa-chat-assignee-option:focus,
.aad #view-chat .aa-chat-app button.aa-chat-assignee-option:focus-visible {
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
}

/* Opção selecionada usa apenas o preenchimento do botão Cursos, sem contorno luminoso. */
.aad #view-chat .aa-chat-app button.aa-chat-assignee-option.is-selected {
    color: #0a0a0a !important;
    background: var(--g, #C9A96E) !important;
    border: 0 !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    outline: 0 !important;
}

/* Aviso de encerramento: mesmas proporções e acabamento dos CTAs de Cursos. */
.aad #view-chat .aa-chat-app .aa-chat-app-status:not(.is-error) {
    min-height: 34px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 15px !important;
    color: #0a0a0a !important;
    background: var(--g, #C9A96E) !important;
    border: 1px solid var(--g, #C9A96E) !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    font-family: Inter,system-ui,sans-serif !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    letter-spacing: 0 !important;
    line-height: 1 !important;
}

/* ========================================================================== */
/* MOBILE 23/08 — CENTRALIZAÇÃO ESTRUTURAL DOS CARDS DO CHAT                 */
/* Escopo exclusivamente mobile; desktop permanece inalterado.               */
/* ========================================================================== */
@media (max-width: 860px) {
    .aad #view-chat {
        width: 100% !important;
        max-width: none !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        overflow: visible !important;
    }

    .aad #view-chat > .aa-chat-app {
        box-sizing: border-box !important;
        width: calc(100vw - 28px) !important;
        max-width: calc(100vw - 28px) !important;
        margin-left: 14px !important;
        margin-right: 14px !important;
        margin-bottom: 12px !important;
    }

    .aad #view-chat > .aa-chat-app .aa-chat-sidebar,
    .aad #view-chat > .aa-chat-app .aa-chat-conversation,
    .aad #view-chat > .aa-chat-app .aa-chat-conversation-panel {
        box-sizing: border-box !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* ========================================================================== */
/* MOBILE 23/08 — CHAT ALINHADO AO CABEÇALHO (16px / 16px)                  */
/* Escopo exclusivamente mobile. Corrige a regra de viewport mais específica */
/* que mantinha o app em 100% e anulava as margens laterais.                 */
/* ========================================================================== */
@media (max-width: 860px) {
    body.aad-chat-view-active .aad #view-chat > .aa-chat-app {
        box-sizing: border-box !important;
        width: calc(100% - 32px) !important;
        max-width: calc(100% - 32px) !important;
        margin-left: 16px !important;
        margin-right: 16px !important;
        grid-template-columns: minmax(0, 1fr) !important;
        grid-template-rows: minmax(0, 1fr) !important;
        justify-self: center !important;
    }

    body.aad-chat-view-active .aad #view-chat > .aa-chat-app .aa-chat-sidebar,
    body.aad-chat-view-active .aad #view-chat > .aa-chat-app .aa-chat-conversation,
    body.aad-chat-view-active .aad #view-chat > .aa-chat-app .aa-chat-conversation-panel {
        box-sizing: border-box !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}
