@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&family=Inter:wght@400;500;600;700&display=swap");

:root {
  /* Superficies */
  --bg: #eef2fd;
  --surface: #ffffff;
  --surface-tint: #f2f4fd;
  --border: #e4e8f7;
  --text: #171a33;
  --muted: #7b81a3;
  --muted-dark: #565c80;
  --overlay-bg: #151733; /* fondo oscuro dedicado para overlays (PIN, modales) */

  /* Marca — azul→índigo con degradado (igual que el diseño de referencia) */
  --brand: #6c5ce7;
  --brand-deep: #4c3fd6;
  --brand-light: #8b7bff;
  --brand-soft: rgba(108, 92, 231, 0.12);
  --brand-navy: #171a33;
  --grad-brand: linear-gradient(100deg, #3f8ef7 0%, #7367f5 100%);

  /* Colores por categoría (cada sección, su color) */
  --cat-flights: #3b82f6;
  --cat-flights-a: #7cb0fb;
  --cat-hotels: #14b8a6;
  --cat-hotels-a: #5ed9cb;
  --cat-itinerary: #6c5ce7;
  --cat-itinerary-a: #a79bff;
  --cat-transport: #f97316;
  --cat-transport-a: #fdba74;
  --cat-reservations: #ef4444;
  --cat-reservations-a: #fca5a5;
  --cat-expenses: #f59e0b;
  --cat-expenses-a: #fcd34d;
  --cat-checklist: #22c55e;
  --cat-checklist-a: #86efac;
  --cat-calendar: #5c7cfa;
  --cat-map: #06b6d4;

  /* Tipos de actividad del itinerario, como en la maqueta
     (Museo = cian, Restaurante = coral, Monumento = índigo, ...) */
  --tag-sight: #2fb8c4;
  --tag-sight-soft: #c7f0f2;
  --tag-food: #f3703a;
  --tag-food-soft: #fdd9cc;
  --tag-monument: #6c5ce7;
  --tag-monument-soft: #e4dcff;
  --tag-lodging: #d9822b;
  --tag-lodging-soft: #f7ddb8;
  --tag-nature: #2ea86b;
  --tag-nature-soft: #cdf0dc;
  --tag-shopping: #d94f8c;
  --tag-shopping-soft: #f8d3e4;
  --tag-other: #5c7cfa;
  --tag-other-soft: #dbe3ff;

  --teal: #14b8a6;
  --rose: #ef4444;

  --font-display: "Plus Jakarta Sans", "Inter", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --font-body: "Inter", -apple-system, system-ui, sans-serif;

  --radius-card: 22px;
  --radius-btn: 16px;
  --shadow-card: 0 10px 30px rgba(23, 26, 51, 0.07);
  --shadow-brand: 0 10px 24px rgba(92, 79, 220, 0.32);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);

  /* Fondo "viaje + espacio" */
  --space-wash: linear-gradient(180deg, #dfe7fb 0%, #eef2fd 38%, #eef2fd 100%);
  --space-wash-solid: #eef2fd;
  --space-star-color: #6c5ce7;
  --space-nebula-1: #7cb0fb;
  --space-nebula-2: #a79bff;
  --space-nebula-3: #f5a9c9;
  --space-route-color: rgba(76, 63, 214, 0.28);
  --space-waypoint-color: rgba(76, 63, 214, 0.55);
  --space-plane-color: rgba(76, 63, 214, 0.7);
  --space-planet-opacity: 0.55;
  --space-moon-opacity: 0.55;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14132b;
    --surface: #1e1c3d;
    --surface-tint: #272451;
    --border: #322f5c;
    --text: #f3f1ff;
    --muted: #a5a3c9;
    --muted-dark: #8785b3;
    --overlay-bg: #0d0c22;

    --space-wash: linear-gradient(180deg, #0b0c22 0%, #14132b 45%, #14132b 100%);
    --space-wash-solid: #14132b;
    --space-star-color: #ffffff;
    --space-nebula-1: #4c3fd6;
    --space-nebula-2: #3f8ef7;
    --space-nebula-3: #b4508f;
    --space-route-color: rgba(139, 123, 255, 0.35);
    --space-waypoint-color: rgba(167, 155, 255, 0.75);
    --space-plane-color: rgba(210, 200, 255, 0.85);
    --space-planet-opacity: 0.85;
    --space-moon-opacity: 0.85;
  }
}

/* Tema elegido a mano desde Ajustes → Tema (anula el automático del
   sistema). Sin el atributo data-theme, la app sigue el tema del
   sistema como hasta ahora. */
:root[data-theme="dark"] {
  --bg: #10122a;
  --surface: #1b1e3d;
  --surface-tint: #252950;
  --border: #2f3460;
  --text: #f1f2ff;
  --muted: #a2a7ce;
  --muted-dark: #8b90bb;
  --overlay-bg: #0b0d1f;
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.35);

  --space-wash: linear-gradient(180deg, #090a1e 0%, #10122a 45%, #10122a 100%);
  --space-wash-solid: #10122a;
  --space-star-color: #ffffff;
  --space-nebula-1: #4c3fd6;
  --space-nebula-2: #3f8ef7;
  --space-nebula-3: #b4508f;
  --space-route-color: rgba(139, 123, 255, 0.35);
  --space-waypoint-color: rgba(167, 155, 255, 0.75);
  --space-plane-color: rgba(210, 200, 255, 0.85);
  --space-planet-opacity: 0.85;
  --space-moon-opacity: 0.85;
}

:root[data-theme="light"] {
  --bg: #eef2fd;
  --surface: #ffffff;
  --surface-tint: #f2f4fd;
  --border: #e4e8f7;
  --text: #171a33;
  --muted: #7b81a3;
  --muted-dark: #565c80;
  --overlay-bg: #151733;
  --shadow-card: 0 10px 30px rgba(23, 26, 51, 0.07);

  --space-wash: linear-gradient(180deg, #dfe7fb 0%, #eef2fd 38%, #eef2fd 100%);
  --space-wash-solid: #eef2fd;
  --space-star-color: #6c5ce7;
  --space-nebula-1: #7cb0fb;
  --space-nebula-2: #a79bff;
  --space-nebula-3: #f5a9c9;
  --space-route-color: rgba(76, 63, 214, 0.28);
  --space-waypoint-color: rgba(76, 63, 214, 0.55);
  --space-plane-color: rgba(76, 63, 214, 0.7);
  --space-planet-opacity: 0.55;
  --space-moon-opacity: 0.55;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  height: 100%;
}

/* ============================================================
   FONDO "VIAJE + ESPACIO"
   Capa fija detrás de #app: cielo con degradado, nebulosas suaves,
   estrellas (algunas titilan), un planeta/luna flotando y una ruta
   de vuelo punteada con un avioncito recorriéndola en bucle.
   Puramente decorativo — no captura clics ni afecta el layout.
   ============================================================ */

/* ============================================================
   FONDO "VIAJE + ESPACIO" (versión realista)
   Capa fija detrás de #app: cielo con degradado, banda de vía
   láctea con textura de ruido, nebulosas con textura real
   (feTurbulence), estrellas de colores con halo, una Tierra con
   continentes/nubes/atmósfera, una luna con cráteres, una ruta de
   vuelo tipo mapa aéreo con pines y avión, y estrellas fugaces
   ocasionales. Puramente decorativo — no captura clics ni afecta
   el layout.
   ============================================================ */

.space-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  /* Fuerza su propia capa de composición: los filtros SVG
     (feTurbulence de las nebulosas/estrellas) son caros de calcular,
     y sin esto Safari en iOS puede volver a rasterizarlos en cada
     frame de scroll en vez de tratarlos como una capa fija estática,
     lo que se nota como tirones al desplazarse por la app. */
  transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
}

.space-bg__wash {
  position: absolute;
  inset: 0;
  background: var(--space-wash);
  transition: background 0.4s ease;
}

.space-bg__milkyway,
.space-bg__stars,
.space-bg__route {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.space-bg__milkyway rect { fill: #ffffff; }

.tp-star-tw {
  animation: tp-twinkle 4.5s ease-in-out infinite;
}
.tp-star-tw2 {
  animation-duration: 6.5s;
}
.tp-star-tw:nth-of-type(3n) { animation-delay: -1.4s; }
.tp-star-tw:nth-of-type(5n) { animation-delay: -2.8s; }
.tp-star-tw:nth-of-type(7n) { animation-delay: -3.6s; }

@keyframes tp-twinkle {
  0%, 100% { opacity: 0.3; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Tierra: esfera con océano, continentes, nubes en movimiento suave
   y un halo de atmósfera. */
.space-bg__earth {
  position: absolute;
  top: -68px;
  right: -58px;
  width: 220px;
  height: 220px;
  opacity: var(--space-planet-opacity);
  animation: tp-float 11s ease-in-out infinite;
}
.space-bg__earth svg { width: 100%; height: 100%; display: block; }
.space-bg__earth g[filter="url(#tp-earth-clouds)"],
.space-bg__earth ellipse {
  animation: tp-clouds-drift 60s linear infinite;
  transform-origin: 110px 110px;
}

@keyframes tp-clouds-drift {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Luna: esfera gris con cráteres y sombra de fase. */
.space-bg__moon {
  position: absolute;
  bottom: 10%;
  left: -46px;
  width: 120px;
  height: 120px;
  opacity: var(--space-moon-opacity);
  animation: tp-float 13s ease-in-out infinite;
  animation-delay: -5s;
}
.space-bg__moon svg { width: 100%; height: 100%; display: block; }

@keyframes tp-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(16px); }
}

/* Ruta de vuelo tipo mapa aéreo: línea punteada, pines de origen/
   destino y avión que la recorre en bucle con sombra propia. */
.space-bg__route-line {
  fill: none;
  stroke: var(--space-route-color);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 2 13;
}

.space-bg__waypoint {
  fill: var(--space-waypoint-color);
}

.space-bg__waypoint-pin path {
  fill: var(--space-waypoint-color);
}

.space-bg__plane {
  fill: var(--space-plane-color);
  offset-path: path("M70,1500 C260,1360 120,1120 320,980 C480,870 360,700 560,560 C680,478 620,340 760,220");
  offset-rotate: auto;
  animation: tp-fly 24s linear infinite;
}

@keyframes tp-fly {
  0% { offset-distance: 0%; opacity: 0; }
  4% { opacity: 1; }
  96% { opacity: 1; }
  100% { offset-distance: 100%; opacity: 0; }
}

/* Estrellas fugaces: cruzan el cielo de vez en cuando y desaparecen. */
.space-bg__shooting-star {
  position: absolute;
  top: 18%;
  left: 12%;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4);
  opacity: 0;
  animation: tp-shoot 9s ease-in infinite;
  animation-delay: 2s;
}
.space-bg__shooting-star::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  width: 90px;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), #ffffff);
  transform: translateY(-50%);
}
.space-bg__shooting-star--2 {
  top: 62%;
  left: 68%;
  animation-duration: 13s;
  animation-delay: 7s;
}

@keyframes tp-shoot {
  0%, 92%, 100% { opacity: 0; transform: translate(0, 0); }
  93% { opacity: 1; }
  97% { opacity: 0.9; transform: translate(-160px, 130px); }
  98% { opacity: 0; transform: translate(-160px, 130px); }
}

@media (prefers-reduced-motion: reduce) {
  .tp-star-tw,
  .space-bg__plane,
  .space-bg__earth,
  .space-bg__earth ellipse,
  .space-bg__moon,
  .space-bg__shooting-star {
    animation: none !important;
  }
  .space-bg__shooting-star { display: none; }
}

body {
  overscroll-behavior-y: none;
  position: relative;
  overflow-x: hidden;
}

/* Las manchas de color decorativas de antes fueron reemplazadas por el
   fondo "viaje + espacio" (.space-bg, más abajo), que cumple el mismo
   papel de dar vida a las pantallas anchas sin interferir con el
   contenido. */

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

button {
  font-family: inherit;
  cursor: pointer;
}

a { color: inherit; }

::selection {
  background: var(--brand);
  color: #fff;
}

.icon-svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  vertical-align: -3px;
}

