:root {
    --fundo: #f4f6f9;
    --cartao: #ffffff;
    --texto: #1b2430;
    --suave: #5f6b7a;
    --borda: #d9dee6;
    --acento: #1f5fbf;
    --acento-escuro: #184b97;
    --ok: #1f7a4d;
    --erro: #b3261e;
    --info: #1f5fbf;
    --raio: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--texto);
    background: var(--fundo);
}
h1 { font-size: 1.35rem; line-height: 1.3; margin: 0 0 .5rem; }
h2 { font-size: 1.05rem; margin: 1.1rem 0 .5rem; }
.cartao h2:first-child { margin-top: 0; }
a { color: var(--acento); }
small { color: var(--suave); font-weight: 400; }

.topo {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    padding: .75rem 1rem; background: #14213d; color: #fff;
}
.topo a.marca { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-weight: 700; }
.topo .marca img { display: block; width: 200px; max-width: 50vw; height: auto; }
.topo .marca span { font-weight: 400; opacity: .7; font-size: .85rem; }
.usuario-topo { display: grid; grid-template-columns: auto auto; align-items: center; column-gap: .6rem; }
.usuario-topo .perfil-selo { grid-column: 1; grid-row: 1; justify-self: start; margin-bottom: .15rem; }
.usuario-topo .usuario { grid-column: 1; grid-row: 2; justify-self: start; }
.usuario-topo .menu-topo { grid-column: 2; grid-row: 1 / span 2; }
.usuario-topo .usuario { font-size: .9rem; opacity: .85; }
.perfil-selo { font-size: .72rem; padding: .1rem .5rem; border-radius: 999px; background: rgba(255,255,255,.18); color: #fff; }

.container { max-width: 760px; margin: 0 auto; padding: 1rem; }
.barra { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .75rem; }
.barra h1 { margin: 0; }

.cartao {
    background: var(--cartao); border: 1px solid var(--borda); border-radius: var(--raio);
    padding: 1rem; margin: 0 0 1rem;
}
.centro { text-align: center; }
.login { max-width: 380px; margin: 12vh auto 0; }
.suave { color: var(--suave); }
.pequeno { font-size: .85rem; }

.aviso { padding: .7rem .9rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid; }
.aviso-ok { background: #e8f5ee; border-color: #b5dec5; color: var(--ok); }
.aviso-info { background: #e9f0fb; border-color: #bcd0ee; color: var(--info); }
.aviso-alerta { background: #fff4d6; border-color: #f0d68a; color: #7a5200; }
.escolha-status { border: 0; padding: 0; }
.escolha-status legend { font-weight: 700; padding: 0; margin: .25rem 0 0; }
.aviso-erro { background: #fdecea; border-color: #f3c0bb; color: var(--erro); }

/* Botões e links */
.botao, button.botao {
    display: inline-block; padding: .65rem 1.1rem; border: 0; border-radius: 10px;
    background: var(--acento); color: #fff; font: inherit; font-weight: 600;
    text-decoration: none; text-align: center; cursor: pointer; min-height: 44px;
}
.botao:hover { background: var(--acento-escuro); }
.botao.sec { background: #e7ebf1; color: var(--texto); }
.botao.sec:hover { background: #dbe1ea; }
.botao.grande { padding: .85rem 1.3rem; font-size: 1.05rem; }
.botao:disabled { opacity: .55; cursor: wait; }
button.link {
    background: none; border: 0; padding: .25rem; font: inherit; color: var(--acento);
    cursor: pointer; text-decoration: underline;
}
button.perigo, .perigo { color: var(--erro); }

/* Formulários */
.campo { display: block; margin: 0 0 .9rem; }
.campo > span { display: block; font-weight: 600; margin-bottom: .25rem; }
input[type=text], input[type=password], input[type=date], input[type=number], select, textarea {
    width: 100%; padding: .65rem .75rem; font: inherit; color: inherit;
    border: 1px solid var(--borda); border-radius: 10px; background: #fff; min-height: 44px;
}
input:focus, select:focus, textarea:focus, .opcao:focus-within {
    outline: 3px solid #b8d0f5; border-color: var(--acento);
}
input[type=file] { width: 100%; padding: .5rem 0; font: inherit; }
.grade { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
.grande-input { font-size: 1.3rem; }
.check { display: flex; gap: .6rem; align-items: center; margin: 0 0 .9rem; font-weight: 600; }
.check input { width: 22px; height: 22px; }

/* Pergunta */
.etapa-nome { margin: 0 0 .25rem; text-transform: uppercase; letter-spacing: .04em; font-size: .75rem; color: var(--suave); font-weight: 700; }
.opcoes { display: grid; gap: .55rem; margin: 1rem 0; }
.opcoes.duas { grid-template-columns: 1fr 1fr; }
.opcao {
    display: flex; align-items: center; gap: .7rem; padding: .85rem 1rem; min-height: 52px;
    border: 2px solid var(--borda); border-radius: 12px; cursor: pointer; background: #fff;
}
.opcao input { width: 22px; height: 22px; flex: none; accent-color: var(--acento); }
.opcao:has(input:checked) { border-color: var(--acento); background: #eaf1fc; font-weight: 600; }
.acoes-form { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: flex-end; margin-top: 1rem; }
.acoes-form .grande { flex: 1 1 200px; }

.contexto { display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; align-items: baseline; margin-bottom: .6rem; font-size: .9rem; }
.etapas { list-style: none; display: flex; gap: .4rem; flex-wrap: wrap; padding: 0; margin: 0 0 .6rem; font-size: .78rem; }
.etapas li { padding: .2rem .6rem; border-radius: 999px; background: #e7ebf1; color: var(--suave); }
.etapas li.completa { background: #e1f1e8; color: var(--ok); }
.etapas li.atual { background: var(--acento); color: #fff; font-weight: 700; }
.progresso { height: 8px; background: #e2e7ee; border-radius: 999px; overflow: hidden; }
.progresso > div { height: 100%; background: var(--acento); }

/* Listas */
.lista { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.item { display: block; text-decoration: none; color: inherit; background: var(--cartao); border: 1px solid var(--borda); border-radius: var(--raio); padding: .85rem 1rem; }
.item:hover { border-color: var(--acento); }
.item-topo { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; }
.selo { font-size: .75rem; padding: .15rem .55rem; border-radius: 999px; background: #e7ebf1; white-space: nowrap; }
.selo-em_analise { background: #fff1d6; color: #8a5a00; }
.selo-laudo_gerado { background: #e1f1e8; color: var(--ok); }
.os-fixa { display: flex; align-items: baseline; gap: .75rem; margin: 0 0 .75rem; font-size: 1.05rem; }
.existentes { list-style: none; padding: 0; margin: .5rem 0 1rem; display: grid; gap: .4rem; }
.existentes li { padding: .5rem .75rem; border: 1px solid var(--borda); border-radius: 10px; background: #fafbfd; }

.dados { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem 1rem; margin: 0 0 .75rem; }
.dados dt { font-size: .75rem; color: var(--suave); text-transform: uppercase; letter-spacing: .03em; }
.dados dd { margin: 0; font-weight: 600; }
.respostas { list-style: none; padding: 0; margin: 0; }
.respostas li { padding: .6rem 0; border-top: 1px solid var(--borda); }
.respostas li:first-child { border-top: 0; }
.r-topo { display: flex; justify-content: space-between; gap: .75rem; }
.r-pergunta { color: var(--suave); font-size: .9rem; }
.r-valor { font-weight: 600; }

.midias { display: flex; gap: .75rem; flex-wrap: wrap; }
.midias figure { margin: 0; }
.midias img, .midias video { max-width: 100%; width: 220px; height: 160px; object-fit: cover; border-radius: 10px; border: 1px solid var(--borda); background: #000; }
.midias.pequenas img, .midias.pequenas video { width: 110px; height: 80px; margin-top: .4rem; }

details.cartao summary, details summary { cursor: pointer; font-weight: 600; padding: .25rem 0; }
details form { margin-top: .75rem; }
.largo { grid-column: 1 / -1; }

@media (min-width: 640px) {
    .grade { grid-template-columns: 1fr 1fr; }
    .container { padding: 1.5rem 1rem; }
}

/* Laudo */
.botao.verde, button.botao.verde { background: #1f7a4d; color: #fff; }
.botao.verde:hover { background: #17613c; }
.acoes-form .botao { text-decoration: none; }
.item-laudo { display: grid; grid-template-columns: 110px 1fr 130px; gap: .5rem; margin: .5rem 0; }
.itens-laudo { border: 0; padding: 0; margin: 1rem 0; }
.itens-laudo legend { font-weight: 600; padding: 0; margin-bottom: .15rem; }
@media (max-width: 560px) { .item-laudo { grid-template-columns: 1fr 1fr; } .item-laudo input[type=text] { grid-column: 1 / -1; grid-row: 2; } }

/* Áudio do laudo */
.audio-laudo-form { border: 0; padding: 0; margin: 1rem 0; }
.audio-laudo-form legend { font-weight: 600; padding: 0; margin-bottom: .25rem; }
.audio-laudo-form audio, .audio-laudo audio { width: 100%; max-width: 420px; display: block; margin: .4rem 0; }
.audio-laudo-form audio[hidden] { display: none; }
.gravador { display: flex; align-items: center; gap: .75rem; margin: .5rem 0; }
.gravador .gravando { background: var(--erro); color: #fff; }
.opcao-simples { display: block; margin: .4rem 0; }

/* Versões do laudo */
.versoes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
.versoes-titulo { font-weight: 600; margin-right: 4px; }
.versao-chip { display: inline-block; box-sizing: border-box; min-width: 48px; padding: 6px 14px; border: 2px solid #000; border-radius: 4px; background: #fff; color: #000; text-align: center; text-decoration: none; font-size: 14px; line-height: 1.3; }
.versao-chip:hover { background: #f0f0f0; }
.versao-chip.ativa { background: #1f7a4d; border-color: #1f7a4d; color: #fff; font-weight: 700; font-size: 16px; padding: 8px 18px; }

/* Busca de análises */
.acoes-topo { display: flex; align-items: center; gap: .5rem; }
.botao.icone { padding: .55rem .7rem; display: inline-flex; align-items: center; justify-content: center; }
.busca { display: flex; gap: .5rem; align-items: center; margin: 0 0 1rem; }
.busca[hidden] { display: none; }
.busca select { width: auto; flex: 0 0 auto; padding: .6rem .5rem; }
@media (max-width: 520px) { .busca { flex-wrap: wrap; } .busca input[type="search"] { flex-basis: 100%; } }
.busca input[type="search"] { flex: 1; min-width: 0; padding: .6rem .75rem; border: 1px solid #c9d1dc; border-radius: 6px; font-size: 1rem; }

/* Botão do login: largura total e mais fino. Ajuste à vontade. */
.botao.BotaoLogin { display: block; box-sizing: border-box; width: 100%; padding: .5rem 1rem; font-size: 1rem; }

/* Menu das análises (três pontinhos) */
.card-analise { position: relative; }
.card-analise .item { padding-bottom: 2.6rem; }
.menu-card { position: absolute; right: .5rem; bottom: .4rem; z-index: 5; }
.menu-botao { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 36px; border: 1px solid var(--borda); border-radius: 8px; background: #fff; color: var(--texto); cursor: pointer; }
.menu-botao:hover { background: #eef2f7; }
.menu-lista { position: absolute; right: 0; bottom: calc(100% + 4px); min-width: 220px; margin: 0; padding: .3rem; list-style: none; background: #fff; border: 1px solid var(--borda); border-radius: 10px; box-shadow: 0 6px 20px rgba(0, 0, 0, .15); }
.menu-lista[hidden] { display: none; }
.barra-acoes { display: flex; align-items: center; gap: .75rem; }
.menu-resumo { position: relative; right: auto; bottom: auto; }
.menu-resumo .menu-lista { top: calc(100% + 4px); bottom: auto; }
.menu-lista a { display: block; padding: .6rem .75rem; border-radius: 6px; color: var(--texto); text-decoration: none; }
.menu-lista a:hover { background: #eef2f7; }
.menu-lista a.perigo { color: var(--erro); }
.selo-cor-amarelo { background: #fff1d6; color: #8a5a00; }
.selo-cor-laranja { background: #ffd9b0; color: #9a3f00; font-weight: 600; }
.selo-cor-vermelho { background: #fbd5d1; color: #a11a12; }
.selo-cor-cinza { background: #e3e8ef; color: #455468; }
.selo-cor-azul-escuro { background: #1e3a6e; color: #fff; }
.selo-cor-verde { background: #e1f1e8; color: var(--ok); }
.selo-cor-roxo { background: #ece3f7; color: #5b2a97; }
.selo-cor-azul-claro { background: #dcebfb; color: #1f5fbf; }
.selo-excluida { background: #fdecea; color: var(--erro); }
.botao.botao-perigo, button.botao.botao-perigo { background: #b3261e; color: #fff; }
.botao.botao-perigo:hover { background: #8f1d17; }
.botao.botao-perigo:disabled { opacity: .45; cursor: not-allowed; }

/* Menu do usuário (engrenagem, no topo) */
.menu-topo { position: relative; right: auto; bottom: auto; }
.menu-topo .menu-botao { width: 36px; height: 34px; background: transparent; color: #fff; border-color: rgba(255, 255, 255, .4); }
.menu-topo .menu-botao:hover { background: rgba(255, 255, 255, .15); }
.menu-topo .menu-lista { top: calc(100% + 6px); bottom: auto; min-width: 230px; padding: .3rem; }
.menu-lista form { margin: 0; }
.menu-lista button { display: block; width: 100%; text-align: left; padding: .6rem .75rem; border: 0; border-radius: 6px; background: transparent; color: var(--texto); font: inherit; cursor: pointer; }
.menu-lista button:hover { background: #eef2f7; }

.comparar { margin: .4rem 0 1rem; padding-left: 1.2rem; }
.comparar li { margin: .35rem 0; }

/* Tela inicial: botões grandes, 2 por linha no celular, 4 em tela larga */
.inicio-grade { display: grid; grid-template-columns: repeat(2, 1fr); gap: .9rem; margin-top: 1rem; }
@media (min-width: 900px) { .inicio-grade { grid-template-columns: repeat(4, 1fr); } }
.inicio-botao { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; text-align: center;
  min-height: 11rem; padding: 1rem .75rem; border-radius: 14px; color: #fff; text-decoration: none; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.inicio-botao strong { font-size: 1.1rem; line-height: 1.2; }
.inicio-botao small { color: #fff; opacity: .9; font-size: .78rem; }
a.inicio-botao:active { transform: scale(.98); }
a.inicio-botao:focus-visible { outline: 3px solid #111; outline-offset: 2px; }
.inicio-azul { background: #1f5fbf; } .inicio-laranja { background: #d9730d; } .inicio-verde { background: #1f8a4c; }
.inicio-roxo { background: #6b3fa0; } .inicio-vermelho { background: #c0392b; }
.inicio-breve { opacity: .55; filter: grayscale(.4); cursor: not-allowed; }
