/* Pericial — app de vistoria */
@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; --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, monospace;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --topo: env(safe-area-inset-top, 0px); --fundo: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; }
#app { max-width: 720px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; font-weight: 600; line-height: 1.2; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; color: var(--muted); }
a { color: var(--ink); }
: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); }
.danger { color: var(--danger); }
.carregar { padding: 40px 20px; color: var(--muted); }

.ecra { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: calc(16px + var(--topo)) 18px calc(20px + var(--fundo)); }
.cabecalho { display: flex; align-items: center; gap: 6px; min-height: 44px; }
.cabecalho h1 { flex: 1; }
.voltar { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; margin-left: -12px; border: 0; background: none; padding: 0; color: var(--ink); text-decoration: none; font-size: 28px; line-height: 1; }

.cartao { background: var(--white); border: 1px solid var(--line); border-radius: 6px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.lista { background: var(--white); border: 1px solid var(--line); border-radius: 6px; display: flex; flex-direction: column; }
.lista > * + * { border-top: 1px solid var(--line-2); }
.linha-lista { display: flex; align-items: center; gap: 12px; padding: 14px; min-height: 60px; text-decoration: none; color: var(--ink); background: none; border: 0; width: 100%; text-align: left; font: inherit; cursor: pointer; }
.linha-lista .texto { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.linha-lista strong { font-weight: 600; font-size: 17px; }
.linha-lista .seta { color: var(--muted); font-size: 22px; }

button, .botao { font: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 6px; border: 1px solid var(--ink); background: var(--white); color: var(--ink); font-weight: 500; text-decoration: none; }
button:disabled { opacity: 0.5; }
.principal { background: var(--red); border-color: var(--red); color: var(--white); font-weight: 600; }
.principal:active { background: var(--red-dark); }
.grande { min-height: 132px; flex-direction: column; align-items: flex-start; justify-content: space-between; padding: 18px; font-size: 26px; font-weight: 600; width: 100%; text-align: left; }
.secundario { border-color: var(--line); }
.tracejado { border: 2px dashed #B8B4AC; background: transparent; width: 100%; }
.ligacao { border: 0; background: none; padding: 0; min-height: 0; text-decoration: underline; font-weight: 500; }
.icone { width: 48px; padding: 0; flex: none; }
.perigo { color: var(--danger); border-color: var(--danger); }

label, .campo { display: flex; flex-direction: column; gap: 6px; font-size: 15px; font-weight: 600; }
.dica { font-weight: 400; font-size: 13px; color: var(--muted); }
input, textarea, select { font: inherit; font-size: 17px; font-weight: 400; color: var(--ink); background: var(--white); border: 1px solid #B8B4AC; border-radius: 6px; padding: 12px; width: 100%; }
textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
.erro { color: var(--danger); font-size: 15px; }
.aviso { background: #FFF6E5; border: 1px solid #EBCB8B; border-radius: 6px; padding: 12px 14px; font-size: 15px; }
.aviso.erro { background: #FDECEC; border-color: #E8B9AD; }

.estado { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.e-atribuido, .e-aberto { 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-por_validar, .e-local { background: #F9DCD5; color: #7A2414; }

.sinc { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.ponto { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.ponto.pendente { background: #D08A00; }
.ponto.erro { background: var(--danger); }

/* Vistoria */
.topo-vistoria { background: var(--ink); color: var(--white); padding: calc(10px + var(--topo)) 18px 14px; display: flex; flex-direction: column; gap: 2px; }
.topo-vistoria .voltar { color: var(--white); }
.topo-vistoria .num { font-size: 30px; line-height: 1.05; }
.topo-vistoria .muted, .topo-vistoria .sinc { color: #CFCBC2; }
details.capitulo { background: var(--white); border: 1px solid var(--line); border-radius: 6px; }
details.capitulo > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; padding: 0 14px; cursor: pointer; font-weight: 600; }
details.capitulo > summary::-webkit-details-marker { display: none; }
details.capitulo > summary .resumo { font-weight: 400; font-size: 13px; color: var(--muted); }
details.capitulo[open] > summary { border-bottom: 1px solid var(--line-2); }
details.capitulo .corpo { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 12px; }
details.capitulo.notas-visita { border: 2px solid var(--ink); }
.area { display: flex; flex-direction: column; gap: 10px; }
.area + .area { border-top: 1px solid var(--line-2); padding-top: 14px; }
.area-topo { display: flex; align-items: center; gap: 8px; }
.area-topo input { font-weight: 600; }
.nota { display: flex; gap: 10px; align-items: flex-start; }
.nota .n { font-family: var(--mono); font-size: 14px; padding-top: 12px; min-width: 32px; }
.nota .campos { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.nota .acoes, .acoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.miniatura { width: 72px; height: 72px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); background: var(--line-2); }
.capa { width: 100%; max-height: 240px; object-fit: cover; border-radius: 4px; }
.texto-com-voz { position: relative; }
.ouvir { position: absolute; right: 6px; bottom: 6px; width: 40px; min-height: 40px; padding: 0; border-radius: 50%; border-color: var(--line); font-size: 18px; }
.ouvir.ativo { background: var(--red); border-color: var(--red); color: var(--white); }
.texto-com-voz textarea { padding-right: 52px; }

.rodape-fixo { position: sticky; bottom: 0; background: var(--white); border-top: 1px solid var(--line); padding: 10px 18px calc(10px + var(--fundo)); display: flex; gap: 10px; }
.rodape-fixo .principal { flex: 1; }

.separadores { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--line-2); border-radius: 6px; padding: 3px; gap: 3px; }
.separadores button { min-height: 40px; border: 0; background: transparent; font-size: 14px; padding: 0 4px; }
.separadores button[aria-selected="true"] { background: var(--white); font-weight: 600; }

dialog { border: 0; border-radius: 10px; padding: 0; width: min(520px, calc(100vw - 24px)); color: var(--ink); }
dialog::backdrop { background: rgba(28,28,28,0.5); }
dialog form { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--fundo)); transform: translateX(-50%); background: var(--ink); color: var(--white); padding: 12px 16px; border-radius: 6px; z-index: 50; max-width: calc(100vw - 32px); font-size: 15px; }
.instalar { background: var(--white); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; font-size: 14px; display: flex; gap: 10px; }

a.cartao { text-decoration: none; color: var(--ink); }
a.cartao .num { font-size: 22px; }
