/* =====================================================================
   TEMA ADRIRU — estilos comunes de todo el sitio
   Paleta tomada del logo (astronauta en flotador rosa/azul) sobre fondos oscuros.
   Todo el color sale de las variables de :root: cambia aquí y cambia en toda la web.
   ===================================================================== */

:root,
[data-bs-theme="dark"] {
  /* Marca */
  --brand-pink:      #ff3385;
  --brand-pink-soft: #ff69b4;
  --brand-blue:      #4a90e2;
  --brand-pink-rgb:  255, 51, 133;   /* el rosa de marca en «r, g, b» para usarlo con transparencia: rgba(var(--brand-pink-rgb), .2) */
  --brand-gradient:  linear-gradient(135deg, var(--brand-pink), var(--brand-blue));
  --btn-edge:        #4f5762;   /* borde fino de los botones con degradado (pestañas activas, filtros, botones redondos…): un gris un paso más claro que --surface-4 */
  --brand-cyan:      #7cf7ff;

  /* Superficies (de más oscura a más clara) */
  --surface-0: #15171a;   /* pie, cabecera */
  --surface-1: #1a1c20;   /* barras laterales */
  --surface-2: #22252a;   /* fondo de página */
  --surface-3: #2a2e34;   /* tarjetas */
  --surface-4: #343a42;   /* bordes, hover */

  --text-main:   #e6e8ea;
  --text-muted:  #95a5a6;
  --text-strong: #ffffff;                       /* títulos y texto destacado */

  /* Capas translúcidas (hover, chips…) y otros colores que cambian entre modo oscuro y claro */
  --ov-1: rgba(255, 255, 255, .05);
  --ov-2: rgba(255, 255, 255, .09);
  --ov-3: rgba(255, 255, 255, .14);
  --bar-bg: rgba(21, 23, 26, .94);              /* cabecera, menú inferior, barras fijas */
  --shadow-c: rgba(0, 0, 0, .5);
  --ok-text: #7ee2a8;
  --bad-text: #ff8a95;
  --warn-text: #ffd479;
  --gray-icon: #7c8794;

  --radius: .75rem;
  --header-h: 68px;

  /* Bootstrap: se reasignan sus variables para que todo componente use la paleta */
  --bs-body-bg: var(--surface-2);
  --bs-body-bg-rgb: 34, 37, 42;
  --bs-body-color: var(--text-main);
  --bs-secondary-color: var(--text-muted);
  --bs-border-color: var(--surface-4);
  --bs-tertiary-bg: var(--surface-3);
  --bs-secondary-bg: var(--surface-3);
  --bs-primary: var(--brand-blue);
  --bs-primary-rgb: 74, 144, 226;
  --bs-link-color: var(--brand-blue);
  --bs-link-color-rgb: 74, 144, 226;
  --bs-link-hover-color: var(--brand-pink);
  --bs-link-hover-color-rgb: 255, 51, 133;
  --bs-card-bg: var(--surface-3);
  --bs-card-cap-bg: var(--ov-1);
  --bs-modal-bg: var(--surface-3);
  --bs-dropdown-bg: var(--surface-3);
  --bs-list-group-bg: var(--surface-3);
  --bs-font-sans-serif: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
}

/* ===== MODO CLARO ===== (se activa con el botón de la cabecera; se recuerda en el navegador) */
[data-bs-theme="light"] {
  --btn-edge: #aab3bf;
  --brand-pink: #e3226e;
  --brand-pink-rgb: 227, 34, 110;
  --brand-blue: #2a74c9;
  --surface-0: #ffffff;
  --surface-1: #f6f7f9;
  --surface-2: #eceff3;
  --surface-3: #ffffff;
  --surface-4: #d6dbe2;
  --text-main:   #1f262e;
  --text-muted:  #5d6b78;
  --text-strong: #0d1117;
  --ov-1: rgba(15, 23, 42, .04);
  --ov-2: rgba(15, 23, 42, .07);
  --ov-3: rgba(15, 23, 42, .12);
  --bar-bg: rgba(255, 255, 255, .94);
  --shadow-c: rgba(16, 24, 40, .16);
  --ok-text: #167a47;
  --bad-text: #c4293c;
  --warn-text: #8a6100;
  --gray-icon: #7b8794;

  --bs-body-bg: var(--surface-2);
  --bs-body-bg-rgb: 236, 239, 243;
  --bs-body-color: var(--text-main);
  --bs-secondary-color: var(--text-muted);
  --bs-border-color: var(--surface-4);
  --bs-tertiary-bg: var(--surface-1);
  --bs-secondary-bg: var(--surface-1);
  --bs-primary: var(--brand-blue);
  --bs-primary-rgb: 42, 116, 201;
  --bs-link-color: var(--brand-blue);
  --bs-link-color-rgb: 42, 116, 201;
  --bs-link-hover-color: var(--brand-pink);
  --bs-link-hover-color-rgb: 227, 34, 110;
  --bs-card-bg: var(--surface-3);
  --bs-card-cap-bg: var(--ov-1);
  --bs-modal-bg: var(--surface-3);
  --bs-dropdown-bg: var(--surface-3);
  --bs-list-group-bg: var(--surface-3);
  --bs-emphasis-color: var(--text-strong);
}

