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

:root {
  --bg:          #f0ede8;
  --bg2:         #e8e4de;
  --accent:      #2d6a4f;
  --accent2:     #1b4332;
  --accent-light:#e8f0eb;
  --gold:        #c9a84c;
  --text:        #1a1a1a;
  --text-mid:    #555;
  --text-muted:  #888;
  --border:      rgba(0,0,0,.1);
  --danger:      #c0392b;
  --danger-bg:   #fff5f5;
  --glass-bg:    rgba(255,255,255,0.65);
  --glass-border:rgba(255,255,255,0.9);
  --shadow-md:   0 4px 20px rgba(0,0,0,.1);

  /* Superficies sólidas (tarjetas, menús, inputs, splash) */
  --surface:       #ffffff;
  --surface-2:     #fafaf7;
  --surface-hover: #fafafa;
  --row-bg:        rgba(255,255,255,.7);
  --row-hover:     #ffffff;
  --shadow-soft:   rgba(0,0,0,.07);
  --shadow-card:   rgba(0,0,0,.08);
  --topbar-bg:     rgba(240,237,232,.98);
  --overlay-bg:    rgba(0,0,0,.45);

  /* Estado de tarjeta clickeable (success hover/active) */
  --success-hover-bg: #f0faf4;
  --success-active-bg:#dff2e8;

  /* Splash */
  --splash-bg:    #ffffff;
  --splash-track: #e8eaf6;
  --splash-bar:   #3949ab;

  --bg-overlay:   rgba(240,237,232,.6);

  /* Alias de compatibilidad usados por módulos (byc, viajes, resumen, etc.) */
  --card-bg:    var(--surface);
  --hover:      var(--surface-hover);
  --primary:    var(--accent);
  --success:    var(--accent);
  --text-light: var(--text-muted);

  /* Fondos/textos semánticos para pills, badges y banners de estado */
  --success-bg:   #e6f4ec;
  --success-text: #2d6a4f;
  --warning-bg:   #fff8e1;
  --warning-text: #b07d00;
  --danger-bg2:   #fce8e8;
  --danger-text:  #c0392b;
  --info-bg:      #e8f0fb;
  --info-text:    #3b5bdb;
  --neutral-bg:   #f0f0f0;
  --neutral-text: #999;
  --gold-bg:      rgba(201,168,76,.15);
  --gold-text:    #7a5c10;

  /* Banners de alerta de viaje (riesgo=naranja, cancelación=rojo) */
  --alert-warn-icon:  #c0392b;
  --alert-warn-title: #b03010;
  --alert-warn-text:  #7a3010;
  --alert-danger-icon:  #a01010;
  --alert-danger-title: #8b0000;
  --alert-danger-text:  #6b1010;

  color-scheme: light;
}

[data-theme="dark"] {
  --bg:          #15171a;
  --bg2:         #1d2024;
  --accent:      #3e8b67;
  --accent2:     #5fb98a;
  --accent-light:rgba(62,139,103,.18);
  --gold:        #d8b863;
  --text:        #ecece8;
  --text-mid:    #b9bcc2;
  --text-muted:  #80858d;
  --border:      rgba(255,255,255,.1);
  --danger:      #e0584a;
  --danger-bg:   rgba(224,88,74,.12);
  --glass-bg:    rgba(32,35,40,.65);
  --glass-border:rgba(255,255,255,.08);
  --shadow-md:   0 4px 20px rgba(0,0,0,.4);

  --surface:       #20232a;
  --surface-2:     #262a32;
  --surface-hover: #2a2e36;
  --row-bg:        rgba(32,35,42,.75);
  --row-hover:     #262a32;
  --shadow-soft:   rgba(0,0,0,.35);
  --shadow-card:   rgba(0,0,0,.45);
  --topbar-bg:     rgba(21,23,26,.95);
  --overlay-bg:    rgba(0,0,0,.65);

  --success-hover-bg: rgba(62,139,103,.14);
  --success-active-bg:rgba(62,139,103,.22);

  --splash-bg:    #15171a;
  --splash-track: #2a2e3d;
  --splash-bar:   #6c7ce0;

  --bg-overlay:   rgba(21,23,26,.6);

  /* Alias de compatibilidad */
  --card-bg:    var(--surface);
  --hover:      var(--surface-hover);
  --primary:    var(--accent);
  --success:    var(--accent);
  --text-light: var(--text-muted);

  /* Fondos/textos semánticos para pills, badges y banners de estado */
  --success-bg:   rgba(62,139,103,.2);
  --success-text: #6fcb9d;
  --warning-bg:   rgba(216,184,99,.18);
  --warning-text: #e6c777;
  --danger-bg2:   rgba(224,88,74,.18);
  --danger-text:  #f08075;
  --info-bg:      rgba(108,124,224,.2);
  --info-text:    #a3b0f5;
  --neutral-bg:   rgba(255,255,255,.08);
  --neutral-text: #aaadb3;
  --gold-bg:      rgba(216,184,99,.18);
  --gold-text:    #e6c777;

  /* Banners de alerta de viaje — tonos más claros para contraste en oscuro */
  --alert-warn-icon:  #e0584a;
  --alert-warn-title: #f0a070;
  --alert-warn-text:  #d99a78;
  --alert-danger-icon:  #f08075;
  --alert-danger-title: #f5a09a;
  --alert-danger-text:  #e09a96;

  color-scheme: dark;
}

