/**
 * PWA / mobile app-shell polish (chat, CRM, admin).
 * Conserva escritorio; refuerza touch, safe-area, teclado y densidad nativa del chat.
 */

:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --touch-min: 44px;
  --app-height: 100dvh;
}

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

body {
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  overscroll-behavior-y: none;
}

/* Evitar zoom accidental iOS (inputs < 16px) */
input,
select,
textarea,
button {
  font-size: 16px;
}

button,
.admin-btn,
a.admin-nav__link {
  min-height: var(--touch-min);
  min-width: var(--touch-min);
}

/* Chat: no forzar 44px en chips/composer; densidad más cercana a mensajería. */
body.page-chat button.chip,
body.page-chat .chip,
body.page-chat .chat-quick-replies__btn,
body.page-chat .chat-composer__send,
body.page-chat .chat-shell__icon-btn,
body.page-chat .chat-shell__header .btn--sm {
  min-height: 0;
  min-width: 0;
}

/* =========================================================================
   Encabezado compartido (Chat / CRM / Inicio) — un solo contrato visual
   ========================================================================= */

.app-header {
  --header-h: 52px;
}

@media (max-width: 767px) {
  .app-header {
    --header-h: 48px;
    padding-top: var(--safe-top);
  }

  .app-header__inner {
    min-height: var(--header-h);
    padding: 0.35rem 0.65rem;
    gap: 0.5rem;
  }

  .app-brand__mark {
    width: 1.75rem;
    height: 1.75rem;
    flex-basis: 1.75rem;
    border-radius: 8px;
    font-size: 0.68rem;
  }

  .app-brand__text {
    font-size: 0.95rem;
  }

  .app-nav {
    gap: 0.4rem;
    font-size: 0.82rem;
    align-items: center;
  }

  .app-nav a,
  .app-nav__current {
    padding: 0.35rem 0.45rem;
    border-radius: 10px;
  }

  .app-nav__with-icon {
    min-height: 44px;
    min-width: 44px;
    padding: 0.35rem 0.4rem;
  }

  /* Icon-only primary nav on narrow phones; aria-label / title keep the name. */
  .app-nav__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .app-nav__with-icon {
    position: relative;
  }

  .session-pill {
    max-width: 7.5rem;
    padding: 0.2rem 0.55rem;
    font-size: 0.78rem;
    min-height: 2rem;
  }
}

@media (max-width: 390px) {
  .app-brand__text {
    display: none;
  }
}

@media (min-width: 768px) {
  .app-header {
    --header-h: 56px;
  }

  .app-header__inner {
    min-height: var(--header-h);
    padding: 0.55rem 1rem;
  }

  .app-brand__mark {
    width: 2rem;
    height: 2rem;
    flex-basis: 2rem;
  }

  .app-brand__text {
    display: inline;
    font-size: 1rem;
  }

  .app-nav__label {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: nowrap;
    border: 0;
  }

  .session-pill {
    max-width: 9rem;
    font-size: 0.82rem;
    min-height: 2rem;
  }
}

/* =========================================================================
   Chat Universal — shell tipo app nativa (móvil primero; escritorio estable)
   ========================================================================= */

body.page-chat {
  display: flex;
  flex-direction: column;
  height: var(--app-height, 100dvh);
  max-height: var(--app-height, 100dvh);
  overflow: hidden;
  background: #e5ddd5;
  /* Keyboard / iOS visualViewport: keep layout in the visible viewport. */
  padding-top: var(--vv-offset-top, 0px);
  box-sizing: border-box;
}

body.page-chat .app-header {
  flex: 0 0 auto;
}

body.page-chat .app-header__inner {
  max-width: none;
}

