/* =====================================================================
   Panel de administración de KIMI — identidad propia, negro y rojo.
   ===================================================================== */
:root {
  --rojo:        #E3181E;
  --rojo-oscuro: #B01016;
  --rojo-suave:  rgba(227, 24, 30, 0.12);

  /* Se conservan los nombres viejos para no reescribir todo. */
  --primario:        var(--rojo);
  --primario-oscuro: var(--rojo-oscuro);
  --primario-suave:  var(--rojo-suave);
  --acento:          var(--rojo);
  --acento-suave:    var(--rojo-suave);

  --exito:   #2ECC71;
  --aviso:   #F5A623;
  --peligro: #E3181E;

  --texto:        #F5F5F7;
  --texto-suave:  #9B9BA5;
  --texto-tenue:  #6A6A75;
  --borde:        #2A2A31;
  --fondo:        #08080A;
  --superficie:   #141417;
  --superficie-alta: #1E1E23;

  --radio: 14px;
  --sombra: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
}

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

body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--fondo);
  color: var(--texto);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.oculto { display: none !important; }

/* --------------------------------------------------- el logo de KIMI */
.kimi { font-weight: 900; letter-spacing: -0.03em; line-height: 1; }
.kimi .k { color: #fff; }
.kimi .imi { color: var(--rojo); }

/* ---------------------------------------------------------- acceso */
.acceso {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(227,24,30,.20), transparent 55%),
    var(--fondo);
  padding: 20px;
}
.tarjeta-acceso {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: 22px;
  padding: 40px 34px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 70px rgba(0,0,0,.5);
}
.logo-acceso {
  width: 74px; height: 74px;
  display: grid; place-items: center;
  background: #050506;
  border: 1px solid var(--borde);
  border-radius: 20px;
  margin: 0 auto 20px;
  box-shadow: 0 0 40px -8px rgba(227,24,30,.4);
}
.logo-acceso .kimi { font-size: 26px; }
.tarjeta-acceso h1 { font-size: 22px; text-align: center; font-weight: 800; }
.tarjeta-acceso .sub { text-align: center; color: var(--texto-suave); margin-bottom: 28px; font-size: 14.5px; margin-top: 4px; }
.pie-acceso { text-align: center; margin-top: 20px; font-size: 12px; color: var(--texto-tenue); }

label { display: block; margin-bottom: 15px; font-size: 13.5px; font-weight: 600; color: var(--texto-suave); }
input, select, textarea {
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border: 1px solid var(--borde);
  border-radius: 11px;
  font: inherit;
  font-size: 15px;
  background: var(--superficie-alta);
  color: var(--texto);
}
input::placeholder, textarea::placeholder { color: var(--texto-tenue); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--rojo);
  box-shadow: 0 0 0 3px var(--rojo-suave);
}
option { background: var(--superficie-alta); color: var(--texto); }

/* --------------------------------------------------------- botones */
.btn {
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
  background: var(--superficie-alta);
  color: var(--texto);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn.primario   { background: var(--rojo); color: #fff; }
.btn.primario:hover { background: var(--rojo-oscuro); }
.btn.peligro    { background: var(--peligro); color: #fff; }
.btn.exito      { background: var(--exito); color: #06110a; }
.btn.fantasma   { background: transparent; border-color: var(--borde); color: var(--texto-suave); }
.btn.fantasma:hover { border-color: var(--rojo); color: var(--texto); }
.btn.ancho      { width: 100%; margin-top: 8px; }
.btn.pequeno    { padding: 7px 13px; font-size: 13.5px; }
.btn:disabled   { opacity: .5; cursor: not-allowed; transform: none; }

/* --------------------------------------------------------- panel */
.panel { display: grid; grid-template-columns: 234px 1fr; min-height: 100vh; }

.lateral {
  background: #050506;
  border-right: 1px solid var(--borde);
  color: #fff;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.marca { display: flex; align-items: center; gap: 10px; font-size: 20px; padding: 6px 10px 22px; }

#menu { flex: 1; overflow-y: auto; }
#menu a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--texto-suave);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
  margin-bottom: 2px;
}
#menu a:hover { background: rgba(255,255,255,.05); color: #fff; }
#menu a.activo { background: var(--rojo); color: #fff; font-weight: 600; }
#menu a .icono { width: 18px; text-align: center; opacity: .9; }
#menu a .cont {
  margin-left: auto;
  background: var(--rojo);
  color: #fff;
  border-radius: 20px;
  padding: 1px 7px;
  font-size: 11.5px;
  font-weight: 700;
}
#menu a.activo .cont { background: rgba(0,0,0,.35); }
#menu .grupo {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--texto-tenue); padding: 16px 12px 6px; font-weight: 700;
}
.lateral-pie { border-top: 1px solid var(--borde); padding-top: 14px; }
#quien { font-size: 13px; color: var(--texto-suave); margin-bottom: 10px; padding-left: 4px; }

main { min-width: 0; }
.cabecera {
  background: var(--fondo);
  border-bottom: 1px solid var(--borde);
  padding: 16px 26px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 20;
}
.cabecera h1 { font-size: 21px; font-weight: 800; }
.acciones-cabecera { display: flex; align-items: center; gap: 12px; }
.reloj { font-size: 13px; color: var(--texto-suave); }
.contenido { padding: 24px 26px 60px; }

/* --------------------------------------------------------- fichas */
.rejilla { display: grid; gap: 14px; }
.rejilla.c4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.rejilla.c3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.rejilla.c2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.ficha {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 18px;
  box-shadow: var(--sombra);
}
.ficha .etiqueta {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--texto-suave); font-weight: 700;
}
.ficha .numero { font-size: 30px; font-weight: 800; margin-top: 5px; line-height: 1.1; }
.ficha .nota { font-size: 13px; color: var(--texto-suave); margin-top: 5px; }
.ficha.destacada { background: linear-gradient(135deg, var(--rojo), var(--rojo-oscuro)); color: #fff; border-color: transparent; }
.ficha.destacada .etiqueta, .ficha.destacada .nota { color: rgba(255,255,255,.85); }
.ficha.alerta { border-color: var(--rojo); background: var(--rojo-suave); }

.panel-caja {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  overflow: hidden;
}
.panel-caja > h2 {
  font-size: 15.5px; font-weight: 700;
  padding: 15px 18px;
  border-bottom: 1px solid var(--borde);
  display: flex; align-items: center; justify-content: space-between;
}

/* --------------------------------------------------------- tablas */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; padding: 11px 16px;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--texto-suave); font-weight: 700;
  border-bottom: 1px solid var(--borde);
  background: var(--superficie-alta);
  white-space: nowrap;
}
td { padding: 12px 16px; border-bottom: 1px solid var(--borde); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--superficie-alta); }
.tabla-desliza { overflow-x: auto; }