html { background: var(--bg); }

body,
.topbar, .hamburger-menu, .breadcrumb-bar, .search-wrap, .passenger-row,
.home-card, .detalle-section, .detail-field, .pasajero-stat-card,
.form-input, .btn-google, .btn-cancel, #login-view {
  transition: background-color .25s ease, border-color .25s ease, color .25s ease, box-shadow .25s ease;
}

body {
  min-height: 100vh;
  font-family: 'Roboto', sans-serif;
  background: var(--bg);
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Gradiente de fondo suave ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 55% at 15% 85%, rgba(45,106,79,.1)  0%, transparent 65%),
    radial-gradient(ellipse 50% 50% at 85% 15%, rgba(201,168,76,.08) 0%, transparent 65%),
    radial-gradient(ellipse 70% 60% at 50% 50%, var(--bg-overlay) 0%, transparent 70%);
  z-index: 0;
  pointer-events: none;
}

/* ── Burbujas ── */
.bubbles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.bubble {
  position: absolute;
  bottom: -160px;
  border-radius: 50%;
  opacity: 0;
  animation: rise linear infinite;
}

.bubble:nth-child(1)  { width:55px;  height:55px;  left:7%;   background: radial-gradient(circle at 35% 35%, rgba(45,106,79,.18),  rgba(45,106,79,.04));  animation-duration:14s; animation-delay:0s;   }
.bubble:nth-child(2)  { width:28px;  height:28px;  left:18%;  background: radial-gradient(circle at 35% 35%, rgba(201,168,76,.2),  rgba(201,168,76,.05)); animation-duration:10s; animation-delay:2s;   }
.bubble:nth-child(3)  { width:80px;  height:80px;  left:30%;  background: radial-gradient(circle at 35% 35%, rgba(45,106,79,.12),  rgba(45,106,79,.03));  animation-duration:18s; animation-delay:4s;   }
.bubble:nth-child(4)  { width:18px;  height:18px;  left:43%;  background: radial-gradient(circle at 35% 35%, rgba(201,168,76,.15), transparent);           animation-duration:9s;  animation-delay:1s;   }
.bubble:nth-child(5)  { width:45px;  height:45px;  left:55%;  background: radial-gradient(circle at 35% 35%, rgba(45,106,79,.15),  rgba(45,106,79,.04));  animation-duration:13s; animation-delay:5s;   }
.bubble:nth-child(6)  { width:70px;  height:70px;  left:66%;  background: radial-gradient(circle at 35% 35%, rgba(201,168,76,.12), rgba(201,168,76,.03)); animation-duration:16s; animation-delay:3s;   }
.bubble:nth-child(7)  { width:32px;  height:32px;  left:75%;  background: radial-gradient(circle at 35% 35%, rgba(45,106,79,.1),   transparent);           animation-duration:11s; animation-delay:7s;   }
.bubble:nth-child(8)  { width:50px;  height:50px;  left:85%;  background: radial-gradient(circle at 35% 35%, rgba(45,106,79,.14),  rgba(45,106,79,.03));  animation-duration:15s; animation-delay:0.5s; }
.bubble:nth-child(9)  { width:22px;  height:22px;  left:92%;  background: radial-gradient(circle at 35% 35%, rgba(201,168,76,.18), rgba(201,168,76,.04)); animation-duration:8s;  animation-delay:6s;   }
.bubble:nth-child(10) { width:95px;  height:95px;  left:3%;   background: radial-gradient(circle at 35% 35%, rgba(45,106,79,.08),  rgba(45,106,79,.02));  animation-duration:20s; animation-delay:9s;   }
.bubble:nth-child(11) { width:38px;  height:38px;  left:48%;  background: radial-gradient(circle at 35% 35%, rgba(201,168,76,.1),  transparent);           animation-duration:12s; animation-delay:11s;  }
.bubble:nth-child(12) { width:60px;  height:60px;  left:22%;  background: radial-gradient(circle at 35% 35%, rgba(45,106,79,.1),   rgba(45,106,79,.03));  animation-duration:17s; animation-delay:8s;   }

[data-theme="dark"] .bubbles { opacity: .5; }

@keyframes rise {
  0%   { transform: translateY(0)    scale(1)   rotate(0deg);  opacity: 0;   }
  10%  { opacity: 1; }
  80%  { opacity: .5; }
  100% { transform: translateY(-110vh) scale(1.1) rotate(15deg); opacity: 0; }
}

