/* masuno · Inspecciones y Auditorías — estilos mobile-first */
:root {
  --rojo: #c62828; --rojo-osc: #8e0000;
  --ok: #2e7d32; --nc: #c62828; --obs: #ef6c00; --na: #757575;
  --fondo: #f5f6f8; --carta: #ffffff; --borde: #e0e2e6;
  --texto: #212529; --texto2: #5f6368;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--fondo); color: var(--texto);
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 16px; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; width: 100%; padding: 10px; border: 1px solid var(--borde);
  border-radius: 8px; background: #fff; color: var(--texto); }
textarea { min-height: 70px; resize: vertical; }
label { display: block; font-size: .85rem; color: var(--texto2); margin: 10px 0 4px; }

/* Barra superior */
#topbar { position: sticky; top: 0; z-index: 50; background: var(--rojo); color: #fff;
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
#topbar .logo { height: 26px; }
#topbar h1 { font-size: 1.02rem; margin: 0; flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#topbar button { background: rgba(255,255,255,.15); color: #fff; border: none; border-radius: 8px; padding: 8px 10px; }
#syncdot { font-size: .7rem; padding: 3px 8px; border-radius: 10px; background: rgba(255,255,255,.2); }
#syncdot.pend { background: #ffb300; color: #000; }

#app { max-width: 760px; margin: 0 auto; padding: 12px 12px 90px; }

.card { background: var(--carta); border: 1px solid var(--borde); border-radius: 12px;
  padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card h2 { margin: 0 0 8px; font-size: 1.05rem; }
.card h3 { margin: 14px 0 6px; font-size: .95rem; color: #4a4d52; }
.muted { color: var(--texto2); font-size: .85rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
hr { border: none; border-top: 1px solid var(--borde); margin: 12px 0; }

/* Botones */
.btn { display: inline-block; border: none; border-radius: 10px; padding: 12px 16px;
  background: var(--rojo); color: #fff; font-weight: 600; text-align: center; }
.btn.sec { background: #fff; color: var(--rojo); border: 1.5px solid var(--rojo); }
.btn.gris { background: #eceef1; color: var(--texto); border: 1px solid var(--borde); font-weight: 500; }
.btn.peq { padding: 7px 10px; font-size: .85rem; border-radius: 8px; }
.btn.block { display: block; width: 100%; margin-top: 10px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-big { display: flex; align-items: center; gap: 12px; width: 100%; margin-bottom: 10px;
  padding: 18px 16px; font-size: 1.05rem; border-radius: 14px; }
.btn-big small { display: block; font-weight: 400; opacity: .85; font-size: .8rem; }

/* Listas */
.item-lista { display: flex; align-items: center; gap: 10px; padding: 12px 4px;
  border-bottom: 1px solid var(--borde); }
.item-lista:last-child { border-bottom: none; }
.item-lista .tit { flex: 1; min-width: 0; }
.item-lista .tit b { display: block; }
.item-lista .tit span { font-size: .8rem; color: var(--texto2); }
.chip { display: inline-block; font-size: .7rem; padding: 2px 8px; border-radius: 10px;
  background: #eceef1; color: var(--texto2); margin: 2px 3px 0 0; white-space: nowrap; }
.chip.norma { background: #e3f2fd; color: #0d47a1; }
.chip.ok { background: #e8f5e9; color: var(--ok); }
.chip.nc { background: #ffebee; color: var(--nc); }
.chip.obs { background: #fff3e0; color: var(--obs); }
.chip.borrador { background: #fff8e1; color: #8d6e00; }

/* Checklist */
.chk-item { padding: 12px 0; border-bottom: 1px solid var(--borde); }
.chk-item:last-child { border-bottom: none; }
.chk-item .txt { margin-bottom: 8px; }
.chk-item .num { color: var(--texto2); font-size: .8rem; margin-right: 6px; }
.res-botones { display: flex; gap: 6px; }
.res-botones button { flex: 1; padding: 10px 4px; border-radius: 8px; border: 1.5px solid var(--borde);
  background: #fff; color: var(--texto2); font-weight: 600; font-size: .85rem; }
.res-botones button.sel-C   { background: var(--ok);  border-color: var(--ok);  color: #fff; }
.res-botones button.sel-NC  { background: var(--nc);  border-color: var(--nc);  color: #fff; }
.res-botones button.sel-OBS { background: var(--obs); border-color: var(--obs); color: #fff; }
.res-botones button.sel-NA  { background: var(--na);  border-color: var(--na);  color: #fff; }
.chk-extra { margin-top: 8px; }
.chk-extra textarea { min-height: 44px; font-size: .9rem; }
.fotos-mini { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.fotos-mini .fwrap { position: relative; }
.fotos-mini img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--borde); }
.fotos-mini .del { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--nc); color: #fff; border: none; font-size: .75rem; line-height: 1; }

/* Progreso */
.progreso { height: 8px; background: #eceef1; border-radius: 4px; overflow: hidden; margin: 6px 0 2px; }
.progreso div { height: 100%; background: var(--ok); transition: width .3s; }

/* Secciones plegables */
.sec-head { display: flex; align-items: center; gap: 8px; padding: 10px 0; cursor: pointer;
  border-bottom: 2px solid var(--borde); font-weight: 600; }
.sec-head .flecha { transition: transform .2s; }
.sec-head.abierta .flecha { transform: rotate(90deg); }
.sec-cuerpo { display: none; }
.sec-cuerpo.abierta { display: block; }

/* Navegación inferior */
#navbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; display: flex;
  background: #fff; border-top: 1px solid var(--borde); padding-bottom: env(safe-area-inset-bottom); }
#navbar button { flex: 1; background: none; border: none; padding: 9px 2px 7px; font-size: .68rem;
  color: var(--texto2); display: flex; flex-direction: column; align-items: center; gap: 2px; }
#navbar button .ico { font-size: 1.35rem; }
#navbar button.act { color: var(--rojo); font-weight: 700; }

/* Modal */
#modal-fondo { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 90; display: none; }
#modal-fondo.abierto { display: flex; align-items: flex-end; justify-content: center; }
#modal { background: #fff; border-radius: 16px 16px 0 0; width: 100%; max-width: 760px;
  max-height: 88vh; overflow-y: auto; padding: 16px 16px 30px; }
@media (min-width: 700px) { #modal-fondo.abierto { align-items: center; } #modal { border-radius: 16px; } }

.aviso { background: #fff8e1; border: 1px solid #ffe082; color: #6d5300; border-radius: 10px;
  padding: 10px 12px; font-size: .85rem; margin: 8px 0; }
.exito { background: #e8f5e9; border: 1px solid #a5d6a7; color: #1b5e20; border-radius: 10px;
  padding: 10px 12px; font-size: .9rem; margin: 8px 0; }

.login-wrap { max-width: 420px; margin: 8vh auto 0; text-align: center; }
.login-wrap img { max-width: 220px; margin-bottom: 18px; }

.tag-fecha { font-size: .78rem; color: var(--texto2); }
.pill-estado { font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 12px; }
.pill-estado.abierta { background: #fff3e0; color: var(--obs); }
.pill-estado.cerrada { background: #e8f5e9; color: var(--ok); }
