/* MedTech PWA: seção Exames (AchadosView.swift). Cor da seção #0F7F74; claro e escuro pelo sistema. */
:root {
  --ex-cor: #0F7F74; --ex-tinta: #0B6E64;
  --cz-alta: #0F7F74; --cz-media: #B7791F; --cz-baixa: #C2410C;
  --cz-alta-t: #0B6E64; --cz-media-t: #8A5A0B; --cz-baixa-t: #B03A08;
  --ex-azul: #2563EB; --ex-ambar: #B7791F; --ex-roxo: #7C4DE8; --ex-cinza: #5D6579; --ex-corte: #B03A08;
}
@media (prefers-color-scheme: dark) {
  :root { --ex-tinta: #5FD6C8; --cz-alta-t: #5FD6C8; --cz-media-t: #E9BE6C; --cz-baixa-t: #FFA877; }
}

.ex { position: absolute; inset: 0; }
.ex-form { padding-bottom: 28px; }
.ex-form.arrastando { box-shadow: inset 0 0 0 3px var(--ex-cor); }

/* motor (laudai.html?achados=1): fora da tela; por cima do app só com o visualizador DICOM aberto */
.ex-motor { position: fixed; left: -10000px; top: 0; width: 390px; height: 800px; border: 0; opacity: 0; pointer-events: none; }
.ex-motor.vis { position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 500; opacity: 1; pointer-events: auto; background: rgba(0, 0, 0, .35); }

/* cabeçalho */
.ex-cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ex-cab .titulo-secao { margin-bottom: 0; }
.ex-cab-bts { display: flex; align-items: center; gap: 2px; }
.ex-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 8px; font-size: 16px; font-weight: 600; color: var(--ex-tinta); }
.ex-link .ti { font-size: 18px; }
.ex-icone { width: 44px; height: 44px; display: grid; place-items: center; font-size: 22px; color: var(--tinta2); border-radius: 50%; }
.ex-sub { font-size: 16px; color: var(--tinta2); line-height: 1.45; margin: 6px 0 16px; }