/* ── Card login ── */
#login-view {
  position: relative;
  z-index: 10;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  border-radius: 24px;
  padding: 3rem 2.8rem 2.6rem;
  width: min(420px, 92vw);
  text-align: center;
  box-shadow:
    0 2px 0 var(--glass-border) inset,
    0 24px 64px rgba(0,0,0,.1),
    0 4px 16px rgba(0,0,0,.06);
  animation: cardIn .8s cubic-bezier(.22,1,.36,1) both;
}

@keyframes cardIn {
  from { opacity:0; }
  to   { opacity:1; }
}

/* Logo */
.logo-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: 2px solid rgba(201,168,76,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  box-shadow:
    0 0 0 8px rgba(45,106,79,.08),
    0 8px 24px rgba(45,106,79,.2);
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 8px rgba(45,106,79,.08), 0 8px 24px rgba(45,106,79,.2); }
  50%      { box-shadow: 0 0 0 14px rgba(45,106,79,.04), 0 8px 32px rgba(45,106,79,.28); }
}

.logo-wrap svg { width: 36px; height: 36px; }

h2 {
  font-family: 'Roboto', sans-serif;
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
  margin-bottom: .4rem;
}

.subtitle {
  font-size: .83rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 2.2rem;
}

/* Divisor */
.divider {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin-bottom: 1.8rem;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.divider span {
  font-size: .72rem;
  color: var(--text-muted);
  letter-spacing: .07em;
  text-transform: uppercase;
}

/* Botón Google */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  width: 100%;
  padding: .9rem 1.4rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-family: 'Roboto', sans-serif;
  font-size: .97rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .15s, box-shadow .2s;
  box-shadow: 0 2px 8px var(--shadow-soft);
}

.btn-google:hover {
  background: var(--surface-hover);
  border-color: rgba(0,0,0,.18);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--shadow-card);
}

.btn-google:active { transform: translateY(0); box-shadow: none; }

/* Footer */
.footer-note {
  margin-top: 1.8rem;
  font-size: .75rem;
  color: var(--text-muted);
}

.footer-note span { color: var(--accent); font-weight: 500; }

.hidden { display: none !important; }

/* ── APP SHELL ───────────────────────────────────────────── */
#app-view {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
  align-self: stretch;
  color: var(--text);
  animation: cardIn .6s cubic-bezier(.22,1,.36,1) both;
}

.topbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--topbar-bg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(45,106,79,.15);
  box-shadow: 0 2px 12px rgba(0,0,0,.07);
  padding: 0 1.1rem; height: 68px;
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  gap: .5rem;
}

/* Título centrado — botón "fantasma" para mantener accesibilidad de foco/click */
.topbar-brand {
  grid-column: 2;
  justify-self: center;
  display: flex; flex-direction: column; align-items: center;
  background: none; border: none; padding: 0; margin: 0;
  cursor: pointer;
  max-width: 100%;
  min-width: 0;
  line-height: 1.1;
}
.topbar-brand-title {
  font-family: 'Roboto', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent2);
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.topbar-brand-subtitle {
  font-family: 'Roboto', sans-serif;
  font-size: .6rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: .18em;
  margin-top: 1px;
}

/* ── MENÚ HAMBURGUESA ────────────────────────────────────── */
.hamburger-wrap { position: relative; grid-column: 1; justify-self: start; }

.hamburger-btn {
  width: 38px; height: 38px; border-radius: 10px;
  border: 1.5px solid rgba(45,106,79,.25);
  background: rgba(45,106,79,.07);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 5px;
  cursor: pointer; color: var(--accent2);
  transition: background .15s, border-color .15s;
}
.hamburger-btn:hover { background: rgba(45,106,79,.14); border-color: var(--accent); }
.hamburger-btn span {
  display: block; width: 18px; height: 2px;
  background: currentColor; border-radius: 2px;
}

.hamburger-menu {
  position: absolute; top: calc(100% + 8px); left: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-md);
  min-width: 200px; overflow: hidden;
  opacity: 0; pointer-events: none;
  transform: translateY(-6px);
  transition: opacity .15s, transform .15s;
  z-index: 200;
}
.hamburger-menu.open { opacity: 1; pointer-events: auto; transform: translateY(0); }

/* ── PERFIL (derecha) ────────────────────────────────────── */
.topbar-profile {
  grid-column: 3; justify-self: end;
  width: 38px; height: 38px; border-radius: 50%;
  border: none; padding: 0; cursor: pointer;
  background: var(--accent2);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Roboto', sans-serif;
  font-size: .8rem; font-weight: 700;
  letter-spacing: .02em;
  transition: filter .15s, transform .15s;
  flex-shrink: 0;
}
.topbar-profile:hover { filter: brightness(1.1); }
.topbar-profile:active { transform: scale(.94); }
.topbar-profile img {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
}

