/* Pericial — área de gestão */
@font-face { font-family: 'IBM Plex Sans'; font-weight: 400; font-display: swap; src: url('fonts/ibm-plex-sans-400.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 500; font-display: swap; src: url('fonts/ibm-plex-sans-500.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 600; font-display: swap; src: url('fonts/ibm-plex-sans-600.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 500; font-display: swap; src: url('fonts/ibm-plex-mono-500.woff2') format('woff2'); }

:root {
  --ink: #1C1C1C;
  --ink-2: #3D3B37;
  --muted: #5F5D58;
  --line: #D9D5CC;
  --line-2: #E8E5DE;
  --paper: #F7F5F1;
  --white: #FFFFFF;
  --red: #E30613;
  --red-dark: #B8050F;
  --warn: #8A4B00;
  --ok: #1D5634;
  --danger: #9B1B12;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--ink); }
a:hover { color: var(--red-dark); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 34px; line-height: 1.15; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
[hidden] { display: none !important; }
.num { font-family: var(--mono); font-weight: 500; letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.warn { color: var(--warn); font-weight: 600; }
.ok { color: var(--ok); font-weight: 600; }
.danger { color: var(--danger); }
.pre { white-space: pre-wrap; }

/* Estrutura */
.layout { display: flex; flex-wrap: wrap; min-height: 100vh; }
.menu { flex: 1 1 220px; max-width: 250px; background: var(--ink); color: var(--white); padding: 24px 16px; display: flex; flex-direction: column; gap: 2px; }
.menu .logo { width: 150px; margin: 0 0 28px 6px; }
.menu a { color: var(--white); text-decoration: none; padding: 10px 12px; border-radius: 3px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.menu a:hover { background: #2E2E2C; color: var(--white); }
.menu a.logo-link, .menu a.logo-link:hover { background: none; padding: 0; }
.menu a[aria-current="page"] { background: var(--white); color: var(--ink); font-weight: 600; }
.menu .contador { background: var(--red); color: var(--white); border-radius: 999px; padding: 0 8px; font-size: 13px; font-weight: 600; }
.menu .rodape { margin-top: auto; padding: 16px 12px 0; font-size: 13px; color: #CFCBC2; display: flex; flex-direction: column; gap: 6px; }
.menu .rodape a { padding: 0; color: #CFCBC2; text-decoration: underline; display: inline; }
.menu .rodape a:hover { background: none; color: var(--white); }
.conteudo { flex: 999 1 560px; min-width: 0; padding: 32px clamp(16px, 4vw, 44px) 64px; }
.conteudo > * { max-width: 1180px; }
@media (max-width: 700px) {
  .menu { max-width: none; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px; }
  .menu .logo { width: 110px; margin: 0 12px 0 4px; }
  .menu .rodape { margin: 0 0 0 auto; padding: 0; flex-direction: row; }
  .menu .rodape .quem { display: none; }
}

.pilha { display: flex; flex-direction: column; gap: 20px; }
.linha { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.linha.entre { justify-content: space-between; }
.linha.base { align-items: baseline; }
.colunas { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.colunas > .principal { flex: 3 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.colunas > .lateral { flex: 2 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.voltar { font-size: 14px; color: var(--muted); text-decoration: none; }

/* Cartões */
.cartao { background: var(--white); border: 1px solid var(--line); border-radius: 4px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.cartao.destaque { border: 2px solid var(--ink); }
.cartao h2 + p { margin-top: -4px; }
.alertas { display: flex; flex-wrap: wrap; gap: 12px; }
.alerta { flex: 1 1 240px; background: var(--white); border: 1px solid var(--line); border-radius: 4px; padding: 12px 16px; display: flex; gap: 12px; align-items: center; text-decoration: none; }
.alerta .n { font-family: var(--mono); font-size: 28px; font-weight: 500; }
.alerta.vermelho { border-color: #E8B9AD; } .alerta.vermelho .n { color: var(--danger); }
.alerta.laranja { border-color: #EBCB8B; } .alerta.laranja .n { color: var(--warn); }
.alerta.azul { border-color: #9FCFD2; } .alerta.azul .n { color: #0F5257; }
.aviso { background: #FFF6E5; border: 1px solid #EBCB8B; border-radius: 4px; padding: 12px 14px; }
.aviso.erro { background: #FDECEC; border-color: #E8B9AD; color: var(--danger); }
.aviso.sucesso { background: #E8F4EC; border-color: #A9D3B6; color: var(--ok); }

/* Botões */
button, .botao { font: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 3px; border: 1px solid var(--ink); background: var(--white); color: var(--ink); font-weight: 500; text-decoration: none; }
button:hover, .botao:hover { background: var(--line-2); color: var(--ink); }
.principal-btn { background: var(--red); border-color: var(--red); color: var(--white); font-weight: 600; }
.principal-btn:hover { background: var(--red-dark); border-color: var(--red-dark); color: var(--white); }
.perigo { color: var(--danger); border-color: var(--danger); }
.ligacao { border: 0; background: none; padding: 0; min-height: 0; text-decoration: underline; font-weight: 500; }
.ligacao:hover { background: none; color: var(--red-dark); }
button:disabled { opacity: 0.55; cursor: default; }
.pilula { min-height: 36px; padding: 0 14px; border-radius: 999px; border-color: var(--line); font-size: 14px; }
.pilula[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--white); }

/* Formulários */
label, .campo { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.campo-dica { font-weight: 400; color: var(--muted); font-size: 13px; }
input, select, textarea { font: inherit; font-size: 15px; font-weight: 400; color: var(--ink); background: var(--white); border: 1px solid #B8B4AC; border-radius: 3px; padding: 10px 12px; width: 100%; }
textarea { resize: vertical; line-height: 1.5; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; accent-color: var(--ink); }
.escolha { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; cursor: pointer; }
.escolha input { margin-top: 2px; flex: none; }
.grelha-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.grelha-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
.procura { display: flex; flex-direction: row; font-weight: 400; align-items: center; gap: 10px; background: var(--white); border: 1px solid var(--line); border-radius: 3px; padding: 0 12px; flex: 1 1 280px; }
.procura input { border: 0; padding: 10px 0; }
.procura input:focus-visible { outline: none; }
.procura:focus-within { outline: 3px solid var(--red); outline-offset: 2px; }
.erro-form { color: var(--danger); font-size: 14px; }

/* Tabelas */
.tabela-caixa { overflow-x: auto; background: var(--white); border: 1px solid var(--line); border-radius: 4px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); padding: 12px 14px; white-space: nowrap; }
td { padding: 12px 14px; border-top: 1px solid var(--line-2); vertical-align: top; }
td .num { font-size: 18px; }
tr.clicavel { cursor: pointer; }
tr.clicavel:hover td { background: #FBFAF8; }
.direita { text-align: right; }
.vazio { padding: 28px 16px; text-align: center; color: var(--muted); }

/* Estados */
.estado { display: inline-block; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.e-por_validar { background: #F9DCD5; color: #7A2414; }
.e-aberto { background: #E8E6E1; color: #3A3A37; }
.e-atribuido { background: #E3ECF5; color: #1D3F63; }
.e-em_vistoria { background: #FCEBC4; color: #6B3D00; }
.e-em_gabinete { background: #E9E2F4; color: #43306B; }
.e-em_revisao { background: #DDEFF0; color: #0F5257; }
.e-enviado { background: #DCEFE2; color: #1D5634; }
.e-arquivado { background: #ECEAE5; color: #5F5D58; }
.e-cancelado { background: #ECEAE5; color: #5F5D58; text-decoration: line-through; }

.etapas { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.etapas li { flex: 1 1 100px; padding: 8px 10px 0; border-top: 4px solid var(--line); font-size: 13px; color: var(--muted); }
.etapas li.feita { border-color: var(--ink); color: var(--ink); }
.etapas li.atual { border-color: var(--red); color: var(--ink); font-weight: 600; }

.numero-grande { font-family: var(--mono); font-size: clamp(40px, 6vw, 64px); font-weight: 500; line-height: 0.95; letter-spacing: -0.03em; }

/* Listas dentro de cartões */
.lista > * + * { border-top: 1px solid var(--line-2); padding-top: 10px; margin-top: 10px; }
.item { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.item .cresce { flex: 1 1 220px; min-width: 0; }
dl.dados { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 4px 20px; }
dl.dados dt { font-size: 13px; color: var(--muted); }
dl.dados dd { margin: 0 0 10px; }

/* Notas */
.nota { display: flex; gap: 14px; align-items: flex-start; }
.nota .foto { width: 88px; height: 66px; flex: none; border-radius: 3px; background: var(--line-2); display: flex; align-items: center; justify-content: center; text-align: center; font-size: 11px; color: var(--muted); padding: 4px; }
.nota .corpo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.corrigida { font-size: 13px; color: var(--warn); }
.fixo-baixo { position: sticky; bottom: 0; background: var(--paper); padding: 12px 0; border-top: 1px solid var(--line); }

/* Diálogos */
dialog { border: 0; border-radius: 6px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 12px 40px rgba(0,0,0,0.25); color: var(--ink); }
dialog::backdrop { background: rgba(28,28,28,0.45); }
dialog form { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
dialog .acoes { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 4px; }

/* Entrada */
.entrada { min-height: 100vh; display: flex; flex-wrap: wrap; }
.entrada .lado-form { flex: 1 1 420px; padding: 48px 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; }
.entrada .lado-form .logo { width: 260px; }
.entrada .lado-form .cartao { width: 100%; max-width: 400px; padding: 28px; }
.entrada .lado-marca { flex: 1 1 420px; background: var(--ink); color: var(--white); padding: 48px; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.entrada .lado-marca p { max-width: 440px; }
.entrada .lado-marca .grande { font-size: 26px; font-weight: 500; line-height: 1.3; }
.entrada .lado-marca .muted { color: #CFCBC2; }
@media (max-width: 700px) { .entrada .lado-marca { display: none; } }

.carregar { padding: 40px; color: var(--muted); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--white); padding: 12px 18px; border-radius: 4px; z-index: 50; max-width: calc(100vw - 32px); }
.codigo { font-family: var(--mono); font-size: 15px; background: var(--line-2); padding: 10px 12px; border-radius: 3px; word-break: break-all; user-select: all; }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; }
.cartao > button.ligacao, .cartao > a { align-self: flex-start; }
.sem-quebra { white-space: nowrap; }
a.item, .ligacao-item { text-decoration: none; }
a.item strong, a.item > span:last-child, .ligacao-item strong, .ligacao-item > span:last-child { text-decoration: underline; }
.ligacao-item { border: 0; background: none; padding: 0; min-height: 0; text-align: left; justify-content: flex-start; font-weight: 400; width: 100%; }
.ligacao-item:hover { background: none; }
details > summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
details[open] > summary { margin-bottom: 10px; }
