/* ============================================================
   MENSAJERÍA INTERNA + AVISOS DE HORARIO
   ============================================================ */

/* ── Avatars ─────────────────────────────────────────────── */
.msg-avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(10, 38, 71, 0.15);
}
.msg-avatar--initials {
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; letter-spacing: 0.02em;
}

/* ── Header button ───────────────────────────────────────── */
.msg-header-btn .msg-badge { background: linear-gradient(135deg, #ff6b6b, #e63946); }

/* ── Page layout ─────────────────────────────────────────── */
.msg-page {
  padding: 1.25rem;
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(0, 180, 216, 0.12), transparent 60%),
    radial-gradient(900px 400px at 110% 10%, rgba(20, 66, 114, 0.10), transparent 60%),
    var(--surface-bg);
  min-height: calc(100vh - 60px);
  overflow-y: auto;
}
.msg-shell {
  display: grid;
  grid-template-columns: 250px minmax(300px, 400px) 1fr;
  height: calc(100vh - 60px - 2.5rem);
  max-height: calc(100vh - 60px - 2.5rem);
  min-height: 480px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(10, 38, 71, 0.12);
  overflow: hidden;
  font-family: var(--font-family);
}
.msg-loading {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  color: var(--gray-600); font-weight: 500;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.msg-sidebar {
  background: linear-gradient(180deg, var(--primary-800) 0%, var(--primary-700) 100%);
  padding: 1.25rem 0.9rem;
  display: flex; flex-direction: column; gap: 1.25rem;
  color: #fff;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
}
.msg-compose-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%;
  padding: 0.85rem 1rem;
  border: none; border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-400), var(--accent-600));
  color: #fff; font-size: 1rem; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 180, 216, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.msg-compose-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(0, 180, 216, 0.45); }
.msg-compose-btn:active { transform: translateY(0); }

.msg-folders { display: flex; flex-direction: column; gap: 4px; }
.msg-folder {
  display: flex; align-items: center; gap: 10px;
  padding: 0.7rem 0.85rem;
  border: none; border-radius: 12px;
  background: transparent; color: rgba(255, 255, 255, 0.78);
  font-size: 0.92rem; font-weight: 500; text-align: left;
  cursor: pointer; transition: all 0.18s ease;
}
.msg-folder:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.msg-folder.active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff; font-weight: 700;
  box-shadow: inset 3px 0 0 var(--accent-400);
}
.msg-folder-icon { font-size: 1.05rem; width: 22px; text-align: center; }
.msg-folder-label { flex: 1; }
.msg-folder-count {
  min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: 11px;
  background: var(--accent-400); color: var(--primary-900);
  font-size: 0.75rem; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}
.msg-sidebar-tip {
  margin-top: auto;
  display: flex; gap: 10px;
  padding: 0.85rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.78rem; line-height: 1.45; color: rgba(255, 255, 255, 0.75);
}
.msg-sidebar-tip-icon { font-size: 1.1rem; }