body.page-chat .app-main {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  height: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.page-chat .app-footer {
  display: none;
}

body.page-chat .chat-shell {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

body.page-chat .chat-shell__header {
  flex: 0 0 auto;
  padding: 0.45rem 0.75rem;
}

body.page-chat .chat-shell__header-row {
  align-items: center;
  gap: 0.5rem;
}

body.page-chat .chat-shell__header h1 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

body.page-chat .chat-shell__header p {
  margin: 0.1rem 0 0;
  font-size: 0.72rem;
  line-height: 1.25;
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.page-chat .chat-shell__dev {
  margin: 0.25rem 0 0;
  font-size: 0.68rem;
}

body.page-chat .chat-shell__header .btn--sm {
  padding: 0.28rem 0.55rem;
  font-size: 0.72rem;
  min-height: 2rem;
  white-space: nowrap;
}

body.page-chat .chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0.55rem 0.6rem 0.35rem;
  gap: var(--chat-bubble-gap, 0.28rem);
}

body.page-chat .chat-bubble {
  max-width: var(--chat-bubble-max, min(88%, 22rem));
  padding: 0.38rem 0.55rem 0.28rem;
  border-radius: 14px;
  font-size: var(--chat-font-size, 0.9rem);
  line-height: var(--chat-line-height, 1.32);
  box-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.05);
}

body.page-chat .chat-bubble--bot {
  border-bottom-left-radius: 4px;
}

body.page-chat .chat-bubble--user {
  border-bottom-right-radius: 4px;
}

body.page-chat .chat-bubble__meta {
  font-size: var(--chat-meta-size, 0.62rem);
  margin-top: 0.1rem;
  gap: 0.25rem;
}

body.page-chat .chat-bubble__ai-tag {
  font-size: 0.6rem;
  padding: 0.02rem 0.28rem;
}

body.page-chat .chat-bubble__action {
  margin-top: 0.45rem;
}

body.page-chat .chat-quick-replies {
  gap: 0.3rem;
  margin-top: 0.45rem;
}

body.page-chat .chat-quick-replies__btn {
  padding: 0.32rem 0.62rem;
  font-size: 0.78rem;
  min-height: 2rem;
}

body.page-chat .chat-delivery-card__title {
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

body.page-chat .chat-delivery-card__textarea {
  min-height: 9rem;
  max-height: 14rem;
  padding: 0.55rem 0.65rem;
  font-size: 16px;
  line-height: 1.4;
}

body.page-chat .chat-delivery-card__actions {
  gap: 0.35rem;
  margin-top: 0.45rem;
}

body.page-chat .chat-delivery-card__btn {
  min-width: 0;
  flex: 1 1 calc(50% - 0.35rem);
  font-size: 0.8rem;
  padding: 0.45rem 0.55rem;
  min-height: 2.35rem;
}

body.page-chat .chat-composer {
  flex: 0 0 auto;
  position: relative;
  bottom: auto;
  padding-bottom: max(0.35rem, var(--safe-bottom));
  border-top: 1px solid var(--composer-border);
  background: var(--composer-bg);
}

body.page-chat .chat-chips {
  gap: 0.35rem;
  padding: 0.35rem 0.55rem 0.15rem;
}

body.page-chat .chip,
body.page-chat button.chip,
body.page-chat a.chip {
  min-height: 2rem;
  min-width: 0;
  padding: 0.28rem 0.62rem;
  font-size: 0.75rem;
  line-height: 1.2;
}

body.page-chat .chat-form {
  gap: 0.4rem;
  padding: 0.3rem 0.55rem 0.35rem;
  align-items: flex-end;
}

body.page-chat .chat-form__textarea,
body.page-chat .chat-form__secure {
  padding: 0.5rem 0.75rem;
  font-size: 16px;
  line-height: 1.35;
  border-radius: 20px;
  min-height: 2.35rem;
  max-height: 7rem;
  background: var(--composer-input-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

body.page-chat .chat-composer__send {
  min-height: 2.35rem;
  min-width: 2.35rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  border-radius: 999px;
  align-self: flex-end;
}

@media (max-width: 767px) {
  body.page-chat {
    --chat-font-size: 0.875rem;
    --chat-line-height: 1.3;
    --chat-meta-size: 0.58rem;
    --chat-header-size: 0.88rem;
    --chat-bubble-gap: 0.22rem;
    --chat-bubble-max: min(86%, 20rem);
  }

  body.page-chat .app-header {
    --header-h: 44px;
  }

  body.page-chat .app-header__inner {
    min-height: var(--header-h);
    padding: 0.25rem 0.5rem;
    gap: 0.35rem;
  }

  body.page-chat .app-nav__with-icon {
    min-height: 40px;
    min-width: 40px;
    padding: 0.28rem 0.32rem;
  }

  body.page-chat .chat-shell__header {
    padding: 0.32rem 0.55rem;
  }

  body.page-chat .chat-shell__header h1 {
    font-size: var(--chat-header-size);
  }

  body.page-chat .chat-shell__header p {
    font-size: 0.68rem;
    max-width: 14rem;
  }

  body.page-chat .chat-shell__header .btn--sm,
  body.page-chat .chat-shell__easy-read-btn {
    padding: 0.22rem 0.4rem;
    font-size: 0.68rem;
    min-height: 1.85rem;
    min-width: 1.85rem;
  }

  body.page-chat .chat-messages {
    padding: 0.4rem 0.45rem 0.28rem;
    gap: var(--chat-bubble-gap);
  }

  body.page-chat .chat-bubble {
    max-width: var(--chat-bubble-max);
    padding: 0.3rem 0.48rem 0.22rem;
    border-radius: 12px;
    font-size: var(--chat-font-size);
    line-height: var(--chat-line-height);
  }

  body.page-chat .chat-quick-replies {
    gap: 0.22rem;
    margin-top: 0.32rem;
  }

  body.page-chat .chat-quick-replies__btn {
    padding: 0.26rem 0.5rem;
    font-size: 0.72rem;
    min-height: 1.75rem;
  }

  body.page-chat .chat-chips {
    gap: 0.25rem;
    padding: 0.22rem 0.45rem 0.1rem;
  }

  body.page-chat .chip,
  body.page-chat button.chip,
  body.page-chat a.chip {
    min-height: 1.75rem;
    padding: 0.22rem 0.5rem;
    font-size: 0.7rem;
  }

  body.page-chat .chat-form {
    gap: 0.3rem;
    padding: 0.22rem 0.45rem 0.28rem;
  }

  body.page-chat .chat-form__textarea,
  body.page-chat .chat-form__secure {
    padding: 0.42rem 0.65rem;
    font-size: 16px; /* evita zoom iOS/Android */
    line-height: 1.3;
    border-radius: 18px;
    min-height: 2.1rem;
    max-height: 6rem;
  }

  body.page-chat .chat-composer {
    padding-bottom: max(0.22rem, var(--safe-bottom));
  }

  body.page-chat .chat-composer__send {
    min-height: 2.1rem;
    min-width: 2.1rem;
    padding: 0.35rem 0.7rem;
    font-size: 0.78rem;
  }

  body.page-chat .session-pill {
    max-width: 6.5rem;
    padding: 0.15rem 0.45rem;
    font-size: 0.72rem;
    min-height: 1.75rem;
  }
}

@media (max-width: 390px) {
  body.page-chat {
    --chat-font-size: 0.85rem;
    --chat-bubble-max: 90%;
  }

  body.page-chat .chat-shell__header h1 {
    font-size: 0.84rem;
  }

  body.page-chat .chat-composer__send {
    padding: 0.32rem 0.58rem;
  }

  body.page-chat .app-nav {
    gap: 0.22rem;
  }

  body.page-chat .app-nav__with-icon {
    min-height: 38px;
    min-width: 38px;
    padding: 0.28rem 0.3rem;
  }
}

@media (max-width: 480px) {
  body.page-chat .chat-messages {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  body.page-chat .chat-shell__header .btn--sm {
    padding: 0.25rem 0.45rem;
  }
}

@media (min-width: 641px) and (max-width: 900px) {
  body.page-chat .app-main {
    max-width: 720px;
    margin: 0 auto;
  }
}

@media (min-width: 768px) {
  body.page-chat {
    background: var(--color-bg, #f8fafc);
  }

  body.page-chat .app-header {
    padding-top: 0;
  }

  body.page-chat .app-header__inner {
    max-width: 960px;
    margin: 0 auto;
  }

  /* Must stay inline-flex: display:inline breaks icon+label capsule layout. */
  body.page-chat .app-nav a[href*="categories.php"],
  body.page-chat .app-nav a.app-nav__estado,
  body.page-chat .app-nav__with-icon,
  body.page-chat .app-nav button.app-nav__with-icon {
    display: inline-flex;
  }

  body.page-chat .app-main {
    max-width: 720px;
    margin: 0 auto;
    height: calc(var(--app-height, 100dvh) - var(--header-h, 56px));
  }

  body.page-chat .chat-shell {
    border-left: 1px solid var(--color-border, #e2e8f0);
    border-right: 1px solid var(--color-border, #e2e8f0);
  }

  body.page-chat .chat-shell__header {
    padding: 0.75rem 1rem;
  }

  body.page-chat .chat-shell__header h1 {
    font-size: 1.05rem;
  }

  body.page-chat .chat-shell__header p {
    font-size: 0.82rem;
    max-width: none;
    white-space: normal;
  }

  body.page-chat .chat-messages {
    padding: 0.75rem 0.85rem 0.5rem;
    gap: var(--chat-bubble-gap, 0.35rem);
  }

  body.page-chat .chat-bubble {
    max-width: var(--chat-bubble-max, min(82%, 420px));
    padding: 0.45rem 0.65rem 0.35rem;
    font-size: var(--chat-font-size, 0.92rem);
  }

  body.page-chat .chat-composer {
    background: var(--composer-bg);
    padding-bottom: 0;
  }

  body.page-chat .chat-form {
    padding: 0.5rem 0.75rem 0.65rem;
  }

  body.page-chat .chat-form__textarea,
  body.page-chat .chat-form__secure {
    font-size: 0.95rem;
    padding: 0.65rem 0.9rem;
    min-height: 2.6rem;
  }

  body.page-chat .chat-composer__send {
    min-width: 4.5rem;
    padding: 0.65rem 1rem;
    font-size: 0.95rem;
  }

  body.page-chat .chip,
  body.page-chat button.chip,
  body.page-chat a.chip {
    font-size: 0.8rem;
    padding: 0.35rem 0.7rem;
  }

  body.page-chat .chat-delivery-card__textarea {
    min-height: 14rem;
    max-height: 20rem;
    font-size: 0.95rem;
  }
}

@media (orientation: landscape) and (max-height: 480px) {
  body.page-chat .chat-shell__header {
    padding: 0.25rem 0.65rem;
  }

  body.page-chat .chat-shell__header p,
  body.page-chat .chat-shell__dev {
    display: none;
  }

  body.page-chat .chat-chips {
    padding-top: 0.2rem;
    padding-bottom: 0;
  }

  body.page-chat .chat-messages {
    padding-top: 0.35rem;
  }
}

/* Standalone PWA: menos “chrome” de navegador */
@media (display-mode: standalone) {
  body.page-chat .app-header {
    border-bottom-color: var(--composer-border);
  }
}

.admin-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.page-admin,
.page-crm,
.page-crm-guest {
  overflow-x: hidden;
}

/* CRM — shell tipo app (móvil); el scroll vive en el contenido */
@media (max-width: 767px) {
  body.page-crm {
    display: flex;
    flex-direction: column;
    min-height: var(--app-height, 100dvh);
    height: var(--app-height, 100dvh);
    max-height: var(--app-height, 100dvh);
    overflow: hidden;
    background:
      radial-gradient(120% 80% at 0% 0%, rgba(45, 212, 191, 0.12), transparent 55%),
      radial-gradient(90% 60% at 100% 0%, rgba(139, 92, 246, 0.1), transparent 50%),
      #f8fafc;
  }

  body.page-crm .app-header {
    flex: 0 0 auto;
  }

  body.page-crm .app-main {
    flex: 1 1 auto;
    min-height: 0;
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0.65rem 0.7rem calc(4.35rem + var(--safe-bottom));
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.page-crm .app-footer {
    display: none;
  }

  body.page-crm-guest .app-main {
    padding-bottom: max(1.25rem, var(--safe-bottom));
  }
}

@media (display-mode: standalone) {
  body.page-crm .app-header {
    border-bottom-color: rgba(15, 23, 42, 0.06);
  }
}

@media (max-width: 768px) {
  .admin-shell {
    flex-direction: column;
  }

  .admin-nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.35rem;
    padding: 0.5rem;
    -webkit-overflow-scrolling: touch;
  }

  .admin-nav__link {
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .admin-top {
    padding-top: max(0.75rem, var(--safe-top));
  }

  .admin-main {
    padding-bottom: max(1rem, var(--safe-bottom));
  }
}

.offline-banner {
  display: none;
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fef3c7;
  color: #92400e;
  text-align: center;
  padding: 0.5rem;
  font-size: 0.9rem;
}

.offline-banner.is-visible {
  display: block;
}

/* Historial clientes + timeline + filtro TuAPI (móvil) */
@media (max-width: 767px) {
  body.page-chat .chat-history-panel__sheet {
    padding-bottom: calc(56px + var(--safe-bottom));
  }

  body.page-chat .chat-history-item {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    padding: 0.55rem 0.75rem;
    gap: 0.7rem;
    min-height: 0;
  }

  body.page-chat .chat-history-item__avatar {
    width: 50px;
    height: 50px;
    font-size: 0.95rem;
  }

  body.page-chat .chat-history-item__title {
    font-size: 0.92rem;
  }

  body.page-chat .chat-history-item__preview {
    font-size: 0.78rem;
    -webkit-line-clamp: 2;
  }

  body.page-chat .chat-history-item__time {
    font-size: 0.7rem;
  }

  body.page-chat .chat-history-detail__header {
    gap: 0.4rem;
    margin-bottom: 0.55rem;
  }

  body.page-chat .chat-history-detail__header h3 {
    font-size: 0.95rem;
  }

  body.page-chat .chat-timeline-event {
    padding: 0.55rem 0.65rem;
    border-radius: 10px;
  }

  body.page-chat .chat-timeline-event__title {
    font-size: 0.84rem;
  }

  body.page-chat .chat-timeline-event__body {
    font-size: 0.82rem;
    line-height: 1.4;
  }

  body.page-chat .chat-timeline-event__time {
    font-size: 0.68rem;
  }

  body.page-chat .chat-tuapi-filter__sheet {
    left: 0.65rem;
    right: 0.65rem;
    top: auto;
    bottom: max(0.75rem, var(--safe-bottom));
    width: auto;
    transform: none;
    border-radius: 14px 14px 12px 12px;
    padding: 0.85rem 0.9rem 1rem;
  }

  body.page-chat .chat-shell__tuapi-history-btn .chat-shell__icon-btn-label {
    display: none;
  }

  body.page-chat .app-nav__bell {
    min-width: 2.25rem;
    min-height: 2.25rem;
  }

  body.page-chat .chat-history-day-sep {
    font-size: 0.72rem;
    margin: 0.55rem 0 0.25rem;
  }
}

@media (max-width: 390px) {
  body.page-chat .chat-history-item__avatar {
    width: 48px;
    height: 48px;
  }

  body.page-chat .chat-timeline-event {
    padding: 0.45rem 0.55rem;
  }
}

/* Barra inferior móvil (solo chat) */
.app-bottom-nav {
  display: none;
}

#gymChatPlusBtn[hidden],
#storeChatPlusBtn[hidden],
#gymChatPlusBtn.is-hidden,
#storeChatPlusBtn.is-hidden {
  display: none !important;
}

@media (max-width: 767px) {
  body.page-chat .app-bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    align-items: stretch;
    justify-content: space-around;
    gap: 0.1rem;
    min-height: 56px;
    padding: 0.2rem 0.15rem max(0.25rem, var(--safe-bottom));
    background: var(--bottom-nav-bg);
    border-top: 1px solid var(--bottom-nav-border);
    box-shadow: var(--bottom-nav-shadow);
  }

  body.page-chat .app-bottom-nav[hidden],
  body.page-chat .app-bottom-nav.is-hidden {
    display: none !important;
  }

  body.page-chat .app-bottom-nav__item[hidden],
  body.page-chat .app-bottom-nav__item.is-hidden {
    display: none !important;
  }

  body.page-chat .app-bottom-nav__item {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.12rem;
    min-width: 0;
    min-height: 48px;
    padding: 0.25rem 0.15rem;
    border: 0;
    background: transparent;
    color: var(--bottom-nav-muted);
    text-decoration: none;
    font: inherit;
    cursor: pointer;
    border-radius: 10px;
  }

  body.page-chat .app-bottom-nav__item .tuapi-icon {
    width: 22px;
    height: 22px;
  }

  body.page-chat .app-bottom-nav__label {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  body.page-chat .app-bottom-nav__item.is-active {
    color: var(--color-primary-dark);
    background: color-mix(in srgb, var(--color-primary) 10%, transparent);
  }

  body.page-chat .app-bottom-nav__item.is-active .tuapi-icon {
    color: var(--color-primary, #0d9488);
  }

  body.page-chat .app-bottom-nav__icon-wrap {
    position: relative;
    display: inline-flex;
  }

  body.page-chat .app-bottom-nav__badge {
    position: absolute;
    top: -0.35rem;
    right: -0.55rem;
    min-width: 1rem;
    height: 1rem;
    padding: 0 0.22rem;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.58rem;
    font-weight: 700;
    line-height: 1rem;
    text-align: center;
  }

  body.page-chat .app-bottom-nav__badge.is-hidden,
  body.page-chat .app-bottom-nav__badge[hidden] {
    display: none !important;
  }

  /* Evitar duplicar navegación: arriba solo marca + pill */
  body.page-chat .app-nav__chat,
  body.page-chat .app-nav__clients,
  body.page-chat .app-nav__crm,
  body.page-chat .app-nav__bell {
    display: none !important;
  }

  body.page-chat .chat-shell__tuapi-history-btn,
  body.page-chat .chat-shell__easy-read-btn {
    display: none !important;
  }

  body.page-chat .app-main {
    padding-bottom: calc(56px + var(--safe-bottom));
  }

  body.page-chat .chat-composer {
    padding-bottom: 0.35rem;
  }

  body.page-chat .chat-history-item {
    padding: 0.55rem 0.75rem;
    display: flex !important;
    align-items: center;
    flex-direction: row;
    gap: 0.7rem;
  }

  body.page-chat .chat-history-item__avatar {
    width: 50px;
    height: 50px;
    font-size: 0.95rem;
  }

  body.page-chat .chat-history-item__main {
    flex: 1 1 auto;
    min-width: 0;
  }

  body.page-chat .chat-history-panel__sheet {
    padding-bottom: calc(56px + var(--safe-bottom));
    background: var(--panel-bg);
  }

  body.page-chat .chat-history-panel__list,
  body.page-chat .chat-history-panel__detail {
    background: var(--panel-surface);
  }

  body.page-chat .chat-history-panel__footer {
    padding-bottom: 0.5rem;
  }

  body.page-chat .chat-tuapi-filter {
    z-index: 95;
  }

  body.page-chat .chat-history-item__title {
    font-size: 0.94rem;
  }

  body.page-chat .chat-history-item__preview {
    font-size: 0.78rem;
  }

  body.page-chat .chat-history-item__hint {
    font-size: 0.7rem;
  }
}

@media (min-width: 768px) {
  .app-bottom-nav {
    display: none !important;
  }
}


