/* MEL · estilo sencillo: sin animaciones, sin transiciones, parecido a una página estática. */
*, *::before, *::after { box-sizing: border-box; animation: none !important; transition: none !important; scroll-behavior: auto !important; }
:root {
  --azul: #1f4e78; --azul-2: #2e6da4; --fondo: #f4f6f8; --papel: #fff; --texto: #1d2733; --suave: #5b6770; --borde: #cfd8e0; --linea: #e3e8ec;
  --verde: #1b7f3b; --verde-f: #dff3e5; --amarillo: #8a6500; --amarillo-f: #fff0b8; --naranja: #a8460a; --naranja-f: #ffe3cc; --rojo: #b3261e; --rojo-f: #fde1df; --gris: #4d5963; --gris-f: #e8ecef;
  --radio: 10px; --alto: 48px;
}
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fondo); color: var(--texto); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; overscroll-behavior: none; }
#app { min-height: 100dvh; display: flex; flex-direction: column; }
.cargando { text-align: center; padding: 40vh 16px 0; color: var(--suave); }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.2; } h1 { font-size: 1.35rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 8px; } a { color: var(--azul-2); }
small, .nota { color: var(--suave); font-size: .875rem; }
.oculto { display: none !important; }

/* barra de arriba y menú de abajo */
.barra { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; background: var(--azul); color: #fff; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); min-height: 52px; }
.barra h1 { flex: 1; margin: 0; font-size: 1.1rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra button { background: rgba(255,255,255,.14); color: #fff; border: 0; border-radius: 8px; min-height: 40px; min-width: 40px; padding: 0 10px; font: inherit; }
.estado-red { font-size: .8rem; white-space: nowrap; }
.contenido { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 12px 12px 88px; }
.menu { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--papel); border-top: 1px solid var(--borde); padding-bottom: env(safe-area-inset-bottom); }
.menu a { flex: 1; text-align: center; text-decoration: none; color: var(--suave); padding: 6px 2px 8px; font-size: .75rem; min-height: 56px; }
.menu a b { display: block; font-size: 1.35rem; font-weight: 400; line-height: 1.3; }
.menu a.activo { color: var(--azul); font-weight: 700; box-shadow: inset 0 3px 0 var(--azul); }

/* botones y selectores */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--alto); padding: 0 16px; border-radius: var(--radio); border: 1px solid var(--azul); background: var(--azul); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.sec { background: var(--papel); color: var(--azul); }
.btn.verde { background: var(--verde); border-color: var(--verde); } .btn.rojo { background: var(--rojo); border-color: var(--rojo); }
.btn.peligro { background: var(--papel); color: var(--rojo); border-color: var(--rojo); }
.btn.grande { min-height: 58px; font-size: 1.1rem; width: 100%; } .btn.chico { min-height: 36px; padding: 0 10px; font-size: .9rem; }
.btn[disabled] { opacity: .45; }
.fila-botones { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; } .fila-botones > .btn { flex: 1 1 140px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.chip { min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1.5px solid var(--borde); background: var(--papel); color: var(--texto); font: inherit; cursor: pointer; display: inline-flex; align-items: center; }
.chip.sel { background: var(--azul); border-color: var(--azul); color: #fff; font-weight: 600; }
.chip.verde.sel { background: var(--verde); border-color: var(--verde); } .chip.rojo.sel { background: var(--rojo); border-color: var(--rojo); } .chip.gris.sel { background: var(--gris); border-color: var(--gris); }
.chip.amarillo.sel { background: #e6b800; border-color: #e6b800; color: #1d2733; }
.chip.mas { border-style: dashed; color: var(--azul); }
a.chip { text-decoration: none; }

/* formularios */
.campo { display: block; margin: 0 0 14px; } .campo > .rotulo, .rotulo { display: block; font-weight: 600; margin-bottom: 4px; }
.ayuda { font-weight: 400; color: var(--suave); font-size: .85rem; }
input, select, textarea { width: 100%; min-height: var(--alto); padding: 8px 10px; font: inherit; color: var(--texto); background: var(--papel); border: 1.5px solid var(--borde); border-radius: var(--radio); }
textarea { min-height: 92px; resize: vertical; } input:focus, select:focus, textarea:focus, .chip:focus, .btn:focus { outline: 3px solid #8ab4f8; outline-offset: 1px; }
input[readonly], .calc { background: var(--gris-f); }
input[type=checkbox], input[type=radio] { width: 24px; min-height: 24px; height: 24px; }
.error { color: var(--rojo); font-weight: 600; margin: 6px 0; } .aviso { background: var(--amarillo-f); border: 1px solid #e6c200; border-radius: var(--radio); padding: 10px 12px; margin: 0 0 12px; }
.aviso.rojo { background: var(--rojo-f); border-color: var(--rojo); } .aviso.verde { background: var(--verde-f); border-color: var(--verde); }

/* tarjetas y listas */
.tarjeta { background: var(--papel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 12px; margin: 0 0 10px; }
.tarjeta.toque { cursor: pointer; display: block; color: inherit; text-decoration: none; }
.tarjeta h3 { margin-bottom: 2px; }
.fila { display: flex; align-items: center; gap: 10px; background: var(--papel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 10px 12px; margin: 0 0 8px; min-height: 56px; color: inherit; text-decoration: none; cursor: pointer; }
.fila .cuerpo { flex: 1; min-width: 0; } .fila .titulo { font-weight: 600; overflow-wrap: anywhere; } .fila .sub { color: var(--suave); font-size: .875rem; overflow-wrap: anywhere; }
.rejilla { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0 0 12px; }
.baldosa { background: var(--papel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 12px 8px; text-align: center; text-decoration: none; color: var(--texto); min-height: 92px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px; cursor: pointer; font: inherit; }
.baldosa b.icono { font-size: 1.8rem; font-weight: 400; line-height: 1.1; } .baldosa .num { font-size: 1.5rem; font-weight: 700; }
.baldosa.principal { background: var(--azul); color: #fff; border-color: var(--azul); } .baldosa.principal .sub { color: #dbe8f5; }
.etiqueta { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.etiqueta.verde { background: var(--verde-f); color: var(--verde); } .etiqueta.amarillo { background: var(--amarillo-f); color: var(--amarillo); } .etiqueta.naranja { background: var(--naranja-f); color: var(--naranja); }
.etiqueta.rojo { background: var(--rojo-f); color: var(--rojo); } .etiqueta.gris { background: var(--gris-f); color: var(--gris); }
.punto { color: var(--azul-2); font-size: .8rem; }
.semaforo { border-left: 8px solid var(--gris); } .semaforo.verde { border-color: var(--verde); } .semaforo.amarillo, .semaforo.ambar { border-color: #e6b800; } .semaforo.rojo { border-color: var(--rojo); }
.dato-grande { font-size: 2rem; font-weight: 800; line-height: 1.1; }
.buscar { position: sticky; top: 52px; z-index: 5; background: var(--fondo); padding: 6px 0 4px; }
.cabecera-vista { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; } .cabecera-vista h2 { flex: 1; margin: 0; }
.vacio { text-align: center; color: var(--suave); padding: 28px 12px; }

/* tabla tipo Excel */
.envoltura-tabla { overflow: auto; max-height: 70vh; border: 1px solid var(--borde); border-radius: var(--radio); background: var(--papel); }
table.rejilla-datos { border-collapse: collapse; font-size: .875rem; min-width: 100%; }
table.rejilla-datos th, table.rejilla-datos td { border: 1px solid var(--linea); padding: 6px 8px; text-align: left; white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
table.rejilla-datos th { position: sticky; top: 0; background: var(--azul); color: #fff; z-index: 1; } table.rejilla-datos th.calc { background: #6b7782; }
table.rejilla-datos tbody tr { cursor: pointer; } table.rejilla-datos tbody tr:nth-child(even) { background: #f7f9fb; } table.rejilla-datos td.num { text-align: right; }

/* hoja inferior (ventana) */
.fondo { position: fixed; inset: 0; z-index: 50; background: rgba(15,25,35,.55); display: flex; align-items: flex-end; justify-content: center; }
.hoja { background: var(--papel); width: 100%; max-width: 640px; max-height: 92dvh; overflow: auto; border-radius: 16px 16px 0 0; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); }
.hoja > h2 { margin-bottom: 10px; }
@media (min-width: 700px) { .fondo { align-items: center; } .hoja { border-radius: 16px; } }
.aviso-flotante { position: fixed; left: 12px; right: 12px; bottom: 76px; z-index: 60; background: #1d2733; color: #fff; padding: 12px 14px; border-radius: var(--radio); text-align: center; }
.aviso-flotante.mal { background: var(--rojo); }

/* revisión (bien / mal / no aplica) */
.punto-revision { background: var(--papel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 10px; margin: 0 0 8px; } .punto-revision .texto { margin-bottom: 6px; overflow-wrap: anywhere; }
.punto-revision.mal { border-color: var(--rojo); background: #fff8f7; }
.tres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; } .tres .chip { justify-content: center; padding: 0 4px; }
.firma-lienzo { width: 100%; height: 160px; border: 1.5px dashed var(--borde); border-radius: var(--radio); background: #fff; touch-action: none; display: block; }
.miniaturas { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; } .miniaturas img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--borde); }
.barras { display: flex; align-items: flex-end; gap: 4px; height: 120px; margin: 8px 0 2px; } .barras div { flex: 1; background: var(--azul-2); min-height: 2px; position: relative; }
.rotulos-barras { display: flex; gap: 4px; font-size: .7rem; color: var(--suave); text-align: center; } .rotulos-barras span { flex: 1; }
.pestanas { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; } .pestanas .chip { flex: none; }
.solo-imprimir { display: none; }

/* pantalla de entrada */
.entrada { max-width: 420px; margin: 0 auto; padding: 28px 16px; width: 100%; } .entrada .logo { text-align: center; margin-bottom: 14px; } .entrada .logo img { width: 84px; height: 84px; }
.papelito { border: 2px dashed #555; border-radius: 8px; padding: 12px; margin: 0 0 10px; break-inside: avoid; page-break-inside: avoid; } .papelito .codigo { font: 700 1.6rem/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 2px; margin: 8px 0; }

@media (min-width: 900px) { .rejilla { grid-template-columns: repeat(4, 1fr); } .contenido { padding-bottom: 96px; } }
@media print {
  .barra, .menu, .no-imprimir, .aviso-flotante, .fondo { display: none !important; }
  body { background: #fff; font-size: 11pt; } .contenido { max-width: none; padding: 0; } .solo-imprimir { display: block; }
  .tarjeta, .punto-revision, .fila { break-inside: avoid; border-color: #888; } .chip { min-height: 28px; } .chip:not(.sel) { display: none; } .chip.sel { background: #fff !important; color: #000 !important; border: 1.5px solid #000; }
  input, textarea, select { border: 0; border-bottom: 1px solid #888; border-radius: 0; background: #fff; min-height: 24px; }
  /* papelitos: solo ellos salen en el papel, dos por fila para recortarlos */
  body.imprime-solo > #app { display: none !important; }
  .solo-imprimir.papeles { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px; }
  .solo-imprimir.papeles .papelito .codigo { font-size: 1.3rem; }
}

/* grupos plegables (formularios, ayuda): se abren y cierran sin animación */
details.grupo { background: var(--papel); border: 1px solid var(--borde); border-radius: var(--radio); margin: 0 0 10px; padding: 0 10px 2px; }
details.grupo > summary { display: flex; align-items: center; gap: 8px; min-height: var(--alto); cursor: pointer; list-style: none; }
details.grupo > summary::-webkit-details-marker { display: none; }
details.grupo > summary::after { content: '▾'; margin-left: auto; color: var(--suave); }
details.grupo[open] > summary::after { content: '▴'; }
details.grupo > div { padding-bottom: 4px; }