/* ── List pane ───────────────────────────────────────────── */
.msg-list-pane {
  display: flex; flex-direction: column;
  border-right: 1px solid var(--gray-200);
  background: rgba(255, 255, 255, 0.6);
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.msg-list-header { padding: 1.1rem 1.1rem 0.8rem; border-bottom: 1px solid var(--gray-100); flex-shrink: 0; }
.msg-list-header h2 { margin: 0 0 0.75rem; font-size: 1.2rem; color: var(--primary-800); font-weight: 800; }
.msg-search {
  display: flex; align-items: center; gap: 8px;
  padding: 0.55rem 0.8rem;
  background: var(--gray-100);
  border-radius: 10px;
  color: var(--gray-500);
  border: 1px solid transparent;
  transition: all 0.2s;
}
.msg-search:focus-within { background: #fff; border-color: var(--accent-300); box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.15); }
.msg-search input { border: none; background: transparent; outline: none; flex: 1; font-size: 0.9rem; color: var(--gray-900); }

.msg-list {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.4rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(10, 38, 71, 0.25) transparent;
}
.msg-list::-webkit-scrollbar {
  width: 7px;
}
.msg-list::-webkit-scrollbar-track {
  background: transparent;
}
.msg-list::-webkit-scrollbar-thumb {
  background: rgba(10, 38, 71, 0.22);
  border-radius: 4px;
}
.msg-list::-webkit-scrollbar-thumb:hover {
  background: var(--accent-400);
}
.msg-item {
  display: flex; gap: 12px;
  padding: 0.85rem 0.8rem;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
  position: relative;
  margin-bottom: 2px;
}
.msg-item:hover { background: var(--primary-50); }
.msg-item.selected { background: linear-gradient(135deg, #e0f4fb, #eaf2f8); box-shadow: inset 0 0 0 1px var(--accent-200); }
.msg-item-avatar { position: relative; flex-shrink: 0; }
.msg-unread-dot {
  position: absolute; top: -2px; right: -2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent-400);
  border: 2px solid #fff;
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.2);
}
.msg-item-main { flex: 1; min-width: 0; }
.msg-item-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.msg-item-from { font-size: 0.88rem; color: var(--gray-700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-to-label { color: var(--gray-500); font-weight: 500; }
.msg-item-time { font-size: 0.72rem; color: var(--gray-500); white-space: nowrap; }
.msg-item-subject { font-size: 0.9rem; color: var(--gray-800); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-item-snippet { font-size: 0.8rem; color: var(--gray-500); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-item.unread .msg-item-from,
.msg-item.unread .msg-item-subject { font-weight: 800; color: var(--gray-900); }
.msg-item.unread .msg-item-time { color: var(--accent-600); font-weight: 700; }
.msg-item-tags { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }

.msg-cat-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.01em;
}
.msg-cat-tag--schedule { background: #fff4e0; color: #b45309; }
.msg-cat-tag--general { background: var(--primary-50); color: var(--primary-500); }
.msg-read-pill {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700;
  background: var(--gray-100); color: var(--gray-600);
}
.msg-read-pill.all { background: #dcfce7; color: #15803d; }

.msg-empty { text-align: center; padding: 3rem 1.5rem; color: var(--gray-500); }
.msg-empty-icon { font-size: 2.6rem; margin-bottom: 0.5rem; }
.msg-empty-title { font-weight: 700; color: var(--gray-700); margin-bottom: 4px; }
.msg-empty-text { font-size: 0.85rem; }

/* ── Reader ──────────────────────────────────────────────── */
.msg-reader {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  background: #fff;
  overflow: hidden;
}
.msg-reader--empty { align-items: center; justify-content: center; background: linear-gradient(180deg, #fff, #f7fbfd); }
.msg-reader-placeholder { text-align: center; color: var(--gray-500); max-width: 280px; }
.msg-reader-placeholder-icon {
  width: 88px; height: 88px; margin: 0 auto 1rem;
  border-radius: 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem;
  background: linear-gradient(135deg, var(--accent-100), var(--primary-50));
  box-shadow: 0 10px 30px rgba(0, 150, 199, 0.15);
  animation: msgFloat 4s ease-in-out infinite;
}
@keyframes msgFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.msg-reader-placeholder h3 { margin: 0 0 0.35rem; color: var(--gray-800); }
.msg-reader-placeholder p { margin: 0; font-size: 0.88rem; }

.msg-reader-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  flex-shrink: 0;
}
.msg-reader-actions { margin-left: auto; display: flex; gap: 6px; }
.msg-tool-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--gray-200); border-radius: 10px;
  background: #fff; color: var(--gray-700);
  font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.msg-tool-btn:hover { background: var(--primary-50); border-color: var(--primary-200); color: var(--primary-600); }
.msg-tool-btn--danger:hover { background: #fef2f2; border-color: #fecaca; color: #dc2626; }
.msg-back-mobile { display: none; }

.msg-reader-scroll {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.75rem 2rem 2rem;
  animation: msgFadeIn 0.25s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(10, 38, 71, 0.25) transparent;
}
.msg-reader-scroll::-webkit-scrollbar {
  width: 7px;
}
.msg-reader-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.msg-reader-scroll::-webkit-scrollbar-thumb {
  background: rgba(10, 38, 71, 0.22);
  border-radius: 4px;
}
.msg-reader-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--accent-400);
}

.msg-reader-subject { font-size: 1.45rem; line-height: 1.3; margin: 0 0 1.1rem; color: var(--gray-900); font-weight: 800; }
.msg-reader-meta { display: flex; align-items: center; gap: 12px; padding-bottom: 1.25rem; border-bottom: 1px solid var(--gray-100); margin-bottom: 1.25rem; }
.msg-reader-from { font-weight: 700; color: var(--gray-900); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.msg-role-pill { font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--primary-50); color: var(--primary-500); }
.msg-reader-date { font-size: 0.8rem; color: var(--gray-500); margin-top: 2px; text-transform: capitalize; }
.msg-reader-body { font-size: 0.97rem; line-height: 1.7; color: var(--gray-800); white-space: normal; word-wrap: break-word; }

/* ── Estilos de Hilos de Conversación ──────────────────────── */
.msg-thread-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1.5px solid var(--gray-200);
}
.msg-thread-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--gray-900);
  margin: 0 0 0.4rem;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.msg-thread-badge {
  font-size: 0.76rem;
  font-weight: 700;
  background: #e0f2fe;
  color: #0369a1;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid #bae6fd;
}
.msg-thread-subtitle {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin: 0;
}
.msg-thread-stream {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin-bottom: 1.5rem;
}
.msg-thread-card {
  background: #ffffff;
  border: 1.5px solid var(--gray-200);
  border-radius: 16px;
  padding: 1.15rem 1.35rem;
  box-shadow: 0 2px 8px rgba(10, 38, 71, 0.04);
  transition: all 0.2s ease;
  position: relative;
}
.msg-thread-card:hover {
  border-color: var(--accent-300);
  box-shadow: 0 6px 18px rgba(10, 38, 71, 0.08);
}
.msg-thread-card--me {
  background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 100%);
  border-color: #bae6fd;
}
.msg-thread-card--reply {
  border-left: 4px solid var(--accent-400);
}
.msg-thread-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.msg-thread-author {
  display: flex;
  align-items: center;
  gap: 10px;
}
.msg-thread-author-name {
  font-weight: 700;
  color: var(--gray-900);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.msg-reply-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.msg-thread-time {
  font-size: 0.78rem;
  color: var(--gray-500);
}
.msg-thread-card-body {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--gray-800);
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-quote-toggle {
  margin-top: 0.6rem;
  font-size: 0.75rem;
  color: var(--primary-600);
  cursor: pointer;
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-block;
  user-select: none;
}
.msg-quote-toggle:hover {
  background: var(--primary-100);
}
.msg-quote-box {
  margin-top: 0.5rem;
  padding: 0.6rem 0.9rem;
  background: var(--gray-50);
  border-left: 3px solid var(--gray-300);
  border-radius: 4px;
  font-size: 0.82rem;
  color: var(--gray-600);
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Quick inline reply box in reader */
.msg-inline-reply {
  background: #ffffff;
  border: 1.5px solid var(--accent-300);
  border-radius: 16px;
  padding: 1.15rem;
  box-shadow: 0 4px 16px rgba(0, 180, 216, 0.1);
  margin-top: 1rem;
}
.msg-inline-reply-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0.65rem;
  font-weight: 700;
  color: var(--primary-800);
  font-size: 0.9rem;
}
.msg-inline-reply-textarea {
  width: 100%;
  min-height: 80px;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 0.75rem;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--gray-900);
  resize: vertical;
  outline: none;
  transition: all 0.2s;
  box-sizing: border-box;
}
.msg-inline-reply-textarea:focus {
  border-color: var(--accent-400);
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.15);
}
.msg-inline-reply-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 0.65rem;
  flex-wrap: wrap;
}
.msg-inline-reply-send {
  background: linear-gradient(135deg, var(--accent-400), var(--accent-600));
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.55rem 1.25rem;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 180, 216, 0.3);
  transition: all 0.2s;
}
.msg-inline-reply-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 180, 216, 0.4);
}
.msg-inline-reply-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Thread toggle button in list header */
.msg-thread-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--gray-300);
  background: #ffffff;
  color: var(--gray-700);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.msg-thread-toggle:hover {
  border-color: var(--accent-400);
  color: var(--primary-700);
}
.msg-thread-toggle.active {
  background: var(--primary-700);
  color: #ffffff;
  border-color: var(--primary-700);
}
.msg-thread-count-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--primary-100);
  color: var(--primary-800);
  margin-left: 6px;
  display: inline-block;
}
.msg-thread-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.msg-reply-indicator {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--accent-600);
  vertical-align: middle;
}