.menu-user {
  padding: .75rem 1rem .65rem;
  border-bottom: 1px solid var(--border);
  font-size: .78rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.menu-item {
  display: flex; align-items: center; gap: .6rem;
  width: 100%; padding: .75rem 1rem;
  border: none; background: none;
  font-family: 'Roboto', sans-serif; font-size: .88rem;
  color: var(--text-mid); cursor: pointer; text-align: left;
  transition: background .12s;
}
.menu-item:hover { background: var(--bg); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-bg); }

/* ── BREADCRUMB ──────────────────────────────────────────── */
.breadcrumb-bar {
  padding: .6rem 1.2rem; border-bottom: 1px solid var(--border); background: var(--bg);
}
.breadcrumb { display: flex; align-items: center; gap: .4rem; font-size: .78rem; }
.bc-link { color: var(--accent); cursor: pointer; font-weight: 500; }
.bc-link:hover { text-decoration: underline; }
.bc-sep { color: var(--text-muted); }
.bc-current { color: var(--text-muted); }

/* ── Contenido principal ─────────────────────────────────── */
.main {
  padding: 1.5rem 1.2rem;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  display: flex; align-items: baseline; gap: 1rem;
  flex-wrap: wrap; margin-bottom: 1.4rem;
}
.page-header h1 {
  font-family: 'Roboto', sans-serif;
  font-size: 1.6rem; font-weight: 700;
}
.page-desc { font-size: .85rem; color: var(--text-muted); margin-top: .3rem; }

.passenger-count {
  font-size: .78rem; color: var(--text-muted);
  background: var(--bg2); border-radius: 20px;
  padding: .2rem .7rem; margin-left: auto;
}

/* ── Buscador ────────────────────────────────────────────── */
.search-wrap {
  display: flex; align-items: center; gap: .6rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: .55rem .85rem;
  margin-bottom: 1rem;
  transition: border-color .2s, box-shadow .2s;
}
.search-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45,106,79,.1);
}
.search-wrap svg { color: var(--text-muted); flex-shrink: 0; }
.search-wrap input {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: 'Roboto', sans-serif; font-size: .9rem; color: var(--text);
}

/* ── Lista pasajeros ─────────────────────────────────────── */
.passenger-row {
  display: flex; align-items: center; gap: .9rem;
  padding: .75rem 1rem;
  background: var(--row-bg);
  border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: .5rem;
  cursor: pointer; transition: background .15s, transform .12s, box-shadow .15s;
  animation: rowIn .3s both;
}
.passenger-row:hover {
  background: var(--row-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--shadow-soft);
}
.passenger-row:active { transform: scale(.99); }

@keyframes rowIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.p-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
  font-size: .78rem; font-weight: 600; color: #fff;
  /* Mismo border/box-shadow que .detalle-avatar (transparente/nulo acá).
     Si el navegador tiene que animar border+shadow apareciendo de la
     nada durante el morph (View Transitions), lo hace de golpe al
     final en vez de interpolarlo — por eso mantenemos la misma
     "forma" en ambos extremos y solo cambia tamaño/posición. */
  border: 3px solid rgba(255,255,255,0);
  box-shadow: 0 4px 16px rgba(45,106,79,0);
}
.p-avatar img { width: 100%; height: 100%; object-fit: cover; }

.p-name { flex: 1; font-size: .92rem; font-weight: 500; }
.p-pill {
  font-size: .72rem; color: var(--text-muted);
  background: var(--bg2); border-radius: 20px;
  padding: .15rem .6rem; white-space: nowrap;
}
.chevron { color: var(--text-muted); flex-shrink: 0; }

.list-state {
  text-align: center; padding: 3rem 1rem;
  color: var(--text-muted); font-size: .9rem;
}
.list-state .icon { font-size: 2rem; margin-bottom: .6rem; }

/* ── Home grid ───────────────────────────────────────────── */
.home-grid {
  display: grid; gap: .8rem;
  grid-template-columns: 1fr;
}

.home-card {
  display: flex; align-items: center; gap: 1rem;
  background: var(--row-bg);
  border: 1px solid var(--border);
  border-radius: 14px; padding: 1rem 1.1rem;
  transition: background .15s, transform .12s, box-shadow .15s;
  position: relative; overflow: hidden;
}
.home-card.active { cursor: pointer; }
.home-card.active:hover {
  background: var(--row-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--shadow-card);
}
.home-card.soon { opacity: .7; cursor: default; }

.card-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.card-icon--img {
  background: transparent;
  padding: 0;
}
.card-icon--img img {
  width: 48px; height: 48px;
  object-fit: contain;
  border-radius: 10px;
}
.card-body { flex: 1; }
.card-body h3 { font-size: .95rem; font-weight: 600; margin-bottom: .2rem; }
.card-body p  { font-size: .78rem; color: var(--text-muted); line-height: 1.4; }