.stat-icon {
  color: var(--accent, var(--brand));
  margin-right: 5px;
  width: 15px;
  height: 15px;
}

.panel-icon {
  color: var(--accent, var(--brand));
  margin-right: 7px;
  width: 17px;
  height: 17px;
}

/* ============================================================
   TOP BAR
   ============================================================ */

.topbar {
  padding: calc(16px + var(--safe-top)) 20px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, var(--bg) 72%, rgba(238, 242, 253, 0));
}

.topbar .icon-btn {
  flex-shrink: 0;
}

.topbar-titles {
  flex: 1;
  min-width: 0;
}

.topbar-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  box-shadow: 0 2px 6px rgba(32, 31, 61, 0.05);
}

.icon-btn:hover {
  border-color: var(--brand);
  box-shadow: 0 4px 12px rgba(232, 114, 42, 0.18);
}
.icon-btn:active { transform: scale(0.94); }

.icon-btn.logged-in {
  position: relative;
  border-color: var(--cat-hotels);
}
.icon-btn.logged-in::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--cat-hotels);
  border: 2px solid var(--surface);
}

/* ============================================================
   CONTENIDO
   ============================================================ */

.view {
  flex: 1;
  padding: 4px 20px 110px;
}

.view.no-tabbar { padding-bottom: 40px; }

.section-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  margin: 22px 0 10px;
}

.section-title:first-child { margin-top: 6px; }

/* ============================================================
   TARJETAS DE ELEMENTOS (vuelos, hoteles, itinerario...)
   Estilo "Wanderlog": tarjeta redondeada + insignia de color por
   categoría en vez del billete de embarque anterior.
   ============================================================ */

