:root {
  --ink: #15181c;
  --ink-2: #2b3038;
  --muted: #6c7178;
  --paper: #f4f2ed;
  --card: #fbfaf7;
  --line: #e2ded4;
  --line-strong: #d2cdc1;
  --primary: #0f6e64;
  --primary-deep: #0a4f48;
  --primary-soft: #e3efed;
  --signal: #b8690f;        /* âmbar — fator de risco psicossocial (FRPRT) */
  --signal-soft: #f7ebd9;
  --signal-line: #e8cfa6;
  --danger: #a8392c;
  --danger-soft: #f5e2de;
  --ok: #2f7d52;
  --info: #235a8a;          /* azul — status "Novo" */
  --info-soft: #e2ecf5;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(21, 24, 28, .04), 0 8px 28px -16px rgba(21, 24, 28, .18);
}

.chip-homolog-flutuante {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: #e0201c; color: #fff;
  font-family: "Inter", system-ui, sans-serif; font-weight: 800; font-size: 13px;
  letter-spacing: .05em; text-transform: uppercase;
  padding: 9px 12px;
  box-shadow: 0 2px 10px rgba(224, 32, 28, .5);
  animation: pulso-homolog 1.8s ease-in-out infinite;
}
@keyframes pulso-homolog {
  0%, 100% { background: #e0201c; }
  50% { background: #ff3b35; }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}

h1, h2, h3, h4 { font-family: "Archivo", system-ui, sans-serif; font-weight: 700; margin: 0; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--primary-deep); }

/* ---------- Topbar ---------- */
.topbar { background: var(--ink); color: #f4f2ed; position: sticky; top: 0; z-index: 20; }
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 13px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
}
.topnav-row { border-top: 1px solid rgba(244, 242, 237, .1); }
.topnav-row .topnav { max-width: 1120px; margin: 0 auto; padding: 9px 22px; }
.brand { display: flex; align-items: center; gap: 11px; margin-right: auto; }
.brand .glyph { width: 30px; height: 30px; flex: 0 0 auto; }
.brand b { font-family: "Archivo", sans-serif; font-weight: 800; letter-spacing: .04em; font-size: 15px; text-transform: uppercase; display: block; }
.brand span { display: block; font-size: 11px; color: #9aa0a6; letter-spacing: .14em; text-transform: uppercase; margin-top: 1px; }
.chip-homolog-flutuante {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: #e0201c; color: #fff;
  font-family: "Inter", system-ui, sans-serif; font-weight: 800; font-size: 13px;
  letter-spacing: .05em; text-transform: uppercase;
  padding: 9px 12px;
  box-shadow: 0 2px 10px rgba(224, 32, 28, .5);
  animation: pulso-homolog 1.8s ease-in-out infinite;
}
@keyframes pulso-homolog {
  0%, 100% { background: #e0201c; }
  50% { background: #ff3b35; }
}
/* Logo real (JPEG com fundo branco) precisa de uma "etiqueta" clara sobre o
   fundo escuro da topbar — sem isso vira um retângulo branco cru. */
.logo-chip {
  display: inline-flex; align-items: center; background: #fff; border-radius: 7px;
  padding: 5px 9px; flex: 0 0 auto;
}
.logo-chip img { display: block; height: 22px; width: auto; }
.topbar-user { display: flex; align-items: center; gap: 14px; font-size: 13px; color: #c8ccd0; }

/* Menu do usuário: nome vira um botão que abre um dropdown (Alterar senha / Sair). */
.user-menu { position: relative; }
.user-menu-toggle {
  display: inline-flex; align-items: center; gap: 6px; color: #f4f2ed;
  border: 1px solid #34393f; background: #22262c; font-weight: 600; font-size: 12.5px;
  padding: 7px 12px; border-radius: 9px;
}
.user-menu-toggle:hover { border-color: #f4f2ed; }
.user-menu-painel {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 30;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 10px;
  box-shadow: var(--shadow); padding: 6px; min-width: 160px;
}
.user-menu-painel a {
  display: block; padding: 9px 11px; border-radius: 7px; font-size: 13.5px;
  color: var(--ink-2); text-decoration: none; white-space: nowrap;
}
.user-menu-painel a:hover { background: var(--paper); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 26px 22px 80px; }

/* ---------- Cabeçalho ---------- */
.eyebrow {
  font-family: "Archivo", sans-serif; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; font-size: 11px; color: var(--primary-deep);
}
h1.titulo { font-weight: 800; font-size: clamp(24px, 4vw, 34px); letter-spacing: -.01em; margin: 7px 0 6px; line-height: 1.05; }
.lede { color: var(--ink-2); max-width: 70ch; font-size: 14.5px; margin: 0; }
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.pgr-pill {
  font-family: "JetBrains Mono", monospace; font-size: 11.5px; font-weight: 600;
  background: var(--ink); color: #dfe9e7; padding: 7px 12px; border-radius: 9px;
  display: inline-flex; gap: 8px; align-items: center; text-decoration: none;
}
.pgr-pill:hover { background: var(--primary-deep); }
.pgr-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px rgba(15, 110, 100, .25); }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 22px; }
@media (max-width: 820px) { .kpis { grid-template-columns: 1fr 1fr; } }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 17px; box-shadow: var(--shadow); display: block; color: inherit; text-decoration: none; }
a.kpi:hover { border-color: var(--primary); }
.kpi-topo { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-icone { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 9px; flex: 0 0 auto; }
.kpi .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .v { font-family: "Archivo", sans-serif; font-weight: 800; font-size: 30px; line-height: 1; margin: 9px 0 0; }
.kpi .v small { font-family: "Inter", sans-serif; font-weight: 600; font-size: 14px; color: var(--muted); }
.kpi .v.texto { font-size: 18px; line-height: 1.2; margin-top: 11px; }
.kpi.flag { background: var(--signal-soft); border-color: var(--signal-line); }
.kpi.flag .v { color: var(--signal); }
.kpi .trend { font-size: 11.5px; font-weight: 600; color: var(--ink-2); margin-top: 7px; }
.kpi.flag .trend { color: var(--signal); }

/* ---------- Cards / colunas ---------- */
.cols { display: grid; grid-template-columns: 1fr; gap: 18px; margin-top: 18px; }
@media (min-width: 860px) {
  .cols-dashboard { grid-template-columns: 1.4fr 1fr; }
}
/* Canvas do Chart.js tem largura/altura intrínsecas do atributo HTML — sem
   isso ele não encolhe com o container e força scroll horizontal no card. */
.card-b canvas { max-width: 100%; height: auto !important; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { padding: 16px 18px 0; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card-h h3 { font-size: 16px; }
.card-h .hint { font-size: 11.5px; color: var(--muted); }
.card-b { padding: 14px 18px 18px; }
.vazio { color: var(--muted); font-size: 13px; padding: 10px 0; }

/* ---------- Abas (Parâmetros) ---------- */
.tabs {
  display: flex; gap: 3px; margin: 16px 18px 0; padding: 4px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 11px;
}
.tab-btn {
  flex: 1; border: none; background: none; font: inherit; font-size: 13.5px; font-weight: 700;
  color: var(--ink-2); padding: 10px 14px; border-radius: 8px; cursor: pointer;
  text-align: center; transition: background .12s ease, color .12s ease;
}
.tab-btn:hover { background: #fff; color: var(--ink); }
.tab-btn.on { background: var(--primary); color: #fff; box-shadow: var(--shadow); }
.tab-btn.on:hover { background: var(--primary-deep); color: #fff; }

/* ---------- Barras FRPRT ---------- */
.bar { display: grid; grid-template-columns: 1fr; gap: 11px; }
a.row { display: block; color: inherit; text-decoration: none; border-radius: 8px; }
a.row:hover .top .name { color: var(--primary-deep); text-decoration: underline; }
.cell-link { text-decoration: none; }
.cell-link:hover .cell { outline: 2px solid var(--signal); }
.bar .row .top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.bar .row .top .name { font-weight: 600; color: var(--ink); }
.bar .row .top .num { font-family: "JetBrains Mono", monospace; font-weight: 600; color: var(--ink-2); }
.track { height: 9px; background: #ece8df; border-radius: 999px; overflow: hidden; }
.track i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--signal), #d98a2a); }

/* ---------- Heatmap fator × unidade ---------- */
.heat { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.heat th { font-size: 11px; color: var(--muted); font-weight: 700; padding: 6px 8px; text-align: center; }
.heat th:first-child, .heat td:first-child { text-align: left; font-weight: 600; color: var(--ink); }
.heat td { padding: 6px 8px; text-align: center; }
.cell {
  display: inline-grid; place-items: center; width: 34px; height: 30px; border-radius: 7px;
  font-family: "JetBrains Mono", monospace; font-weight: 600; font-size: 12px; color: #5e3d12;
}

/* ---------- Tabela de relatos ---------- */
.tbl-scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 0 10px 9px; white-space: nowrap; }
.tbl th a { color: inherit; text-decoration: none; }
.tbl th a:hover { color: var(--primary-deep); }
.tbl td { padding: 11px 10px; border-top: 1px solid var(--line); }
.tbl tr:hover td { background: #f6f4ee; }
.mono { font-family: "JetBrains Mono", monospace; font-weight: 600; font-size: 12px; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.tag.frprt { background: var(--signal-soft); color: var(--signal); border: 1px solid var(--signal-line); }
.tag.eth { background: #eef0f2; color: var(--ink-2); border: 1px solid var(--line-strong); }
.unidade-inativa-tag { font-size: 9.5px; font-weight: 400; color: var(--muted); font-style: italic; }
.st-badge { font-size: 11px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.st-badge .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.resp-badge { font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.resp-badge.resp-ok { background: #e5f1ea; color: var(--ok); border: 1px solid #bfdccb; }
.resp-badge.resp-pendente { background: #eef0f2; color: var(--muted); border: 1px solid var(--line-strong); }

/* ---------- Navegação do topo ---------- */
.topnav-toggle {
  display: none; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
  width: 34px; height: 34px; flex: 0 0 auto;
  border: 1px solid #34393f; background: #22262c; border-radius: 9px;
}
.topnav-toggle span { display: block; width: 16px; height: 2px; background: #f4f2ed; transition: transform .2s, opacity .2s; }
.topnav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.topnav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.topnav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Bloco de conta (nome + Minha conta/Sair) embutido no hambúrguer — só
   aparece no mobile, dentro do mesmo painel dos links de navegação. No
   desktop quem cuida disso é o dropdown .user-menu. */
.topnav-conta-mobile { display: none; }

/* Mobile: os links da topnav não cabem numa linha só — vira menu hambúrguer,
   e o menu do usuário logado entra junto dentro dele. */
@media (max-width: 780px) {
  .topnav-toggle { display: inline-flex; }
  .user-menu { display: none; }
  .topnav-row { display: none; }
  .topnav-row.aberto { display: block; }
  .topnav { flex-direction: column; gap: 2px; }
  .topnav a { padding: 11px 14px; }
  .topnav-conta-mobile {
    display: block; margin-top: 8px; padding-top: 10px;
    border-top: 1px solid rgba(244, 242, 237, .1);
  }
  .topnav-conta-nome {
    padding: 6px 14px; font-size: 11px; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: #9aa0a6;
  }
  .topnav-conta-mobile a {
    display: block; color: #aab0b6; text-decoration: none; font-weight: 600;
    font-size: 13px; padding: 11px 14px; border-radius: 8px;
  }
  .topnav-conta-mobile a:hover { color: #f4f2ed; }
}
/* Em telas estreitas os itens não cabem numa linha só — rola horizontal em
   vez de quebrar/cortar (padrão comum de tab-bar mobile). */
.topnav { display: flex; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a {
  color: #aab0b6; text-decoration: none; font-weight: 600; font-size: 13px;
  padding: 8px 15px; border-radius: 8px; white-space: nowrap; flex: 0 0 auto;
}
.topnav a:hover { color: #f4f2ed; }
.topnav a.on { background: var(--paper); color: var(--ink); }

/* ---------- Blocos colapsáveis (Filtros / Indicadores / Relatos) ---------- */
.secao { margin-top: 18px; }
.secao summary.secao-cabecalho {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 9px;
  font-family: "Archivo", sans-serif; font-weight: 700; font-size: 13px;
  letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2);
  padding: 4px 0;
}
.secao summary.secao-cabecalho::-webkit-details-marker { display: none; }
.secao summary.secao-cabecalho::before {
  content: ''; width: 0; height: 0; flex: 0 0 auto;
  border-style: solid; border-width: 5px 0 5px 7px;
  border-color: transparent transparent transparent var(--muted);
  transition: transform .15s ease;
}
.secao[open] > summary.secao-cabecalho::before { transform: rotate(90deg); }
.secao summary.secao-cabecalho:hover { color: var(--ink); }
@media print {
  details.secao { display: block !important; }
  details.secao > summary.secao-cabecalho { display: none !important; }
}

/* ---------- Imprimir / Exportar ---------- */
.dash-head-acoes { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.print-cabecalho, .print-rodape { display: none; }

#modal-exportar {
  border: none; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 0; width: min(380px, 90vw); position: relative;
}
#modal-exportar::backdrop { background: rgba(21, 24, 28, .45); }
#modal-exportar .modal-cabecalho { padding: 18px 40px 4px 20px; }
#modal-exportar .modal-cabecalho h3 { font-size: 16px; }
#modal-exportar .modal-corpo { padding: 10px 20px 20px; }
.modal-escopo { display: flex; flex-direction: column; gap: 9px; margin: 14px 0 4px; }
.modal-escopo label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.modal-acoes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.modal-acoes .btn:disabled { opacity: .45; cursor: not-allowed; }
.modal-fechar {
  position: absolute; top: 10px; right: 12px; background: none; border: none;
  font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px;
}
.modal-fechar:hover { color: var(--ink); }

@media print {
  .topbar, .dash-head-acoes, #modal-exportar, .filtros, details.secao[data-secao-id="filtros"] { display: none !important; }
  a[href]::after { content: none !important; }
  a { color: inherit; text-decoration: none; }

  .print-cabecalho {
    display: flex !important; align-items: center; gap: 14px;
    border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 18px;
  }
  .print-cabecalho img { height: 34px; width: auto; }
  .print-cabecalho strong { font-family: "Archivo", sans-serif; font-size: 15px; }
  .print-cabecalho .print-filtros-resumo { font-size: 11px; color: var(--muted); margin-top: 3px; }

  .print-rodape {
    display: block !important; position: fixed; bottom: 0; left: 0; right: 0;
    font-size: 10px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 6px;
  }

  body[data-imprimir="indicadores"] details.secao[data-secao-id="relatos"] { display: none !important; }
  body[data-imprimir="relatos"] details.secao[data-secao-id="indicadores"] { display: none !important; }
}

/* ---------- Filtros da lista ---------- */
.filtros {
  display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px; margin-top: 18px;
}
/* min-width:0 é o que permite um item flex encolher abaixo do tamanho do seu
   conteúdo — sem isso, um <select> com opção de texto longo (ex.: nome de
   filial) estoura o container em vez de quebrar linha. */
.filtro { flex: 1 1 160px; min-width: 0; }
.filtro label { display: block; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 5px; }
.filtro label .hint { text-transform: none; font-weight: 400; letter-spacing: 0; font-size: 10.5px; }
.filtros select, .filtros input[type=text], .filtros input[type=date] {
  border: 1px solid var(--line-strong); background: #fff; border-radius: 9px;
  padding: 9px 10px; font: inherit; font-size: 13.5px; color: var(--ink);
  width: 100%; max-width: 100%; box-sizing: border-box;
}
@media (max-width: 480px) {
  .filtro { flex-basis: 100%; }
}
.filtro-busca input { width: 140px; }
.filtro-palavra input { width: 260px; }
.filtro-acao { display: flex; gap: 8px; }
.filtro-acao .btn { padding: 9px 16px; font-size: 13.5px; }

/* Checkbox "solto": própria linha, separada dos demais filtros por uma borda. */
.filtro-solto {
  flex-basis: 100%; margin-top: 8px; padding-top: 12px; border-top: 1px dashed var(--line);
}

/* Totalizador por status — chips clicáveis ao lado do resumo de resultados. */
.status-totais { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.status-total-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600;
  padding: 5px 11px; border-radius: 999px; background: var(--card); border: 1px solid var(--line);
  color: var(--ink-2); text-decoration: none;
}
.status-total-chip:hover { border-color: var(--primary); color: var(--primary-deep); }
.status-total-chip .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.status-total-chip b { font-weight: 700; }
.status-total-chip .pct { color: var(--muted); font-weight: 500; }

/* Multiseleção: botão-resumo + painel de checkboxes */
.filtro-multi { position: relative; }
.multi-select { position: relative; }
.multi-toggle {
  display: block; width: 100%; min-width: 150px; text-align: left;
  border: 1px solid var(--line-strong); background: #fff; border-radius: 9px;
  padding: 9px 10px; font: inherit; font-size: 13.5px; color: var(--ink);
}
.multi-toggle:hover { border-color: var(--ink); }
.multi-painel {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 30;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 10px;
  box-shadow: var(--shadow); padding: 6px; min-width: 220px; max-height: 260px; overflow-y: auto;
}
.multi-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; font-size: 13.5px; white-space: nowrap; cursor: pointer; }
.multi-item:hover { background: var(--paper); }
.multi-item input { accent-color: var(--primary); width: 15px; height: 15px; flex: 0 0 auto; }

/* Checkbox simples (ex.: "Não listar concluídos") */
.filtro-check { align-self: center; }
.check-label { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.check-label input[type=checkbox] { accent-color: var(--primary); width: 16px; height: 16px; margin-top: 2px; flex: 0 0 auto; }

/* ---------- Severidade ---------- */
.tag.sev-alta { background: var(--danger-soft); color: var(--danger); border: 1px solid #e6c4bd; }
.tag.sev-media { background: var(--signal-soft); color: var(--signal); border: 1px solid var(--signal-line); }
.tag.sev-baixa { background: #eef0f2; color: var(--ink-2); border: 1px solid var(--line-strong); }

/* ---------- Lista: linhas clicáveis / paginação ---------- */
.linha-link { cursor: pointer; }
.tbl td a { color: inherit; text-decoration: none; }
.tbl td a:hover { color: var(--primary-deep); text-decoration: underline; }
.paginacao { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; font-size: 13px; color: var(--muted); }
.paginacao .btn { padding: 9px 16px; font-size: 13.5px; }

/* ---------- Detalhe do relato ---------- */
.voltar-lista { margin: 0 0 14px; font-size: 13.5px; }
.voltar-lista a { text-decoration: none; font-weight: 600; }
.det-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.proto-chip {
  font-family: "JetBrains Mono", monospace; font-weight: 600; font-size: 14px;
  background: var(--ink); color: #fff; padding: 6px 12px; border-radius: 8px; letter-spacing: .04em;
}
.det-meta { font-size: 13px; color: var(--muted); margin: 8px 0 16px; }
/* Barra compacta de ações (status + classificação), acima das colunas */
.det-acoes {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px; margin-top: 18px;
}
.det-acao { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.det-acao select {
  min-width: 170px; border: 1px solid var(--line-strong); background: #fff;
  border-radius: 9px; padding: 10px 11px; font: inherit; font-size: 13.5px; color: var(--ink);
}
.det-acao select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.det-acao-divisor { width: 1px; align-self: stretch; background: var(--line); margin: 0 2px; }
@media (max-width: 700px) { .det-acao-divisor { display: none; } }
.btn-sm { padding: 10px 16px; font-size: 13.5px; }

/* Cabeçalho fixo (protocolo/tags + barra de ações): rola só o conteúdo do
   relato por baixo. Altura medida via JS (--det-topo-h) para o offset da
   coluna sticky da direita não ficar embaixo dele. */
.det-topo {
  position: sticky; top: var(--topbar-h, 60px); z-index: 10;
  background: var(--paper);
}
@media (max-width: 900px) { .det-topo { position: static; } }

.det-cols { display: grid; grid-template-columns: 1.25fr .75fr; gap: 18px; align-items: start; margin-top: 18px; }
@media (max-width: 900px) { .det-cols { grid-template-columns: 1fr; } }

/* Coluna direita fixa (linha do tempo) enquanto o relato, à esquerda, é
   mais longo que a tela. Só um card aqui agora — não precisa de teto de
   altura nem rolagem própria (isso é o que gerava scroll dentro de scroll). */
.det-sticky {
  position: sticky; top: calc(var(--topbar-h, 60px) + var(--det-topo-h, 170px) + 18px);
}
@media (max-width: 900px) { .det-sticky { position: static; } }

/* Abas da coluna esquerda: Relato (dados do fato) / Respostas (composição
   + histórico) — evita que as duas áreas disputem altura ao mesmo tempo. */
.det-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.det-tab {
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink-2);
  font-weight: 600; font-size: 13.5px; padding: 9px 16px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 7px;
}
.det-tab:hover { border-color: var(--ink); }
.det-tab.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.det-tab-badge {
  font-size: 11px; font-weight: 700; background: var(--primary); color: #fff;
  border-radius: 999px; padding: 1px 7px; line-height: 1.5;
}
.det-tab.on .det-tab-badge { background: #fff; color: var(--ink); }
.relato-texto {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
  font-size: 14px; color: var(--ink-2); white-space: pre-wrap;
}
.det-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; margin-top: 16px; }
@media (max-width: 560px) { .det-grid { grid-template-columns: 1fr; } }
.det-item .rot { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.det-item .val { font-size: 14px; color: var(--ink); white-space: pre-wrap; }
.anexos { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.anexos li {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 13px;
}
.anexos .anexo-nome {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13.5px; font-weight: 600; text-decoration: none;
}
.anexos .anexo-nome:hover { text-decoration: underline; }
.anexos .anexo-baixar {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 7px; color: var(--muted);
}
.anexos .anexo-baixar:hover { color: var(--primary-deep); background: var(--primary-soft); }
.anexos .hint { font-size: 11.5px; color: var(--muted); }

.card-b select {
  width: 100%; border: 1px solid var(--line-strong); background: #fff; border-radius: 9px;
  padding: 10px 11px; font: inherit; font-size: 13.5px; color: var(--ink);
}
.f-mini { display: block; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 5px; }

.resposta-texto {
  width: 100%; min-height: 90px; resize: vertical;
  border: 1px solid var(--line-strong); background: #fff; border-radius: 9px;
  padding: 10px 12px; font: inherit; font-size: 13.5px; color: var(--ink);
}
.resposta-texto:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.resposta-texto[readonly] { background: #f3f1eb; color: var(--muted); cursor: not-allowed; }
.hint-bloqueio { font-size: 12.5px; color: var(--signal); background: var(--signal-soft); border: 1px solid var(--signal-line); border-radius: 8px; padding: 8px 11px; margin: 0 0 10px; }
.respostas { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.respostas li { border-top: 1px solid var(--line); padding-top: 10px; }
.respostas .resposta-meta { font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.respostas .resposta-corpo { font-size: 13.5px; color: var(--ink-2); white-space: pre-wrap; }
.det-item .val a { color: var(--primary-deep); }

.flash { border-radius: 10px; padding: 11px 14px; margin-bottom: 16px; font-size: 13.5px; }
.flash-ok { background: #e5f1ea; border: 1px solid #bfdccb; color: var(--ok); }
.flash-erro { background: var(--danger-soft); border: 1px solid #e6c4bd; color: var(--danger); }

/* Toast: mensagem de confirmação/erro de uma ação, some sozinha depois de
   alguns segundos — não fica presa no cabeçalho fixo do relato. */
.toast {
  position: fixed; top: calc(var(--topbar-h, 60px) + 14px); right: 22px; z-index: 50;
  max-width: 360px; border-radius: 10px; padding: 12px 16px; font-size: 13.5px;
  box-shadow: var(--shadow); transition: opacity .35s ease, transform .35s ease;
}
.toast-ok { background: #e5f1ea; border: 1px solid #bfdccb; color: var(--ok); }
.toast-erro { background: var(--danger-soft); border: 1px solid #e6c4bd; color: var(--danger); }
.toast-saindo { opacity: 0; transform: translateY(-6px); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 18px; border-left: 2px solid var(--line); margin-left: 5px; }
.timeline li:last-child { padding-bottom: 2px; }
.timeline li::before {
  content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--primary); border: 2px solid var(--card);
}
.timeline .quando { font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--muted); }
.timeline .oque { font-size: 13px; color: var(--ink); margin: 2px 0; }
.timeline .quem { font-size: 11.5px; color: var(--muted); }

/* ---------- Login ---------- */
.login-wrap { max-width: 420px; margin: 0 auto; padding: 48px 16px 64px; }
.login-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 26px 24px; margin-top: 18px;
}
label.f { display: block; font-weight: 600; font-size: 14px; margin: 16px 0 8px; color: var(--ink); }
input[type=email], input[type=password], input[type=text], input[type=number] {
  width: 100%; border: 1px solid var(--line-strong); background: #fff; border-radius: 10px;
  padding: 12px 13px; font: inherit; font-size: 15px; color: var(--ink);
}
input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.login-link { text-align: center; margin: 16px 0 0; font-size: 13.5px; }
.login-link a { font-weight: 600; }
.mensagem-info {
  background: var(--primary-soft); border: 1px solid #bfdcd7; color: var(--primary-deep);
  border-radius: 10px; padding: 11px 14px; margin-top: 16px; font-size: 13.5px;
}
.codigo-2fa-input {
  width: 100%; border: 1px solid var(--line-strong); background: #fff; border-radius: 10px;
  padding: 14px; font-size: 26px; letter-spacing: .3em; text-align: center;
  font-family: "JetBrains Mono", monospace; color: var(--ink);
}
.codigo-2fa-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.reenviar-2fa { text-align: center; margin-top: 14px; font-size: 13px; color: var(--muted); }
.reenviar-2fa button { border: none; background: none; color: var(--primary-deep); font-weight: 600; font-size: 13px; padding: 0; text-decoration: underline; }
.btn {
  display: inline-block; border: 1px solid var(--line-strong); background: #fff; color: var(--ink);
  font-weight: 600; font-size: 14.5px; padding: 12px 18px; border-radius: 10px;
  text-decoration: none; text-align: center;
}
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-deep); border-color: var(--primary-deep); }
.btn-full { width: 100%; margin-top: 20px; }
.ajuda-campo { font-size: 12.5px; color: var(--muted); margin: 7px 0 4px; }
.campo-erro { color: var(--danger); font-size: 13px; margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .grid2 { grid-template-columns: 1fr 1fr; gap: 0 14px; }
}
.logo-preview {
  background: var(--ink); border-radius: 10px; padding: 14px; display: flex;
  align-items: center; justify-content: center; margin-bottom: 4px;
}
.logo-preview img { max-height: 40px; max-width: 100%; }
.parametros-acoes { margin-top: 20px; }
input[type=file] {
  width: 100%; border: 1px dashed var(--line-strong); background: #fff; border-radius: 10px;
  padding: 10px 12px; font: inherit; font-size: 13.5px; color: var(--ink);
}
/* Upload: o input nativo fica escondido; a zona inteira é clicável e aceita
   arrastar-e-soltar. Mesmo padrão do formulário público (relato.css). */
.upload input[type=file] { display: none; }
.upload-zona {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 5px;
  border: 1.5px dashed var(--line-strong); border-radius: 12px; background: #fff;
  padding: 20px 16px; color: var(--muted); text-align: center;
  font: inherit; transition: border-color .15s, background .15s;
}
.upload-zona:hover, .upload-zona:focus-visible, .upload-zona.arrastando {
  border-color: var(--primary); background: var(--primary-soft); outline: none;
}
.upload-zona svg { color: var(--primary); margin-bottom: 2px; }
.upload-zona b { color: var(--ink-2); font-size: 14px; }
.upload-dica { font-size: 12.5px; }
.upload-dica .so-mobile { display: none; }
@media (hover: none) and (pointer: coarse) {
  .upload-dica .so-desktop { display: none; }
  .upload-dica .so-mobile { display: inline; }
}
.upload-lista { margin: 10px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--ink-2); }
.upload-lista li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 0; border-top: 1px solid var(--line);
}
.upload-lista li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-remover {
  flex: 0 0 auto; border: 1px solid var(--line-strong); background: #fff; color: var(--danger);
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 7px;
}
.upload-remover:hover { border-color: var(--danger); background: var(--danger-soft); }

.erro-login {
  background: var(--danger-soft); border: 1px solid #e6c4bd; color: var(--danger);
  border-radius: 10px; padding: 11px 14px; margin-top: 16px; font-size: 13.5px;
}