.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
.der { text-align: right; }
.suave { color: var(--texto-suave); font-size: 13px; }
.negativo { color: #ff6b6b; font-weight: 700; }
.positivo { color: #4ade80; font-weight: 700; }

/* ------------------------------------------------------ etiquetas */
.pastilla {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.p-verde  { background: rgba(46,204,113,.15); color: #4ade80; }
.p-rojo   { background: rgba(227,24,30,.15); color: #ff6b6b; }
.p-ambar  { background: rgba(245,166,35,.15); color: #f5b942; }
.p-gris   { background: rgba(155,155,165,.14); color: var(--texto-suave); }
.p-azul   { background: rgba(59,130,246,.15); color: #60a5fa; }
.p-coral  { background: var(--rojo-suave); color: #ff8a6b; }

/* --------------------------------------------------------- varios */
#mapa { height: 380px; border-radius: var(--radio); border: 1px solid var(--borde); background: var(--superficie-alta); }
.leaflet-tile { filter: brightness(0.85) contrast(1.05); }
.vacio { padding: 44px 20px; text-align: center; color: var(--texto-suave); }
.error {
  background: rgba(227,24,30,.14); color: #ff8a8a;
  padding: 11px 14px; border-radius: 11px; font-size: 14px; margin-bottom: 14px;
}
.exito-caja {
  background: rgba(46,204,113,.14); color: #6ee7a0;
  padding: 11px 14px; border-radius: 11px; font-size: 14px; margin-bottom: 14px;
}
.barra-filtros { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: end; }
.barra-filtros label { margin: 0; }
.barra-filtros input, .barra-filtros select { min-width: 160px; margin-top: 4px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: grid; place-items: center; z-index: 100; padding: 20px; backdrop-filter: blur(2px); }
.modal-caja {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: 20px;
  width: 100%; max-width: 620px;
  max-height: 88vh; overflow-y: auto;
}
.modal-cabecera {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--borde);
  position: sticky; top: 0; background: var(--superficie);
}
.modal-cabecera h2 { font-size: 18px; font-weight: 700; }
.cerrar { border: none; background: none; font-size: 26px; cursor: pointer; color: var(--texto-suave); line-height: 1; }
#modal-cuerpo { padding: 24px; }

.aviso-flotante {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--superficie-alta); color: #fff;
  border: 1px solid var(--borde);
  padding: 13px 22px; border-radius: 12px; font-size: 14.5px;
  box-shadow: 0 12px 40px rgba(0,0,0,.5); z-index: 200;
}
.aviso-flotante.malo { background: var(--peligro); border-color: transparent; }

.linea-tiempo { list-style: none; }
.linea-tiempo li { padding: 9px 0 9px 22px; border-left: 2px solid var(--borde); position: relative; }
.linea-tiempo li::before {
  content: ''; position: absolute; left: -6px; top: 15px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--rojo); border: 2px solid var(--superficie);
}

.asiento { display: flex; justify-content: space-between; padding: 7px 0; font-size: 14px; }
.asiento + .asiento { border-top: 1px dashed var(--borde); }

@media (max-width: 880px) {
  .panel { grid-template-columns: 1fr; }
  .lateral { position: static; height: auto; flex-direction: row; align-items: center; gap: 14px; overflow-x: auto; }
  #menu { display: flex; gap: 6px; }
  #menu .grupo { display: none; }
  .lateral-pie { border: none; padding: 0; }
  #quien { display: none; }
  .contenido { padding: 16px; }
}
