/* Cores da logomarca da North Sistemas: azul-marinho #04166d e azul #3d59e1. */
:root {
  color-scheme: light;
  --fundo: #f3f5fb;
  --superficie: #ffffff;
  --superficie-2: #f5f7fc;
  --borda: #e0e4f1;
  --borda-forte: #c8cfe4;
  --texto: #141b3d;
  --texto-suave: #5b6485;
  --destaque: #3d59e1;
  --destaque-forte: #2c45c4;
  --destaque-fundo: #e9edfc;
  --lateral: #03104f;
  --lateral-texto: #b7c1ec;
  --lateral-marca: #7f95f5;
  --sombra: 0 1px 2px rgba(4, 22, 109, .06), 0 6px 20px rgba(4, 22, 109, .06);
  --raio: 12px;

  --azul: #3d59e1;      --azul-fundo: #e9edfc;
  --ambar: #a86200;     --ambar-fundo: #fff2d9;
  --roxo: #6d3fd4;      --roxo-fundo: #efe9fd;
  --verde: #18794a;     --verde-fundo: #e2f6ea;
  --vermelho: #c62f2f;  --vermelho-fundo: #fde8e8;
  --laranja: #bd4f08;   --laranja-fundo: #ffeade;
  --cinza: #56617a;     --cinza-fundo: #eceff5;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --fundo: #080c1e;
    --superficie: #10163a;
    --superficie-2: #161d47;
    --borda: #242d5c;
    --borda-forte: #36417c;
    --texto: #e7eafa;
    --texto-suave: #9aa4cf;
    --destaque: #6a82f0;
    --destaque-forte: #8a9df5;
    --destaque-fundo: #1b2458;
    --lateral: #050919;
    --sombra: 0 1px 2px rgba(0, 0, 0, .3);

    --azul: #93a5f7;      --azul-fundo: #1b2458;
    --ambar: #f0b657;     --ambar-fundo: #3a2c10;
    --roxo: #b79cf5;      --roxo-fundo: #2b2149;
    --verde: #6fd39c;     --verde-fundo: #143324;
    --vermelho: #f58b8b;  --vermelho-fundo: #421c1c;
    --laranja: #f5a06b;   --laranja-fundo: #40240f;
    --cinza: #a6afd2;     --cinza-fundo: #222a52;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fundo);
  color: var(--texto);
  font: 14px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 24px; font-weight: 650; letter-spacing: -.01em; overflow-wrap: anywhere; }
h2 { font-size: 15px; font-weight: 650; }
a { color: var(--destaque); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
.suave { color: var(--texto-suave); }
.pequeno { font-size: 12.5px; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--destaque); outline-offset: 2px; }

/* ---------- Estrutura ---------- */
.layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.barra-topo, .fundo-menu { display: none; }

.lateral {
  background: var(--lateral);
  color: var(--lateral-texto);
  padding: 20px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.marca { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 17px; font-weight: 650; padding: 0 8px; }
.marca-logo { width: 32px; height: 32px; flex: none; border-radius: 50%; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .28); }
.logo-entrada { display: block; text-align: center; margin-bottom: 14px; }
.logo-entrada img { height: 132px; width: auto; max-width: 100%; }
.lateral-topo { display: flex; align-items: center; justify-content: space-between; }
.lateral .btn-primario { justify-content: center; padding: 10px 14px; }
.lateral nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.lateral nav a {
  color: inherit; padding: 10px 12px; border-radius: 9px; display: flex; align-items: center; gap: 11px;
  font-weight: 550; position: relative;
}
.lateral nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.lateral nav a.ativo { background: rgba(255, 255, 255, .1); color: #fff; }
.lateral nav a.ativo::before {
  content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--lateral-marca);
}
.usuario-caixa { border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 14px; display: flex; align-items: center; gap: 10px; }
.usuario-caixa .quem { flex: 1; min-width: 0; line-height: 1.3; }
.usuario-caixa .quem > * { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usuario-caixa strong { color: #fff; }

.conteudo { padding: 30px 36px 56px; min-width: 0; max-width: 1320px; width: 100%; }
.cabecalho { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px 16px; flex-wrap: wrap; margin-bottom: 20px; }
.cabecalho > div:first-child { min-width: 0; flex: 1 1 260px; }
.cabecalho .acoes { display: flex; gap: 8px; flex-wrap: wrap; }
.voltar { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 8px; font-size: 13px; font-weight: 550; }
.voltar .ico { width: 15px; height: 15px; }

/* ---------- Componentes ---------- */
.cartao { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); box-shadow: var(--sombra); min-width: 0; }
.cartao-corpo { padding: 18px 20px; }
.cartao-titulo { padding: 14px 20px; border-bottom: 1px solid var(--borda); display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 9px; padding: 8px 14px; min-height: 38px;
  border: 1px solid var(--borda-forte); background: var(--superficie); color: var(--texto);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--superficie-2); text-decoration: none; }
