/* Latina Pizza · Fotos del cierre de caja
   La administradora agrega fotos de los reportes; el dueño las revisa al lado de las cifras.
   El visor es oscuro para que el tiquete fotografiado sea lo único que brilla. */

/* ---------- Formulario: fotos de respaldo ---------- */
.cf-tipos { display: grid; }
.cf-tipo { padding: 14px 0; border-top: 1px solid var(--line-2); }
.cf-tipo:first-child { border-top: 0; padding-top: 2px; }
.cf-tipo:last-child { padding-bottom: 0; }
.cf-etq { font-weight: 650; }
.cf-tipo .ayuda { margin: 0 0 10px; }
.cf-tira { display: flex; flex-wrap: wrap; gap: 10px; }
.cf-celda { position: relative; width: 76px; height: 76px; }
.cf-foto, .cf-agregar {
  width: 100%; height: 100%; border-radius: var(--r-s); padding: 0; cursor: pointer;
  display: grid; place-items: center; overflow: hidden; position: relative;
}
.cf-foto { border: 1px solid var(--line); background: var(--line-2); cursor: zoom-in; }
.cf-foto img { width: 100%; height: 100%; object-fit: cover; display: block; grid-area: 1 / 1; }
.cf-agregar {
  width: 76px; height: 76px; border: 1.5px dashed color-mix(in srgb, var(--basil) 45%, var(--line));
  background: var(--basil-weak); color: var(--basil-txt);
  align-content: center; gap: 2px; font-weight: 600; font-size: 0.8125rem;
}
.cf-agregar:hover { border-style: solid; }
.cf-ico { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.cf-quitar {
  position: absolute; top: -9px; right: -9px; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--paper); background: var(--ink); color: var(--paper);
  font-size: 1rem; line-height: 1; display: grid; place-items: center; cursor: pointer; padding: 0;
}
.cf-quitar::before { content: ''; position: absolute; inset: -9px; }   /* más fácil de tocar */
.cf-quitar:hover { background: var(--tomato); }
.cf-subiendo .cf-foto { cursor: progress; }
.cf-subiendo .cf-foto img { opacity: 0.45; }
.cf-giro {
  grid-area: 1 / 1; width: 24px; height: 24px; border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--basil) 25%, transparent); border-top-color: var(--basil);
  animation: cf-girar 0.8s linear infinite;
}
@keyframes cf-girar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .cf-giro { animation-duration: 2.4s; } }
.cf-error .cf-foto { border-color: var(--tomato); cursor: pointer; }
.cf-reintentar {
  grid-area: 1 / 1; align-self: stretch; justify-self: stretch; display: grid; place-items: center;
  background: color-mix(in srgb, var(--tomato) 86%, transparent); color: #fff; font-size: 0.75rem; font-weight: 700;
}
.cf-falta { margin-top: 10px; padding: 6px 10px; border-radius: var(--r-s); background: var(--crust-weak); color: var(--crust-txt); font-size: 0.875rem; font-weight: 600; }
.cf-falta-bloquea { background: var(--tomato-weak); color: var(--tomato); }
.cf-obligatoria { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--basil-weak); color: var(--basil-txt); font-size: 0.75rem; font-weight: 700; vertical-align: 2px; }
/* En la cinta: cuántas fotos obligatorias faltan */
.cuadre-fotos { width: 100%; border: 0; background: none; padding: 2px 0 8px; margin: 0; font: inherit; cursor: pointer; text-align: left; }
.cuadre-fotos strong { color: var(--ok-txt); }
.cuadre-fotos.faltan strong { color: var(--tomato); }
.cierre-form[inert] .cf-quitar, .cierre-form[inert] .cf-agregar { display: none; }

/* ---------- Lista de cierres ---------- */
.tabla .cen { text-align: center; }
.cr-fotos { display: inline-flex; align-items: center; gap: 4px; font-weight: 650; color: var(--basil-txt); font-variant-numeric: tabular-nums; }
.cr-ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.tabla-cierres td:last-child { white-space: nowrap; }