/* Schedule change card */
.msg-change-card {
  border-radius: 16px;
  padding: 1rem 1.1rem;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, #fff9ed 0%, #fff 70%);
  border: 1px solid #fde4b8;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.08);
}
.msg-change-card-title { font-weight: 800; color: #b45309; margin-bottom: 0.6rem; font-size: 0.92rem; }
.msg-change-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 0.6rem 0;
  border-top: 1px dashed rgba(180, 83, 9, 0.18);
}
.msg-change-row:first-of-type { border-top: none; }
.msg-change-date { font-weight: 700; color: var(--gray-800); font-size: 0.88rem; }
.msg-change-shifts { display: flex; align-items: center; gap: 8px; }
.msg-change-arrow { color: var(--gray-400); font-size: 0.9rem; }

.msg-shift-chip {
  display: inline-flex; align-items: center;
  padding: 4px 11px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 700; white-space: nowrap;
  border: 1px solid transparent;
}
.msg-shift-chip--old { opacity: 0.6; text-decoration: line-through; text-decoration-thickness: 1.5px; }
.msg-shift-chip--work { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }
.msg-shift-chip--rest { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.msg-shift-chip--vacation { background: #fef3c7; color: #b45309; border-color: #fde68a; }
.msg-shift-chip--holiday { background: #f3e8ff; color: #7e22ce; border-color: #e9d5ff; }
.msg-shift-chip--personal { background: #fce7f3; color: #be185d; border-color: #fbcfe8; }
.msg-shift-chip--medical { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.msg-shift-chip--none { background: var(--gray-100); color: var(--gray-600); border-color: var(--gray-200); }

/* Read receipts */
.msg-receipts { margin-top: 1.75rem; padding: 1rem 1.1rem; border-radius: 14px; background: var(--gray-50); border: 1px solid var(--gray-100); }
.msg-receipts-title { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gray-500); margin-bottom: 0.6rem; }
.msg-receipt { display: flex; align-items: center; gap: 10px; padding: 0.4rem 0; }
.msg-receipt-name { flex: 1; font-weight: 600; font-size: 0.88rem; color: var(--gray-800); }
.msg-receipt-status { font-size: 0.75rem; font-weight: 700; color: var(--gray-500); }
.msg-receipt-status.read { color: #15803d; }

.msg-quick-reply { display: flex; align-items: center; gap: 10px; margin-top: 2rem; }
.msg-quick-reply-btn {
  flex: 1; text-align: left;
  padding: 0.8rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
  color: var(--gray-500); font-size: 0.9rem;
  cursor: text; transition: all 0.15s;
}
.msg-quick-reply-btn:hover { border-color: var(--accent-300); background: #fff; box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.12); }

/* ── Compose dialog ──────────────────────────────────────── */
.msg-compose-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(4, 28, 44, 0.45);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: msgOverlayIn 0.2s ease;
}
.msg-compose-overlay--exit { animation: msgOverlayOut 0.2s ease forwards; }
@keyframes msgOverlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes msgOverlayOut { to { opacity: 0; } }
.msg-compose {
  width: 100%; max-width: 640px; max-height: calc(100vh - 2rem);
  display: flex; flex-direction: column;
  background: #fff; border-radius: 20px;
  box-shadow: 0 30px 70px rgba(4, 28, 44, 0.35);
  overflow: hidden;
  animation: msgPopIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes msgPopIn { from { opacity: 0; transform: translateY(16px) scale(0.97); } to { opacity: 1; transform: none; } }
.msg-compose-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.4rem;
  background: linear-gradient(135deg, var(--primary-800), var(--primary-600));
  color: #fff;
}
.msg-compose-header h3 { margin: 0; font-size: 1.08rem; color: #fff; }
.msg-compose-close { background: rgba(255, 255, 255, 0.12); border: none; color: #fff; width: 32px; height: 32px; border-radius: 10px; font-size: 1.3rem; cursor: pointer; transition: background 0.15s; }
.msg-compose-close:hover { background: rgba(255, 255, 255, 0.25); }
.msg-compose-body { padding: 1.2rem 1.4rem; overflow-y: auto; position: relative; }
.msg-field-label { display: block; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gray-500); margin: 0.9rem 0 0.35rem; }
.msg-field-label:first-child { margin-top: 0; }
.msg-input, .msg-textarea {
  width: 100%; box-sizing: border-box;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--gray-200); border-radius: 12px;
  font-family: inherit; font-size: 0.95rem; color: var(--gray-900);
  background: #fff; outline: none; transition: all 0.15s;
}
.msg-textarea { resize: vertical; min-height: 150px; line-height: 1.55; }
.msg-input:focus, .msg-textarea:focus { border-color: var(--accent-400); box-shadow: 0 0 0 4px rgba(0, 180, 216, 0.14); }

.msg-recipients {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 0.45rem 0.55rem;
  min-height: 46px; box-sizing: border-box;
  border: 1.5px solid var(--gray-200); border-radius: 12px;
  transition: all 0.15s;
}
.msg-recipients:focus-within { border-color: var(--accent-400); box-shadow: 0 0 0 4px rgba(0, 180, 216, 0.14); }
.msg-chips { display: contents; }
.msg-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 6px 3px 3px;
  border-radius: 999px;
  background: var(--primary-50); color: var(--primary-600);
  font-size: 0.82rem; font-weight: 600;
  animation: msgPopIn 0.2s ease;
}
.msg-chip .msg-avatar { box-shadow: none; }
.msg-chip button { border: none; background: rgba(20, 66, 114, 0.1); color: var(--primary-600); width: 18px; height: 18px; border-radius: 50%; cursor: pointer; font-size: 0.85rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.msg-chip button:hover { background: #fecaca; color: #b91c1c; }
.msg-recipient-input { flex: 1; min-width: 140px; border: none; outline: none; font-size: 0.92rem; padding: 0.3rem; font-family: inherit; }
.msg-recipient-dropdown {
  position: absolute; left: 1.4rem; right: 1.4rem; z-index: 5;
  background: #fff; border-radius: 14px;
  box-shadow: 0 18px 40px rgba(10, 38, 71, 0.18);
  border: 1px solid var(--gray-100);
  max-height: 260px; overflow-y: auto;
  display: none; margin-top: 6px; padding: 6px;
}
.msg-recipient-dropdown.open { display: block; animation: msgFadeIn 0.15s ease; }
.msg-option { display: flex; align-items: center; gap: 10px; padding: 0.5rem 0.6rem; border-radius: 10px; cursor: pointer; }
.msg-option:hover { background: var(--primary-50); }
.msg-option-name { font-weight: 600; font-size: 0.9rem; color: var(--gray-900); }
.msg-option-meta { font-size: 0.75rem; color: var(--gray-500); }
.msg-option-empty { padding: 1rem; text-align: center; color: var(--gray-500); font-size: 0.85rem; }

.msg-quick-groups { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 0.6rem; }
.msg-quick-label { font-size: 0.75rem; color: var(--gray-500); font-weight: 600; }
.msg-quick-chip {
  padding: 4px 11px; border-radius: 999px;
  border: 1px dashed var(--gray-300); background: #fff;
  font-size: 0.76rem; font-weight: 600; color: var(--gray-600);
  cursor: pointer; transition: all 0.15s;
}
.msg-quick-chip:hover { border-style: solid; border-color: var(--accent-400); color: var(--accent-600); background: var(--accent-100); }

.msg-compose-footer {
  display: flex; align-items: center; gap: 10px;
  padding: 0.9rem 1.4rem;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
}
.msg-compose-hint { margin-right: auto; font-size: 0.8rem; color: var(--gray-500); font-weight: 600; }
.msg-send-btn { display: inline-flex; align-items: center; gap: 8px; background: linear-gradient(135deg, var(--accent-400), var(--accent-600)) !important; border: none !important; box-shadow: 0 6px 16px rgba(0, 150, 199, 0.35); }
.msg-send-btn.sending { opacity: 0.7; pointer-events: none; }

/* ── Live notification (top-right) ───────────────────────── */
.msg-notify-stack {
  position: fixed; top: 76px; right: 20px; z-index: 10001;
  display: flex; flex-direction: column; gap: 10px;
  width: 360px; max-width: calc(100vw - 40px);
}
.msg-notify {
  position: relative;
  display: flex; gap: 12px;
  padding: 1rem 2.4rem 1.1rem 1rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-left: 4px solid var(--accent-400);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(10, 38, 71, 0.22);
  overflow: hidden;
  animation: msgSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.msg-notify--schedule { border-left-color: #f59e0b; }
.msg-notify--exit { animation: msgSlideOut 0.3s ease forwards; }
@keyframes msgSlideIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes msgSlideOut { to { opacity: 0; transform: translateX(40px); } }
.msg-notify-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-100); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.msg-notify--schedule .msg-notify-icon { background: #fef3c7; }
.msg-notify-content { flex: 1; min-width: 0; }
.msg-notify-title { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent-600); }
.msg-notify--schedule .msg-notify-title { color: #b45309; }
.msg-notify-from { font-weight: 700; color: var(--gray-900); margin-top: 2px; }
.msg-notify-subject { font-size: 0.85rem; color: var(--gray-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-notify-actions { display: flex; gap: 6px; margin-top: 0.6rem; }
.msg-notify-btn { padding: 0.35rem 0.8rem; border-radius: 8px; border: 1px solid var(--gray-200); background: #fff; font-size: 0.78rem; font-weight: 700; color: var(--gray-700); cursor: pointer; }
.msg-notify-btn--primary { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }
.msg-notify-btn--primary:hover { background: var(--primary-700); }
.msg-notify-x { position: absolute; top: 8px; right: 10px; border: none; background: transparent; font-size: 1.2rem; color: var(--gray-400); cursor: pointer; }
.msg-notify-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(0, 0, 0, 0.04); }
.msg-notify-progress span { display: block; height: 100%; background: var(--accent-400); animation: msgProgress 12s linear forwards; }
.msg-notify--schedule .msg-notify-progress span { background: #f59e0b; }
@keyframes msgProgress { from { width: 100%; } to { width: 0; } }

/* ── Schedule change alert popup ─────────────────────────── */
.msg-alert-overlay {
  position: fixed; inset: 0; z-index: 10002;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  background: rgba(4, 28, 44, 0.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: msgOverlayIn 0.25s ease;
}
.msg-alert-overlay--exit { animation: msgOverlayOut 0.25s ease forwards; }
.msg-alert {
  width: 100%; max-width: 480px; max-height: calc(100vh - 2rem);
  display: flex; flex-direction: column;
  background: #fff; border-radius: 24px; overflow: hidden;
  box-shadow: 0 40px 80px rgba(4, 28, 44, 0.4);
  animation: msgPopIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.msg-alert-hero {
  text-align: center;
  padding: 1.75rem 1.5rem 1.4rem;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.25), transparent 60%),
    linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
  color: #fff;
}
.msg-alert-bell {
  width: 68px; height: 68px; margin: 0 auto 0.75rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.12);
  animation: msgRing 1.6s ease-in-out 0.3s 2;
}
@keyframes msgRing {
  0%, 100% { transform: rotate(0); }
  10%, 30% { transform: rotate(-14deg); }
  20%, 40% { transform: rotate(14deg); }
  50% { transform: rotate(0); }
}
.msg-alert-hero h3 { margin: 0 0 0.3rem; font-size: 1.35rem; font-weight: 800; color: #fff; }
.msg-alert-hero p { margin: 0; font-size: 0.9rem; opacity: 0.95; }
.msg-alert-body { padding: 1rem 1.4rem; overflow-y: auto; }
.msg-alert-note { margin-top: 0.75rem; padding: 0.7rem 0.9rem; border-radius: 12px; background: var(--gray-50); font-size: 0.85rem; color: var(--gray-700); }
.msg-alert-footer { display: flex; gap: 10px; justify-content: flex-end; padding: 0.9rem 1.4rem 1.2rem; }
.msg-alert-footer .btn-primary { background: linear-gradient(135deg, #f59e0b, #f97316); border: none; box-shadow: 0 6px 16px rgba(249, 115, 22, 0.35); }

/* ── Notify toggle in schedule modal ─────────────────────── */
.sched-notify-toggle {
  display: flex; align-items: center; gap: 12px;
  margin-top: 0.5rem;
  padding: 0.8rem 0.95rem;
  border-radius: 14px;
  background: var(--gray-50, #f8fafc);
  border: 1px solid var(--gray-200, #e2e8f0);
  cursor: pointer; user-select: none;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.15s;
}
.sched-notify-toggle:hover { background: var(--gray-100, #f1f5f9); }
.sched-notify-toggle:has(input:checked) {
  background: linear-gradient(135deg, #fff9ed, #fff);
  border-color: #fde4b8;
}
.sched-notify-toggle:has(input:checked):hover { box-shadow: 0 4px 14px rgba(245, 158, 11, 0.15); }
.sched-notify-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.sched-notify-switch {
  position: relative; flex-shrink: 0;
  width: 42px; height: 24px; border-radius: 12px;
  background: var(--gray-300);
  transition: background 0.2s;
}
.sched-notify-switch::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.sched-notify-toggle input:checked + .sched-notify-switch { background: #f59e0b; }
.sched-notify-toggle input:checked + .sched-notify-switch::after { transform: translateX(18px); }
.sched-notify-toggle input:focus-visible + .sched-notify-switch { box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.35); }
.sched-notify-text { display: flex; flex-direction: column; line-height: 1.3; }
.sched-notify-text strong { font-size: 0.9rem; color: var(--gray-900); }
.sched-notify-text small { font-size: 0.76rem; color: var(--gray-500); }

/* ── Selection & Bulk Actions ────────────────────────────── */
.msg-item-select {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-right: 2px;
  flex-shrink: 0;
}
.msg-item-checkbox {
  width: 17px;
  height: 17px;
  cursor: pointer;
  accent-color: var(--accent-500);
  border-radius: 4px;
}
.msg-item.checked {
  background: rgba(0, 180, 216, 0.08);
  box-shadow: inset 3px 0 0 var(--accent-500);
}

/* ── Star / Important ────────────────────────────────────── */
.msg-star-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
  padding: 4px 2px;
  color: var(--gray-300);
  transition: transform 0.15s ease, color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  flex-shrink: 0;
}
.msg-star-btn:hover {
  transform: scale(1.2);
  color: #f59e0b;
}
.msg-star-btn.starred {
  color: #f59e0b;
  text-shadow: 0 0 6px rgba(245, 158, 11, 0.35);
}
.msg-tool-btn.starred {
  color: #d97706;
  background: #fef3c7;
  border-color: #fcd34d;
}
.msg-star-icon {
  font-size: 1.1rem;
}

/* ── Bulk Toolbar ────────────────────────────────────────── */
.msg-list-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}
.msg-select-all-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
}
.msg-select-all-label:hover {
  color: var(--primary-600);
}
.msg-bulk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #e0f4fb, #f0f9ff);
  border-bottom: 2px solid var(--accent-200);
  gap: 8px;
  flex-wrap: wrap;
  animation: fadeIn 0.15s ease;
}
.msg-bulk-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.msg-bulk-count {
  font-size: 0.86rem;
  color: var(--primary-800);
  font-weight: 700;
}
.msg-bulk-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.msg-bulk-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  background: #fff;
  color: var(--gray-700);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.msg-bulk-btn:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}
.msg-bulk-btn--danger {
  color: #dc2626;
  border-color: #fecaca;
}
.msg-bulk-btn--danger:hover {
  background: #fef2f2;
  color: #b91c1c;
}
.msg-bulk-btn--close {
  padding: 4px 7px;
  color: var(--gray-400);
}
.msg-bulk-btn--close:hover {
  color: var(--gray-800);
}

/* ── Attachments ─────────────────────────────────────────── */
.msg-attach-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: #e0f2fe;
  color: #0369a1;
}
.msg-attachments-card {
  margin-top: 1.5rem;
  padding: 1.1rem;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--gray-200);
}
.msg-attachments-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.msg-attachments-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.msg-att-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  transition: all 0.2s ease;
}
.msg-att-item:hover {
  border-color: var(--accent-300);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.msg-att-icon-box {
  font-size: 1.4rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-50);
  border-radius: 8px;
  flex-shrink: 0;
}
.msg-att-info {
  flex: 1;
  min-width: 0;
}
.msg-att-link {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary-700);
  text-decoration: none;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-att-link:hover {
  text-decoration: underline;
  color: var(--accent-600);
}
.msg-att-meta {
  font-size: 0.75rem;
  color: var(--gray-500);
}
.msg-att-dl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  padding: 4px 10px;
}
.msg-att-preview-thumb {
  margin-top: 4px;
  margin-bottom: 8px;
}
.msg-att-preview-thumb img {
  max-width: 280px;
  max-height: 200px;
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: transform 0.2s;
  object-fit: contain;
}
.msg-att-preview-thumb img:hover {
  transform: scale(1.02);
}

.msg-attach-zone {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: var(--gray-50);
  border: 1.5px dashed var(--gray-300);
  border-radius: 12px;
}
.msg-attach-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.msg-attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
}
.msg-staged-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0.6rem;
}
.msg-staged-attachment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  font-size: 0.8rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}
.msg-staged-attachment .msg-att-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 2px;
}
.msg-staged-attachment .msg-att-remove:hover {
  color: #ef4444;
}

/* ── Scheduled messages ──────────────────────────────────── */
.msg-schedule-zone {
  margin-top: 0.9rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #fffbeb, #ffffff);
  border: 1.5px solid #fde68a;
  border-radius: 12px;
}
.msg-schedule-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #b45309;
  cursor: pointer;
  user-select: none;
}
.msg-schedule-picker-wrap {
  margin-top: 0.5rem;
}
.msg-schedule-help {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--gray-500);
}
.msg-scheduled-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}
.msg-sched-inline-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: #fff;
  color: var(--primary-700);
  border: 1px solid var(--gray-300);
  cursor: pointer;
  transition: all 0.15s ease;
}
.msg-sched-inline-btn:hover {
  background: var(--primary-50);
  border-color: var(--accent-400);
}
.msg-sched-inline-btn--danger {
  color: #dc2626;
  border-color: #fecaca;
}
.msg-sched-inline-btn--danger:hover {
  background: #fef2f2;
  border-color: #f87171;
}
.msg-scheduled-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.25rem;
  border-radius: 14px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fcd34d;
  color: #92400e;
  font-size: 0.88rem;
}
.msg-scheduled-banner-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.msg-scheduled-banner-icon {
  font-size: 1.4rem;
}
.msg-scheduled-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1100px) {
  .msg-shell { grid-template-columns: 76px minmax(280px, 360px) 1fr; }
  .msg-sidebar { padding: 1rem 0.6rem; align-items: center; }
  .msg-compose-btn { font-size: 0; padding: 0; width: 46px; height: 46px; border-radius: 12px; gap: 0; }
  .msg-compose-btn span { display: none; }
  .msg-folder { justify-content: center; padding: 0; width: 46px; height: 46px; border-radius: 12px; position: relative; }
  .msg-folder-label, .msg-sidebar-tip { display: none; }
  .msg-folder-count { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; font-size: 0.65rem; padding: 0 5px; }
}
@media (max-width: 760px) {
  .msg-page { padding: 0; }
  .msg-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: calc(100vh - 60px); border-radius: 0; }
  .msg-sidebar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    gap: 8px;
    height: auto;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .msg-folders {
    flex-direction: row;
    flex: 1;
    align-items: center;
    justify-content: space-around;
    gap: 6px;
  }
  .msg-sidebar .msg-compose-btn,
  .msg-sidebar .msg-folder {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 10px !important;
    flex-shrink: 0 !important;
    font-size: 0 !important;
    gap: 0 !important;
    box-sizing: border-box !important;
  }
  .msg-sidebar .msg-compose-btn span,
  .msg-sidebar .msg-folder .msg-folder-label {
    display: none !important;
  }
  .msg-sidebar .msg-compose-btn svg,
  .msg-sidebar .msg-folder svg {
    width: 20px !important;
    height: 20px !important;
    flex-shrink: 0;
  }
  .msg-sidebar .msg-folder .msg-folder-icon {
    width: 20px !important;
    height: 20px !important;
    font-size: 1.15rem !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .msg-sidebar .msg-folder.active {
    box-shadow: inset 0 -3px 0 var(--accent-400);
  }
  .msg-reader { display: none; }
  .msg-shell.has-selection .msg-list-pane { display: none; }
  .msg-shell.has-selection .msg-reader { display: flex; }
  .msg-back-mobile { display: inline-flex; }
  .msg-reader-actions .msg-tool-btn span { display: none; }
  .msg-reader-scroll { padding: 1.25rem; }
  .msg-notify-stack { top: 66px; right: 10px; left: 10px; width: auto; }
}

