/* =====================================================================
   Identidade visual PCM — Pignus Construção e Montagem
   Paleta extraída da logo oficial (dourado #FDB817 + grafite #373435).
   ===================================================================== */
:root {
  --pcm-dourado:       #FDB817;
  --pcm-dourado-escuro: #B9860A;
  --pcm-grafite:       #373435;
  --pcm-texto:         #2b2723;
  --pcm-texto-suave:   #78716a;
  --pcm-fundo:         #F7F5F1;
  --pcm-fundo-cartao:  #ffffff;
  --pcm-borda:         #EAE4D8;

  --kpi-vermelho-bg: #F43F5E;
  --kpi-dourado-bg:  #FDB817;
  --kpi-verde-bg:    #16A34A;
  --kpi-roxo-bg:     #7C3AED;
  --kpi-grafite-bg:  #373435;
}

* { box-sizing: border-box; }

body {
  font-family: "Segoe UI", -apple-system, Roboto, Arial, sans-serif;
  background: var(--pcm-fundo);
  color: var(--pcm-texto);
  margin: 0;
  padding: 0;
}

a { color: var(--pcm-dourado-escuro); }

/* ---------------------------------------------------------------------
   Estrutura geral: topbar + sidebar + conteúdo
   --------------------------------------------------------------------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.app-topbar {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid var(--pcm-borda);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 22px;
  position: relative;
  z-index: 5;
  gap: 10px;
}
.app-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 6px;
  margin-right: 2px;
  color: var(--pcm-grafite);
  cursor: pointer;
  border-radius: 8px;
  flex-shrink: 0;
}
.app-hamburger:hover { background: #F1EEE7; }
.app-topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 3px;
  background: var(--pcm-dourado);
}
.app-marca { display: flex; align-items: center; }
.app-logo-img { height: 30px; width: auto; display: block; }
.app-topbar-acoes { display: flex; align-items: center; gap: 18px; font-size: 13.5px; color: var(--pcm-texto-suave); margin-left: auto; }
.app-usuario { font-weight: 600; color: var(--pcm-texto); }
.app-sair {
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; color: var(--pcm-texto-suave); font-weight: 600;
}
.app-sair:hover { color: var(--pcm-grafite); }
.app-sair svg { color: inherit; }

.app-notif-btn {
  background: transparent; color: var(--pcm-grafite); border: 1px solid var(--pcm-borda);
  padding: 7px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
}
.app-notif-btn:hover { background: #F1EEE7; }

.app-nivel-tag {
  display: inline-block; margin-left: 4px; padding: 2px 8px; border-radius: 999px;
  background: #F1EEE7; color: var(--pcm-texto-suave); font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .03em; vertical-align: middle;
}

.app-corpo { flex: 1; display: flex; position: relative; }

.app-sidebar-backdrop { display: none; }

.app-sidebar {
  width: 216px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--pcm-borda);
  padding: 18px 12px;
}
.app-nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-radius: 9px;
  color: var(--pcm-texto-suave);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 600;
  margin-bottom: 3px;
  transition: background .12s ease, color .12s ease;
}
.app-nav-item svg { flex-shrink: 0; opacity: .8; }
.app-nav-item:hover { background: #FBF6EA; color: var(--pcm-grafite); }
.app-nav-item.ativo { background: var(--pcm-dourado); color: var(--pcm-grafite); }
.app-nav-item.ativo svg { opacity: 1; }

.app-conteudo { flex: 1; padding: 26px 30px 50px; min-width: 0; }

.pagina-cabecalho {
  display: flex; justify-content: space-between; align-items: flex-end;
  flex-wrap: wrap; gap: 10px;
  margin-bottom: 22px;
}
.pagina-cabecalho h1 { font-size: 22px; margin: 0 0 4px; color: var(--pcm-grafite); }
.pagina-cabecalho p { margin: 0; color: var(--pcm-texto-suave); font-size: 14px; }

/* ---------------------------------------------------------------------
   Cartões e componentes gerais
   --------------------------------------------------------------------- */
