/* AlmaForce — Mensajes (correo por Outlook y WhatsApp, Fase 9b 2026-10-17).
   Estilo de la casa: esquinas grandes, bordes finos, sombras suaves, Inter / Plus Jakarta, sin barras
   horizontales (todo envuelve en vez de desbordar). */
.af-msg-tabs { margin: 1rem 0 .9rem; flex-wrap: wrap; gap: .45rem; }
.af-msg-tab { display: inline-flex; align-items: center; gap: .35rem; padding: .42rem .85rem; font-size: .76rem; }
.af-msg-tab .af-icon { width: 15px; height: 15px; }
.af-msg-panel .af-section__head { flex-wrap: wrap; gap: .75rem; }
.af-msg-panel .af-ask { flex: 1 1 320px; min-width: 0; }
.af-msg-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 1.4rem; align-items: start; }
@media (max-width: 960px) { .af-msg-grid { grid-template-columns: minmax(0, 1fr); } }
.af-msg-compose { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.af-msg-compose .af-field__label { margin-top: .55rem; }
.af-msg-body { min-height: 220px; resize: vertical; line-height: 1.5; }
.af-msg-compose textarea { resize: vertical; }

.af-msg-outlook { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; padding: .7rem .95rem;
  border-radius: 16px; border: 1px solid color-mix(in srgb, #d97706 30%, var(--af-border)); background: color-mix(in srgb, #f59e0b 9%, var(--af-surface));
  color: var(--af-text); font: 500 .8rem var(--af-font); }
.af-msg-outlook > span { flex: 1 1 240px; min-width: 0; }
.af-msg-outlook--ok { border-color: color-mix(in srgb, #059669 28%, var(--af-border)); background: color-mix(in srgb, #10b981 8%, var(--af-surface)); }
.af-msg-outlook .af-icon { width: 18px; height: 18px; flex: none; }

.af-msg-search { position: relative; display: flex; align-items: center; }
.af-msg-search > .af-icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-35%); width: 16px; height: 16px; color: var(--af-text-muted); pointer-events: none; }
.af-msg-search .af-input { padding-left: 2.1rem; border-radius: 999px; }
.af-msg-results { display: flex; flex-direction: column; gap: .3rem; margin-top: .5rem; max-height: 300px; overflow-y: auto; overflow-x: hidden; }
.af-msg-option { display: flex; justify-content: space-between; align-items: center; gap: .6rem; width: 100%; padding: .55rem .75rem; text-align: left;
  border: 1px solid var(--af-border); border-radius: 14px; background: var(--af-surface); color: var(--af-text); font: 500 .78rem var(--af-font); cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s; }
.af-msg-option:hover:not([disabled]) { border-color: var(--af-accent); box-shadow: var(--af-shadow); transform: translateY(-1px); }
.af-msg-option[disabled] { opacity: .6; cursor: not-allowed; }
.af-msg-option > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.af-msg-option em, .af-msg-chip em { display: block; font-style: normal; color: var(--af-text-muted); font-size: .7rem; }
.af-msg-option .af-muted { flex: 0 1 45%; text-align: right; overflow-wrap: anywhere; }

.af-msg-chips { display: flex; flex-wrap: wrap; gap: .45rem; margin: .7rem 0 .4rem; }
.af-msg-chip { display: inline-flex; align-items: center; gap: .45rem; max-width: 100%; padding: .4rem .5rem .4rem .7rem; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--af-accent) 25%, var(--af-border)); background: color-mix(in srgb, var(--af-accent) 7%, var(--af-surface));
  font: 500 .76rem var(--af-font); color: var(--af-text); }
.af-msg-chip > span { min-width: 0; overflow-wrap: anywhere; }
.af-msg-chip .af-icon { width: 15px; height: 15px; flex: none; color: var(--af-accent); }
.af-msg-chip button, .af-msg-files button { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border: 0; border-radius: 999px;
  background: transparent; color: var(--af-text-muted); cursor: pointer; flex: none; }