/* ---------- Revisión de un cierre ---------- */
.revision {
  width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; padding: 0; border: 0;
  background: var(--flour); color: var(--ink);
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.revision[open] { display: grid; }
.revision::backdrop { background: rgba(13, 16, 34, 0.55); }
.rv-cab {
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--paper); border-bottom: 1px solid var(--line-2);
}
.rv-titulos { flex: 1; min-width: 0; }
.rv-titulos h2 { font-family: var(--serif); font-size: 1.3rem; color: var(--titulo); }
.rv-titulos p { color: var(--ink-2); font-size: 0.9375rem; }
.rv-cuerpo { overflow: auto; padding: 16px; display: grid; gap: 18px; align-content: start; overscroll-behavior: contain; }
.rv-cargando, .rv-vacio { padding: 18px; }
.rv-vacio { border: 1.5px dashed var(--line); border-radius: var(--r); color: var(--ink-2); text-align: center; background: var(--paper); }
.rv-sec { font-size: 0.8125rem; font-weight: 700; color: var(--ink-3); margin: 14px 0 4px; }
.rv-sec:first-child { margin-top: 0; }

/* El cierre como tiquete de caja, igual que la cinta del formulario */
.rv-tiquete {
  background: var(--paper); padding: 22px 18px 18px; border-radius: 0 0 var(--r) var(--r); box-shadow: var(--sombra);
  --diente: 7px;
  -webkit-mask: conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / calc(2 * var(--diente)) var(--diente) repeat-x,
                linear-gradient(#000 0 0) 0 var(--diente) / 100% 100% no-repeat;
          mask: conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / calc(2 * var(--diente)) var(--diente) repeat-x,
                linear-gradient(#000 0 0) 0 var(--diente) / 100% 100% no-repeat;
}
.rv-linea { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; min-height: 40px; color: var(--ink-2); }
.rv-linea .rv-monto { color: var(--ink); text-align: right; min-width: 6.5em; }
.rv-monto { font-variant-numeric: tabular-nums; white-space: nowrap; }
.rv-fuerte { color: var(--ink); font-weight: 700; border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 4px; }
.rv-fuerte .rv-monto { font-size: 1.125rem; font-weight: 800; font-stretch: 110%; }
.rv-ver {
  display: inline-flex; align-items: center; gap: 5px; min-height: 34px; padding: 4px 12px 4px 9px;
  border-radius: 999px; border: 0; background: var(--basil); color: #fff;
  font-weight: 650; font-size: 0.8125rem; cursor: zoom-in; white-space: nowrap;
}
.rv-ver:hover { background: var(--basil-2); }
.rv-ico { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linejoin: round; }
.rv-sin { padding: 3px 10px; border-radius: 999px; background: var(--crust-weak); color: var(--crust-txt); font-size: 0.8125rem; font-weight: 650; white-space: nowrap; }
.rv-salidas { list-style: none; margin: 0 0 4px; padding: 0 0 0 12px; border-left: 2px solid var(--line-2); display: grid; gap: 4px; }
.rv-salidas li { display: flex; justify-content: space-between; gap: 12px; font-size: 0.875rem; color: var(--ink-2); }
.rv-salidas small { display: block; color: var(--ink-3); }
.rv-resultado { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.rv-resultado span { font-weight: 700; font-size: 1.0625rem; }
.rv-resultado strong { font-size: 1.9rem; font-weight: 800; font-stretch: 118%; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rv-resultado.cuadra { color: var(--ok-txt); }
.rv-resultado.falta { color: var(--tomato); }
.rv-resultado.sobra { color: var(--crust-txt); }
.rv-nota { margin-top: 14px; padding: 10px 12px; border-radius: var(--r-s); background: var(--flour); }
.rv-nota p:last-child { white-space: pre-line; }

/* Las fotos, agrupadas por lo que respaldan */
.rv-fotos { display: grid; gap: 16px; align-content: start; }
.rv-falta { padding: 10px 12px; border-radius: var(--r-s); background: var(--crust-weak); color: var(--crust-txt); font-weight: 600; font-size: 0.9375rem; }
.rv-grupo { background: var(--paper); border-radius: var(--r); padding: 14px; box-shadow: var(--sombra); display: grid; gap: 10px; }
.rv-grupo-cab { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; }
.rv-grupo-cab h3 { font-size: 1rem; font-weight: 700; }
.rv-grupo-cab p { color: var(--ink-2); font-size: 0.875rem; }
.rv-grupo-cab strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.rv-minis { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.rv-mini {
  aspect-ratio: 3 / 4; padding: 0; border: 1px solid var(--line); border-radius: var(--r-s); overflow: hidden;
  background: var(--line-2); cursor: zoom-in; display: grid; place-items: center;
}
.rv-mini img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.2s; }
.rv-mini:hover img { transform: scale(1.03); }
.rv-mini-error { padding: 8px; font-size: 0.8125rem; color: var(--ink-3); }

.rv-pie {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: var(--paper); border-top: 1px solid var(--line-2);
}
.rv-quien { flex: 1 1 100%; color: var(--ink-3); font-size: 0.875rem; }
.rv-pie .btn { flex: 1 1 0; }
.rv-pie a.btn { text-decoration: none; color: var(--ink); }
.rv-pie .btn-primario { flex-grow: 2; }
@media (min-width: 900px) {
  .revision { width: min(1120px, 94vw); height: min(92vh, 940px); margin: auto; border-radius: var(--r); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35); }
  .rv-cab { padding: 16px 16px 16px 24px; }
  .rv-cuerpo { grid-template-columns: 380px minmax(0, 1fr); gap: 24px; padding: 20px 24px; align-items: start; }
  .rv-tiquete { position: sticky; top: 0; }
  .rv-minis { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .rv-pie { padding: 12px 24px; flex-wrap: nowrap; }
  .rv-quien { flex: 1 1 auto; }
  .rv-pie .btn { flex: none; }
}

/* ---------- Visor de fotos ---------- */
.visor {
  width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; padding: 0; border: 0;
  background: #0A0C1A; color: #fff; grid-template-rows: auto minmax(0, 1fr); overflow: hidden;
}
.visor[open] { display: grid; }
.visor::backdrop { background: #0A0C1A; }
.visor-barra {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  padding: 8px 8px 10px 16px; padding-top: max(8px, env(safe-area-inset-top));
  background: rgba(255, 255, 255, 0.05); border-bottom: 1px solid rgba(255, 255, 255, 0.08); z-index: 2;
}
.visor-textos { flex: 1 1 calc(100% - 64px); min-width: 0; order: 1; }
.visor-cerrar { order: 2; width: 44px; height: 44px; border: 0; background: none; color: #fff; font-size: 1.9rem; line-height: 1; cursor: pointer; border-radius: var(--r-s); }
.visor-cerrar:hover { background: rgba(255, 255, 255, 0.1); }
.visor-cuenta { order: 3; color: rgba(255, 255, 255, 0.7); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.visor-btn { order: 4; margin-left: auto; min-height: 38px; padding: 6px 14px; border-radius: var(--r-s); border: 1px solid rgba(255, 255, 255, 0.35); background: none; color: #fff; font-weight: 600; cursor: pointer; }
.visor-btn[aria-pressed="true"] { background: #fff; color: #0A0C1A; border-color: #fff; }
.visor-titulo { font-family: var(--serif); font-size: 1.05rem; font-weight: 700; color: #fff; }
.visor-detalle { color: rgba(255, 255, 255, 0.78); font-size: 0.9375rem; margin-top: 2px; }
.visor-detalle strong {
  display: inline-block; color: #fff; font-size: 1.2rem; font-weight: 800; font-stretch: 112%; font-variant-numeric: tabular-nums;
  padding: 0 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.12); box-shadow: inset 0 -2px 0 var(--rojo);
}
.visor-marco { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 12px; touch-action: pinch-zoom; min-height: 0; }
.visor-img { min-width: 0; min-height: 0; max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; cursor: zoom-in; user-select: none; -webkit-user-select: none; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
.visor.ampliada .visor-marco { display: block; overflow: auto; touch-action: auto; padding: 0; }
.visor.ampliada .visor-img { display: block; margin: 0 auto; max-width: none; max-height: none; cursor: zoom-out; border-radius: 0; box-shadow: none; }
.visor.ampliada .visor-nav { display: none; }
.visor-nota { position: absolute; left: 0; right: 0; top: 50%; text-align: center; color: rgba(255, 255, 255, 0.7); pointer-events: none; }
.visor-nav {
  position: absolute; top: 55%; transform: translateY(-50%); z-index: 3;
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: rgba(10, 12, 26, 0.6); border: 1px solid rgba(255, 255, 255, 0.25); color: #fff;
}
.visor-nav:hover { background: rgba(10, 12, 26, 0.85); }
.visor-nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.visor-ant { left: 10px; }
.visor-sig { right: 10px; }
.visor :focus-visible { outline-color: rgba(255, 255, 255, 0.85); }
@media (min-width: 700px) {
  .visor-barra { flex-wrap: nowrap; padding-left: 20px; }
  .visor-textos { flex: 1 1 auto; order: 0; }
  .visor-cuenta, .visor-btn { order: 0; }
  .visor-btn { margin-left: 0; }
  .visor-cerrar { order: 1; }
  .visor-marco { padding: 20px 76px; }
  .visor-ant { left: 16px; }
  .visor-sig { right: 16px; }
}

/* ---------- Avisos breves encima de las ventanas abiertas ----------
   util.js muestra la zona de avisos como "popover" (así queda por encima de una ventana modal).
   Se quitan los estilos que el navegador le pone a un popover; la posición sigue siendo la de app.css. */
#avisos { right: auto; margin: 0; padding: 0; border: 0; background: none; overflow: visible; color: inherit; }
@media (min-width: 761px) { #avisos { top: auto; } }

/* ---------- Pagos: la foto de la factura (Efectivo y Gastos) ---------- */
.mov-det .mov-fotos { display: inline-flex; align-items: center; gap: 4px; color: var(--basil-txt); font-weight: 600; }
.mov-ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.mov-ver { cursor: zoom-in; }
.ef-fotos .cf-tira { margin-top: 2px; }
.ef-fotos .cf-falta { margin-bottom: 0; }
.gs-fotos { display: flex; width: fit-content; margin-top: 4px; padding: 6px 0; min-height: 0; border: 0; background: none; font: inherit; font-size: 0.8125rem; cursor: zoom-in; }
.gs-fotos:hover { text-decoration: underline; }

/* El local no abrió ese día */
.registro-sin-abrir { display: grid; gap: 4px; background: var(--line-2); color: var(--ink-2); }
.registro-sin-abrir p { margin: 0; }
.registro-sin-abrir .btn-texto, .registro-nota .btn-texto { justify-self: start; padding: 2px 0; }
.registro-nota { padding: 4px 0; color: var(--ink-3); font-size: 0.875rem; }
.registro-bloqueado .btn { margin-top: 8px; }
/* Dueños: mover o borrar un cierre */
.rv-mas { position: relative; }
.rv-mas > summary { list-style: none; cursor: pointer; }
.rv-mas > summary::-webkit-details-marker { display: none; }
.rv-mas-lista { position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 5; display: grid; gap: 2px; min-width: 15rem; padding: 8px 12px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sombra); }
.rv-mas-lista .btn-texto { justify-self: start; text-align: left; padding: 8px 0; }
.rv-mas { flex: 0 0 auto; }