.ticket {
  position: relative;
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: 0 8px 20px rgba(32, 31, 61, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

@media (hover: hover) {
  .ticket:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(32, 31, 61, 0.1);
  }
}

/* Colores por categoría: cada una define su propio degradado */
.ticket.cat-flights      { --accent-a: var(--cat-flights-a);      --accent-b: var(--cat-flights);      --accent: var(--cat-flights); }
.ticket.cat-hotels       { --accent-a: var(--cat-hotels-a);       --accent-b: var(--cat-hotels);       --accent: var(--cat-hotels); }
.ticket.cat-itinerary    { --accent-a: var(--cat-itinerary-a);    --accent-b: var(--cat-itinerary);    --accent: var(--cat-itinerary); }
.ticket.cat-transport    { --accent-a: var(--cat-transport-a);    --accent-b: var(--cat-transport);    --accent: var(--cat-transport); }
.ticket.cat-checklist    { --accent-a: var(--cat-checklist-a);    --accent-b: var(--cat-checklist);    --accent: var(--cat-checklist); }
.ticket.cat-reservations { --accent-a: var(--cat-reservations-a); --accent-b: var(--cat-reservations); --accent: var(--cat-reservations); }
.ticket.cat-expenses     { --accent-a: var(--cat-expenses-a);     --accent-b: var(--cat-expenses);     --accent: var(--cat-expenses); }

.ticket-stub {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-a, var(--brand)), var(--accent-b, var(--brand-deep)));
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
  color: #fff;
  overflow: hidden;
}

.ticket-stub .stub-icon {
  display: flex;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.ticket-stub .icon-svg {
  width: 30px;
  height: 30px;
}

.ticket-stub.has-photo {
  background: var(--surface-tint);
}

.ticket-stub img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: photo-fade-in 0.4s ease;
}

.stub-date {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border-radius: 10px;
  padding: 2px 8px;
  display: flex;
  gap: 3px;
  align-items: baseline;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
}

.stub-day {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.stub-month {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
}

/* El talón perforado ya no se usa visualmente, se deja oculto por si
   quedara algún resto en el DOM. */
.ticket-divider { display: none; }

.ticket-body {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}

.ticket-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.ticket-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-amount {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--accent, var(--teal));
  flex-shrink: 0;
}

.ticket-meta {
  font-size: 13px;
  color: var(--muted-dark);
  margin: 3px 0 0;
  line-height: 1.5;
}

.ticket-meta .mono {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-tint);
  padding: 1px 6px;
  border-radius: 6px;
}

.ticket-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.ticket-actions button {
  border: none;
  background: var(--surface-tint);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 10px;
  transition: transform 0.15s ease, background 0.15s ease;
}
.ticket-actions button:hover { background: var(--brand-soft); color: var(--brand-deep); }
.ticket-actions button:active { transform: scale(0.95); }

.ticket-actions button.danger {
  background: rgba(250, 82, 82, 0.1);
  color: var(--rose);
}
.ticket-actions button.danger:hover { background: rgba(250, 82, 82, 0.18); }

.ticket.done { opacity: 0.55; }
.ticket.done .ticket-title { text-decoration: line-through; }

.ticket.compact { align-items: center; padding: 10px 14px; }
.ticket.compact .ticket-stub {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(116, 184, 22, 0.14);
  box-shadow: none;
}

/* ============================================================
   ARRASTRAR Y SOLTAR (itinerario, checklist)
   ============================================================ */

.drag-handle {
  flex-shrink: 0;
  width: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 16px;
  cursor: grab;
  touch-action: none;
  align-self: center;
}

.drag-ghost { opacity: 0.4; }

.sortable-chosen { box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18); }

/* ============================================================
   MAPA
   ============================================================ */

.map-pin {
  font-size: 20px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.leaflet-popup-content-wrapper {
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
}

.leaflet-popup-tip { background: var(--surface); }

/* ============================================================
   BOTONES
   ============================================================ */

.btn {
  border: none;
  border-radius: var(--radius-btn);
  padding: 13px 18px;
  font-weight: 700;
  font-size: 15px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

@media (hover: hover) {
  .btn:hover { filter: brightness(1.05); }
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: #fff;
  box-shadow: 0 8px 18px rgba(232, 114, 42, 0.3);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
@media (hover: hover) {
  .btn-secondary:hover { border-color: var(--brand); color: var(--brand-deep); }
}

.btn-danger {
  background: rgba(250, 82, 82, 0.12);
  color: var(--rose);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.fab {
  position: fixed;
  right: max(20px, calc((100vw - 560px) / 2 + 20px));
  bottom: calc(90px + var(--safe-bottom));
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: #fff;
  border: none;
  font-size: 26px;
  box-shadow: 0 12px 26px rgba(232, 114, 42, 0.4);
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
@media (hover: hover) {
  .fab:hover { transform: translateY(-2px) scale(1.03); }
}
.fab:active { transform: scale(0.95); }

/* ============================================================
   TARJETAS DE RESUMEN / DASHBOARD
   ============================================================ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 4px;
}

.stat-card {
  --accent: var(--brand);
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 14px 14px 18px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background: var(--accent);
}
@media (hover: hover) {
  .stat-card:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(32,31,61,0.1); }
}
.stat-card:active { transform: scale(0.97); }

.stat-card[data-nav="flights"] { --accent: var(--cat-flights); }
.stat-card[data-nav="hotels"] { --accent: var(--cat-hotels); }
.stat-card[data-nav="itinerary"] { --accent: var(--cat-itinerary); }
.stat-card[data-nav="transport"] { --accent: var(--cat-transport); }
.stat-card[data-nav="expenses"] { --accent: var(--cat-expenses); }

.stat-card-discover {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
  aspect-ratio: 5 / 4;
  padding: 10px;
}
.stat-card-discover::before {
  width: 100%;
  height: 5px;
  top: 0; left: 0; right: 0; bottom: auto;
}
.stat-card-discover-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.stat-card-discover .stat-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

.stat-card-discover-photo {
  background-size: cover;
  background-position: center;
  color: #fff;
}
.stat-card-discover-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 16, 33, 0.1), rgba(15, 16, 33, 0.6));
}
.stat-card-discover-photo .stat-card-discover-icon {
  /* ya hay una foto real de fondo: se oculta la ilustración de relleno */
  display: none;
}
.stat-card-discover-photo .stat-label {
  position: relative;
  z-index: 1;
  color: #fff;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--muted);
}

.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  margin-top: 4px;
  color: var(--accent);
}

.panel {
  --accent: var(--brand);
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px 16px 16px 20px;
  margin-top: 14px;
  overflow: hidden;
}
.panel[data-nav]::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background: var(--accent);
}
.panel[data-nav="map"] { --accent: var(--cat-map); }
.panel[data-nav="expenses"] { --accent: var(--cat-expenses); }
.panel[data-nav="checklist"] { --accent: var(--cat-checklist); }
.panel[data-nav="calendar"] { --accent: var(--cat-calendar); }

.panel[data-nav] { cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease; }
@media (hover: hover) {
  .panel[data-nav]:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(32,31,61,0.1); }
}
.panel[data-nav]:active { transform: scale(0.99); }

.panel h3 {
  font-family: var(--font-display);
  font-size: 15.5px;
  margin: 0 0 10px;
  font-weight: 700;
}

.progress-track {
  background: var(--surface-tint);
  border-radius: 10px;
  height: 10px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--cat-itinerary));
  border-radius: 10px;
  transition: width 0.3s ease;
}

