:root {
  --bg: #050505;
  --panel: rgba(12, 12, 12, 0.94);
  --panel-solido: #0f0f0f;
  --superficie: #181818;
  --borde: rgba(255, 255, 255, 0.10);
  --borde-fuerte: rgba(255, 255, 255, 0.22);
  --texto: #f6f6f6;
  --muted: #a6a6a6;
  --naranja: #ff7a00;
  --naranja-claro: #ffa040;
  --naranja-suave: rgba(255, 122, 0, 0.16);
  --rojo: #ff3b30;
  --rojo-suave: rgba(255, 59, 48, 0.16);
  --verde: #22d36b;
  --verde-suave: rgba(34, 211, 107, 0.16);
  --primario: var(--naranja);
  --primario-texto: #000;
  --foco: var(--naranja-claro);
  --error: #ff5a4f;
  --radio: 12px;
  --gutter: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--texto);
  font: 15px/1.45 var(--font);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--naranja-claro); }
.muted { color: var(--muted); }
.crece { flex: 1; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--foco); outline-offset: 2px; }

/* ---------- Cabecera ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px var(--gutter);
  background: #000;
  border-bottom: 2px solid var(--naranja);
  z-index: 5;
}
.top__title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.top__title > div { min-width: 0; }
.top__title h1 { font-size: 19px; font-weight: 750; letter-spacing: 0.005em; line-height: 1.2; }
.top__title h1 .ceja {
  display: block; font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--naranja);
}
.top__title p { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn.btn-inicio {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  text-decoration: none; font-size: 18px; line-height: 1;
  border: 2px solid var(--naranja); color: var(--naranja); background: #000;
}
.btn-inicio span { font-size: 14px; font-weight: 750; color: var(--texto); }
.btn.btn-inicio:hover { background: var(--naranja); color: #000; }
.btn-inicio:hover span { color: #000; }
.lazo {
  width: 14px; height: 22px; flex: none;
  background: var(--naranja);
  clip-path: polygon(50% 0, 100% 30%, 75% 100%, 50% 60%, 25% 100%, 0 30%);
}
.top__phones { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.tel {
  display: flex; flex-direction: column; align-items: flex-end;
  padding: 5px 12px; border-radius: 10px;
  background: #000; border: 2px solid var(--naranja);
  color: var(--texto); text-decoration: none; line-height: 1.2;
}
.tel small { color: var(--naranja-claro); font-size: 11px; font-weight: 600; }
.tel strong { font-size: 18px; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.tel--urgente { background: var(--rojo); border-color: var(--rojo); }
.tel--urgente small { color: #fff; opacity: 0.9; }
.tel--hosp { font: inherit; cursor: pointer; border-color: var(--verde); }
.tel--hosp small { color: var(--verde); }

/* Ventana de teléfonos y hospitales */
.seccion { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--naranja); margin-top: 6px; }
.lista-tel { display: flex; flex-direction: column; gap: 8px; }
.tel--fila { flex-direction: row; justify-content: space-between; align-items: center; padding: 10px 14px; }
.tel--fila small { font-size: 14px; color: var(--texto); }
.tel--urgente.tel--fila small { color: #fff; }
.puntos { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.puntos li::marker { color: var(--naranja); }
.hospitales { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.hospitales li { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 12px; background: var(--superficie); border-left: 4px solid var(--verde); }
.hospitales li > div { display: flex; flex-direction: column; min-width: 0; }
.hospitales li span { font-size: 12px; }
.hospitales .btn { white-space: nowrap; flex: none; text-decoration: none; }

.aviso {
  padding: 7px var(--gutter);
  font-size: 13px;
  background: #1a0d00;
  color: #ffd3a8;
  border-bottom: 1px solid #3d2000;
  z-index: 5;
}

/* ---------- Escenario ---------- */
.stage { position: relative; flex: 1; min-height: 0; }
.escena { position: absolute; inset: 0; z-index: 0; }
.escena canvas { display: block; touch-action: none; }

.leyenda {
  position: absolute; left: var(--gutter); top: 12px;
  display: flex; flex-direction: column; gap: 6px;
  pointer-events: none;
}
.leyenda__tren {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: var(--radio);
  background: var(--panel); border: 1px solid var(--borde);
  backdrop-filter: blur(6px);
}
.leyenda__tren .chip { width: 10px; height: 28px; border-radius: 3px; }
.leyenda__tren strong { font-size: 15px; }
.leyenda__tren span { font-size: 12px; color: var(--muted); display: block; }
.leyenda__claves { display: flex; gap: 12px; padding: 6px 12px; border-radius: var(--radio); background: var(--panel); border: 1px solid var(--borde); font-size: 12px; }
.punto { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; box-shadow: 0 0 0 2px #fff; }
.punto--rojo { background: var(--rojo); }
.punto--verde { background: var(--verde); }

.ayuda { position: absolute; left: 50%; bottom: 80px; transform: translateX(-50%); font-size: 12px; pointer-events: none; text-shadow: 0 1px 2px #000; text-align: center; color: #e6e6e6; }

.acciones {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; gap: 8px; z-index: 3;
}
.btn-vista-flotante { display: none; }

/* ---------- Botones e inputs ---------- */
.btn {
  appearance: none; border: 1px solid var(--borde-fuerte);
  background: rgba(20, 20, 20, 0.85); color: var(--texto);
  font: inherit; font-weight: 650;
  padding: 9px 14px; border-radius: 10px; cursor: pointer;
  backdrop-filter: blur(6px);
  min-height: 40px;
}
.btn:hover { background: rgba(40, 40, 40, 0.95); border-color: var(--naranja); }
.btn--primario { background: var(--primario); color: var(--primario-texto); border-color: transparent; font-weight: 750; }
.btn--primario:hover { background: var(--naranja-claro); }
.btn--grande { padding: 13px 22px; font-size: 16px; box-shadow: 0 6px 28px rgba(255, 122, 0, 0.35); }
.btn--bloque { width: 100%; }
.btn--icono { padding: 6px 12px; line-height: 1; min-width: 40px; }
.btn--peligro { color: var(--error); }
.btn--verde { background: var(--verde); color: #000; border-color: transparent; }
.btn:disabled { opacity: 0.4; cursor: default; }

.input {
  width: 100%;
  font: inherit; color: var(--texto);
  background: #0a0a0a; border: 1px solid #333; border-radius: 10px;
  padding: 10px 12px;
}
.input:focus { border-color: var(--naranja); outline: none; box-shadow: 0 0 0 3px var(--naranja-suave); }
.input--corto { width: 7em; }
input[type="file"].input { padding: 6px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label > .input, label > select { color: var(--texto); font-size: 16px; }
.req { color: var(--rojo); }

/* ---------- Panel lateral / hoja inferior ---------- */
.panel {
  position: absolute; right: var(--gutter); top: 12px; bottom: 12px;
  width: 350px;
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--borde); border-radius: 16px;
  backdrop-filter: blur(8px);
  z-index: 2;
  overflow: hidden;
}
.hoja__asa { display: none; }
.panel__titulo { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; }
.panel__titulo .btn { font-size: 13px; padding: 5px 10px; min-height: 32px; }
@media (min-width: 861px) {
  .panel.plegado { bottom: auto; }
  .panel.plegado #buscar, .panel.plegado .filtros, .panel.plegado .lista { display: none; }
  .panel.plegado .panel__cabecera { border-bottom: 0; }
  body.lista-plegada .coche-panel { right: var(--gutter); }
}
.panel__cabecera { padding: 12px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--borde); }
.hoja__fila { display: none; }
.contadores { display: flex; gap: 10px; font-size: 13px; color: var(--muted); }
.contadores > div { flex: 1; padding: 8px 10px; border-radius: 10px; background: var(--superficie); border-left: 4px solid; }
.contadores strong { display: block; font-size: 24px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.contadores .c-busca { border-color: var(--rojo); }
.contadores .c-busca strong { color: var(--rojo); }
.contadores .c-ok { border-color: var(--verde); }
.contadores .c-ok strong { color: var(--verde); }
.filtros { display: flex; gap: 6px; flex-wrap: wrap; }
.filtro {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--texto);
  background: var(--superficie); border: 1px solid var(--borde); border-radius: 999px;
  padding: 5px 12px; cursor: pointer; min-height: 32px;
}
.filtro[aria-pressed="true"] { color: #000; background: var(--naranja); border-color: var(--naranja); }

.lista { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.lista:empty::after { content: attr(data-vacio); display: block; padding: 18px 10px; color: var(--muted); font-size: 13px; text-align: center; }
.persona {
  display: flex; gap: 10px; align-items: center;
  padding: 8px; border-radius: 12px; cursor: pointer;
  border: 1px solid transparent; border-left: 4px solid var(--rojo);
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 6px;
}
.persona.localizada { border-left-color: var(--verde); }
.persona:hover, .persona:focus-visible { background: rgba(255, 255, 255, 0.08); }
.persona.resaltada { border-color: var(--naranja); background: var(--naranja-suave); }
.avatar {
  width: 48px; height: 48px; flex: none; border-radius: 50%;
  object-fit: cover; background: #262626;
  display: grid; place-items: center;
  font-weight: 750; color: #fff; font-size: 16px;
  border: 2px solid var(--naranja);
}
.persona__info { min-width: 0; flex: 1; }
.persona__nombre { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.persona__ubic { font-size: 12px; color: var(--muted); }
.persona__ubic .marca { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: 0; }
.estado { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px; white-space: nowrap; text-transform: uppercase; letter-spacing: 0.03em; }
.estado--buscando { background: var(--rojo); color: #fff; }
.estado--localizado { background: var(--verde); color: #000; }
.persona.localizada .persona__nombre { color: #d0d0d0; }
.hoja__pie { display: none; }

/* ---------- Panel de coche ---------- */
.coche-panel {
  position: absolute; left: var(--gutter); right: calc(350px + var(--gutter) * 2); bottom: 80px;
  max-height: 58%;
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--borde); border-top: 3px solid var(--naranja); border-radius: 16px;
  backdrop-filter: blur(8px);
  z-index: 4;
}
.coche-panel > header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.coche-panel__titulo { display: flex; align-items: center; gap: 6px; min-width: 0; }
.coche-panel__titulo > div { min-width: 0; }
.coche-panel h2 { font-size: 17px; white-space: nowrap; }
.coche-panel #cocheSub { font-size: 13px; }
.coche-panel .lista { padding: 0; display: flex; gap: 6px; overflow-x: auto; flex: none; }
.lista--compacta .persona { flex: none; width: 290px; margin: 0; }
.btn-flecha { min-width: 40px; padding: 6px 0; font-size: 20px; line-height: 1; }

@media (min-width: 861px) {
  .coche-panel { max-height: 46%; }
  .coche-panel .plano { max-width: 620px; }
  .coche-panel .plano svg { min-width: 0; }
  body.interior-activo .coche-panel .plano, body.interior-activo .coche-panel .lista { display: none; }
  body.interior-activo .coche-panel { right: auto; width: min(680px, calc(100% - 350px - var(--gutter) * 3)); }
  body.interior-activo.lista-plegada .coche-panel { width: min(680px, calc(100% - var(--gutter) * 2)); }
  .coche-panel .fila { flex-wrap: nowrap; }
}

/* ---------- Vista interior 3D ---------- */
.tip3d {
  position: absolute; left: 0; top: 0; z-index: 6; pointer-events: none;
  padding: 4px 9px; border-radius: 6px; font-size: 13px; font-weight: 600; white-space: nowrap;
  background: rgba(0, 0, 0, 0.92); border: 1px solid var(--naranja);
}
.barra-3d {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 6;
  display: flex; gap: 12px; align-items: center;
  width: max-content; max-width: calc(100% - 2 * var(--gutter));
  padding: 10px 12px 10px 16px; border-radius: 12px;
  background: var(--panel); border: 2px solid var(--naranja);
  backdrop-filter: blur(8px); font-weight: 650;
}
#btnInterior[aria-pressed="true"] { background: var(--naranja); color: #000; }
body.eligiendo-3d .acciones, body.eligiendo-3d .panel, body.eligiendo-3d .leyenda, body.eligiendo-3d .ayuda, body.eligiendo-3d .btn-vista-flotante { display: none; }

/* ---------- Planos SVG ---------- */
.plano { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.plano svg { display: block; width: 100%; min-width: 640px; height: auto; user-select: none; }
.plano--tren svg { min-width: 560px; }
.plano .asiento { cursor: pointer; }
.plano .asiento rect { fill: #2a2a2a; stroke: #444; stroke-width: 1; transition: fill 0.15s; }
.plano .asiento:hover rect { fill: #4a3520; stroke: var(--naranja); }
.plano .asiento text { fill: #a0a0a0; font-size: 9px; pointer-events: none; }
.plano .asiento.ocupado rect { fill: var(--rojo); stroke: #ffb0aa; }
.plano .asiento.ocupado.localizado rect { fill: var(--verde); stroke: #b6f5cf; }
.plano .asiento.ocupado text { fill: #fff; font-weight: 800; }
.plano .asiento.ocupado.localizado text { fill: #000; }
.plano .asiento.elegido rect { fill: var(--naranja); stroke: #fff; stroke-width: 2; }
.plano .asiento.elegido text { fill: #000; font-weight: 800; }
.plano .asiento.resaltado rect { stroke: #fff; stroke-width: 3; }
.plano .aprox { fill: rgba(255, 59, 48, 0.3); stroke: #ff8a80; stroke-dasharray: 4 3; stroke-width: 1.5; }
.plano .aprox.elegido { fill: rgba(255, 122, 0, 0.45); stroke: #fff; }
.plano .clicable { cursor: crosshair; }

/* ---------- Etiquetas 3D ---------- */
.etq-tren {
  padding: 6px 12px; border-radius: 8px;
  color: #fff; font-weight: 800; font-size: 15px; white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.etq-tren small { display: block; font-weight: 500; font-size: 11px; opacity: 0.9; }
.etq-coche {
  display: flex; align-items: center; gap: 4px;
  min-width: 28px; min-height: 28px; justify-content: center;
  padding: 3px 8px; border-radius: 999px;
  border: 2px solid #fff;
  color: #fff; font-size: 13px; font-weight: 800; white-space: nowrap;
  cursor: pointer; pointer-events: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
.etq-coche:hover { filter: brightness(1.25); }
.etq-coche .n { font-variant-numeric: tabular-nums; }
.etq-coche .badge { background: #fff; color: var(--rojo); border-radius: 999px; padding: 0 6px; font-size: 11px; }
.etq-asiento { font-size: 11px; font-weight: 800; color: #fff; text-shadow: 0 0 3px #000, 0 0 3px #000; pointer-events: none; }
.etq-coche.activo { background: var(--naranja) !important; color: #000; border-color: #000; transform: scale(1.15); }

/* ---------- Modales ---------- */
.modal {
  width: min(720px, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100dvh - 32px);
  padding: 0; border: 1px solid var(--borde); border-top: 3px solid var(--naranja); border-radius: 16px;
  background: var(--panel-solido); color: var(--texto);
}
.modal::backdrop { background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(2px); }
.form { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.form fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.modal__cab { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal__cab h2 { font-size: 20px; }
.modal__pie { display: flex; gap: 8px; align-items: center; padding-top: 4px; }
.fila { display: flex; gap: 10px; flex-wrap: wrap; }
.fila > label { min-width: 120px; }
.fila--centro { align-items: flex-end; }
.pista { font-size: 13px; flex: 1; min-width: 200px; }
.privado { padding: 12px; border-radius: 12px; background: #0a0a0a; border: 1px dashed #3a3a3a; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.foto-previa img { max-height: 140px; border-radius: 10px; }
.error { color: var(--error); font-size: 14px; min-height: 1em; font-weight: 600; }
.error:empty { display: none; }
.check { flex-direction: row; gap: 10px; align-items: flex-start; color: var(--texto); font-size: 14px; }
.check input { margin-top: 3px; width: 20px; height: 20px; flex: none; accent-color: var(--naranja); }

.pasos { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0; counter-reset: paso; }
.pasos li { flex: 1; font-size: 12px; color: var(--muted); padding-top: 6px; border-top: 4px solid #2a2a2a; counter-increment: paso; }
.pasos li::before { content: counter(paso) ". "; }
.pasos li.activo { color: var(--texto); font-weight: 700; border-color: var(--naranja); }
.pasos li.hecho { border-color: var(--verde); }

.selector-tren { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.opcion-tren {
  text-align: left; font: inherit; color: var(--texto); cursor: pointer;
  padding: 12px; border-radius: 12px; min-height: 56px;
  background: #0a0a0a; border: 2px solid #2e2e2e;
  display: flex; gap: 10px; align-items: center;
}
.opcion-tren .chip { width: 8px; align-self: stretch; border-radius: 3px; }
.opcion-tren small { display: block; color: var(--muted); font-size: 12px; }
.opcion-tren[aria-checked="true"] { border-color: var(--naranja); background: var(--naranja-suave); }
.resumen-ubicacion { font-weight: 700; min-height: 1.4em; color: var(--naranja-claro); }

.tarjeta-previa { display: flex; gap: 14px; align-items: center; padding: 12px; border-radius: 12px; background: #0a0a0a; border-left: 4px solid var(--rojo); }
.tarjeta-previa .avatar { width: 72px; height: 72px; font-size: 22px; }

.enlace { display: flex; gap: 8px; }

.ficha { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.ficha__foto { width: 180px; max-width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; background: #262626; border: 3px solid var(--rojo); }
.ficha--localizada .ficha__foto { border-color: var(--verde); }
/* Sin foto: recuadro con las iniciales (no hereda el tamaño pequeño de .avatar) */
.ficha__foto.avatar { height: auto; display: grid; place-items: center; line-height: 1; }
.ficha__datos { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 8px; }
.ficha__datos h2 { font-size: 24px; }
.ficha dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 15px; }
.ficha dt { color: var(--muted); }
.ficha dd { margin: 0; font-weight: 600; }
.caja-info { padding: 10px 12px; border-radius: 12px; background: #1a0d00; border: 1px solid #3d2000; font-size: 13px; color: #ffd3a8; }
.caja-info strong { color: #fff; }

/* ---------- Pie ---------- */
.pie {
  display: flex; gap: 16px; flex-wrap: wrap; align-items: center;
  padding: 6px var(--gutter); font-size: 12px;
  background: #000; border-top: 1px solid var(--borde);
}
.pie span { flex: 1; min-width: 200px; }

/* ---------- Modo TV ---------- */
.tv {
  position: absolute; left: var(--gutter); bottom: 18px; z-index: 3;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px 12px 12px; border-radius: 16px;
  background: var(--naranja); color: #000;
}
.tv img { border-radius: 8px; background: #fff; padding: 4px; }
.tv strong { display: block; font-size: 24px; }
.tv span { font-size: 20px; font-weight: 700; }
body.modo-tv .acciones, body.modo-tv .ayuda, body.modo-tv .pie { display: none; }
/* Discreto para no estorbar en la emisión; se resalta al pasar el ratón o con el foco */
.btn-salir-tv { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 6; opacity: 0.6; }
.btn-salir-tv:hover, .btn-salir-tv:focus-visible { opacity: 1; }
body.modo-tv .top__title h1 { font-size: 26px; }
body.modo-tv .tel strong { font-size: 26px; }

/* ---------- Móvil ---------- */
@media (max-width: 860px) {
  :root { --gutter: 12px; }
  body { font-size: 15px; }

  /* Cabecera compacta: título en una línea y teléfonos en fila */
  .top { flex-direction: column; align-items: stretch; gap: 6px; padding: 8px var(--gutter); }
  .top__title { gap: 10px; }
  .btn-inicio { min-height: 38px; padding: 6px 10px; }
  .btn-inicio span { display: none; }
  .top__title .lazo { display: none; }
  .top__title h1 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .top__title h1 .ceja { font-size: 10px; }
  .top__title p { display: none; }
  .top__phones {
    flex-wrap: nowrap; justify-content: flex-start; gap: 6px;
    overflow-x: auto; scrollbar-width: none; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter);
  }
  .top__phones::-webkit-scrollbar { display: none; }
  .top__phones .tel { flex: none; align-items: flex-start; gap: 0; padding: 3px 8px; white-space: nowrap; border-radius: 8px; }
  .top__phones .tel strong { font-size: 14px; letter-spacing: 0; }
  .top__phones .tel small { font-size: 10px; }

  .aviso { padding: 5px var(--gutter); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
  .aviso.abierto { white-space: normal; }

  .leyenda, .ayuda, .pie, .acciones { display: none; }
  .panel__titulo { display: none; }
  .tv { display: none !important; }
  .etq-tren { font-size: 12px; padding: 4px 8px; }
  .etq-tren small { display: none; }
  .etq-coche { font-size: 12px; min-width: 26px; min-height: 26px; padding: 2px 7px; }

  .btn-vista-flotante {
    display: grid; place-items: center;
    position: absolute; right: var(--gutter); top: 10px; z-index: 3;
    width: 44px; height: 44px; padding: 0; border-radius: 50%;
    font-size: 20px; background: rgba(0, 0, 0, 0.75); border: 2px solid var(--naranja); color: var(--naranja);
  }

  /* Hoja inferior arrastrable: mínima (botón + buscador), media y completa */
  .panel {
    left: 0; right: 0; top: auto; bottom: 0; width: auto;
    height: var(--hoja-alto, 172px);
    border-radius: 18px 18px 0 0; border: 0; border-top: 3px solid var(--naranja);
    background: rgba(8, 8, 8, 0.97);
    transition: height 0.28s cubic-bezier(.2, .8, .2, 1);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .panel.arrastrando { transition: none; }
  .hoja__asa {
    display: block; flex: none; height: 22px; cursor: grab; touch-action: none;
    position: relative;
  }
  .hoja__asa::before { content: ""; position: absolute; left: 50%; top: 8px; width: 44px; height: 5px; margin-left: -22px; border-radius: 3px; background: #555; }
  .panel__cabecera { padding: 0 var(--gutter) 10px; gap: 8px; touch-action: none; }
  .panel__cabecera input, .panel__cabecera button { touch-action: manipulation; }
  .hoja__fila { display: flex; gap: 8px; order: -2; }
  .btn-anadir-hoja { flex: 1; font-size: 16px; padding: 12px; min-height: 50px; }
  .hoja__lista { flex: none; min-height: 50px; font-size: 15px; }
  .hoja__lista b { display: inline-block; min-width: 24px; margin-left: 4px; padding: 1px 6px; border-radius: 999px; background: var(--rojo); color: #fff; }
  .panel[data-estado="min"] #buscar { display: none; }
  #buscar { order: -1; font-size: 16px; }
  .contadores > div { padding: 6px 10px; display: flex; align-items: baseline; gap: 6px; }
  .contadores strong { display: inline; font-size: 20px; }
  .panel[data-estado="min"] .contadores, .panel[data-estado="min"] .filtros { display: none; }
  .lista { padding: 6px var(--gutter); }
  .hoja__pie { display: flex; gap: 14px; flex-wrap: wrap; padding: 8px var(--gutter) 14px; font-size: 12px; border-top: 1px solid var(--borde); }

  /* Panel del coche: compacto, deja ver el tren */
  body.coche-abierto .panel { display: none; }
  body.coche-abierto .btn-vista-flotante { display: grid; }
  body.hoja-max:not(.coche-abierto) .btn-vista-flotante { display: none; }
  .coche-panel {
    left: 0; right: 0; bottom: 0; max-height: 52%;
    padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0; border: 0; border-top: 3px solid var(--naranja);
    background: rgba(8, 8, 8, 0.97); gap: 8px;
  }
  .coche-panel h2 { font-size: 16px; }
  .coche-panel #cocheSub { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .coche-panel > header { flex-wrap: wrap; }
  .coche-panel__titulo { flex: 1 1 100%; }
  .coche-panel__titulo > div { flex: 1; text-align: center; }
  .coche-panel .fila { flex: 1 1 100%; flex-wrap: nowrap; gap: 6px; }
  .coche-panel .fila .btn:not(.btn--icono) { flex: 1; }
  #btnInterior { white-space: nowrap; }
  body.interior-activo .coche-panel .plano, body.interior-activo .coche-panel .lista { display: none; }
  body.interior-activo #cocheSub { white-space: normal; }
  .plano svg { min-width: 600px; }
  .coche-panel .plano svg { min-width: 560px; }
  .plano--tren svg { min-width: 520px; }
  .lista--compacta .persona { width: 250px; }

  /* Modales a pantalla completa */
  .modal {
    width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh;
    margin: 0; border-radius: 0; border: 0; border-top: 3px solid var(--naranja);
  }
  .form { padding: 14px var(--gutter) 0; min-height: 100%; }
  .modal__pie {
    position: sticky; bottom: 0; margin: auto calc(-1 * var(--gutter)) 0;
    padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
    background: var(--panel-solido); border-top: 1px solid var(--borde);
  }
  .modal__pie .btn { min-height: 48px; font-size: 16px; padding-inline: 18px; }
  .modal--ficha .form { padding-bottom: 16px; }
  .ficha__foto { width: 100%; max-height: 46dvh; }
  .ficha__foto.avatar { aspect-ratio: auto; height: 140px; }
  .ficha__datos { min-width: 0; }
  .fila > label { flex: 1; }
  .barra-3d { flex-direction: column; align-items: stretch; gap: 8px; font-size: 13px; top: 8px; width: calc(100% - 2 * var(--gutter)); }
  .barra-3d .fila { flex-wrap: nowrap; }
}
