/* ── Header sticky ── */
.app-header { position: sticky; top: 0; z-index: 10; }
.app-header h1 { font-size: 1.1rem; font-weight: 700; }

/* ── Tabs ── */
.tab-content { padding: 1.2rem 1rem 5rem; max-width: 560px; margin: 0 auto; }

/* ── Formulario — tarjetas de sección ── */
.form-card {
  background: white; border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
  margin-bottom: .9rem;
}
.form-card-header {
  padding: .95rem 1.1rem .6rem;
  font-size: .92rem; font-weight: 800; color: var(--azul);
  display: flex; align-items: center; gap: .4rem;
  border-bottom: 1.5px solid #f0f4f8;
}
.form-card-opc {
  margin-left: auto; font-size: .75rem; font-weight: 500;
  color: var(--suave);
}
.form-card-hint {
  font-size: .85rem; color: var(--suave); padding: .55rem 1.1rem 0;
  line-height: 1.45;
}
.form-card-body { padding: .8rem 1.1rem 1.1rem; }
.form-card-body .field-group:last-child,
.form-card-body .field-group.last { margin-bottom: 0; }
.form-card-body > .field-group:first-child { margin-top: 0; }
.form-card-warn .form-card-header { color: #e65100; border-bottom-color: #ffe0cc; }
.form-card-warn { box-shadow: 0 1px 4px rgba(230,81,0,.1); }

/* ── Formulario — campos ── */
.field-group { margin-bottom: 1.1rem; }
.field-group.mb0 { margin-bottom: 0; }
.mb0 { margin-bottom: 0 !important; }
.field-group label {
  display: block; font-size: 1rem; font-weight: 700;
  color: var(--texto); margin-bottom: .55rem;
}
.field-group .opc { color: var(--suave); font-weight: 400; margin-left: .3rem; font-size: .83rem; }

input[type="number"], input[type="text"] {
  width: 100%; border: 2px solid var(--borde); border-radius: 10px;
  padding: .9rem 1rem; font-size: 1rem; color: var(--texto);
  font-family: inherit; outline: none; transition: border-color .2s, box-shadow .2s;
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }
input[type="number"]:focus, input[type="text"]:focus {
  border-color: var(--azul2);
  box-shadow: 0 0 0 3px rgba(41,121,255,.15);
}

select {
  width: 100%; border: 2px solid var(--borde); border-radius: 10px;
  padding: .9rem 1rem; font-size: 1rem; color: var(--texto);
  font-family: inherit; outline: none; background: white;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7a8d' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 1rem center;
  transition: border-color .2s, box-shadow .2s; cursor: pointer;
}
select:focus {
  border-color: var(--azul2);
  box-shadow: 0 0 0 3px rgba(41,121,255,.15);
}

/* ── Foto zone ── */
.foto-zone {
  border: 2.5px dashed var(--borde); border-radius: 12px;
  padding: 1.3rem; text-align: center;
  transition: border-color .2s, background .2s; background: #f8fafc;
}
.foto-zone.drag-over { border-color: var(--azul2); background: #e8f0fe; }
.foto-btns { display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; margin-bottom: .6rem; }
.btn-foto {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .85rem 1.4rem; border-radius: 10px; font-size: 1rem;
  font-weight: 700; cursor: pointer; border: none;
  position: relative; overflow: hidden; transition: background .2s;
  min-height: 48px;
}
.btn-foto input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.btn-camara  { background: var(--azul2); color: white; }
.btn-camara:active  { background: #1565c0; }
.btn-galeria { background: #eceff1; color: #37474f; }
.btn-galeria:active { background: #cfd8dc; }
.foto-preview { width: 100%; max-height: 240px; object-fit: cover; border-radius: 10px; margin-top: .9rem; }
.foto-nombre  { font-size: .82rem; color: var(--suave); margin-top: .4rem; }

/* ── Botones de opción (reemplaza sliders) ── */
.opt-question { margin-bottom: 1.1rem; }
.opt-question.last { margin-bottom: 0; }
.opt-label { font-size: .92rem; font-weight: 700; color: var(--texto); margin-bottom: .55rem; }
.opt-row { display: flex; gap: .4rem; }
.opt-btn {
  flex: 1; padding: .65rem .2rem; border: 2px solid #dde3ea;
  border-radius: 10px; background: white; font-size: .88rem;
  font-weight: 600; color: #78909c; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  text-align: center; line-height: 1.2;
}
.opt-btn:active { transform: scale(.95); }
.opt-btn.active {
  border-color: var(--azul2); background: var(--azul2); color: white;
}

.checkbox-group { display: flex; flex-wrap: wrap; gap: .5rem; }
.checkbox-opt {
  display: flex; align-items: center; gap: .45rem;
  padding: .55rem .85rem; border: 2px solid #dde3ea;
  border-radius: 10px; background: white; font-size: .88rem;
  font-weight: 600; color: #78909c; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.checkbox-opt:has(input:checked) {
  border-color: var(--azul2); background: var(--azul2); color: white;
}
.checkbox-opt input { display: none; }

/* mantener compatibilidad si algo usa section-label */
.section-label {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .07em;
  color: #90a4ae; font-weight: 700; margin-bottom: 1rem;
}

textarea {
  width: 100%; border: 2px solid var(--borde); border-radius: 10px;
  padding: .9rem 1rem; font-size: 1rem; color: var(--texto);
  resize: vertical; min-height: 90px; font-family: inherit;
  outline: none; transition: border-color .2s, box-shadow .2s;
}
textarea:focus {
  border-color: var(--azul2);
  box-shadow: 0 0 0 3px rgba(41,121,255,.15);
}

/* ── Botón enviar ── */
.btn-primary {
  width: 100%; padding: .9rem; background: var(--azul);
  color: white; border: none; border-radius: 10px;
  font-size: 1rem; font-weight: 700; cursor: pointer;
  letter-spacing: .02em; transition: background .2s, transform .1s;
}
.btn-primary:active { transform: scale(.98); }
.btn-enviar {
  width: 100%; padding: 1.1rem; background: var(--azul);
  color: white; border: none; border-radius: 14px;
  font-size: 1.1rem; font-weight: 700; cursor: pointer;
  letter-spacing: .02em; transition: background .2s, transform .1s;
  box-shadow: 0 4px 14px rgba(26,58,92,.3); margin-top: .4rem;
}
.btn-enviar:active  { transform: scale(.97); background: #0d2a47; }
.btn-enviar:disabled { opacity: .6; cursor: not-allowed; box-shadow: none; }

/* ── Cards de lista ── */
.carga-card {
  background: white; border-radius: 16px;
  box-shadow: 0 2px 14px rgba(0,0,0,.09);
  margin-bottom: 1.1rem; overflow: hidden;
  border: 1px solid rgba(0,0,0,.05);
}
.card-foto-wrap { position: relative; }
.card-foto {
  width: 100%; height: 185px; object-fit: cover; display: block;
  background: #eceff1; cursor: zoom-in;
}
.card-foto-badge {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,.52); color: white;
  border-radius: 20px; padding: .18rem .55rem;
  font-size: .75rem; font-weight: 700;
}
.card-foto-num {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.58));
  padding: 1.5rem .9rem .55rem;
  color: white; font-size: 1rem; font-weight: 800;
}
.card-body { padding: 1rem 1rem .9rem; }
.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: .7rem; }
.card-territorio { font-size: 1rem; font-weight: 700; color: var(--azul); }
.card-fecha {
  font-size: .72rem; color: var(--suave);
  background: #f0f4f8; padding: .18rem .55rem; border-radius: 20px;
}
.card-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .75rem; }
.card-tag {
  font-size: .73rem; border-radius: 20px; padding: .22rem .65rem;
  font-weight: 600; border: 1px solid;
}
.tag-terreno  { background: #e8f5e9; color: #2e7d32; border-color: #a5d6a7; }
.tag-vehiculo { background: #e3f2fd; color: #1565c0; border-color: #90caf9; }
.tag-pub      { background: #fff8e1; color: #6d4c00; border-color: #ffe082; }
.ratings { display: flex; gap: .5rem; margin-bottom: .75rem; }
.rating-item {
  flex: 1; background: #f8fafc; border-radius: 10px;
  padding: .5rem .4rem .55rem; text-align: center;
  border: 1px solid #eceff1;
}
.rating-label { font-size: .62rem; color: var(--suave); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .35rem; }
.rating-val {
  display: inline-block; width: 40px; height: 40px; line-height: 40px;
  border-radius: 50%; font-weight: 800; font-size: 1.05rem; color: white;
}
.obs-text {
  font-size: .84rem; color: #546e7a; background: #f8fafc;
  border-radius: 8px; padding: .6rem .75rem; margin-bottom: .6rem;
  border-left: 3px solid #cfd8dc; line-height: 1.5;
}
.obs-text--vol {
  border-left-color: #90caf9;
  background: #eef6ff;
}
.card-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .4rem;
  margin-bottom: .75rem;
}
.card-kpi {
  border: 1px solid #e7edf3;
  background: #f8fbff;
  border-radius: 10px;
  padding: .4rem .45rem;
  text-align: center;
}
.card-kpi-label {
  display: block;
  font-size: .62rem;
  color: #78909c;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.card-kpi strong {
  display: block;
  margin-top: .2rem;
  font-size: .82rem;
  color: #1a3a5c;
}
.card-actions { display: flex; gap: .5rem; margin-top: .75rem; align-items: flex-start; }
.btn-detalle {
  flex: 1;
  padding: .65rem .5rem;
  background: #e8f0fe;
  color: #0d47a1;
  border: none;
  border-radius: 10px;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s;
}
.btn-detalle:hover { background: #d6e5ff; }
.btn-editar {
  flex: 1; padding: .65rem .5rem;
  background: #f0f4f8; color: var(--azul); border: none;
  border-radius: 10px; font-size: .88rem; font-weight: 700;
  cursor: pointer; transition: background .2s;
}
.btn-editar:hover  { background: #dde3ea; }
.btn-editar:active { background: #cfd8dc; }
.btn-eliminar {
  flex: 1;
  padding: .65rem .5rem;
  background: #fce4ec;
  color: #b71c1c;
  border: none;
  border-radius: 10px;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s;
}
.btn-eliminar:hover  { background: #f8bbd0; }
.btn-eliminar:active { background: #f48fb1; }
.card-nv-group { flex: 1.3; }

/* ── Audio ── */
.audio-zona { border: 2px solid var(--borde); border-radius: 12px; padding: 1rem; background: #fafafa; }
.audio-lista { display: flex; flex-direction: column; gap: .55rem; margin-bottom: .8rem; }
.audio-lista:empty { display: none; }
.audio-item {
  display: flex; align-items: center; gap: .5rem;
  background: white; border: 1px solid #eceff1; border-radius: 10px; padding: .5rem .75rem;
}
.audio-item audio { flex: 1; min-width: 0; height: 40px; }
.audio-item .audio-label { font-size: .8rem; color: var(--suave); white-space: nowrap; }
.btn-quitar-audio {
  flex-shrink: 0; background: #fce4ec; color: #c62828; border: none;
  border-radius: 8px; padding: .4rem .65rem; font-size: .85rem;
  cursor: pointer; transition: background .2s; font-weight: 600; white-space: nowrap;
}
.btn-quitar-audio:active { background: #f8bbd0; }
.audio-controles { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; }
.btn-grabar {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .75rem 1.2rem; background: #e53935; color: white;
  border: none; border-radius: 10px; font-size: .95rem; font-weight: 700;
  cursor: pointer; transition: background .2s; min-height: 48px;
}
.btn-grabar:active { background: #b71c1c; }
.btn-audio-subir {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .75rem 1.2rem; background: #eceff1; color: #37474f;
  border-radius: 10px; font-size: .95rem; font-weight: 700;
  cursor: pointer; transition: background .2s; position: relative; overflow: hidden; min-height: 48px;
}
.btn-audio-subir:active { background: #cfd8dc; }
.btn-audio-subir input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.audio-grabando { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.rec-dot-wrap { display: flex; align-items: center; gap: .4rem; color: #e53935; font-weight: 700; font-size: .95rem; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #e53935; animation: blink 1s ease-in-out infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .15; } }
.rec-timer { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--texto); }
.btn-detener {
  padding: .65rem 1.1rem; background: #37474f; color: white;
  border: none; border-radius: 10px; font-size: .95rem; font-weight: 700;
  cursor: pointer; transition: background .2s; min-height: 48px;
}
.btn-detener:active { background: #263238; }
.card-audio { width: 100%; margin-top: .5rem; height: 36px; border-radius: 6px; display: block; }

/* ── No Visitar ── */
.nv-toggle {
  width: 100%; padding: .65rem .6rem;
  background: #fff3e0; color: #e65100; border: 2px solid #ffcc80;
  border-radius: 10px; font-size: .88rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  transition: background .2s;
}
.nv-toggle:active { background: #ffe0b2; }
.nv-toggle.open   { background: #fff8e1; border-color: #ffb74d; border-radius: 10px 10px 0 0; }
.nv-count-pill {
  background: #e65100; color: white; border-radius: 20px;
  padding: .1rem .55rem; font-size: .8rem; font-weight: 700;
}
.nv-panel {
  background: #fffde7; border: 2px solid #ffcc80;
  border-top: none; border-radius: 0 0 10px 10px;
  padding: .7rem .9rem;
}
.nv-row {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .6rem 0; border-bottom: 1px solid #fff9c4;
}
.nv-row:last-of-type { border-bottom: none; }
.nv-row-info { flex: 1; min-width: 0; }
.nv-row-dir { font-size: .95rem; font-weight: 700; word-break: break-word; }
.nv-row-mot { font-size: .82rem; color: var(--suave); margin-top: .15rem; }
.nv-del {
  flex-shrink: 0; background: #fce4ec; border: none; color: #c62828;
  font-size: 1.1rem; cursor: pointer; padding: .35rem .55rem; border-radius: 8px;
  transition: background .15s; min-height: 40px;
}
.nv-del:active { background: #f8bbd0; }
.nv-add-row { display: flex; gap: .5rem; margin-top: .8rem; flex-wrap: wrap; }
.nv-add-row input {
  flex: 1; min-width: 120px; border: 2px solid var(--borde); border-radius: 9px;
  padding: .75rem .9rem; font-size: .95rem; font-family: inherit;
  outline: none; background: white; transition: border-color .2s;
}
.nv-add-row input:focus { border-color: var(--azul2); }
.nv-btn-add {
  padding: .75rem 1.1rem; background: var(--azul); color: white;
  border: none; border-radius: 9px; font-size: .95rem; font-weight: 700;
  cursor: pointer; white-space: nowrap; min-height: 48px;
}
.nv-btn-add:active { background: #0d2a47; }
.nv-empty-msg { font-size: .88rem; color: var(--suave); text-align: center; padding: .7rem 0; }
.nv-form-section { background: #fff8f0; border: 2px solid #ffe0b2; border-radius: 10px; padding: .8rem; }
.nv-form-loading  { font-size: .88rem; color: var(--suave); text-align: center; padding: .5rem 0; }

/* ── Grid de fotos múltiples ── */
.fotos-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin-bottom: .6rem; }
.fotos-grid:empty { display: none; }
.foto-wrap { position: relative; border-radius: 8px; overflow: hidden; aspect-ratio: 1; }
.foto-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.btn-del-foto {
  position: absolute; top: 3px; right: 3px;
  background: rgba(0,0,0,.55); color: white; border: none; border-radius: 50%;
  width: 26px; height: 26px; font-size: .75rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.btn-del-foto:active { background: rgba(198,40,40,.85); }

/* ── Botones agregar fotos ── */
.foto-add-btns { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .5rem; }
.btn-foto-add {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .75rem 1.2rem; border-radius: 10px; font-size: .95rem; font-weight: 700;
  cursor: pointer; border: none; position: relative; overflow: hidden; min-height: 48px;
}
.btn-foto-add input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.btn-foto-add-cam  { background: var(--azul2); color: white; }
.btn-foto-add-gal { background: #eceff1; color: #37474f; }

/* ── Modal de recorte ── */
.crop-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.85);
  z-index: 1000; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 1rem;
}
.crop-modal-container { width: 100%; max-width: 480px; }
.crop-canvas-wrap { width: 100%; height: 60vw; max-height: 360px; background: #000; border-radius: 10px; overflow: hidden; }
.crop-canvas-wrap img { display: block; max-width: 100%; }
.crop-modal-btns { display: flex; gap: .7rem; margin-top: .9rem; justify-content: center; }
.btn-crop-ok {
  flex: 1; padding: .85rem; background: var(--azul2); color: white;
  border: none; border-radius: 10px; font-size: 1rem; font-weight: 700; cursor: pointer;
}
.btn-crop-cancel {
  flex: 1; padding: .85rem; background: #eceff1; color: #37474f;
  border: none; border-radius: 10px; font-size: 1rem; font-weight: 700; cursor: pointer;
}

/* ── Lista topbar ── */
.lista-topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.lista-count {
  font-size: .85rem; color: var(--suave); font-weight: 600;
}
.btn-nueva-carga {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .6rem 1.1rem; background: var(--azul); color: white;
  border: none; border-radius: 10px; font-size: .95rem; font-weight: 700;
  cursor: pointer; box-shadow: 0 2px 8px rgba(26,58,92,.25);
  transition: background .2s;
}
.btn-nueva-carga:active { background: #0d2a47; }

/* ── Form back button ── */
.form-back {
  display: inline-flex; align-items: center; gap: .3rem;
  margin-bottom: .85rem; padding: .45rem .7rem;
  background: none; border: none; color: var(--azul);
  font-size: .92rem; font-weight: 700; cursor: pointer;
  border-radius: 8px; transition: background .15s;
}
.form-back:hover  { background: rgba(41,121,255,.08); }
.form-back:active { background: rgba(41,121,255,.15); }

/* ── Modal detalle territorio ── */
.modal-box-territorio {
  max-width: 760px;
  max-height: 88vh;
  overflow-y: auto;
}
.modal-territorio-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .6rem;
  margin-bottom: .9rem;
}
.modal-territorio-fecha {
  font-size: .78rem;
  color: #607d8b;
  background: #f1f5f9;
  border-radius: 999px;
  padding: .2rem .55rem;
  white-space: nowrap;
}
.modal-audios {
  margin-top: .9rem;
  padding-top: .8rem;
  border-top: 1px solid #e2e8f0;
  display: grid;
  gap: .5rem;
}
.modal-audios audio {
  width: 100%;
}

@media (max-width: 720px) {
  .card-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-actions {
    flex-wrap: wrap;
  }

  .card-nv-group {
    flex-basis: 100%;
  }

  .modal-territorio-head {
    flex-direction: column;
  }
}