.progress-fill.over { background: var(--rose); }

.agenda-line {
  font-size: 13.5px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
  display: flex;
  gap: 8px;
}
.agenda-line:last-child { border-bottom: none; }

.today-banner {
  background: linear-gradient(120deg, var(--cat-itinerary), var(--brand));
  color: #fff;
  border-radius: 18px;
  padding: 13px 16px;
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 14px;
  line-height: 1.5;
  box-shadow: 0 8px 18px rgba(232, 114, 42, 0.25);
}

/* ============================================================
   FORMULARIOS / MODAL
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(23, 20, 54, 0.55);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: modal-fade-in 0.22s ease both;
}

.modal-sheet {
  background: var(--surface);
  border-top-left-radius: 26px;
  border-top-right-radius: 26px;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 10px 20px calc(28px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  animation: modal-slide-up 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes modal-fade-in {
  from { background: rgba(23, 20, 54, 0); }
  to { background: rgba(23, 20, 54, 0.55); }
}

@keyframes modal-slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  margin: 8px auto 14px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  margin: 0 0 16px;
}

.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 13px;
  font-size: 15px;
  font-family: inherit;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.field textarea { min-height: 80px; resize: vertical; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
/* Sin esto, un <input type="date"> (con su propio ancho mínimo de
   contenido para "dd/mm/aaaa" + icono de calendario) puede forzar a
   su columna a crecer más allá de su 1fr, rompiendo la simetría de
   la fila y empujando la otra columna a otra línea. */
.field-row > .field {
  min-width: 0;
}

.field-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.field-check input {
  width: 20px;
  height: 20px;
  accent-color: var(--brand);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

/* ============================================================
   LISTA DE VIAJES (home) — tarjetas tipo postal, un color por viaje
   ============================================================ */

.trip-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 26px;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(32, 31, 61, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
@media (hover: hover) {
  .trip-card:hover { transform: translateY(-2px); box-shadow: 0 16px 32px rgba(32, 31, 61, 0.14); }
}
.trip-card:active { transform: scale(0.99); }

.trip-card-art {
  position: relative;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  color: #fff;
  overflow: hidden;
}

.trip-card-art-icon {
  position: relative;
  z-index: 1;
  display: flex;
}
.trip-card-art-icon .icon-svg {
  width: 38px;
  height: 38px;
}

.trip-card-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: photo-fade-in 0.4s ease;
}

.trip-card-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20, 19, 43, 0) 45%, rgba(20, 19, 43, 0.28) 100%);
}

.trip-countdown-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  background: rgba(255, 255, 255, 0.92);
  color: #201f3d;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 20px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}

.trip-countdown-badge.is-today {
  background: linear-gradient(135deg, #ffd43b, #fab005);
  color: #402c00;
}

@keyframes photo-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.trip-card.trip-color-1 .trip-card-art { background: linear-gradient(135deg, var(--cat-flights-a), var(--cat-flights)); }
.trip-card.trip-color-2 .trip-card-art { background: linear-gradient(135deg, var(--cat-hotels-a), var(--cat-hotels)); }
.trip-card.trip-color-3 .trip-card-art { background: linear-gradient(135deg, var(--cat-itinerary-a), var(--cat-itinerary)); }
.trip-card.trip-color-4 .trip-card-art { background: linear-gradient(135deg, var(--cat-transport-a), var(--cat-transport)); }
.trip-card.trip-color-5 .trip-card-art { background: linear-gradient(135deg, var(--cat-reservations-a), var(--cat-reservations)); }
.trip-card.trip-color-6 .trip-card-art { background: linear-gradient(135deg, var(--cat-checklist-a), var(--cat-checklist)); }

.trip-card .trip-dest {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  margin: 0;
  padding: 16px 18px 0;
}

.trip-card .trip-name {
  font-size: 13px;
  color: var(--muted);
  margin: 2px 0 10px;
  padding: 0 18px;
}

.trip-card .trip-dates {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text);
  background: var(--surface-tint);
  display: inline-block;
  padding: 4px 10px;
  border-radius: 8px;
  margin: 0 18px 16px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-state .emoji { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; line-height: 1.6; }

/* ============================================================
   CALENDARIO
   ============================================================ */

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cal-header .cal-month {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}

.cal-dow { font-size: 10.5px; color: var(--muted); padding-bottom: 4px; }

.cal-day {
  aspect-ratio: 1;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  background: var(--surface-tint);
  border: 1px solid transparent;
  position: relative;
}

.cal-day.empty { background: transparent; }
.cal-day.today { border-color: var(--brand); background: var(--brand-soft); }
.cal-day .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--brand);
  margin-top: 3px;
}
.cal-day.in-range { background: var(--brand-soft); }

.cal-agenda-day {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  margin: 16px 0 6px;
}

/* ============================================================
   MISC
   ============================================================ */

.pill-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.pill-row button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted-dark);
  font-size: 12.5px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 20px;
  transition: transform 0.15s ease, background 0.15s ease;
}
.pill-row button:active { transform: scale(0.96); }

.pill-row button.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.toast {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--overlay-bg);
  color: #fff;
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 600;
  z-index: 100;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
  max-width: 90%;
  text-align: center;
}

.hidden { display: none !important; }

/* ============================================================
   DESCUBRE (tarjetas de lugares/alojamiento sugeridos)
   ============================================================ */

.discover-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border, rgba(0, 0, 0, 0.08));
}

.discover-thumb {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--brand-soft);
}

.discover-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.discover-info {
  flex: 1;
  min-width: 0;
}

.discover-name {
  font-weight: 600;
  font-size: 13.5px;
  margin: 0 0 2px;
}

.discover-summary {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.discover-add {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.12));
  background: var(--brand-soft);
  font-size: 15px;
}

.discover-add:disabled {
  opacity: 0.6;
}

/* ============================================================
   SPLASH DE BIENVENIDA (logo + mensaje, ~1s al abrir la app)
   ============================================================ */

#splash-screen {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--bg);
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

#splash-screen.splash-hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Si el <head> detecta que esto es una recarga dentro de la misma
   sesión (no el primer arranque real), oculta el splash al instante
   por CSS — evita que llegue a pintarse ni un frame mientras el JS
   del final del body decide si lo retira del DOM. */
html.tp-skip-splash #splash-screen {
  display: none;
}

.splash-logo {
  width: 116px;
  height: 116px;
  border-radius: 28px;
  box-shadow: 0 16px 36px rgba(22, 33, 62, 0.28);
  animation: splash-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.splash-tag {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--muted-dark);
  margin: 0;
  letter-spacing: 0.01em;
  animation: fade-up-in 0.5s ease 0.15s both;
}

