/* BKP Chamados — interface. Sem fontes ou bibliotecas externas. */
:root {
  --fundo: #f4f6f9; --superficie: #ffffff; --superficie2: #f8fafc; --borda: #dde3ea; --texto: #1f2933; --suave: #5f6b7a;
  --pri: #1f5fbf; --pri-escuro: #174a96; --pri-claro: #e8f0fc; --perigo: #c0392b; --ok: #1e8449; --alerta: #b9770e;
  --lateral: #13294b; --lateral-texto: #d6e2f3; --lateral-ativo: #24477e;
  --sombra: 0 1px 3px rgba(15, 30, 60, .08), 0 4px 16px rgba(15, 30, 60, .06); --raio: 8px;
  /* situações dos chamados */
  --azul: #1f5fbf; --roxo: #7d3cb5; --ciano: #0e7c86; --laranja: #c25e00; --vermelho: #c0392b; --verde-claro: #4c9a2a;
  --verde: #1e8449; --amarelo: #9a7d0a; --cinza-azulado: #4a6274; --cinza: #7f8c8d;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fundo: #10161f; --superficie: #18212d; --superficie2: #1d2835; --borda: #2c3a4b; --texto: #e5ebf2; --suave: #9aa8b8;
    --pri: #5b9bf0; --pri-escuro: #7fb1f4; --pri-claro: #1b2b44; --perigo: #ef6b5b; --ok: #52be80; --alerta: #f0b44c;
    --lateral: #0b1220; --lateral-texto: #c4d1e3; --lateral-ativo: #1c3157;
    --azul: #5b9bf0; --roxo: #b58ae0; --ciano: #4cc3cc; --laranja: #f09a4c; --vermelho: #ef6b5b; --verde-claro: #8bcf6a;
    --verde: #52be80; --amarelo: #e6c84e; --cinza-azulado: #93a9bb; --cinza: #a3adb5;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 15px; background: var(--fundo); color: var(--texto); line-height: 1.45; }
a { color: var(--pri); cursor: pointer; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .2rem; } h2 { font-size: 1.15rem; margin: 0; } h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 1px solid var(--borda); background: var(--superficie); padding: .45rem .9rem; border-radius: 6px; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--pri); }
button:disabled { opacity: .55; cursor: not-allowed; }
button.pri { background: var(--pri); border-color: var(--pri); color: #fff; }
button.pri:hover:not(:disabled) { background: var(--pri-escuro); }
button.perigo { background: var(--perigo); border-color: var(--perigo); color: #fff; }
button.link { border: none; background: none; color: var(--pri); padding: .2rem .3rem; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--pri); outline-offset: 2px; }
input, select, textarea { width: 100%; border: 1px solid var(--borda); background: var(--superficie); border-radius: 6px; padding: .45rem .6rem; }
textarea { min-height: 80px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: auto; }

/* ---------- estrutura ---------- */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.lateral { background: var(--lateral); color: var(--lateral-texto); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.lateral .marca { padding: 1.1rem 1.2rem; font-weight: 700; font-size: 1.1rem; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.lateral .marca small { display: block; font-weight: 400; font-size: .78rem; color: var(--lateral-texto); opacity: .8; }
.lateral nav { padding: .5rem; flex: 1; }
.lateral nav a { display: flex; align-items: center; gap: .5rem; color: var(--lateral-texto); padding: .55rem .8rem; border-radius: 6px; margin: 1px 0; }
.lateral nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.lateral nav a.ativo { background: var(--lateral-ativo); color: #fff; }
.lateral nav .grupo { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; opacity: .6; padding: .9rem .8rem .3rem; }
.principal { display: flex; flex-direction: column; min-width: 0; }
.topo { display: flex; align-items: center; gap: .8rem; padding: .7rem 1.4rem; background: var(--superficie); border-bottom: 1px solid var(--borda); position: sticky; top: 0; z-index: 5; }
.topo .espaco { flex: 1; }
.topo .usuario { text-align: right; font-size: .85rem; color: var(--suave); }
.topo .usuario b { color: var(--texto); display: block; }
.sino { position: relative; }
.sino .bolinha { position: absolute; top: -6px; right: -6px; background: var(--perigo); color: #fff; border-radius: 10px; font-size: .7rem; padding: 0 .35rem; min-width: 1.2rem; text-align: center; }
.menu-movel { display: none; }
.conteudo { padding: 1.4rem; flex: 1; max-width: 1400px; width: 100%; }
.cabecalho { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.cabecalho .acoes { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.subtitulo { color: var(--suave); margin: 0; }
.faixa { padding: .6rem 1rem; border-radius: var(--raio); margin-bottom: 1rem; border: 1px solid; }
.faixa.alerta { background: color-mix(in srgb, var(--alerta) 12%, transparent); border-color: var(--alerta); }
.faixa.erro { background: color-mix(in srgb, var(--perigo) 12%, transparent); border-color: var(--perigo); }
.faixa.info { background: var(--pri-claro); border-color: var(--pri); }

/* ---------- cartões e grades ---------- */
.cartao { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); box-shadow: var(--sombra); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.cartao > h2, .cartao > h3:first-child { margin-top: 0; margin-bottom: .7rem; }
.grade { display: grid; gap: 1rem; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.indicadores { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.indicador { background: var(--superficie); border: 1px solid var(--borda); border-left: 4px solid var(--pri); border-radius: var(--raio); padding: .7rem .9rem; }
.indicador .valor { font-size: 1.6rem; font-weight: 700; }
.indicador .rotulo { color: var(--suave); font-size: .82rem; }
.barras .linha { display: grid; grid-template-columns: minmax(90px, 32%) 1fr 70px; gap: .6rem; align-items: center; margin: .25rem 0; font-size: .87rem; }
.barras .trilho { background: var(--superficie2); border-radius: 4px; height: 14px; overflow: hidden; }
.barras .barra { background: var(--pri); height: 100%; border-radius: 4px; }
.barras .num { text-align: right; font-variant-numeric: tabular-nums; }
.barras .nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- formulários ---------- */
.form { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .75rem 1rem; }
.campo { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--suave); grid-column: span 12; }
.campo > span.r { font-weight: 600; color: var(--texto); }
.campo.c2 { grid-column: span 2; } .campo.c3 { grid-column: span 3; } .campo.c4 { grid-column: span 4; } .campo.c5 { grid-column: span 5; }
.campo.c6 { grid-column: span 6; } .campo.c8 { grid-column: span 8; } .campo.c9 { grid-column: span 9; }
.campo.erro input, .campo.erro select, .campo.erro textarea { border-color: var(--perigo); }
.campo .msg { color: var(--perigo); font-size: .8rem; }
.campo .ajuda { font-size: .78rem; }
.campo .ajuda.consulta.alerta { color: var(--alerta); }
label.necessario .motivo-necessario { display: none; font-size: .75rem; font-weight: normal; }
label.necessario.falta, label.necessario.falta > span.r { color: var(--perigo); }
label.necessario.falta input, label.necessario.falta select, label.necessario.falta textarea { border-color: var(--perigo); background: color-mix(in srgb, var(--perigo) 7%, var(--superficie)); }
label.necessario.falta .motivo-necessario { display: inline; }
.legenda-necessarios { grid-column: 1 / -1; font-size: .78rem; color: var(--suave); margin: 0 0 .4rem; }
.legenda-necessarios .amostra { display: inline-block; width: 12px; height: 12px; border: 1px solid var(--perigo); background: color-mix(in srgb, var(--perigo) 7%, var(--superficie)); vertical-align: -2px; border-radius: 2px; }
.sugestoes { list-style: none; margin: .2rem 0 0; padding: 0; border: 1px solid var(--borda); border-radius: 6px; max-height: 240px; overflow-y: auto; background: var(--superficie); }
.sugestoes li { padding: .4rem .6rem; cursor: pointer; color: var(--texto); border-bottom: 1px solid var(--borda); overflow-wrap: anywhere; }
.sugestoes li:last-child { border-bottom: 0; }
.sugestoes li:hover, .sugestoes li.ativa { background: var(--pri-claro); }
.sugestoes li b { margin-right: .4rem; }
.chk { display: flex; gap: .5rem; align-items: flex-start; color: var(--texto); }
.campo.chk { flex-direction: row; align-items: center; font-size: .9rem; }
.filtros { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: .8rem; }
.filtros .campo { grid-column: auto; min-width: 140px; flex: 1; }
.filtros .campo.largo { flex: 2; min-width: 220px; }

/* ---------- tabelas ---------- */
.tabela-box { overflow-x: auto; background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .55rem .7rem; border-bottom: 1px solid var(--borda); text-align: left; vertical-align: top; }
th { background: var(--superficie2); font-weight: 600; color: var(--suave); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
tbody tr:hover { background: var(--superficie2); }
tr.clicavel { cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.vazio { text-align: center; color: var(--suave); padding: 1.5rem; }
.paginacao { display: flex; gap: .5rem; align-items: center; justify-content: flex-end; padding: .6rem; color: var(--suave); font-size: .85rem; }

/* ---------- etiquetas de situação ---------- */
.tag { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap;
  color: var(--cor, var(--suave)); background: color-mix(in srgb, var(--cor, var(--suave)) 14%, transparent); border: 1px solid color-mix(in srgb, var(--cor, var(--suave)) 35%, transparent); }
.tag.azul { --cor: var(--azul); } .tag.roxo { --cor: var(--roxo); } .tag.ciano { --cor: var(--ciano); } .tag.laranja { --cor: var(--laranja); }
.tag.vermelho { --cor: var(--vermelho); } .tag.verde-claro { --cor: var(--verde-claro); } .tag.verde { --cor: var(--verde); }
.tag.amarelo { --cor: var(--amarelo); } .tag.cinza-azulado { --cor: var(--cinza-azulado); } .tag.cinza { --cor: var(--cinza); }
.tag.ok { --cor: var(--ok); } .tag.erro { --cor: var(--perigo); } .tag.alerta { --cor: var(--alerta); } .tag.info { --cor: var(--pri); }
.indicador.azul { border-left-color: var(--azul); } .indicador.roxo { border-left-color: var(--roxo); } .indicador.ciano { border-left-color: var(--ciano); }
.indicador.laranja { border-left-color: var(--laranja); } .indicador.vermelho { border-left-color: var(--vermelho); } .indicador.verde { border-left-color: var(--verde); }
.indicador.amarelo { border-left-color: var(--amarelo); } .indicador.cinza { border-left-color: var(--cinza); } .indicador.verde-claro { border-left-color: var(--verde-claro); }
.indicador.cinza-azulado { border-left-color: var(--cinza-azulado); }

/* ---------- detalhe do chamado ---------- */
.abas { display: flex; gap: .2rem; border-bottom: 1px solid var(--borda); margin-bottom: 1rem; overflow-x: auto; }
.abas button { border: none; background: none; border-bottom: 3px solid transparent; border-radius: 0; padding: .55rem .9rem; color: var(--suave); white-space: nowrap; }
.abas button.ativa { color: var(--pri); border-bottom-color: var(--pri); font-weight: 600; }
.dados { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .6rem 1.2rem; }
.dados > div > span:first-child { display: block; font-size: .78rem; color: var(--suave); }
.linha-tempo { list-style: none; padding: 0; margin: 0; }
.linha-tempo li { position: relative; padding: 0 0 1rem 1.4rem; border-left: 2px solid var(--borda); margin-left: .4rem; }
.linha-tempo li::before { content: ""; position: absolute; left: -7px; top: .25rem; width: 12px; height: 12px; border-radius: 50%; background: var(--pri); }
.linha-tempo li.interno::before { background: var(--alerta); }
.linha-tempo li.observacao::before { background: var(--ok); }
.linha-tempo .quando { font-size: .8rem; color: var(--suave); }
.linha-tempo .obs { background: var(--superficie2); border-radius: 6px; padding: .5rem .7rem; margin-top: .3rem; white-space: pre-wrap; }
.miniaturas { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.miniaturas .anexo { border: 1px solid var(--borda); border-radius: 6px; padding: .5rem; font-size: .82rem; background: var(--superficie2); word-break: break-word; }
.miniaturas img { width: 100%; height: 110px; object-fit: cover; border-radius: 4px; background: var(--borda); }
.botoes { display: flex; gap: .5rem; flex-wrap: wrap; }
.botoes select, .botoes input:not([type=checkbox]) { width: auto; }
.selo-interno { font-size: .72rem; color: var(--alerta); font-weight: 600; margin-left: .4rem; }

/* ---------- login ---------- */
.tela-login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem; }
.caixa-login { width: 100%; max-width: 400px; background: var(--superficie); border: 1px solid var(--borda); border-radius: 12px; box-shadow: var(--sombra); padding: 1.8rem; }
.caixa-login h1 { text-align: center; margin-bottom: .3rem; }
.caixa-login .subtitulo { text-align: center; margin-bottom: 1.2rem; }
.caixa-login .campo { margin-bottom: .8rem; }
.caixa-login button.pri { width: 100%; padding: .6rem; }
.qrcode { display: block; margin: .5rem auto; width: 210px; height: 210px; background: #fff; border-radius: 6px; }
.codigo-mfa { font-size: 1.4rem; letter-spacing: .4rem; text-align: center; }
.segredo { font-family: ui-monospace, Consolas, monospace; word-break: break-all; background: var(--superficie2); padding: .4rem; border-radius: 4px; }

/* ---------- modais e avisos ---------- */
.fundo-modal { position: fixed; inset: 0; background: rgba(10, 20, 35, .55); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 1rem; z-index: 50; overflow-y: auto; }
.modal { background: var(--superficie); border-radius: 10px; width: 100%; max-width: 560px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal.largo { max-width: 920px; }
.modal header { display: flex; align-items: center; padding: .9rem 1.1rem; border-bottom: 1px solid var(--borda); }
.modal header h2 { flex: 1; }
.modal header button { border: none; font-size: 1.4rem; line-height: 1; padding: .1rem .5rem; background: none; }
.modal .corpo { padding: 1.1rem; max-height: 72vh; overflow-y: auto; }
.modal footer { display: flex; gap: .5rem; justify-content: flex-end; padding: .8rem 1.1rem; border-top: 1px solid var(--borda); }
#avisos { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 60; max-width: min(420px, calc(100vw - 2rem)); }
.aviso { padding: .7rem 1rem; border-radius: 8px; color: #fff; background: var(--ok); box-shadow: var(--sombra); }
.aviso.erro { background: var(--perigo); } .aviso.alerta { background: var(--alerta); }
.texto-legal { font-size: .9rem; } .texto-legal h3 { margin-top: 1rem; } .texto-legal pre { white-space: pre-wrap; font-size: .75rem; background: var(--superficie2); padding: .6rem; border-radius: 4px; }
#rodape { padding: 1rem 1.4rem; color: var(--suave); font-size: .8rem; display: flex; gap: 1rem; flex-wrap: wrap; border-top: 1px solid var(--borda); }
.carregando { color: var(--suave); padding: 1rem; }
.vazio-grande { text-align: center; padding: 2.5rem 1rem; color: var(--suave); }

/* ---------- celular e tablet ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .lateral { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; z-index: 40; }
  .app.menu-aberto .lateral { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .menu-movel { display: inline-block; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .campo.c2, .campo.c3, .campo.c4, .campo.c5, .campo.c6, .campo.c8, .campo.c9 { grid-column: span 12; }
  .conteudo { padding: 1rem; }
  .topo { padding: .6rem 1rem; }
  .topo .usuario { display: none; }
  .barras .linha { grid-template-columns: 38% 1fr 60px; }
  /* tabelas largas deslizam para o lado dentro da caixa, sem espremer o texto */
  .tabela-box table { min-width: 600px; }
  .tabela-box td:first-child { white-space: nowrap; }
}
@media print {
  .lateral, .topo, #rodape, .acoes, .filtros, .paginacao, button { display: none !important; }
  .app { display: block; } .cartao { box-shadow: none; }
}

/* assinatura na tela (atendimento no local) */
.assinatura-caixa { position: relative; background: #fff; border: 1px dashed var(--borda); border-radius: var(--raio); }
.assinatura-quadro { display: block; width: 100%; height: 200px; touch-action: none; cursor: crosshair; }
.assinatura-dica { position: absolute; inset: 0; display: grid; place-items: center; color: #9aa5b1; pointer-events: none; }
.assinatura-dica[hidden] { display: none; }
.assinatura-caixa.leitura { display: inline-block; max-width: 100%; margin-top: .8rem; padding: .3rem; }
.assinatura-imagem { display: block; max-width: 100%; height: auto; }
.quebra { overflow-wrap: anywhere; }
.assinatura-campo .ajuda { display: block; color: var(--suave); font-size: .8rem; }
@media (max-width: 600px) { .assinatura-quadro { height: 180px; } }
.sugestoes li.vazio { cursor: default; color: var(--suave); }
.sugestoes li.vazio:hover { background: none; }
button.peq { padding: .25rem .6rem; font-size: .8rem; }
