* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #f4f4f6;
  color: #1a1a1a;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
}

/* La especificidad de .container (display:flex) empataría con la regla
   [hidden] del navegador; se fuerza explícitamente para que ocultar una
   vista funcione siempre. */
.view[hidden] {
  display: none !important;
}

/* GOAL 02: mismo problema que arriba, mismo arreglo, pero GENERAL — un
   elemento con `display: flex` (o cualquier otro `display` propio) puede
   pisar la regla nativa `[hidden] { display: none }` del navegador
   porque la hoja de estilos del autor tiene prioridad sobre la del
   navegador aunque la especificidad empate. Se descubrió con
   `#acta-preview-wrapper` (display: flex) al ocultarlo para mostrar el
   aviso de PDF en su lugar — quedaba con la casilla de foto vacía
   visible en vez de ocultarse. Esta regla cubre CUALQUIER elemento
   oculto con el atributo `hidden`, no solo los ya conocidos. */
[hidden] {
  display: none !important;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.top-bar-view {
  justify-content: space-between;
}

.view-title {
  font-size: 1.3rem;
  margin: 0;
}

.btn-back {
  background: none;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1d4ed8;
  cursor: pointer;
  padding: 0.4rem 0;
}

.home-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.btn-home {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 1.5rem 1rem;
  border: none;
  border-radius: 0.8rem;
  cursor: pointer;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
}

.btn-home:active {
  opacity: 0.85;
}

.btn-home-actas {
  background: #1d4ed8;
}

.btn-home-incidencias {
  background: #b45309;
}

.btn-home-carga {
  background: #6d28d9;
}

.btn-home-pendientes {
  background: #334155;
}

.btn-home-title {
  font-size: 1.3rem;
  font-weight: 700;
}

.btn-home-subtitle {
  font-size: 0.85rem;
  opacity: 0.9;
}

.stats-row {
  display: flex;
  gap: 0.75rem;
}

.stat-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 0.6rem;
  padding: 0.75rem;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
}

.stat-label {
  font-size: 0.75rem;
  color: #666;
}

.fotos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

.foto-thumb-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.foto-size {
  margin: 0;
  font-size: 0.68rem;
  color: #666;
  text-align: center;
}

.foto-thumb {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid #ddd;
  border-radius: 0.5rem;
  overflow: hidden;
  background: #fff;
}

.foto-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.foto-thumb .foto-remove {
  position: absolute;
  top: 0.2rem;
  right: 0.2rem;
  width: 1.6rem;
  height: 1.6rem;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
}

h1 {
  text-align: center;
  margin: 0;
  font-size: 1.8rem;
  letter-spacing: 0.03em;
}

.subtitle {
  text-align: center;
  margin: 0 0 1rem;
  color: #555;
}

.conn-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}

.conn-badge.online {
  background: #dcfce7;
  color: #166534;
}

.conn-badge.offline {
  background: #ffedd5;
  color: #9a3412;
}

.conn-badge.syncing {
  background: #dbeafe;
  color: #1e40af;
}

.conn-badge.servererror {
  background: #fee2e2;
  color: #991b1b;
}

.banner-offline {
  /* GOAL 02 (ampliación): a propósito NO es `position: fixed` — un
     overlay flotante terminaba tapando controles del formulario (botón
     Guardar, campos) e impidiendo interactuar con ellos. Vive dentro del
     flujo normal del documento (insertado justo debajo del top-bar de la
     vista activa por `actualizarBannerOfflineTranscripcion()`), así que
     solo empuja el contenido hacia abajo, nunca lo cubre. */
  background: #fff7ed;
  border: 2px solid #f59e0b;
  border-radius: 0.6rem;
  padding: 0.9rem 1rem;
}

.banner-offline p {
  margin: 0.25rem 0;
  font-size: 0.85rem;
  color: #7c2d12;
}

.banner-offline-titulo {
  font-weight: 700;
  font-size: 0.95rem !important;
}

.banner-offline button {
  margin-top: 0.6rem;
  width: 100%;
}