@keyframes splash-pop {
  0% { transform: scale(0.75); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .splash-logo, .splash-tag { animation: none; }
}

/* ============================================================
   PANTALLA DE ARRANQUE
   ============================================================ */

.boot-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  gap: 16px;
  color: var(--muted);
  text-align: center;
  padding: 0 30px;
}

.boot-badge {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  box-shadow: 0 10px 24px rgba(232, 114, 42, 0.35);
  animation: boot-float 2.2s ease-in-out infinite;
}

.boot-spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  animation: boot-spin 0.8s linear infinite;
}

@keyframes boot-spin { to { transform: rotate(360deg); } }
@keyframes boot-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* ============================================================
   ANIMACIÓN DE ENTRADA ESCALONADA
   El contenido de cada pantalla aparece con un ligero fundido en
   vez de aparecer de golpe. Se limita a los primeros elementos
   visibles para no complicar la hoja de estilos.
   ============================================================ */

.view > * {
  animation: fade-up-in 0.36s ease both;
}
.view > *:nth-child(1) { animation-delay: 0.02s; }
.view > *:nth-child(2) { animation-delay: 0.06s; }
.view > *:nth-child(3) { animation-delay: 0.1s; }
.view > *:nth-child(4) { animation-delay: 0.14s; }
.view > *:nth-child(5) { animation-delay: 0.18s; }
.view > *:nth-child(6) { animation-delay: 0.22s; }
.view > *:nth-child(7) { animation-delay: 0.26s; }
.view > *:nth-child(8) { animation-delay: 0.3s; }
.view > *:nth-child(n+9) { animation-delay: 0.32s; }

@keyframes fade-up-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   TRANSICIONES DESLIZANTES ENTRE PANTALLAS
   Usa la View Transitions API nativa: al navegar "hacia adelante"
   (abrir un viaje, entrar en una sección) el contenido nuevo entra
   desde la derecha; al ir "atrás" entra desde la izquierda, como en
   iOS/Android. En navegadores sin soporte no pasa nada raro: el
   cambio es instantáneo, igual que antes.
   ============================================================ */

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.32s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

:root[data-nav-dir="forward"]::view-transition-old(root) { animation-name: tp-slide-out-left; }
:root[data-nav-dir="forward"]::view-transition-new(root) { animation-name: tp-slide-in-right; }
:root[data-nav-dir="back"]::view-transition-old(root) { animation-name: tp-slide-out-right; }
:root[data-nav-dir="back"]::view-transition-new(root) { animation-name: tp-slide-in-left; }

@keyframes tp-slide-in-right {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes tp-slide-out-left {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(-25%); opacity: 0; }
}
@keyframes tp-slide-in-left {
  from { transform: translateX(-100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes tp-slide-out-right {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(25%); opacity: 0; }
}

/* ============================================================
   PANTALLA DE IMPRESIÓN
   ============================================================ */

@media print {
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area {
    position: absolute;
    top: 0; left: 0; width: 100%;
    color: #111;
    background: #fff;
  }
}

#print-area { display: none; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

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

/* ============================================================
   DESLIZAR PARA RECARGAR (pull-to-refresh)
   Círculo fijo en la parte superior que gira según lo que arrastras
   y, al pasar el umbral, gira a velocidad constante mientras recarga.
   ============================================================ */

.ptr-indicator {
  position: fixed;
  top: calc(6px + var(--safe-top));
  left: 50%;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 8px 18px rgba(32, 31, 61, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  opacity: 0;
  transform: translate(-50%, -60px);
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.ptr-indicator.ptr-visible {
  opacity: 1;
}

.ptr-indicator .ptr-ring {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid var(--border);
  border-top-color: var(--brand);
}

.ptr-indicator.ptr-spinning .ptr-ring {
  animation: ptr-spin 0.7s linear infinite;
}

@keyframes ptr-spin {
  to { transform: rotate(360deg); }
}

/* --- Lista vertical de viajes ("Ver todos") --- */
.trip-list { display: grid; gap: 12px; }
.trip-list .trip-card { margin: 0; }
.trip-list .trip-card-art { height: 132px; }
.trip-list .trip-meta { flex-direction: row; gap: 14px; }

/* --- Banner "Descubre" del resumen --- */
.discover-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  color: var(--text);
  background-size: cover;
  background-position: center;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
.discover-banner.has-photo { color: #fff; border-color: transparent; }
.discover-banner.has-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(100deg, rgba(10, 18, 40, 0.85), rgba(10, 18, 40, 0.4));
}
.discover-banner-inner b {
  display: block;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.discover-banner-inner small {
  display: block;
  font-size: 12px;
  opacity: 0.85;
  margin-top: 3px;
}
.discover-banner-go { margin-left: auto; opacity: 0.8; }

/* --- Anillo de gastos por categoría --- */
.donut { flex-shrink: 0; }

/* ============================================================
   ============================================================
   CAPA DE REDISEÑO  ·  "Travel Planner" (maqueta de referencia)
   Hero con foto, tarjetas blancas muy redondeadas, acentos
   índigo/violeta, chips de día y barra inferior con botón
   central. Va al final del archivo para poder ajustar los
   componentes anteriores sin tocarlos.
   ============================================================
   ============================================================ */

/* ---------- Tipografía general ---------- */

.topbar-title,
.section-title,
.modal-title,
.trip-card .trip-dest,
.ticket-title,
.panel h3 {
  letter-spacing: -0.015em;
}

.section-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 0 12px;
}

/* ---------- HERO (cabecera con foto) ---------- */

.hero {
  position: relative;
  margin: 0 0 6px;
  padding: calc(18px + var(--safe-top)) 20px 22px;
  overflow: hidden;
  border-bottom-left-radius: 30px;
  border-bottom-right-radius: 30px;
  background: linear-gradient(135deg, #2b2f6b, #4b4fae);
  color: #fff;
  isolation: isolate;
}

.hero-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
  animation: photo-fade-in 0.5s ease;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(12, 14, 40, 0.55) 0%, rgba(12, 14, 40, 0.25) 45%, rgba(12, 14, 40, 0.78) 100%);
}

.hero-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-brand {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero-logo {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  object-fit: cover;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3);
}

.hero-brand-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  margin: 0;
  line-height: 1.15;
}

.hero-brand-tag {
  font-size: 11.5px;
  margin: 1px 0 0;
  opacity: 0.8;
}

.hero .icon-btn {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
  backdrop-filter: blur(8px);
  box-shadow: none;
}
.hero .icon-btn:hover {
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}
.hero .icon-btn.logged-in { border-color: var(--cat-hotels-a); }
.hero .icon-btn.logged-in::after { border-color: rgba(255, 255, 255, 0.5); }

.hero-greeting {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  margin: 16px 0 14px;
  line-height: 1.35;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.hero-greeting-q {
  display: block;
  margin-top: 2px;
  font-size: 13.5px;
  font-weight: 500;
  opacity: 0.85;
}

.hero-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 11px 16px;
  backdrop-filter: blur(10px);
  margin-bottom: 14px;
}

.hero-search svg { opacity: 0.85; flex-shrink: 0; }

.hero-search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  outline: none;
}
.hero-search input::placeholder { color: rgba(255, 255, 255, 0.75); }

.hero-cta {
  width: 100%;
  border: none;
  border-radius: 999px;
  background: var(--grad-brand);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-brand);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.hero-cta:active { transform: scale(0.98); }
@media (hover: hover) { .hero-cta:hover { filter: brightness(1.06); } }

/* Botón "Planificar viaje con IA" — CTA propia entre la búsqueda y
   "Mis viajes", con el mismo lenguaje visual que el resto de la app
   (degradado de marca, esquinas grandes, sombra suave). */
.ai-plan-cta {
  width: 100%;
  border: none;
  border-radius: 20px;
  background: var(--grad-brand);
  color: #fff;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 16px;
  margin: 2px 0 20px;
  box-shadow: var(--shadow-brand);
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.ai-plan-cta::after {
  /* Un halo suave, como un "destello" de IA, en la esquina —
     puramente decorativo, sin depender de ninguna imagen externa. */
  content: "";
  position: absolute;
  top: -30px;
  right: -30px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}
.ai-plan-cta:active { transform: scale(0.98); }
@media (hover: hover) { .ai-plan-cta:hover { filter: brightness(1.06); } }

.ai-plan-cta-art {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  backdrop-filter: blur(4px);
}

.ai-plan-cta-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ai-plan-cta-text strong {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}
.ai-plan-cta-text span {
  font-size: 12px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}

.ai-plan-cta-arrow {
  flex-shrink: 0;
  opacity: 0.85;
}
.ai-plan-cta-arrow .icon-svg { width: 18px; height: 18px; }

/* Hero de un viaje concreto (detalle) */

.hero-trip { padding-bottom: 26px; }

.hero-trip-status {
  display: inline-block;
  background: var(--cat-hotels);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  margin-top: 26px;
  box-shadow: 0 6px 14px rgba(20, 184, 166, 0.35);
}

.hero-trip-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  margin: 8px 0 6px;
  line-height: 1.15;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
}

.hero-trip-meta {
  font-size: 13px;
  margin: 0;
  opacity: 0.92;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Fila de estadísticas flotante bajo el hero */

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
  margin: -42px 0 10px;
  position: relative;
  z-index: 5;
}

.hero-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 11px 6px 10px;
  text-align: center;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease;
}
.hero-stat:active { transform: scale(0.96); }