.btn-primario { background: var(--destaque); border-color: var(--destaque); color: #fff; }
.btn-primario:hover { background: var(--destaque-forte); border-color: var(--destaque-forte); }
.btn-sucesso { background: #1c8a52; border-color: #1c8a52; color: #fff; }
.btn-sucesso:hover { background: #17754a; border-color: #17754a; }
.btn-pequeno { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn-pequeno .ico { width: 15px; height: 15px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-icone {
  width: 38px; height: 38px; padding: 0; border: 0; border-radius: 9px; background: none; color: inherit; cursor: pointer;
  display: inline-grid; place-items: center; flex: none;
}
.btn-icone:hover { background: rgba(128, 140, 170, .18); }

input, select, textarea {
  font: inherit; color: var(--texto); background: var(--superficie); border: 1px solid var(--borda-forte);
  border-radius: 9px; padding: 8px 11px; width: 100%; min-height: 38px;
}
textarea { resize: vertical; min-height: 96px; }
input::placeholder, textarea::placeholder { color: var(--texto-suave); opacity: .8; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--destaque); outline-offset: -1px; border-color: var(--destaque); }
.campo { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.campo > span { font-size: 12.5px; font-weight: 600; color: var(--texto-suave); }
.com-botao { display: flex; gap: 8px; }
.aviso { border-radius: 9px; padding: 9px 12px; background: var(--cinza-fundo); color: var(--cinza); font-size: 13px; }
.aviso.sucesso { background: var(--verde-fundo); color: var(--verde); }
.aviso.alerta { background: var(--ambar-fundo); color: var(--ambar); }
.grade-form { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.c2 { grid-column: span 2; } .c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c6 { grid-column: span 6; }

.selo {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--cinza-fundo); color: var(--cinza);
}
.selo::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.selo-aberto, .selo-media { background: var(--azul-fundo); color: var(--azul); }
.selo-em_andamento { background: var(--ambar-fundo); color: var(--ambar); }
.selo-aguardando_cliente { background: var(--roxo-fundo); color: var(--roxo); }
.selo-fechado, .selo-ativo { background: var(--verde-fundo); color: var(--verde); }
.selo-alta { background: var(--laranja-fundo); color: var(--laranja); }
.selo-critica, .selo-ruim { background: var(--vermelho-fundo); color: var(--vermelho); }
.selo-bom { background: var(--verde-fundo); color: var(--verde); }
.selo-regular { background: var(--ambar-fundo); color: var(--ambar); }
.atrasado { color: var(--vermelho); font-weight: 600; }

/* Lista / Quadro: dois botões colados, o ativo fica destacado. */
.alternar { display: flex; }
.alternar .btn { border-radius: 0; }
.alternar .btn:first-child { border-radius: 9px 0 0 9px; }
.alternar .btn:last-child { border-radius: 0 9px 9px 0; margin-left: -1px; }
.alternar .btn.ativo { background: var(--destaque-fundo); color: var(--destaque); border-color: var(--destaque); position: relative; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font-size: 12.5px; font-weight: 700; background: var(--destaque-fundo); color: var(--destaque);
}
.com-avatar { display: flex; align-items: center; gap: 11px; min-width: 0; }
.com-avatar > div { min-width: 0; }

/* Abas de status: são botões de rádio, então funcionam com teclado e entram no formulário. */
.abas { display: flex; gap: 6px; padding: 12px 16px 0; overflow-x: auto; scrollbar-width: none; }
.abas::-webkit-scrollbar { display: none; }
.aba { position: relative; flex: none; }
.aba input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; cursor: pointer; }
.aba span {
  display: block; padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: 13px;
  color: var(--texto-suave); border: 1px solid transparent; white-space: nowrap;
}
.aba input:hover + span { background: var(--superficie-2); color: var(--texto); }
.aba input:checked + span { background: var(--destaque-fundo); color: var(--destaque); border-color: var(--destaque); }
.aba input:focus-visible + span { outline: 2px solid var(--destaque); outline-offset: 2px; }

.filtros { display: flex; gap: 10px; flex-wrap: wrap; padding: 12px 16px 14px; border-bottom: 1px solid var(--borda); }
.busca { position: relative; flex: 1 1 260px; min-width: 0; }
.busca .ico { position: absolute; left: 11px; top: 50%; translate: 0 -50%; color: var(--texto-suave); pointer-events: none; }
.busca input { padding-left: 36px; }
.filtros select { width: auto; flex: 0 1 auto; min-width: 0; }

.rolagem { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; font-weight: 650; color: var(--texto-suave); text-transform: uppercase; letter-spacing: .05em; padding: 10px 16px; border-bottom: 1px solid var(--borda); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--borda); vertical-align: middle; }
td:empty::after { content: "—"; color: var(--texto-suave); }
tbody tr:last-child td { border-bottom: 0; }
tr[data-ir] { cursor: pointer; }
tr[data-ir]:hover td { background: var(--superficie-2); }
td.acao { text-align: right; white-space: nowrap; }
.numero { font-variant-numeric: tabular-nums; color: var(--texto-suave); font-weight: 600; white-space: nowrap; }
.titulo-linha { font-weight: 600; overflow-wrap: anywhere; }

.vazio { padding: 40px 20px; text-align: center; color: var(--texto-suave); display: grid; justify-items: center; gap: 10px; }
.vazio .ico { width: 34px; height: 34px; stroke-width: 1.5; opacity: .7; }

/* ---------- Painel ---------- */
.grade-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { padding: 16px 18px; display: block; color: inherit; border-left: 4px solid var(--cor, var(--borda-forte)); transition: translate .12s, box-shadow .12s; }
.stat:hover { text-decoration: none; translate: 0 -2px; box-shadow: 0 8px 24px rgba(20, 30, 60, .1); }
.stat .valor { font-size: 30px; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .rotulo { color: var(--texto-suave); font-size: 13px; margin-top: 4px; }
.grade-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 18px; margin-bottom: 18px; }
.item-lista { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--borda); color: inherit; }
.item-lista:last-child { border-bottom: 0; border-radius: 0 0 var(--raio) var(--raio); }
.item-lista:hover { background: var(--superficie-2); text-decoration: none; }
.item-lista .meio { flex: 1; min-width: 0; }
.item-lista .meio > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra-linha { display: grid; grid-template-columns: 76px 1fr 28px; align-items: center; gap: 12px; padding: 7px 0; }
.barra { height: 8px; border-radius: 999px; background: var(--cinza-fundo); overflow: hidden; }
.barra > i { display: block; height: 100%; border-radius: 999px; background: currentColor; }
.barra-linha b { text-align: right; font-variant-numeric: tabular-nums; }
.barra-larga { grid-template-columns: 130px 1fr 28px; }
.stat-fixo:hover { translate: none; box-shadow: var(--sombra); }
.linha-prazo { display: grid; grid-template-columns: 110px 120px auto; align-items: center; gap: 12px; justify-content: start; }
.linha-prazo .selo { justify-self: start; }
.nome-inteiro { overflow-wrap: normal; white-space: nowrap; }

/* ---------- Quadro de chamados ---------- */
.quadro { display: grid; grid-template-columns: repeat(3, minmax(240px, 1fr)); gap: 14px; padding: 16px; overflow-x: auto; align-items: start; }
.coluna { background: var(--superficie-2); border: 1px solid var(--borda); border-radius: var(--raio); padding: 12px; display: grid; gap: 10px; min-width: 0; }
.coluna h3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.cartao-quadro { display: grid; gap: 6px; padding: 12px 14px; color: inherit; }
.cartao-quadro:hover { text-decoration: none; border-color: var(--destaque); }
.cartao-quadro .selos { margin-top: 2px; }
.coluna-vazia { padding: 14px 4px; text-align: center; }
.avaliacao-linha { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.apontamento:hover { background: none; }

/* ---------- Chamado ---------- */
.detalhe { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; align-items: start; }
.selos { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.dados { display: grid; gap: 13px; margin: 0; }
.dados dt { font-size: 11.5px; font-weight: 650; color: var(--texto-suave); text-transform: uppercase; letter-spacing: .05em; }
.dados dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.solucao { border-color: var(--verde); background: var(--verde-fundo); }
.linha-tempo { list-style: none; margin: 0; padding: 0; }
.linha-tempo li { padding: 13px 20px; border-bottom: 1px solid var(--borda); }
.linha-tempo li.evento { color: var(--texto-suave); font-size: 13px; background: var(--superficie-2); }
.linha-tempo .quem { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 3px; flex-wrap: wrap; }
.comentar { padding: 16px 20px; display: grid; gap: 10px; }
.comentar .acoes { display: flex; justify-content: flex-end; }
.pilha { display: grid; gap: 18px; min-width: 0; }
.acoes-lado { display: grid; gap: 10px; }

/* ---------- Conversas ---------- */
.contador {
  background: #d93838; color: #fff; border-radius: 999px; min-width: 20px; height: 20px; padding: 0 6px;
  font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; margin-left: auto; flex: none;
}
.conversas { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 18px; align-items: start; }
.lista-conversas { max-height: calc(100dvh - 170px); overflow-y: auto; }
.lista-conversas .item-lista { padding: 12px 16px; }
.item-lista.ativo { background: var(--destaque-fundo); }
.painel-conversa { display: flex; flex-direction: column; height: calc(100dvh - 170px); min-height: 420px; overflow: hidden; }
.painel-conversa > .vazio { margin: auto; }
.conversa-topo { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--borda); flex-wrap: wrap; }
.conversa-topo .meio { flex: 1; min-width: 140px; }
.conversa-topo .acoes { display: flex; gap: 8px; flex-wrap: wrap; }
.voltar-conversas { display: none; color: inherit; }
.mensagens { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 8px; background: var(--superficie-2); }
.msg { max-width: min(78%, 560px); padding: 9px 13px; border-radius: 14px; }
.msg.cliente { align-self: flex-start; background: var(--superficie); border: 1px solid var(--borda); border-bottom-left-radius: 4px; }
.msg.atendente { align-self: flex-end; background: var(--destaque-fundo); border-bottom-right-radius: 4px; }
.msg.sistema { align-self: center; max-width: 90%; text-align: center; font-size: 12.5px; color: var(--texto-suave); background: var(--cinza-fundo); padding: 4px 14px; }
.msg-rodape { font-size: 11.5px; color: var(--texto-suave); margin-top: 3px; }
.msg img.anexo, .msg video.anexo { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; background: var(--cinza-fundo); }
.msg audio.anexo { display: block; width: 280px; max-width: 100%; height: 40px; }
details.secao { border: 1px solid var(--borda); border-radius: 9px; padding: 0 14px; }
details.secao > summary { padding: 11px 0; font-weight: 650; }
details.secao[open] { padding-bottom: 14px; }
.caixas { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 14px; }
.alerta-config { display: grid; gap: 16px; }
.alerta-config fieldset { border: 1px solid var(--borda); border-radius: 9px; margin: 0; padding: 6px 12px 10px; display: grid; }
.alerta-config legend { font-size: 12.5px; font-weight: 600; color: var(--texto-suave); padding: 0 6px; }
.alerta-opcao, .opcao { display: flex; align-items: center; gap: 10px; padding: 7px 0; cursor: pointer; }
.alerta-opcao input, .opcao input { width: 18px; height: 18px; min-height: 0; margin: 0; flex: none; accent-color: var(--destaque); }
.midia { display: inline-flex; align-items: center; gap: 4px; margin-right: auto; }
.midia .gravando { color: #fff; background: #d64545; }
.midia-tempo { font-variant-numeric: tabular-nums; font-weight: 600; color: #d64545; padding: 0 4px; }
.responder { display: grid; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--borda); }
.responder textarea { min-height: 58px; }
.responder .acoes { display: flex; justify-content: flex-end; gap: 8px; }
.conversa-fim { padding: 14px; text-align: center; border-top: 1px solid var(--borda); }
.opcao-artigo { width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--borda); font: inherit; color: inherit; cursor: pointer; padding: 10px 4px; }

/* ---------- Base de conhecimento e canais ---------- */
.sugestoes { font-size: 13px; background: var(--destaque-fundo); border-radius: 9px; padding: 8px 12px; }
.codigo { font-family: Consolas, monospace; font-size: 16px; letter-spacing: .08em; }
.codigo-bloco { background: var(--superficie-2); border: 1px solid var(--borda); border-radius: 9px; padding: 12px; overflow-x: auto; font-size: 12.5px; margin: 0; }
h2 .ico { vertical-align: -3px; }
summary { cursor: pointer; }

/* ---------- Modal ---------- */
dialog.modal {
  border: 1px solid var(--borda); border-radius: 16px; padding: 0; background: var(--superficie); color: var(--texto);
  width: min(700px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); box-shadow: 0 24px 70px rgba(0, 0, 0, .3);
}
dialog.modal[open] { display: flex; }
dialog.modal.estreito { width: min(440px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(10, 15, 30, .55); }
.modal form { display: flex; flex-direction: column; min-height: 0; width: 100%; }
.modal header { padding: 12px 12px 12px 22px; border-bottom: 1px solid var(--borda); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal header h2 { font-size: 17px; }
.modal .corpo { padding: 20px 22px; overflow-y: auto; }
.modal footer { padding: 14px 22px; border-top: 1px solid var(--borda); display: flex; justify-content: flex-end; gap: 8px; }
.erro { background: var(--vermelho-fundo); color: var(--vermelho); border-radius: 9px; padding: 9px 12px; margin-bottom: 14px; font-weight: 550; }

/* ---------- Avisos rápidos ---------- */
.avisos { position: fixed; left: 50%; bottom: 24px; translate: -50% 0; display: grid; gap: 8px; z-index: 100; width: max-content; max-width: calc(100vw - 32px); }
.aviso-rapido {
  background: #18202f; color: #fff; padding: 11px 16px; border-radius: 10px; font-weight: 550;
  display: flex; align-items: center; gap: 9px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); animation: subir .18s ease-out;
}
.aviso-rapido.sucesso .ico { color: #6fd39c; }
.aviso-rapido.erro-rapido { background: #a82626; }
@keyframes subir { from { opacity: 0; translate: 0 8px; } }

/* ---------- Acesso ---------- */
.acesso { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.acesso .cartao { width: min(400px, 100%); padding: 30px 28px; }
.acesso .marca { color: var(--texto); padding: 0 0 8px; font-size: 19px; justify-content: center; }
.acesso form { display: grid; gap: 14px; margin-top: 20px; }
.acesso .btn { padding: 10px; }

/* ---------- Tablet e celular: o menu vira gaveta ---------- */
@media (max-width: 960px) {
  .layout { display: block; }
  .barra-topo {
    display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 20;
    background: var(--lateral); color: #fff; padding: 8px 12px;
  }
  .barra-topo .marca { flex: 1; padding: 0; font-size: 16px; }
  .lateral {
    position: fixed; inset: 0 auto 0 0; width: min(280px, 86vw); height: auto; z-index: 40;
    translate: -100% 0; transition: translate .2s ease-out; visibility: hidden;
  }
  .menu-aberto .lateral { translate: 0 0; visibility: visible; box-shadow: 0 0 60px rgba(0, 0, 0, .5); }
  .menu-aberto .fundo-menu { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(10, 15, 30, .55); }
  .lateral nav a.ativo::before { left: -14px; }
  .conteudo { padding: 20px 16px 48px; }
  .detalhe { grid-template-columns: minmax(0, 1fr); }
  /* No chamado, as ações (fechar, assumir) sobem para o topo; os dados ficam depois do histórico. */
  .detalhe > .pilha { display: contents; }
  .detalhe .cartao-acoes { order: -1; }
  /* Conversas: no celular aparece a lista ou a conversa, uma de cada vez. */
  .conversas { grid-template-columns: minmax(0, 1fr); }
  .com-conversa .lista-conversas, .conversas:not(.com-conversa) .painel-conversa { display: none; }
  .voltar-conversas { display: inline-grid; }
  .painel-conversa { height: calc(100dvh - 190px); }
  h1 { font-size: 21px; }
}

/* ---------- Celular: tabelas viram cartões, formulários em uma coluna ---------- */
@media (max-width: 680px) {
  .grade-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 13px 14px; }
  .stat .valor { font-size: 25px; }
  .cabecalho .acoes, .cabecalho .acoes .btn { flex: 1 1 auto; }

  .rolagem { overflow: visible; }
  thead { display: none; }
  table, tbody { display: block; }
  tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 13px 16px; border-bottom: 1px solid var(--borda); }
  tbody tr:last-child { border-bottom: 0; }
  td { padding: 0; border: 0; }
  td:empty { display: none; }
  td.principal { flex: 1 1 100%; order: -1; }
  td.acao { margin-left: auto; }
  td[data-rotulo]::before { content: attr(data-rotulo) ": "; color: var(--texto-suave); font-size: 12.5px; }
  tr[data-ir]:hover td { background: none; }
  tr[data-ir]:active { background: var(--superficie-2); }

  .quadro { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .filtros select { flex: 1 1 140px; }
  .grade-form { grid-template-columns: minmax(0, 1fr); }
  .c2, .c3, .c4, .c6 { grid-column: auto; }
  .com-botao { flex-wrap: wrap; }
  .com-botao .btn { flex: 1 1 auto; }

  dialog.modal, dialog.modal.estreito {
    width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 18px 18px 0 0; border-width: 1px 0 0;
  }
  .modal .corpo { padding: 16px; }
  .modal footer { padding: 12px 16px; }
  .modal footer .btn { flex: 1; }
  .avisos { bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Sugestão de instalar o app: cartão no canto em tela larga, faixa no alto no celular. */
.instalar-barra {
  position: fixed; z-index: 60; top: 16px; right: 16px; width: min(400px, calc(100vw - 24px));
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px;
  background: var(--superficie); border: 1px solid var(--borda-forte); border-radius: var(--raio); box-shadow: 0 12px 40px rgba(4, 12, 50, .35);
}
.instalar-barra img { border-radius: 50%; flex: none; }
.instalar-barra .meio { flex: 1 1 160px; min-width: 0; }
.instalar-barra .acoes { display: flex; gap: 8px; margin-left: auto; }
@media (max-width: 700px) { .instalar-barra { top: 64px; left: 12px; right: 12px; width: auto; } }