.btn {
  display: block;
  width: 100%;
  padding: 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  border: none;
  border-radius: 0.6rem;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: #1d4ed8;
  color: #fff;
}

.btn-success {
  background: #15803d;
  color: #fff;
}

.btn-danger {
  background: #b91c1c;
  color: #fff;
}

.btn-share {
  background: #0f766e;
  color: #fff;
}

.btn:active {
  opacity: 0.85;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 0.6rem;
  padding: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #333;
}

.field input,
.field select {
  padding: 0.7rem 0.6rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 0.4rem;
  background: #fff;
  color: #1a1a1a;
}

.field input:disabled,
.field select:disabled {
  background: #f0f0f0;
  color: #888;
}

.field-hint {
  margin: 0;
  font-size: 0.78rem;
  color: #777;
  min-height: 1rem;
}

.field-hint.found {
  color: #166534;
}

.field-hint.new {
  color: #9a3412;
}

.inline-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: #fef9ec;
  border: 1px dashed #d4a017;
  border-radius: 0.5rem;
  padding: 0.75rem;
}

.inline-form input {
  padding: 0.6rem;
  font-size: 0.95rem;
  border: 1px solid #ccc;
  border-radius: 0.4rem;
}

.inline-form-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-mini {
  flex: 1;
  padding: 0.55rem;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid #ccc;
  border-radius: 0.4rem;
  background: #fff;
  cursor: pointer;
}

.btn-mini-primary {
  background: #1d4ed8;
  color: #fff;
  border-color: #1d4ed8;
}

.btn-mini-danger {
  background: #b91c1c;
  color: #fff;
  border-color: #b91c1c;
}

.admin-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.admin-links a.btn-mini {
  flex: none;
  text-decoration: none;
  text-align: center;
  color: #1d4ed8;
}

.votos-section {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 0.6rem;
  padding: 1rem;
}

.votos-section h2 {
  font-size: 1rem;
  margin: 0 0 0.75rem;
}

.votos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.votos-grid input {
  width: 100%;
  padding: 0.8rem 0.6rem;
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  border: 1px solid #ccc;
  border-radius: 0.4rem;
}

.carga-fotos-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.carga-foto-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 0.5rem;
  padding: 0.5rem;
}

.carga-foto-row img {
  width: 3.2rem;
  height: 3.2rem;
  object-fit: cover;
  border-radius: 0.4rem;
  flex-shrink: 0;
}

.carga-foto-icono-pdf {
  width: 3.2rem;
  height: 3.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: #f3f4f6;
  border-radius: 0.4rem;
  flex-shrink: 0;
}

.carga-foto-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex-shrink: 0;
  width: 7rem;
}

