/* home/chat layout — extraído de templates/default */
/* ──────────────────────────────────────────────────────────────
   HOME: fundo inteiro com cor do painel (var(--qs-bg))
   ────────────────────────────────────────────────────────────── */
#qs-home {
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - var(--bottom-h, 62px));
    /* Fundo inteiro preenchido com a cor configurada em Meu Negócio */
    background: var(--qs-bg);
}
@media (min-width: 768px) {
    #qs-home { min-height: 100dvh; }
}

/* ── Bloco de Destaque ────────────────────────────────────────── */
#qs-bloco-destaque {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Espaço extra no topo: deixa margem para o FAB menu (≡) em mobile */
    padding: 56px 16px 0;
    z-index: 5;
    position: relative;
}
@media (min-width: 768px) {
    #qs-bloco-destaque { padding: 24px 36px 0; }
}
#qs-home.chat-ativo #qs-bloco-destaque { display: none; }

.qs-bd-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 600px;
}
.qs-bd-card {
    flex: 1;
    min-width: 0;
    /* Altura mínima enquanto JS ainda não mediu; JS aplica altura exata via style */
    min-height: 140px;
    overflow: hidden;
    background: color-mix(in srgb, var(--qs-primary) 5%, #fff);
    border-radius: 16px;
    padding: 18px 20px 16px;
    box-shadow: 0 1px 8px rgba(0,0,0,.08);
}
.qs-bd-titulo {
    font-size: clamp(.82rem, 1.9vw, .96rem);
    font-weight: 800;
    color: #1a1a2e;
    line-height: 1.4;
    margin: 0 0 10px;
    min-height: 1.2em;
}
.qs-bd-paragrafo {
    font-size: clamp(.82rem, 1.9vw, .96rem);
    color: #4a4f5a;
    line-height: 1.65;
    margin: 0 0 6px;
    opacity: 0;
    transition: opacity .35s ease;
}
.qs-bd-paragrafo.visivel { opacity: 1; }
.qs-bd-paragrafo ul,
.qs-bd-paragrafo ol { margin: 4px 0 4px 1.2em; padding: 0; }
.qs-bd-paragrafo li  { margin-bottom: 2px; }
.qs-bd-solucao {
    font-size: clamp(.82rem, 1.9vw, .96rem);
    font-weight: 700;
    color: var(--qs-primary);
    margin: 8px 0 0;
    line-height: 1.5;
    opacity: 0;
    transition: opacity .35s ease .1s;
}
.qs-bd-solucao.visivel { opacity: 1; }
.qs-bd-arrow {
    width: 32px; height: 32px; border-radius: 50%;
    border: 1.5px solid rgba(0,0,0,.15);
    background: rgba(255,255,255,.8);
    color: #555; font-size: 1.2rem; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0;
    transition: background .15s, border-color .15s, color .15s;
    backdrop-filter: blur(4px);
    padding: 0;
}
.qs-bd-arrow:hover { background: #fff; border-color: var(--qs-primary); color: var(--qs-primary); }
.qs-bd-arrow.oculto { visibility: hidden; pointer-events: none; }
.qs-bd-dots {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    justify-content: center;
    min-height: 8px;
}
.qs-bd-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: rgba(0,0,0,.18);
    transition: background .2s, transform .2s;
    cursor: pointer;
}
.qs-bd-dot.ativo {
    background: var(--qs-primary);
    transform: scale(1.35);
}

/* Com bloco ativo: greeting cola logo abaixo do bloco em mobile */
#qs-home.tem-bloco-destaque #qs-greeting {
    padding-top: 12px;
}
@media (min-width: 768px) {
    #qs-home.tem-bloco-destaque #qs-greeting { padding-top: 4vh; }
}

/* ── Greeting — avatar à ESQUERDA da saudação (like Claude.ai) ── */
#qs-greeting {
    display: flex;
    justify-content: center;
    align-items: center;
    /*
     * Breathing room entre o badge fixo e o conteúdo
     * 17vh ≈ Kimi, 22vh+ ≈ Claude.ai
     * O padding-top cria o espaço, não afeta o sticky do input
     */
    padding: 17vh 24px 24px;
    transition: opacity .22s;
}
@media (min-width: 768px) {
    #qs-greeting { padding-top: 20vh; padding-bottom: 28px; }
}
#qs-greeting.oculto { display: none; }

.qs-greeting-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 600px;
    width: 100%;
}

