/* ============================== SompEnv — Design System ==============================
   Padrão (como a imagem de referência): moldura verde-petróleo escura (barra lateral, cabeçalhos,
   chamadas, login) + lista e conversa claras. Tema escuro completo em [data-theme="dark"].
   Sem estilos inline nas páginas (a CSP do app bloqueia style="" no HTML). */

@font-face {
    font-family: "Inter";
    src: url("../fonts/inter-latin-wght.woff2") format("woff2-variations"), url("../fonts/inter-latin-wght.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    /* marca */
    --somp-primary: #12b886;
    --somp-primary-dark: #0a8f68;
    --somp-primary-light: #3fe0a6;
    --somp-primary-ink: #ffffff;
    --somp-turquesa: #1fd1c1;
    --somp-gradiente: linear-gradient(135deg, #3fe0a6 0%, #12b886 50%, #0a8f78 100%);

    /* moldura escura (barra lateral, cabeçalho mobile, chamada, login) */
    --somp-chrome: #0a302c;
    --somp-chrome-2: #0e3d38;
    --somp-chrome-3: #155049;
    --somp-chrome-text: #e9fbf5;
    --somp-chrome-muted: #9cc7bd;
    --somp-chrome-border: rgba(255, 255, 255, .08);

    /* conteúdo (claro) */
    --somp-background: #e7eeec;
    --somp-background-2: #dfe8e6;
    --somp-surface: #ffffff;
    --somp-surface-2: #f2f6f5;
    --somp-surface-3: #e4eeeb;
    --somp-selecionado: #dcf4ec;
    --somp-text: #10201e;
    --somp-muted: #5c706d;
    --somp-faint: #8d9e9b;
    --somp-border: rgba(10, 50, 45, .09);
    --somp-border-strong: rgba(10, 50, 45, .17);
    --somp-success: #12b886;
    --somp-danger: #f0444f;
    --somp-warning: #e89a1c;
    --somp-info: #1a9fd9;

    --somp-chat-fundo: #edf2f0;
    --somp-chat-padrao: rgba(10, 70, 60, .055);
    --somp-bolha-minha: #d5f5e5;
    --somp-bolha-minha-texto: #0d2a22;
    --somp-bolha-minha-meta: rgba(13, 42, 34, .5);
    --somp-bolha-outra: #ffffff;
    --somp-lido: #14a3e0;
    --somp-glass: rgba(255, 255, 255, .82);
    --somp-glow: 0 0 0 1px rgba(18, 184, 134, .25), 0 8px 30px rgba(18, 184, 134, .14);
    --somp-shadow: 0 16px 44px rgba(8, 40, 36, .16);
    --somp-shadow-sm: 0 1px 2px rgba(8, 40, 36, .1), 0 2px 8px rgba(8, 40, 36, .05);
    --somp-radius: 18px;
    --somp-radius-md: 14px;
    --somp-radius-sm: 10px;
    --somp-trans: .18s cubic-bezier(.2, .7, .2, 1);
    --somp-fonte: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --somp-background: #061114;
    --somp-background-2: #08171b;
    --somp-surface: #0c1d22;
    --somp-surface-2: #11282e;
    --somp-surface-3: #173339;
    --somp-selecionado: #16363a;
    --somp-text: #e4f3f0;
    --somp-muted: #8aa6a3;
    --somp-faint: #5f7b79;
    --somp-border: rgba(150, 230, 215, .1);
    --somp-border-strong: rgba(150, 230, 215, .2);
    --somp-chat-fundo: #071418;
    --somp-chat-padrao: rgba(150, 230, 215, .05);
    --somp-bolha-minha: #0f5e50;
    --somp-bolha-minha-texto: #eafff8;
    --somp-bolha-minha-meta: rgba(234, 255, 248, .6);
    --somp-bolha-outra: #13292f;
    --somp-lido: #5fd8ff;
    --somp-glass: rgba(12, 29, 34, .8);
    --somp-shadow: 0 16px 44px rgba(0, 0, 0, .5);
    --somp-shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 8px rgba(0, 0, 0, .2);
    --somp-chrome: #061c1a;
    --somp-chrome-2: #0a2724;
    --somp-chrome-3: #10352f;
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--somp-fonte);
    font-size: 15px;
    line-height: 1.45;
    color: var(--somp-text);
    background: var(--somp-background);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--somp-primary-dark); }
[hidden] { display: none !important; }
img { max-width: 100%; }

:focus-visible { outline: 2px solid var(--somp-primary); outline-offset: 2px; border-radius: 6px; }

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

.ico {
    width: 20px; height: 20px; flex-shrink: 0;
    fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.ico-sm { width: 16px; height: 16px; }
.ico-lg { width: 26px; height: 26px; }
.girar { animation: girar 1s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--somp-border-strong); border-radius: 9px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: var(--somp-border-strong) transparent; }