.carga-foto-nombre {
  font-size: 0.72rem;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.carga-foto-row .carga-foto-size {
  font-size: 0.68rem;
  color: #666;
}

.pendiente-pdf-link {
  display: inline-block;
  padding: 0.5rem 0.8rem;
  background: #eef2ff;
  color: #3730a3;
  border-radius: 0.4rem;
  text-decoration: none;
  font-size: 0.85rem;
}

.carga-foto-row select {
  flex: 1;
  padding: 0.55rem;
  font-size: 0.9rem;
  border: 1px solid #ccc;
  border-radius: 0.4rem;
}

.carga-foto-row .foto-remove {
  position: static;
  flex-shrink: 0;
  width: 1.8rem;
  height: 1.8rem;
  border: none;
  border-radius: 999px;
  background: #b91c1c;
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
}

.lote-progreso {
  margin: 0.3rem 0;
  font-size: 0.8rem;
}

.lote-progreso-header {
  font-weight: 600;
  margin: 0 0 0.2rem;
}

.lote-progreso-item {
  margin: 0;
  color: #444;
}

.corrob-resumen {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.corrob-resumen p {
  margin: 0;
}

.corrob-votos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem 1rem;
  margin: 0.4rem 0;
}

.corrob-votos-grid span.corrob-organizacion {
  font-weight: 600;
}

.corrob-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.preview-wrapper {
  width: 100%;
  max-height: 55vh;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 2px dashed #ccc;
  border-radius: 0.6rem;
  overflow: hidden;
  background: #fff;
}

.preview-wrapper img {
  display: block;
  width: 100%;
  max-height: 55vh;
  height: auto;
  object-fit: contain;
}

.size-info {
  text-align: center;
  margin: 0;
  font-size: 0.85rem;
  color: #555;
}

.progress-wrapper {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.progress-track {
  flex: 1;
  height: 0.6rem;
  background: #e2e2e6;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: #1d4ed8;
  transition: width 0.15s ease-out;
}

.progress-text {
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 2.8rem;
  text-align: right;
}

.status {
  text-align: center;
  font-weight: 600;
  min-height: 1.4rem;
  margin: 0;
}

.status.ok {
  color: #15803d;
}

.status.error {
  color: #b91c1c;
}

.status.pending {
  color: #444;
}

.pending-section {
  margin-top: 0.5rem;
  border-top: 1px solid #ddd;
  padding-top: 1rem;
}

.pending-section h2 {
  font-size: 1rem;
  margin: 0 0 0.6rem;
}

.pending-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.pending-item {
  border: 1px solid #ddd;
  border-radius: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pending-item .pending-meta {
  font-size: 0.8rem;
  color: #555;
}

.pending-item .pending-status {
  font-size: 0.85rem;
  font-weight: 600;
}

.pending-item .pending-status-evidencia {
  font-size: 0.75rem;
  font-weight: 500;
  color: #78716c;
}

.pending-item .btn-retry {
  padding: 0.45rem 0.9rem;
  font-size: 0.9rem;
  border: none;
  border-radius: 0.4rem;
  background: #b45309;
  color: #fff;
  cursor: pointer;
}

.pending-item .btn-retry:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pending-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pending-actions .btn-mini {
  flex: initial;
}

.pendiente-foto-preview-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.pendiente-foto-preview {
  max-width: 6rem;
  max-height: 6rem;
  object-fit: cover;
  border-radius: 0.4rem;
  border: 1px solid #ddd;
}

.pending-empty {
  color: #777;
  font-size: 0.85rem;
  margin: 0;
}

/* ---------------- GOAL 03: OCR local, carga masiva, ADMINISTRACIÓN ---------------- */

/* Valor PROPUESTO por el OCR: hay que verificarlo, no está validado. */
.campo-propuesto-ocr {
  border: 2px solid #2563eb !important;
  background: #eff6ff;
}

/* No se pudo leer de forma confiable: PENDIENTE DE VERIFICACIÓN. */
.campo-pendiente-ocr {
  border: 2px dashed #d97706 !important;
  background: #fffbeb;
}

.pista-ocr {
  color: #92400e;
  margin-top: -0.25rem;
}

.revision-ocr {
  border: 2px solid #2563eb;
  border-radius: 0.5rem;
  padding: 0.75rem;
  background: #eff6ff;
}

.check-label {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  font-weight: 600;
}

.muestra-panel {
  border: 1px solid #c7d2fe;
  border-radius: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: #f5f7ff;
}

.muestra-panel h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.lote-item[data-estado-extraccion="ERROR"] {
  border-color: #fca5a5;
}

.lote-item[data-estado-extraccion="VALIDADA"] {
  border-color: #86efac;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.admin-nav h2 {
  width: 100%;
  margin: 0;
  font-size: 1.05rem;
}

.admin-nav a.btn-mini {
  flex: none;
  text-decoration: none;
  color: #1d4ed8;
}

.tabla-scroll {
  overflow-x: auto;
}

.tabla-import {
  border-collapse: collapse;
  font-size: 0.78rem;
  width: 100%;
}

.tabla-import th,
.tabla-import td {
  border: 1px solid #ddd;
  padding: 0.25rem 0.35rem;
  vertical-align: top;
  text-align: left;
}

.tabla-import .fila-nuevo {
  background: #f0fdf4;
}

.tabla-import .fila-actualizacion {
  background: #eff6ff;
}

.tabla-import .fila-duplicado,
.tabla-import .fila-error {
  background: #fef2f2;
}
