/* Atendimento GFFLOG - PWA de multiatendimento WhatsApp */
:root {
    --brand: #0f766e;
    --brand-2: #115e59;
    --brand-soft: #ccfbf1;
    --bg: #f1f5f4;
    --card: #ffffff;
    --ink: #0f1f1d;
    --muted: #5b6b68;
    --line: #dbe5e3;
    --in: #ffffff;
    --out: #d9fdd3;
    --danger: #dc2626;
    --warn: #b45309;
    --ok: #15803d;
    --shadow: 0 1px 2px rgba(15, 31, 29, .08), 0 4px 14px rgba(15, 31, 29, .06);
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-t: env(safe-area-inset-top, 0px);
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b1514; --card: #12201e; --ink: #e8f1ef; --muted: #8fa5a1; --line: #223532;
        --in: #1a2b29; --out: #0d4a43; --brand-soft: #0c3b36; --shadow: 0 1px 2px rgba(0, 0, 0, .4);
        color-scheme: dark;
    }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.at-spinner { width: 18px; height: 18px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; display: inline-block; animation: at-gira .8s linear infinite; }
@keyframes at-gira { to { transform: rotate(360deg); } }
.at-carregando { height: 100%; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--muted); }

/* botoes */
.at-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-weight: 600; text-decoration: none; color: var(--ink); }
.at-btn:active { transform: translateY(1px); }
.at-btn-primario { background: var(--brand); border-color: var(--brand); color: #fff; }
.at-btn-perigo { color: var(--danger); border-color: rgba(220, 38, 38, .45); }
.at-btn-pequeno { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.at-btn[disabled] { opacity: .55; pointer-events: none; }
.at-icone { width: 40px; height: 40px; display: inline-grid; place-items: center; border: 0; background: transparent; border-radius: 50%; color: inherit; flex: none; }
.at-icone:active { background: rgba(127, 127, 127, .18); }
.at-icone svg { width: 22px; height: 22px; }

/* aviso / login */
.at-aviso { min-height: 100%; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 28px 22px; text-align: center; max-width: 420px; margin: 0 auto; }
.at-aviso img { border-radius: 20px; box-shadow: var(--shadow); }
.at-aviso h1 { margin: 6px 0 0; font-size: 26px; }
.at-aviso p { margin: 0; color: var(--muted); }
.at-login-form { display: grid; gap: 12px; width: 100%; text-align: left; margin-top: 6px; }
.at-login-form label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.at-login-form input, .at-campo { width: 100%; height: 46px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-size: 16px; color: var(--ink); }
.at-login-form input:focus, .at-campo:focus, .at-composer textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; }
.at-erro { width: 100%; padding: 10px 12px; border-radius: 10px; background: rgba(220, 38, 38, .1); color: var(--danger); font-size: 14px; }

/* estrutura */
.at-app { height: 100%; display: grid; grid-template-columns: 1fr; position: relative; overflow: hidden; }
.at-col { display: flex; flex-direction: column; min-height: 0; height: 100%; background: var(--bg); }
.at-lista-col { }
.at-chat-col { display: none; }
.at-app[data-tela="chat"] .at-lista-col { display: none; }
.at-app[data-tela="chat"] .at-chat-col { display: flex; }
@media (min-width: 900px) {
    .at-app { grid-template-columns: 400px 1fr; }
    .at-lista-col { border-right: 1px solid var(--line); }
    .at-app[data-tela="chat"] .at-lista-col { display: flex; }
    .at-chat-col, .at-app[data-tela="chat"] .at-chat-col { display: flex; }
    .at-voltar { display: none !important; }
    .at-nav { position: static; }
}

/* topo */
.at-topo { display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-t)) 14px 10px; background: var(--brand); color: #fff; }
.at-topo h1 { flex: 1; margin: 0; font-size: 19px; font-weight: 700; letter-spacing: .01em; }
.at-status { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 12px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .16); color: #fff; font-size: 13px; font-weight: 600; }
.at-status i { width: 9px; height: 9px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, .3); }
.at-status[data-s="pausa"] i { background: #fbbf24; box-shadow: 0 0 0 3px rgba(251, 191, 36, .3); }
.at-status[data-s="fora_horario"] i { background: #cbd5e1; box-shadow: 0 0 0 3px rgba(203, 213, 225, .3); }
.at-busca { padding: 10px 14px 6px; background: var(--bg); }
.at-busca input { width: 100%; height: 40px; padding: 0 14px 0 38px; border: 1px solid var(--line); border-radius: 12px; background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238a9a97' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px center; font-size: 15px; }
.at-abas { display: flex; gap: 6px; padding: 4px 14px 10px; overflow-x: auto; scrollbar-width: none; }
.at-aba { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 14px; font-weight: 600; color: var(--muted); }
.at-aba[aria-selected="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.at-aba b { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 12px; display: inline-grid; place-items: center; }
.at-aba[aria-selected="true"] b { background: #fff; color: var(--brand); }
.at-rolagem { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* banners */
.at-banner { margin: 8px 14px 0; padding: 10px 12px; border-radius: 12px; background: #fef3c7; color: #78350f; font-size: 13.5px; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.at-banner .at-btn { flex: none; background: #fff; color: #78350f; border-color: #f59e0b; }
@media (prefers-color-scheme: dark) { .at-banner { background: #3a2d0a; color: #fde68a; } .at-banner .at-btn { background: transparent; color: #fde68a; } }

/* conversas */
.at-conv { display: flex; gap: 12px; align-items: center; width: 100%; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line); background: var(--card); text-align: left; }
.at-conv:active, .at-conv[aria-current="true"] { background: var(--brand-soft); }
.at-avatar { width: 46px; height: 46px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 17px; color: #fff; background: var(--brand); }
.at-conv-corpo { flex: 1; min-width: 0; }
.at-linha1 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.at-nome { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.at-hora { flex: none; font-size: 12px; color: var(--muted); }
.at-conv[data-nl="1"] .at-hora { color: var(--brand); font-weight: 700; }
.at-linha2 { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-top: 2px; }
.at-resumo { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.at-badge { flex: none; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.at-chip { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: #fef3c7; color: #92400e; }
.at-chip[data-t="atendendo"] { background: var(--brand-soft); color: var(--brand-2); }
.at-chip[data-t="encerrada"] { background: #e5e7eb; color: #4b5563; }
.at-vazio { padding: 48px 28px; text-align: center; color: var(--muted); }
.at-vazio svg { width: 54px; height: 54px; opacity: .5; margin-bottom: 8px; }
.at-vazio strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* navegacao inferior */
.at-nav { display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.at-nav button { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 8px 2px 7px; border: 0; background: transparent; color: var(--muted); font-size: 11.5px; font-weight: 600; position: relative; }
.at-nav button svg { width: 24px; height: 24px; }
.at-nav button[aria-current="true"] { color: var(--brand); }
.at-nav .at-pt { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; display: grid; place-items: center; }

/* chat */
.at-chat-topo { display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--safe-t)) 8px 8px 4px; background: var(--brand); color: #fff; }
.at-chat-topo .at-avatar { width: 40px; height: 40px; background: rgba(255, 255, 255, .22); font-size: 15px; }
.at-chat-info { flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; color: #fff; padding: 0 4px; }
.at-chat-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.at-chat-info span { display: block; font-size: 12.5px; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.at-acoes { display: flex; gap: 6px; padding: 8px 12px; background: var(--card); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.at-acoes .at-btn { flex: none; }
.at-msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 12px 6px; display: flex; flex-direction: column; gap: 3px; background: var(--bg); -webkit-overflow-scrolling: touch; }
.at-dia { align-self: center; margin: 10px 0 6px; padding: 3px 12px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); font-size: 12px; color: var(--muted); font-weight: 600; }
.at-evt { align-self: center; margin: 6px 0; padding: 4px 12px; border-radius: 999px; background: rgba(127, 127, 127, .14); font-size: 12px; color: var(--muted); text-align: center; max-width: 90%; }
.at-bolha { max-width: min(82%, 520px); padding: 7px 10px 5px; border-radius: 14px; background: var(--in); box-shadow: 0 1px 1px rgba(15, 31, 29, .1); position: relative; word-wrap: break-word; overflow-wrap: anywhere; }
.at-bolha[data-d="recebida"] { align-self: flex-start; border-top-left-radius: 4px; }
.at-bolha[data-d="enviada"] { align-self: flex-end; border-top-right-radius: 4px; background: var(--out); }
.at-bolha .at-autor { display: block; font-size: 12px; font-weight: 700; color: var(--brand); margin-bottom: 2px; }
.at-bolha .at-txt { white-space: pre-wrap; }
.at-bolha .at-meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin-top: 1px; font-size: 11px; color: var(--muted); }
.at-bolha[data-falha="1"] { outline: 1px solid var(--danger); }
.at-ticks { font-size: 13px; letter-spacing: -2px; }
.at-ticks[data-l="1"] { color: #2563eb; }
.at-ticks[data-f="1"] { color: var(--danger); letter-spacing: 0; font-weight: 700; }
.at-cit { margin-bottom: 4px; padding: 5px 9px; background: rgba(127, 127, 127, .14); border-radius: 8px; font-size: 13px; color: var(--muted); }
.at-cit::before { content: "↩ "; color: var(--brand); font-weight: 700; }
.at-bolha img.at-foto { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; cursor: zoom-in; background: rgba(127, 127, 127, .15); min-width: 140px; min-height: 80px; object-fit: cover; }
.at-bolha img.at-figurinha { max-width: 140px; min-height: 0; background: transparent; }
.at-bolha audio { width: min(260px, 70vw); height: 40px; }
.at-bolha video { max-width: 100%; max-height: 320px; border-radius: 10px; }
.at-doc { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 3px; border-radius: 10px; background: rgba(127, 127, 127, .14); color: inherit; text-decoration: none; font-weight: 600; font-size: 14px; }
.at-doc svg { width: 26px; height: 26px; flex: none; color: var(--brand); }
.at-reacao { position: absolute; bottom: -10px; right: 8px; padding: 0 5px; border-radius: 10px; background: var(--card); box-shadow: var(--shadow); font-size: 14px; }
.at-reacao + .at-meta { }

/* barra de assumir / composer */
.at-assumir { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 12px; background: #fef3c7; color: #78350f; font-size: 14px; border-top: 1px solid #fde68a; }
@media (prefers-color-scheme: dark) { .at-assumir { background: #3a2d0a; color: #fde68a; border-color: #5b4513; } }
.at-outro { padding: 12px 14px; text-align: center; color: var(--muted); background: var(--card); border-top: 1px solid var(--line); font-size: 14px; padding-bottom: calc(12px + var(--safe-b)); }
.at-composer { display: flex; align-items: flex-end; gap: 6px; padding: 8px 8px calc(8px + var(--safe-b)); background: var(--card); border-top: 1px solid var(--line); position: relative; }
.at-composer textarea { flex: 1; min-height: 42px; max-height: 140px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 21px; background: var(--bg); resize: none; line-height: 1.35; font-size: 16px; }
.at-enviar { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }
.at-enviar svg { width: 22px; height: 22px; }
.at-enviar[disabled] { opacity: .5; }
.at-rapidas { position: absolute; left: 8px; right: 8px; bottom: calc(100% + 4px); max-height: 46vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: var(--shadow); z-index: 20; }
.at-rapida { display: block; width: 100%; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.at-rapida:last-child { border-bottom: 0; }
.at-rapida strong { color: var(--brand); }
.at-rapida span { display: block; color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.at-chat-vazio { flex: 1; display: none; place-content: center; justify-items: center; color: var(--muted); text-align: center; gap: 8px; padding: 20px; }
@media (min-width: 900px) { .at-chat-vazio { display: grid; } .at-app[data-tela="chat"] .at-chat-vazio { display: none; } .at-chat-conteudo { display: none; } .at-app[data-tela="chat"] .at-chat-conteudo { display: flex; } }
.at-chat-conteudo { display: flex; flex-direction: column; flex: 1; min-height: 0; }
@media (min-width: 900px) { .at-chat-conteudo { display: none; } }

/* telas simples (horario, equipe, mais) */
.at-pagina { display: none; }
.at-app[data-tela="horario"] .at-lista-col, .at-app[data-tela="equipe"] .at-lista-col, .at-app[data-tela="mais"] .at-lista-col { display: none; }
.at-app[data-tela="horario"] .at-pagina[data-p="horario"], .at-app[data-tela="equipe"] .at-pagina[data-p="equipe"], .at-app[data-tela="mais"] .at-pagina[data-p="mais"] { display: flex; }
@media (min-width: 900px) {
    .at-app[data-tela="horario"] .at-lista-col, .at-app[data-tela="equipe"] .at-lista-col, .at-app[data-tela="mais"] .at-lista-col { display: flex; }
    .at-app[data-tela="horario"] .at-chat-col, .at-app[data-tela="equipe"] .at-chat-col, .at-app[data-tela="mais"] .at-chat-col { display: none; }
    .at-pagina { grid-column: 2; }
    .at-app[data-tela="horario"], .at-app[data-tela="equipe"], .at-app[data-tela="mais"] { grid-template-columns: 400px 1fr; }
}
.at-pagina { flex-direction: column; min-height: 0; height: 100%; background: var(--bg); }
.at-cartao { margin: 12px 14px 0; padding: 14px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); }
.at-cartao h2 { margin: 0 0 4px; font-size: 16px; }
.at-cartao p { margin: 0 0 10px; color: var(--muted); font-size: 13.5px; }
.at-linha-chave { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; }
.at-chave { position: relative; width: 48px; height: 28px; flex: none; }
.at-chave input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.at-chave span { position: absolute; inset: 0; border-radius: 14px; background: #b6c2bf; transition: background .15s; }
.at-chave span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.at-chave input:checked + span { background: var(--brand); }
.at-chave input:checked + span::after { transform: translateX(20px); }
.at-chave input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.at-dia-linha { padding: 10px 0; border-top: 1px solid var(--line); }
.at-dia-linha:first-of-type { border-top: 0; }
.at-dia-topo { display: flex; align-items: center; justify-content: space-between; font-weight: 700; }
.at-dia-topo small { font-weight: 500; color: var(--muted); margin-left: 8px; }
.at-horas { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.at-horas label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.at-horas input[type="time"] { height: 40px; padding: 0 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 15px; }
.at-link { border: 0; background: transparent; color: var(--brand); font-weight: 700; padding: 6px 2px; font-size: 13.5px; }
.at-rodape-fixo { padding: 10px 14px calc(10px + var(--safe-b)); background: var(--card); border-top: 1px solid var(--line); display: flex; gap: 8px; }
.at-rodape-fixo .at-btn { flex: 1; }
.at-eq { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line); background: var(--card); text-align: left; }
.at-eq .at-nome { flex: 1; }
.at-eq small { display: block; color: var(--muted); font-weight: 400; }
.at-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #dcfce7; color: #166534; }
.at-pill[data-s="pausa"] { background: #fef3c7; color: #92400e; }
.at-pill[data-s="fora_horario"] { background: #e5e7eb; color: #4b5563; }
.at-lista-simples { margin: 8px 0 0; padding: 0; list-style: none; }
.at-lista-simples li { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); }
.at-lista-simples li:first-child { border-top: 0; }
.at-lista-simples b { color: var(--brand); }
.at-lista-simples span { display: block; color: var(--muted); font-size: 13.5px; }
.at-form-linha { display: grid; gap: 8px; margin-top: 10px; }
textarea.at-campo { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.4; }

/* folha inferior (menu) */
.at-folha-fundo { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; justify-content: center; }
.at-folha { width: 100%; max-width: 520px; max-height: 82vh; overflow-y: auto; padding: 14px 14px calc(14px + var(--safe-b)); border-radius: 20px 20px 0 0; background: var(--card); box-shadow: 0 -8px 30px rgba(0, 0, 0, .25); }
@media (min-width: 900px) { .at-folha-fundo { align-items: center; } .at-folha { border-radius: 20px; } }
.at-folha h3 { margin: 2px 0 10px; font-size: 17px; }
.at-opcao { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 6px 8px; border: 0; border-radius: 12px; background: transparent; text-align: left; }
.at-opcao:active { background: var(--brand-soft); }
.at-opcao small { display: block; color: var(--muted); }
.at-opcao[data-perigo="1"] { color: var(--danger); }
.at-visor { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .92); display: grid; place-items: center; padding: 16px; }
.at-visor img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.at-visor button { position: absolute; top: calc(12px + var(--safe-t)); right: 12px; background: rgba(255, 255, 255, .15); color: #fff; }
.at-toasts { position: fixed; left: 0; right: 0; bottom: calc(76px + var(--safe-b)); z-index: 90; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 14px; }
.at-toast { max-width: 520px; padding: 10px 16px; border-radius: 12px; background: #1f2937; color: #fff; font-size: 14px; box-shadow: var(--shadow); animation: at-sobe .2s ease-out; }
.at-toast[data-t="erro"] { background: var(--danger); }
@keyframes at-sobe { from { transform: translateY(8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.at-marca { margin: -4px 0 0; font-weight: 700; color: var(--ink) !important; }
.at-link-caixa { display: block; width: 100%; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 12px; background: var(--bg); font-size: 13px; word-break: break-all; user-select: all; }
.at-botoes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
