
/*
 * email-hub.css — Scoped styles for the React Email Hub
 * All classes are prefixed with .eh- to prevent bleeding into the Vanilla JS shell.
 */

/* ── Root layout ─────────────────────────────────────────────────────────── */
.eh-root {
  display: flex;
  height: 100%;
  min-height: 480px;
  background: #ffffff;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 0.875rem;
  color: #1e293b;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.eh-loading {
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #64748b;
}

.eh-spinner {
  width: 24px; height: 24px;
  border: 3px solid #e2e8f0;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: eh-spin 0.7s linear infinite;
}

@keyframes eh-spin { to { transform: rotate(360deg); } }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.eh-sidebar {
  width: 300px;
  min-width: 260px;
  max-width: 320px;
  flex-shrink: 0;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  overflow: hidden;
}

.eh-sidebar-mailbox {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px 6px;
  font-size: 0.72rem;
  color: #64748b;
  border-bottom: 1px solid #f1f5f9;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.eh-mailbox-dot {
  width: 7px; height: 7px;
  background: #22c55e;
  border-radius: 50%;
  flex-shrink: 0;
}

.eh-sidebar-controls {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  align-items: center;
}

.eh-btn-compose {
  flex: 1;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.eh-btn-compose:hover { opacity: 0.9; transform: translateY(-1px); }

.eh-btn-icon {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  color: #64748b;
  transition: background 0.15s;
}

.eh-btn-icon:hover { background: #f1f5f9; color: #6366f1; }

.eh-search {
  margin: 0 12px 8px;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.82rem;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}

.eh-search:focus { border-color: #6366f1; }

.eh-thread-list {
  flex: 1;
  overflow-y: auto;
}

.eh-empty-list {
  padding: 24px;
  text-align: center;
  color: #94a3b8;
  font-size: 0.82rem;
}

/* ── Thread Items ────────────────────────────────────────────────────────── */
.eh-thread-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  background: none;
  border: none;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.12s;
}

.eh-thread-item:hover { background: #f1f5f9; }
.eh-thread-active { background: #eff6ff !important; border-left: 3px solid #6366f1; }

.eh-thread-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2px;
}

.eh-thread-party {
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}

.eh-thread-date { font-size: 0.72rem; color: #94a3b8; white-space: nowrap; }

.eh-thread-subject {
  font-size: 0.82rem;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 3px;
}

.eh-unread-dot {
  width: 6px; height: 6px;
  background: #6366f1;
  border-radius: 50%;
  flex-shrink: 0;
}

.eh-thread-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.eh-thread-preview {
  font-size: 0.75rem;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.eh-thread-count {
  font-size: 0.68rem;
  background: #e2e8f0;
  color: #64748b;
  border-radius: 20px;
  padding: 1px 7px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Main panel ──────────────────────────────────────────────────────────── */
.eh-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Thread view ─────────────────────────────────────────────────────────── */
.eh-thread-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.eh-thread-header {
  padding: 14px 20px 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  flex-shrink: 0;
}

.eh-thread-header-subject {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 3px;
}

.eh-thread-header-meta { font-size: 0.77rem; color: #94a3b8; }

.eh-messages-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Message Bubbles ─────────────────────────────────────────────────────── */
.eh-bubble-wrap {
  display: flex;
  flex-direction: column;
}

.eh-outbound { align-items: flex-end; }
.eh-inbound  { align-items: flex-start; }

.eh-bubble {
  max-width: 72%;
  min-width: 160px;
  border-radius: 12px;
  padding: 12px 16px;
  position: relative;
}

.eh-bubble-out {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-left: 3px solid #6366f1;
}

.eh-bubble-in {
  background: #f8fafc;
  border-left: 3px solid #e2e8f0;
}

.eh-bubble-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.eh-bubble-sender {
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
}

.eh-bubble-time {
  font-size: 0.72rem;
  color: #94a3b8;
  white-space: nowrap;
}

.eh-bubble-body { font-size: 0.85rem; line-height: 1.6; color: #1e293b; }

.eh-bubble-html { /* rendered HTML body */
  overflow-wrap: break-word;
  word-break: break-word;
}

.eh-bubble-html img { max-width: 100%; height: auto; border-radius: 4px; }

.eh-bubble-text { white-space: pre-wrap; overflow-wrap: break-word; }

.eh-no-content { color: #94a3b8; font-style: italic; }

.eh-quoted-toggle {
  margin-top: 6px;
  background: none;
  border: none;
  color: #6366f1;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.eh-quoted {
  margin-top: 8px;
  padding: 8px 12px;
  border-left: 2px solid #e2e8f0;
  color: #94a3b8;
  font-size: 0.78rem;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

/* ── Attachments in bubble ───────────────────────────────────────────────── */
.eh-bubble-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.eh-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  text-decoration: none;
  color: #334155;
  font-size: 0.78rem;
  transition: background 0.15s;
}

.eh-attachment-chip:hover { background: #e2e8f0; }
.eh-attachment-icon { font-size: 0.9rem; }
.eh-attachment-name { font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eh-attachment-size { color: #94a3b8; font-size: 0.72rem; }

/* ── Tracking Badge ──────────────────────────────────────────────────────── */
.eh-bubble-tracking { margin-top: 8px; }

.eh-tracking-badge {
  display: inline-block;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.72rem;
  font-weight: 500;
}

.eh-tracking-sent {
  background: #f1f5f9;
  color: #94a3b8;
}

.eh-tracking-opened {
  background: #dcfce7;
  color: #16a34a;
}

/* ── Reply section ───────────────────────────────────────────────────────── */
.eh-reply-section {
  flex-shrink: 0;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  padding: 12px 20px;
}

.eh-reply-trigger {
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #6366f1;
  font-size: 0.85rem;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-weight: 500;
}

.eh-reply-trigger:hover { background: #eff6ff; border-color: #6366f1; }

.eh-reply-disabled {
  color: #94a3b8;
  font-size: 0.8rem;
  padding: 6px 0;
}

.eh-reply-form { display: flex; flex-direction: column; gap: 10px; }

.eh-reply-textarea, .eh-compose-body {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
  color: #1e293b;
}

.eh-reply-textarea:focus, .eh-compose-body:focus { border-color: #6366f1; }

.eh-reply-attachments, .eh-compose-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.eh-reply-att-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.78rem;
  color: #334155;
}

.eh-att-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

.eh-att-remove:hover { color: #ef4444; }

.eh-reply-error { color: #ef4444; font-size: 0.8rem; }

.eh-reply-actions, .eh-compose-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.eh-reply-actions-right, .eh-compose-actions-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Compose drawer ──────────────────────────────────────────────────────── */
.eh-compose-drawer {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px;
  gap: 12px;
}

.eh-compose-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
}

.eh-compose-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  font-size: 1rem;
}

.eh-compose-close:hover { color: #ef4444; }

.eh-compose-subject {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  color: #1e293b;
}

.eh-compose-subject:focus { border-color: #6366f1; }

/* ── Shared buttons ──────────────────────────────────────────────────────── */
.eh-btn-primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.eh-btn-primary:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
.eh-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.eh-btn-ghost {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 0.82rem;
  cursor: pointer;
  color: #475569;
  transition: background 0.15s;
}

.eh-btn-ghost:hover { background: #f1f5f9; }

/* ── Empty / error states ────────────────────────────────────────────────── */
.eh-state-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px;
  gap: 12px;
  color: #475569;
}

.eh-state-icon { font-size: 2.5rem; }
.eh-state-empty h3 { margin: 0; font-size: 1.1rem; font-weight: 700; color: #1e293b; }
.eh-state-empty p  { margin: 0; font-size: 0.85rem; color: #64748b; max-width: 340px; }

.eh-main-empty { background: #fafafa; }

.eh-connect-btn { margin-top: 8px; }

/*
 * email-hub.css — Scoped styles for the React Email Hub
 * All classes are prefixed with .eh- to prevent bleeding into the Vanilla JS shell.
 */

/* ── Root layout ─────────────────────────────────────────────────────────── */
.eh-root {
  display: flex;
  height: 100%;
  min-height: 480px;
  background: #ffffff;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 0.875rem;
  color: #1e293b;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.eh-loading {
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #64748b;
}

.eh-spinner {
  width: 24px; height: 24px;
  border: 3px solid #e2e8f0;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: eh-spin 0.7s linear infinite;
}

@keyframes eh-spin { to { transform: rotate(360deg); } }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.eh-sidebar {
  width: 300px;
  min-width: 260px;
  max-width: 320px;
  flex-shrink: 0;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  overflow: hidden;
}

.eh-sidebar-mailbox {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px 6px;
  font-size: 0.72rem;
  color: #64748b;
  border-bottom: 1px solid #f1f5f9;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.eh-mailbox-dot {
  width: 7px; height: 7px;
  background: #22c55e;
  border-radius: 50%;
  flex-shrink: 0;
}

.eh-sidebar-controls {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  align-items: center;
}

.eh-btn-compose {
  flex: 1;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.eh-btn-compose:hover { opacity: 0.9; transform: translateY(-1px); }

.eh-btn-icon {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  color: #64748b;
  transition: background 0.15s;
}

.eh-btn-icon:hover { background: #f1f5f9; color: #6366f1; }

.eh-search {
  margin: 0 12px 8px;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.82rem;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}

.eh-search:focus { border-color: #6366f1; }

.eh-thread-list {
  flex: 1;
  overflow-y: auto;
}

.eh-empty-list {
  padding: 24px;
  text-align: center;
  color: #94a3b8;
  font-size: 0.82rem;
}

/* ── Thread Items ────────────────────────────────────────────────────────── */
.eh-thread-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  background: none;
  border: none;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.12s;
}

.eh-thread-item:hover { background: #f1f5f9; }
.eh-thread-active { background: #eff6ff !important; border-left: 3px solid #6366f1; }

.eh-thread-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2px;
}

.eh-thread-party {
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}

.eh-thread-date { font-size: 0.72rem; color: #94a3b8; white-space: nowrap; }

.eh-thread-subject {
  font-size: 0.82rem;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 3px;
}

.eh-unread-dot {
  width: 6px; height: 6px;
  background: #6366f1;
  border-radius: 50%;
  flex-shrink: 0;
}

.eh-thread-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.eh-thread-preview {
  font-size: 0.75rem;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.eh-thread-count {
  font-size: 0.68rem;
  background: #e2e8f0;
  color: #64748b;
  border-radius: 20px;
  padding: 1px 7px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Main panel ──────────────────────────────────────────────────────────── */
.eh-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Thread view ─────────────────────────────────────────────────────────── */
.eh-thread-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.eh-thread-header {
  padding: 14px 20px 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  flex-shrink: 0;
}

.eh-thread-header-subject {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 3px;
}

.eh-thread-header-meta { font-size: 0.77rem; color: #94a3b8; }

.eh-messages-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Message Bubbles ─────────────────────────────────────────────────────── */
.eh-bubble-wrap {
  display: flex;
  flex-direction: column;
}

.eh-outbound { align-items: flex-end; }
.eh-inbound  { align-items: flex-start; }

.eh-bubble {
  max-width: 72%;
  min-width: 160px;
  border-radius: 12px;
  padding: 12px 16px;
  position: relative;
}

.eh-bubble-out {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-left: 3px solid #6366f1;
}

.eh-bubble-in {
  background: #f8fafc;
  border-left: 3px solid #e2e8f0;
}

.eh-bubble-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.eh-bubble-sender {
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
}

.eh-bubble-time {
  font-size: 0.72rem;
  color: #94a3b8;
  white-space: nowrap;
}

.eh-bubble-body { font-size: 0.85rem; line-height: 1.6; color: #1e293b; }

.eh-bubble-html { /* rendered HTML body */
  overflow-wrap: break-word;
  word-break: break-word;
}

.eh-bubble-html img { max-width: 100%; height: auto; border-radius: 4px; }

.eh-bubble-text { white-space: pre-wrap; overflow-wrap: break-word; }

.eh-no-content { color: #94a3b8; font-style: italic; }

.eh-quoted-toggle {
  margin-top: 6px;
  background: none;
  border: none;
  color: #6366f1;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.eh-quoted {
  margin-top: 8px;
  padding: 8px 12px;
  border-left: 2px solid #e2e8f0;
  color: #94a3b8;
  font-size: 0.78rem;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

/* ── Attachments in bubble ───────────────────────────────────────────────── */
.eh-bubble-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.eh-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  text-decoration: none;
  color: #334155;
  font-size: 0.78rem;
  transition: background 0.15s;
}

.eh-attachment-chip:hover { background: #e2e8f0; }
.eh-attachment-icon { font-size: 0.9rem; }
.eh-attachment-name { font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eh-attachment-size { color: #94a3b8; font-size: 0.72rem; }

/* ── Tracking Badge ──────────────────────────────────────────────────────── */
.eh-bubble-tracking { margin-top: 8px; }

.eh-tracking-badge {
  display: inline-block;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.72rem;
  font-weight: 500;
}

.eh-tracking-sent {
  background: #f1f5f9;
  color: #94a3b8;
}

.eh-tracking-opened {
  background: #dcfce7;
  color: #16a34a;
}

/* ── Reply section ───────────────────────────────────────────────────────── */
.eh-reply-section {
  flex-shrink: 0;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  padding: 12px 20px;
}

.eh-reply-trigger {
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #6366f1;
  font-size: 0.85rem;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-weight: 500;
}

.eh-reply-trigger:hover { background: #eff6ff; border-color: #6366f1; }

.eh-reply-disabled {
  color: #94a3b8;
  font-size: 0.8rem;
  padding: 6px 0;
}

.eh-reply-form { display: flex; flex-direction: column; gap: 10px; }

.eh-reply-textarea, .eh-compose-body {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
  color: #1e293b;
}

.eh-reply-textarea:focus, .eh-compose-body:focus { border-color: #6366f1; }

.eh-reply-attachments, .eh-compose-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.eh-reply-att-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.78rem;
  color: #334155;
}

.eh-att-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

.eh-att-remove:hover { color: #ef4444; }

.eh-reply-error { color: #ef4444; font-size: 0.8rem; }

.eh-reply-actions, .eh-compose-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.eh-reply-actions-right, .eh-compose-actions-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Compose drawer ──────────────────────────────────────────────────────── */
.eh-compose-drawer {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px;
  gap: 12px;
}

.eh-compose-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
}

.eh-compose-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  font-size: 1rem;
}

.eh-compose-close:hover { color: #ef4444; }

.eh-compose-subject {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  color: #1e293b;
}

.eh-compose-subject:focus { border-color: #6366f1; }

/* ── Shared buttons ──────────────────────────────────────────────────────── */
.eh-btn-primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.eh-btn-primary:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
.eh-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.eh-btn-ghost {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 0.82rem;
  cursor: pointer;
  color: #475569;
  transition: background 0.15s;
}

.eh-btn-ghost:hover { background: #f1f5f9; }

/* ── Empty / error states ────────────────────────────────────────────────── */
.eh-state-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px;
  gap: 12px;
  color: #475569;
}

.eh-state-icon { font-size: 2.5rem; }
.eh-state-empty h3 { margin: 0; font-size: 1.1rem; font-weight: 700; color: #1e293b; }
.eh-state-empty p  { margin: 0; font-size: 0.85rem; color: #64748b; max-width: 340px; }

.eh-main-empty { background: #fafafa; }

.eh-connect-btn { margin-top: 8px; }

/*
 * email-hub.css — Scoped styles for the React Email Hub
 * All classes are prefixed with .eh- to prevent bleeding into the Vanilla JS shell.
 */

/* ── Root layout ─────────────────────────────────────────────────────────── */
.eh-root {
  display: flex;
  height: 100%;
  min-height: 480px;
  background: #ffffff;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 0.875rem;
  color: #1e293b;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.eh-loading {
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #64748b;
}

.eh-spinner {
  width: 24px; height: 24px;
  border: 3px solid #e2e8f0;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: eh-spin 0.7s linear infinite;
}

@keyframes eh-spin { to { transform: rotate(360deg); } }

/* ── Skeleton shimmer ────────────────────────────────────────────────────── */
@keyframes eh-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.eh-skeleton-line,
.eh-skeleton-btn,
.eh-skeleton-bubble {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 800px 100%;
  animation: eh-shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.eh-sidebar {
  width: 300px;
  min-width: 260px;
  max-width: 320px;
  flex-shrink: 0;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  overflow: hidden;
}

.eh-sidebar-mailbox {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px 6px;
  font-size: 0.72rem;
  color: #64748b;
  border-bottom: 1px solid #f1f5f9;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.eh-mailbox-dot {
  width: 7px; height: 7px;
  background: #22c55e;
  border-radius: 50%;
  flex-shrink: 0;
}

.eh-sidebar-controls {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  align-items: center;
}

.eh-btn-compose {
  flex: 1;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.eh-btn-compose:hover { opacity: 0.9; transform: translateY(-1px); }

.eh-btn-icon {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  color: #64748b;
  transition: background 0.15s;
}

.eh-btn-icon:hover { background: #f1f5f9; color: #6366f1; }

.eh-search {
  margin: 0 12px 8px;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.82rem;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}

.eh-search:focus { border-color: #6366f1; }

.eh-thread-list {
  flex: 1;
  overflow-y: auto;
}

.eh-empty-list {
  padding: 24px;
  text-align: center;
  color: #94a3b8;
  font-size: 0.82rem;
}

/* ── Thread Items ────────────────────────────────────────────────────────── */
.eh-thread-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  background: none;
  border: none;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.12s;
}

.eh-thread-item:hover { background: #f1f5f9; }
.eh-thread-active { background: #eff6ff !important; border-left: 3px solid #6366f1; }

.eh-thread-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2px;
}

.eh-thread-party {
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}

.eh-thread-date { font-size: 0.72rem; color: #94a3b8; white-space: nowrap; }

.eh-thread-subject {
  font-size: 0.82rem;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 3px;
}

.eh-unread-dot {
  width: 6px; height: 6px;
  background: #6366f1;
  border-radius: 50%;
  flex-shrink: 0;
}

.eh-thread-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.eh-thread-preview {
  font-size: 0.75rem;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.eh-thread-count {
  font-size: 0.68rem;
  background: #e2e8f0;
  color: #64748b;
  border-radius: 20px;
  padding: 1px 7px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Main panel ──────────────────────────────────────────────────────────── */
.eh-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Thread view ─────────────────────────────────────────────────────────── */
.eh-thread-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.eh-thread-header {
  padding: 14px 20px 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  flex-shrink: 0;
}

.eh-thread-header-subject {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 3px;
}

.eh-thread-header-meta { font-size: 0.77rem; color: #94a3b8; }

.eh-messages-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Message Bubbles ─────────────────────────────────────────────────────── */
.eh-bubble-wrap {
  display: flex;
  flex-direction: column;
}

.eh-outbound { align-items: flex-end; }
.eh-inbound  { align-items: flex-start; }

.eh-bubble {
  max-width: 72%;
  min-width: 160px;
  border-radius: 12px;
  padding: 12px 16px;
  position: relative;
}

.eh-bubble-out {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-left: 3px solid #6366f1;
}

.eh-bubble-in {
  background: #f8fafc;
  border-left: 3px solid #e2e8f0;
}

.eh-bubble-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.eh-bubble-sender {
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
}

.eh-bubble-time {
  font-size: 0.72rem;
  color: #94a3b8;
  white-space: nowrap;
}

.eh-bubble-body { font-size: 0.85rem; line-height: 1.6; color: #1e293b; }

.eh-bubble-html { /* rendered HTML body */
  overflow-wrap: break-word;
  word-break: break-word;
}

.eh-bubble-html img { max-width: 100%; height: auto; border-radius: 4px; }

.eh-bubble-text { white-space: pre-wrap; overflow-wrap: break-word; }

.eh-no-content { color: #94a3b8; font-style: italic; }

.eh-quoted-toggle {
  margin-top: 6px;
  background: none;
  border: none;
  color: #6366f1;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.eh-quoted {
  margin-top: 8px;
  padding: 8px 12px;
  border-left: 2px solid #e2e8f0;
  color: #94a3b8;
  font-size: 0.78rem;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

/* ── Attachments in bubble ───────────────────────────────────────────────── */
.eh-bubble-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.eh-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  text-decoration: none;
  color: #334155;
  font-size: 0.78rem;
  transition: background 0.15s;
}

.eh-attachment-chip:hover { background: #e2e8f0; }
.eh-attachment-icon { font-size: 0.9rem; }
.eh-attachment-name { font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eh-attachment-size { color: #94a3b8; font-size: 0.72rem; }

/* ── Tracking Badge ──────────────────────────────────────────────────────── */
.eh-bubble-tracking { margin-top: 8px; }

.eh-tracking-badge {
  display: inline-block;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.72rem;
  font-weight: 500;
}

.eh-tracking-sent {
  background: #f1f5f9;
  color: #94a3b8;
}

.eh-tracking-opened {
  background: #dcfce7;
  color: #16a34a;
}

/* ── Reply section ───────────────────────────────────────────────────────── */
.eh-reply-section {
  flex-shrink: 0;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  padding: 12px 20px;
}

.eh-reply-trigger {
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #6366f1;
  font-size: 0.85rem;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-weight: 500;
}

.eh-reply-trigger:hover { background: #eff6ff; border-color: #6366f1; }

.eh-reply-disabled {
  color: #94a3b8;
  font-size: 0.8rem;
  padding: 6px 0;
}

.eh-reply-form { display: flex; flex-direction: column; gap: 10px; }

.eh-reply-textarea, .eh-compose-body {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
  color: #1e293b;
}

.eh-reply-textarea:focus, .eh-compose-body:focus { border-color: #6366f1; }

.eh-reply-attachments, .eh-compose-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.eh-reply-att-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.78rem;
  color: #334155;
}

.eh-att-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

.eh-att-remove:hover { color: #ef4444; }

.eh-reply-error { color: #ef4444; font-size: 0.8rem; }

.eh-reply-actions, .eh-compose-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.eh-reply-actions-right, .eh-compose-actions-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Compose drawer ──────────────────────────────────────────────────────── */
.eh-compose-drawer {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px;
  gap: 12px;
}

.eh-compose-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
}

.eh-compose-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  font-size: 1rem;
}

.eh-compose-close:hover { color: #ef4444; }

.eh-compose-subject {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  color: #1e293b;
}

.eh-compose-subject:focus { border-color: #6366f1; }

/* ── Shared buttons ──────────────────────────────────────────────────────── */
.eh-btn-primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.eh-btn-primary:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
.eh-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.eh-btn-ghost {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 0.82rem;
  cursor: pointer;
  color: #475569;
  transition: background 0.15s;
}

.eh-btn-ghost:hover { background: #f1f5f9; }

/* ── Empty / error states ────────────────────────────────────────────────── */
.eh-state-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px;
  gap: 12px;
  color: #475569;
}

.eh-state-icon { font-size: 2.5rem; }
.eh-state-empty h3 { margin: 0; font-size: 1.1rem; font-weight: 700; color: #1e293b; }
.eh-state-empty p  { margin: 0; font-size: 0.85rem; color: #64748b; max-width: 340px; }

.eh-main-empty { background: #fafafa; }

.eh-connect-btn { margin-top: 8px; }

/* ── Skeleton layout ─────────────────────────────────────────────────────── */
.eh-skeleton-sidebar {
  padding: 14px 12px;
  gap: 0;
}

.eh-skeleton-btn {
  height: 36px;
  width: 100%;
  margin-bottom: 14px;
  border-radius: 8px;
}

.eh-skeleton-thread-item {
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.eh-skeleton-line {
  height: 10px;
}

.eh-skeleton-line--short  { width: 40%; }
.eh-skeleton-line--medium { width: 65%; }
.eh-skeleton-line--long   { width: 90%; }

.eh-skeleton-main {
  padding: 20px 24px;
  gap: 16px;
}

.eh-skeleton-bubble {
  padding: 14px 18px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: none !important;
  animation: none !important;
  max-width: 68%;
}

.eh-skeleton-bubble--out { align-self: flex-end; border-left: 3px solid #dbeafe; background: #eff6ff !important; }
.eh-skeleton-bubble--in  { align-self: flex-start; border-left: 3px solid #e2e8f0; background: #f8fafc !important; }

.eh-skeleton-bubble .eh-skeleton-line {
  animation: eh-shimmer 1.4s ease-in-out infinite;
  background: linear-gradient(90deg, #e2e8f0 25%, #cbd5e1 50%, #e2e8f0 75%);
  background-size: 800px 100%;
}