/* Wordmark: "Somp" + "Env" verde */
.marca { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.marca img { width: 40px; height: 40px; filter: drop-shadow(0 4px 14px rgba(18, 184, 134, .4)); }
.marca strong { font-size: 22px; font-weight: 800; letter-spacing: -.03em; }
.marca strong em { font-style: normal; background: var(--somp-gradiente); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Botões ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
    font-weight: 600; font-size: 14.5px; text-decoration: none; white-space: nowrap;
    transition: transform var(--somp-trans), background var(--somp-trans), box-shadow var(--somp-trans), border-color var(--somp-trans);
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primario { background: var(--somp-gradiente); color: #fff; box-shadow: 0 6px 18px rgba(18, 184, 134, .3); }
.btn-primario:hover:not(:disabled) { box-shadow: 0 8px 26px rgba(18, 184, 134, .42); }
.btn-secundario { background: var(--somp-surface-2); border-color: var(--somp-border-strong); color: var(--somp-text); }
.btn-secundario:hover:not(:disabled) { background: var(--somp-surface-3); }
.btn-perigo { background: rgba(240, 68, 79, .1); border-color: rgba(240, 68, 79, .35); color: var(--somp-danger); }
.btn-perigo:hover:not(:disabled) { background: rgba(240, 68, 79, .18); }
.btn-fantasma { background: transparent; color: var(--somp-muted); }
.btn-fantasma:hover:not(:disabled) { background: var(--somp-surface-2); color: var(--somp-text); }
.btn-bloco { width: 100%; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }

.btn-icone {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--somp-muted);
    transition: background var(--somp-trans), color var(--somp-trans), transform var(--somp-trans);
    position: relative; flex-shrink: 0;
}
.btn-icone:hover { background: var(--somp-surface-2); color: var(--somp-text); }
.btn-icone.ativo { color: var(--somp-primary); background: rgba(18, 184, 134, .1); }
.btn-icone:disabled { opacity: .45; cursor: not-allowed; }
.btn-mais { background: var(--somp-surface-2); color: var(--somp-primary-dark); border: 1px solid var(--somp-border); }

/* ---------- Formulários ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.campo label, .rotulo-campo { font-size: 13px; font-weight: 600; color: var(--somp-muted); }
.campo small { color: var(--somp-faint); font-size: 12.5px; }
.entrada {
    width: 100%; min-height: 46px; padding: 11px 14px; border-radius: 12px;
    background: var(--somp-surface-2); border: 1px solid var(--somp-border-strong); color: var(--somp-text);
    transition: border-color var(--somp-trans), box-shadow var(--somp-trans), background var(--somp-trans);
}
.entrada::placeholder { color: var(--somp-faint); }
.entrada:focus { outline: none; border-color: var(--somp-primary); box-shadow: 0 0 0 3px rgba(18, 184, 134, .16); background: var(--somp-surface); }
textarea.entrada { resize: vertical; min-height: 90px; }
.entrada-prefixo { position: relative; }
.entrada-prefixo > span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--somp-primary); font-weight: 700; pointer-events: none; }
.entrada-prefixo .entrada { padding-left: 32px; }
.entrada-senha { position: relative; }
.entrada-senha .entrada { padding-right: 48px; }
.entrada-senha .btn-icone { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); }
select.entrada {
    appearance: none; padding-right: 36px; background-repeat: no-repeat; background-size: 5px 5px;
    background-image: linear-gradient(45deg, transparent 50%, var(--somp-muted) 50%), linear-gradient(135deg, var(--somp-muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
}

.chave { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.chave input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chave .trilho { width: 42px; height: 24px; border-radius: 24px; background: var(--somp-surface-3); position: relative; transition: background var(--somp-trans); flex-shrink: 0; border: 1px solid var(--somp-border-strong); }
.chave .trilho::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform var(--somp-trans); }
.chave input:checked + .trilho { background: var(--somp-primary); border-color: var(--somp-primary); }
.chave input:checked + .trilho::after { transform: translateX(18px); }
.chave input:focus-visible + .trilho { outline: 2px solid var(--somp-primary); outline-offset: 2px; }

.alerta { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 14px; background: var(--somp-surface-2); border: 1px solid var(--somp-border-strong); }
.alerta-erro { background: rgba(240, 68, 79, .08); border-color: rgba(240, 68, 79, .35); color: #b4202c; }
.alerta-sucesso { background: rgba(18, 184, 134, .1); border-color: rgba(18, 184, 134, .35); color: #08704f; }
.alerta-aviso { background: rgba(232, 154, 28, .1); border-color: rgba(232, 154, 28, .35); color: #8a5800; }
:root[data-theme="dark"] .alerta-erro, .auth .alerta-erro { color: #ffb3b9; }
:root[data-theme="dark"] .alerta-sucesso, .auth .alerta-sucesso { color: #9ff3d0; }
:root[data-theme="dark"] .alerta-aviso, .auth .alerta-aviso { color: #ffd38f; }

/* ---------- Telas de acesso (login, cadastro, recuperação): moldura escura da marca ---------- */
.auth {
    --somp-surface-2: rgba(255, 255, 255, .06);
    --somp-surface: rgba(255, 255, 255, .09);
    --somp-surface-3: rgba(255, 255, 255, .14);
    --somp-text: var(--somp-chrome-text);
    --somp-muted: var(--somp-chrome-muted);
    --somp-faint: #6f9a91;
    --somp-border: rgba(255, 255, 255, .09);
    --somp-border-strong: rgba(255, 255, 255, .16);
    color-scheme: dark;
    min-height: 100%; display: grid; grid-template-columns: 1.1fr 1fr; color: var(--somp-text);
    background:
        radial-gradient(900px 600px at 12% 8%, rgba(63, 224, 166, .18), transparent 60%),
        radial-gradient(800px 600px at 95% 100%, rgba(31, 209, 193, .14), transparent 60%),
        linear-gradient(160deg, #0c3a35 0%, #072522 55%, #041816 100%);
}
.auth a { color: var(--somp-primary-light); }
.auth-vitrine { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; padding: 56px clamp(32px, 6vw, 88px); }
.auth-vitrine::before {
    content: ""; position: absolute; inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
    background-size: 44px 44px; mask-image: radial-gradient(circle at 30% 40%, #000 0%, transparent 70%);
}
.auth-vitrine .marca { position: relative; }
.auth-vitrine .marca img { width: 64px; height: 64px; }
.auth-vitrine .marca strong { font-size: 44px; }
.auth-vitrine .marca-slogan { position: relative; color: var(--somp-chrome-muted); font-size: 18px; margin: 6px 0 0 76px; }
.auth-vitrine h1 { position: relative; font-size: clamp(28px, 3vw, 40px); line-height: 1.12; letter-spacing: -.03em; margin: 40px 0 14px; max-width: 560px; font-weight: 700; }
.auth-vitrine h1 span { display: block; background: var(--somp-gradiente); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-vitrine p.lead { position: relative; color: var(--somp-chrome-muted); font-size: 16.5px; max-width: 500px; margin: 0 0 30px; }
.auth-recursos { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 540px; padding: 0; margin: 0; list-style: none; }
.auth-recursos li { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border-radius: var(--somp-radius-md); background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); backdrop-filter: blur(10px); }
.auth-recursos li b { display: block; font-size: 14.5px; }
.auth-recursos li small { color: var(--somp-chrome-muted); font-size: 13px; }
.auth-recursos .ico { color: var(--somp-primary-light); width: 26px; height: 26px; margin-top: 2px; }
.auth-form-lado { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.cartao {
    width: 100%; max-width: 430px; padding: 34px 32px; border-radius: 24px;
    background: rgba(8, 36, 33, .72); border: 1px solid rgba(255, 255, 255, .12); backdrop-filter: blur(18px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}
.cartao h2 { margin: 0 0 4px; font-size: 24px; letter-spacing: -.02em; }
.cartao .sub { margin: 0 0 24px; color: var(--somp-muted); font-size: 14.5px; }
.cartao .rodape-form { margin-top: 18px; text-align: center; font-size: 14px; color: var(--somp-muted); }
.cartao .rodape-form a { font-weight: 600; text-decoration: none; }
.cartao .linha-acoes { display: flex; justify-content: flex-end; margin: -4px 0 16px; font-size: 13.5px; }
.cartao .linha-acoes a { text-decoration: none; }
.cartao .entrada:focus { background: rgba(255, 255, 255, .09); }
.marca-mobile { display: none; margin-bottom: 22px; }
.selo-e2e { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 20px; font-size: 12.5px; color: var(--somp-faint); }
.selo-e2e .ico { width: 14px; height: 14px; color: var(--somp-primary); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.username-status { font-size: 12.5px; min-height: 18px; }
.username-status.ok { color: var(--somp-primary-light); }
.username-status.erro { color: #ff8f98; }

@media (max-width: 900px) {
    .auth { grid-template-columns: 1fr; }
    .auth-vitrine { display: none; }
    .marca-mobile { display: inline-flex; }
    .cartao { padding: 28px 22px; border-radius: 20px; }
}

/* ============================== Aplicativo ============================== */
body.app { overflow: hidden; background: var(--somp-chrome); }
.app-shell {
    height: 100vh; height: 100dvh; display: grid;
    grid-template-columns: 248px minmax(300px, 370px) 1fr auto;
    grid-template-areas: "rail lateral principal gaveta";
}

/* ---------- Barra lateral escura (desktop): marca, perfil e menu com rótulos ---------- */
.rail {
    grid-area: rail; display: flex; flex-direction: column; gap: 4px; padding: 18px 14px 16px; min-height: 0;
    background: linear-gradient(180deg, var(--somp-chrome-2) 0%, var(--somp-chrome) 100%); color: var(--somp-chrome-text);
}
.rail .marca { padding: 0 6px 18px; }
.rail .marca img { width: 34px; height: 34px; }
.rail .marca strong { font-size: 21px; color: #fff; }
.rail-perfil {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; margin-bottom: 14px; border-radius: 16px; border: 0; text-align: left;
    background: rgba(255, 255, 255, .05); color: inherit; transition: background var(--somp-trans);
}
.rail-perfil:hover { background: rgba(255, 255, 255, .09); }
.rail-perfil .txt { min-width: 0; }
.rail-perfil b { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-perfil small { display: block; color: var(--somp-chrome-muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-perfil .status { display: flex; align-items: center; gap: 5px; color: var(--somp-primary-light); font-size: 12px; }
.rail-perfil .status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--somp-primary-light); box-shadow: 0 0 8px var(--somp-primary-light); }
.rail-btn {
    display: flex; align-items: center; gap: 14px; width: 100%; height: 46px; padding: 0 14px; border-radius: 12px; border: 0;
    background: transparent; color: var(--somp-chrome-muted); font-weight: 600; font-size: 14.5px; text-align: left; position: relative;
    transition: background var(--somp-trans), color var(--somp-trans);
}
.rail-btn .ico { width: 21px; height: 21px; }
.rail-btn:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.rail-btn.ativo { color: #fff; background: linear-gradient(90deg, rgba(63, 224, 166, .28), rgba(18, 184, 134, .14)); box-shadow: inset 0 0 0 1px rgba(63, 224, 166, .18); }
.rail-btn.ativo .ico { color: var(--somp-primary-light); }
.rail-btn .rotulo { flex: 1; }
.rail-espaco { flex: 1; }
.rail-rodape { border-top: 1px solid var(--somp-chrome-border); padding-top: 10px; display: grid; gap: 2px; }
.badge {
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--somp-primary); color: #fff;
    font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.badge-perigo { background: var(--somp-danger); }

/* ---------- Avatares ---------- */
.avatar {
    width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0; position: relative;
    display: inline-flex; align-items: center; justify-content: center; overflow: hidden;
    font-weight: 700; font-size: 16px; color: #fff; letter-spacing: .01em;
    background: linear-gradient(135deg, hsl(var(--h, 160) 55% 48%), hsl(calc(var(--h, 160) + 25) 60% 32%));
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar .ico { width: 55%; height: 55%; }
.avatar-sm { width: 36px; height: 36px; font-size: 13px; }
.avatar-lg { width: 96px; height: 96px; font-size: 32px; }
.avatar-xl { width: 128px; height: 128px; font-size: 42px; }
.avatar-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.ponto-online { position: absolute; right: 1px; bottom: 1px; width: 12px; height: 12px; border-radius: 50%; background: var(--somp-primary); box-shadow: 0 0 0 2.5px var(--somp-surface); }

/* ---------- Painel da lista (claro) ---------- */
.lateral { grid-area: lateral; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--somp-surface); border-right: 1px solid var(--somp-border); }
.lateral-topo { display: flex; align-items: center; justify-content: space-between; padding: 18px 14px 6px 20px; }
.lateral-topo h1 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.lateral-topo .acoes { display: flex; gap: 4px; }
.lateral-busca { display: flex; align-items: center; gap: 8px; margin: 8px 14px 10px 16px; }
.busca { position: relative; flex: 1; }
.busca .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--somp-faint); width: 18px; height: 18px; pointer-events: none; }
.busca input { width: 100%; height: 42px; border-radius: 21px; border: 1px solid transparent; padding: 0 14px 0 42px; background: var(--somp-surface-2); color: var(--somp-text); }
.busca input:focus { outline: none; border-color: var(--somp-primary); background: var(--somp-surface); box-shadow: 0 0 0 3px rgba(18, 184, 134, .14); }
.filtros { display: flex; gap: 6px; padding: 0 16px 8px; overflow-x: auto; scrollbar-width: none; }
.filtros::-webkit-scrollbar { display: none; }
.filtros button {
    border: 1px solid var(--somp-border-strong); background: transparent; color: var(--somp-muted); border-radius: 20px;
    padding: 5px 13px; font-size: 13px; font-weight: 600; white-space: nowrap; transition: all var(--somp-trans);
}
.filtros button:hover { color: var(--somp-text); background: var(--somp-surface-2); }
.filtros button[aria-selected="true"] { background: var(--somp-selecionado); border-color: rgba(18, 184, 134, .45); color: var(--somp-primary-dark); }
:root[data-theme="dark"] .filtros button[aria-selected="true"] { color: var(--somp-primary-light); }
.lateral-conteudo { flex: 1; overflow-y: auto; padding: 0 0 16px; min-height: 0; }
.secao-titulo { padding: 14px 20px 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--somp-faint); }

.item {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 16px 11px 18px; border: 0; border-bottom: 1px solid var(--somp-border);
    background: transparent; text-align: left; color: var(--somp-text); position: relative; transition: background var(--somp-trans);
}
.item:hover { background: var(--somp-surface-2); }
.item.ativo { background: var(--somp-selecionado); }
.item-corpo { flex: 1; min-width: 0; }
.item-linha { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.item-linha + .item-linha { margin-top: 2px; }
.item-nome { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; min-width: 0; }
.item-nome .ico { width: 15px; height: 15px; color: var(--somp-faint); }
.item-hora { font-size: 12px; color: var(--somp-faint); white-space: nowrap; }
.item-hora.destaque { color: var(--somp-primary); font-weight: 600; }
.item-previa { font-size: 13.5px; color: var(--somp-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; display: flex; align-items: center; gap: 4px; }
.item-previa .ico { width: 15px; height: 15px; }
.item-previa b { color: var(--somp-text); font-weight: 600; }
.item-previa.digitando { color: var(--somp-primary); font-style: italic; }
.item-sub { font-size: 13px; color: var(--somp-muted); }
.item-acoes { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.tique { display: inline-flex; color: var(--somp-faint); }
.tique .ico { width: 16px; height: 16px; }
.tique.lido { color: var(--somp-lido); }

.vazio-lista { text-align: center; color: var(--somp-muted); padding: 40px 24px; font-size: 14px; }
.vazio-lista .ico { width: 42px; height: 42px; color: var(--somp-faint); margin-bottom: 10px; }
.vazio-lista strong { display: block; color: var(--somp-text); font-size: 15.5px; margin-bottom: 4px; }

/* ---------- Área principal ---------- */
.principal { grid-area: principal; display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; background: var(--somp-chat-fundo); }
.tela-vazia { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px; background: radial-gradient(600px 400px at 50% 42%, rgba(18, 184, 134, .1), transparent 65%); }
.tela-vazia img { width: 96px; height: 96px; filter: drop-shadow(0 12px 30px rgba(18, 184, 134, .35)); }
.tela-vazia h2 { font-size: 30px; margin: 20px 0 6px; letter-spacing: -.03em; }
.tela-vazia p { color: var(--somp-muted); max-width: 440px; margin: 0; }
.tela-vazia .selo-e2e { margin-top: 34px; }

.conversa { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.conversa-topo {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 18px; min-height: 68px;
    background: var(--somp-surface); border-bottom: 1px solid var(--somp-border); position: relative; z-index: 3;
}
.conversa-topo .info { flex: 1; min-width: 0; cursor: pointer; border: 0; background: none; text-align: left; padding: 0; color: inherit; }
.conversa-topo .nome { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.conversa-topo .sub { font-size: 13px; color: var(--somp-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 5px; }
.conversa-topo .sub.online { color: var(--somp-primary-dark); }
.conversa-topo .sub.online::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--somp-primary); }
:root[data-theme="dark"] .conversa-topo .sub.online { color: var(--somp-primary-light); }
.conversa-topo .sub.digitando { color: var(--somp-primary); }
.conversa-topo .acoes { display: flex; gap: 2px; }
.conversa-topo .acoes .btn-icone { color: var(--somp-text); }
.btn-voltar { display: none; }

.mensagens {
    flex: 1; overflow-y: auto; padding: 18px clamp(12px, 4vw, 56px) 12px; min-height: 0; position: relative;
    background-color: var(--somp-chat-fundo);
    background-image: radial-gradient(circle at 1px 1px, var(--somp-chat-padrao) 1.2px, transparent 0);
    background-size: 22px 22px;
}
.aviso-cripto {
    display: flex; align-items: center; gap: 8px; max-width: 520px; margin: 4px auto 18px; padding: 9px 14px; border-radius: 12px; justify-content: center; text-align: center;
    background: #fff6dd; border: 1px solid rgba(232, 154, 28, .25); color: #7a5300; font-size: 12.5px;
}
:root[data-theme="dark"] .aviso-cripto { background: rgba(232, 154, 28, .08); color: #f3cf8f; }
.aviso-cripto .ico { width: 15px; height: 15px; flex-shrink: 0; }
.sep-data { display: flex; justify-content: center; margin: 14px 0; position: sticky; top: 0; z-index: 1; }
.sep-data span { font-size: 12px; font-weight: 600; color: var(--somp-muted); background: var(--somp-surface); padding: 5px 12px; border-radius: 10px; box-shadow: var(--somp-shadow-sm); }
.msg-sistema { text-align: center; margin: 10px 0; }
.msg-sistema span { font-size: 12.5px; color: var(--somp-muted); background: var(--somp-surface); padding: 5px 12px; border-radius: 10px; display: inline-block; box-shadow: var(--somp-shadow-sm); }
.carregar-antigas { display: flex; justify-content: center; padding: 6px 0 12px; }

.msg { display: flex; align-items: flex-end; gap: 8px; margin: 2px 0; position: relative; }
.msg.minha { justify-content: flex-end; }
.msg + .msg:not(.seguida) { margin-top: 10px; }
.msg .avatar-msg { width: 32px; height: 32px; font-size: 12px; align-self: flex-start; }
.msg.seguida .avatar-msg { visibility: hidden; }
.bolha {
    max-width: min(560px, 76%); padding: 7px 10px 6px 12px; border-radius: 14px; position: relative;
    background: var(--somp-bolha-outra); box-shadow: var(--somp-shadow-sm); word-wrap: break-word; overflow-wrap: anywhere; animation: entrar .22s ease-out;
}
.msg.minha .bolha { background: var(--somp-bolha-minha); color: var(--somp-bolha-minha-texto); }
.msg.outra:not(.seguida) .bolha { border-top-left-radius: 4px; }
.msg.minha:not(.seguida) .bolha { border-top-right-radius: 4px; }
.msg.destaque .bolha { box-shadow: 0 0 0 2px var(--somp-primary), var(--somp-glow); }
@keyframes entrar { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.bolha .autor { font-size: 12.5px; font-weight: 700; margin-bottom: 2px; color: hsl(var(--h, 160) 60% 34%); }
:root[data-theme="dark"] .bolha .autor { color: hsl(var(--h, 160) 70% 66%); }
.bolha .texto { white-space: pre-wrap; font-size: 14.8px; }
.bolha .texto a { color: var(--somp-info); text-decoration: underline; text-underline-offset: 2px; }
.bolha .texto.so-emoji { font-size: 38px; line-height: 1.15; }
.bolha .rodape { display: flex; align-items: center; justify-content: flex-end; gap: 4px; font-size: 11px; color: var(--somp-faint); margin-top: 2px; float: right; margin-left: 12px; position: relative; top: 4px; }
.msg.minha .bolha .rodape { color: var(--somp-bolha-minha-meta); }
.bolha .rodape .tique.lido { color: var(--somp-lido); }
.bolha .encaminhada { font-size: 12px; color: var(--somp-muted); font-style: italic; display: flex; align-items: center; gap: 4px; margin-bottom: 2px; }
.msg.minha .bolha .encaminhada { color: var(--somp-bolha-minha-meta); }
.bolha .encaminhada .ico { width: 13px; height: 13px; }
.bolha .citacao {
    display: block; width: 100%; text-align: left; border: 0; margin: 2px 0 6px; padding: 6px 10px; border-radius: 8px;
    background: rgba(10, 50, 45, .06); border-left: 3px solid var(--somp-primary); color: inherit; font-size: 13px;
}
:root[data-theme="dark"] .bolha .citacao { background: rgba(0, 0, 0, .2); }
.bolha .citacao b { display: block; font-size: 12.5px; color: var(--somp-primary-dark); }
:root[data-theme="dark"] .bolha .citacao b { color: var(--somp-primary-light); }
.bolha .citacao span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .8; }
.bolha .apagada { font-style: italic; color: var(--somp-muted); display: flex; align-items: center; gap: 6px; font-size: 14px; }
.msg.minha .bolha .apagada { color: var(--somp-bolha-minha-meta); }
.bolha .apagada .ico { width: 15px; height: 15px; }
.bolha .sem-chave { font-size: 13px; color: var(--somp-warning); display: flex; gap: 6px; align-items: center; }
.bolha .sem-chave .ico { width: 15px; height: 15px; }
.bolha .menu-msg {
    position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 8px; border: 0; opacity: 0;
    background: var(--somp-glass); color: var(--somp-text); display: flex; align-items: center; justify-content: center; transition: opacity var(--somp-trans);
}
.bolha:hover .menu-msg, .bolha:focus-within .menu-msg, .menu-msg:focus-visible { opacity: 1; }
.bolha .menu-msg .ico { width: 16px; height: 16px; }
.reacoes { display: flex; gap: 3px; position: absolute; bottom: -14px; right: 10px; z-index: 1; }
.msg.outra .reacoes { right: auto; left: 50px; }
.reacoes span { background: var(--somp-surface); border: 1px solid var(--somp-border-strong); border-radius: 12px; padding: 0 6px; font-size: 13px; line-height: 22px; box-shadow: var(--somp-shadow-sm); }
.msg.tem-reacao { margin-bottom: 14px; }
.verificacao-falhou { color: var(--somp-danger); font-size: 12px; display: flex; gap: 5px; align-items: center; margin-top: 4px; }
.verificacao-falhou .ico { width: 14px; height: 14px; }

/* ---------- Mídia dentro das mensagens ---------- */
.midia { margin: 2px -6px 4px; border-radius: 10px; overflow: hidden; position: relative; background: rgba(10, 50, 45, .08); min-width: 220px; }
.midia img, .midia video { display: block; width: 100%; max-height: 360px; object-fit: cover; cursor: zoom-in; }
.midia video { cursor: default; object-fit: contain; background: #000; }
.midia-carregando { display: flex; align-items: center; justify-content: center; gap: 8px; height: 180px; color: var(--somp-muted); font-size: 13px; }
.doc {
    display: flex; align-items: center; gap: 12px; padding: 10px; margin: 2px -4px 4px; border-radius: 10px; min-width: 240px;
    background: rgba(10, 50, 45, .05); border: 1px solid var(--somp-border); color: inherit; text-decoration: none; width: calc(100% + 8px); text-align: left;
}
:root[data-theme="dark"] .doc { background: rgba(0, 0, 0, .18); }
.doc .doc-ico { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: rgba(18, 184, 134, .14); color: var(--somp-primary-dark); flex-shrink: 0; }
:root[data-theme="dark"] .doc .doc-ico { color: var(--somp-primary-light); }
.doc .doc-ico.pdf { background: rgba(240, 68, 79, .12); color: var(--somp-danger); }
.doc .doc-nome { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc small { color: var(--somp-muted); font-size: 12px; }
.msg.minha .doc small { color: var(--somp-bolha-minha-meta); }
.doc > div { min-width: 0; flex: 1; }

/* Player de áudio */
.audio-player { display: flex; align-items: center; gap: 10px; min-width: 250px; padding: 4px 2px 2px; }
.audio-player .play { width: 40px; height: 40px; border-radius: 50%; border: 0; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--somp-primary); color: #fff; }
.audio-player .play .ico { width: 18px; height: 18px; fill: currentColor; }
.audio-player .trilha { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.audio-player .ondas { display: flex; align-items: center; gap: 2px; height: 26px; cursor: pointer; }
.audio-player .ondas i { flex: 1; min-width: 2px; border-radius: 2px; background: currentColor; opacity: .28; transition: opacity .1s; }
.audio-player .ondas i.tocado { opacity: 1; color: var(--somp-primary); }
.audio-player .tempo { font-size: 11.5px; opacity: .7; }
.audio-player .velocidade { border: 1px solid var(--somp-border-strong); background: transparent; border-radius: 10px; font-size: 11.5px; font-weight: 700; padding: 2px 7px; color: inherit; opacity: .8; }

/* ---------- Composer (campo de mensagem) ---------- */
.composer { position: relative; padding: 10px 16px 12px; background: var(--somp-chat-fundo); }
.composer-linha { display: flex; align-items: flex-end; gap: 8px; }
.composer-caixa {
    flex: 1; display: flex; align-items: flex-end; gap: 2px; background: var(--somp-surface); border: 1px solid var(--somp-border);
    border-radius: 24px; padding: 3px 6px; min-height: 48px; box-shadow: var(--somp-shadow-sm); transition: border-color var(--somp-trans), box-shadow var(--somp-trans);
}
.composer-caixa:focus-within { border-color: rgba(18, 184, 134, .55); box-shadow: 0 0 0 3px rgba(18, 184, 134, .12); }
.composer textarea { flex: 1; border: 0; background: transparent; resize: none; padding: 11px 6px; max-height: 150px; min-height: 42px; line-height: 1.4; }
.composer textarea:focus { outline: none; }
.btn-enviar {
    width: 48px; height: 48px; border-radius: 50%; border: 0; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    background: var(--somp-gradiente); color: #fff; box-shadow: 0 6px 18px rgba(18, 184, 134, .35); transition: transform var(--somp-trans);
}
.btn-enviar:hover { transform: scale(1.05); }
.btn-enviar:active { transform: scale(.95); }
.btn-enviar.gravando { background: var(--somp-danger); box-shadow: 0 6px 18px rgba(240, 68, 79, .35); }
.responder-barra { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; padding: 8px 8px 8px 12px; border-radius: 12px; background: var(--somp-surface); border-left: 3px solid var(--somp-primary); box-shadow: var(--somp-shadow-sm); }
.responder-barra div { flex: 1; min-width: 0; font-size: 13px; }
.responder-barra b { display: block; color: var(--somp-primary-dark); font-size: 12.5px; }
:root[data-theme="dark"] .responder-barra b { color: var(--somp-primary-light); }
.responder-barra span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--somp-muted); }
.impedimento { padding: 16px; text-align: center; color: var(--somp-muted); font-size: 14px; background: var(--somp-surface); border-top: 1px solid var(--somp-border); }
.progresso-envio { position: absolute; left: 0; top: 0; height: 2px; background: var(--somp-primary); box-shadow: 0 0 10px var(--somp-primary); transition: width .2s; }

/* Gravador de áudio */
.gravador { flex: 1; display: flex; align-items: center; gap: 12px; padding: 0 8px 0 14px; min-height: 48px; background: var(--somp-surface); border-radius: 24px; border: 1px solid rgba(240, 68, 79, .35); box-shadow: var(--somp-shadow-sm); }
.gravador .ponto { width: 10px; height: 10px; border-radius: 50%; background: var(--somp-danger); animation: pulsar 1.2s infinite; flex-shrink: 0; }
.gravador.pausado .ponto { animation: none; opacity: .4; }
.gravador .tempo { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 46px; }
.gravador .rotulo { color: var(--somp-muted); font-size: 13.5px; }
.rail .rail-btn.ativo .rotulo { color: #fff; }
.gravador .nivel { flex: 1; height: 4px; border-radius: 4px; background: var(--somp-surface-3); overflow: hidden; }
.gravador .nivel i { display: block; height: 100%; width: 0; background: var(--somp-danger); transition: width .08s; }
@keyframes pulsar { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }

/* Popovers (anexos, emojis, menus) */
.popover { position: absolute; z-index: 30; background: var(--somp-surface); border: 1px solid var(--somp-border); border-radius: 16px; box-shadow: var(--somp-shadow); padding: 8px; animation: surgir .16s ease-out; }
@keyframes surgir { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.menu-anexos { bottom: 72px; left: 16px; display: grid; gap: 2px; min-width: 220px; }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--somp-text); text-align: left; font-size: 14px; }
.menu-item:hover, .menu-item:focus-visible { background: var(--somp-surface-2); }
.menu-item.perigo { color: var(--somp-danger); }
.menu-item .bola { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; }
.menu-item .bola .ico { width: 18px; height: 18px; }
.bola-doc { background: linear-gradient(135deg, #8a6bff, #5b3fd6); }
.bola-midia { background: linear-gradient(135deg, #3aa0ff, #1561d6); }
.bola-camera { background: linear-gradient(135deg, #ff5a8a, #d6245c); }
.bola-audio { background: linear-gradient(135deg, #ffa24a, #e0671b); }
.menu-flutuante { min-width: 210px; display: grid; gap: 1px; }
.menu-flutuante .menu-item { padding: 9px 12px; }
.menu-flutuante .menu-item .ico { width: 18px; height: 18px; color: var(--somp-muted); }
.menu-flutuante .menu-item.perigo .ico { color: var(--somp-danger); }
.menu-flutuante hr { border: 0; border-top: 1px solid var(--somp-border); margin: 4px 0; }
.reacoes-rapidas { display: flex; gap: 2px; padding: 2px 4px 6px; border-bottom: 1px solid var(--somp-border); margin-bottom: 4px; }
.reacoes-rapidas button { border: 0; background: transparent; font-size: 22px; width: 38px; height: 38px; border-radius: 10px; transition: transform .12s; }
.reacoes-rapidas button:hover { background: var(--somp-surface-2); transform: scale(1.15); }

.emojis { bottom: 72px; right: 72px; width: 340px; max-width: calc(100vw - 28px); padding: 0; overflow: hidden; }
.emojis-abas { display: flex; border-bottom: 1px solid var(--somp-border); padding: 4px; gap: 2px; }
.emojis-abas button { flex: 1; border: 0; background: transparent; font-size: 18px; padding: 6px 0; border-radius: 8px; opacity: .55; }
.emojis-abas button[aria-selected="true"] { opacity: 1; background: var(--somp-surface-2); }
.emojis-grade { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px; max-height: 260px; overflow-y: auto; }
.emojis-grade button { border: 0; background: transparent; font-size: 22px; height: 38px; border-radius: 8px; }
.emojis-grade button:hover { background: var(--somp-surface-2); }

/* ---------- Gaveta (informações do contato/grupo) ---------- */
.gaveta { grid-area: gaveta; width: 380px; display: flex; flex-direction: column; min-height: 0; background: var(--somp-surface); border-left: 1px solid var(--somp-border); animation: deslizar .2s ease-out; }
@keyframes deslizar { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.gaveta-topo { display: flex; align-items: center; gap: 8px; padding: 14px 12px 14px 18px; border-bottom: 1px solid var(--somp-border); min-height: 68px; }
.gaveta-topo h2 { margin: 0; font-size: 17px; flex: 1; }
.gaveta-corpo { flex: 1; overflow-y: auto; padding: 0 0 24px; background: var(--somp-surface-2); }
.perfil-cabeca { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 28px 20px 20px; gap: 4px; background: var(--somp-surface); }
.perfil-cabeca h3 { margin: 12px 0 0; font-size: 21px; letter-spacing: -.01em; }
.perfil-cabeca .username { color: var(--somp-primary-dark); font-weight: 600; }
:root[data-theme="dark"] .perfil-cabeca .username { color: var(--somp-primary-light); }
.perfil-cabeca .presenca { color: var(--somp-muted); font-size: 13.5px; }
.perfil-acoes { display: flex; justify-content: center; gap: 10px; padding: 0 16px 20px; background: var(--somp-surface); }
.perfil-acoes .btn-acao {
    display: flex; flex-direction: column; align-items: center; gap: 6px; width: 86px; padding: 12px 6px; border-radius: 14px;
    background: var(--somp-surface-2); border: 1px solid var(--somp-border); color: var(--somp-primary); font-size: 12.5px; font-weight: 600;
}
.perfil-acoes .btn-acao:hover { background: var(--somp-selecionado); }
.perfil-acoes .btn-acao span { color: var(--somp-text); }
.bloco { margin: 10px 12px; padding: 2px 0; background: var(--somp-surface); border: 1px solid var(--somp-border); border-radius: var(--somp-radius-md); }
.bloco-texto { padding: 12px 16px; font-size: 14px; }
.bloco-texto small { display: block; color: var(--somp-muted); font-size: 12.5px; margin-bottom: 3px; }
.bloco .item { border-bottom: 0; }
.bloco .menu-item { border-radius: 0; padding: 13px 16px; }
.bloco .menu-item:first-child { border-radius: 14px 14px 0 0; }
.bloco .menu-item:last-child { border-radius: 0 0 14px 14px; }
.bloco .menu-item .ico { color: var(--somp-muted); }
.bloco .menu-item.perigo .ico { color: var(--somp-danger); }
.bloco .menu-item .extra { margin-left: auto; color: var(--somp-faint); font-size: 13px; }
.codigo-seguranca { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .08em; font-size: 15px; line-height: 1.8; text-align: center; padding: 14px; word-spacing: .3em; }

/* ---------- Páginas de configurações (na área principal) ---------- */
.pagina { flex: 1; overflow-y: auto; padding: 28px clamp(16px, 5vw, 64px) 48px; }
.pagina-topo { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.pagina-topo h2 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.pagina-conteudo { max-width: 680px; }
.cartao-secao { background: var(--somp-surface); border: 1px solid var(--somp-border); border-radius: var(--somp-radius); padding: 22px; margin-bottom: 18px; box-shadow: var(--somp-shadow-sm); }
.cartao-secao h3 { margin: 0 0 4px; font-size: 16.5px; }
.cartao-secao > p { margin: 0 0 18px; color: var(--somp-muted); font-size: 14px; }
.linha-config { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--somp-border); }
.linha-config:first-of-type { border-top: 0; }
.linha-config .txt { min-width: 0; }
.linha-config .txt b { display: block; font-size: 14.5px; font-weight: 600; }
.linha-config .txt small { color: var(--somp-muted); font-size: 13px; }
.linha-config select.entrada { width: auto; min-width: 170px; min-height: 40px; padding-top: 8px; padding-bottom: 8px; }
.dispositivo { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--somp-border); }
.dispositivo:first-of-type { border-top: 0; }
.dispositivo .ico-disp { width: 44px; height: 44px; border-radius: 12px; background: var(--somp-selecionado); display: flex; align-items: center; justify-content: center; color: var(--somp-primary-dark); flex-shrink: 0; }
.dispositivo .txt { flex: 1; min-width: 0; }
.dispositivo .txt b { display: block; }
.dispositivo .txt small { color: var(--somp-muted); font-size: 13px; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 8px; background: var(--somp-selecionado); color: var(--somp-primary-dark); }
:root[data-theme="dark"] .tag { color: var(--somp-primary-light); }
.tag-aviso { background: rgba(232, 154, 28, .14); color: var(--somp-warning); }
.tag-perigo { background: rgba(240, 68, 79, .12); color: var(--somp-danger); }
.avatar-editar { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }

/* ---------- Modais ---------- */
.modal-fundo { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(4, 22, 20, .55); backdrop-filter: blur(5px); animation: aparecer .15s ease-out; }
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
.modal { width: 100%; max-width: 460px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--somp-surface); border: 1px solid var(--somp-border); border-radius: 22px; box-shadow: var(--somp-shadow); animation: surgir .18s ease-out; }
.modal-largo { max-width: 640px; }
.modal-topo { display: flex; align-items: center; gap: 10px; padding: 18px 14px 12px 22px; }
.modal-topo h2 { margin: 0; font-size: 18px; flex: 1; }
.modal-corpo { padding: 4px 22px 18px; overflow-y: auto; }
.modal-corpo > p { color: var(--somp-muted); margin-top: 0; }
.modal-rodape { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 20px; border-top: 1px solid var(--somp-border); }
.lista-selecao { max-height: 320px; overflow-y: auto; margin: 8px -22px 0; }
.lista-selecao .item { padding-left: 22px; }
.lista-selecao .item input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--somp-primary); flex-shrink: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 16px; background: var(--somp-selecionado); font-size: 13px; }
.chip button { border: 0; background: transparent; color: inherit; display: flex; padding: 2px; border-radius: 50%; }
.chip .ico { width: 14px; height: 14px; }

/* Visualizador de imagem */
.visualizador { position: fixed; inset: 0; z-index: 120; background: rgba(0, 0, 0, .92); display: flex; flex-direction: column; animation: aparecer .15s; }
.visualizador-topo { display: flex; justify-content: flex-end; gap: 6px; padding: 12px; }
.visualizador-topo .btn-icone { color: #fff; }
.visualizador-topo .btn-icone:hover { background: rgba(255, 255, 255, .12); }
.visualizador-corpo { flex: 1; display: flex; align-items: center; justify-content: center; padding: 0 16px 24px; min-height: 0; }
.visualizador-corpo img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }

/* Prévia de anexos antes de enviar */
.previa-anexos { display: grid; gap: 10px; }
.previa-anexo { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; background: var(--somp-surface-2); }
.previa-anexo img, .previa-anexo video { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; background: #000; }
.previa-anexo .doc-ico { width: 64px; height: 64px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--somp-selecionado); color: var(--somp-primary-dark); }
.previa-anexo .txt { flex: 1; min-width: 0; font-size: 14px; }
.previa-anexo .txt b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.previa-anexo .txt small { color: var(--somp-muted); }

/* Soltar arquivos */
.soltar { position: absolute; inset: 12px; z-index: 40; border: 2px dashed var(--somp-primary); border-radius: 22px; background: rgba(220, 244, 236, .92); display: none; align-items: center; justify-content: center; flex-direction: column; gap: 10px; color: var(--somp-primary-dark); font-weight: 600; font-size: 17px; pointer-events: none; }
:root[data-theme="dark"] .soltar { background: rgba(6, 17, 20, .9); color: var(--somp-primary-light); }
.principal.arrastando .soltar { display: flex; }
.soltar .ico { width: 44px; height: 44px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 200; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; font-size: 14px; background: var(--somp-surface); color: var(--somp-text); border: 1px solid var(--somp-border); box-shadow: var(--somp-shadow); animation: surgir .2s ease-out; }
.toast .ico { color: var(--somp-primary); }
.toast.erro .ico { color: var(--somp-danger); }
.toast-notif { cursor: pointer; }
.toast-notif .avatar { width: 40px; height: 40px; font-size: 14px; }
.toast-notif .txt { min-width: 0; }
.toast-notif .txt b { display: block; }
.toast-notif .txt span { display: block; color: var(--somp-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }

/* ---------- Chamada (overlay escuro, como a referência) ---------- */
.chamada {
    position: fixed; inset: 0; z-index: 150; display: flex; flex-direction: column; color: #ecfffa;
    background: radial-gradient(700px 520px at 50% 22%, rgba(63, 224, 166, .22), transparent 65%), linear-gradient(180deg, #0d3c37 0%, #072522 60%, #041714 100%);
    animation: aparecer .2s;
}
.chamada video.remoto { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.chamada video.local { position: absolute; right: 18px; top: 18px; width: min(26vw, 220px); aspect-ratio: 3 / 4; object-fit: cover; border-radius: 16px; border: 2px solid rgba(255, 255, 255, .2); box-shadow: 0 12px 30px rgba(0, 0, 0, .5); z-index: 2; background: #111; transform: scaleX(-1); }
.chamada-info { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 24px; }
.chamada.com-video .chamada-info { flex: 0; justify-content: flex-start; padding-top: 28px; text-shadow: 0 2px 10px rgba(0, 0, 0, .6); }
.chamada.com-video .chamada-info .avatar-chamada { display: none; }
.avatar-chamada { position: relative; margin-bottom: 20px; }
.avatar-chamada .avatar { width: 128px; height: 128px; font-size: 44px; background: var(--somp-gradiente); box-shadow: 0 0 0 8px rgba(63, 224, 166, .14), 0 16px 40px rgba(18, 184, 134, .35); }
.chamada.tocando .avatar-chamada::before, .chamada.tocando .avatar-chamada::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid rgba(63, 224, 166, .5); animation: onda 2s ease-out infinite; }
.chamada.tocando .avatar-chamada::after { animation-delay: 1s; }
@keyframes onda { from { transform: scale(1); opacity: .9; } to { transform: scale(1.6); opacity: 0; } }
.chamada-info .nome { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.chamada-info .username { color: var(--somp-primary-light); font-weight: 600; }
.chamada-info .estado { color: rgba(236, 255, 250, .78); font-size: 15px; }
.chamada-info .cronometro { font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 600; }
.chamada-cripto { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: rgba(236, 255, 250, .6); margin-top: 8px; }
.chamada-cripto .ico { width: 14px; height: 14px; }
.chamada-controles { position: relative; z-index: 2; display: flex; justify-content: center; flex-wrap: wrap; gap: 18px 22px; padding: 22px 16px calc(30px + env(safe-area-inset-bottom)); max-width: 460px; margin: 0 auto; }
.ctrl { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12.5px; color: rgba(236, 255, 250, .9); background: none; border: 0; min-width: 72px; }
.ctrl .bola-ctrl { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .12); backdrop-filter: blur(10px); transition: background var(--somp-trans), transform var(--somp-trans); }
.ctrl:hover .bola-ctrl { background: rgba(255, 255, 255, .17); }
.ctrl:active .bola-ctrl { transform: scale(.95); }
.ctrl.desligado .bola-ctrl { background: #ecfffa; color: #072522; }
.ctrl .bola-ctrl .ico { width: 25px; height: 25px; }
.ctrl.encerrar .bola-ctrl { width: 72px; height: 72px; background: var(--somp-danger); border-color: transparent; box-shadow: 0 10px 28px rgba(240, 68, 79, .5); }
.ctrl.atender .bola-ctrl { width: 72px; height: 72px; background: var(--somp-primary); color: #fff; border-color: transparent; box-shadow: 0 10px 28px rgba(18, 184, 134, .5); animation: chacoalhar 1.4s infinite; }
@keyframes chacoalhar { 0%, 60%, 100% { transform: rotate(0); } 10%, 30%, 50% { transform: rotate(-12deg); } 20%, 40% { transform: rotate(12deg); } }
.chamada-topo { position: absolute; top: 14px; left: 14px; z-index: 3; display: flex; gap: 8px; }
.chamada-topo .btn-icone { color: #fff; background: rgba(0, 0, 0, .25); }
.chamada.minimizada { inset: auto 18px 18px auto; width: 300px; height: auto; border-radius: 20px; border: 1px solid rgba(255, 255, 255, .12); box-shadow: var(--somp-shadow); overflow: hidden; }
.chamada.minimizada .chamada-info { flex: 0; flex-direction: row; padding: 14px; gap: 12px; text-align: left; justify-content: flex-start; }
.chamada.minimizada .avatar-chamada { margin: 0; }
.chamada.minimizada .avatar-chamada .avatar { width: 48px; height: 48px; font-size: 18px; box-shadow: none; }
.chamada.minimizada .chamada-info .nome { font-size: 16px; }
.chamada.minimizada .chamada-info .username, .chamada.minimizada .chamada-cripto, .chamada.minimizada video.local, .chamada.minimizada .teclado { display: none; }
.chamada.minimizada .chamada-controles { padding: 0 12px 14px; gap: 8px; }
.chamada.minimizada .ctrl { min-width: 0; }
.chamada.minimizada .ctrl span { display: none; }
.chamada.minimizada .ctrl .bola-ctrl { width: 44px; height: 44px; }
.chamada.minimizada video.remoto { position: static; height: 160px; }
.teclado { display: grid; grid-template-columns: repeat(3, 64px); gap: 10px; justify-content: center; margin-top: 12px; }
.teclado button { height: 52px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .08); color: #fff; font-size: 20px; font-weight: 600; }

/* ---------- Navegação inferior (celular) ---------- */
.nav-inferior { display: none; }

/* Tablet: barra lateral vira trilho só com ícones */
@media (min-width: 861px) and (max-width: 1180px) {
    .app-shell { grid-template-columns: 78px minmax(290px, 340px) 1fr auto; }
    .rail { padding: 16px 12px; align-items: center; }
    .rail .marca { padding: 0 0 16px; }
    .rail .marca strong, .rail-perfil .txt, .rail-btn .rotulo { display: none; }
    .rail-perfil { width: auto; padding: 4px; background: none; }
    .rail-btn { width: 50px; justify-content: center; padding: 0; }
    .rail-btn .badge { position: absolute; top: 3px; right: 2px; }
    .gaveta { position: fixed; right: 0; top: 0; bottom: 0; z-index: 50; box-shadow: var(--somp-shadow); }
}

/* ============================== Celular: experiência própria ============================== */
@media (max-width: 860px) {
    body.app { background: var(--somp-surface); }
    .app-shell { grid-template-columns: 1fr; grid-template-rows: 1fr auto; grid-template-areas: "lateral" "nav"; }
    .rail { display: none; }
    .principal, .gaveta { grid-area: lateral; }
    .app-shell[data-tela="conversa"] .lateral, .app-shell[data-tela="conversa"] .nav-inferior,
    .app-shell[data-tela="gaveta"] .lateral, .app-shell[data-tela="gaveta"] .principal, .app-shell[data-tela="gaveta"] .nav-inferior { display: none; }
    .app-shell[data-tela="conversa"], .app-shell[data-tela="gaveta"] { grid-template-rows: 1fr; }
    .app-shell[data-tela="lista"] .principal { display: none; }
    .gaveta { width: 100%; border-left: 0; }
    .lateral { border-right: 0; }
    /* cabeçalho verde-escuro como na referência */
    .lateral-topo { background: var(--somp-chrome); color: var(--somp-chrome-text); padding: max(16px, env(safe-area-inset-top)) 10px 14px 18px; }
    .lateral-topo .btn-icone { color: var(--somp-chrome-text); }
    .lateral-topo .btn-icone:hover { background: rgba(255, 255, 255, .1); }
    .lateral-busca { margin: 12px 12px 8px 14px; }
    .item { padding-left: 16px; }
    .btn-voltar { display: inline-flex; margin-left: -6px; }
    .conversa-topo { padding: 8px 6px 8px 8px; gap: 8px; min-height: 62px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--somp-chrome); color: var(--somp-chrome-text); border-bottom: 0; }
    .conversa-topo .sub, .conversa-topo .sub.online { color: var(--somp-chrome-muted); }
    .conversa-topo .sub.digitando { color: var(--somp-primary-light); }
    .conversa-topo .acoes .btn-icone, .conversa-topo .btn-voltar { color: var(--somp-chrome-text); }
    .conversa-topo .btn-icone:hover { background: rgba(255, 255, 255, .1); }
    .conversa-topo .avatar { width: 40px; height: 40px; font-size: 14px; }
    .conversa-topo .acoes .so-desktop { display: none; }
    .gaveta-topo { background: var(--somp-chrome); color: var(--somp-chrome-text); border-bottom: 0; padding-top: max(14px, env(safe-area-inset-top)); }
    .gaveta-topo .btn-icone { color: var(--somp-chrome-text); }
    .mensagens { padding: 12px 10px 8px; }
    .bolha { max-width: 84%; }
    .msg .avatar-msg { display: none; }
    .msg.outra .reacoes { left: 10px; }
    .composer { padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
    .tela-vazia { display: none; }
    .nav-inferior {
        grid-area: nav; display: flex; justify-content: space-around; padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
        background: var(--somp-surface); border-top: 1px solid var(--somp-border);
    }
    .nav-inferior .rail-btn { width: auto; flex: 1; height: 58px; flex-direction: column; justify-content: center; gap: 3px; padding: 0; border-radius: 14px; color: var(--somp-muted); font-size: 11px; text-align: center; }
    .nav-inferior .rail-btn .ico { width: 23px; height: 23px; }
    .nav-inferior .rail-btn .rotulo { flex: 0; font-size: 11px; }
    .nav-inferior .rail-btn:hover { background: var(--somp-surface-2); color: var(--somp-text); }
    .nav-inferior .rail-btn.ativo { color: var(--somp-primary); background: transparent; box-shadow: none; }
    .nav-inferior .rail-btn.ativo .ico { color: var(--somp-primary); }
    .nav-inferior .rail-btn .badge { position: absolute; top: 4px; left: calc(50% + 4px); }
    .pagina { padding: 18px 14px 40px; }
    .toasts { left: 12px; right: 12px; bottom: 84px; max-width: none; }
    .menu-anexos { left: 8px; bottom: 66px; }
    .emojis { left: 8px; right: auto; bottom: 66px; }
    .chamada.minimizada { left: 12px; right: 12px; width: auto; bottom: 12px; }
    .modal-fundo { align-items: flex-end; padding: 0; }
    .modal { max-width: none; border-radius: 22px 22px 0 0; max-height: 92dvh; padding-bottom: env(safe-area-inset-bottom); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
