        :root {
            color-scheme: light;
            --roxo: #9101D2;
            --roxo-escuro: #6f00a3;
            --laranja: #FF780C;
            --texto: #1f2230;
            --texto-suave: #6d7280;
            --linha: #e8e9ef;
            --fundo: #f7f7fb;
            --fundo-chat: #f7f3ec;
            --padrao-chat: url('/chat/fundo-claro.jpg?v=2');
            --branco: #ffffff;
            --superficie: #ffffff;
            --superficie-2: #f1f2f6;
            --cabecalho: rgba(255, 255, 255, .96);
            --composer: rgba(255, 255, 255, .98);
            --borda-input: #dfe1e8;
            --placeholder: #9a9daa;
            --hora: #9296a2;
            --erro: #b42318;
            --sombra: 0 10px 30px rgba(24, 24, 35, .08);
        }

        html[data-theme="dark"] {
            color-scheme: dark;
            --texto: #f3f4f7;
            --texto-suave: #a7adba;
            --linha: #303542;
            --fundo: #11131a;
            --fundo-chat: #0c121e;
            --padrao-chat: url('/chat/fundo-escuro.jpg?v=2');
            --branco: #1a1d26;
            --superficie: #1a1d26;
            --superficie-2: #242833;
            --cabecalho: rgba(21, 24, 32, .97);
            --composer: rgba(21, 24, 32, .98);
            --borda-input: #383d49;
            --placeholder: #808694;
            --hora: #808694;
            --erro: #ff8078;
            --sombra: 0 10px 30px rgba(0, 0, 0, .30);
        }

        * {
            box-sizing: border-box;
        }

        html,
        body {
            margin: 0;
            width: 100%;
            max-width: 100%;
            min-height: 100%;
            overflow-x: hidden;
            background: var(--fundo);
            color: var(--texto);
            font-family: "Amsi", "Segoe UI", Arial, sans-serif;
        }

        body {
            overflow-y: hidden;
        }

        button,
        textarea {
            font: inherit;
        }

        .app {
            width: 100%;
            max-width: 100%;
            min-width: 0;
            height: 100vh;
            height: 100dvh;
            display: grid;
            grid-template-rows: auto 1fr auto;
            background:
                radial-gradient(circle at 10% -10%, rgba(145, 1, 210, .08), transparent 32rem),
                var(--fundo);
        }

        .topo,
        .mensagens,
        .composer {
            width: 100%;
            max-width: 100%;
            min-width: 0;
        }

        .topo {
            background: var(--cabecalho);
            -webkit-backdrop-filter: blur(12px);
            backdrop-filter: blur(12px);
            border-bottom: 1px solid var(--linha);
            z-index: 10;
        }

        .topo-interno,
        .mensagens-interno,
        .composer-interno {
            width: 100%;
            max-width: 980px;
            margin: 0 auto;
        }

        .topo-interno {
            display: flex;
            flex-direction: column;
            align-items: stretch;
            gap: 0;
            padding: 12px 20px 11px;
        }

        .topo-logo-linha {
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 55px;
            padding-bottom: 8px;
        }

        .marca-logo {
            display: block;
            width: auto;
            height: 50px;
            max-width: min(330px, 68vw);
            object-fit: contain;
        }

        .topo-info-linha {
            position: relative;
            width: 100%;
            min-width: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            border-top: 1px solid rgba(232, 233, 239, .8);
            padding: 9px 20px 0;
        }

        .topo-textos {
            min-width: 0;
            text-align: center;
        }

        .topo-titulo {
            margin: 0;
            font-size: 16px;
            font-weight: 800;
            line-height: 1.15;
        }

        .topo-subtitulo {
            margin-top: 4px;
            color: var(--texto-suave);
            font-size: 12px;
        }

        .topo-acoes {
            position: absolute;
            right: 4px;
            top: 50%;
            transform: translateY(-35%);
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .som-toggle,
        .tema-toggle,
        .limpar-toggle {
            width: 36px;
            height: 36px;
            border: 0;
            border-radius: 12px;
            display: grid;
            place-items: center;
            padding: 0;
            cursor: pointer;
            background: transparent;
            color: #767b88;
            transition: background .15s ease, color .15s ease;
        }

        .encerrar-toggle {
            min-width: 104px;
            height: 36px;
            border: 1px solid rgba(217, 45, 32, .16);
            border-radius: 12px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 7px;
            padding: 0 12px 0 10px;
            cursor: pointer;
            background: rgba(217, 45, 32, .05);
            color: #d92d20;
            font-size: 13px;
            font-weight: 700;
            transition: background .15s ease, color .15s ease, border-color .15s ease;
        }

        .som-toggle:hover,
        .tema-toggle:hover {
            color: var(--roxo);
            background: rgba(145, 1, 210, .07);
        }

        .limpar-toggle:hover,
        .encerrar-toggle:hover {
            color: #d92d20;
            background: rgba(217, 45, 32, .10);
        }

        .som-toggle svg,
        .tema-toggle svg,
        .limpar-toggle svg {
            width: 20px;
            height: 20px;
            fill: currentColor;
        }

        .encerrar-toggle svg {
            width: 18px;
            height: 18px;
            fill: currentColor;
            flex: 0 0 auto;
        }

        .encerrar-toggle .botao-texto {
            line-height: 1;
            white-space: nowrap;
        }

        .modal-overlay {
            position: fixed;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            z-index: 300;
            display: grid;
            place-items: center;
            padding: 20px;
            background: rgba(13, 15, 22, .48);
            -webkit-backdrop-filter: blur(5px);
            backdrop-filter: blur(5px);
        }

        .modal-overlay[hidden] {
            display: none;
        }

        .modal-limpar {
            width: 100%;
            max-width: 420px;
            border: 1px solid var(--linha);
            border-radius: 22px;
            background: var(--superficie);
            color: var(--texto);
            box-shadow: 0 24px 70px rgba(0, 0, 0, .24);
            padding: 22px;
        }

        .modal-limpar-icone {
            width: 48px;
            height: 48px;
            border-radius: 16px;
            display: grid;
            place-items: center;
            margin-bottom: 15px;
            color: #d92d20;
            background: rgba(217, 45, 32, .09);
        }

        .modal-limpar-icone svg {
            width: 23px;
            height: 23px;
            fill: currentColor;
        }

        .modal-limpar h2 {
            margin: 0;
            font-size: 19px;
            line-height: 1.2;
        }

        .modal-limpar p {
            margin: 8px 0 0;
            color: var(--texto-suave);
            font-size: 13px;
            line-height: 1.55;
        }

        .modal-limpar-acoes {
            display: flex;
            justify-content: flex-end;
            gap: 9px;
            margin-top: 22px;
        }

        .modal-btn {
            min-height: 40px;
            border-radius: 12px;
            padding: 0 15px;
            border: 1px solid var(--linha);
            cursor: pointer;
            font: inherit;
            font-size: 13px;
            font-weight: 700;
        }

        .modal-btn.secundario {
            background: var(--superficie-3);
            color: var(--texto);
        }

        .modal-btn.perigo {
            border-color: #d92d20;
            background: #d92d20;
            color: #ffffff;
        }

        .modal-btn:disabled {
            opacity: .55;
            cursor: default;
        }

        .mensagens {
            min-height: 0;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            overscroll-behavior: contain;
            background-color: var(--fundo-chat);
            background-image: var(--padrao-chat);
            background-repeat: repeat;
            background-position: top center;
            background-size: 320px auto;
        }

        .mensagens-interno {
            min-height: 100%;
            padding: 30px 20px 26px;
            display: flex;
            flex-direction: column;
            justify-content: flex-end;
        }

        .boas-vindas {
            margin: auto;
            max-width: 540px;
            text-align: center;
            padding: 34px 22px;
        }

        .boas-vindas-icone {
            width: 72px;
            height: 72px;
            margin: 0 auto 18px;
            border-radius: 24px;
            display: grid;
            place-items: center;
            font-size: 30px;
            background: var(--branco);
            box-shadow: var(--sombra);
        }

        .boas-vindas h1 {
            margin: 0;
            font-size: 28px;
            font-size: clamp(24px, 4vw, 34px);
            line-height: 1.15;
        }

        .boas-vindas p {
            margin: 12px auto 0;
            color: var(--texto-suave);
            line-height: 1.6;
            font-size: 15px;
        }

        .lista {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .msg {
            display: flex;
            flex-direction: column;
            max-width: min(78%, 680px);
        }

        .msg.usuario {
            align-self: flex-end;
            align-items: flex-end;
        }

        .msg.chapanet {
            align-self: flex-start;
            align-items: flex-start;
        }

        .msg.sistema {
            align-self: flex-start;
            align-items: flex-start;
            max-width: min(78%, 620px);
        }

        .sistema .bolha {
            background: var(--superficie-3);
            color: var(--texto);
            border: 1px solid var(--linha);
            border-bottom-left-radius: 6px;
            box-shadow: 0 5px 18px rgba(24, 24, 35, .04);
            font-weight: 500;
        }

        html[data-theme="dark"] .sistema .bolha {
            background: #252a35;
            color: #f3f4f7;
            border-color: #353b49;
            box-shadow: 0 5px 18px rgba(0, 0, 0, .16);
        }

        .msg.msg-audio {
            width: 390px;
            max-width: 78%;
            min-width: 300px;
        }

        .msg.msg-audio .bolha {
            width: 100%;
            min-width: 0;
        }

        .msg-remetente {
            margin: 0 8px 5px;
            color: var(--texto-suave);
            font-size: 11px;
            font-weight: 700;
        }

        .bolha {
            padding: 12px 15px;
            border-radius: 18px;
            line-height: 1.52;
            font-size: 15px;
            overflow-wrap: anywhere;
        }

        .bolha strong,
        .bolha b {
            font-weight: 800;
        }

        .bolha em,
        .bolha i {
            font-style: italic;
        }

        .bolha u {
            text-underline-offset: 2px;
        }

        .bolha a {
            color: var(--roxo);
            font-weight: 700;
            text-decoration: underline;
            text-underline-offset: 3px;
            word-break: break-word;
        }

        .bolha.bolha-emoji {
            font-size: 38px;
            line-height: 1.12;
            padding: 11px 15px;
            min-width: 62px;
            text-align: center;
        }

        .bolha.bolha-emoji > div {
            line-height: 1.12;
        }

        .usuario .bolha a {
            color: #fff;
        }

        .usuario .bolha {
            color: #ffffff;
            background: linear-gradient(135deg, var(--roxo), var(--roxo-escuro));
            border-bottom-right-radius: 6px;
            box-shadow: 0 6px 18px rgba(145, 1, 210, .14);
        }

        .chapanet .bolha {
            background: var(--branco);
            border: 1px solid var(--linha);
            border-bottom-left-radius: 6px;
            box-shadow: 0 5px 18px rgba(24, 24, 35, .05);
        }

        .msg-hora {
            margin: 5px 8px 0;
            color: var(--hora);
            font-size: 10px;
        }

        .midia {
            display: block;
            margin-top: 8px;
            color: inherit;
            font-weight: 700;
            text-decoration: underline;
            text-underline-offset: 3px;
        }

        .midia-imagem {
            display: block;
            max-width: min(420px, 100%);
            max-height: 380px;
            margin-top: 9px;
            border-radius: 14px;
            object-fit: contain;
            background: #f1f1f4;
        }

        .midia-audio {
            display: none;
        }

        .audio-player {
            width: 340px;
            max-width: 100%;
            min-width: 260px;
            display: flex;
            align-items: center;
            gap: 9px;
            margin-top: 3px;
            padding: 3px 0;
        }

        .audio-play,
        .audio-volume {
            width: 36px;
            height: 36px;
            flex: 0 0 auto;
            border: 0;
            border-radius: 999px;
            display: grid;
            place-items: center;
            cursor: pointer;
            padding: 0;
        }

        .audio-menu-wrap {
            position: relative;
            flex: 0 0 auto;
        }

        .audio-menu-btn {
            width: 34px;
            height: 34px;
            border: 0;
            border-radius: 999px;
            display: grid;
            place-items: center;
            cursor: pointer;
            padding: 0;
            background: transparent;
            color: #666c78;
        }

        .usuario .audio-menu-btn {
            color: #fff;
        }

        .audio-menu-btn:hover {
            background: rgba(145, 1, 210, .08);
        }

        .usuario .audio-menu-btn:hover {
            background: rgba(255, 255, 255, .14);
        }

        .audio-menu-btn svg {
            width: 19px;
            height: 19px;
            fill: currentColor;
        }

        .audio-menu {
            position: absolute;
            right: 0;
            bottom: calc(100% + 8px);
            min-width: 210px;
            padding: 7px;
            border: 1px solid var(--linha);
            border-radius: 14px;
            background: var(--branco);
            box-shadow: 0 14px 36px rgba(24, 24, 35, .16);
            z-index: 80;
        }

        .audio-menu[hidden] {
            display: none;
        }

        .audio-menu-item {
            width: 100%;
            min-height: 40px;
            border: 0;
            border-radius: 10px;
            background: transparent;
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 10px;
            cursor: pointer;
            color: var(--texto);
            text-align: left;
            font-size: 13px;
        }

        .audio-menu-item:hover {
            background: rgba(145, 1, 210, .06);
        }

        .audio-menu-item svg {
            width: 18px;
            height: 18px;
            flex: 0 0 auto;
            fill: currentColor;
        }

        .audio-speed-panel {
            padding: 6px 8px 8px;
        }

        .audio-speed-title {
            margin: 2px 2px 8px;
            color: var(--texto-suave);
            font-size: 11px;
            font-weight: 700;
        }

        .audio-speed-options {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 5px;
        }

        .audio-speed-btn {
            border: 1px solid var(--linha);
            border-radius: 9px;
            min-height: 34px;
            background: var(--branco);
            color: var(--texto);
            cursor: pointer;
            font-size: 12px;
            font-weight: 700;
        }

        .audio-speed-btn:hover {
            border-color: rgba(145, 1, 210, .35);
            color: var(--roxo);
        }

        .audio-speed-btn.ativo {
            color: var(--branco);
            border-color: var(--roxo);
            background: var(--roxo);
        }

        .audio-play {
            background: rgba(145, 1, 210, .10);
            color: var(--roxo);
        }

        .audio-volume {
            background: transparent;
            color: #666c78;
        }

        .usuario .audio-play {
            background: rgba(255, 255, 255, .20);
            color: #fff;
        }

        .usuario .audio-volume {
            color: #fff;
        }

        .audio-play svg,
        .audio-volume svg {
            width: 19px;
            height: 19px;
            fill: currentColor;
        }

        .audio-centro {
            flex: 1;
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .audio-progresso {
            width: 100%;
            min-width: 0;
            height: 5px;
            margin: 0;
            padding: 0;
            accent-color: var(--roxo);
            cursor: pointer;
        }

        .usuario .audio-progresso {
            accent-color: #fff;
        }

        .audio-tempos {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 8px;
            color: #808591;
            font-size: 10px;
            line-height: 1;
            font-variant-numeric: tabular-nums;
        }

        .usuario .audio-tempos {
            color: rgba(255, 255, 255, .82);
        }

        .midia-video {
            display: block;
            width: min(420px, 100%);
            max-width: 100%;
            max-height: 420px;
            margin-top: 8px;
            border-radius: 14px;
            background: #111;
        }

        .acoes-chat {
            display: flex;
            align-items: center;
            gap: 3px;
            flex: 0 0 auto;
        }

        .acao-chat {
            width: 36px;
            height: 36px;
            display: grid;
            place-items: center;
            border: 0;
            border-radius: 12px;
            background: transparent;
            color: #727785;
            cursor: pointer;
            transition: background .15s ease, color .15s ease, transform .15s ease;
            padding: 0;
        }

        .emoji-wrap {
            position: relative;
            display: grid;
            place-items: center;
        }

        .emoji-picker {
            position: absolute;
            left: 0;
            bottom: calc(100% + 14px);
            width: min(330px, calc(100vw - 28px));
            max-height: 270px;
            overflow-y: auto;
            overflow-x: hidden;
            padding: 10px;
            display: grid;
            grid-template-columns: repeat(7, minmax(32px, 1fr));
            gap: 3px;
            background: var(--branco);
            border: 1px solid var(--linha);
            border-radius: 18px;
            box-shadow: 0 16px 45px rgba(24, 24, 35, .16);
            z-index: 50;
        }

        .emoji-picker[hidden] {
            display: none;
        }

        .emoji-item {
            width: 38px;
            height: 38px;
            border: 0;
            border-radius: 10px;
            background: transparent;
            cursor: pointer;
            display: grid;
            place-items: center;
            font-size: 22px;
            line-height: 1;
        }

        .emoji-item:hover {
            background: rgba(145, 1, 210, .07);
        }

        .gravacao-ui {
            flex: 1;
            min-width: 0;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .gravacao-ui[hidden] {
            display: none;
        }

        .gravacao-lixeira,
        .gravacao-pausa {
            width: 38px;
            height: 38px;
            border: 0;
            border-radius: 12px;
            display: grid;
            place-items: center;
            cursor: pointer;
            background: transparent;
            flex: 0 0 auto;
        }

        .gravacao-lixeira {
            color: #d92d20;
        }

        .gravacao-pausa {
            color: var(--roxo);
        }

        .gravacao-lixeira:hover {
            background: rgba(217, 45, 32, .08);
        }

        .gravacao-pausa:hover {
            background: rgba(145, 1, 210, .07);
        }

        .gravacao-lixeira svg,
        .gravacao-pausa svg {
            width: 21px;
            height: 21px;
            fill: currentColor;
        }

        .gravacao-info {
            min-width: 0;
            flex: 1;
            display: flex;
            align-items: center;
            gap: 10px;
            color: #d92d20;
            font-size: 13px;
            font-weight: 700;
        }

        .gravacao-ponto {
            width: 9px;
            height: 9px;
            border-radius: 999px;
            background: #d92d20;
            flex: 0 0 auto;
            animation: pulsar-gravacao 1.2s ease-in-out infinite;
        }

        .gravacao-info.pausada {
            color: #777b86;
        }

        .gravacao-info.pausada .gravacao-ponto {
            background: #777b86;
            animation: none;
        }

        .gravacao-tempo {
            font-variant-numeric: tabular-nums;
            white-space: nowrap;
        }

        .gravacao-legenda {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            color: var(--texto-suave);
            font-weight: 500;
        }

        .gravacao-review {
            flex: 1;
            min-width: 0;
            display: flex;
            align-items: center;
            gap: 9px;
        }

        .gravacao-review[hidden] {
            display: none;
        }

        .review-play {
            width: 38px;
            height: 38px;
            flex: 0 0 auto;
            border: 0;
            border-radius: 12px;
            display: grid;
            place-items: center;
            cursor: pointer;
            color: var(--roxo);
            background: rgba(145, 1, 210, .08);
        }

        .review-play svg {
            width: 21px;
            height: 21px;
            fill: currentColor;
        }

        .review-tempo {
            flex: 0 0 auto;
            min-width: 38px;
            color: var(--texto-suave);
            font-size: 12px;
            font-variant-numeric: tabular-nums;
        }

        .review-progresso {
            flex: 1;
            min-width: 45px;
            height: 5px;
            accent-color: var(--roxo);
            cursor: pointer;
        }

        .acao-chat:hover {
            background: rgba(145, 1, 210, .07);
            color: var(--roxo);
        }

        .acao-chat:active {
            transform: scale(.96);
        }

        .acao-chat:disabled {
            opacity: .4;
            cursor: default;
            transform: none;
        }

        .acao-chat svg {
            width: 21px;
            height: 21px;
            fill: currentColor;
        }

        .acao-chat.gravando {
            color: #d92d20;
            background: rgba(217, 45, 32, .09);
            animation: pulsar-gravacao 1.2s ease-in-out infinite;
        }

        @keyframes pulsar-gravacao {
            0%, 100% { opacity: 1; }
            50% { opacity: .55; }
        }

        .status.gravando {
            color: #d92d20;
            font-weight: 700;
        }

        .composer {
            border-top: 1px solid var(--linha);
            background: var(--composer);
            padding-bottom: env(safe-area-inset-bottom);
        }

        .composer-interno {
            padding: 12px 20px;
        }

        .caixa {
            width: 100%;
            max-width: 100%;
            min-width: 0;
            display: flex;
            align-items: flex-end;
            gap: 10px;
            background: var(--branco);
            border: 1px solid var(--borda-input);
            border-radius: 22px;
            padding: 8px 8px 8px 15px;
            box-shadow: 0 5px 18px rgba(24, 24, 35, .04);
        }

        .caixa:focus-within {
            border-color: rgba(145, 1, 210, .45);
            box-shadow: 0 0 0 4px rgba(145, 1, 210, .07);
        }

        textarea {
            flex: 1;
            min-width: 0;
            min-height: 28px;
            max-height: 130px;
            resize: none;
            overflow-y: auto;
            border: 0;
            outline: 0;
            background: transparent;
            color: var(--texto);
            padding: 6px 0 4px;
            line-height: 1.45;
        }

        textarea::placeholder {
            color: var(--placeholder);
        }

        .enviar {
            width: 44px;
            height: 44px;
            border: 0;
            border-radius: 16px;
            display: grid;
            place-items: center;
            cursor: pointer;
            color: var(--branco);
            background: linear-gradient(135deg, var(--roxo), var(--laranja));
            transition: transform .15s ease, opacity .15s ease;
            flex: 0 0 auto;
        }

        .enviar:hover {
            transform: translateY(-1px);
        }

        .enviar:disabled {
            opacity: .45;
            cursor: default;
            transform: none;
        }

        .enviar svg {
            width: 21px;
            height: 21px;
            fill: currentColor;
        }

        .status {
            min-height: 18px;
            padding: 4px 4px 0;
            color: var(--texto-suave);
            font-size: 11px;
        }

        .status.erro,
        .status.aviso {
            font-size: 12.5px;
            line-height: 1.4;
        }

        .status.erro {
            color: var(--erro);
            font-weight: 600;
        }

        html[data-theme="dark"] .topo {
            background: var(--cabecalho);
            border-bottom-color: var(--linha);
        }

        html[data-theme="dark"] .topo-info-linha {
            border-top-color: var(--linha);
        }

        html[data-theme="dark"] .boas-vindas-icone,
        html[data-theme="dark"] .chapanet .bolha,
        html[data-theme="dark"] .emoji-picker,
        html[data-theme="dark"] .audio-menu {
            background: var(--superficie);
            color: var(--texto);
            border-color: var(--linha);
            box-shadow: var(--sombra);
        }

        html[data-theme="dark"] .composer {
            background: var(--composer);
            border-top-color: var(--linha);
        }

        html[data-theme="dark"] .caixa {
            background: var(--superficie);
            border-color: var(--borda-input);
            box-shadow: 0 5px 18px rgba(0, 0, 0, .16);
        }

        html[data-theme="dark"] textarea {
            color: var(--texto);
        }

        html[data-theme="dark"] textarea::placeholder {
            color: var(--placeholder);
        }

        html[data-theme="dark"] .msg-hora {
            color: var(--hora);
        }

        html[data-theme="dark"] .emoji-item:hover,
        html[data-theme="dark"] .audio-menu-item:hover {
            background: rgba(184, 74, 235, .12);
        }

        html[data-theme="dark"] .audio-speed-btn {
            background: var(--superficie-2);
            border-color: var(--linha);
            color: var(--texto);
        }

        html[data-theme="dark"] .audio-speed-btn.ativo {
            background: var(--roxo);
            border-color: var(--roxo);
            color: #fff;
        }

        html[data-theme="dark"] .acao-chat,
        html[data-theme="dark"] .som-toggle,
        html[data-theme="dark"] .tema-toggle,
        html[data-theme="dark"] .limpar-toggle,
        html[data-theme="dark"] .encerrar-toggle,
        html[data-theme="dark"] .audio-volume,
        html[data-theme="dark"] .audio-menu-btn {
            color: #aeb4c2;
        }

        html[data-theme="dark"] .encerrar-toggle {
            color: #ff938c;
            background: rgba(217, 45, 32, .10);
            border-color: rgba(255, 147, 140, .16);
        }

        html[data-theme="dark"] .acao-chat:hover,
        html[data-theme="dark"] .som-toggle:hover,
        html[data-theme="dark"] .tema-toggle:hover {
            color: #d58cff;
            background: rgba(184, 74, 235, .12);
        }

        html[data-theme="dark"] .review-play,
        html[data-theme="dark"] .audio-play {
            background: rgba(184, 74, 235, .14);
            color: #d58cff;
        }

        html[data-theme="dark"] .midia-imagem {
            background: #0d0f15;
        }


        @media (min-width: 641px) and (max-width: 900px) {
            .topo-info-linha {
                padding-right: 210px;
                padding-left: 20px;
            }
        }

        @media (max-width: 480px) {
            .topo-info-linha {
                padding-right: 224px;
            }

            .topo-acoes {
                gap: 3px;
            }

            .som-toggle,
            .tema-toggle,
            .limpar-toggle {
                width: 28px;
                height: 28px;
            }

            .encerrar-toggle {
                min-width: 84px;
                height: 28px;
                padding: 0 8px;
                font-size: 11px;
                border-radius: 10px;
            }
        }

        @media (max-width: 640px) {

            .topo-interno {
                padding: 9px 12px 8px;
            }

            .topo-logo-linha {
                min-height: 48px;
                padding-bottom: 6px;
            }

            .marca-logo {
                height: 42px;
                max-width: min(245px, 72vw);
            }

            .topo-info-linha {
                padding: 8px 232px 0 10px;
            }

            .topo-titulo {
                font-size: 15px;
            }

            .topo-subtitulo {
                font-size: 11px;
                line-height: 1.35;
            }

            .topo-acoes {
                right: 0;
            }

            .som-toggle,
            .tema-toggle,
            .limpar-toggle {
                width: 32px;
                height: 32px;
            }

            .encerrar-toggle {
                min-width: 90px;
                height: 32px;
                padding: 0 10px 0 9px;
                font-size: 12px;
                gap: 6px;
            }

            .encerrar-toggle svg {
                width: 16px;
                height: 16px;
            }

            .modal-limpar {
                width: 100%;
                border-radius: 20px;
                padding: 19px;
            }

            .modal-limpar-acoes {
                display: grid;
                grid-template-columns: 1fr 1fr;
            }

            .modal-btn {
                width: 100%;
                padding: 0 10px;
            }

            .topo-interno {
                min-height: 64px;
                padding: 8px 14px;
            }

            .marca {
                width: 40px;
                height: 40px;
                border-radius: 13px;
            }

            .mensagens {
                background-size: 430px auto;
            }

            .mensagens-interno {
                padding: 20px 13px 18px;
            }

            .composer-interno {
                padding: 9px 10px;
            }

            .msg {
                max-width: 88%;
            }

            .msg.sistema {
                max-width: 88%;
            }

            .msg.msg-audio {
                width: 340px;
                max-width: 92%;
                min-width: 270px;
            }

            .audio-player {
                width: 100%;
                min-width: 230px;
                gap: 7px;
            }

            .audio-play,
            .audio-volume {
                width: 34px;
                height: 34px;
            }

            .audio-menu-btn {
                width: 32px;
                height: 32px;
            }

            .audio-menu {
                right: 0;
                min-width: 200px;
                max-width: min(86vw, 240px);
            }

            .caixa {
                border-radius: 19px;
                padding-left: 10px;
            }

            .emoji-picker {
                position: fixed;
                left: 10px;
                right: 10px;
                bottom: calc(78px + env(safe-area-inset-bottom));
                width: auto;
                max-width: none;
                max-height: min(320px, 50vh);
                grid-template-columns: repeat(7, minmax(0, 1fr));
                gap: 4px;
                padding: 10px 8px;
            }

            .emoji-item {
                width: 100%;
                height: 40px;
                font-size: 24px;
            }

            .bolha.bolha-emoji {
                font-size: 42px;
                min-width: 66px;
                padding: 12px 16px;
            }

            .gravacao-legenda {
                display: none;
            }

            .gravacao-ui {
                gap: 4px;
                max-width: 100%;
                overflow: hidden;
            }

            .review-tempo {
                min-width: 34px;
                font-size: 11px;
            }

            .gravacao-lixeira,
            .gravacao-pausa,
            .review-play {
                width: 36px;
                height: 36px;
            }

            .enviar {
                width: 42px;
                height: 42px;
                border-radius: 14px;
            }
        }

        /* Ajuste final mobile: título, subtítulo e controles em três linhas */
        @media (max-width: 640px) {
            .topo-info-linha {
                padding: 8px 10px 0 !important;
                display: flex !important;
                flex-direction: column !important;
                align-items: center !important;
                justify-content: flex-start !important;
                gap: 7px !important;
            }

            .topo-textos {
                width: 100% !important;
                min-width: 0 !important;
                display: flex !important;
                flex-direction: column !important;
                align-items: center !important;
                text-align: center !important;
            }

            .topo-titulo {
                margin: 0 !important;
                font-size: 15px !important;
                line-height: 1.2 !important;
                white-space: nowrap !important;
            }

            .topo-subtitulo {
                margin-top: 2px !important;
                width: 100% !important;
                max-width: 330px !important;
                font-size: 11px !important;
                line-height: 1.35 !important;
                text-align: center !important;
            }

            .topo-acoes {
                position: static !important;
                right: auto !important;
                top: auto !important;
                transform: none !important;
                width: 100% !important;
                display: flex !important;
                align-items: center !important;
                justify-content: center !important;
                gap: 7px !important;
                margin-top: 1px !important;
                flex-wrap: nowrap !important;
            }
        }

        @media (max-width: 480px) {
            .topo-titulo {
                font-size: 14px !important;
            }

            .topo-subtitulo {
                max-width: 290px !important;
            }

            .topo-acoes {
                gap: 6px !important;
            }
        }


        /* Mensagem exibida na hora do envio, antes da confirmação. */
        .msg.pendente .bolha {
            opacity: .78;
        }

        .msg.falhou .bolha {
            opacity: .6;
            outline: 1px dashed var(--erro);
            outline-offset: 2px;
        }

        .msg-estado {
            display: -webkit-box;
            display: flex;
            -webkit-box-align: center;
            align-items: center;
            -webkit-box-pack: end;
            justify-content: flex-end;
            flex-wrap: wrap;
        }

        .msg.falhou .msg-estado {
            color: var(--erro);
        }

        .reenviar {
            border: 0;
            padding: 0;
            margin: 0 0 0 4px;
            background: none;
            color: var(--roxo);
            font-size: inherit;
            font-weight: 700;
            text-decoration: underline;
            cursor: pointer;
        }

        html[data-theme="dark"] .reenviar {
            color: #c77dff;
        }

        /* ---------- Avisos de novas mensagens ---------- */

        .notif-toggle[hidden],
        .convite-notif[hidden] {
            display: none !important;
        }

        .notif-toggle.ativo {
            color: var(--roxo);
            background: rgba(145, 1, 210, .1);
        }

        html[data-theme="dark"] .notif-toggle.ativo {
            color: #d49bff;
            background: rgba(199, 125, 255, .16);
        }

        .notif-toggle.bloqueado {
            opacity: .55;
        }

        .modal-notif-icone {
            color: var(--roxo);
            background: rgba(145, 1, 210, .1);
        }

        #modalNotifTexto p {
            margin: 0 0 10px;
            line-height: 1.5;
        }

        #modalNotifTexto ol {
            margin: 0 0 6px;
            padding-left: 20px;
            line-height: 1.55;
        }

        .convite-notif {
            display: flex;
            align-items: center;
            gap: 12px;
            margin: 0 0 10px;
            padding: 11px 12px 11px 14px;
            border: 1px solid rgba(145, 1, 210, .22);
            border-radius: 16px;
            background: var(--superficie);
            box-shadow: var(--sombra);
            -webkit-animation: conviteEntrar .25s ease-out;
            animation: conviteEntrar .25s ease-out;
        }

        @-webkit-keyframes conviteEntrar {
            from { opacity: 0; -webkit-transform: translateY(8px); }
            to { opacity: 1; -webkit-transform: none; }
        }

        @keyframes conviteEntrar {
            from { opacity: 0; transform: translateY(8px); }
            to { opacity: 1; transform: none; }
        }

        .convite-notif-icone {
            flex: 0 0 auto;
            width: 38px;
            height: 38px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            background: linear-gradient(135deg, var(--roxo), var(--laranja));
        }

        .convite-notif-icone svg {
            width: 20px;
            height: 20px;
            fill: currentColor;
        }

        .convite-notif-texto {
            flex: 1 1 auto;
            min-width: 0;
            display: flex;
            flex-direction: column;
            font-size: 13px;
            line-height: 1.35;
        }

        .convite-notif-texto span {
            color: var(--texto-suave);
            font-size: 12px;
        }

        .convite-notif-acoes {
            flex: 0 0 auto;
            display: flex;
            gap: 6px;
        }

        .convite-btn {
            border: 1px solid var(--roxo);
            border-radius: 999px;
            padding: 8px 14px;
            background: var(--roxo);
            color: #fff;
            font-size: 13px;
            font-weight: 700;
            cursor: pointer;
            white-space: nowrap;
        }

        .convite-btn.secundario {
            border-color: var(--linha);
            background: transparent;
            color: var(--texto-suave);
            font-weight: 600;
        }

        @media (max-width: 640px) {
            .convite-notif {
                flex-wrap: wrap;
                gap: 10px;
            }

            .convite-notif-texto {
                flex-basis: calc(100% - 52px);
            }

            .convite-notif-acoes {
                width: 100%;
                justify-content: flex-end;
            }
        }

        /* Placeholder em uma linha só (no celular quebrava e ficava cortado). */
        #texto::placeholder {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        #texto::-webkit-input-placeholder {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        /* ------------------------------------------------------------------
           Menu de anexos (foto, vídeo, documento, localização)
           ------------------------------------------------------------------ */

        .anexo-menu {
            position: absolute;
            left: 0;
            bottom: calc(100% + 14px);
            width: min(250px, calc(100vw - 28px));
            padding: 8px;
            display: grid;
            gap: 2px;
            background: var(--branco);
            border: 1px solid var(--linha);
            border-radius: 18px;
            box-shadow: 0 16px 45px rgba(24, 24, 35, .16);
            z-index: 50;
        }

        .anexo-menu[hidden] {
            display: none;
        }

        .anexo-item {
            display: flex;
            align-items: center;
            gap: 12px;
            width: 100%;
            min-height: 46px;
            padding: 6px 10px;
            border: 0;
            border-radius: 12px;
            background: transparent;
            color: var(--texto);
            font: inherit;
            font-size: 14px;
            font-weight: 600;
            text-align: left;
            cursor: pointer;
        }

        .anexo-item:hover,
        .anexo-item:focus-visible {
            background: rgba(145, 1, 210, .07);
        }

        .anexo-icone {
            width: 34px;
            height: 34px;
            flex: 0 0 34px;
            display: grid;
            place-items: center;
            border-radius: 11px;
            color: var(--roxo);
            background: rgba(145, 1, 210, .09);
        }

        .anexo-icone svg {
            width: 19px;
            height: 19px;
            fill: currentColor;
        }

        html[data-theme="dark"] .anexo-menu {
            background: var(--superficie);
            color: var(--texto);
            border-color: var(--linha);
            box-shadow: var(--sombra);
        }

        html[data-theme="dark"] .anexo-item:hover,
        html[data-theme="dark"] .anexo-item:focus-visible {
            background: rgba(255, 255, 255, .07);
        }

        html[data-theme="dark"] .anexo-icone {
            background: rgba(255, 255, 255, .08);
        }

        /* ------------------------------------------------------------------
           Janela de localização e avisos
           ------------------------------------------------------------------ */

        .modal-local-icone {
            color: var(--roxo);
            background: rgba(145, 1, 210, .09);
        }

        .modal-local-mapa {
            display: inline-block;
            margin-top: 10px;
            color: var(--roxo);
            font-size: 13px;
            font-weight: 700;
            text-decoration: underline;
            text-underline-offset: 3px;
        }

        .modal-local-mapa[hidden] {
            display: none;
        }

        .modal-btn.principal {
            border-color: var(--roxo);
            background: var(--roxo);
            color: #ffffff;
        }

        html[data-theme="dark"] .modal-local-mapa {
            color: #d9a8f2;
        }

        .status.aviso {
            color: #b54708;
            font-weight: 600;
        }

        html[data-theme="dark"] .status.aviso {
            color: #fdb022;
        }

        .bolha a {
            overflow-wrap: anywhere;
        }


        /* ---------- Robô (mascote animado 2D) ---------- */

        .sr-only {
            position: absolute !important;
            width: 1px !important;
            height: 1px !important;
            padding: 0 !important;
            margin: -1px !important;
            overflow: hidden !important;
            clip: rect(0, 0, 0, 0) !important;
            white-space: nowrap !important;
            border: 0 !important;
        }

        .robo {
            display: block;
            flex: 0 0 auto;
            /* cor dos efeitos (Zzz, linhas de velocidade) acompanha o tema */
            color: var(--texto-suave);
            cursor: pointer;
            -webkit-user-select: none;
            user-select: none;
            /* dois toques no robô = carinho (sem dar zoom na página) */
            touch-action: manipulation;
            -webkit-tap-highlight-color: transparent;
        }

        .robo svg {
            display: block;
            overflow: visible;
        }

        /* Tela inicial: ocupa a área do antigo ícone de balão */
        .robo-grande {
            width: 120px;
            height: 150px;
            margin: 0 auto 10px;
        }

        /* Topo: no lugar do título e da linha informativa */
        .robo-mini {
            width: 46px;
            height: 46px;
            margin: 0 auto;
        }

        /* Robô do topo: escondido enquanto a tela inicial aparece; entra com
           um "pop" quando a conversa começa (o espaço fica reservado). */
        .robo-mini {
            transition: opacity .3s ease, transform .45s cubic-bezier(.34, 1.56, .64, 1);
        }

        .robo-mini.robo-escondido {
            opacity: 0;
            transform: scale(.3);
            pointer-events: none;
        }

        @media (prefers-reduced-motion: reduce) {
            .robo-mini {
                transition: none;
            }
        }

        .topo-textos {
            display: flex;
            align-items: center;
            justify-content: center;
        }

        @media (max-width: 640px) {
            .robo-mini {
                width: 42px !important;
                height: 42px !important;
            }

            .topo-info-linha {
                gap: 4px !important;
                padding-top: 5px !important;
            }
        }
