/* ============================================================
   OMEJ v2 — Hoja de estilo unificada, mobile-first
   ============================================================ */

* { box-sizing: border-box; }

:root {
  --bg: #f2f4f7;
  --surface: #ffffff;
  --primary: #173a5e;
  --primary-light: #1769aa;
  --green: #2e7d32;
  --green-bg: #e8f5e9;
  --green-border: #81c784;
  --orange: #ef6c00;
  --orange-bg: #fff8e1;
  --orange-border: #ffcc80;
  --gray: #607d8b;
  --gray-bg: #eeeeee;
  --gray-border: #757575;
  --red: #c62828;
  --red-bg: #ffe5e5;
  --warn: #d39a00;
  --warn-bg: #fff4cf;
  --text: #202124;
  --text-muted: #687078;
  --border: #ddd;
  --radius: 8px;
  --shadow: 0 1px 5px rgba(0,0,0,.07);
  --max-width: 1300px;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ============================================================
   HEADER
   ============================================================ */

header {
  background: var(--primary);
  color: white;
  padding: 10px 12px;
}

.header-inner {
  max-width: var(--max-width);
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.header-brand h1 {
  margin: 0;
  font-size: 21px;
}

.header-sub {
  font-size: 11px;
  opacity: .85;
}

.header-nav {
  display: flex;
  gap: 5px;
}

.header-nav a {
  color: white;
  text-decoration: none;
  background: rgba(255,255,255,.15);
  padding: 7px 9px;
  border-radius: 6px;
  font-size: 12px;
}

/* ============================================================
   LAYOUT
   ============================================================ */

.container {
  max-width: var(--max-width);
  margin: 10px auto;
  padding: 0 8px;
}

.panel {
  background: var(--surface);
  padding: 11px;
  margin-bottom: 9px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ============================================================
   FORMULARIO DE BÚSQUEDA
   ============================================================ */

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}

.search-field {
  flex: 1;
  min-width: 260px;
}

.field-label {
  display: block;
  font-weight: bold;
  margin-bottom: 4px;
  font-size: 13px;
}

.search-row {
  display: flex;
  gap: 6px;
}

.search-row input[type=text] {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 10px;
  border: 1px solid #b8bec5;
  border-radius: 7px;
  font-size: 18px;
}

.search-hint {
  color: var(--text-muted);
  font-size: 10px;
  margin-top: 4px;
}

.corralones {
  display: flex;
  gap: 5px;
}

.check {
  padding: 7px 9px;
  background: #eef1f4;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: background .15s;
}

.check.checked {
  background: var(--primary-light);
  color: white;
}

.check input[type=checkbox] {
  margin: 0;
}

/* ============================================================
   BOTONES
   ============================================================ */

.btn {
  border: 0;
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 13px;
  background: var(--primary-light);
  color: white;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.btn-clear {
  background: var(--gray);
  white-space: nowrap;
}

.btn-search {
  padding: 10px 20px;
  font-size: 14px;
  flex: 0 0 auto;
}

.btn-small {
  padding: 6px 10px;
  font-size: 11px;
  white-space: nowrap;
}

.btn-green {
  background: var(--green);
}

.btn-orange {
  background: var(--orange);
}

.btn-photos {
  background: var(--gray);
  width: 100%;
  padding: 12px;
  font-size: 14px;
}

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

/* ============================================================
   ALERTAS
   ============================================================ */

.alert {
  padding: 9px;
  margin-bottom: 8px;
  border-radius: 5px;
  font-size: 13px;
}

.alert-error {
  background: var(--red-bg);
  border-left: 4px solid var(--red);
}

.alert-success {
  background: var(--green-bg);
  border-left: 4px solid var(--green);
}

.alert-warn {
  background: var(--warn-bg);
  border-left: 4px solid var(--warn);
}

/* ============================================================
   INDICADOR DE BÚSQUEDA
   ============================================================ */

.searching-indicator {
  text-align: center;
  padding: 14px;
  font-size: 15px;
  font-weight: bold;
  color: var(--primary-light);
  background: #e3f2fd;
  border-radius: var(--radius);
  margin-bottom: 9px;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

/* ============================================================
   RESULTADOS COMPACTOS
   ============================================================ */

.results-info {
  font-size: 11px;
  margin-bottom: 7px;
  padding: 7px;
  background: #e3f2fd;
  border-radius: 5px;
}

.result-card {
  padding: 10px;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
}

.result-id {
  font-size: 15px;
  font-weight: bold;
}

.result-corralon {
  background: var(--primary);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

.result-sep {
  color: var(--text-muted);
  margin: 0 2px;
}

.result-entrada {
  color: var(--text);
}

.result-invent {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.result-vin {
  font-size: 11px;
  color: var(--text-muted);
  font-family: monospace;
  margin-bottom: 5px;
}

.result-status {
  padding: 7px 9px;
  border-radius: 7px;
  border-left: 5px solid var(--warn);
  background: var(--orange-bg);
  font-size: 15px;
  font-weight: bold;
  margin-bottom: 5px;
}

.status-found {
  background: var(--green-bg);
  border-left-color: var(--green);
  color: var(--green);
}

.status-pending {
  background: var(--orange-bg);
  border-left-color: var(--warn);
  color: #9a5b00;
}

.status-none {
  background: var(--gray-bg);
  border-left-color: var(--gray-border);
  color: #424242;
}

.status-icon {
  font-size: 18px;
}

.result-listas {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 7px;
  border-radius: 15px;
  font-size: 10px;
  border: 1px solid var(--border);
  background: white;
}

.badge-found {
  background: var(--green-bg);
  border-color: var(--green-border);
  color: #1b5e20;
}

.badge-pending {
  background: var(--orange-bg);
  border-color: var(--orange-border);
  color: #9a5b00;
}

/* ============================================================
   DETALLE DE VEHÍCULO
   ============================================================ */

.back-link {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--primary-light);
  text-decoration: none;
  font-size: 13px;
}

.status-block {
  padding: 9px;
  margin-bottom: 7px;
  border-radius: 7px;
  border-left: 5px solid var(--warn);
  background: var(--orange-bg);
}

.status-block.status-found {
  background: var(--green-bg);
  border-left-color: var(--green);
}

.status-block.status-none {
  background: var(--gray-bg);
  border-left-color: var(--gray-border);
}

.status-label {
  text-transform: uppercase;
  font-size: 9px;
  color: #616161;
  margin-bottom: 2px;
}

.status-big {
  font-size: 19px;
  font-weight: bold;
  line-height: 1.1;
}

.status-found .status-big { color: #1b5e20; }
.status-none .status-big { color: #424242; }

.badges-row {
  margin-top: 6px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.datos-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 8px;
}

.dato {
  background: #f4f6f8;
  border-radius: 6px;
  padding: 6px;
}

.dato-wide {
  grid-column: span 2;
}

.dato-label {
  text-transform: uppercase;
  font-size: 8px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.dato-value {
  font-size: 12px;
  font-weight: bold;
  overflow-wrap: anywhere;
}

.actions-block {
  margin-top: 8px;
}

.alt-card {
  margin-top: 8px;
  box-shadow: none;
  border: 1px solid var(--border);
}

.muted {
  color: var(--text-muted);
  font-size: 13px;
}

/* ============================================================
   GALERÍA DE FOTOGRAFÍAS
   ============================================================ */

.fotos-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.fotos-title {
  font-size: 15px;
  font-weight: bold;
  color: var(--primary);
}

.fotos-count {
  font-size: 11px;
  color: var(--text-muted);
}

.fotos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px;
}

.foto-thumb {
  cursor: pointer;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 4 / 3;
  background: #f4f6f8;
  transition: transform .15s, box-shadow .15s;
}

.foto-thumb:hover {
  transform: scale(1.03);
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

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

.fotos-empty {
  color: var(--text-muted);
  font-size: 13px;
  padding: 14px;
  text-align: center;
  background: var(--gray-bg);
  border-radius: 6px;
}

/* ============================================================
   LIGHTBOX
   ============================================================ */

.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,.88);
}

.lightbox img {
  position: relative;
  z-index: 1;
  max-width: 90%;
  max-height: 85%;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
}

.lightbox-nav {
  position: absolute;
  z-index: 2;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.15);
  border: none;
  color: white;
  font-size: 28px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}

.lightbox-nav:hover {
  background: rgba(255,255,255,.3);
}

.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

.lightbox-close {
  position: absolute;
  z-index: 2;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,.15);
  border: none;
  color: white;
  font-size: 32px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}

.lightbox-close:hover {
  background: rgba(255,255,255,.3);
}

/* ============================================================
   RESPONSIVE — MÓVIL
   ============================================================ */

@media (max-width: 900px) {
  .datos-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .contadores-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .contador-total {
    grid-column: span 3;
  }
}

@media (max-width: 600px) {
  header { padding: 7px 8px; }
  .header-inner { flex-wrap: wrap; gap: 4px; }
  .header-brand h1 { font-size: 18px; }
  .header-sub { display: none; }
  .header-nav a { padding: 5px 7px; font-size: 11px; }
  .container { margin-top: 6px; padding: 0 5px; }
  .panel { padding: 8px; margin-bottom: 6px; }
  .search-field { min-width: 100%; }
  .search-form { gap: 5px; }
  .search-row { flex-wrap: wrap; }
  .search-row input[type=text] { font-size: 16px; padding: 9px; min-width: 0; flex: 1 1 200px; }
  .btn-clear { padding: 8px 9px; flex: 0 0 auto; }
  .corralones { gap: 3px; }
  .check { padding: 5px 7px; font-size: 11px; }
  .btn-search { padding: 7px 11px; width: 100%; }
  .result-header { margin-bottom: 4px; flex-wrap: wrap; gap: 4px; }
  .result-id { font-size: 14px; }
  .result-status { font-size: 14px; padding: 6px 7px; }
  .result-listas { gap: 3px; }
  .result-listas .badge { font-size: 9px; padding: 3px 5px; }
  .result-listas form { display: inline; }
  .result-listas .btn-small { font-size: 10px; padding: 4px 7px; }
  .datos-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }
  .dato { padding: 5px; }
  .dato-wide { grid-column: span 2; }
  .dato-label { font-size: 7px; }
  .dato-value { font-size: 11px; }
  .status-big { font-size: 17px; }
  .status-block { padding: 7px; margin-bottom: 5px; }
  .btn-photos { padding: 14px; font-size: 15px; }
  .fotos-grid {
    grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
    gap: 4px;
  }
  .lightbox-nav { width: 36px; height: 36px; font-size: 20px; }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
  .lightbox-close { width: 36px; height: 36px; font-size: 26px; top: 8px; right: 8px; }
}

@media (max-width: 380px) {
  .header-brand h1 { font-size: 16px; }
  .header-nav { width: 100%; justify-content: space-around; }
  .header-nav a { flex: 1; text-align: center; font-size: 10px; padding: 5px 4px; }
  .datos-grid { grid-template-columns: 1fr; }
  .dato-wide { grid-column: span 1; }
  .contadores-grid { grid-template-columns: 1fr; }
  .contador-total { grid-column: span 1; }
  .contador-num { font-size: 20px; }
}

/* ============================================================
   FASE 3 — LISTAS
   ============================================================ */

.listas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.listas-header h2 {
  margin: 0;
  font-size: 18px;
}

.lista-card {
  padding: 11px;
}

.lista-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
}

.lista-card-info {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lista-card-nombre {
  font-size: 15px;
  font-weight: bold;
}

.lista-card-meta {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.lista-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.lista-card-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.lista-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-field input[type=text] {
  width: 100%;
  padding: 9px;
  border: 1px solid #b8bec5;
  border-radius: 7px;
  font-size: 15px;
}

.form-field input[type=file] {
  font-size: 13px;
}

.lista-detalle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.lista-detalle-header h2 {
  margin: 0;
  font-size: 18px;
}

.lista-detalle-actions {
  display: flex;
  gap: 5px;
}

.lista-filtros {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}

.filtro-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 110px;
}

.filtro-group input,
.filtro-group select {
  padding: 7px;
  border: 1px solid #b8bec5;
  border-radius: 6px;
  font-size: 13px;
}

.filtro-actions {
  display: flex;
  gap: 4px;
  align-items: flex-end;
}

.lista-table-wrap {
  overflow-x: auto;
}

.lista-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.lista-table th {
  text-align: left;
  padding: 7px 8px;
  border-bottom: 2px solid var(--border);
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.lista-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
}

.lista-row {
  cursor: pointer;
  transition: background .12s;
}

.lista-row:hover {
  background: #f0f4f8;
}

.vin-cell {
  font-family: monospace;
  font-size: 11px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-actions {
  white-space: nowrap;
}

.btn-fotos {
  background: var(--gray);
  font-size: 10px;
  padding: 4px 8px;
}

.paginacion {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
}

.pag-info {
  font-size: 13px;
  color: var(--text-muted);
}

/* Validación */
.validacion-resumen {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.val-stat {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: bold;
}

.val-total { background: var(--gray-bg); color: var(--text); }
.val-validos { background: var(--green-bg); color: var(--green); }
.val-noenc { background: var(--orange-bg); color: #9a5b00; }
.val-dup { background: var(--warn-bg); color: var(--warn); }
.val-invalidos { background: var(--red-bg); color: var(--red); }

/* ============================================================
   MODALES (Fase 3)
   ============================================================ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,.6);
}

.modal-content {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 600px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
}

.modal-fotos-content {
  max-width: 700px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 26px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 14px;
}

.modal-listas {
  margin-top: 10px;
}

.modal-fotos-principal {
  position: relative;
  text-align: center;
  margin-bottom: 10px;
}

.modal-fotos-principal .lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}

.modal-fotos-principal #fotoPrev { left: 4px; }
.modal-fotos-principal #fotoNext { right: 4px; }

.modal-fotos-thumbs {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: center;
}

.modal-foto-thumb {
  width: 60px;
  height: 45px;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .15s;
}

.modal-foto-thumb.selected {
  border-color: var(--primary-light);
}

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

@media (max-width: 900px) {
  .lista-filtros {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .filtro-group {
    min-width: 100%;
  }
  .filtro-group input,
  .filtro-group select {
    width: 100%;
    font-size: 14px;
    padding: 8px;
  }
  .filtro-actions {
    flex-wrap: wrap;
    gap: 4px;
  }
  .filtro-actions .btn-small {
    flex: 1 1 auto;
    text-align: center;
    font-size: 12px;
    padding: 8px 10px;
  }
  .lista-detalle-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .lista-detalle-actions {
    width: 100%;
  }
  .lista-detalle-actions .btn-small {
    flex: 1;
    text-align: center;
  }
  .lista-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .lista-card-meta {
    flex-wrap: wrap;
    gap: 4px;
  }
  .lista-card-actions {
    gap: 4px;
  }
  .lista-card-actions .btn-small {
    flex: 1 1 auto;
    text-align: center;
    font-size: 11px;
  }
  .validacion-resumen {
    gap: 4px;
  }
  .val-stat {
    flex: 1 1 auto;
    text-align: center;
    font-size: 11px;
    padding: 5px 8px;
  }
}

@media (max-width: 600px) {
  .lista-table { font-size: 11px; }
  .lista-table th { padding: 5px 4px; }
  .lista-table td { padding: 5px 4px; }
  .lista-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .row-actions {
    white-space: normal;
  }
  .row-actions form {
    flex-wrap: wrap;
    gap: 2px !important;
  }
  .estado-select {
    font-size: 10px;
    padding: 3px;
    max-width: 90px;
  }
  .row-actions .btn-small {
    font-size: 10px;
    padding: 4px 6px;
  }
  .btn-fotos {
    font-size: 9px;
    padding: 3px 6px;
  }
  .badge {
    font-size: 9px;
    padding: 3px 5px;
  }
  .badge-salida {
    font-size: 8px;
  }
  .paginacion {
    gap: 4px;
  }
  .paginacion .btn-small {
    padding: 8px 14px;
    font-size: 13px;
  }
  .pag-info { font-size: 12px; }
  .modal-content { width: 95%; }
  .modal-header h3 { font-size: 14px; }
  .modal-body { padding: 10px; }
  .modal-foto-thumb { width: 48px; height: 36px; }
}

@media (max-width: 380px) {
  .lista-card-nombre { font-size: 13px; }
  .lista-detalle-header h2 { font-size: 16px; }
  .lista-table { font-size: 10px; }
  .lista-table th, .lista-table td { padding: 4px 2px; }
  .vin-cell { max-width: 80px; font-size: 10px; }
  .filtro-actions .btn-small { font-size: 11px; padding: 7px 8px; }
  .paginacion .btn-small { padding: 7px 10px; font-size: 12px; }
}

/* ============================================================
   FASE 3+ — COLORES DE FILAS POR ESTADO DERIVADO
   ============================================================ */

.row-salida {
  background: var(--red-bg) !important;
}

.row-encontrado {
  background: var(--green-bg) !important;
}

.row-pendiente {
  background: var(--orange-bg) !important;
}

.row-no-localizado {
  background: var(--gray-bg) !important;
}

.row-salida:hover {
  background: #ffd0d0 !important;
}

.row-encontrado:hover {
  background: #d4edda !important;
}

.row-pendiente:hover {
  background: #fff3d0 !important;
}

.row-no-localizado:hover {
  background: #e2e2e2 !important;
}

.badge-salida {
  background: var(--red-bg);
  border-color: var(--red);
  color: var(--red);
  font-weight: bold;
}

.badge-neutro {
  background: #eceff1;
  border: 1px solid #607d8b;
  color: #455a64;
}

.status-salida {
  background: var(--red-bg);
  border-left-color: var(--red);
  color: var(--red);
}

.status-block.status-salida {
  background: var(--red-bg);
  border-left-color: var(--red);
}

.status-block.status-salida .status-big {
  color: var(--red);
}

.estado-select {
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
}

/* ============================================================
   INFORMACIÓN AMPLIADA (PostgreSQL)
   ============================================================ */

.pg-grupo {
  margin-bottom: 10px;
}

.pg-grupo-titulo {
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
}

/* ============================================================
   CONTADORES POR ESTADO
   ============================================================ */

.contadores-panel {
  padding: 12px;
}

.contadores-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.contadores-titulo {
  font-size: 13px;
  font-weight: bold;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.contadores-filtro-corralon {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contadores-filtro-corralon select {
  padding: 6px 10px;
  border: 1px solid #b8bec5;
  border-radius: 6px;
  font-size: 13px;
  min-width: 140px;
}

.contadores-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.contador-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: transform .15s, box-shadow .15s;
}

.contador-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 10px rgba(0,0,0,.08);
}

.contador-num {
  font-size: 28px;
  font-weight: bold;
  line-height: 1;
  margin-bottom: 4px;
}

.contador-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
}

.contador-encontrados {
  background: var(--green-bg);
  border-color: var(--green-border);
}
.contador-encontrados .contador-num { color: var(--green); }

.contador-salida {
  background: var(--red-bg);
  border-color: var(--red);
}
.contador-salida .contador-num { color: var(--red); }

.contador-pendientes {
  background: var(--orange-bg);
  border-color: var(--orange-border);
}
.contador-pendientes .contador-num { color: #9a5b00; }

.contador-no-localizados {
  background: var(--gray-bg);
  border-color: var(--gray-border);
}
.contador-no-localizados .contador-num { color: #455a64; }

.contador-total {
  background: #e3f2fd;
  border-color: var(--primary-light);
}
.contador-total .contador-num { color: var(--primary); }

.contador-card.contador-loading .contador-num {
  opacity: .4;
  animation: pulse 1s infinite;
}

@media (max-width: 900px) {
  .contadores-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .contador-total {
    grid-column: span 3;
  }
  .contador-num { font-size: 24px; }
  .contadores-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .contadores-filtro-corralon select {
    min-width: 100%;
  }
}

@media (max-width: 600px) {
  .contadores-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .contador-total {
    grid-column: span 2;
  }
  .contador-num { font-size: 22px; }
  .contador-label { font-size: 9px; }
  .contador-card { padding: 10px 4px; }
  .contadores-panel { padding: 8px; }
}

@media (max-width: 380px) {
  .contadores-grid {
    grid-template-columns: 1fr;
  }
  .contador-total {
    grid-column: span 1;
  }
  .contador-num { font-size: 20px; }
}

/* ============================================================
   LISTAS EN PANTALLAS PEQUEÑAS
   ============================================================ */

@media (max-width: 700px) {
  .lista-table-panel {
    padding: 6px;
  }

  .lista-table-panel .lista-table-wrap {
    overflow: visible;
  }

  .lista-table-panel .lista-table,
  .lista-table-panel .lista-table thead,
  .lista-table-panel .lista-table tbody,
  .lista-table-panel .lista-table tr,
  .lista-table-panel .lista-table td {
    display: block;
  }

  .lista-table-panel .lista-table thead {
    display: none;
  }

  .lista-table-panel .lista-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 12px;
    margin-bottom: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
  }

  .lista-table-panel .lista-table td {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 6px;
    align-items: start;
    min-width: 0;
    padding: 5px 0;
    border: 0;
    overflow-wrap: anywhere;
  }

  .lista-table-panel .lista-table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 9px;
    font-weight: bold;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: .2px;
  }

  .lista-table-panel .lista-table td[data-label="Estado"],
  .lista-table-panel .lista-table td[data-label="Acciones"] {
    grid-column: 1 / -1;
  }

  .lista-table-panel .lista-table td[data-label="Estado"] .badge {
    justify-self: start;
    max-width: 100%;
    white-space: normal;
    text-align: left;
  }

  .lista-table-panel .lista-table td[data-label="Acciones"] {
    display: block;
    padding-top: 8px;
    margin-top: 4px;
    border-top: 1px solid var(--border);
  }

  .lista-table-panel .lista-table td[data-label="Acciones"]::before {
    display: block;
    margin-bottom: 5px;
  }

  .lista-table-panel .row-actions form {
    display: flex !important;
    width: 100%;
    flex-wrap: wrap;
    gap: 5px !important;
    align-items: center !important;
  }

  .lista-table-panel .row-actions form .estado-select {
    flex: 1 1 125px;
    max-width: none;
    min-width: 0;
    padding: 7px 6px;
    font-size: 12px;
  }

  .lista-table-panel .row-actions .btn-small {
    min-height: 32px;
    padding: 7px 10px;
    font-size: 11px;
  }

  .lista-table-panel .row-actions > .btn-fotos {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 5px;
    min-height: 32px;
  }

  .lista-table-panel .vin-cell {
    max-width: none;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    font-size: 11px;
    line-height: 1.35;
  }
}

@media (max-width: 380px) {
  .lista-table-panel .lista-table tr {
    padding: 7px 8px;
  }

  .lista-table-panel .lista-table td {
    grid-template-columns: 65px minmax(0, 1fr);
    gap: 5px;
  }

  .lista-table-panel .lista-table td::before {
    font-size: 8px;
  }
}

/* ============================================================
   INICIO DE SESIÓN Y USUARIOS
   ============================================================ */

.header-nav {
  flex-wrap: wrap;
  align-items: center;
}

.header-salir {
  color: white;
  background: rgba(0,0,0,.25);
  border: 0;
  padding: 7px 9px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

.form-inline {
  display: inline;
  margin: 0;
}

.auth-panel {
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.form-field input[type=password],
.form-field select {
  width: 100%;
  padding: 9px;
  border: 1px solid #b8bec5;
  border-radius: 7px;
  font-size: 15px;
  background: white;
}

.btn-danger {
  background: var(--red);
}

.acciones-celda {
  white-space: nowrap;
}
