/* Incidentes — Grupo Lada · sistema visual cálido (crema / terracota / salvia) */

:root {
  --crema: #f6f1e8;
  --papel: #fffdf9;
  --tinta: #2a2622;
  --tinta-suave: #6f665a;
  --linea: #e6dccd;
  --terracota: #bf4d2e;
  --terracota-osc: #9c3c22;
  --salvia: #6f7f5e;
  --ambar: #c98a1c;
  --rojo: #8e2323;
  --azul: #3d5a80;
  --radio: 14px;
  --sombra: 0 1px 2px rgba(42, 38, 34, .05), 0 10px 28px rgba(42, 38, 34, .08);
  --fuente-ui: 'Inter', -apple-system, system-ui, sans-serif;
  --fuente-titulo: 'Fraunces', Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--fuente-ui);
  font-size: 15px;
  line-height: 1.55;
  color: var(--tinta);
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(191, 77, 46, .06), transparent 60%),
    var(--crema);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--terracota-osc); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 {
  font-family: var(--fuente-titulo);
  font-weight: 600;
  font-size: 1.9rem;
  letter-spacing: -.01em;
  line-height: 1.2;
}

h2 { font-family: var(--fuente-titulo); font-weight: 600; }

/* ── Cabecera ─────────────────────────────────────────────── */

.cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .8rem clamp(1rem, 4vw, 2.4rem);
  background: rgba(255, 253, 249, .92);
  border-bottom: 1px solid var(--linea);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 1100;
}

.marca { display: flex; align-items: center; gap: .7rem; }
.marca:hover { text-decoration: none; }
.marca-logo svg { display: block; border-radius: 9px; box-shadow: 0 2px 6px rgba(156, 60, 34, .35); }
.marca-texto { display: flex; flex-direction: column; line-height: 1.15; }
.marca-texto strong { font-family: var(--fuente-titulo); font-size: 1.06rem; color: var(--tinta); }
.marca-texto small { color: var(--tinta-suave); font-size: .74rem; letter-spacing: .02em; }