.hero-stat .hs-icon {
  color: var(--accent, var(--brand));
  display: flex;
  justify-content: center;
  margin-bottom: 5px;
}
.hero-stat .hs-icon .icon-svg { width: 17px; height: 17px; }

.hero-stat .hs-label {
  font-size: 10.5px;
  color: var(--muted);
  display: block;
  margin-bottom: 2px;
}

.hero-stat .hs-value {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
}

/* ---------- Topbar más discreta (pantallas internas) ---------- */

.topbar { padding-top: calc(14px + var(--safe-top)); }

.topbar-eyebrow {
  font-family: var(--font-body);
  letter-spacing: 0.02em;
  font-size: 11.5px;
  font-weight: 600;
}

.topbar-title { font-size: 22px; font-weight: 800; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  box-shadow: var(--shadow-card);
}
.icon-btn:hover {
  border-color: var(--brand);
  box-shadow: 0 6px 16px rgba(108, 92, 231, 0.2);
}

/* ---------- Tarjetas de viaje (inicio) ---------- */

.trip-card {
  border-radius: 24px;
  box-shadow: var(--shadow-card);
  border-color: transparent;
}

.trip-card-art { height: 132px; }

.trip-card-art::after {
  background: linear-gradient(180deg, rgba(14, 16, 40, 0) 40%, rgba(14, 16, 40, 0.45) 100%);
}

.trip-countdown-badge {
  background: rgba(255, 255, 255, 0.95);
  color: var(--brand-deep);
  border-radius: 999px;
  font-weight: 700;
}
.trip-countdown-badge.is-today {
  background: var(--grad-brand);
  color: #fff;
}

.trip-card .trip-dest { font-size: 19px; font-weight: 800; padding-top: 14px; }
.trip-card .trip-name { font-size: 12.5px; }

.trip-card .trip-dates {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-dark);
  background: var(--surface-tint);
  border-radius: 999px;
  padding: 5px 12px;
}

/* ---------- Tarjetas de elemento ---------- */

.ticket {
  border-radius: var(--radius-card);
  border-color: transparent;
  box-shadow: var(--shadow-card);
  padding: 13px;
}

.ticket-stub { border-radius: 18px; }

.ticket-stub.has-photo { box-shadow: 0 6px 14px rgba(23, 26, 51, 0.15); }

.stub-date { border-radius: 999px; }
.stub-day, .stub-month { font-family: var(--font-body); font-weight: 700; }

.ticket-title { font-size: 16px; font-weight: 700; }

.ticket-amount {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 800;
}

.ticket-meta .mono {
  font-family: var(--font-body);
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 8px;
}

.ticket-actions button {
  border-radius: 999px;
  padding: 7px 13px;
  background: var(--surface-tint);
}
.ticket-actions button:hover { background: var(--brand-soft); color: var(--brand-deep); }

/* Etiqueta de categoría de color (Museo, Restaurante, Monumento…) */

.tag-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent, var(--brand)) 15%, transparent);
  color: var(--accent, var(--brand));
  margin-top: 4px;
}

/* ---------- Botones ---------- */

.btn { border-radius: 999px; padding: 14px 18px; }

.btn-primary {
  background: var(--grad-brand);
  box-shadow: var(--shadow-brand);
}

.btn-secondary { border-radius: 999px; }
@media (hover: hover) {
  .btn-secondary:hover { border-color: var(--brand); color: var(--brand-deep); }
}

.fab {
  background: var(--grad-brand);
  box-shadow: var(--shadow-brand);
  font-size: 28px;
}

/* ---------- Tarjetas de resumen / paneles ---------- */

.stat-card {
  border-radius: 20px;
  border-color: transparent;
  box-shadow: var(--shadow-card);
  padding: 14px;
}
.stat-card::before {
  left: 0; top: auto; bottom: 0; right: 0;
  width: auto;
  height: 4px;
  background: var(--accent);
  opacity: 0.9;
}
.stat-card-discover::before { height: 4px; top: auto; bottom: 0; }

.stat-card .stat-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.stat-card .stat-value { font-size: 25px; font-weight: 800; color: var(--text); }

.panel {
  border-radius: 22px;
  border-color: transparent;
  box-shadow: var(--shadow-card);
  padding: 16px;
  margin-top: 12px;
}
.panel[data-nav]::before {
  left: 0; top: 0; bottom: auto; right: 0;
  width: auto;
  height: 4px;
}
.panel h3 { font-size: 15px; font-weight: 800; }

