/* =====================================================================
   Sistema de Reservas — capa de identidad sobre Bootstrap 5
   Paleta: tinta profunda + jade operativo + ámbar para la comisión.
   ===================================================================== */
:root {
  --tinta:        #0E2430;
  --tinta-suave:  #1B3A4A;
  --jade:         #128C6E;
  --jade-claro:   #E4F3EE;
  --ambar:        #C8862A;
  --ambar-claro:  #FBF1DF;
  --lienzo:       #F1F4F5;
  --papel:        #FFFFFF;
  --borde:        #DDE4E7;
  --texto:        #16232B;
  --texto-tenue:  #62757F;
  --peligro:      #B23A48;

  --radio:        14px;
  --radio-sm:     10px;
  --sombra:       0 1px 2px rgba(14,36,48,.06), 0 8px 24px -12px rgba(14,36,48,.25);
  --lateral:      264px;

  --display: 'Plus Jakarta Sans', system-ui, sans-serif;
  --cuerpo:  'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--cuerpo);
  background: var(--lienzo);
  color: var(--texto);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, .titulo-vista { font-family: var(--display); letter-spacing: -.02em; }

.eyebrow {
  font-family: var(--display);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--jade);
  margin-bottom: 1.25rem;
}

.salto-contenido {
  position: absolute; left: -999px; top: 0; z-index: 2000;
  background: var(--tinta); color: #fff; padding: .6rem 1rem; border-radius: 0 0 var(--radio-sm) 0;
}
.salto-contenido:focus { left: 0; }

/* ---------------------- Pantalla de acceso ---------------------- */
.pantalla-acceso { display: grid; grid-template-columns: 1.05fr .95fr; min-height: 100vh; }