/* ============================================================
   AVISOS ESTILO WHATSAPP (sonido + push)
   ============================================================ */

/* Tarjeta in-app */
.msg-notify--wa {
  border-left: none;
  padding: 0.85rem 2.2rem 0.95rem 0.85rem;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 18px;
  box-shadow: 0 22px 48px rgba(10, 38, 71, 0.28), 0 0 0 1px rgba(37, 211, 102, 0.18);
  animation: waPopIn 0.45s cubic-bezier(0.18, 1.25, 0.4, 1);
}
.msg-notify--wa::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, #25d366, #128c7e);
}
.msg-notify--wa.msg-notify--schedule::before { background: linear-gradient(180deg, #fbbf24, #f97316); }
@keyframes waPopIn {
  0% { opacity: 0; transform: translateY(-14px) scale(0.92); }
  60% { opacity: 1; transform: translateY(2px) scale(1.02); }
  100% { transform: none; }
}
.msg-notify-avatar { position: relative; flex-shrink: 0; align-self: flex-start; }
.msg-notify-avatar-badge {
  position: absolute; right: -4px; bottom: -4px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #25d366; color: #fff; font-size: 0.7rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px #fff;
  animation: waBadgePulse 1.4s ease-out 0.3s 2;
}
.msg-notify--schedule .msg-notify-avatar-badge { background: #f59e0b; }
@keyframes waBadgePulse {
  0% { box-shadow: 0 0 0 2px #fff, 0 0 0 2px rgba(37, 211, 102, 0.6); }
  100% { box-shadow: 0 0 0 2px #fff, 0 0 0 12px rgba(37, 211, 102, 0); }
}
.msg-notify-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.msg-notify--wa .msg-notify-from { margin-top: 0; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-notify-time { font-size: 0.72rem; font-weight: 700; color: #128c7e; flex-shrink: 0; }
.msg-notify--schedule .msg-notify-time { color: #b45309; }
.msg-notify--wa .msg-notify-subject { color: var(--gray-800); font-weight: 600; margin-top: 1px; }
.msg-notify-preview {
  font-size: 0.82rem; color: var(--gray-500); line-height: 1.35; margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.msg-notify--wa .msg-notify-btn--primary { background: linear-gradient(135deg, #25d366, #128c7e); border-color: transparent; }
.msg-notify--wa .msg-notify-btn--primary:hover { filter: brightness(1.06); }
.msg-notify--wa .msg-notify-progress span { background: linear-gradient(90deg, #25d366, #128c7e); }

/* Campana/sobre de la cabecera "vibrando" al llegar un mensaje */
.msg-header-btn--ring svg { animation: waRing 0.9s ease-in-out 2; transform-origin: 50% 20%; }
@keyframes waRing {
  0%, 100% { transform: rotate(0); }
  15%, 45% { transform: rotate(-16deg); }
  30%, 60% { transform: rotate(16deg); }
  75% { transform: rotate(-6deg); }
}

/* Botón "Avisos" en la barra lateral */
.notif-settings-btn { position: relative; margin-top: 0.35rem; border-top: 1px dashed var(--gray-200); }
.notif-dot {
  position: absolute; top: 8px; left: 30px; width: 9px; height: 9px; border-radius: 50%;
  background: #f97316; box-shadow: 0 0 0 2px #fff; animation: waBadgePulse 1.6s ease-out infinite;
}
.notif-dot[hidden] { display: none; }

/* Panel de ajustes */
.notif-panel {
  position: fixed; z-index: 10005;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--gray-200); border-radius: 18px;
  box-shadow: 0 24px 60px rgba(10, 38, 71, 0.28);
  padding: 0.9rem; display: flex; flex-direction: column; gap: 0.55rem;
  opacity: 0; transform: translateY(-6px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.notif-panel.show { opacity: 1; transform: none; }
.notif-panel-head { display: flex; justify-content: space-between; align-items: center; font-weight: 800; color: var(--gray-900); padding: 0 0.2rem 0.2rem; }
.notif-panel-x { border: none; background: transparent; font-size: 1.3rem; line-height: 1; color: var(--gray-400); cursor: pointer; }
.notif-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.8rem;
  padding: 0.65rem 0.75rem; border-radius: 12px; background: var(--gray-50); cursor: pointer;
}
.notif-row.is-disabled { opacity: 0.6; cursor: not-allowed; }
.notif-row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-row-text strong { font-size: 0.88rem; color: var(--gray-900); }
.notif-row-text small { font-size: 0.74rem; color: var(--gray-500); }
.notif-switch {
  appearance: none; -webkit-appearance: none; flex-shrink: 0;
  width: 44px; height: 26px; border-radius: 999px; background: var(--gray-300);
  position: relative; cursor: pointer; transition: background 0.2s ease;
}
.notif-switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); transition: transform 0.22s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.notif-switch:checked { background: #25d366; }
.notif-switch:checked::after { transform: translateX(18px); }
.notif-switch:disabled { cursor: not-allowed; }
.notif-switch:focus-visible { outline: 2px solid var(--primary-500, #3b82f6); outline-offset: 2px; }
.notif-status { font-size: 0.78rem; line-height: 1.4; color: var(--gray-600); padding: 0.1rem 0.3rem; }
.notif-status--on { color: #128c7e; font-weight: 600; }
.notif-status--denied, .notif-status--ios-needs-install { color: #b45309; background: #fffbeb; border-radius: 10px; padding: 0.55rem 0.7rem; }

.notif-btn { border: none; border-radius: 10px; padding: 0.6rem 1rem; font-weight: 700; font-size: 0.85rem; cursor: pointer; transition: transform 0.15s ease, filter 0.15s ease; }
.notif-btn:active { transform: scale(0.97); }
.notif-btn--primary { background: linear-gradient(135deg, #25d366, #128c7e); color: #fff; box-shadow: 0 6px 16px rgba(18, 140, 126, 0.3); }
.notif-btn--primary:hover { filter: brightness(1.06); }
.notif-btn--ghost { background: transparent; color: var(--gray-600); }
.notif-btn--ghost:hover { background: var(--gray-100); }

/* Invitación flotante a activar avisos */
.notif-prompt {
  position: fixed; z-index: 10004; left: 50%; bottom: 20px;
  width: min(460px, calc(100vw - 24px));
  display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 0.85rem; align-items: center;
  padding: 1rem 1.1rem; border-radius: 20px;
  background: linear-gradient(135deg, #0a2647 0%, #0f3460 100%); color: #fff;
  box-shadow: 0 24px 60px rgba(4, 28, 44, 0.45);
  opacity: 0; transform: translate(-50%, 30px);
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.18, 1.25, 0.4, 1);
}
.notif-prompt.show { opacity: 1; transform: translate(-50%, 0); }
.notif-prompt-icon {
  width: 48px; height: 48px; border-radius: 50%; grid-row: span 2;
  display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
  background: rgba(37, 211, 102, 0.2); box-shadow: 0 0 0 6px rgba(37, 211, 102, 0.1);
  animation: msgRing 1.6s ease-in-out 0.4s 2;
}
.notif-prompt-text { display: flex; flex-direction: column; gap: 2px; }
.notif-prompt-text strong { font-size: 0.95rem; }
.notif-prompt-text span { font-size: 0.8rem; opacity: 0.8; line-height: 1.35; }
.notif-prompt-actions { grid-column: 2; display: flex; justify-content: flex-end; gap: 0.4rem; margin-top: 0.3rem; }
.notif-prompt .notif-btn--ghost { color: rgba(255, 255, 255, 0.75); }
.notif-prompt .notif-btn--ghost:hover { background: rgba(255, 255, 255, 0.1); }

/* Mini toast */
.notif-toast {
  position: fixed; z-index: 10006; left: 50%; top: 18px;
  max-width: calc(100vw - 24px); padding: 0.7rem 1.1rem; border-radius: 12px;
  font-size: 0.88rem; font-weight: 600; color: #fff; background: #0f3460;
  box-shadow: 0 12px 30px rgba(4, 28, 44, 0.3);
  opacity: 0; transform: translate(-50%, -12px); transition: opacity 0.25s ease, transform 0.25s ease;
}
.notif-toast.show { opacity: 1; transform: translate(-50%, 0); }
.notif-toast--ok { background: linear-gradient(135deg, #128c7e, #0f766e); }
.notif-toast--warn { background: linear-gradient(135deg, #d97706, #b45309); }
.notif-toast--error { background: linear-gradient(135deg, #dc2626, #991b1b); }

@media (max-width: 1100px) {
  .notif-settings-btn { border-top: none; margin-top: 0; }
  .notif-dot { top: 4px; left: auto; right: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .msg-notify--wa, .msg-notify-avatar-badge, .msg-header-btn--ring svg, .notif-dot, .notif-prompt-icon { animation: none !important; }
}


/* ===== Modal Asignar Turno (moderno) ===== */
.sched-modal .form-label { font-size: 0.78rem; font-weight: 600; color: #475569; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 4px; display: block; }
.sched-modal input:not([type="checkbox"]), .sched-modal select, .sched-modal textarea {
  border: 1px solid #cbd5e1; border-radius: 8px; padding: 8px 12px; font-size: 0.9rem;
  background-color: #ffffff; outline: none; width: 100%; box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}
.sched-modal input:not([type="checkbox"]):focus, .sched-modal select:focus, .sched-modal textarea:focus {
  border-color: #0284c7; box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}
.sched-modal input:disabled { background-color: #f8fafc; color: #64748b; }
.sched-modal .sched-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sched-modal .sched-quick-row { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; margin: 8px 0 12px 0; }
.sched-modal .sched-quick-chip {
  height: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  font-size: 0.78rem; font-weight: 600; background: #f1f5f9; border: 1px solid #cbd5e1;
  border-radius: 8px; color: #334155; cursor: pointer; white-space: nowrap; padding: 0 10px;
  transition: all .15s ease;
}
.sched-modal .sched-quick-chip:hover { background: #e2e8f0; border-color: #94a3b8; }
.sched-modal .sched-quick-chip.active { background: #eff6ff; border-color: #3b82f6; color: #1d4ed8; font-weight: 700; box-shadow: 0 0 0 1px #3b82f6; }
.sched-modal .sched-quick-chip--clear {
  background: #fef2f2 !important;
  border-color: #fca5a5 !important;
  color: #b91c1c !important;
  font-weight: 700 !important;
}
.sched-modal .sched-quick-chip--clear:hover {
  background: #fee2e2 !important;
  border-color: #f87171 !important;
  color: #991b1b !important;
}
.sched-modal .sched-notify-toggle { display: flex; align-items: center; gap: 12px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px; }
.sched-modal .sched-notify-switch { align-self: center; }
.sched-modal .sched-notify-text { justify-content: center; }