/* Flecha unificada: todas las cards activas la muestran, las soon no */
.card-arrow { display: none; }
.home-card.active::after {
  content: "";
  display: block;
  width: 18px; height: 18px;
  flex-shrink: 0;
  background-color: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M5 12h14M12 5l7 7-7 7'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M5 12h14M12 5l7 7-7 7'/%3E%3C/svg%3E") center/contain no-repeat;
}

.soon-badge {
  position: absolute; top: .7rem; right: .9rem;
  font-size: .65rem; font-weight: 600; color: var(--text-muted);
  background: var(--bg2); border-radius: 20px;
  padding: .15rem .55rem; letter-spacing: .04em; text-transform: uppercase;
}

/* ── Detalle pasajero ────────────────────────────────────── */
.detalle-main { padding-bottom: 2rem; }

.detalle-profile {
  display: flex; flex-direction: column; align-items: center;
  padding: 1.5rem 0 1rem; text-align: center;
}
.detalle-avatar-wrap { position: relative; margin-bottom: .8rem; }
.detalle-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; font-size: 1.5rem; font-weight: 600; color: #fff;
  border: 3px solid rgba(255,255,255,.8);
  box-shadow: 0 4px 16px rgba(45,106,79,.2);
}
.detalle-avatar img { width: 100%; height: 100%; object-fit: cover; }
.d-initials { font-size: 1.4rem; font-weight: 600; color: #fff; }

.avatar-edit-btn {
  position: absolute; bottom: -2px; right: -2px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff;
  border: 2px solid #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.avatar-edit-btn:hover { background: var(--accent2); }

#detalle-name {
  font-family: 'Roboto', sans-serif;
  font-size: 1.4rem; font-weight: 700;
}

.detalle-section {
  background: var(--row-bg);
  border: 1px solid var(--border);
  border-radius: 14px; padding: 1rem 1.1rem;
  margin-bottom: .9rem;
}

.section-title {
  display: flex; align-items: center; gap: .45rem;
  font-size: .73rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: .9rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .8rem;
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: .6rem .8rem;
}
.detail-field.full { grid-column: 1 / -1; }

.detail-label {
  font-size: .68rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.detail-value {
  font-size: .9rem;
  font-weight: 500;
  color: var(--text);
}
.detail-value.empty { color: var(--text-muted); font-style: italic; font-size: .82rem; }

/* ── Contacto de emergencia (sección plegable) ───────────── */
.detalle-section--collapsible { padding-bottom: .3rem; }

.section-title--toggle {
  width: 100%;
  background: none; border: none; padding: 0;
  margin-bottom: 0;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.section-title--toggle:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px;
}
.section-title-text { flex: 1; }

.section-title-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.section-title--toggle[aria-expanded="true"] .section-title-chevron {
  transform: rotate(180deg);
}

.detalle-collapse-body {
  will-change: height;
}
.detalle-collapse-inner {
  padding-top: .9rem;
}

/* ── Contacto de emergencia ──────────────────────────────── */
.detalle-empty-state {
  display: flex; flex-direction: column; align-items: flex-start; gap: .7rem;
  padding: .9rem 1rem;
  background: var(--glass-bg);
  border: 1px dashed var(--border);
  border-radius: 10px;
}
.detalle-empty-state p {
  font-size: .85rem; color: var(--text-muted); margin: 0;
}
.btn-agregar-pasajero {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem; border: none;
  border-radius: 10px; background: var(--accent); color: #fff;
  font-family: 'Roboto', sans-serif; font-size: .85rem; font-weight: 500;
  cursor: pointer; transition: background .15s, transform .12s;
}
.btn-agregar-pasajero:hover { background: #235a3f; }
.btn-agregar-pasajero:active { transform: scale(.97); }

/* ── FAB ─────────────────────────────────────────────────── */
.fab {
  position: fixed; bottom: 1.8rem; right: 1.8rem; z-index: 150;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent); color: #fff;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(45,106,79,.4);
  transition: transform .15s, box-shadow .15s;
}
.fab:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(45,106,79,.5); }
.fab:active { transform: scale(.96); }

/* ── FAB SOS (contacto de emergencia) ───────────────────────
/* ── FAB SOS (contacto de emergencia) ───────────────────────
   El FAB genérico (.fab) está oculto dentro de Detalle de pasajero,
   así que SOS puede vivir a la derecha sin chocar con nada.
   z-index por encima de .bottom-nav (200): si no, el navbar fijo lo
   tapa por completo. Separado del navbar con más aire (6rem) para
   que no quede pegado al borde superior de la barra. */
.fab-sos {
  position: fixed; bottom: calc(6rem + env(safe-area-inset-bottom, 0px)); right: 1.8rem; z-index: 210;
  height: 52px; padding: 0 1.1rem 0 .9rem; border-radius: 26px;
  background: var(--danger); color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; gap: .45rem;
  font-family: 'Roboto', sans-serif; font-weight: 700; font-size: .85rem; letter-spacing: .04em;
  box-shadow: 0 4px 16px rgba(192,57,43,.4);
  transition: transform .15s, box-shadow .15s;
}
.fab-sos:hover { transform: scale(1.05); box-shadow: 0 6px 22px rgba(192,57,43,.5); }
.fab-sos:active { transform: scale(.96); }
.fab-sos:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.fab-sos-label { line-height: 1; }

@media (max-width: 520px) {
  .fab-sos { right: 1.1rem; bottom: calc(5.6rem + env(safe-area-inset-bottom, 0px)); }
}

/* ── Modal SOS: contacto de emergencia ──────────────────────
   <dialog> nativo: focus trap, Esc y ::backdrop gratis. */
.modal-sos {
  border: none; padding: 0; background: transparent;
  max-width: min(480px, calc(100vw - 2rem));
  width: 100%;
  max-height: min(640px, calc(100vh - 2rem));
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  overflow: visible;
  /* El reset global "*{margin:0}" anula el auto-centrado nativo de
     <dialog> (que depende de margin:auto). Lo restauramos a mano. */
  position: fixed;
  inset: 0;
  margin: auto;
}
.modal-sos::backdrop {
  background: rgba(0,0,0,.45);
  animation: sosBackdropIn .18s ease-out;
}
.modal-sos[open] .modal-sos-card { animation: sosCardIn .18s cubic-bezier(.4,0,.2,1); }

@keyframes sosBackdropIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sosCardIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-sos-card {
  display: flex; flex-direction: column;
  max-height: min(640px, calc(100vh - 2rem));
  background: var(--card-bg);
  color: var(--text);
  border-radius: 16px;
  overflow: hidden;
  margin: 0;
}

.modal-sos-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; padding: 1.1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-sos-titulo {
  display: flex; align-items: center; gap: .5rem;
  font-family: 'Roboto', sans-serif; font-size: 1.05rem; font-weight: 700;
  color: var(--danger); margin: 0;
}
.modal-sos-close {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: transparent; border: none; cursor: pointer; color: inherit;
  transition: background .12s;
}
.modal-sos-close:hover { background: rgba(0,0,0,.06); }
.modal-sos-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.modal-sos-body {
  padding: 1.2rem; overflow-y: auto; flex: 1 1 auto;
}

.modal-sos-footer {
  padding: 1rem 1.2rem; border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-sos-footer-group { display: flex; justify-content: flex-end; gap: .6rem; }

@media (max-width: 520px) {
  .modal-sos { max-width: calc(100vw - 1.5rem); }
}

/* ── Modal sugerencia instalación PWA ─────────── */
.modal-instalar-titulo { color: var(--accent2); }

.modal-instalar-logo-wrap {
  display: flex; justify-content: center; margin-bottom: .9rem;
}
.modal-instalar-logo {
  width: 64px; height: 64px; border-radius: 16px;
  box-shadow: var(--shadow-md, 0 4px 14px rgba(0,0,0,.12));
}

.modal-instalar-texto {
  font-size: .88rem; line-height: 1.5; color: var(--text-mid);
  text-align: center; margin: 0 0 .3rem;
}

.modal-instalar-ios-steps { margin-top: 1rem; }
.modal-instalar-ios-list {
  list-style: none; padding: 0; margin: .6rem 0 0;
  display: flex; flex-direction: column; gap: .5rem;
}
.modal-instalar-ios-list li {
  display: flex; align-items: center; gap: .55rem;
  font-size: .85rem; color: var(--text);
  background: var(--accent-light);
  border-radius: 10px; padding: .6rem .75rem;
}
.modal-instalar-ios-num {
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: .72rem; font-weight: 700;
}

.modal-instalar-btn-instalar {
  width: auto; padding: .6rem 1.1rem; display: inline-flex;
  align-items: center; gap: .4rem; font-size: .85rem;
}

/* ── FORMULARIO NUEVO CLIENTE ────────────────────────────── */
.form-page-header { margin-bottom: 1.5rem; }
.form-page-header h1 {
  font-family: 'Roboto', sans-serif; font-size: 1.6rem; font-weight: 700;
}

.form-field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .2rem; }
.form-field.full { grid-column: 1 / -1; }
.form-label { font-size: .78rem; font-weight: 500; color: var(--text-mid); }
.req { color: var(--danger); }

.form-input {
  padding: .65rem .85rem;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text);
  font-family: 'Roboto', sans-serif; font-size: .92rem;
  outline: none; width: 100%;
  transition: border-color .2s, box-shadow .2s;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(45,106,79,.1); }