.acceso-marca {
  background: linear-gradient(155deg, var(--tinta) 0%, var(--tinta-suave) 100%);
  color: #EAF1F3;
  display: flex; align-items: center; padding: 4rem 3.5rem;
  position: relative; overflow: hidden;
}
/* Trama sutil de "noches vendidas": líneas verticales como un calendario. */
.acceso-marca::after {
  content: ''; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 1px, transparent 1px 44px);
  pointer-events: none;
}
.acceso-marca__contenido { position: relative; max-width: 30rem; }
/* Variante limpia: logo + subtítulo centrados, sin texto descriptivo. */
.acceso-marca--centrado, .acceso-marca:has(.acceso-marca__contenido--centrado) { justify-content: center; }
.acceso-marca__contenido--centrado {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  max-width: 32rem; width: 100%;
}
.acceso-marca__contenido--centrado .acceso-logo {
  height: 120px; margin: 0 auto 1rem; display: block;
}
.eyebrow--centrado { text-align: center; margin: 0; }
@media (max-width: 900px) {
  .acceso-marca__contenido--centrado .acceso-logo { height: 88px; }
}
.acceso-titulo { font-size: clamp(2.2rem, 4.2vw, 3.4rem); font-weight: 800; line-height: 1.05; margin-bottom: 1.25rem; }
.acceso-bajada { color: #B7C8CF; line-height: 1.65; margin-bottom: 2rem; }
.acceso-lista { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; }
.acceso-lista li { display: flex; align-items: center; gap: .75rem; color: #D6E2E6; font-size: .93rem; }
.acceso-lista i { color: var(--jade); width: 1.2rem; }

.acceso-formulario { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; background: var(--papel); }
.acceso-caja { width: 100%; max-width: 24rem; }

@media (max-width: 900px) {
  .pantalla-acceso { grid-template-columns: 1fr; }
  .acceso-marca { padding: 2.5rem 1.75rem; }
  .acceso-titulo { font-size: 2rem; }
}

/* ---------------------- Estructura del panel ---------------------- */
#pantalla-app { display: flex; min-height: 100vh; }

.barra-lateral {
  width: var(--lateral); flex: 0 0 var(--lateral);
  background: var(--tinta); color: #C9D8DD;
  display: flex; flex-direction: column; padding: 1.25rem 1rem;
  position: sticky; top: 0; height: 100vh;
}
.barra-lateral__marca { display: flex; align-items: center; gap: .75rem; padding: .25rem .5rem 1.5rem; }
.marca-sigla {
  width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.06);
  display: grid; place-items: center; overflow: hidden;
}
.marca-icono-img { width: 30px; height: 30px; object-fit: contain; display: block; }
.marca-texto { font-family: var(--display); font-weight: 600; color: #fff; line-height: 1.15; font-size: .95rem; }
.marca-texto small { color: #8FA6AF; font-weight: 500; font-size: .72rem; }

/* Logo del panel de acceso */
.acceso-logo { height: 96px; width: auto; margin-bottom: 1.5rem; display: block; }
@media (max-width: 900px) { .acceso-logo { height: 72px; } }

.barra-lateral__nav { display: grid; gap: .15rem; overflow-y: auto; flex: 1; }
.nav-item-lateral {
  display: flex; align-items: center; gap: .7rem;
  padding: .6rem .75rem; border-radius: var(--radio-sm);
  color: #B4C6CD; text-decoration: none; font-size: .92rem; font-weight: 500;
  border: 0; background: transparent; width: 100%; text-align: left; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.nav-item-lateral i { width: 1.15rem; text-align: center; font-size: .95rem; }
.nav-item-lateral:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item-lateral.activo { background: var(--jade); color: #fff; }
.nav-grupo { font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: #6E848D; padding: 1rem .75rem .35rem; }

.barra-lateral__pie { border-top: 1px solid rgba(255,255,255,.08); padding-top: 1rem; }
.usuario-chip { display: flex; align-items: center; gap: .65rem; }
.usuario-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.1); color: #fff;
  display: grid; place-items: center; font-weight: 600; font-size: .8rem; overflow: hidden; flex: 0 0 36px;
}
.usuario-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Avatar reutilizable en tablas y modales */
.avatar-foto {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover;
  background: var(--lienzo); border: 1px solid var(--borde); flex: 0 0 34px;
}
.avatar-iniciales {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 34px;
  display: grid; place-items: center; font-weight: 600; font-size: .78rem;
  background: var(--jade-claro); color: #0B6B54;
}
.avatar-fila { display: flex; align-items: center; gap: .6rem; }
/* Avatar de la barra superior */
.avatar-topbar {
  width: 38px; height: 38px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--borde);
}
.usuario-datos { line-height: 1.2; overflow: hidden; }
.usuario-datos strong { display: block; color: #fff; font-size: .85rem; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.usuario-datos small { color: #8FA6AF; font-size: .72rem; }
.btn-salir { background: rgba(178,58,72,.18); color: #F2B8BF; border: 1px solid rgba(178,58,72,.35); }
.btn-salir:hover { background: var(--peligro); color: #fff; }

.area-principal { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.barra-superior {
  display: flex; align-items: center; gap: 1rem;
  background: var(--papel); border-bottom: 1px solid var(--borde);
  padding: 1rem 1.5rem; position: sticky; top: 0; z-index: 20;
}
.titulo-vista { font-size: 1.25rem; margin: 0; font-weight: 700; }
.subtitulo-vista { margin: 0; color: var(--texto-tenue); font-size: .82rem; }
.contenido { padding: 1.5rem; flex: 1; }

@media (max-width: 991.98px) {
  .barra-lateral {
    position: fixed; z-index: 1040; transform: translateX(-100%);
    transition: transform .25s ease; box-shadow: var(--sombra);
  }
  .barra-lateral.abierta { transform: translateX(0); }
  .contenido { padding: 1rem; }
}

/* ---------------------- Componentes ---------------------- */
.tarjeta {
  background: var(--papel); border: 1px solid var(--borde); border-radius: var(--radio);
  box-shadow: var(--sombra); padding: 1.25rem;
}
.tarjeta + .tarjeta { margin-top: 1rem; }

.kpi { display: grid; gap: .35rem; }
.kpi__etiqueta { font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--texto-tenue); font-weight: 600; }
.kpi__valor { font-family: var(--display); font-size: 1.85rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.kpi__nota { font-size: .78rem; color: var(--texto-tenue); }
.kpi--jade .kpi__valor { color: var(--jade); }
.kpi--ambar .kpi__valor { color: var(--ambar); }

/* Cinta de liquidación: el elemento firma del sistema. */
.cinta-liquidacion {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  border: 1px solid var(--borde); border-radius: var(--radio); overflow: hidden; background: var(--papel);
}
.cinta-tramo { padding: .85rem 1rem; border-right: 1px solid var(--borde); }
.cinta-tramo:last-child { border-right: 0; }
.cinta-tramo__etiqueta { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--texto-tenue); font-weight: 600; }
.cinta-tramo__monto { font-family: var(--display); font-weight: 700; font-size: 1.1rem; }
.cinta-tramo--resta { background: var(--ambar-claro); }
.cinta-tramo--resta .cinta-tramo__monto { color: var(--ambar); }
.cinta-tramo--neto { background: var(--jade-claro); }
.cinta-tramo--neto .cinta-tramo__monto { color: var(--jade); font-size: 1.25rem; }

.table thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--texto-tenue); font-weight: 600; border-bottom: 1px solid var(--borde); white-space: nowrap;
}
.table tbody td { vertical-align: middle; font-size: .88rem; }
.tabla-envoltorio { overflow-x: auto; }

.pildora { font-size: .72rem; font-weight: 600; padding: .2rem .6rem; border-radius: 999px; display: inline-block; }
.pildora--ok { background: var(--jade-claro); color: #0B6B54; }
.pildora--espera { background: #E8EEF1; color: var(--tinta-suave); }
.pildora--alerta { background: #FBE7E9; color: var(--peligro); }
.pildora--ambar { background: var(--ambar-claro); color: var(--ambar); }

.btn-jade { background: var(--jade); border-color: var(--jade); color: #fff; font-weight: 600; }
.btn-jade:hover, .btn-jade:focus { background: #0F7A60; border-color: #0F7A60; color: #fff; }
.btn-icono { border: 1px solid var(--borde); background: var(--papel); border-radius: var(--radio-sm); }

.form-label { font-size: .82rem; font-weight: 600; color: var(--texto); margin-bottom: .3rem; }
.form-control, .form-select { border-color: var(--borde); border-radius: var(--radio-sm); font-size: .9rem; }
.form-control:focus, .form-select:focus { border-color: var(--jade); box-shadow: 0 0 0 .2rem rgba(18,140,110,.15); }
.input-group-text { background: var(--lienzo); border-color: var(--borde); color: var(--texto-tenue); }

:focus-visible { outline: 2px solid var(--jade); outline-offset: 2px; }

.vacio { text-align: center; padding: 3rem 1rem; color: var(--texto-tenue); }
.vacio i { font-size: 2rem; color: var(--borde); display: block; margin-bottom: .75rem; }

.toast-zona { position: fixed; top: 1rem; right: 1rem; z-index: 1080; display: grid; gap: .5rem; }
.aviso {
  background: var(--tinta); color: #fff; padding: .75rem 1rem; border-radius: var(--radio-sm);
  box-shadow: var(--sombra); font-size: .88rem; display: flex; align-items: center; gap: .6rem; max-width: 22rem;
}
.aviso--error { background: var(--peligro); }
.aviso--ok { background: var(--jade); }

.json-diff { background: #0E2430; color: #C8E6DC; border-radius: var(--radio-sm); padding: .85rem; font-size: .76rem; overflow: auto; max-height: 16rem; }

/* ---------------------- Mapa (Leaflet) ---------------------- */
#mapa-selector { height: 380px; width: 100%; border-radius: var(--radio-sm); border: 1px solid var(--borde); z-index: 1; }

/* El modal del mapa se superpone al modal del formulario (Bootstrap usa 1055).
   Subimos su capa y la de su backdrop para que quede por encima sin conflictos. */
#modal-mapa { z-index: 1070; }
.modal-backdrop.backdrop-mapa { z-index: 1065; }

/* El modal de gestión de amenidades también se superpone al formulario. */
#modal-amenidad { z-index: 1070; }
.modal-backdrop.backdrop-amenidad { z-index: 1065; }

/* Cuadrícula de amenidades en el formulario y su vista previa de ícono/foto. */
.amenidad-chip-foto { width: 22px; height: 22px; border-radius: 4px; object-fit: cover; vertical-align: middle; }
.amenidad-preview-icono {
  width: 64px; height: 64px; border-radius: 12px; display: grid; place-items: center;
  background: var(--jade-claro); color: var(--jade); font-size: 1.6rem; overflow: hidden;
}
.amenidad-preview-icono img { width: 100%; height: 100%; object-fit: cover; }
.amenidad-item-gestion {
  display: flex; align-items: center; gap: .6rem; padding: .5rem .25rem;
  border-bottom: 1px solid var(--borde);
}
.amenidad-item-gestion:last-child { border-bottom: 0; }
.amenidad-item-gestion .nombre { flex: 1; }
.amenidad-item-gestion .icono-mini {
  width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center;
  background: var(--jade-claro); color: var(--jade); overflow: hidden; flex: 0 0 34px;
}
.amenidad-item-gestion .icono-mini img { width: 100%; height: 100%; object-fit: cover; }
.mapa-coordenadas {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  background: var(--jade-claro); border-radius: var(--radio-sm); padding: .6rem .85rem; margin-top: .75rem;
}
.mapa-coordenadas code { color: #0B6B54; font-weight: 600; }
.enlace-mapa {
  display: inline-flex; align-items: center; gap: .4rem;
  color: var(--jade); text-decoration: none; font-weight: 600; font-size: .85rem;
}
.enlace-mapa:hover { text-decoration: underline; }

/* ---------------------- Selects dinámicos con gestión ---------------------- */
.select-dinamico { display: flex; gap: .4rem; align-items: stretch; }
.select-dinamico .form-select { flex: 1; }
.btn-gestion-cat {
  border: 1px solid var(--borde); background: var(--papel); color: var(--jade);
  border-radius: var(--radio-sm); padding: 0 .7rem; white-space: nowrap;
}
.btn-gestion-cat:hover { background: var(--jade-claro); }
.gestion-lista { max-height: 16rem; overflow-y: auto; }
.gestion-item {
  display: flex; align-items: center; gap: .5rem; padding: .5rem .25rem;
  border-bottom: 1px solid var(--borde);
}
.gestion-item:last-child { border-bottom: 0; }
.gestion-item .nombre { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------------------- Reportes (comisiones / propietario) ---------------------- */
.reporte { background: #fff; border-radius: var(--radio-sm); padding: 1.5rem; }
.reporte__cabecera {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; flex-wrap: wrap; border-bottom: 2px solid var(--tinta); padding-bottom: 1rem; margin-bottom: 1rem;
}
.reporte__titulo { font-family: var(--display); color: var(--tinta); margin: 0; font-size: 1.4rem; }
.reporte__meta { text-align: right; font-size: .9rem; color: #444; }
.reporte__meta .etq { font-weight: 600; color: var(--tinta); }
.reporte__pie { margin-top: 1rem; font-size: .78rem; color: #888; text-align: right; }

.tabla-scroll { overflow-x: auto; }
.tabla-reporte { width: 100%; border-collapse: collapse; font-size: .82rem; }
.tabla-reporte th, .tabla-reporte td { padding: .5rem .6rem; border-bottom: 1px solid var(--borde); white-space: nowrap; }
.tabla-reporte thead th { background: var(--jade-claro); color: var(--tinta); font-weight: 600; text-align: left; }
.tabla-reporte tfoot td { border-top: 2px solid var(--tinta); background: #f7fafb; }
.tabla-reporte .text-end { text-align: right; }
.tabla-reporte .text-center { text-align: center; }

/* Impresión a PDF: solo se ve el reporte, a página completa horizontal. */
@media print {
  body.imprimiendo-reporte * { visibility: hidden; }
  body.imprimiendo-reporte #reporte-imprimible,
  body.imprimiendo-reporte #reporte-imprimible * { visibility: visible; }
  body.imprimiendo-reporte #reporte-imprimible {
    position: absolute; left: 0; top: 0; width: 100%; padding: 0; margin: 0;
  }
  body.imprimiendo-reporte .tabla-reporte { font-size: 10px; }
  body.imprimiendo-reporte .tabla-scroll { overflow: visible; }
  @page { size: landscape; margin: 12mm; }
}

/* ---------------------- UX global de formularios ---------------------- */
/* Diálogo de confirmación al intentar salir de un formulario */
.confirmar-salida {
  position: absolute; inset: 0; z-index: 20;
  display: grid; place-items: center; padding: 1rem;
  background: rgba(14, 36, 48, .55); border-radius: inherit;
}
.confirmar-salida__caja {
  background: #fff; border-radius: var(--radio-sm); padding: 1.25rem 1.5rem;
  max-width: 26rem; width: 100%; box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
/* Botón "Ocultar información" en el encabezado del modal */
#btn-ocultar-info { white-space: nowrap; }
/* Cuando la info está oculta, los campos enmascarados se ven atenuados */
.modal-body.info-oculta input[readonly][value="••••••••"],
.modal-body.info-oculta .dato-sensible {
  letter-spacing: .1em; color: #6b7c84;
}
.dato-sensible.enmascarado { filter: none; }

/* ---------------------- WhatsApp ---------------------- */
.enlace-whatsapp {
  display: inline-flex; align-items: center; gap: .35rem;
  color: #25D366; text-decoration: none; font-weight: 600;
}
.enlace-whatsapp:hover { color: #1da851; text-decoration: underline; }
.enlace-whatsapp .fa-whatsapp { font-size: 1.05em; }
.btn-whatsapp {
  background: #25D366; color: #fff; border: 0;
}
.btn-whatsapp:hover { background: #1da851; color: #fff; }

/* ---------------------- Bandera de país ---------------------- */
.bandera-pais { font-size: 1.15rem; vertical-align: middle; line-height: 1; }