.af-msg-chip button:hover, .af-msg-files button:hover { background: color-mix(in srgb, var(--af-text) 8%, transparent); color: var(--af-text); }
.af-msg-chip button .af-icon, .af-msg-files button .af-icon { width: 13px; height: 13px; color: inherit; }

.af-msg-attach { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; margin-top: .6rem; }
.af-msg-files { list-style: none; margin: .45rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.af-msg-files li { display: flex; align-items: center; gap: .5rem; padding: .4rem .6rem; border: 1px solid var(--af-border); border-radius: 12px; font-size: .76rem; }
.af-msg-files li > span:nth-child(2) { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.af-msg-files .af-icon { width: 15px; height: 15px; }

.af-msg-result { margin-top: .8rem; padding: .75rem .95rem; border-radius: 16px; border: 1px solid var(--af-border); background: color-mix(in srgb, var(--af-accent) 4%, var(--af-surface)); font-size: .78rem; }
.af-msg-result ul { list-style: none; margin: .4rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.af-msg-result p { margin: 0 0 .4rem; }

.af-msg-bubble { align-self: flex-start; max-width: 100%; margin-top: .4rem; padding: .65rem .85rem; border-radius: 18px 18px 18px 6px;
  background: color-mix(in srgb, #25d366 14%, var(--af-surface)); border: 1px solid color-mix(in srgb, #25d366 30%, var(--af-border));
  font: 500 .8rem/1.45 var(--af-font); color: var(--af-text); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Tablas de Enviados y Plantillas: el texto envuelve; nunca barra horizontal. */
.af-msg-table { overflow-x: hidden; border-radius: 16px; }
.af-msg-table table { table-layout: fixed; width: 100%; }
.af-msg-table td, .af-msg-table th { overflow-wrap: anywhere; white-space: normal; vertical-align: top; }
.af-msg-table td .af-icon { width: 14px; height: 14px; vertical-align: -2px; }
.af-msg-snippet { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* Contacto sin autorización de datos: acceso directo a registrarla (2026-10-17). */
.af-msg-option--blocked { cursor: default; background: color-mix(in srgb, var(--af-warning, #b7791f) 6%, transparent); border-radius: 14px; }
.af-msg-option__fix { display: inline-flex; flex-direction: column; align-items: flex-end; gap: .3rem; text-align: right; }
.af-msg-consent { border-radius: 999px; white-space: nowrap; }

/* WhatsApp: cliente con canal corporativo en el buscador y elección "¿A qué WhatsApp?" (2026-10-17) */
.af-msg-option--corporate { border-color: color-mix(in srgb, #059669 30%, var(--af-border)); background: color-mix(in srgb, #10b981 6%, var(--af-surface)); }
.af-msg-option--corporate > span:first-child .af-icon { width: 14px; height: 14px; margin-right: .35rem; vertical-align: -2px; color: #059669; }
.af-msg-dests { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .45rem; margin: .2rem 0 .6rem; padding: 0; border: 0; min-width: 0; }
.af-msg-dests legend { margin-bottom: .35rem; }
.af-msg-dest { display: flex; align-items: center; gap: .55rem; padding: .55rem .75rem; border: 1px solid var(--af-border); border-radius: 14px;
  background: var(--af-surface); font: 500 .76rem var(--af-font); color: var(--af-text); cursor: pointer; transition: border-color .15s, box-shadow .15s; min-width: 0; }
.af-msg-dest span { min-width: 0; overflow-wrap: anywhere; }
.af-msg-dest em { display: block; font-style: normal; color: var(--af-text-muted); font-size: .7rem; }
.af-msg-dest input { accent-color: #059669; flex: none; }
.af-msg-dest.is-active { border-color: #059669; box-shadow: 0 0 0 3px color-mix(in srgb, #10b981 18%, transparent); }