/* ---------- Base ---------- */
html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  color: var(--text-main);
}

/* El contenido principal ocupa el espacio libre y empuja el pie abajo */
body > main,
body > #app { flex: 1 0 auto; }

a { text-decoration: none; }
a:hover { text-decoration: none; }

h1, h2, h3, h4 { font-weight: 700; letter-spacing: -.01em; }

.text-gradient {
  background: linear-gradient(90deg, var(--brand-pink), var(--brand-blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Contenedores de página ---------- */
.page-container {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.75rem 1rem 3rem;
}
.page-wide { max-width: 1600px; }
.page-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .75rem; margin-bottom: 1.5rem;
}
.page-header h1, .page-header h2 { margin: 0; text-align: left; }

/* ---------- Cabecera / menú ---------- */
.site-header {
  position: sticky; top: 0; z-index: 1030;
  background: var(--bar-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--surface-4);
}
.app-navbar { min-height: var(--header-h); padding: .35rem 0; }
.app-navbar .navbar-brand {
  display: flex; align-items: center; gap: .6rem;
  font-weight: 800; font-size: 1.25rem; color: var(--text-strong); letter-spacing: .02em;
}
.app-navbar .navbar-brand img { object-fit: contain; }
.app-navbar .nav-link {
  color: var(--text-muted);
  font-weight: 600; font-size: .95rem;
  padding: .55rem .85rem; border-radius: .5rem;
  transition: color .15s, background .15s;
}
.app-navbar .nav-link i { margin-right: .3rem; }
.app-navbar .nav-link:hover { color: var(--text-strong); background: var(--ov-1); }
.app-navbar .nav-link.active { color: var(--text-strong); box-shadow: inset 0 -2px 0 var(--brand-pink); border-radius: .5rem .5rem 0 0; }
.app-navbar .nav-cta {
  color: #fff; background: var(--brand-gradient);
}
.app-navbar .nav-cta:hover { filter: brightness(1.1); color: #fff; }
.app-navbar .dropdown-toggle { background: none; border: 0; }
.app-navbar .dropdown-toggle::after { margin-left: .4em; }
.account-menu { background: var(--surface-1); border: 1px solid var(--surface-4); border-radius: .75rem; padding: .4rem; min-width: 13rem; box-shadow: 0 .75rem 2rem var(--shadow-c); }
.account-menu .dropdown-item { color: var(--text-main); border-radius: .5rem; padding: .6rem .8rem; font-weight: 600; }
.account-menu .dropdown-item i { width: 1.4rem; margin-right: .3rem; text-align: center; color: var(--text-muted); }
.account-menu .dropdown-item:hover, .account-menu .dropdown-item:focus { background: var(--ov-2); color: var(--text-strong); }
.account-menu .dropdown-item.active { background: var(--ov-2); color: var(--text-strong); box-shadow: inset 3px 0 0 var(--brand-pink); }
.account-menu .dropdown-divider { border-color: var(--surface-4); }
.account-menu .nav-cta { background: var(--brand-gradient); display: block; padding: .65rem .85rem; border-radius: .5rem; font-weight: 700; color: #fff; }

/* Desplegables de la barra superior (escritorio): aparecen rápido, con un pequeño deslizamiento */
@keyframes navDrop { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
.app-navbar .dropdown-menu.show { animation: navDrop .14s ease-out; transform-origin: top center; }
@media (prefers-reduced-motion: reduce) { .app-navbar .dropdown-menu.show { animation: none; } }
.app-navbar .nav-hover.dropdown { position: relative; }
.app-navbar .nav-hover .dropdown-menu { margin-top: 0; }   /* sin hueco entre el botón y la lista: el ratón no los «pierde» */

/* Cuadrícula de apps (desplegable «Apps» del móvil) */
.app-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; min-height: 5.25rem; padding: .6rem .25rem;
  border-radius: .8rem; background: var(--surface-3); border: 1px solid var(--surface-4); color: var(--text-main); text-decoration: none;
  font-size: .85rem; font-weight: 600; text-align: center; -webkit-tap-highlight-color: transparent;
}
.app-tile i { font-size: 1.6rem; color: var(--brand-blue); }
.app-tile span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-tile:hover { background: var(--ov-2); color: var(--text-strong); }
.app-tile:active { background: var(--ov-3); }
.app-tile.active { border-color: var(--brand-pink); color: var(--text-strong); }
.app-tile.active i { color: var(--brand-pink); }
/* Escritorio: cada grupo de la barra de arriba es una lista (usa los estilos de .account-menu) */
.apps-list { min-width: 12rem; }

/* Móvil: menú inferior (al alcance del pulgar) con tres botones: Inicio, Apps y Mi cuenta. Arriba queda solo el logo. */
.bottom-nav { display: none; }
.bottom-nav-spacer { height: calc(4rem + env(safe-area-inset-bottom)); }
@media (max-width: 991.98px) {
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--bar-bg); backdrop-filter: blur(12px);
    border-top: 1px solid var(--surface-4);
  }
  .bottom-nav-item, .bottom-nav-drop { flex: 1 1 0; min-width: 0; }
  .bottom-nav-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem;
    min-height: 3.75rem; padding: .45rem .25rem; background: none; border: 0; border-top: 2px solid transparent;
    color: var(--text-muted); text-decoration: none; font-size: .75rem; font-weight: 600; line-height: 1.1;
    -webkit-tap-highlight-color: transparent;
  }
  .bottom-nav-drop { position: static; }                     /* los menús se colocan respecto a toda la barra */
  .bottom-nav-drop .bottom-nav-item { width: 100%; }
  .bottom-nav-item i { font-size: 1.4rem; }
  .bottom-nav-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bottom-nav-item:active { background: var(--ov-2); }
  .bottom-nav-item.active, .bottom-nav-item.show { color: var(--text-strong); border-top-color: var(--brand-pink); }
  .bottom-nav-item.active i, .bottom-nav-item.show i { color: var(--brand-pink); }
  .bottom-nav-cta i { color: var(--brand-pink); }
  /* Menús desplegados hacia arriba, con botones grandes para el dedo */
  .bottom-nav .bottom-nav-drop .dropdown-menu { position: absolute; top: auto; bottom: calc(100% + .5rem); margin: 0; max-height: 70vh; overflow-y: auto; transform: none; }
  .bottom-nav .account-menu { right: .5rem; left: auto; width: min(17rem, calc(100vw - 1rem)); }
  .bottom-nav .account-menu .dropdown-item, .bottom-nav .account-menu .nav-cta { padding: .9rem 1rem; font-size: 1.05rem; }
  .bottom-nav .bottom-nav-drop .apps-menu {
    left: .5rem; right: .5rem; padding: .6rem; background: var(--surface-1); border: 1px solid var(--surface-4); border-radius: 1rem;
    box-shadow: 0 .75rem 2rem var(--shadow-c);
  }
  .bottom-nav .apps-menu.show { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; align-content: start; }
  /* Menú de Apps casi a pantalla completa: desde justo debajo de la línea de la cabecera hasta encima de la barra inferior */
  .bottom-nav .bottom-nav-drop .apps-menu {
    bottom: calc(100% + .5rem); max-height: none; overscroll-behavior: contain;
    height: calc(100vh - var(--header-h) - 1px - 3.75rem - 1px - env(safe-area-inset-bottom) - 1rem);
    height: calc(100dvh - var(--header-h) - 1px - 3.75rem - 1px - env(safe-area-inset-bottom) - 1rem);
  }
  .apps-group-title { grid-column: 1 / -1; margin: .4rem 0 -.1rem; padding: 0 .25rem; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
  .apps-group-title:first-child { margin-top: 0; }
  /* Animación al abrir: el panel se despliega desde la barra inferior y cada título y botón entra en cascada con un pequeño rebote */
  .bottom-nav .apps-menu.show { transform-origin: bottom center; animation: appsOpen .34s cubic-bezier(.2, .8, .2, 1); }
  .bottom-nav .apps-menu.show > * { animation: appsItem .42s cubic-bezier(.34, 1.56, .64, 1) both; animation-delay: .5s; }
  .bottom-nav .apps-menu.show > :nth-child(1) { animation-delay: 62ms; }
  .bottom-nav .apps-menu.show > :nth-child(2) { animation-delay: 84ms; }
  .bottom-nav .apps-menu.show > :nth-child(3) { animation-delay: 106ms; }
  .bottom-nav .apps-menu.show > :nth-child(4) { animation-delay: 128ms; }
  .bottom-nav .apps-menu.show > :nth-child(5) { animation-delay: 150ms; }
  .bottom-nav .apps-menu.show > :nth-child(6) { animation-delay: 172ms; }
  .bottom-nav .apps-menu.show > :nth-child(7) { animation-delay: 194ms; }
  .bottom-nav .apps-menu.show > :nth-child(8) { animation-delay: 216ms; }
  .bottom-nav .apps-menu.show > :nth-child(9) { animation-delay: 238ms; }
  .bottom-nav .apps-menu.show > :nth-child(10) { animation-delay: 260ms; }
  .bottom-nav .apps-menu.show > :nth-child(11) { animation-delay: 282ms; }
  .bottom-nav .apps-menu.show > :nth-child(12) { animation-delay: 304ms; }
  .bottom-nav .apps-menu.show > :nth-child(13) { animation-delay: 326ms; }
  .bottom-nav .apps-menu.show > :nth-child(14) { animation-delay: 348ms; }
  .bottom-nav .apps-menu.show > :nth-child(15) { animation-delay: 370ms; }
  .bottom-nav .apps-menu.show > :nth-child(16) { animation-delay: 392ms; }
  .bottom-nav .apps-menu.show > :nth-child(17) { animation-delay: 414ms; }
  .bottom-nav .apps-menu.show > :nth-child(18) { animation-delay: 436ms; }
  .bottom-nav .apps-menu.show > :nth-child(19) { animation-delay: 458ms; }
  .bottom-nav .apps-menu.show > :nth-child(20) { animation-delay: 480ms; }
  .bottom-nav .apps-menu.show > :nth-child(21) { animation-delay: 502ms; }
  .bottom-nav .apps-menu.show > :nth-child(22) { animation-delay: 524ms; }
  .bottom-nav .apps-menu.show > :nth-child(23) { animation-delay: 546ms; }
  .bottom-nav .apps-menu.show > :nth-child(24) { animation-delay: 568ms; }
  .bottom-nav .apps-menu.show > :nth-child(25) { animation-delay: 590ms; }
  .bottom-nav .apps-menu.show > :nth-child(26) { animation-delay: 612ms; }
  .bottom-nav .apps-menu.show > :nth-child(27) { animation-delay: 634ms; }
  .bottom-nav .apps-menu.show > :nth-child(28) { animation-delay: 656ms; }
  .bottom-nav .apps-menu.show > :nth-child(29) { animation-delay: 678ms; }
  .bottom-nav .apps-menu.show > :nth-child(30) { animation-delay: 700ms; }
  .bottom-nav .apps-menu.show > :nth-child(n+31) { animation-delay: .72s; }
  .bottom-nav-item.show i { animation: appsIcon .4s cubic-bezier(.34, 1.56, .64, 1); }
  @keyframes appsOpen { from { opacity: 0; clip-path: inset(70% 0 0 0 round 1rem); } to { opacity: 1; clip-path: inset(0 0 0 0 round 1rem); } }
  @keyframes appsItem { from { opacity: 0; transform: translateY(1.2rem) scale(.8); } to { opacity: 1; transform: none; } }
  @keyframes appsIcon { 0% { transform: scale(1); } 40% { transform: scale(1.3) rotate(-8deg); } 100% { transform: none; } }
  @media (prefers-reduced-motion: reduce) {
    .bottom-nav .apps-menu.show, .bottom-nav .apps-menu.show > *, .bottom-nav-item.show i { animation: none; }
  }
  .apps-group-title i { margin-right: .3rem; }
}

/* App instalada (abierta como app, no en el navegador) y que no es el inicio: sin menú ni cabecera, la app ocupa toda la pantalla.
   Los hueco que dejaban se quitan (--header-h / --bn-h a 0) y se respeta la zona segura de arriba (muesca / barra de estado). */
html.app-standalone .site-header, html.app-standalone .bottom-nav, html.app-standalone .bottom-nav-spacer { display: none !important; }
html.app-standalone body { --header-h: 0px !important; --bn-h: 0px !important; padding-top: env(safe-area-inset-top); }

/* ---------- Pie ---------- */
.site-footer {
  flex-shrink: 0;
  padding: 1rem 0;
  background: var(--surface-0);
  border-top: 1px solid var(--surface-4);
  color: var(--text-muted);
  font-size: .85rem; text-align: center;
}

/* ---------- Componentes Bootstrap con la paleta ---------- */
.btn-primary {
  --bs-btn-bg: var(--brand-blue);
  --bs-btn-border-color: var(--brand-blue);
  --bs-btn-hover-bg: #3a7bc8;
  --bs-btn-hover-border-color: #3a7bc8;
  --bs-btn-active-bg: #336aaa;
  --bs-btn-active-border-color: #336aaa;
  --bs-btn-focus-shadow-rgb: 74, 144, 226;
}
.btn-accent {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--brand-pink);
  --bs-btn-border-color: var(--brand-pink);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #e62874;
  --bs-btn-hover-border-color: #e62874;
  --bs-btn-active-bg: #cc2266;
  --bs-btn-active-border-color: #cc2266;
  --bs-btn-focus-shadow-rgb: 255, 51, 133;
}
.card { border-color: var(--surface-4); border-radius: var(--radius); }
.card.border-secondary { border-color: var(--surface-4) !important; }
.form-control, .form-select {
  background-color: var(--surface-1);
  border-color: var(--surface-4);
}
.form-control:focus, .form-select:focus {
  background-color: var(--surface-1);
  border-color: var(--brand-pink);
  box-shadow: 0 0 0 .2rem rgba(var(--brand-pink-rgb), .25);
}
.form-check-input:checked { background-color: var(--brand-pink); border-color: var(--brand-pink); }
.list-group-item.active { background-color: var(--brand-blue); border-color: var(--brand-blue); }
.table { --bs-table-bg: transparent; }
.modal-content { border-color: var(--surface-4); border-radius: var(--radius); }
.pagination { --bs-pagination-bg: var(--surface-3); --bs-pagination-border-color: var(--surface-4);
  --bs-pagination-active-bg: var(--brand-pink); --bs-pagination-active-border-color: var(--brand-pink); }
::selection { background: rgba(var(--brand-pink-rgb), .45); }

/* ---------- Inicio: tarjetas de acceso a cada app ---------- */
.hero { text-align: center; padding: 2.5rem 0 1.5rem; }
.hero img { width: 150px; height: auto; filter: drop-shadow(0 8px 24px rgba(var(--brand-pink-rgb), .35)); }
.hero h1 { margin-top: 1rem; font-size: clamp(1.9rem, 5vw, 2.8rem); }
.hero p { color: var(--text-muted); margin: .25rem 0 0; }

/* Inicio: títulos de cada grupo de apps */
.home-group { display: flex; align-items: center; gap: .5rem; margin: 1.75rem 0 .75rem; font-size: .85rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); }
.home-group i { color: var(--brand-pink); }
.home-group:first-of-type { margin-top: .5rem; }
.home-group + .app-grid { margin-top: 0; }
.app-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  margin-top: 1.5rem;
}
.app-card {
  display: flex; flex-direction: column; gap: .35rem;
  padding: 1.4rem; color: var(--text-main);
  background: var(--surface-3);
  border: 1px solid var(--surface-4); border-radius: var(--radius);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.app-card:hover {
  color: var(--text-main); transform: translateY(-3px);
  border-color: var(--brand-pink); box-shadow: 0 10px 28px var(--shadow-c);
}
.app-card .app-icon {
  width: 46px; height: 46px; display: grid; place-items: center;
  font-size: 1.25rem; color: var(--text-strong); border-radius: .75rem; margin-bottom: .5rem;
  background: var(--brand-gradient);
}
.app-card h3 { font-size: 1.15rem; margin: 0; color: inherit; font-weight: 600; }
.app-card p { margin: 0; color: var(--text-muted); font-size: .9rem; }

/* Inicio: estrella de favorita en cada tarjeta */
.app-item { position: relative; display: flex; }
.app-item > .app-card { flex: 1 1 auto; min-width: 0; }
.fav-form { position: absolute; top: .45rem; right: .45rem; margin: 0; }
.fav-btn { width: 2.4rem; height: 2.4rem; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); font-size: 1.05rem; opacity: .75; transition: opacity .15s, color .15s, transform .15s; }
.app-item:hover .fav-btn, .fav-btn:focus-visible, .fav-btn.on { opacity: 1; }
.fav-btn:hover { color: #f5b301; transform: scale(1.12); }
.fav-btn.on { color: #f5b301; }
.fav-btn:disabled { opacity: .4; }
#favSection .home-group .home-fold > i:first-child { color: #f5b301; }

/* Móvil: botones en cuadrícula de 2 columnas */
@media (max-width: 575.98px) {
  .app-grid { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
  .app-card { align-items: center; text-align: center; padding: 1.1rem .6rem; gap: .25rem; }
  .app-card .app-icon { width: 52px; height: 52px; font-size: 1.4rem; margin-bottom: .35rem; }
  .app-card h3 { font-size: 1rem; }
  .app-card p { font-size: .75rem; line-height: 1.25; }
  .hero { padding: 1.25rem 0 .5rem; }
  .hero img { width: 110px; }
}

/* ---------- Login ---------- */
.auth-wrap { display: grid; place-items: center; flex: 1 0 auto; padding: 2rem 1rem; }
.auth-card { width: 100%; max-width: 420px; padding: 2rem; }
.auth-card .auth-logo { display: block; width: 90px; margin: 0 auto 1rem; }
.auth-card h1 { font-size: 1.6rem; text-align: center; margin-bottom: 1.5rem; }

/* ---------- Parking ---------- */

/* ---------- Gift list ---------- */
/* Selector de lista (Gift list): desplegable con buscador con aspecto de botón */
.combo-people { display: inline-block; min-width: 6rem; max-width: 100%; }
.combo-people .combo-list { right: auto; width: max-content; min-width: min(16rem, 90vw); max-width: 90vw; }
.combo-people .combo-input {
  font-weight: 600; color: #fff; cursor: pointer; border-radius: 999px; padding: .5rem 2.4rem .5rem 1rem;
  background: var(--brand-gradient) no-repeat; border-color: var(--btn-edge);
}
.combo-people .combo-input::placeholder { color: rgba(255, 255, 255, .75); }
.combo-people::after {
  content: ''; position: absolute; right: 1rem; top: 50%; width: .55rem; height: .55rem; margin-top: -.4rem; pointer-events: none;
  border-right: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(45deg);
}
.combo-people .combo-input:focus { color: var(--text-strong); background: var(--surface-3); border-color: var(--brand-pink); box-shadow: 0 0 0 .2rem rgba(var(--brand-pink-rgb), .25); }
.gift-tags { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.gift-tag {
  display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .6rem; border-radius: 999px; font-size: .8rem; line-height: 1.4;
  color: var(--text-muted); background: var(--ov-1); border: 1px solid var(--surface-4); cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.gift-tag:hover { color: var(--text-strong); border-color: var(--brand-pink); }
.gift-tag.active { color: #fff; background: var(--brand-gradient); border-color: var(--btn-edge); }
.gift-tag-n { opacity: .75; font-size: .72rem; }
.gift-tagbar { padding-bottom: .1rem; }
.gift-tagsel { appearance: none; -webkit-appearance: none; max-width: 100%; padding-right: 1.7rem;
  background: var(--ov-1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='m3 6 5 5 5-5'/%3E%3C/svg%3E") no-repeat right .5rem center / .7rem; }
.gift-tagsel.active { color: #fff; background-color: transparent; background-image: var(--brand-gradient), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='m3 6 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 0 0, right .5rem center; background-size: 100% 100%, .7rem; }
.gift-tagsel option { color: var(--bs-body-color, #222); background: var(--surface-2, #fff); }
.gift-card { transition: border-color .15s, transform .15s; }
.gift-card:hover { border-color: var(--brand-pink); }
.gift-card h3 { word-break: break-word; }
.gift-desc { color: var(--text-muted); font-size: .92rem; word-break: break-word; }

/* ---------- Comunes a varias apps ---------- */
.count-pill {
  font-size: .85rem; font-weight: 600; vertical-align: middle;
  padding: .15rem .6rem; border-radius: 999px; margin-left: .4rem;
  background: rgba(var(--brand-pink-rgb), .15); color: var(--brand-pink);
}
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }

/* ---------- Administración de usuarios ---------- */
.user-card.is-off { opacity: .6; }
.d-contents { display: contents; }
.perm-list { border: 1px solid var(--surface-4); border-radius: .6rem; padding: .75rem .9rem; background: var(--surface-1); }
.perm-app + .perm-app { margin-top: .6rem; padding-top: .6rem; border-top: 1px solid var(--surface-4); }
.perm-subs { margin: .4rem 0 0 1.6rem; display: grid; gap: .25rem; }

/* Pastillas de filtro pulsables (recetas, multimedia, organización, viajes): aspecto común; cada app solo fija su tamaño */
.rec-chip, .rec-pill, .mm-chip, .org-chip, .vj-fchip { border-radius: 999px; background: var(--surface-3); border: 1px solid var(--surface-4); color: var(--text-main); white-space: nowrap; }
.rec-chip.active, .rec-pill.active, .mm-chip.active, .org-chip.active, .vj-fchip.active { color: #fff; background: var(--brand-gradient); border-color: var(--btn-edge); font-weight: 600; }

/* Etiquetas redondeadas (parking, usuarios) */
.spot-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.chip { font-size: .8rem; padding: .2rem .6rem; border-radius: 999px; background: var(--ov-2); border: 1px solid var(--surface-4); }
.chip.chip-warn { color: var(--warn-text); border-color: rgba(255, 193, 7, .5); }
.chip.chip-bad { color: var(--bad-text); border-color: rgba(220, 53, 69, .6); }
.chip.chip-ok { color: var(--ok-text); }
.spot-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .85rem; }
.spot-actions .btn { flex: 1 1 auto; }

/* Gift list: regalos comprados */
.gift-bought { border-color: rgba(126, 226, 168, .45); background: linear-gradient(0deg, rgba(126, 226, 168, .05), rgba(126, 226, 168, .05)), var(--surface-3); }
.gift-status { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .6rem; padding-top: .6rem; border-top: 1px dashed var(--surface-4); }
.gift-status-text { color: var(--ok-text); font-size: .9rem; }
.gift-status:not(.is-bought) { justify-content: flex-start; }

/* Desplegable con buscador */
.combo { position: relative; }
.combo-list {
  position: absolute; left: 0; right: 0; top: calc(100% + .25rem); z-index: 1060; margin: 0; padding: .3rem; list-style: none;
  max-height: 14rem; overflow-y: auto; background: var(--surface-1); border: 1px solid var(--surface-4); border-radius: .6rem;
  box-shadow: 0 .75rem 2rem var(--shadow-c);
}
.combo-list[hidden] { display: none; }
.combo-list li { padding: .55rem .7rem; border-radius: .45rem; cursor: pointer; color: var(--text-main); }
.combo-list li:hover, .combo-list li.active { background: var(--ov-2); color: var(--text-strong); }
.combo-list li.combo-none { color: var(--text-muted); cursor: default; }
.combo-list li.combo-none:hover { background: none; }

/* ---------- Botón de modo claro / oscuro ---------- */
.theme-toggle {
  width: 2.5rem; height: 2.5rem; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--surface-4); border-radius: 50%; color: var(--text-muted); font-size: 1.05rem; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: color .15s, background .15s, border-color .15s;
}
.theme-toggle:hover, .theme-toggle:focus-visible { color: var(--text-strong); background: var(--ov-2); border-color: var(--brand-pink); outline: none; }
.theme-toggle .ti-moon { display: none; }
[data-bs-theme="light"] .theme-toggle .ti-sun { display: none; }
[data-bs-theme="light"] .theme-toggle .ti-moon { display: inline; }
.theme-toggle-float { position: fixed; top: .75rem; right: .75rem; z-index: 1040; background: var(--surface-3); }

/* Botones de aviso (amarillo) legibles en modo claro */
[data-bs-theme="light"] .btn-outline-warning { --bs-btn-color: var(--warn-text); --bs-btn-border-color: #c79100; --bs-btn-hover-color: #1a1500; --bs-btn-hover-bg: #ffc107; --bs-btn-hover-border-color: #ffc107; }

/* Aviso emergente común de las apps (ui_toast() en PHP, Adriru.toast() en JS). Cada app ajusta su posición con --toast-lift (móvil) y --toast-lift-lg (escritorio). */
.app-toast {
  position: fixed; left: .75rem; right: .75rem; z-index: 1070; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  bottom: calc(var(--bn-h) + env(safe-area-inset-bottom) + var(--toast-lift, 1rem)); max-width: 520px; margin: 0 auto; padding: .8rem 1rem;
  background: var(--surface-4); color: var(--text-strong); border: 1px solid var(--surface-4); border-radius: .8rem; box-shadow: 0 .5rem 1.5rem var(--shadow-c);
}
.app-toast[hidden] { display: none; }
.app-toast button { background: none; border: 0; color: var(--brand-blue); font-weight: 700; text-transform: uppercase; font-size: .85rem; padding: .35rem .25rem; }
@media (min-width: 992px) { .app-toast { bottom: var(--toast-lift-lg, 1.5rem); } }

/* Páginas de app con barra inferior en el móvil: reservan su alto (--bn-h) */
.app-body { --bn-h: 3.75rem; }

/* «Saltar al contenido»: solo se ve al enfocarlo con el teclado */
.skip-link { position: absolute; left: .5rem; top: -4rem; z-index: 2000; padding: .5rem .9rem; border-radius: .5rem; background: var(--brand-pink); color: #fff; font-weight: 600; text-decoration: none; }
.skip-link:focus { top: .5rem; outline: 2px solid #fff; outline-offset: 2px; }
main:focus { outline: none; }

/* Inicio: buscador de apps */
.home-search { max-width: 560px; margin: 0 auto 1.25rem; }

/* Inicio: grupos plegables con contador, y orden manual de las favoritas */
.home-group { justify-content: flex-start; }
.home-fold { display: inline-flex; align-items: center; gap: .5rem; padding: 0; background: none; border: 0; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.home-fold:hover .home-name { color: var(--text-strong); }
.home-fold > i:first-child { color: var(--brand-pink); }
.home-count { font-weight: 600; opacity: .75; letter-spacing: 0; }
.home-chev { font-size: .7rem; transition: transform .2s; }
.home-group.folded .home-chev { transform: rotate(-90deg); }
.home-group.folded + .app-grid { display: none; }
#homeApps.searching .home-group.folded + .app-grid { display: grid; }
@media (prefers-reduced-motion: reduce) { .home-chev { transition: none; } }
.fav-order { margin-left: auto; padding: .2rem .65rem; background: var(--surface-3); border: 1px solid var(--surface-4); border-radius: .6rem; color: var(--text-muted); font-size: .75rem; font-weight: 600; letter-spacing: 0; text-transform: none; }
.fav-order[aria-pressed="true"] { color: #fff; background: var(--brand-gradient); border-color: var(--btn-edge); }
.fav-ord { display: none; }
#favSection.order-mode .fav-ord { position: absolute; left: .45rem; bottom: .45rem; z-index: 2; display: flex; gap: .3rem; }
#favSection.order-mode .app-card { padding-bottom: 3rem; }
#favSection.order-mode .app-card:hover { transform: none; }
.fav-mv { width: 2.2rem; height: 2.2rem; display: grid; place-items: center; background: var(--surface-1); border: 1px solid var(--surface-4); border-radius: .6rem; color: var(--text-main); }
.fav-mv:disabled { opacity: .35; }
.fav-mv:not(:disabled):hover { border-color: var(--brand-pink); }
.app-item.fav-moved .app-card { border-color: var(--brand-pink); box-shadow: 0 0 0 2px rgba(255, 51, 128, .35); }
