/* luna.css :: conversas da Luna separadas por cliente e projeto (lista ao lado; no celular, lista ou conversa).
   O resto do estilo da Luna (balões, chips, entrada, painel da IA) fica em painel.css, que entra depois deste:
   aqui as regras usam .luna-cv-page na frente para valer sobre ele. */

.luna-page.luna-cv-page { height: auto; max-height: none; display: block; }
.luna-cv-page .luna-page-header { margin-bottom: 16px; }

.luna-cv { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 20px; height: calc(100vh - 200px); min-height: 520px; max-height: 860px; }

/* lista de conversas */
.luna-cv-lado { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--sh-card); overflow: hidden; }
.luna-cv-lado-topo { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-bottom: 1px solid var(--border); }
.luna-cv-page .luna-cv-novabtn { width: 100%; }
.luna-cv-novabtn .av-ic { width: 16px; height: 16px; flex: none; }
.luna-cv-filtro { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.luna-cv-rot { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.luna-cv-filtro select { width: 100%; min-width: 0; }
.luna-cv-lista { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 8px 12px; scrollbar-width: thin; }
.luna-cv-grupo { margin-bottom: 10px; }
.luna-cv-grupo-t { display: flex; align-items: center; gap: 6px; margin: 6px 6px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); overflow-wrap: anywhere; }
.luna-cv-grupo-t .av-ic { width: 14px; height: 14px; flex: none; }
.luna-cv-item { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; border: 0; border-left: 3px solid transparent; background: none;
  border-radius: 8px; padding: 8px 10px; cursor: pointer; font-family: var(--font-ui); color: var(--body); min-width: 0; }
.luna-cv-item:hover, .luna-cv-item:focus-visible { background: var(--bg-zebra); }
.luna-cv-item.on { background: var(--orange-light); border-left-color: var(--orange); }
.luna-cv-item-t { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.35; overflow-wrap: anywhere; }
.luna-cv-item-s { font-size: 11.5px; color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }
.luna-cv-vazio { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 10px 8px; font-size: 13px; color: var(--body); line-height: 1.5; }
.luna-cv-vazio p { margin: 0; }
.luna-cv-vazio > .av-ic { width: 26px; height: 26px; color: var(--muted); }

/* nova conversa */
.luna-cv-nova-form { padding: 12px 14px 14px; border-bottom: 1px solid var(--border); background: var(--bg-zebra); display: flex; flex-direction: column; gap: 10px; }
.luna-cv-nova-t { margin: 0; font-weight: 700; color: var(--ink); font-size: 14px; }
.luna-cv-nova-form .field { margin: 0; }
.luna-cv-nova-form select { width: 100%; min-width: 0; }
.luna-cv-nova-form .rd-dica { margin: 0; font-size: 12px; }
.luna-cv-nova-form .rd-acoes { margin: 0; gap: 8px; }

/* conversa aberta */
.luna-cv-chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.luna-cv-cab { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 14px; padding-bottom: 10px; margin-bottom: 10px;
  border-bottom: 1px solid var(--border); flex-shrink: 0; }
.luna-cv-cab-l { flex: 1 1 260px; min-width: 0; }
.luna-cv-tit { margin: 0; font-family: var(--font-title); font-size: 20px; color: var(--ink); line-height: 1.3; overflow-wrap: anywhere; }
.luna-cv-meta { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.luna-cv-cab-b { display: flex; flex-wrap: wrap; gap: 8px; }
.luna-cv-cab-b .btn { padding: 8px 14px; }
.luna-cv-cab-b .av-ic { width: 15px; height: 15px; flex: none; }
.luna-cv-voltar { display: none; }
.luna-cv-ren { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.luna-cv-ren .field { flex: 1 1 240px; margin: 0; min-width: 0; }
.luna-cv-ren input { width: 100%; }
.luna-cv-ren .rd-acoes { margin: 0; gap: 8px; }
.luna-cv-page .luna-ia-bar { flex-shrink: 0; margin: 0 0 10px; }
.luna-cv-page .luna-suggestions { margin-bottom: 4px; }
.luna-cv-page .luna-suggestions:empty { display: none; }
.luna-cv-page .luna-chip { white-space: normal; text-align: left; line-height: 1.35; }
.luna-cv-page .luna-chat { min-height: 0; }
.luna-cv-page .luna-bubble { white-space: pre-line; overflow-wrap: anywhere; }
.luna-cv-page .luna-input { min-width: 0; }
.luna-cv-carregando { margin: 0; }

/* celular e janela estreita: uma coisa por vez (a lista ou a conversa) */
@media (max-width: 1000px) {
  .luna-cv { display: block; height: auto; min-height: 0; max-height: none; }
  .luna-cv-v-lista .luna-cv-chat, .luna-cv-v-conversa .luna-cv-lado { display: none; }
  .luna-cv-lado { box-shadow: none; }
  .luna-cv-v-conversa .luna-cv-chat { height: calc(100vh - 220px); min-height: 460px; }
  .luna-cv-voltar { display: inline-flex; flex: 0 0 100%; justify-content: center; }
  .luna-cv-v-lista .luna-cv-lista { overflow: visible; }
}
@media (max-width: 768px) {
  .luna-cv-v-conversa .luna-page-header { display: none; }
  .luna-cv-v-conversa .luna-cv-chat { height: calc(100vh - 84px); height: calc(100dvh - 84px); min-height: 420px; }
  .luna-cv-tit { font-size: 18px; }
  .luna-cv-page .luna-ia-bar { gap: 8px; }
  .luna-cv-page .luna-ia-status { font-size: 12px; gap: 6px; }
  .luna-cv-page .luna-ia-btn { padding: 8px 14px; }
}
/* celular: o selo do modo e o botão "IA da Luna" numa linha só; o painel do botão explica o custo */
@media (max-width: 560px) {
  .luna-cv-page .luna-ia-desc { display: none; }
  .luna-cv-page .luna-ia-bar { flex-wrap: nowrap; }
  .luna-cv-cab-b .btn { padding: 7px 12px; }
}