.nav { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.nav > a:not(.boton) {
  padding: .42rem .8rem;
  border-radius: 999px;
  color: var(--tinta-suave);
  font-weight: 500;
  font-size: .92rem;
}
.nav > a:not(.boton):hover { background: rgba(191, 77, 46, .08); color: var(--tinta); text-decoration: none; }
.nav > a.activo { background: rgba(191, 77, 46, .12); color: var(--terracota-osc); font-weight: 600; }
.nav-nuevo { margin-left: .35rem; }
.nav-usuario {
  margin-left: .6rem;
  padding: .3rem .75rem;
  background: rgba(111, 127, 94, .14);
  color: #4c5a3f;
  border-radius: 999px;
  font-weight: 600;
  font-size: .85rem;
}
.nav-salir { font-size: .85rem; }

/* ── Estructura ───────────────────────────────────────────── */

.contenido {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: clamp(1.2rem, 3vw, 2rem) clamp(1rem, 4vw, 2.4rem) 3rem;
  flex: 1;
}

.pie {
  text-align: center;
  padding: 1.2rem;
  color: var(--tinta-suave);
  font-size: .8rem;
  border-top: 1px solid var(--linea);
  background: rgba(255, 253, 249, .6);
}

.fila-titulo {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
}

.sutil { color: var(--tinta-suave); font-size: .92rem; margin-top: .25rem; }
.acciones { display: flex; gap: .55rem; align-items: center; }
.migaja { display: inline-block; margin-bottom: .8rem; font-size: .88rem; color: var(--tinta-suave); }

/* ── Botones ──────────────────────────────────────────────── */

.boton {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .52rem 1.05rem;
  border-radius: 999px;
  border: 1px solid var(--linea);
  background: var(--papel);
  color: var(--tinta);
  font-family: var(--fuente-ui);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .06s ease, box-shadow .15s ease, background .15s ease;
  white-space: nowrap;
}
.boton:hover { text-decoration: none; box-shadow: var(--sombra); transform: translateY(-1px); }
.boton:active { transform: translateY(0); }

.boton-primario {
  background: var(--terracota);
  border-color: var(--terracota);
  color: #fffdf9;
  box-shadow: 0 3px 10px rgba(156, 60, 34, .3);
}
.boton-primario:hover { background: var(--terracota-osc); }

.boton-peligro { color: var(--rojo); border-color: rgba(142, 35, 35, .3); }
.boton-peligro:hover { background: rgba(142, 35, 35, .07); }

.boton-bloque { width: 100%; justify-content: center; padding: .7rem; font-size: 1rem; }

/* ── Tarjetas ─────────────────────────────────────────────── */

.tarjeta {
  background: var(--papel);
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 1.25rem 1.4rem;
}

.tarjeta-titulo {
  font-size: 1.12rem;
  margin-bottom: .9rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.contador {
  font-family: var(--fuente-ui);
  font-size: .78rem;
  font-weight: 600;
  background: rgba(191, 77, 46, .1);
  color: var(--terracota-osc);
  border-radius: 999px;
  padding: .1rem .55rem;
}

/* ── Chips y puntos ───────────────────────────────────────── */

.chip {
  display: inline-block;
  padding: .13rem .6rem;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .01em;
  background: color-mix(in srgb, var(--c, #b9ac9b) 14%, white);
  color: color-mix(in srgb, var(--c, #6f665a) 82%, black);
  border: 1px solid color-mix(in srgb, var(--c, #b9ac9b) 30%, white);
  white-space: nowrap;
}
.chip-neutra { --c: #b9ac9b; font-weight: 500; }

.punto {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c, var(--tinta-suave));
  margin-right: .42rem;
}

/* ── Panel: estadísticas ──────────────────────────────────── */

.estadisticas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .8rem;
  margin-bottom: 1.2rem;
}

.stat {
  background: var(--papel);
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: .9rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .1rem;
  color: var(--tinta);
  transition: transform .08s ease, box-shadow .15s ease;
}
a.stat:hover { text-decoration: none; transform: translateY(-2px); }

.stat-cifra {
  font-family: var(--fuente-titulo);
  font-size: 1.9rem;
  font-weight: 600;
  line-height: 1.1;
}
.stat-nombre {
  color: var(--tinta-suave);
  font-size: .82rem;
  font-weight: 500;
  display: flex;
  align-items: center;
}
.stat-total { background: var(--tinta); border-color: var(--tinta); }
.stat-total .stat-cifra { color: var(--crema); }
.stat-total .stat-nombre { color: rgba(246, 241, 232, .75); }

/* ── Panel: mapa + recientes ──────────────────────────────── */

.panel-rejilla {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  align-items: start;
}

.tarjeta-mapa { padding: .6rem; position: relative; }

#mapa { height: 540px; border-radius: 10px; z-index: 1; }

.mapa-leyenda {
  position: absolute;
  bottom: 1.1rem;
  left: 1.1rem;
  z-index: 500;
  background: rgba(255, 253, 249, .94);
  border: 1px solid var(--linea);
  border-radius: 10px;
  box-shadow: var(--sombra);
  padding: .5rem .8rem;
  display: flex;
  gap: .9rem;
  flex-wrap: wrap;
  font-size: .8rem;
}
.leyenda-item { display: flex; align-items: center; color: var(--tinta-suave); }
.leyenda-item b { margin-left: .3rem; color: var(--tinta); }

.lista-recientes { list-style: none; }
.lista-recientes li + li { border-top: 1px solid var(--linea); }
.lista-recientes a {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .65rem .2rem;
  color: var(--tinta);
}
.lista-recientes a:hover { text-decoration: none; background: rgba(191, 77, 46, .04); }
.lista-recientes .rad { font-size: .74rem; font-weight: 700; color: var(--terracota-osc); letter-spacing: .04em; }
.lista-recientes .dir { font-weight: 600; font-size: .92rem; }
.lista-recientes .metachips { display: flex; gap: .35rem; }
.lista-recientes .cuando { color: var(--tinta-suave); font-size: .78rem; }

.ver-todo { display: block; margin-top: .8rem; font-size: .9rem; font-weight: 600; }
.vacio { color: var(--tinta-suave); text-align: center; padding: 1.4rem 0; line-height: 1.8; }

/* ── Popup Leaflet ────────────────────────────────────────── */

.leaflet-popup-content-wrapper {
  border-radius: 12px;
  box-shadow: var(--sombra);
  font-family: var(--fuente-ui);
}
.popup { font-size: .86rem; line-height: 1.5; }
.popup a { font-weight: 600; }

/* ── Filtros + tabla ──────────────────────────────────────── */

.filtros {
  display: flex;
  gap: .55rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}
.filtros input[type="search"] { flex: 1 1 240px; }
.filtros .limpiar { font-size: .85rem; color: var(--tinta-suave); }

.tabla-envoltura { padding: 0; overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tabla th {
  text-align: left;
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--tinta-suave);
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--linea);
  white-space: nowrap;
}
.tabla td { padding: .75rem 1rem; border-bottom: 1px solid #f0e9dc; vertical-align: middle; }
.tabla tbody tr { cursor: pointer; transition: background .1s ease; }
.tabla tbody tr:hover { background: rgba(191, 77, 46, .045); }
.tabla tbody tr:last-child td { border-bottom: none; }
.tabla .rad { font-weight: 700; color: var(--terracota-osc); font-size: .8rem; letter-spacing: .04em; white-space: nowrap; }
.tabla .num { text-align: center; color: var(--tinta-suave); }
.tabla .cuando { color: var(--tinta-suave); font-size: .82rem; white-space: nowrap; }
.tabla small { color: var(--tinta-suave); }

/* ── Formularios ──────────────────────────────────────────── */

input, select, textarea {
  font-family: var(--fuente-ui);
  font-size: .93rem;
  color: var(--tinta);
  background: #fff;
  border: 1px solid var(--linea);
  border-radius: 10px;
  padding: .55rem .8rem;
  width: 100%;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--terracota);
  box-shadow: 0 0 0 3px rgba(191, 77, 46, .14);
}
textarea { resize: vertical; }
label { display: block; font-size: .84rem; font-weight: 600; color: var(--tinta-suave); }
label input, label select, label textarea { margin-top: .3rem; font-weight: 400; }
label + label, .dos + label, label + .dos, .dos + .dos { margin-top: .85rem; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }

.adjuntar small { display: block; font-weight: 400; margin-top: .25rem; color: var(--tinta-suave); }
input[type="file"] {
  padding: .45rem;
  background: var(--crema);
  border-style: dashed;
  cursor: pointer;
}
input[type="file"]::file-selector-button {
  font-family: var(--fuente-ui);
  font-weight: 600;
  font-size: .82rem;
  border: 1px solid var(--linea);
  background: var(--papel);
  color: var(--tinta);
  border-radius: 999px;
  padding: .3rem .8rem;
  margin-right: .7rem;
  cursor: pointer;
}

.form-rejilla {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 1rem;
  align-items: start;
}
.form-columna { display: flex; flex-direction: column; gap: 1rem; }
.tarjeta-pegajosa { position: sticky; top: 82px; }

#mapa-selector { height: 340px; border-radius: 10px; margin-top: .6rem; z-index: 1; }
.geobusqueda { display: flex; gap: .5rem; }
.geo-ayuda { font-size: .8rem; color: var(--tinta-suave); margin-top: .5rem; }
#geo-resultados { display: flex; flex-direction: column; gap: .3rem; margin-top: .5rem; }
.geo-opcion {
  text-align: left;
  font-family: var(--fuente-ui);
  font-size: .82rem;
  padding: .45rem .7rem;
  border: 1px solid var(--linea);
  border-radius: 8px;
  background: var(--crema);
  cursor: pointer;
}
.geo-opcion:hover { border-color: var(--terracota); background: rgba(191, 77, 46, .06); }

.form-envio { display: flex; flex-direction: column; gap: .6rem; align-items: center; }
.cancelar { font-size: .88rem; color: var(--tinta-suave); }

/* ── Detalle ──────────────────────────────────────────────── */

.rad-grande {
  color: var(--terracota-osc);
  font-size: .55em;
  font-family: var(--fuente-ui);
  font-weight: 700;
  letter-spacing: .05em;
  vertical-align: .35em;
  margin-right: .3rem;
}
.detalle-cabecera .sutil .chip { margin-left: .4rem; vertical-align: 1px; }

.detalle-rejilla {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1rem;
  align-items: start;
}
.detalle-principal, .detalle-lateral { display: flex; flex-direction: column; gap: 1rem; }

.descripcion { white-space: pre-line; }

.ficha { display: grid; grid-template-columns: auto 1fr; gap: .45rem .9rem; font-size: .9rem; }
.ficha dt { color: var(--tinta-suave); font-weight: 500; white-space: nowrap; }
.ficha dd { font-weight: 500; }

#mapa-mini { height: 240px; border-radius: 10px; z-index: 1; }

/* Documentos */
.docs-rejilla { display: flex; flex-direction: column; gap: .55rem; }
.doc {
  display: flex;
  align-items: center;
  gap: .8rem;
  border: 1px solid var(--linea);
  border-radius: 10px;
  padding: .5rem .7rem;
  background: #fff;
}
.doc-imagen img {
  width: 74px;
  height: 56px;
  object-fit: cover;
  border-radius: 7px;
  display: block;
  background: var(--crema);
}
.doc-archivo {
  width: 74px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--crema);
  border-radius: 7px;
  font-size: 1.5rem;
}
.doc-archivo:hover { text-decoration: none; }
.doc-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.doc-nombre {
  font-weight: 600;
  font-size: .89rem;
  color: var(--tinta);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-info small { color: var(--tinta-suave); font-size: .76rem; }
.doc-acciones { display: flex; align-items: center; gap: .5rem; }
.doc-acciones a, .doc-acciones button {
  border: none;
  background: none;
  cursor: pointer;
  font-size: .95rem;
  color: var(--tinta-suave);
  padding: .25rem;
}
.doc-acciones a:hover { color: var(--tinta); text-decoration: none; }
.doc-acciones button:hover { color: var(--rojo); }

.subir-form {
  display: flex;
  gap: .6rem;
  margin-top: .9rem;
  align-items: center;
  flex-wrap: wrap;
}
.subir-form input[type="file"] { flex: 1 1 220px; }

/* Bitácora */
.bitacora-form { margin-bottom: 1.1rem; }
.bitacora-form-fila { display: flex; gap: .6rem; margin-top: .5rem; }
.bitacora-form-fila select { flex: 1; }

.bitacora { list-style: none; position: relative; padding-left: 1.4rem; }
.bitacora::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--linea);
}
.bitacora li { position: relative; padding: .45rem 0 .55rem; }
.bitacora li::before {
  content: '';
  position: absolute;
  left: -1.4rem;
  top: .85rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c, #b9ac9b);
  border: 2.5px solid var(--papel);
  box-shadow: 0 0 0 1px var(--linea);
}
.bitacora-nota { font-size: .92rem; }
.bitacora small { color: var(--tinta-suave); font-size: .76rem; }

/* ── Login ────────────────────────────────────────────────── */

.login-escenario {
  min-height: calc(100vh - 220px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  padding: 2rem 1rem;
}

.login-tarjeta {
  width: min(400px, 100%);
  background: var(--papel);
  border: 1px solid var(--linea);
  border-radius: 20px;
  box-shadow: var(--sombra);
  padding: 2.4rem 2.2rem 2.2rem;
  text-align: center;
}
.login-logo { margin-bottom: 1.1rem; }
.login-logo svg { border-radius: 14px; box-shadow: 0 4px 14px rgba(156, 60, 34, .35); }
.login-tarjeta h1 { font-size: 1.65rem; }
.login-sub { color: var(--tinta-suave); font-size: .9rem; margin: .3rem 0 1.5rem; }
.login-form { text-align: left; display: flex; flex-direction: column; gap: .85rem; }
.login-pie { color: var(--tinta-suave); font-size: .8rem; }

.alerta {
  background: rgba(142, 35, 35, .08);
  color: var(--rojo);
  border: 1px solid rgba(142, 35, 35, .25);
  border-radius: 10px;
  padding: .55rem .8rem;
  font-size: .86rem;
  margin-bottom: 1rem;
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 980px) {
  .panel-rejilla, .detalle-rejilla, .form-rejilla { grid-template-columns: 1fr; }
  .tarjeta-pegajosa { position: static; }
  #mapa { height: 420px; }
}

@media (max-width: 640px) {
  body { font-size: 14px; }
  h1 { font-size: 1.5rem; }
  .dos { grid-template-columns: 1fr; }
  .cabecera { padding: .7rem 1rem; }
  .marca-texto small { display: none; }
  .nav-usuario { display: none; }
  #mapa { height: 340px; }
  .tabla .cuando, .tabla .num { display: none; }
  .tabla thead th:last-child, .tabla thead th:nth-child(6) { display: none; }
}