.cartao {
  background: var(--pcm-fundo-cartao);
  border: 1px solid var(--pcm-borda);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(43, 39, 35, 0.04);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.badge {
  display: inline-block;
  font-size: 11.5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: .2px;
}
.badge-aberto { background: #FCE7E5; color: #B3261E; }
.badge-em_andamento { background: #FFF3D6; color: #8A6300; }
.badge-resolvido { background: #E1F3E5; color: #1E7D32; }
.badge-fechado { background: #ECEAE6; color: #5c564d; }
.badge-encerrado_inatividade { background: #EDE7F6; color: #5B3A9E; }
/* Posição na fila de espera (dashboard) — usa o dourado da marca pra não
   competir com as cores de status, que significam outra coisa. */
.badge-fila { background: #FDF0D0; color: var(--pcm-dourado-escuro); }

.abas { margin-bottom: 16px; display: flex; gap: 4px; border-bottom: 1px solid var(--pcm-borda); }
.abas a {
  display: inline-block;
  padding: 9px 16px;
  text-decoration: none;
  color: var(--pcm-texto-suave);
  font-size: 14px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.abas a.ativa { color: var(--pcm-grafite); border-bottom-color: var(--pcm-dourado); }

/* Chips de filtro por categoria (aba "Todos" do painel). Carregam a mesma
   informação do antigo gráfico "Chamados por categoria" do dashboard —
   nome + total —, mas clicáveis, filtrando a lista. */
.chips-filtro { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 14px; }
.chips-filtro .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid var(--pcm-borda);
  border-radius: 999px;
  background: var(--pcm-fundo-cartao);
  color: var(--pcm-texto);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.3;
}
.chips-filtro .chip:hover { border-color: var(--pcm-dourado); }
.chips-filtro .chip.ativo {
  background: var(--pcm-grafite);
  border-color: var(--pcm-grafite);
  color: #fff;
}
.chip-total {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--pcm-texto-suave);
  background: var(--pcm-fundo);
  border-radius: 999px;
  padding: 1px 7px;
}
.chips-filtro .chip.ativo .chip-total { background: rgba(255,255,255,0.18); color: #fff; }

button, input[type=submit], a.botao {
  background: var(--pcm-grafite);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
}
button:hover, input[type=submit]:hover, a.botao:hover { background: #000; }
button.secundario, a.botao.secundario { background: #F1EEE7; color: var(--pcm-texto); }
button.secundario:hover, a.botao.secundario:hover { background: #e7e2d7; }
button.destaque, a.botao.destaque { background: var(--pcm-dourado); color: var(--pcm-grafite); }
button.destaque:hover, a.botao.destaque:hover { background: #ecab10; }
button.perigo, a.botao.perigo { background: #fff; color: #B3261E; border: 1px solid #F3CBC6; }
button.perigo:hover, a.botao.perigo:hover { background: #FCE7E5; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:disabled:hover { background: inherit; }

input[type=email], input[type=password], input[type=text], input[type=number], input[type=tel],
select, textarea {
  width: 100%; padding: 10px; border-radius: 8px; border: 1px solid var(--pcm-borda);
  margin-bottom: 12px; font-family: inherit; font-size: 14px; background: #fff; color: var(--pcm-texto);
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--pcm-dourado); box-shadow: 0 0 0 3px rgba(253,184,23,0.18);
}

.erro { color: #B3261E; margin-bottom: 12px; font-size: 14px; }
.sucesso { color: #1E7D32; margin-bottom: 12px; font-size: 14px; }
/* Recado neutro dentro de um cartão — nem erro nem sucesso, só
   informação (ex.: chamado do canal antigo, que não aceita resposta). */
.aviso {
  font-size: 13px; color: var(--pcm-texto-suave); background: #FBF6EA;
  border: 1px solid var(--pcm-borda); border-radius: 8px; padding: 10px 12px; margin: 12px 0 0;
}
.vazio { color: var(--pcm-texto-suave); text-align: center; padding: 34px 0; }

table.tabela { width: 100%; border-collapse: collapse; }
table.tabela th {
  text-align: left; padding: 10px 12px; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .4px; color: #9a9188; border-bottom: 1px solid var(--pcm-borda);
}
table.tabela td { padding: 12px; font-size: 14px; border-bottom: 1px solid var(--pcm-borda); vertical-align: middle; }
table.tabela tr:last-child td { border-bottom: none; }
table.tabela tr.linha-link { cursor: pointer; }
table.tabela tr.linha-link:hover { background: #FBF9F4; }
.celula-principal { font-weight: 700; color: var(--pcm-grafite); }
.celula-suave { color: var(--pcm-texto-suave); font-size: 13px; }

/* ---------------------------------------------------------------------
   Dashboard: cards de indicadores
   --------------------------------------------------------------------- */
.kpi-grade {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}
.kpi-cartao {
  border-radius: 12px;
  padding: 16px 18px;
  color: #fff;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 3px 10px rgba(0,0,0,0.07);
  text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease;
}
a.kpi-cartao:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.14);
}
.kpi-cartao .kpi-icone {
  width: 30px; height: 30px; border-radius: 8px;
  background: rgba(255,255,255,0.22);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
}
.kpi-cartao .kpi-rotulo { font-size: 12.5px; font-weight: 600; opacity: .92; }
.kpi-cartao .kpi-valor { font-size: 26px; font-weight: 800; line-height: 1.1; margin-top: 2px; }
.kpi-cartao .kpi-legenda { font-size: 11.5px; opacity: .85; margin-top: 2px; }
.kpi-vermelho { background: var(--kpi-vermelho-bg); }
.kpi-dourado  { background: var(--kpi-dourado-bg); color: var(--pcm-grafite); }
.kpi-dourado .kpi-icone { background: rgba(55,52,53,0.14); }
.kpi-verde    { background: var(--kpi-verde-bg); }
.kpi-roxo     { background: var(--kpi-roxo-bg); }
.kpi-grafite  { background: var(--kpi-grafite-bg); }

.secao-titulo { font-size: 15px; font-weight: 700; color: var(--pcm-grafite); margin: 4px 0 12px; }

/* ---------------------------------------------------------------------
   Tela de chamado: layout de duas colunas (conversa + detalhes)
   --------------------------------------------------------------------- */
.chamado-grade {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: flex-start;
}
@media (max-width: 860px) {
  .chamado-grade { grid-template-columns: 1fr; }
}

.conversa-scroll { max-height: 460px; overflow-y: auto; padding-right: 4px; margin-bottom: 4px; }
.bolha { max-width: 78%; padding: 9px 13px; border-radius: 12px; margin-bottom: 8px; font-size: 14px; line-height: 1.45; }
.bolha-recebida { background: #F3F1EC; margin-right: auto; border-bottom-left-radius: 3px; }
.bolha-enviada { background: #FDF0CC; margin-left: auto; text-align: right; border-bottom-right-radius: 3px; }
.hora-bolha { display: block; font-size: 10.5px; color: #8a8378; margin-top: 3px; }

/* Foto dentro da bolha. `max-height` além do `max-width` porque foto de
   celular em pé é muito mais alta que larga: sem o teto de altura, uma
   única foto vertical empurra a conversa inteira pra fora da tela. */
.bolha-foto {
  display: block; max-width: 100%; max-height: 260px; width: auto; height: auto;
  border-radius: 8px; margin-bottom: 6px; cursor: zoom-in; background: #fff;
}
.bolha-enviada .bolha-foto { margin-left: auto; }

/* Botão "Mensagens prontas" (ao lado do "Anexar foto"). A lista abre
   PRA CIMA, por cima da conversa: o botão fica no pé do cartão, e
   abrindo pra baixo ela sairia da tela. */
.mensagens-prontas { position: relative; }
.mensagens-prontas-botao {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; font-size: 13px; font-weight: 500;
}
.mensagens-prontas-qtd {
  background: var(--pcm-dourado); color: var(--pcm-grafite);
  font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px;
}
.mensagens-prontas-menu {
  position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 20;
  width: 420px; max-width: calc(100vw - 48px);
  background: var(--pcm-fundo-cartao); border: 1px solid var(--pcm-borda);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(55, 52, 53, .16);
  padding: 8px;
}
.mensagens-prontas-menu[hidden] { display: none; }
.mensagens-prontas-filtro { width: 100%; margin-bottom: 6px; box-sizing: border-box; }
.mensagens-prontas-lista { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; }
.mensagens-prontas-lista li[hidden] { display: none; }
.mensagens-prontas-item {
  display: block; width: 100%; text-align: left;
  background: transparent; color: var(--pcm-texto);
  padding: 8px 10px; border-radius: 6px;
  font-size: 13px; font-weight: 400; line-height: 1.4;
  white-space: pre-line; overflow-wrap: anywhere;
}
.mensagens-prontas-item:hover, .mensagens-prontas-item:focus { background: #FDF8EA; outline: none; }
.mensagens-prontas-lista li + li { border-top: 1px solid var(--pcm-borda); }
.mensagens-prontas-vazio { margin: 6px 10px; font-size: 13px; }
.mensagens-prontas-gerenciar {
  display: block; margin-top: 6px; padding: 8px 10px 2px;
  border-top: 1px solid var(--pcm-borda); font-size: 12.5px;
}

/* Links dentro das bolhas (ex.: "wa.me/55..." de uma mensagem pronta). */
.bolha a:not(:has(img)) { color: var(--pcm-dourado-escuro); text-decoration: underline; overflow-wrap: anywhere; }

form.responder { display: flex; gap: 8px; margin-top: 14px; }
form.responder textarea {
  flex: 1; padding: 10px; border-radius: 8px; border: 1px solid var(--pcm-borda);
  font-family: inherit; resize: vertical; min-height: 46px;
}

/* Formulário com anexo: vira coluna (campo+botão em cima, anexo embaixo)
   e a linha de cima assume o layout que era do próprio form. */
form.responder-com-anexo { flex-direction: column; gap: 8px; }
form.responder-com-anexo .responder-linha { display: flex; gap: 8px; }

.responder-anexo { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* O <input type=file> nativo não é estilizável de forma confiável entre
   navegadores, então ele fica escondido dentro do <label> — clicar no
   rótulo abre o seletor do mesmo jeito, e no celular oferece a câmera. */
.rotulo-anexo {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 7px 12px; border-radius: 8px; border: 1px dashed var(--pcm-borda);
  font-size: 13px; font-weight: 500; color: var(--pcm-texto); background: transparent;
  transition: border-color .15s, background .15s;
}
.rotulo-anexo:hover { border-color: var(--pcm-dourado); background: #FDF8EA; }
.rotulo-anexo input[type="file"] { display: none; }
.anexo-resumo { font-size: 12px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.anexo-resumo-alerta { color: #a8442a; font-weight: 500; }

/* Fotos já escolhidas, antes de enviar: uma por linha, com miniatura e
   botão de remover. É aqui que a pessoa percebe que pegou a foto errada
   — por isso a miniatura, e não só o nome do arquivo. */
.anexo-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.anexo-lista[hidden] { display: none; }
.anexo-item {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 8px; border-radius: 8px; background: #F7F5F0;
  border: 1px solid var(--pcm-borda);
}
.anexo-mini {
  width: 38px; height: 38px; flex: none; object-fit: cover;
  border-radius: 5px; background: #fff;
}
.anexo-nome {
  flex: 1; min-width: 0; font-size: 12.5px; color: var(--pcm-texto);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Foto além do limite do servidor: fica na lista, marcada, pra pessoa
   escolher qual tirar em vez de o sistema decidir por ela. */
.anexo-item-excedente { border-color: #d9a48f; background: #FBF1ED; }
.anexo-item-excedente .anexo-nome { color: #a8442a; }
.anexo-remover {
  flex: none; width: 26px; height: 26px; padding: 0; line-height: 1;
  border: none; border-radius: 50%; cursor: pointer;
  background: transparent; color: #8a8378; font-size: 13px;
  transition: background .15s, color .15s;
}
.anexo-remover:hover { background: #EAE5DC; color: #a8442a; }

.anexo-limpar-linha { display: flex; justify-content: flex-end; }
.anexo-limpar {
  border: none; background: transparent; cursor: pointer; padding: 2px 4px;
  font-size: 12px; color: #8a8378; text-decoration: underline;
}
.anexo-limpar:hover { color: #a8442a; }

.painel-detalhes .item-detalhe { margin-bottom: 14px; }
.painel-detalhes .item-detalhe .rotulo { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: #9a9188; font-weight: 700; margin-bottom: 3px; }
.painel-detalhes .item-detalhe .valor { font-size: 14px; color: var(--pcm-texto); }
.painel-detalhes hr { border: none; border-top: 1px solid var(--pcm-borda); margin: 16px 0; }
.acoes-chamado { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }

.estrela { color: var(--pcm-dourado); }

/* ---------------------------------------------------------------------
   Tela de login (sem sidebar)
   --------------------------------------------------------------------- */
.tela-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--pcm-fundo);
}
.cartao-login {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border: 1px solid var(--pcm-borda);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(43,39,35,0.08);
  padding: 34px 30px;
  text-align: center;
}
.cartao-login .app-logo-img { height: 34px; margin: 0 auto 18px; }
.cartao-login-legenda {
  text-align: center;
  color: var(--pcm-texto-suave);
  font-size: 13px;
  margin-bottom: 22px;
}
.cartao-login form { text-align: left; }
/* Links de apoio embaixo do formulário de login ("Esqueci minha senha",
   "Voltar para o login") — separados do botão, centralizados. */
.cartao-login-rodape { text-align: center; margin: 16px 0 0; font-size: 13px; }
/* Rótulo de campo em formulário de configuração. Classe própria em vez de
   estilizar `label` direto: o `label` cru também envolve checkbox (ver
   .linha-ativo em inatividade.php), onde virar bloco quebraria a linha. */
.form-rotulo { display: block; font-size: 12.5px; font-weight: 700; color: var(--pcm-grafite); margin-bottom: 5px; }
.cartao-login input[type=submit] { width: 100%; }

/* ---------------------------------------------------------------------
   Chat público do site (chat.php) — cliente abre chamado e conversa
   e conversa com o atendente. Sem sidebar, card único centralizado.
   --------------------------------------------------------------------- */
.tela-chat {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--pcm-fundo);
  padding: 24px 14px;
}
.cartao-chat {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border: 1px solid var(--pcm-borda);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(43,39,35,0.08);
  padding: 28px 26px;
}
.chat-titulo { font-size: 19px; margin: 0 0 2px; color: var(--pcm-grafite); text-align: center; }
.chat-cabecalho { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.chat-protocolo { font-weight: 700; color: var(--pcm-grafite); font-size: 14.5px; }
.chat-aviso {
  font-size: 12.5px; color: var(--pcm-texto-suave); background: #FBF6EA;
  border: 1px solid var(--pcm-borda); border-radius: 8px; padding: 8px 10px; margin: 10px 0 14px;
}
.chat-rodape { text-align: center; margin-top: 14px; font-size: 13px; }
.cartao-chat .conversa-scroll { max-height: 380px; }

/* ---------------------------------------------------------------------
   Responsivo (celular/tablet): menu lateral vira gaveta, tabelas passam
   a rolar na horizontal, formulários empilham.
   --------------------------------------------------------------------- */
@media (max-width: 860px) {
  .app-hamburger { display: inline-flex; }
  .app-topbar { padding: 0 12px; }
  .app-usuario { display: none; }
  /* Antes era `display: none`, o que impedia quem usa o celular de ativar
     as notificações — e, pior, de descobrir que estavam bloqueadas. Fica
     visível, só compacto e com o texto cortado se não couber. */
  .app-notif-btn {
    font-size: 11px; padding: 6px 9px;
    max-width: 42vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .app-topbar-acoes { gap: 10px; }
  .app-sair span { display: none; }
  .app-sair { padding: 6px; }

  .app-sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 0;
    width: 240px;
    max-width: 78vw;
    z-index: 25;
    overflow-y: auto;
    box-shadow: 3px 0 16px rgba(0,0,0,0.14);
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  body.pcm-menu-aberto .app-sidebar { transform: translateX(0); }

  .app-sidebar-backdrop {
    display: block;
    position: fixed;
    top: 60px; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0);
    pointer-events: none;
    transition: background .2s ease;
    z-index: 20;
  }
  body.pcm-menu-aberto .app-sidebar-backdrop {
    background: rgba(43,39,35,0.4);
    pointer-events: auto;
  }

  .app-conteudo { padding: 18px 16px 40px; }
  .pagina-cabecalho h1 { font-size: 19px; }

  /* Tabelas ficam largas demais pra tela pequena: em vez de espremer as
     colunas, deixa rolar de lado (mais fácil de usar que texto cortado). */
  .cartao:has(table.tabela) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.tabela { min-width: 640px; }

  /* Linhas de formulário (adicionar categoria/usuário) empilham. */
  .linha-form-add { display: flex !important; flex-direction: column !important; }
  .linha-form-add > * { width: 100% !important; }

  form.responder { flex-direction: column; }
  form.responder button { width: 100%; }
  /* No celular o campo e o botão empilham; a linha interna do formulário
     com anexo precisa acompanhar, senão o botão fica espremido ao lado. */
  form.responder-com-anexo .responder-linha { flex-direction: column; gap: 8px; }
  .rotulo-anexo { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  .kpi-grade { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi-cartao { padding: 12px 14px; min-height: 84px; }
  .kpi-cartao .kpi-valor { font-size: 22px; }
  .cartao { padding: 14px 14px; }
  .app-conteudo { padding: 14px 10px 36px; }
}

/* ---------------------------------------------------------------------
   Aviso de mensagem nova (cartão na própria tela) — assets/notificacoes.js
   Fica por cima de tudo (topbar = z-index 5, gaveta lateral = 25), no
   canto de cima à direita. Existe porque a notificação do sistema
   operacional é engolida com facilidade (permissão negada, Assistente de
   foco do Windows, navegador minimizado) e aí o atendente não via nada.
   --------------------------------------------------------------------- */
.pcm-toasts {
  position: fixed;
  top: 72px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 380px;
  max-width: calc(100vw - 24px);
  pointer-events: none; /* o container não bloqueia cliques; os cartões sim */
}

.pcm-toast {
  pointer-events: auto;
  position: relative;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 40px 14px 14px;
  border-radius: 12px;
  border-left: 6px solid var(--pcm-dourado);
  background: var(--pcm-grafite);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(255, 255, 255, 0.06);
  animation: pcm-toast-entrada .26s cubic-bezier(.2, .9, .3, 1.2),
             pcm-toast-atencao 1s ease-in-out .3s 2;
}
.pcm-toast:hover { background: #423e3f; }

/* Chamado novo é o caso mais urgente: ninguém assumiu ainda. Ganha a
   borda dourada cheia em vez de só a faixa lateral. */
.pcm-toast-novo {
  border: 2px solid var(--pcm-dourado);
  border-left-width: 6px;
}

.pcm-toast-icone { font-size: 22px; line-height: 1.2; flex: 0 0 auto; }

.pcm-toast-corpo { min-width: 0; flex: 1; }

.pcm-toast-rotulo {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .09em;
  color: var(--pcm-dourado);
  margin-bottom: 3px;
}

.pcm-toast-nome {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  /* Nome comprido de cliente não pode empurrar o cartão pra fora da tela. */
  overflow-wrap: anywhere;
}

.pcm-toast-texto {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.86);
  overflow-wrap: anywhere;
  /* Trecho da mensagem em até 3 linhas: passando disso o cartão viraria
     um bloco de texto e esconderia os avisos de baixo. */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pcm-toast-acao {
  margin-top: 7px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--pcm-dourado);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.pcm-toast-fechar {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.pcm-toast-fechar:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }

.pcm-toast-saindo {
  animation: pcm-toast-saida .2s ease-in forwards;
}

@keyframes pcm-toast-entrada {
  from { opacity: 0; transform: translateX(26px) scale(.96); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes pcm-toast-saida {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(26px); }
}

/* Duas pulsadas de halo dourado logo depois de aparecer: é o que faz o
   aviso ser notado mesmo com o olho em outra parte da tela. */
@keyframes pcm-toast-atencao {
  0%, 100% { box-shadow: 0 14px 38px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(255, 255, 255, 0.06); }
  50%      { box-shadow: 0 14px 38px rgba(0, 0, 0, 0.42), 0 0 0 6px rgba(253, 184, 23, 0.45); }
}

/* Quem configurou o sistema pra reduzir animação continua vendo o cartão,
   só sem o movimento e o pulso. */
@media (prefers-reduced-motion: reduce) {
  .pcm-toast, .pcm-toast-saindo { animation: none; }
}

/* Botão de notificações bloqueadas: precisa gritar, senão o atendente
   nunca descobre por que parou de aparecer aviso no computador dele. */
.app-notif-btn.bloqueado {
  background: #FEF2F2;
  border-color: #F43F5E;
  color: #B91C3C;
}
.app-notif-btn.bloqueado:hover { background: #FDE4E7; }

/* No celular o cartão ocupa a largura da tela, encostado nas duas bordas.
   Este bloco fica no fim do arquivo de propósito: a mesma regra dentro do
   @media lá de cima perderia pra `.pcm-toasts` (mesma especificidade,
   declarada depois) e o cartão continuaria com 380px fixos. */
@media (max-width: 860px) {
  .pcm-toasts { top: 68px; left: 8px; right: 8px; width: auto; }
}