/* Avatar — compacto, ao lado do texto */
.qs-agente-avatar {
    width: 54px; height: 54px; border-radius: 50%;
    object-fit: cover;
    border: 2.5px solid var(--qs-primary);
    flex-shrink: 0;
    box-shadow: 0 3px 14px color-mix(in srgb, var(--qs-primary) 22%, transparent);
    display: block;
}
.qs-agente-avatar-placeholder {
    width: 54px; height: 54px; border-radius: 50%;
    background: linear-gradient(135deg, var(--qs-primary), var(--qs-accent));
    display: flex; align-items: center; justify-content: center;
    font-size: 1.45rem; font-weight: 800; color: #fff;
    flex-shrink: 0;
    box-shadow: 0 3px 14px color-mix(in srgb, var(--qs-primary) 22%, transparent);
}

.qs-greeting-texto { display: flex; flex-direction: column; gap: 4px; }
.qs-agente-label {
    font-size: clamp(.78rem, 1.6vw, .92rem);
    font-weight: 700;
    color: var(--qs-primary);
    letter-spacing: .02em;
    text-transform: none;
    line-height: 1;
}
#qs-texto-saudacao {
    font-size: clamp(1.1rem, 3vw, 1.65rem);
    font-weight: 800; color: #1a1a2e;
    line-height: 1.22;
    letter-spacing: -.02em;
    text-align: left;
    margin: 0;
}

/* ── Área de mensagens ────────────────────────────────────────── */
#qs-mensagens {
    display: none;
    overflow-y: auto;
    padding: 0 16px 16px;
    scroll-behavior: smooth;
    flex-direction: column;
    /* Mesmo fundo da página — sem divisória visual (padrão Claude.ai) */
    background: var(--qs-bg);
}
@media (min-width: 768px) { #qs-mensagens { padding: 0 32px 20px; } }

/*
 * Spacer que cresce para empurrar mensagens para baixo quando há poucas.
 * Quando o container fica cheio, o spacer colapsa para zero e o scroll assume.
 * Técnica padrão de chat UIs (Claude.ai, Kimi, etc.)
 */
#qs-mensagens::before {
    content: '';
    flex: 1;
    min-height: 24px;
}

/* ── Estado com conversa ativa: layout vira UI de chat ───────── */
#qs-home.chat-ativo {
    /* Mobile: altura disponível = viewport - barra de navegação inferior */
    height: calc(100dvh - var(--bottom-h, 62px));
    overflow: hidden;
}
@media (min-width: 768px) {
    /* Desktop: sidebar fica ao lado, barra inferior some — usa 100dvh */
    #qs-home.chat-ativo { height: 100dvh; }
}
/* Mensagens preenchem o espaço restante e ficam acima do input */
#qs-home.chat-ativo #qs-mensagens {
    display: flex;
    flex: 1;
    min-height: 0; /* flex precisa disso para overflow funcionar */
}
/* Input sai do sticky e fica embaixo das mensagens em fluxo normal */
#qs-home.chat-ativo #qs-input-area {
    position: static;
    flex-shrink: 0;
}
/* Cards somem durante a conversa */
#qs-home.chat-ativo #qs-conteudo-tabs {
    display: none !important;
}
.qs-sem-conteudo {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    color: #bbb;
    font-size: .9rem;
}

