/**
 * Lectura fácil — global (Chat + CRM + header).
 * Escala legibilidad del contenido; header aislado con crecimiento moderado.
 */

body.chat-easy-read,
html.chat-easy-read-boot body {
  --easy-read-font-scale: 1.1;
  --easy-read-line-scale: 1.15;
  --easy-read-header-scale: 1.03;
}

/* ——— Header global: NO hereda escalado del body ——— */
body.chat-easy-read .app-header,
html.chat-easy-read-boot body .app-header {
  font-size: 16px;
  flex-shrink: 0;
}

body.chat-easy-read .app-header__inner,
html.chat-easy-read-boot body .app-header__inner {
  min-width: 0;
}

body.chat-easy-read .app-brand,
html.chat-easy-read-boot body .app-brand {
  flex-shrink: 0;
}

body.chat-easy-read .app-nav,
html.chat-easy-read-boot body .app-nav {
  font-size: calc(0.875rem * var(--easy-read-header-scale, 1.03));
  flex-wrap: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}

body.chat-easy-read .app-nav__with-icon,
body.chat-easy-read .app-nav__current,
html.chat-easy-read-boot body .app-nav__with-icon,
html.chat-easy-read-boot body .app-nav__current {
  white-space: nowrap;
  max-width: none;
  height: auto;
  min-height: 44px;
  flex: 0 0 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.15;
}

body.chat-easy-read .app-nav__with-icon .tuapi-icon,
html.chat-easy-read-boot body .app-nav__with-icon .tuapi-icon {
  flex-shrink: 0;
}

body.chat-easy-read .app-nav__workspace-group,
html.chat-easy-read-boot body .app-nav__workspace-group {
  flex-shrink: 0;
}

body.chat-easy-read .app-nav__pill-slot,
html.chat-easy-read-boot body .app-nav__pill-slot {
  flex-shrink: 1;
  min-width: 0;
}

body.chat-easy-read #navEasyReadBtn.is-active,
html.chat-easy-read-boot body #navEasyReadBtn.is-active {
  color: var(--color-primary-dark);
  font-weight: 600;
  background: #ede9fe;
  border-color: #ddd6fe;
}

html.theme-dark.chat-easy-read #navEasyReadBtn.is-active,
html.theme-dark.chat-easy-read-boot #navEasyReadBtn.is-active {
  background: #312e5a;
  border-color: #4c4680;
  color: #c4b5fd;
}

/* ——— Contenido principal ——— */
body.chat-easy-read .app-main,
html.chat-easy-read-boot body .app-main {
  font-size: calc(16px * var(--easy-read-font-scale, 1.1));
  line-height: var(--easy-read-line-scale, 1.15);
}

/* ——— Chat ——— */
body.chat-easy-read .chat-messages,
body.chat-easy-read .chat-bubble,
body.chat-easy-read .chat-form__textarea,
body.chat-easy-read .chat-form__secure,
html.chat-easy-read-boot body.page-chat .chat-messages,
html.chat-easy-read-boot body.page-chat .chat-bubble {
  font-size: calc(1rem * var(--easy-read-font-scale, 1.1));
  line-height: var(--easy-read-line-scale, 1.15);
}

body.chat-easy-read .chip,
body.chat-easy-read .chat-quick-replies__btn,
body.chat-easy-read .chat-composer-menu__item-label,
html.chat-easy-read-boot body.page-chat .chip {
  font-size: calc(0.82rem * var(--easy-read-font-scale, 1.1));
  line-height: 1.25;
  white-space: nowrap;
  min-height: 2.15rem;
  height: auto;
  flex: 0 0 auto;
}

body.chat-easy-read .chat-composer-menu__item,
html.chat-easy-read-boot body.page-chat .chat-composer-menu__item {
  min-height: 48px;
  white-space: normal;
}

body.chat-easy-read .chat-composer-menu__item-example,
html.chat-easy-read-boot body.page-chat .chat-composer-menu__item-example {
  font-size: calc(0.78rem * var(--easy-read-font-scale, 1.1));
  white-space: normal;
}

body.chat-easy-read .chat-history-panel,
body.chat-easy-read .chat-history-item,
body.chat-easy-read .chat-timeline-event,
html.chat-easy-read-boot body.page-chat .chat-history-panel {
  font-size: calc(1rem * var(--easy-read-font-scale, 1.1));
}

/* ——— CRM (standalone + embed) ——— */
body.chat-easy-read .crm-main,
body.chat-easy-read .crm-sidebar__link,
body.chat-easy-read .crm-table,
body.chat-easy-read .crm-form,
html.chat-easy-read-boot body.page-crm,
html.chat-easy-read-boot body.page-crm-embed {
  font-size: calc(1rem * var(--easy-read-font-scale, 1.1));
  line-height: var(--easy-read-line-scale, 1.15);
}

body.chat-easy-read .crm-sidebar__link,
html.chat-easy-read-boot body .crm-sidebar__link {
  min-height: 44px;
  height: auto;
  white-space: normal;
  flex-wrap: nowrap;
  align-items: center;
  min-width: 0;
  overflow-wrap: anywhere;
}

body.chat-easy-read .crm-sidebar__label,
html.chat-easy-read-boot body .crm-sidebar__label {
  min-width: 0;
  flex: 1 1 auto;
}

body.chat-easy-read .crm-quick-actions,
html.chat-easy-read-boot body .crm-quick-actions {
  flex-wrap: wrap;
  gap: 0.45rem;
}

body.chat-easy-read .crm-quick-action,
html.chat-easy-read-boot body .crm-quick-action {
  white-space: normal;
  text-align: left;
  height: auto;
  min-height: 44px;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}

body.chat-easy-read .crm-quick-action__label,
html.chat-easy-read-boot body .crm-quick-action__label {
  min-width: 0;
  overflow-wrap: anywhere;
}

body.chat-easy-read .crm-table th,
body.chat-easy-read .crm-table td,
html.chat-easy-read-boot body .crm-table th,
html.chat-easy-read-boot body .crm-table td {
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

body.chat-easy-read .crm-table td.crm-table__actions,
html.chat-easy-read-boot body .crm-table td.crm-table__actions {
  overflow-wrap: normal;
  word-break: normal;
}

body.chat-easy-read .crm-main .btn,
html.chat-easy-read-boot body .crm-main .btn {
  white-space: normal;
  height: auto;
  min-height: 44px;
  line-height: 1.25;
  text-align: center;
}

body.chat-easy-read .crm-table__actions .btn,
html.chat-easy-read-boot body .crm-table__actions .btn {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
  flex: 0 0 auto;
}

body.chat-easy-read .crm-metric-card,
body.chat-easy-read .crm-summary-block,
html.chat-easy-read-boot body .crm-metric-card {
  min-width: 0;
}

body.chat-easy-read .crm-metric-card__value,
html.chat-easy-read-boot body .crm-metric-card__value {
  font-size: calc(1.25rem * var(--easy-read-font-scale, 1.1));
  line-height: 1.2;
  overflow-wrap: anywhere;
}

body.page-crm-embed.chat-easy-read .crm-sidebar--desktop,
html.chat-easy-read-boot body.page-crm-embed .crm-sidebar--desktop {
  overflow-x: hidden;
}

@container crm-panel (max-width: 479px) {
  body.chat-easy-read.page-crm-embed .crm-sidebar__label,
  html.chat-easy-read-boot body.page-crm-embed .crm-sidebar__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  body.chat-easy-read *,
  html.chat-easy-read-boot body * {
    transition-duration: 0.01ms !important;
  }
}
