/* why: toda cor vem dos tokens de base.css; aqui fica só forma, espaço e tipografia. A portaria usa o celular, então cada tela precisa funcionar em 380 px. */
:root { --mono: ui-monospace, 'Cascadia Mono', 'SF Mono', Consolas, monospace; --raio: 10px; }
h1, h2, h3, p, ul, ol, dl, dd, fieldset { margin: 0; padding: 0; }
fieldset { border: 0; min-width: 0; }
ul, ol { list-style: none; }
a { color: var(--human); }
small { color: var(--muted); font-size: 12.5px; }
:focus-visible { outline: 2px solid var(--human); outline-offset: 2px; }
.so-leitor { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.proto { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; background: #0B1017; color: #C3CCD8; font-size: 12px; padding: 6px 14px; }
.proto a { color: #9DB0FF; text-decoration: none; }
.proto a:hover { text-decoration: underline; }
.proto .sep { color: #485366; }
.proto select, .proto button { font: inherit; background: #1A222E; color: #E7ECF2; border: 1px solid #36425A; border-radius: 6px; padding: 2px 6px; }
.proto button { cursor: pointer; }
.proto select { max-width: 230px; }

.app { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: calc(100vh - 34px); }
.lado { background: var(--s0); border-right: 1px solid var(--rule); padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; }
.lado a { color: var(--ink-2); text-decoration: none; padding: 8px 10px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lado a:hover { background: var(--s1); }
.lado a.on { background: var(--s1); color: var(--ink); font-weight: 600; }
.lado .marca { font-weight: 700; font-size: 19px; letter-spacing: -0.01em; color: var(--ink); justify-content: flex-start; margin-bottom: 14px; }
.lado .marca:hover { background: none; }
/* why: a marca provisória é a lombada do livro de ocorrências: capa escura com o fio azul da caneta. */
.lombada { width: 16px; height: 22px; border-radius: 3px; background: var(--ink); border-left: 5px solid var(--human); flex: none; }
.num { background: var(--human); color: var(--human-ink); border-radius: 999px; padding: 0 7px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.palco { min-width: 0; display: flex; flex-direction: column; }
.topo { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; padding: 10px 32px; border-bottom: 1px solid var(--rule); background: var(--s0); }
.topo .onde { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topo select { font: inherit; font-weight: 600; color: var(--ink); background: var(--s0); border: 1px solid var(--rule); border-radius: 8px; padding: 5px 8px; max-width: 100%; }
.topo .quem { display: flex; align-items: center; gap: 16px; }
.relogio { font-family: var(--mono); font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.conta { display: flex; flex-direction: column; line-height: 1.25; text-align: right; }
main { padding: 28px 32px 56px; max-width: 1080px; width: 100%; display: flex; flex-direction: column; gap: 20px; }

h1 { font-size: 26px; line-height: 1.2; letter-spacing: -0.015em; text-wrap: balance; }
h2 { font-size: 16px; line-height: 1.3; }
h3 { font-size: 14px; color: var(--ink-2); }
.cabeca { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sub { color: var(--muted); }
.sobre { font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 600; }
.nota { color: var(--muted); font-size: 13px; max-width: 72ch; }
.vazio { color: var(--muted); }
.volta { text-decoration: none; font-size: 14px; align-self: flex-start; }
.titulo-linha { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; }
.bloco { display: flex; flex-direction: column; gap: 10px; }
.conta-n { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.prot { font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
a.prot { color: var(--human); }
.protocolos { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.liga { color: var(--muted); font-size: 13px; }

.cartao { background: var(--s0); border: 1px solid var(--rule); border-radius: var(--raio); padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cartao.atencao { border-color: var(--warn); }
.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.grade2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.grade4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 16px; }
.topo-alinhado { align-items: start; }
.vazio-bloco { background: var(--s0); border: 1px dashed var(--rule); border-radius: var(--raio); padding: 28px 24px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.alerta { background: var(--s1); border-radius: 8px; padding: 10px 14px; font-size: 14px; }
.alerta.crit { background: var(--crit-soft); color: var(--crit); }

.btn { border: 1px solid var(--rule); background: var(--s0); color: var(--ink); border-radius: 8px; padding: 8px 14px; cursor: pointer; font: inherit; font-weight: 500; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; min-height: 38px; }
.btn:hover { border-color: var(--muted); }
.btn.decide { background: var(--human); color: var(--human-ink); border-color: var(--human); font-weight: 600; }
.btn.decide:hover { filter: brightness(1.08); }
.btn.quieto { border-color: transparent; background: none; color: var(--human); padding: 6px 8px; min-height: 32px; }
.btn.quieto:hover { background: var(--human-soft); }
.btn[disabled] { opacity: 0.55; cursor: default; }
.acoes { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }

.estado { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--agent-soft); color: var(--agent); white-space: nowrap; }
.estado::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.e-consulta { background: var(--agent-soft); color: var(--agent); }
.e-aberta { background: var(--human-soft); color: var(--human); }
.e-atendimento { background: none; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--rule); }
.e-encerrada, .p-presente, .p-finalizada { background: var(--ok-soft); color: var(--ok); }
.p-prevista { background: var(--agent-soft); color: var(--agent); }
.p-semregistro { background: var(--warn-soft); color: var(--warn); }
.p-faltou { background: var(--crit-soft); color: var(--crit); }
.p-dispensada { background: none; color: var(--muted); box-shadow: inset 0 0 0 1px var(--rule); }
.origem { justify-self: start; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2); border: 1px solid var(--rule); border-radius: 5px; padding: 1px 6px; white-space: nowrap; }
.opc { font-size: 11.5px; font-weight: 400; color: var(--muted); border: 1px solid var(--rule); border-radius: 5px; padding: 0 5px; white-space: nowrap; }
.spec { display: none; font: 11px var(--mono); font-weight: 400; color: var(--muted); border: 1px dashed var(--muted); border-radius: 6px; padding: 0 5px; margin-left: 6px; letter-spacing: 0; text-transform: none; vertical-align: middle; }
body.criterios .spec { display: inline-block; }

.pend { background: var(--s0); border: 1px solid var(--rule); border-left: 4px solid var(--human); border-radius: 8px; padding: 12px 16px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 16px; }
.pend > div { min-width: 0; flex: 1 1 260px; }
.pend p { color: var(--muted); font-size: 13.5px; }
.pend.alarme { border-left-color: var(--warn); background: var(--warn-soft); }
.pend.alarme p { color: var(--ink-2); }

.pergunta { background: var(--s0); border: 1px solid var(--rule); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.pergunta h2 { font-size: 19px; }
.pergunta textarea { font-size: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chips > span { font-size: 12.5px; color: var(--muted); margin-right: 2px; }
.chip { font: inherit; font-size: 13px; color: var(--ink-2); background: var(--s1); border: 1px solid transparent; border-radius: 999px; padding: 4px 11px; text-decoration: none; cursor: pointer; }
.chip:hover { border-color: var(--muted); color: var(--ink); }
.chip.mais { background: none; color: var(--human); }

.form { gap: 14px; }
form.form, .form.painel { display: flex; flex-direction: column; gap: 14px; }
.form.painel, .revisao { border-top: 1px solid var(--rule); padding-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.campo { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.campo.curto { max-width: 200px; }
.campo.alinhado { justify-content: flex-end; padding-bottom: 8px; }
.campo label, .campo legend, .rotulo { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.campo input[type="text"], .campo input[type="search"], .campo textarea, .campo select { font: inherit; color: var(--ink); background: var(--s0); border: 1px solid var(--rule); border-radius: 8px; padding: 9px 11px; width: 100%; min-width: 0; }
.campo textarea { resize: vertical; line-height: 1.45; }
.campo.erro input, .campo.erro textarea, .campo.erro select { border-color: var(--crit); }
.msg-erro { color: var(--crit); font-size: 13px; font-weight: 500; }
.marcar { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.marcar input, .opcao input { margin-top: 3px; accent-color: var(--human); }
.escolha { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.escolha legend { margin-bottom: 6px; }
.escolha .msg-erro { grid-column: 1 / -1; }
.opcao { display: flex; gap: 8px; border: 1px solid var(--rule); border-radius: 8px; padding: 10px 12px; cursor: pointer; }
.opcao:has(input:checked) { border-color: var(--human); background: var(--human-soft); }
.opcao span { display: flex; flex-direction: column; }
.filtros { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filtros .campo { flex: 1 1 150px; }
.filtros .busca { flex: 2 1 240px; }
.anexos { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.anexo { font-family: var(--mono); font-size: 12.5px; background: var(--s1); border-radius: 6px; padding: 3px 8px; display: inline-flex; gap: 6px; align-items: center; }
.anexo button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }

.registros { display: flex; flex-direction: column; background: var(--s0); border: 1px solid var(--rule); border-radius: var(--raio); overflow: hidden; }
.registro { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 11px 16px; text-decoration: none; color: var(--ink); border-top: 1px solid var(--rule); }
.registro:first-child { border-top: 0; }
.registro:hover { background: var(--s1); }
.registro:not(:has(.origem)) { grid-template-columns: auto minmax(0, 1fr) auto; }
.reg-titulo { display: flex; flex-direction: column; min-width: 0; }
.reg-titulo b { font-weight: 600; overflow-wrap: anywhere; }
.abas { display: flex; gap: 4px; border-bottom: 1px solid var(--rule); align-items: center; }
.abas a { text-decoration: none; color: var(--muted); padding: 8px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
.abas a.on { color: var(--ink); border-bottom-color: var(--human); font-weight: 600; }

.dados { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 16px; }
.dados dt { font-size: 12px; color: var(--muted); }
.dados dd { overflow-wrap: anywhere; }
.relato { background: var(--s1); border-radius: 8px; padding: 10px 14px; overflow-wrap: anywhere; }
details summary { cursor: pointer; color: var(--human); font-size: 13.5px; }
details[open] summary { margin-bottom: 8px; }
.retificacao { border-left: 3px solid var(--human); padding: 2px 0 2px 12px; display: flex; flex-direction: column; gap: 2px; }
.vinculo { font-size: 14px; color: var(--ink-2); }
.pendencias { display: flex; flex-direction: column; gap: 6px; }
.pendencias li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 10px; border: 1px solid var(--rule); border-radius: 8px; padding: 8px 12px; }
.pendencias li span { display: flex; flex-direction: column; min-width: 0; }
.pendencias li.feita { color: var(--muted); }
.linha-tempo, .auditoria { display: flex; flex-direction: column; }
.linha-tempo li, .auditoria li { display: grid; grid-template-columns: 96px 130px minmax(0, 1fr); gap: 2px 12px; padding: 8px 0; border-top: 1px solid var(--rule); font-size: 14px; overflow-wrap: anywhere; }
.linha-tempo li:first-child, .auditoria li:first-child { border-top: 0; }
.linha-tempo li:has(> :nth-child(2):last-child) { grid-template-columns: 96px minmax(0, 1fr); }
.auditoria { background: var(--s0); border: 1px solid var(--rule); border-radius: var(--raio); padding: 4px 16px; }
.auditoria li { grid-template-columns: 180px 170px minmax(0, 1fr); }
.quando { font-family: var(--mono); font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.autor { font-weight: 600; display: flex; flex-direction: column; }
.autor.a-raimundo, .autor.a-sistema { font-weight: 400; color: var(--ink-2); }
.autor small { font-weight: 400; font-family: var(--mono); font-size: 11.5px; }

.conversa { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: min(640px, 92%); border-radius: 12px; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.msg .quem { font-size: 12px; color: var(--muted); }
.msg.pessoa { align-self: flex-end; background: var(--human-soft); border-bottom-right-radius: 4px; }
.msg.rai { align-self: flex-start; background: var(--s0); border: 1px solid var(--rule); border-bottom-left-radius: 4px; }
.msg.limite { border-color: var(--warn); background: var(--warn-soft); }
.passos { display: flex; flex-direction: column; gap: 10px; counter-reset: passo; }
.passos li { counter-increment: passo; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 2px 8px; }
.passos li::before { content: counter(passo); font-family: var(--mono); font-size: 12px; color: var(--muted); border: 1px solid var(--rule); border-radius: 50%; width: 20px; height: 20px; display: grid; place-items: center; margin-top: 1px; }
.fonte { grid-column: 2; font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); background: var(--s1); border-radius: 5px; padding: 2px 7px; justify-self: start; overflow-wrap: anywhere; }
.gerando { color: var(--muted); font-style: italic; }
.evento { display: flex; justify-content: space-between; gap: 8px; text-decoration: none; color: var(--ink); padding: 8px 10px; margin: 0 -10px; border-radius: 8px; }
.evento:hover { background: var(--s1); }
.evento span { color: var(--muted); }
.grupo { gap: 4px; }
.grupo h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 4px; }
.livre { flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: center; }
.livre > div { flex: 1 1 280px; }
.simples { display: flex; flex-direction: column; gap: 4px; }
.simples li { padding-left: 14px; position: relative; }
.simples li::before { content: ''; position: absolute; left: 2px; top: 0.65em; width: 5px; height: 5px; border-radius: 50%; background: var(--muted); }

.dia { background: var(--s0); border: 1px solid var(--rule); border-radius: var(--raio); padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; }
.dia-linha { display: grid; grid-template-columns: 230px minmax(0, 1fr) 118px; gap: 12px; align-items: center; padding: 7px 0; text-decoration: none; color: var(--ink); border-top: 1px solid var(--rule); }
.dia-linha.eixo, .dia-linha.eixo + .dia-linha { border-top: 0; }
.dia-linha .estado { justify-self: end; }
.dia-nome { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.dia-trilho { position: relative; height: 22px; background: var(--s1); border-radius: 4px; }
.eixo .dia-trilho { background: none; height: 16px; }
.eixo .dia-trilho i { position: absolute; transform: translateX(-50%); font: 11px var(--mono); color: var(--muted); font-style: normal; }
.janela { position: absolute; top: 4px; bottom: 4px; border-radius: 3px; background: var(--muted); min-width: 4px; }
.j-presente, .j-finalizada { background: var(--ok); }
.j-semregistro { background: var(--warn); }
.j-faltou { background: var(--crit); }
.j-dispensada { background: none; border: 1px dashed var(--muted); }
.entrada { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--human); border-radius: 2px; transform: translateX(-1px); box-shadow: 0 0 0 2px var(--s1); }
.agora { position: absolute; top: -7px; bottom: -7px; width: 1px; background: var(--ink); opacity: 0.55; }
.comp { gap: 10px; }
.comp-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.comp-topo div { display: flex; flex-direction: column; min-width: 0; }
.comp-dados { display: flex; flex-direction: column; gap: 3px; font-size: 14px; color: var(--ink-2); }
.comps { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start; }

.rolagem { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td small { display: block; }
.num-col { font-variant-numeric: tabular-nums; white-space: nowrap; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--s0); border: 1px solid var(--rule); border-radius: var(--raio); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.tile b { font-size: 26px; line-height: 1.15; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: 13px; }
.tile.alerta-tile { border-color: var(--warn); }
.barras { display: flex; flex-direction: column; gap: 8px; }
.barra { display: grid; grid-template-columns: minmax(110px, 190px) minmax(0, 1fr) 40px; gap: 10px; align-items: center; font-size: 13.5px; }
.barra-trilho { height: 14px; border-left: 1px solid var(--rule); }
.barra-trilho i { display: block; height: 100%; min-width: 0; background: var(--dado); border-radius: 0 4px 4px 0; }
.barra:hover .barra-trilho i { filter: brightness(1.15); }
.barra-valor { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 10px; max-width: min(560px, calc(100vw - 32px)); font-size: 14px; z-index: 20; box-shadow: 0 6px 24px rgb(0 0 0 / 0.25); }

@media (max-width: 880px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .lado { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; flex-direction: row; gap: 2px; padding: 6px 8px; border-right: 0; border-top: 1px solid var(--rule); overflow-x: auto; }
  .lado a { flex: none; padding: 8px 12px; font-size: 14px; }
  .lado .marca { display: none; }
  .topo { padding: 10px 16px; }
  .conta small { display: none; }
  main { padding: 20px 16px 96px; gap: 18px; }
  h1 { font-size: 22px; }
  .grade2, .grade4, .escolha { grid-template-columns: minmax(0, 1fr); }
  .campo.alinhado { padding-bottom: 0; }
  .registro, .registro:not(:has(.origem)) { grid-template-columns: auto minmax(0, 1fr); }
  .registro .reg-titulo { grid-column: 1 / -1; order: 3; }
  .registro .estado { justify-self: end; }
  .registro:has(.origem) .estado { grid-column: 1 / -1; justify-self: start; order: 4; }
  .dia-linha { grid-template-columns: minmax(0, 1fr) auto; }
  .dia-linha .dia-trilho { grid-column: 1 / -1; order: 3; }
  .dia-linha.eixo { display: none; }
  .linha-tempo li, .auditoria li, .linha-tempo li:has(> :nth-child(2):last-child) { grid-template-columns: minmax(0, 1fr); }
  .barra { grid-template-columns: minmax(0, 1fr) 40px; }
  .barra-nome { grid-column: 1 / -1; }
  .toast { bottom: 64px; }
}
@media (prefers-reduced-motion: no-preference) { .btn, .chip, .registro, .evento { transition: background-color 0.12s, border-color 0.12s; } }
td .btn { white-space: nowrap; }
td:first-child { min-width: 170px; }