/* Balões */
.qs-msg {
    display: flex; gap: 8px; margin-bottom: 12px; animation: qs-fade-up .22s ease;
    max-width: 720px; width: 100%; margin-left: auto; margin-right: auto;
}
@keyframes qs-fade-up { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }
.qs-msg.user { flex-direction: row-reverse; }
.qs-msg-balao {
    max-width: min(78%, 420px); padding: 10px 14px; border-radius: 16px;
    font-size: .88rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.qs-msg.user  .qs-msg-balao { background: var(--qs-primary); color: #fff; border-bottom-right-radius: 4px; }
.qs-msg.ai    .qs-msg-balao { background: #fff; color: #1a1a2e; border-bottom-left-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.qs-msg-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; align-self: flex-end; border: 2px solid var(--qs-primary); }
.qs-msg-avatar-dot { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--qs-primary), var(--qs-accent)); display: flex; align-items: center; justify-content: center; flex-shrink: 0; align-self: flex-end; font-size: .68rem; color: #fff; font-weight: 700; }
.qs-typing { display: flex; gap: 4px; align-items: center; padding: 10px 12px; background: #fff; border-radius: 16px; border-bottom-left-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.qs-typing span { width: 5px; height: 5px; border-radius: 50%; background: #ccc; animation: qs-bounce .9s ease-in-out infinite; }
.qs-typing span:nth-child(2) { animation-delay: .15s; }
.qs-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes qs-bounce { 0%,80%,100% { transform:translateY(0); } 40% { transform:translateY(-5px); background:var(--qs-primary); } }

/* ── Cards inline no chat ───────────────────────────────── */
.qs-msg.ai .qs-msg-balao { max-width: min(88%, 480px); }
.qs-chat-cards { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 4px; width: 100%; }
.qs-chat-card {
    display: flex; gap: 0; background: #f8f9fb;
    border-radius: 10px; border: 1px solid rgba(0,0,0,.07);
    overflow: hidden; text-decoration: none; color: inherit;
    transition: box-shadow .15s, transform .15s;
}
.qs-chat-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.12); transform: translateY(-1px); text-decoration: none; }
.qs-chat-card-foto { width: 96px; min-height: 86px; object-fit: cover; flex-shrink: 0; }
.qs-chat-card-sem-foto {
    width: 96px; min-height: 86px; flex-shrink: 0;
    background: #eceef2; display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; color: #bbb;
}
.qs-chat-card-info {
    flex: 1; padding: 9px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.qs-chat-card-titulo { font-weight: 700; font-size: .83rem; color: #1a1a2e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qs-chat-card-desc {
    font-size: .73rem; color: #6c757d; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.qs-chat-card-valor { font-size: .8rem; font-weight: 700; color: var(--qs-primary); margin-top: 2px; }
.qs-chat-card-meta  { font-size: .69rem; color: #9099a6; }
.qs-chat-card-btn {
    display: inline-block; margin-top: 5px; padding: 3px 10px;
    background: var(--qs-primary); color: #fff; border-radius: 5px;
    font-size: .7rem; font-weight: 600; align-self: flex-start;
}
.qs-chat-fechamento { font-size: .84rem; color: #444; margin-top: 8px; line-height: 1.5; }

/* ── Input area — sticky ao rolar ────────────────────────────── */
#qs-input-area {
    position: sticky;
    top: 0;  /* sem header: gruda no topo absoluto */
    background: var(--qs-bg);
    padding: 10px 14px;
    z-index: 20;
}
@media (min-width: 768px) {
    #qs-input-area { padding: 10px 36px; }
}

/* Popup de prompts */
#qs-prompts-popup {
    display: none;
    flex-wrap: wrap; gap: 8px;
    padding: 10px 12px;
    background: #fff;
    border: 1.5px solid #e8eaed;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,.1);
    margin-bottom: 8px;
    animation: qs-fade-up .18s ease;
    max-width: 680px; margin-left: auto; margin-right: auto;
}
#qs-prompts-popup.open { display: flex; }

.qs-pill {
    padding: 6px 14px;
    border: 1.5px solid color-mix(in srgb, var(--qs-primary) 28%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--qs-primary) 5%, #fff);
    color: var(--qs-primary); font-size: .78rem; font-weight: 500;
    cursor: pointer; font-family: inherit; white-space: nowrap;
    transition: background .15s, border-color .15s;
}
.qs-pill:hover { background: color-mix(in srgb, var(--qs-primary) 13%, #fff); border-color: var(--qs-primary); }

/* ──────────────────────────────────────────────────
   Input card — DUAS LINHAS (como Claude.ai):
   Linha 1: textarea
   Linha 2: toolbar [+]  ............  [↑]
   ────────────────────────────────────────────────── */
.qs-input-wrap {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1.5px solid #d5d8dc;
    border-radius: 16px;
    padding: 14px 14px 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
    transition: border-color .2s, box-shadow .2s;
    max-width: 680px; margin: 0 auto;
}
.qs-input-wrap:focus-within {
    border-color: var(--qs-primary);
    box-shadow: 0 2px 16px color-mix(in srgb, var(--qs-primary) 16%, transparent);
}

/* Linha 1: campo de texto */
#qs-campo {
    border: none; outline: none; resize: none;
    font-size: .94rem; font-family: inherit; line-height: 1.6;
    background: transparent;
    max-height: 120px; min-height: 24px;
    color: #1a1a2e;
    width: 100%;
    padding-bottom: 6px;
}
#qs-campo::placeholder { color: #c0c5cc; }

/* Linha 2: toolbar */
.qs-input-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid #f0f2f5;
}

/* Botão + circular (esquerda da toolbar) */
#qs-btn-mais {
    width: 30px; height: 30px; border-radius: 50%;
    border: 1.5px solid #d5d8dc; background: transparent;
    color: #888; display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0; font-size: 1.2rem;
    font-weight: 300; line-height: 1;
    transition: all .15s; font-family: sans-serif;
}
#qs-btn-mais:hover  { border-color: var(--qs-primary); color: var(--qs-primary); }
#qs-btn-mais.ativo  { background: var(--qs-primary); color: #fff; border-color: var(--qs-primary); }

/* Botão enviar (direita da toolbar) */
#qs-enviar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--qs-primary); color: #fff; border: none;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: background .15s, opacity .15s, transform .1s;
}
#qs-enviar:hover { background: var(--qs-accent); transform: scale(1.08); }
#qs-enviar:disabled { opacity: .38; cursor: default; transform: none; }

/* Lado direito da toolbar — agrupa mic + enviar com gap */
.qs-toolbar-direita {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Botão microfone */
#qs-btn-mic {
    width: 30px; height: 30px; border-radius: 50%;
    border: 1.5px solid #d5d8dc; background: transparent;
    color: #888; display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0;
    transition: border-color .15s, color .15s;
    padding: 0;
}
#qs-btn-mic:hover { border-color: var(--qs-primary); color: var(--qs-primary); }
#qs-btn-mic.qs-mic-ativo {
    border-color: #dc3545;
    color: #dc3545;
    animation: qs-mic-blink 1s infinite;
}
@keyframes qs-mic-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: .35; }
}