.progress-track { border-radius: 999px; }
.progress-fill { background: var(--grad-brand); }

.today-banner {
  background: var(--grad-brand);
  border-radius: 20px;
  box-shadow: var(--shadow-brand);
}

/* ---------- Chips (días del itinerario, filtros) ---------- */

.pill-row {
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}
.pill-row::-webkit-scrollbar { display: none; }

.pill-row button {
  flex-shrink: 0;
  border-radius: 16px;
  padding: 9px 15px;
  font-size: 12.5px;
  background: var(--surface);
  border-color: transparent;
  box-shadow: var(--shadow-card);
  line-height: 1.25;
}

.pill-row button.active {
  background: var(--grad-brand);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-brand);
}

/* ---------- Formularios ---------- */

.field input,
.field select,
.field textarea {
  border-radius: 14px;
  padding: 13px 14px;
  background: var(--surface-tint);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--brand);
}

.modal-sheet {
  border-top-left-radius: 30px;
  border-top-right-radius: 30px;
}

/* ---------- Barra inferior de navegación ---------- */

.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: end;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 9px 6px calc(8px + var(--safe-bottom));
  box-shadow: 0 -8px 26px rgba(23, 26, 51, 0.08);
}

.tabbar button {
  border: none;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 4px 0;
  transition: color 0.15s ease, transform 0.15s ease;
}
.tabbar button:active { transform: scale(0.92); }
.tabbar button .icon-svg { width: 21px; height: 21px; }

.tabbar button.active { color: var(--brand); }

.tabbar button.tab-center {
  position: relative;
  color: #fff;
  font-size: 0;
  gap: 0;
}
.tabbar button.tab-center span {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--grad-brand);
  color: #fff;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-brand);
  margin-top: -30px;
  border: 4px solid var(--surface);
}

.view.has-tabbar { padding-bottom: calc(104px + var(--safe-bottom)); }

/* Con barra inferior, el botón flotante sube para no solaparse */
.has-tabbar ~ #fab-slot .fab { bottom: calc(104px + var(--safe-bottom)); }

/* ---------- Estado vacío ---------- */

.empty-state .emoji { font-size: 44px; }
.empty-state p { font-size: 14px; }

/* ---------- Pie de marca del inicio ---------- */

.home-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  padding: 22px 0 6px;
}
.home-footer strong {
  font-family: var(--font-display);
  color: var(--muted-dark);
  font-weight: 800;
}

/* ============================================================
   ============================================================
   CAPA DE REDISEÑO 2  ·  fidelidad estricta a la maqueta
   Carrusel de viajes, próximos eventos, chips de día del
   itinerario y timeline con iconos de categoría.
   ============================================================
   ============================================================ */

/* ---------- Encabezado de sección con "Ver todos" ---------- */

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 12px;
}
.section-title-row .section-title { margin: 0; }

.btn-icon-inline {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon-inline:active { transform: scale(0.94); }

.see-all {
  border: none;
  background: transparent;
  color: var(--brand);
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 2px;
}
.see-all .icon-svg { width: 14px; height: 14px; transition: transform 0.2s ease; }
.see-all.expanded .icon-svg { transform: rotate(90deg); }

/* ---------- Carrusel horizontal de viajes ---------- */

.trip-carousel {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-bottom: 4px;
  margin: 0 -20px;
  padding-left: 20px;
  padding-right: 20px;
  -webkit-overflow-scrolling: touch;
}
.trip-carousel::-webkit-scrollbar { display: none; }
.trip-carousel .trip-card {
  flex: 0 0 auto;
  width: 210px;
  scroll-snap-align: start;
  margin-bottom: 0;
}
.trip-carousel.expanded {
  flex-wrap: wrap;
  overflow: visible;
  margin: 0;
  padding: 0;
}
.trip-carousel.expanded .trip-card { width: 100%; }

.trip-meta-row {
  display: flex;
  gap: 12px;
  padding: 0 16px;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}
.trip-meta-row span { display: flex; align-items: center; gap: 4px; }
.trip-meta-row .stat-icon { width: 13px; height: 13px; margin: 0; color: var(--muted); }

.trip-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 16px;
}
.trip-progress-row .progress-track { flex: 1; height: 6px; margin: 0; }
.trip-progress-row span {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted-dark);
  flex-shrink: 0;
}

/* ---------- Próximos eventos ---------- */

.event-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: 18px;
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.event-row:active { transform: scale(0.98); }

.event-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--grad-brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.event-icon .icon-svg { width: 19px; height: 19px; }

.event-body { flex: 1; min-width: 0; }
.event-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.event-sub { font-size: 12px; color: var(--muted); margin: 2px 0 0; }

.event-chevron { color: var(--muted); flex-shrink: 0; }
.event-chevron .icon-svg { width: 16px; height: 16px; }

/* ---------- Logo del hero (avión + ruta hasta el destino) ---------- */

.hero-logo {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--grad-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}
.hero-logo .icon-svg { width: 21px; height: 21px; }

.hero-avatar { font-size: 18px; }

/* ============================================================
   ITINERARIO — chips de día + timeline con iconos de categoría
   ============================================================ */

.day-chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -20px 16px;
  padding: 2px 20px 4px;
  -webkit-overflow-scrolling: touch;
}
.day-chip-row::-webkit-scrollbar { display: none; }

.day-chip {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 16px;
  padding: 9px 14px;
  text-align: center;
  min-width: 64px;
  box-shadow: var(--shadow-card);
}
.day-chip .dc-num { display: block; font-size: 12.5px; font-weight: 800; color: var(--text); }
.day-chip .dc-date { display: block; font-size: 10px; font-weight: 600; color: var(--muted); margin-top: 1px; }

.day-chip.active {
  background: var(--grad-brand);
  border-color: transparent;
  box-shadow: var(--shadow-brand);
}
.day-chip.active .dc-num,
.day-chip.active .dc-date { color: #fff; }

.day-banner {
  position: relative;
  height: 96px;
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-end;
  padding: 14px 16px;
  color: #fff;
  background: linear-gradient(135deg, #2b2f6b, #4b4fae);
}
.day-banner img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}
.day-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(10, 12, 30, 0.05) 30%, rgba(10, 12, 30, 0.75) 100%);
}
.day-banner-title { font-size: 15.5px; font-weight: 800; margin: 0; }
.day-banner-sub {
  font-size: 12px;
  margin: 3px 0 0;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 5px;
}
.day-banner-sub .icon-svg { width: 13px; height: 13px; }

.timeline {
  position: relative;
}

.tl-row {
  display: flex;
  gap: 12px;
  padding-bottom: 20px;
  position: relative;
}
.tl-row:last-child { padding-bottom: 4px; }

.tl-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 34px;
}
.tl-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  z-index: 1;
}
.tl-dot .icon-svg { width: 13px; height: 13px; }
.tl-line {
  flex: 1;
  width: 2px;
  background: var(--border);
  margin-top: 2px;
}
.tl-row:last-child .tl-line { display: none; }

.tl-cat-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text);
}
.tl-cat-icon .icon-svg { width: 19px; height: 19px; }