/* tipos de exame: rolam de lado dentro da faixa, como no iPhone (a página não rola de lado) */
.ex-tipos-rola { margin: 0 -16px 18px; overflow-x: auto; scrollbar-width: none; scroll-padding: 0 16px; overscroll-behavior-x: contain; }
.ex-tipos-rola::-webkit-scrollbar { display: none; }
.ex-tipos { display: flex; gap: 8px; padding: 2px 16px; width: max-content; }
.ex-tipo { min-height: 44px; padding: 0 16px; border-radius: 999px; background: var(--sup); color: var(--tinta2); font-size: 16px; font-weight: 600; white-space: nowrap; transition: background-color .2s, color .2s, transform .25s var(--mola); }
.ex-tipo[aria-pressed="true"] { background: var(--ex-cor); color: #fff; }
.ex-tipo:active { transform: scale(.965); }

/* captura */
.ex-captura { margin-bottom: 16px; }
.ex-cap2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ex-pega { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 26px; min-height: 120px; padding: 18px; border-radius: 24px; background: var(--sup); color: var(--ex-tinta); text-align: left; transition: transform .25s var(--mola); }
.ex-pega .ti { font-size: 28px; }
.ex-pega b { font-size: 17px; font-weight: 700; line-height: 1.25; }
.ex-pega.cheio { background: var(--ex-cor); color: #fff; }
.ex-pega:active, .ex-hitem:active, .ex-cheio:active { transform: scale(.965); }
.ex-dica { font-size: 14px; color: var(--tinta2); margin-top: 8px; line-height: 1.4; }
.ex-exemplo { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; margin-top: 10px; padding: 0 14px; border-radius: 16px; border: 1px dashed var(--ex-cor); color: var(--ex-tinta); font-size: 16px; font-weight: 600; text-align: left; }
.ex-exemplo .ti { font-size: 20px; }

.ex-fotos { display: flex; gap: 10px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px; scrollbar-width: none; }
.ex-fotos::-webkit-scrollbar { display: none; }
.ex-foto { position: relative; flex: none; width: 128px; height: 150px; border-radius: 18px; overflow: hidden; background: #000; }
.ex-foto-ver { display: block; width: 100%; height: 100%; }
.ex-foto-ver img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ex-foto-ver:focus-visible { outline-offset: -4px; }
.ex-selo { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, .62); color: #fff; font-size: 12px; font-weight: 700; pointer-events: none; }
.ex-tira { position: absolute; top: 0; right: 0; width: 44px; height: 44px; display: grid; place-items: center; }
.ex-tira span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .62); color: #fff; font-size: 15px; }
.ex-mais { flex: none; width: 72px; height: 150px; border-radius: 18px; background: var(--sup); color: var(--ex-tinta); font-size: 24px; display: grid; place-items: center; }
.ex-conta { font-size: 14px; color: var(--tinta2); margin-top: 8px; }
.ex-conta.demais { color: var(--critico); font-weight: 600; }
.ex-tire { display: flex; align-items: flex-start; gap: 6px; font-size: 14px; font-weight: 600; color: var(--alerta); margin-top: 6px; line-height: 1.4; }
.ex-tire .ti { font-size: 16px; margin-top: 2px; }

/* campos */
.ex-campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; min-width: 0; }
.ex-campo label { font-size: 14px; font-weight: 600; color: var(--tinta2); }
.ex-campo input, .ex-campo textarea, .ex-campo select { width: 100%; min-height: 48px; padding: 12px 13px; border-radius: 14px; border: 1px solid var(--fio); background: var(--sup); color: var(--tinta); font: 16px/1.4 var(--fonte); -webkit-appearance: none; appearance: none; }
.ex-campo textarea { resize: vertical; min-height: 72px; }
.ex-campo select { padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--tinta2) 50%), linear-gradient(135deg, var(--tinta2) 50%, transparent 50%); background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.ex-campo :is(input, textarea, select):focus { outline: 0; border-color: var(--ex-cor); box-shadow: 0 0 0 1px var(--ex-cor); }
.ex-campo :is(input, textarea)::placeholder { color: var(--tinta2); opacity: .85; }
.ex-par { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.ex-dobra { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 50px; padding: 0 2px; }
.ex-dobra-ic { width: 24px; display: grid; place-items: center; color: var(--ex-tinta); font-size: 18px; }
.ex-dobra-n { font-size: 17px; font-weight: 600; color: var(--tinta); }
.ex-opc { font-size: 14px; color: var(--tinta2); }
.ex-dobra > .ti-chevron-down { margin-left: auto; font-size: 14px; color: var(--tinta2); transition: transform .25s; }
.ex-dobra[aria-expanded="true"] > .ti-chevron-down { transform: rotate(180deg); }
.ex-dobrado { padding-top: 4px; animation: ex-entra .3s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes ex-entra { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* aviso e botão */
.ex-aviso { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 12px; padding: 14px; border-radius: 18px; background: var(--alerta-fundo); }
.ex-aviso .ti { color: var(--alerta); font-size: 20px; margin-top: 1px; flex: none; }
.ex-aviso p { font-size: 15px; line-height: 1.45; color: var(--tinta); }
.ex-aviso strong { font-weight: 700; }
.ex-erro { font-size: 15px; font-weight: 600; color: var(--critico); margin-bottom: 10px; }
.ex-cheio { gap: 8px; background: var(--ex-cor); transition: transform .25s var(--mola), opacity .2s; }
.ex-cheio .ti { font-size: 20px; }
.ex-cheio:disabled { background: var(--tinta2); opacity: .45; cursor: default; }
.ex-cheio:disabled:active { transform: none; }
.ex-nota-demo { font-size: 14px; color: var(--tinta2); text-align: center; margin-top: 10px; }
.ex-gira { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: ex-gira .8s linear infinite; }
@keyframes ex-gira { to { transform: rotate(360deg); } }

/* lendo (LeituraEmCurso) */
.ex-lendo { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 20px 28px; text-align: center; }
.ex-lendo-quadro { position: relative; width: 100%; max-height: 420px; border-radius: 22px; overflow: hidden; background: var(--sup); display: grid; place-items: center; margin-bottom: 10px; }
.ex-lendo-quadro img { display: block; width: 100%; max-height: 420px; object-fit: contain; }
.ex-lendo-ic { padding: 70px 0; font-size: 56px; color: var(--ex-tinta); }
.ex-varre { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--ex-cor); box-shadow: 0 0 12px 2px var(--ex-cor); animation: ex-varre 1.6s ease-in-out infinite alternate; }
@keyframes ex-varre { from { top: 0; } to { top: calc(100% - 3px); } }
.ex-etapa { font-size: 19px; font-weight: 700; }
.ex-tempo { font-size: 14px; color: var(--tinta2); }

/* resultado (ResultadoAchados) */
.ex-res { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--papel); }
.ex-res-cab { flex: none; display: flex; align-items: center; gap: 10px; padding: 6px 12px 8px; }
.ex-res-cab h2 { flex: 1; font-size: 20px; font-weight: 700; outline: 0; }
.ex-redondo { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--sup); color: var(--ex-tinta); font-size: 18px; flex: none; }
.ex-selo-demo { flex: none; display: flex; gap: 8px; align-items: flex-start; margin: 0 14px 8px; padding: 10px 12px; border-radius: 14px; background: var(--perola-fundo); color: var(--tinta); font-size: 14px; line-height: 1.4; }
.ex-selo-demo .ti { color: var(--perola); font-size: 18px; flex: none; }
.ex-res-img { flex: none; padding: 0 14px; }
.ex-res-fotos { display: flex; height: 190px; border-radius: 18px; overflow-x: auto; scroll-snap-type: x mandatory; background: #000; scrollbar-width: none; }
.ex-res-fotos::-webkit-scrollbar { display: none; }
.ex-res-foto { flex: none; width: 100%; height: 100%; scroll-snap-align: center; }
.ex-res-foto img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ex-res-foto:focus-visible { outline-offset: -4px; }
.ex-recolhe { display: flex; align-items: center; justify-content: center; gap: 5px; width: 100%; min-height: 44px; font-size: 14px; font-weight: 600; color: var(--tinta2); }
.ex-res-rola { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.ex-res-rola::-webkit-scrollbar { display: none; }
.ex-res-corpo { display: flex; flex-direction: column; gap: 14px; padding: 4px 16px 24px; }
.ex-res-corpo > * { animation: ex-sobe .5s cubic-bezier(.2, .9, .3, 1) both; }
.ex-res-corpo > :nth-child(2) { animation-delay: 50ms; } .ex-res-corpo > :nth-child(3) { animation-delay: 100ms; }
.ex-res-corpo > :nth-child(4) { animation-delay: 150ms; } .ex-res-corpo > :nth-child(5) { animation-delay: 200ms; }
@keyframes ex-sobe { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.ex-alerta { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border-radius: 18px; background: var(--ex-corte); color: #fff; }
.ex-alerta .ti { font-size: 20px; flex: none; margin-top: 1px; }
.ex-alerta p { font-size: 16px; font-weight: 600; line-height: 1.45; }

.ex-bloco { --k: var(--ex-cinza); padding: 16px; border-radius: 22px; background: var(--sup); }
.ex-bloco.aparece { --k: var(--ex-cor); } .ex-bloco.conferir { --k: var(--ex-azul); } .ex-bloco.significar { --k: var(--ex-ambar); } .ex-bloco.comparada { --k: var(--ex-roxo); }
.ex-bloco h3 { display: flex; align-items: center; gap: 9px; font-size: 18px; font-weight: 700; line-height: 1.25; margin-bottom: 10px; }
.ex-circulo { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--k, var(--ex-cor)); color: #fff; font-size: 16px; }
.ex-circulo.grande { width: 52px; height: 52px; font-size: 26px; margin: 10px 4px 0; }
.ex-bloco p, .ex-bloco li { font-size: 16px; line-height: 1.5; }
.ex-bloco > p + p, .ex-bloco ul + p, .ex-bloco ol + p { margin-top: 6px; }
.ex-bloco ul, .ex-bloco ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ex-achados li { display: flex; align-items: flex-start; gap: 12px; }
.ex-achados li > span:first-child { flex: 1; min-width: 0; }
.ex-cz { flex: none; width: 46px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 5px; font-size: 11px; font-weight: 700; line-height: 1; }
.ex-cz-b { display: flex; gap: 2px; }
.ex-cz-b i { width: 9px; height: 5px; border-radius: 3px; background: var(--fio); }
.ex-cz.alta { color: var(--cz-alta-t); } .ex-cz.alta i.on { background: var(--cz-alta); }
.ex-cz.media { color: var(--cz-media-t); } .ex-cz.media i.on { background: var(--cz-media); }
.ex-cz.baixa { color: var(--cz-baixa-t); } .ex-cz.baixa i.on { background: var(--cz-baixa); }
.ex-confere label { display: flex; align-items: flex-start; gap: 11px; min-height: 44px; padding: 2px 0; cursor: pointer; }
.ex-confere input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--ex-azul); }
.ex-confere li.feito span { color: var(--tinta2); text-decoration: line-through; }
.ex-hipoteses li { display: flex; align-items: flex-start; gap: 11px; }
.ex-hipoteses b { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--ex-ambar); color: #fff; font-size: 14px; font-weight: 700; margin-top: 1px; }
.ex-lista li { position: relative; padding-left: 14px; }
.ex-lista li::before { content: ""; position: absolute; left: 0; top: .62em; width: 5px; height: 5px; border-radius: 50%; background: var(--tinta2); }
.ex-qualidade { padding: 0 4px; }
.ex-qualidade h3 { font-size: 14px; font-weight: 700; color: var(--tinta2); margin-bottom: 4px; }
.ex-qualidade p { font-size: 15px; color: var(--tinta2); line-height: 1.45; }
.ex-cru p { font-size: 16px; line-height: 1.55; }
.ex-cru p + p { margin-top: 10px; }
.ex-rodape { font-size: 13px; color: var(--tinta2); line-height: 1.45; padding: 0 4px; }

/* folhas: aceite, histórico, ajustes */
.folha-ex .folha-titulo { margin-bottom: 10px; }
.folha-ex .folha-corpo > .corpo { margin: 0 4px 14px; }
.ex-hnota { margin: -4px 4px 14px; }
.ex-marca { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; margin: 0 4px 18px; font-size: 16px; font-weight: 500; line-height: 1.45; cursor: pointer; }
.ex-marca input { flex: none; width: 24px; height: 24px; margin: 1px 0 0; accent-color: var(--ex-cor); }
.ex-hlista { display: flex; flex-direction: column; gap: 8px; }
.ex-hitem { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 12px 14px; border-radius: 18px; background: var(--sup); text-align: left; transition: transform .25s var(--mola); }
.ex-hitem .ex-circulo { --k: var(--ex-cor); }
.ex-htx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ex-htx b { font-size: 16px; font-weight: 600; }
.ex-htx span { font-size: 13px; color: var(--tinta2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-hitem > .ti-chevron-right { font-size: 13px; color: var(--tinta2); }
.folha-ex .ex-campo { margin: 0 4px 14px; }
.folha-ex .ex-cheio { margin-top: 6px; }

/* imagem em tela cheia (ZoomFoto) */
.ex-zoom { position: absolute; inset: 0; z-index: 450; background: #000; display: grid; place-items: center; overflow: auto; touch-action: pinch-zoom pan-x pan-y; }
.ex-zoom img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ex-zoom img.perto { max-width: none; max-height: none; width: 250%; }
.ex-zoom-x { position: absolute; top: calc(var(--topo) + 12px); right: 12px; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .22); color: #fff; font-size: 20px; }
.ex-zoom-x:focus-visible { outline-color: #fff; }

@media (prefers-reduced-motion: reduce) {
  .ex-varre { animation: none; top: 50%; }
  .ex-res-corpo > *, .ex-dobrado { animation: none; }
  .ex-gira { animation-duration: 2s; }
  .ex-pega, .ex-tipo, .ex-hitem, .ex-cheio { transition: none; }
  .ex-pega:active, .ex-tipo:active, .ex-hitem:active, .ex-cheio:active { transform: none; }
}