.qs-aviso { text-align: center; font-size: .67rem; color: #bbb; margin-top: 6px; }

/* ── Tab bar ──────────────────────────────────────────────────── */
#qs-conteudo-tabs {
    flex: 1; display: flex; flex-direction: column;
    /* MESMO fundo que o resto — sem divisória visual */
    background: var(--qs-bg);
}
#qs-tab-bar {
    display: flex;
    justify-content: center; /* centraliza os botões de tab */
    padding: 0 14px;
    border-bottom: 1px solid rgba(0,0,0,.08);
    overflow-x: auto; background: var(--qs-bg);
    position: sticky;
    top: 62px; /* abaixo do input sticky */
    z-index: 10;
}
@media (min-width: 768px) {
    #qs-tab-bar { padding: 0 36px; top: 62px; /* abaixo do input sticky desktop */ }
}
.qs-tab-btn {
    padding: 12px 16px 10px; font-size: .875rem; font-weight: 600;
    color: #9099a6; background: none; border: none;
    border-bottom: 2.5px solid transparent; margin-bottom: -1px;
    cursor: pointer; white-space: nowrap;
    transition: color .15s, border-color .15s; font-family: inherit;
}
.qs-tab-btn:hover { color: #555; }
.qs-tab-btn.ativo { color: #1a1a2e; border-bottom-color: var(--qs-primary); font-weight: 700; }

/* ── Tab content + Cards ──────────────────────────────────────── */
.qs-tab-content {
    display: none;
    padding: 16px 14px 60px;
    max-width: 760px;   /* mesmo alinhamento do input card (680px + margem) */
    margin: 0 auto;
    width: 100%;
}
.qs-tab-content.ativo { display: block; }
@media (min-width: 768px) {
    .qs-tab-content { padding: 20px 24px 80px; }
}

.qs-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
/* 3 colunas a partir de 480px — cards mais compactos como Kimi */
@media (min-width: 480px) { .qs-cards-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; } }
@media (min-width: 900px) { .qs-cards-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; } }

.qs-card {
    border-radius: 12px; border: 1px solid rgba(0,0,0,.07);
    overflow: hidden; background: #fff;
    text-decoration: none; color: inherit;
    display: flex; flex-direction: column;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    transition: box-shadow .18s, transform .18s;
}
.qs-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,.1);
    transform: translateY(-2px); text-decoration: none; color: inherit;
}

/* Imagem com aspect-ratio fixo — independente do tamanho original */
.qs-card-foto {
    width: 100%; aspect-ratio: 16/9;
    object-fit: cover; display: block;
    /* Força o tamanho visual independente de qualquer imagem enviada */
    min-height: 0;
    background: #f0f2f5;
}
.qs-card-sem-foto {
    width: 100%; aspect-ratio: 16/9;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--qs-primary) 10%, #f0f2f5),
        color-mix(in srgb, var(--qs-accent) 7%, #f0f2f5));
    display: flex; align-items: center; justify-content: center;
    color: var(--qs-primary); opacity: .4; font-size: 1.5rem;
}
.qs-card-corpo { padding: 10px 12px 13px; flex: 1; display: flex; flex-direction: column; }
.qs-card-titulo { font-size: .82rem; font-weight: 700; color: #1a1a2e; margin-bottom: 3px; line-height: 1.3; }
.qs-card-desc {
    font-size: .72rem; color: #7a8290; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden; flex: 1;
}
.qs-card-valor { margin-top: 7px; font-size: .76rem; font-weight: 600; color: var(--qs-primary); }

/* Link "Ver todos" */
.qs-ver-todos {
    display: inline-flex; align-items: center; gap: 5px; margin-top: 14px;
    font-size: .8rem; font-weight: 600; color: var(--qs-primary);
    padding: 6px 13px; border-radius: 8px;
    background: color-mix(in srgb, var(--qs-primary) 8%, transparent);
    text-decoration: none; transition: background .15s;
}
.qs-ver-todos:hover { background: color-mix(in srgb, var(--qs-primary) 15%, transparent); text-decoration: none; }

/* ── Hero background image ────────────────────────────────────────
   A imagem fica num ::before para poder sumir com opacity transition
   sem afetar o conteúdo (que ficaria invisível junto se usasse opacity
   diretamente no #qs-home).
   ────────────────────────────────────────────────────────────────── */
