/* ===== APP LAYOUT ===== */
.app-layout {
  height: 100dvh;
}

.app-row {
  height: 100%;
}

/* ===== SIDEBAR ===== */
.sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #020617;
  color: #e5e7eb;
  border-right: 1px solid rgba(148,163,184,.18);
}

.sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid rgba(148,163,184,.18);
  flex-shrink: 0;
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.sidebar-item-wrap {
  padding: .75rem;
  border-bottom: 1px solid rgba(148,163,184,.12);
}

.sidebar-item-link {
  display: block;
  color: #e5e7eb;
  text-decoration: none;
}

.sidebar-item-link:hover {
  color: #ffffff;
}

.sidebar-item-link--simple {
  padding: .75rem;
  border-bottom: 1px solid rgba(148,163,184,.12);
}

/* ===== EMPTY PANEL ===== */
.panel-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: #0b1220;
}

/* ===== CHAT ===== */
.chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #0b1220;
}

.chat-header {
  padding: 1rem;
  border-bottom: 1px solid rgba(148,163,184,.18);
  background: #020617;
  color: #e5e7eb;
  flex-shrink: 0;
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(2,6,23,.55), rgba(15,23,42,.9));
}

.chat-quick-replies {
  padding: .5rem .75rem;
  background: rgba(2,6,23,.75);
  border-top: 1px solid rgba(148,163,184,.18);
  flex-shrink: 0;
}

.chat-footer {
  padding: .75rem;
  border-top: 1px solid rgba(148,163,184,.18);
  background: #020617;
  flex-shrink: 0;
}

.chat-form {
  display: flex;
  gap: .5rem;
  align-items: flex-end;
}
.msg-text{
  white-space: pre-wrap;   /* respeta \n y espacios, y hace wrap */
  word-break: break-word;
}

/* ===== INPUT ===== */
.chat-input {
  flex: 1;
  resize: none;
  max-height: 160px;
  background: rgba(15,23,42,.75);
  border: 1px solid rgba(148,163,184,.25);
  color: #e5e7eb;
}

.chat-input:focus {
  background: rgba(15,23,42,.95);
  border-color: rgba(37,99,235,.6);
  box-shadow: 0 0 0 .2rem rgba(37,99,235,.18);
  color: #e5e7eb;
}

.chat-send {
  height: 38px;
}

/* ===== BUBBLES ===== */
.msg-bubble {
  max-width: 72%;
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 14px;
  padding: 10px 12px;
  line-height: 1.25;
  word-break: break-word;
  box-shadow: 0 8px 18px rgba(0,0,0,.18);
}

.msg-in {
  background: rgba(30,41,59,.8);
  color: #e5e7eb;
  border-top-left-radius: 8px;
}

.msg-out {
  background: rgba(37,99,235,.85);
  color: #fff;
  border-top-right-radius: 8px;
}

.msg-meta {
  margin-top: 6px;
  font-size: 11px;
  opacity: .85;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.status-ico {
  font-size: 12px;
}

.qr-dropdown{
  position:absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 100%;
  max-height: 240px;
  overflow:auto;
  background:#fff;
  border:1px solid rgba(0,0,0,.12);
  border-radius:12px;
  box-shadow: 0 10px 25px rgba(0,0,0,.10);
  padding:6px;
  z-index: 50;
}

.qr-item{
  display:grid;
  grid-template-columns: 120px 1fr;
  gap:10px;
  padding:10px;
  border-radius:10px;
  cursor:pointer;
}

.qr-item.is-selected{ background: rgba(0,0,0,.06); }

.qr-shortcut{ font-weight:700; }
.qr-preview{ opacity:.75; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.qr-empty{ padding:12px; opacity:.7; }

.composer-wrap {
  position: relative;
  flex: 1;
}

/* ambos deben tener el mismo box model */
.composer-preview,
.composer-input {
  font-family: inherit;
  font-size: inherit;
  line-height: 1.25;
  letter-spacing: normal;
  padding: .375rem .75rem;
}

/* PREVIEW (se ve) */
.composer-preview {
  min-height: 38px;
  max-height: 160px;
  overflow-y: auto;

  white-space: pre-wrap;
  word-break: break-word;

  background: rgba(15,23,42,.75);
  border: 1px solid rgba(148,163,184,.25);
  border-radius: .375rem;
  color: #e5e7eb;

  pointer-events: none;
}

/* TEXTAREA (solo caret/selección) */
.composer-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  resize: none;

  background: transparent;
  border: 1px solid transparent; /* ok */
  outline: none;

  color: transparent;
  -webkit-text-fill-color: transparent; /* importante en Chrome */
  caret-color: #e5e7eb;
}

/* cuando focus, aplica el “focus” visual al preview */
.composer-wrap:focus-within .composer-preview{
  background: rgba(15,23,42,.95);
  border-color: rgba(37,99,235,.6);
  box-shadow: 0 0 0 .2rem rgba(37,99,235,.18);
}
.wa-marker{
  opacity: .35;
  font-weight: 600;
}


.msg-media { display: grid; gap: 8px; }

.msg-media-img {
  max-width: 280px;
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
}

.msg-media-audio,
.msg-media-video {
  width: 280px;
  max-width: 100%;
}

.msg-placeholder {
  opacity: .75;
  font-style: italic;
}

.status-read {
  color: #34b7f1; /* azul tipo WhatsApp */
}



/* ===== PREVIEW DE ARCHIVO EN COMPOSER ===== */
.composer-preview { position: relative; }

/* contenedor del preview de archivo + botón quitar */
.preview-box{
  position: relative;
  padding: 10px;
  border-radius: 12px;
  background: rgba(2,6,23,.55);
  border: 1px solid rgba(148,163,184,.25);
  margin-bottom: 8px;
  max-width: 320px;
  pointer-events: auto; /* 👈 para que el botón ✕ sea clickeable */
  z-index: 500000;
}

/* botón quitar */
.preview-remove{
  position: absolute;
  top: 6px;
  right: 8px;
  border: none;
  background: rgba(0,0,0,.55);
  color: #fff;
  border-radius: 999px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

/* media */
.preview-image,
.preview-video{
  width: 100%;
  border-radius: 10px;
  display: block;
}

.preview-audio{
  width: 100%;
}

.preview-filename{
  font-size: 12px;
  opacity: .85;
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-document{
  font-size: 13px;
  opacity: .95;
}

/* preview del texto (caption) */
.text-preview{
  pointer-events: none; /* mantiene tu comportamiento original */
}