.tl-content { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 10px; }
.tl-info { flex: 1; min-width: 0; }
.tl-time { font-size: 11.5px; color: var(--muted); font-weight: 600; margin: 0; }
.tl-title { font-size: 15px; font-weight: 700; margin: 2px 0 5px; }
.tl-addr { font-size: 12px; color: var(--muted); margin: 5px 0 0; }

.tl-thumb {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-tint);
}

.tl-menu {
  color: var(--muted);
  flex-shrink: 0;
  padding: 4px;
  margin-left: 2px;
}
.tl-menu .icon-svg { width: 15px; height: 15px; }

/* ============================================================
   GASTOS — segmentado, total, donut y lista reciente
   ============================================================ */

.segmented {
  display: flex;
  background: var(--surface-tint);
  border-radius: 16px;
  padding: 4px;
  margin-bottom: 16px;
  gap: 4px;
}
.segmented button {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 9px 10px;
  border-radius: 12px;
  transition: background 0.15s ease, color 0.15s ease;
}
.segmented button.active {
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--shadow-card);
}

.expense-total-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow-card);
  margin-bottom: 14px;
}
.expense-total-card .et-label { font-size: 12.5px; color: var(--muted); margin: 0; }
.expense-total-card .et-amount {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  margin: 2px 0 10px;
  letter-spacing: -0.5px;
}
.expense-total-card .et-progress-row {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 6px;
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
}
.donut-wrap .donut { flex-shrink: 0; }
.donut-legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; }
.donut-legend > div {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}
.donut-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.donut-legend span { flex: 1; color: var(--muted-dark); font-weight: 600; }
.donut-legend b { font-weight: 700; color: var(--text); white-space: nowrap; }

.expense-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.expense-row:last-child { border-bottom: none; }
.expense-row .exp-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.expense-row .exp-icon .icon-svg { width: 18px; height: 18px; }
.expense-row .exp-info { flex: 1; min-width: 0; }
.expense-row .exp-title { font-size: 13.5px; font-weight: 700; margin: 0; }
.expense-row .exp-sub { font-size: 11.5px; color: var(--muted); margin: 2px 0 0; }
.expense-row .exp-amount { font-family: var(--font-display); font-weight: 800; font-size: 14px; flex-shrink: 0; }

/* ---------- Lista del mapa (bottom sheet) ---------- */

.map-sheet-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
}
.map-sheet-row:last-child { border-bottom: none; }
.map-sheet-thumb {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
}
.map-sheet-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.map-sheet-icon .icon-svg { width: 16px; height: 16px; }
.map-sheet-info { flex: 1; min-width: 0; }
.map-sheet-title { font-size: 13.5px; font-weight: 700; margin: 0; }
.map-sheet-sub { font-size: 11.5px; color: var(--muted); margin: 2px 0 0; }
.map-sheet-chevron { color: var(--muted); flex-shrink: 0; }
.map-sheet-chevron .icon-svg { width: 15px; height: 15px; }

.tp-map-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--grad-brand);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  border: 2px solid #fff;
}

/* ---------- Resumen del viaje (dashboard) ---------- */

.summary-panel { margin-top: 18px; }

.photo-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-top: 4px;
}
.photo-strip::-webkit-scrollbar { display: none; }
.photo-strip img {
  width: 76px;
  height: 76px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
}

.trip-pin {
  display: inline-flex;
  vertical-align: -3px;
  color: var(--rose);
}
.trip-pin .icon-svg { width: 15px; height: 15px; }

.stat-card-expenses {
  display: flex;
  flex-direction: column;
}
.mini-expense-list {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}
.mini-expense-row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  color: var(--muted-dark);
}
.mini-expense-row span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-expense-row b { font-weight: 700; color: var(--text); flex-shrink: 0; }
.mini-expense-empty { font-size: 11px; color: var(--muted); margin-top: 10px; }

.discover-loading {
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 24px 10px;
}
.discover-spinner {
  color: var(--brand);
  animation: discover-spin 1.1s linear infinite;
}
.discover-spinner .icon-svg { width: 32px; height: 32px; }
@keyframes discover-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.discover-loading p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text);
  font-weight: 600;
  max-width: 240px;
}
.discover-loading-sub {
  font-size: 12px !important;
  color: var(--muted) !important;
  font-weight: 500 !important;
}

.brand-logo-badge {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: linear-gradient(135deg, #2fd4c4, #1fa9e0);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.brand-logo-badge .icon-svg { width: 26px; height: 26px; }

/* ---------- Búsqueda de destino con IA (inicio) ---------- */

.dest-search-panel {
  background: var(--surface);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow-card);
  margin: 4px 0 18px;
}

.dest-search-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.dest-search-title {
  font-size: 14.5px;
  font-weight: 800;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.dest-search-pin { color: var(--rose); display: inline-flex; }
.dest-search-pin .icon-svg { width: 15px; height: 15px; }
.dest-search-header .icon-btn { width: 32px; height: 32px; box-shadow: none; }

.dest-search-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-dark);
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.dest-search-label .stat-icon { width: 14px; height: 14px; margin: 0; }

.dest-result-list { display: flex; flex-direction: column; gap: 8px; }

.dest-result-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-tint);
  border-radius: 14px;
  padding: 8px 10px;
}
.dest-result-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dest-result-icon .icon-svg { width: 16px; height: 16px; }
.dest-result-thumb {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}
.dest-result-info { flex: 1; min-width: 0; }
.dest-result-title {
  font-size: 12.5px;
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dest-result-sub { font-size: 10.5px; color: var(--muted); margin: 1px 0 0; }
.dest-result-empty { font-size: 12px; color: var(--muted); padding: 4px 2px; }

.dest-search-pro {
  width: 100%;
  margin-top: 8px;
  border: 1px dashed var(--border);
  background: var(--surface-tint);
  color: var(--muted-dark);
  font-size: 12px;
  font-weight: 700;
  padding: 10px;
  border-radius: 14px;
}

/* ============================================================
   Copiloto IA — generador de itinerarios (ai-copilot.js)
   ============================================================ */
.ai-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 14px;
}
.btn-sm { padding: 9px 14px; font-size: 12.5px; }

.ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 12px;
  color: var(--muted);
  font-size: 13.5px;
}

.ai-day-card { margin-bottom: 12px; }
.ai-day-card h3 { margin-bottom: 8px; }

.ai-item-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.ai-item-row:last-child { border-bottom: none; }
.ai-item-time {
  flex: 0 0 44px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-dark);
  padding-top: 1px;
}
.ai-item-body { flex: 1; min-width: 0; }
.ai-item-title { font-size: 13.5px; font-weight: 700; color: var(--text); margin: 0; }
.ai-item-sub { font-size: 12px; color: var(--muted); margin: 2px 0 0; line-height: 1.4; }
.ai-item-cost { font-size: 12px; font-weight: 700; color: var(--muted-dark); white-space: nowrap; }

.ai-budget-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--muted-dark);
}
