:root {
  --mobile-nav-height: 72px;
  --mobile-safe-bottom: env(safe-area-inset-bottom, 0px);
  --mobile-safe-top: env(safe-area-inset-top, 0px);
}

/* El marketplace móvil usa siempre una superficie oscura para este panel. */
@media (max-width: 760px) {
  /* El menú desplegable necesita colores propios: el header oscuro no debe
     heredarlos sobre la tarjeta clara. */
  html[data-theme="light"] .mobile-menu-panel {
    color-scheme: light;
    background: #ffffff !important;
    border-color: #dbe4f0 !important;
  }

  html[data-theme="light"] .mobile-menu-panel a {
    color: #102a52 !important;
    background: #f4f7fb !important;
    border: 1px solid #e5ebf3;
  }

  html[data-theme="light"] .mobile-menu-panel a::after {
    color: #54749c !important;
  }

  html[data-theme="dark"] .mobile-menu-panel {
    color-scheme: dark;
    background: #080b10 !important;
    border-color: #252c37 !important;
  }

  html[data-theme="dark"] .mobile-menu-panel a {
    color: #e8eef8 !important;
    background: #121823 !important;
    border: 1px solid #222c3b;
  }

  html[data-theme="dark"] .mobile-menu-panel a::after {
    color: #8fb8ff !important;
  }

  body:not(.mobile-subpage) .category-drawer {
    color-scheme: dark;
    width: min(88vw, 360px);
    background: #080b10 !important;
    border-right: 1px solid #252c37 !important;
    scrollbar-color: #334155 #080b10;
  }

  body:not(.mobile-subpage) .category-drawer .drawer-header {
    min-height: calc(78px + var(--mobile-safe-top));
    padding-top: calc(1rem + var(--mobile-safe-top));
    background: linear-gradient(135deg, #071d41, #0b3675) !important;
  }

  body:not(.mobile-subpage) .category-drawer .drawer-section {
    padding: 1.15rem 1rem;
    border-bottom-color: #252c37 !important;
  }

  body:not(.mobile-subpage) .category-drawer .drawer-section h3 {
    margin: 0 0 0.6rem;
    padding-inline: 0.7rem;
    color: #ffc72c !important;
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  body:not(.mobile-subpage) .category-drawer .drawer-section a {
    min-height: 48px;
    margin-block: 3px;
    padding: 0.72rem 0.75rem;
    border: 1px solid transparent;
    border-radius: 12px;
    color: #dbe5f5 !important;
    font-size: 0.84rem;
    font-weight: 750;
  }

  body:not(.mobile-subpage) .category-drawer .drawer-section a:is(:hover, :focus-visible, :active) {
    border-color: rgba(143, 184, 255, 0.15);
    background: #121823 !important;
    color: #ffffff !important;
    outline: none;
  }

  body:not(.mobile-subpage) .category-drawer .drawer-section a span {
    color: #8fb8ff !important;
    font-size: 1.15rem;
  }
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.cl-mobile-nav {
  display: none;
}

@media (max-width: 760px) {
  html[data-native-app],
  html[data-native-app] body {
    scrollbar-width: none !important;
  }

  html[data-native-app]::-webkit-scrollbar,
  html[data-native-app] body::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
  }

  html[data-theme="dark"] .mobile-profile .dashboard-overview {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  .mobile-profile .page-layout {
    display: block !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: calc(100% - 28px) !important;
    max-width: none !important;
    margin-inline: 14px !important;
    gap: 0 !important;
  }

  .mobile-profile .content-column {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
  }

  /* Catálogo de app: dos tarjetas compactas por fila, incluso en 360 px. */
  .products-section > .container,
  .category-marketplace-section > .container {
    width: calc(100% - 20px) !important;
  }

  .product-grid,
  .category-shelf-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px !important;
  }

  .product-grid {
    margin-top: 12px !important;
  }

  .product-card,
  .product-skeleton {
    border-radius: 14px !important;
    box-shadow: 0 5px 16px rgba(7, 25, 58, 0.08) !important;
  }

  .product-media,
  .product-skeleton .skeleton-media {
    aspect-ratio: 4 / 5 !important;
  }

  .product-media img {
    object-fit: contain !important;
    background: #ffffff;
  }

  .product-body {
    padding: 9px 10px 11px !important;
  }

  .product-title {
    min-height: 32px !important;
    font-size: 0.79rem !important;
    line-height: 1.25 !important;
  }

  .product-price {
    margin-top: 5px !important;
    font-size: 1.08rem !important;
  }

  .product-meta {
    gap: 4px !important;
    margin-top: 6px !important;
    font-size: 0.66rem !important;
  }

  .product-meta span,
  .product-school-link {
    display: block;
    overflow: hidden;
    font-size: 0.66rem !important;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .product-attribute-chips,
  .product-academic-meta {
    gap: 4px !important;
    margin-top: 6px !important;
    overflow: hidden;
    flex-wrap: nowrap !important;
  }

  .product-size-chip,
  .product-academic-meta {
    padding: 4px 6px !important;
    font-size: 0.58rem !important;
    white-space: nowrap;
  }

  .condition-badge {
    top: 8px !important;
    left: 8px !important;
    min-height: 23px !important;
    padding-inline: 7px !important;
    font-size: 0.59rem !important;
  }

  .favorite-button {
    top: 7px !important;
    right: 7px !important;
    width: 32px !important;
    height: 32px !important;
  }

  .product-skeleton {
    padding-bottom: 10px !important;
  }

  .product-skeleton .skeleton-body {
    padding: 9px 10px 0 !important;
  }

  .product-skeleton .skeleton-pill {
    display: none;
  }

  .cl-mobile-nav__item:last-child span {
    overflow: visible !important;
    font-size: 0.54rem !important;
    letter-spacing: -0.025em;
    text-overflow: clip !important;
    white-space: nowrap !important;
  }

  html {
    scroll-padding-top: 88px;
  }

  body {
    min-width: 0;
  }

  body[data-mobile-nav="true"] {
    padding-bottom: calc(var(--mobile-nav-height) + var(--mobile-safe-bottom));
  }

  img,
  video,
  canvas,
  svg {
    max-width: 100%;
  }

  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  button,
  input,
  select,
  textarea,
  a {
    -webkit-tap-highlight-color: transparent;
  }

  button,
  [role="button"],
  input[type="button"],
  input[type="submit"],
  input[type="reset"] {
    touch-action: manipulation;
  }

  .cl-mobile-nav {
    position: fixed;
    z-index: 120;
    right: 8px;
    bottom: max(8px, var(--mobile-safe-bottom));
    left: 8px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: end;
    min-height: var(--mobile-nav-height);
    padding: 7px 8px;
    border: 1px solid rgba(214, 224, 238, 0.92);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 44px rgba(7, 25, 58, 0.22);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .cl-mobile-nav__item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    min-height: 54px;
    padding: 5px 2px;
    border-radius: 16px;
    color: #60708a;
    text-decoration: none;
    touch-action: manipulation;
  }

  .cl-mobile-nav__item svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .cl-mobile-nav__item span {
    max-width: 100%;
    overflow: hidden;
    font-size: 0.66rem;
    font-weight: 750;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .cl-mobile-nav__item[aria-current="page"] {
    background: #edf4ff;
    color: #0b2e6b;
  }

  .cl-mobile-nav__item--publish {
    width: 58px;
    height: 58px;
    min-height: 58px;
    margin: -18px auto 0;
    border-radius: 19px;
    background: linear-gradient(145deg, #72d33d, #55b92a);
    color: #092356;
    box-shadow: 0 12px 24px rgba(103, 194, 58, 0.3);
  }

  .cl-mobile-nav__item--publish svg {
    width: 25px;
    height: 25px;
    stroke-width: 2.2;
  }

  .cl-mobile-nav__item--publish span {
    color: #092356;
    font-size: 0.62rem;
  }

  body[data-mobile-nav="true"] .mobile-shortcuts,
  body[data-mobile-nav="true"] #mobile-publish-link {
    display: none !important;
  }

  body[data-mobile-nav="true"] .notification-center,
  body[data-mobile-nav="true"] .toast,
  body[data-mobile-nav="true"] .profile-toast,
  body[data-mobile-nav="true"] .favorite-toast {
    bottom: calc(var(--mobile-nav-height) + var(--mobile-safe-bottom) + 18px) !important;
  }

  .modal__dialog,
  .safety-modal__dialog,
  .report-modal__dialog,
  .school-search-card,
  [role="dialog"] {
    max-width: calc(100vw - 20px);
    max-height: calc(100dvh - 24px);
  }

  .modal__dialog,
  .safety-modal__dialog,
  .report-modal__dialog,
  .school-search-card {
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .form-actions,
  .detail-actions,
  .settings-actions {
    padding-bottom: max(4px, var(--mobile-safe-bottom));
  }

  .table-wrap,
  .admin-table-wrap,
  .moderation-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 430px) {
  :root {
    --mobile-nav-height: 68px;
  }

  .cl-mobile-nav {
    right: 6px;
    bottom: max(6px, var(--mobile-safe-bottom));
    left: 6px;
    padding-inline: 5px;
    border-radius: 21px;
  }

  .cl-mobile-nav__item {
    min-height: 50px;
  }

  .cl-mobile-nav__item svg {
    width: 20px;
    height: 20px;
  }

  .cl-mobile-nav__item span {
    font-size: 0.59rem;
  }

  .cl-mobile-nav__item--publish {
    width: 54px;
    height: 54px;
    min-height: 54px;
    margin-top: -16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cl-mobile-nav,
  .cl-mobile-nav__item {
    scroll-behavior: auto;
    transition: none !important;
  }
}

html[data-theme="dark"] .cl-mobile-nav {
  border-color: rgba(107, 132, 168, 0.28);
  background: rgba(10, 15, 24, 0.97);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.46);
}

html[data-theme="dark"] .cl-mobile-nav__item {
  color: #9db0cc;
}

html[data-theme="dark"] .cl-mobile-nav__item[aria-current="page"] {
  background: rgba(41, 91, 163, 0.28);
  color: #f2f7ff;
}

/* V31 · app bar móvil compacta, inspirada en marketplaces.
   Estas reglas son deliberadamente finales para impedir que estilos de
   escritorio vuelvan a mostrar dos logos en el Home. */
@media (max-width: 760px) {
  body:not(.mobile-subpage) .site-header {
    position: sticky;
    top: 0;
    z-index: 110;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 1px 0 rgba(11, 46, 107, 0.1);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  body:not(.mobile-subpage) .site-header .container {
    width: min(calc(100% - 28px), var(--container));
  }

  body:not(.mobile-subpage) .site-header .brand--desktop {
    display: none !important;
  }

  body:not(.mobile-subpage) .site-header .header-top {
    display: block !important;
    min-height: 0 !important;
    padding: 10px 0 8px !important;
  }

  body:not(.mobile-subpage) .site-header .header-actions-wrap {
    display: flex !important;
    min-height: 50px !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  body:not(.mobile-subpage) .site-header .brand--mobile {
    display: inline-flex !important;
    flex: 0 0 148px !important;
    width: 148px !important;
    height: 50px !important;
    min-width: 148px !important;
    min-height: 50px !important;
    padding: 7px 10px !important;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(11, 46, 107, 0.08);
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 5px 15px rgba(7, 25, 58, 0.08);
  }

  body:not(.mobile-subpage) .site-header .brand--mobile img {
    display: block !important;
    width: 126px !important;
    height: 36px !important;
    max-width: 126px !important;
    max-height: 36px !important;
    object-fit: contain;
  }

  body:not(.mobile-subpage) .site-header .header-actions--mobile {
    display: flex !important;
    width: auto;
    margin-left: auto;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
  }

  body:not(.mobile-subpage) .site-header .mobile-session-button {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 12px;
    border: 1px solid rgba(11, 46, 107, 0.12);
    border-radius: 13px;
    background: #ffffff;
    color: #0b2e6b;
    box-shadow: 0 5px 15px rgba(7, 25, 58, 0.08);
    font-size: 0.78rem;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
  }

  body:not(.mobile-subpage) .site-header .mobile-session-button span {
    display: block;
    white-space: nowrap;
  }

  body:not(.mobile-subpage) .site-header .mobile-session-button .icon {
    width: 20px;
    height: 20px;
  }

  body:not(.mobile-subpage) .site-header .menu-toggle {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border: 1px solid rgba(11, 46, 107, 0.12);
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 5px 15px rgba(7, 25, 58, 0.08);
  }

  body:not(.mobile-subpage) .site-header .search-bar--mobile {
    display: flex !important;
    min-height: 50px !important;
    margin: 0 0 10px !important;
    padding: 3px 4px 3px 14px !important;
    border-radius: 15px !important;
  }

  body:not(.mobile-subpage) .site-header .search-bar--mobile .search-submit {
    flex: 0 0 43px;
    width: 43px;
    height: 43px;
  }

  body:not(.mobile-subpage) .site-header :is(
    .search-bar--desktop,
    .header-actions--desktop,
    .mobile-shortcuts,
    .header-nav
  ) {
    display: none !important;
  }

  html[data-theme="dark"] body:not(.mobile-subpage) .site-header {
    background: rgba(7, 9, 12, 0.98);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1);
  }

  html[data-theme="dark"] body:not(.mobile-subpage) .site-header .menu-toggle {
    border-color: rgba(255, 255, 255, 0.12);
    background: #141922;
    color: #dce7f8;
  }

  html[data-theme="dark"] body:not(.mobile-subpage) .site-header .mobile-session-button {
    border-color: rgba(255, 255, 255, 0.12);
    background: #141922;
    color: #f1f6ff;
  }
}

/* --------------------------------------------------------------------------
   ColegioLibre · interfaz móvil de aplicación
   Estas reglas reemplazan el header de escritorio únicamente en subpáginas.
   -------------------------------------------------------------------------- */
@media (max-width: 760px) {
  :root {
    --mobile-nav-height: 62px;
  }

  body[data-mobile-nav="true"] {
    padding-bottom: calc(var(--mobile-nav-height) + var(--mobile-safe-bottom) + 10px);
  }

  .cl-mobile-nav {
    right: 0;
    bottom: 0;
    left: 0;
    min-height: var(--mobile-nav-height);
    padding: 4px 8px max(4px, var(--mobile-safe-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -8px 28px rgba(7, 25, 58, 0.14);
  }

  .cl-mobile-nav__item {
    min-height: 48px;
    padding: 4px 2px;
    border-radius: 13px;
  }

  .cl-mobile-nav__item--publish {
    width: 50px;
    height: 50px;
    min-height: 50px;
    margin-top: -10px;
    border-radius: 16px;
    box-shadow: 0 8px 18px rgba(103, 194, 58, 0.25);
  }

  .cl-mobile-nav__item span,
  .cl-mobile-nav__item--publish span {
    font-size: 0.58rem;
  }

  /*
   * Preferencias móviles
   * En la versión anterior convivían `top` y `bottom` por una diferencia de
   * especificidad. Eso estiraba el control hasta convertirlo en la franja
   * vertical que tapaba mensajes, perfil y producto.
   */
  .mobile-subpage[data-mobile-nav="true"] .preference-controls {
    top: 12px !important;
    right: 10px !important;
    bottom: auto !important;
    left: auto !important;
    z-index: 125;
    display: flex !important;
    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: 44px !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 2px !important;
    padding: 3px !important;
    overflow: visible !important;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(7, 25, 58, 0.14);
  }

  .mobile-subpage[data-mobile-nav="true"] .preference-controls__button {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
  }

  body:not(.mobile-subpage)[data-mobile-nav="true"] .preference-controls {
    top: auto !important;
    right: 10px !important;
    bottom: calc(var(--mobile-nav-height) + var(--mobile-safe-bottom) + 10px) !important;
    left: auto !important;
    z-index: 125;
    display: flex !important;
    width: auto !important;
    height: auto !important;
    max-height: 44px !important;
    flex-direction: row !important;
    gap: 2px !important;
    padding: 3px !important;
    border-radius: 14px;
  }

  body:not(.mobile-subpage)[data-mobile-nav="true"] .preference-controls__button {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
  }

  /*
   * El panel se ancla al viewport en celular. Las declaraciones importantes
   * también neutralizan coordenadas inline creadas al abrirlo en desktop.
   */
  body[data-mobile-nav="true"] .cl-notification-panel {
    top: 72px !important;
    right: 10px !important;
    bottom: auto !important;
    left: 10px !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    max-height: calc(100dvh - 154px) !important;
    overflow: hidden !important;
    border-radius: 20px !important;
  }

  body[data-mobile-nav="true"] .cl-notification-panel[hidden] {
    display: none !important;
  }

  body[data-mobile-nav="true"] .cl-notification-list {
    max-height: calc(100dvh - 275px) !important;
    overflow-y: auto !important;
  }

  /* Encabezado compacto y uniforme de las pantallas internas. */
  .mobile-subpage .site-header {
    position: sticky;
    top: 0;
    z-index: 110;
    min-height: 64px;
    box-shadow: 0 1px 0 rgba(128, 145, 168, 0.18);
  }

  .mobile-subpage .site-header__row {
    display: flex !important;
    width: 100%;
    min-height: 64px !important;
    padding: 8px 94px 8px 14px !important;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
  }

  .mobile-subpage .site-header .brand-link {
    display: inline-flex;
    width: auto;
    min-height: 46px;
    align-items: center;
    padding: 5px 8px !important;
    border-radius: 12px;
    background: #ffffff !important;
    box-shadow: 0 5px 16px rgba(7, 25, 58, 0.12) !important;
  }

  .mobile-subpage .site-header .brand-link img {
    width: 134px !important;
    height: auto !important;
    max-height: 46px !important;
    object-fit: contain;
  }

  .mobile-subpage .site-header .search-bar,
  .mobile-subpage .site-header .header-actions {
    display: none !important;
  }

  .mobile-profile .site-header__brand-row {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;
  }

  .mobile-profile .account-toggle {
    display: inline-flex;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    min-height: 42px;
    border-radius: 13px;
  }

  .publish-body .publish-page,
  .product-detail-body .product-page,
  .mobile-messages .messages-page,
  .mobile-profile .page-layout,
  .mobile-favorites .favorites-main {
    padding-top: 20px !important;
  }

  .publish-body .page-intro h1,
  .mobile-profile .content-header h1,
  .mobile-favorites .favorites-hero h1 {
    font-size: clamp(2rem, 9vw, 2.55rem) !important;
    line-height: 1.04 !important;
    letter-spacing: -0.045em;
  }

  .publish-body .page-intro p,
  .mobile-profile .content-header p,
  .mobile-favorites .favorites-hero p {
    font-size: 1rem !important;
    line-height: 1.55 !important;
  }

  /* Favoritos usa un header propio: se convierte en la misma app bar. */
  .mobile-favorites .favorites-header {
    position: sticky;
    top: 0;
    z-index: 110;
    min-height: 64px;
    box-shadow: 0 1px 0 rgba(128, 145, 168, 0.18);
  }

  .mobile-favorites .favorites-header__inner {
    width: 100%;
    min-height: 64px;
    padding: 8px 76px 8px 14px;
    align-items: center;
    justify-content: flex-start !important;
  }

  .mobile-favorites .favorites-brand {
    min-height: 46px;
    padding: 5px 8px !important;
    border-radius: 12px;
    background: #ffffff !important;
    box-shadow: 0 5px 16px rgba(7, 25, 58, 0.12) !important;
  }

  .mobile-favorites .favorites-brand img {
    display: block;
    width: 142px !important;
    max-height: 46px;
    object-fit: contain;
  }

  .mobile-favorites .favorites-nav {
    display: none !important;
  }

  .mobile-favorites .favorites-hero {
    gap: 18px;
  }

  .mobile-favorites .favorites-total {
    width: 100%;
    padding: 18px 20px;
    border-radius: 20px;
  }

  /* Publicar: controles cómodos, sin preview de escritorio arriba del form. */
  .publish-body .publish-layout {
    gap: 24px;
  }

  .publish-body .field-row {
    flex-direction: column;
  }

  .publish-body .field-group--compact {
    width: 100%;
  }

  .publish-body .preview-panel {
    position: static;
    order: 2;
    padding: 18px;
    border-radius: 22px;
  }

  .publish-body .condition-selector {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .publish-body .condition-selector label {
    width: 100%;
    min-height: 46px;
  }

  /* Mensajes: lista limpia y sin marco gigante vacío. */
  .mobile-messages .messages-page {
    width: 100%;
    padding-inline: 10px;
  }

  .mobile-messages .messages-app {
    min-height: calc(100dvh - 146px);
    border: 0;
    border-radius: 22px 22px 0 0;
    box-shadow: none;
  }

  .mobile-messages .inbox-header {
    padding: 18px 16px;
  }

  .mobile-messages .inbox-header h1 {
    font-size: 2rem;
    line-height: 1.05;
  }

  /* Perfil: evita los bloques desproporcionados de la captura. */
  .mobile-profile .page-layout {
    width: min(100% - 24px, var(--site-width));
  }

  .mobile-profile .content-header {
    gap: 16px;
  }

  .mobile-profile .dashboard-overview {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .mobile-profile .dashboard-overview__head,
  .mobile-profile .dashboard-metrics,
  .mobile-profile .dashboard-profile-card__grid {
    gap: 12px;
  }

  .mobile-profile .dashboard-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .mobile-profile .dashboard-metric-card {
    min-height: 74px !important;
    padding: 10px !important;
  }

  .mobile-profile .dashboard-overview__head {
    flex-direction: column;
  }

  .mobile-profile .dashboard-overview {
    padding: 0;
  }

  .mobile-profile .dashboard-overview__summary {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  .mobile-profile .dashboard-metric-card__label {
    margin-bottom: 5px;
    font-size: 0.78rem;
  }

  .mobile-profile .dashboard-metric-card strong {
    font-size: 1.25rem;
  }

  .mobile-profile .dashboard-profile-card {
    margin-top: 12px;
    padding: 14px;
    border-radius: 16px;
  }

  .mobile-profile .dashboard-profile-card__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .mobile-profile .dashboard-profile-card strong {
    font-size: 0.9rem;
  }

  .mobile-profile .mobile-profile-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
  }

  .mobile-profile .mobile-profile-action {
    min-height: 46px;
    border: 1px solid rgba(113, 137, 171, 0.25);
    border-radius: 14px;
    background: #111821;
    color: #eaf1fb;
    font-weight: 750;
  }

  .mobile-profile .mobile-profile-action--logout {
    color: #ffb7b7;
  }

  /* Producto: galería proporcionada para una pantalla angosta. */
  .product-detail-body .breadcrumbs {
    margin-bottom: 14px;
  }

  .product-detail-body .gallery-stage,
  .product-detail-body .gallery-stage__media {
    min-height: min(88vw, 390px) !important;
  }

  .product-detail-body .gallery-stage {
    border-radius: 22px;
  }

  /* Home: una sola búsqueda. Antes convivían la versión desktop y mobile. */
  body:not(.mobile-subpage) .site-header .search-bar--desktop {
    display: none !important;
  }

  body:not(.mobile-subpage) .site-header .header-top {
    display: block;
    padding: 10px 0 8px;
  }

  body:not(.mobile-subpage) .site-header .header-actions-wrap {
    display: flex;
    min-height: 48px;
    align-items: center;
    justify-content: space-between;
  }

  body:not(.mobile-subpage) .site-header .brand--mobile {
    display: inline-flex;
    max-width: 150px;
  }

  body:not(.mobile-subpage) .site-header .brand--mobile img {
    width: 142px;
    max-height: 46px;
    object-fit: contain;
  }

  body:not(.mobile-subpage) .site-header .search-bar--mobile {
    display: flex;
    min-height: 52px;
    margin-bottom: 10px;
    padding: 4px 4px 4px 14px;
    align-items: center;
    flex-direction: row;
  }

  body:not(.mobile-subpage) .site-header .search-bar--mobile input {
    min-width: 0;
  }

  body:not(.mobile-subpage) .site-header .search-bar--mobile .search-submit {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
  }

  body:not(.mobile-subpage) .site-header .header-actions--mobile {
    margin-left: auto;
  }

  body:not(.mobile-subpage) .site-header #mobile-publish-link {
    display: none !important;
  }

}

@media (max-width: 390px) {
  .mobile-subpage .site-header .brand-link img,
  .mobile-favorites .favorites-brand img {
    width: 124px !important;
  }

  .publish-body .page-intro h1,
  .mobile-profile .content-header h1,
  .mobile-favorites .favorites-hero h1 {
    font-size: 2rem !important;
  }
}

@media (max-width: 360px) {
  .mobile-subpage .site-header__row {
    padding-right: 88px !important;
  }

  .mobile-subpage .site-header .brand-link img,
  .mobile-favorites .favorites-brand img {
    width: 116px !important;
  }

  .mobile-profile .dashboard-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* V32 · áreas seguras y composición nativa. */
@media (max-width: 760px) {
  html[data-native-app] {
    --mobile-safe-top: max(env(safe-area-inset-top, 0px), 30px);
    --mobile-safe-bottom: max(env(safe-area-inset-bottom, 0px), 18px);
  }

  body:not(.mobile-subpage) .site-header,
  .mobile-subpage .site-header,
  .mobile-favorites .favorites-header {
    padding-top: var(--mobile-safe-top) !important;
  }

  .mobile-subpage[data-mobile-nav="true"] .preference-controls {
    top: calc(var(--mobile-safe-top) + 10px) !important;
  }

  body[data-mobile-nav="true"] .cl-notification-panel {
    top: calc(var(--mobile-safe-top) + 70px) !important;
    max-height: calc(100dvh - var(--mobile-safe-top) - var(--mobile-nav-height) - var(--mobile-safe-bottom) - 22px) !important;
  }

  body[data-mobile-nav="true"] {
    padding-bottom: calc(var(--mobile-nav-height) + var(--mobile-safe-bottom) + 28px) !important;
  }

  .mobile-profile .profile-sidebar {
    height: 100dvh;
    max-height: 100dvh;
    padding-top: calc(var(--mobile-safe-top) + 22px);
    padding-bottom: calc(var(--mobile-safe-bottom) + 28px);
  }

  .mobile-profile .content-column,
  .mobile-favorites #favorites-results {
    padding-bottom: 30px;
  }

  .mobile-profile .security-banner {
    gap: 14px;
    margin-top: 22px;
    padding: 20px;
    border: 1px solid rgba(110, 136, 173, 0.2);
    background: #eef4fc;
  }

  .mobile-profile .security-banner__icon {
    width: 52px;
    height: 52px;
  }

  .mobile-profile .security-banner__copy h2,
  .mobile-profile .security-banner__copy p {
    color: #17335e;
  }

  html[data-theme="dark"] .mobile-profile .security-banner {
    border-color: rgba(255, 255, 255, 0.1);
    background: #101721;
  }

  html[data-theme="dark"] .mobile-profile .security-banner__copy h2 {
    color: #f5f8fc;
  }

  html[data-theme="dark"] .mobile-profile .security-banner__copy p {
    color: #b9c5d6;
  }

  .mobile-favorites .favorites-toolbar {
    padding: 18px;
    border-radius: 20px;
  }

  .mobile-favorites .favorite-card__image {
    aspect-ratio: 16 / 11;
    max-height: 260px;
  }

  .mobile-favorites .favorite-card__image img {
    object-fit: contain;
    padding: 12px;
  }

  .mobile-favorites .favorite-card__body {
    padding: 16px 18px 20px;
  }
}