.form-input.error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(192,57,43,.1); }
select.form-input { cursor: pointer; }

.form-error { font-size: .82rem; color: var(--danger); margin-bottom: 1rem; min-height: 1.2rem; }

.form-actions {
  display: flex; justify-content: flex-end; gap: .7rem; padding-bottom: 2rem;
}
.btn-cancel {
  padding: .6rem 1.2rem; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface); color: var(--text-mid);
  font-family: 'Roboto', sans-serif; font-size: .88rem; cursor: pointer;
  transition: background .15s;
}
.btn-cancel:hover { background: var(--bg); }
.btn-save {
  display: flex; align-items: center; gap: .5rem;
  padding: .6rem 1.4rem; border: none;
  border-radius: 10px; background: var(--accent); color: #fff;
  font-family: 'Roboto', sans-serif; font-size: .88rem; font-weight: 500;
  cursor: pointer; transition: background .15s, transform .12s;
}
.btn-save:hover { background: #235a3f; }
.btn-save:active { transform: scale(.97); }
.btn-save:disabled { background: #aaa; cursor: not-allowed; }

@media (min-width: 521px) {
  .topbar { padding: 0 2rem; }
  .breadcrumb-bar { padding: .6rem 2rem; }
  .main { padding: 2rem; }
  .home-grid { grid-template-columns: 1fr 1fr; }
}

/* ── LOGOS ─────────────────────────────────── */
.login-logo-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 50%;
  background: #0d2b5e;
  display: block;
}

.topbar-logo-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 50%;
  background: #0d2b5e;
  flex-shrink: 0;
}

