:root {
  --fondo: #17191d;
  --tarjeta: #1d2025;
  --borde: #26324a;
  --borde-suave: #2a2e35;
  --texto: #e6e8eb;
  --texto-2: #9aa1ab;
  --texto-3: #6c737d;
  --acento: #8fb8f0;
  --acento-fuerte: #1d3d70;
  --acento-hover: #24497f;
  --linea: #2c4f86;
  --ok: #4fbf8a;
  --aviso: #e0a526;
  --radio: 18px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.contenedor { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; }

/* ---------- Encabezado ---------- */
.encabezado { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.logo {
  width: 52px; height: 52px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: var(--acento-fuerte); color: var(--acento);
}
.encabezado h1 { margin: 0; font-size: 1.45rem; color: var(--acento); font-weight: 700; }
.encabezado p { margin: 2px 0 0; color: var(--texto-2); font-size: .9rem; }

/* ---------- Tarjetas ---------- */
.tarjeta {
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 20px;
  margin-bottom: 18px;
}

/* ---------- Buscador ---------- */
.fila-busqueda { display: flex; gap: 14px; align-items: stretch; }
.selector-ruta {
  flex: 1; min-width: 0; display: flex; align-items: center;   /* min-width: 0 evita que se desborde la tarjeta */
  border: 1px solid var(--borde); border-radius: 999px; min-height: 58px; padding: 0 6px;
}
.selector-ruta select {
  flex: 1; min-width: 0; appearance: none; background: transparent; border: 0; color: var(--texto);
  font: inherit; font-size: 1rem; padding: 14px 30px 14px 18px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa1ab' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.selector-ruta select:focus { outline: none; }
.selector-ruta select option { background: var(--tarjeta); color: var(--texto); }
.boton-invertir {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--borde); background: var(--fondo); color: var(--texto-2);
  display: grid; place-items: center; cursor: pointer; transition: transform .25s;
}
.boton-invertir:hover { color: var(--acento); transform: rotate(180deg); }

.boton-primario {
  flex: none; border: 0; border-radius: 999px; padding: 0 28px; min-height: 58px;
  background: var(--acento-fuerte); color: var(--texto); font: inherit; font-weight: 700; font-size: 1rem;
  cursor: pointer; transition: background .2s; white-space: nowrap;
}
.boton-primario:hover { background: var(--acento-hover); }
.boton-primario:disabled { opacity: .6; cursor: wait; }

.fila-fechas { display: flex; gap: 14px; margin-top: 14px; flex-wrap: wrap; align-items: end; }
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo label, .etiqueta { font-size: .78rem; color: var(--texto-2); text-transform: uppercase; letter-spacing: .04em; }
.campo input[type=date] {
  background: transparent; border: 1px solid var(--borde); border-radius: 12px; color: var(--texto);
  font: inherit; padding: 9px 12px; color-scheme: dark;
}
.check { display: flex; align-items: center; gap: 8px; color: var(--texto-2); font-size: .9rem; padding-bottom: 10px; cursor: pointer; }
.check input { accent-color: var(--acento); }

/* ---------- Semana ---------- */
.semana { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 18px; }
.dia {
  border: 1px solid var(--borde-suave); border-radius: 12px; padding: 8px 4px; text-align: center;
  background: transparent; color: var(--texto); font: inherit; cursor: pointer;
}
.dia:hover { border-color: var(--linea); }
.dia .nombre { font-size: .72rem; color: var(--texto-2); text-transform: uppercase; }
.dia .numero { font-weight: 700; font-size: 1.05rem; }
.dia > span { display: block; }
.dia .cantidad { font-size: .7rem; color: var(--ok); min-height: 1em; }
.dia .desde { font-size: .68rem; color: var(--texto-2); margin-top: 2px; }
.dia.sin-servicio .cantidad { color: var(--texto-3); }
.dia.activo { border-color: var(--acento); background: rgba(143, 184, 240, .08); }
.dia.cargando .cantidad { color: var(--texto-3); }

/* ---------- Filtros ---------- */
.filtros { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 14px; }
.filtros:empty { display: none; }
.grupo-filtros { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--borde-suave); background: transparent; color: var(--texto-2);
  border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .85rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip .punto { width: 8px; height: 8px; border-radius: 50%; }
.chip.activo { color: var(--texto); border-color: var(--acento); }

/* ---------- Resultados ---------- */
.titulo-seccion { display: flex; justify-content: space-between; align-items: baseline; margin: 26px 0 12px; }
.titulo-seccion h2 { margin: 0; font-size: 1.1rem; }
.titulo-seccion span { color: var(--texto-2); font-size: .88rem; }

.viaje { padding: 18px 20px; }
.viaje-cabecera { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.viaje-empresa { display: flex; gap: 12px; align-items: center; min-width: 0; }
.icono-empresa {
  width: 40px; height: 40px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: var(--acento-fuerte);
}
.viaje-empresa strong { display: block; color: var(--acento); font-size: 1rem; }
.viaje-empresa small { color: var(--texto-2); font-size: .82rem; }
.precio {
  border: 1px solid var(--borde); border-radius: 12px; padding: 8px 14px;
  color: var(--acento); font-weight: 700; font-size: 1.25rem; white-space: nowrap; background: var(--fondo);
}
.precio.consultar { font-size: .9rem; color: var(--texto-2); font-weight: 500; }
.separador { border-top: 1px dashed var(--borde); margin: 16px 0; }
.viaje-horario { display: grid; grid-template-columns: 1fr 2fr 1fr; align-items: center; text-align: center; }
.hora { font-size: 1.7rem; font-weight: 700; }
.lugar { color: var(--texto-2); font-size: .85rem; font-weight: 600; }
.trayecto { position: relative; display: flex; flex-direction: column; align-items: center; }
.trayecto .linea { width: 100%; height: 2px; background: var(--linea); position: relative; }
.trayecto .linea::before, .trayecto .linea::after {
  content: ""; position: absolute; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--linea);
}
.trayecto .linea::before { left: 0; }
.trayecto .linea::after { right: 0; }
.duracion {
  margin-top: 10px; background: #23272e; color: var(--acento); border-radius: 999px;
  padding: 3px 12px; font-size: .78rem; font-weight: 700;
}
.viaje-pie { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; font-size: .8rem; color: var(--texto-2); }
.etiqueta-manual { color: var(--aviso); }
.etiqueta-proximo { color: var(--ok); font-weight: 700; }
.etiqueta-salio { color: var(--texto-3); font-weight: 600; }
.viaje.proximo { border-color: var(--ok); }
.viaje.salio { opacity: .5; }
.precio-estudiante { color: var(--ok); font-weight: 600; }
.precio-estudiante em { color: var(--texto-3); font-style: normal; font-weight: 400; }
.viaje-pie a { color: var(--acento); text-decoration: none; }

/* Combinaciones con escala */
.aviso-escala { color: var(--aviso); font-size: .9rem; padding: 4px 4px 12px; }
.escala-titulo strong { display: block; color: var(--acento); font-size: 1.1rem; }
.escala-titulo small { color: var(--texto-2); font-size: .82rem; }
.escala-tramos { margin-top: 14px; border-top: 1px dashed var(--borde); padding-top: 14px; }
.tramo-escala { display: flex; align-items: center; gap: 12px; }
.numero-tramo {
  flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: .85rem;
}
.tramo-info { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: .88rem; color: var(--texto); }
.tramo-info small { color: var(--texto-2); font-size: .78rem; }
.tramo-info a { color: var(--acento); text-decoration: none; }
.tramo-precio { color: var(--texto-2); font-size: .85rem; white-space: nowrap; }
.escala-espera { margin: 8px 0 8px 40px; color: var(--aviso); font-size: .8rem; }

.vacio, .aviso { text-align: center; color: var(--texto-2); padding: 28px 16px; }
.vacio-propuesta { margin: 12px 0 0; font-size: .88rem; }
.vacio-propuesta a { color: var(--ok); }
.aviso { color: var(--aviso); padding: 10px; font-size: .9rem; }
.cargando-texto { text-align: center; color: var(--texto-2); padding: 30px; }

.pie-pagina { text-align: center; color: var(--texto-3); font-size: .78rem; margin-top: 40px; }
.pie-pagina a { color: var(--texto-2); }
.pie-pagina p { margin: 14px 0 0; }
.boton-propuesta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--ok); border-radius: 999px; padding: 10px 18px;
  color: var(--ok) !important; font-size: .9rem; font-weight: 600; text-decoration: none;
  transition: background .2s;
}
.boton-propuesta:hover { background: rgba(79, 191, 138, .1); }
.botones-pie { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.boton-compartir-pagina {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 11px 20px;
  background: var(--acento-fuerte); color: var(--texto) !important; font-size: .9rem; font-weight: 600;
  text-decoration: none; transition: background .2s;
}
.boton-compartir-pagina:hover { background: var(--acento-hover); }

@media (max-width: 780px) {
  .fila-busqueda { flex-direction: column; }
  .fila-busqueda .boton-primario { width: 100%; }
}

@media (max-width: 640px) {
  .hora { font-size: 1.35rem; }
  .semana { gap: 4px; }
  .dia { padding: 6px 2px; }
  .precio { font-size: 1.05rem; }
  .boton-propuesta, .boton-compartir-pagina { width: 100%; }
}

@media (max-width: 420px) {
  .dia .desde { display: none; }   /* no entra en siete columnas */
}