/* ── STAT CARDS PASAJERO ────────────────────── */

.pasajero-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem;
  margin-top: .85rem;
}

.pasajero-stat-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: .75rem .9rem;
}

.psc-full {
  grid-column: 1 / -1;
}

.psc-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.psc-icon--club {
  background: rgba(201,168,76,.15);
  color: #8a6d1a;
}

.psc-icon--viajes {
  background: rgba(45,106,79,.12);
  color: var(--accent);
}

.psc-icon--ultimo {
  background: rgba(99,102,241,.1);
  color: #4f46e5;
}

.psc-body {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  min-width: 0;
}

.psc-label {
  font-size: .7rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.psc-value {
  font-size: .92rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Card "Total de viajes" cliqueable ─────────────────── */
.pasajero-stat-card--clickable {
  cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .12s;
  position: relative;
}
.pasajero-stat-card--clickable:hover {
  background: var(--success-hover-bg);
  box-shadow: 0 2px 10px rgba(45,106,79,.12);
  transform: translateY(-1px);
}
.pasajero-stat-card--clickable:active {
  transform: translateY(0);
  background: var(--success-active-bg);
}
.psc-chevron {
  margin-left: auto;
  color: var(--text-muted, #9b9b8a);
  flex-shrink: 0;
}

/* ── Historial de viajes ───────────────────────────────── */
.historial-viaje-row {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border, #e8e8e0);
  transition: background .12s;
}
.historial-viaje-row:last-child { border-bottom: none; }
.historial-viaje-row:hover { background: var(--surface-2); }

.hvr-num {
  min-width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-size: .75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: .1rem;
}

.hvr-body { flex: 1; min-width: 0; }

.hvr-nombre {
  font-size: .9rem;
  font-weight: 500;
  color: var(--text, #1a1a16);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: .3rem;
}

.hvr-meta {
  display: flex;
  align-items: center;
  gap: .9rem;
  flex-wrap: wrap;
}

.hvr-fecha,
.hvr-puntos {
  display: inline-flex;
  align-items: center;
  gap: .28rem;
  font-size: .78rem;
  color: var(--text-muted, #9b9b8a);
}

.hvr-puntos {
  color: #c9a84c;
  font-weight: 500;
}
.hvr-puntos svg { stroke: #c9a84c; }

/* ── SPLASH ─────────────────────────────────────────────── */
#splash-view {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--splash-bg);
  z-index: 9999;
}

.splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.splash-ring {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.splash-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.splash-track {
  fill: none;
  stroke: var(--splash-track);
  stroke-width: 6;
}

.splash-bar {
  fill: none;
  stroke: var(--splash-bar);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 264;
  stroke-dashoffset: 264;
  animation: splash-load 1.6s ease-in-out forwards;
}

.splash-logo {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: contain;
  background: #0d2b5e;
}

@keyframes splash-load {
  0%   { stroke-dashoffset: 264; }
  80%  { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 0; }
}

/* ── View Transitions API — piloto en Base de clientes ────────
   Solo aplica en navegadores compatibles (Chrome/Edge/Android);
   en el resto se ignora sin afectar la navegación normal. */

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: .28s;
  animation-timing-function: cubic-bezier(.4, 0, .2, 1);
}

/* El avatar tiene su propio nombre de transición (avatar-N, asignado
   por JS), así que lo excluimos del crossfade genérico de "root"
   para que se vea el morph limpio en vez de un doble fundido. */
::view-transition-group(*) {
  animation-duration: .32s;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: .01ms !important;
  }
}

/* ══════════════════════════════════════════════════════════
   BOTTOM NAVBAR — Inicio / Módulos / Más
   Fijo al pie de la pantalla en toda la app (móvil-first).
═══════════════════════════════════════════════════════════ */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  padding: .55rem .5rem calc(.55rem + env(safe-area-inset-bottom, 0px));
  background: var(--surface, var(--bg2));
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 16px rgba(0,0,0,.06);
}

.bn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: .3rem .6rem;
  color: var(--text-muted);
  font-family: 'Roboto', sans-serif;
  font-size: .7rem;
  font-weight: 500;
  border-radius: 10px;
  transition: color .15s;
  flex: 1 1 0;
  min-width: 0;
}
.bn-item:active { transform: scale(.95); }
.bn-item.active { color: var(--accent); }
.bn-item.active svg { color: var(--accent); }

/* Botón central "Módulos": círculo elevado, como en la referencia */
.bn-item--center { margin-top: -1.6rem; }
.bn-fab {
  display: flex; align-items: center; justify-content: center;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--accent2, var(--accent));
  color: #fff;
  box-shadow: 0 4px 14px rgba(45,106,79,.4);
  margin-bottom: .1rem;
  transition: transform .15s, box-shadow .15s;
}
.bn-item--center:active .bn-fab { transform: scale(.93); }
.bn-item--center.active .bn-fab { box-shadow: 0 4px 14px rgba(45,106,79,.55); }
.bn-item--center span:last-child { color: var(--text-mid); }

/* Da lugar al navbar fijo para que no tape el contenido ni el FAB */
body { padding-bottom: 0; }
.main { padding-bottom: calc(1.5rem + 64px + env(safe-area-inset-bottom, 0px)); }
.fab { bottom: calc(1.8rem + 64px + env(safe-area-inset-bottom, 0px)); }

/* ══════════════════════════════════════════════════════════
   SHEET DE MÓDULOS — bottom sheet con grid de 3 columnas
═══════════════════════════════════════════════════════════ */
.modulos-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 210;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.modulos-overlay.open { opacity: 1; pointer-events: auto; }

.modulos-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 220;
  max-width: 680px;
  margin: 0 auto;
  background: var(--surface, var(--bg));
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -8px 32px rgba(0,0,0,.18);
  padding: .7rem 1.2rem calc(1.4rem + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.32,.72,0,1);
  max-height: 80vh;
  overflow-y: auto;
}
.modulos-sheet.open { transform: translateY(0); }

.modulos-sheet-handle {
  width: 40px; height: 4px;
  border-radius: 4px;
  background: var(--border);
  margin: .3rem auto 1rem;
}

.modulos-sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.1rem;
}
.modulos-sheet-header h2 {
  font-family: 'Roboto', sans-serif;
  font-size: 1.3rem; font-weight: 700;
  color: var(--text);
  margin: 0;
}
.modulos-sheet-close {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--bg2);
  color: var(--text-mid);
  cursor: pointer;
  transition: background .15s;
}
.modulos-sheet-close:hover { background: var(--border); }

.modulos-sheet-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .6rem .5rem;
}

.modulo-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  padding: .9rem .4rem;
  background: var(--bg2);
  border: none;
  border-radius: 16px;
  cursor: pointer;
  font-family: 'Roboto', sans-serif;
  color: var(--text);
  transition: background .15s, transform .1s;
}
.modulo-item:active { transform: scale(.96); }

.modulo-item-icon {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border-radius: 14px;
  background: var(--modulo-icon-bg, rgba(45,106,79,.12));
  flex-shrink: 0;
}
.modulo-item-icon img { width: 24px; height: 24px; object-fit: contain; }

.modulo-item-label {
  font-size: .74rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
}

@media (min-width: 480px) {
  .modulos-sheet-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Texto de ayuda arriba del grid en el selector de acceso directo */
.modulos-sheet-hint {
  font-size: .8rem;
  color: var(--text-muted);
  margin: -.4rem 0 1rem;
  line-height: 1.4;
}

/* Resalta el módulo actualmente elegido como acceso directo */
.modulo-item.is-selected {
  background: var(--modulo-icon-bg, rgba(45,106,79,.12));
  box-shadow: inset 0 0 0 2px var(--accent);
}

/* ══════════════════════════════════════════════════════════
   ACCESO DIRECTO (3er botón del navbar) — configurable
═══════════════════════════════════════════════════════════ */
.bn-shortcut-icon-wrap {
  position: relative;
  display: flex; align-items: center; justify-content: center;
}

/* Badge de lápiz: siempre visible y clickeable para poder cambiar
   el acceso directo en cualquier momento (no depende de :hover,
   que no existe de forma confiable en pantallas táctiles). */
.bn-shortcut-edit {
  position: absolute;
  top: -6px; right: -8px;
  width: 15px; height: 15px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent);
  color: #fff;
  border: 2px solid var(--surface, var(--bg2));
  cursor: pointer;
}

