/* ============================================================
   Email Client — Premium CSS
   Hereda variables de iEnTop.css (--color-bg-*, --color-text-*, etc.)
   ============================================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ---------- Email App Variables ---------- */
:root {
  /* Layout tokens — email-specific, no conflict with iEnTop.css */
  --email-sidebar-w: 230px;
  --email-list-w: 360px;
  --email-toolbar-h: 52px;
  --email-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --email-radius: 0.5rem;
  --email-radius-lg: 0.75rem;

  /* Detail-specific elevated surfaces (email-only tokens) */
  --email-surface-header: #1a2744;
  --email-surface-body: #162033;
  --email-surface-attachment: #1a2744;

  /* NOTE: Do NOT redefine --color-bg-*, --color-text-*, --color-accent, etc.
     here. Those variables are defined by iEnTop.css and switch with
     data-theme. Redefining them in :root breaks the theme switcher
     because :root and [data-theme] have the same CSS specificity,
     and this file loads AFTER iEnTop.css, so :root values here
     would always win the cascade. */
}

/* ---------- Reset & Base ---------- */
/* NOTE: Do NOT use global *, body resets here — this CSS is loaded
   in the ERP shell alongside iEnTop.css. Global resets break the
   ERP header, sidebar, and theme switcher. Scope to .email-app. */

.email-app {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--color-bg-primary, #0f172a);
  color: var(--color-text-primary, #f1f5f9);
}

/* ============================================================
   App Shell â€” 3 Column Layout
   ============================================================ */
.email-app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: var(--color-bg-primary);
}

/* ---------- Column 1: Folder Sidebar ---------- */
.email-sidebar {
  width: var(--email-sidebar-w);
  min-width: var(--email-sidebar-w);
  background: var(--color-bg-sidebar, #0c1222);
  border-right: 1px solid var(--color-border, #334155);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.email-sidebar-header {
  padding: 1rem 1rem 0.75rem;
  flex-shrink: 0;
}

.email-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1rem;
}

.email-sidebar-brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--email-radius);
  background: linear-gradient(135deg, var(--color-accent, #6366f1), #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.email-sidebar-brand h1 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}

.email-sidebar-brand span {
  font-size: 0.6875rem;
  color: var(--color-text-muted, #64748b);
  font-weight: 400;
  display: block;
}

/* Account Selector / CRUD List */
.account-selector {
  position: relative;
  margin-bottom: 0.75rem;
}

.account-list {
  border: 1px solid var(--color-border, #334155);
  border-radius: var(--email-radius);
  overflow: hidden;
}

.account-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.625rem;
  cursor: pointer;
  transition: var(--email-transition);
}

.account-option:hover {
  background: var(--color-bg-hover);
}

.account-option.active {
  background: var(--color-accent-subtle);
}

.account-option .fa-check {
  color: var(--color-accent);
  font-size: 0.75rem;
  margin-left: auto;
}

.account-avatar-sm {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.5625rem;
  font-weight: 700;
  flex-shrink: 0;
}

.account-option-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.account-option-info span:first-child {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-primary);
}

.account-option-email {
  font-size: 0.625rem;
  color: var(--color-text-muted);
}

/* CRUD List Actions (global pattern) */
.crud-list-actions {
  display: flex;
  gap: 0.25rem;
  padding: 0.375rem 0.5rem;
  border-top: 1px solid var(--color-border, #334155);
  background: var(--color-bg-secondary, #1e293b);
}

.crud-btn {
  flex: 1;
  padding: 0.375rem;
  border: none;
  border-radius: var(--email-radius, 0.5rem);
  background: transparent;
  color: var(--color-text-muted, #64748b);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.75rem;
}

.crud-btn:hover:not(:disabled) {
  background: var(--color-bg-hover, #334155);
  color: var(--color-text-primary, #f1f5f9);
}

.crud-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.crud-btn.delete:hover:not(:disabled) {
  color: var(--color-danger, #ef4444);
}

/* Account Detail Modal */
.acct-detail-modal {
  background: var(--color-bg-card, #1e293b);
  border: 1px solid var(--color-border, #334155);
  border-radius: 0.75rem;
  width: min(520px, 90vw);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.acct-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border, #334155);
}

.acct-modal-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.acct-modal-close {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem;
}

.acct-modal-close:hover {
  color: var(--color-text-primary);
}

.acct-tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border, #334155);
  padding: 0 1.25rem;
}

.acct-tab {
  padding: 0.625rem 0.75rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.acct-tab:hover {
  color: var(--color-text-primary);
}

.acct-tab.active {
  color: var(--color-accent, #818cf8);
  border-bottom-color: var(--color-accent, #818cf8);
}

.acct-tab-content {
  padding: 1rem 1.25rem;
}

.acct-field {
  margin-bottom: 0.75rem;
}

.acct-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 0.25rem;
}

.acct-field input[type="text"],
.acct-field input[type="email"],
.acct-field input[type="password"],
.acct-field input[type="number"],
.acct-field select {
  width: 100%;
  padding: 0.5rem 0.625rem;
  background: var(--color-bg-input, #0f172a);
  border: 1px solid var(--color-border, #334155);
  border-radius: var(--email-radius, 0.5rem);
  color: var(--color-text-primary);
  font-size: 0.8125rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.acct-field input:focus,
.acct-field select:focus {
  border-color: var(--color-accent, #818cf8);
}

.acct-field input[type="checkbox"] {
  margin-right: 0.375rem;
}

.acct-row {
  display: flex;
  gap: 0.75rem;
}

.acct-row .acct-field {
  flex: 1;
}

.acct-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--color-border, #334155);
}

.acct-modal-footer .btn-cancel {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--color-border, #334155);
  border-radius: var(--email-radius, 0.5rem);
  color: var(--color-text-secondary);
  cursor: pointer;
  font-family: inherit;
}

.acct-modal-footer .btn-save {
  padding: 0.5rem 1.25rem;
  background: var(--color-accent, #818cf8);
  border: none;
  border-radius: var(--email-radius, 0.5rem);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.acct-modal-footer .btn-save:hover {
  background: var(--color-accent-hover, #6366f1);
}

.acct-modal-footer .btn-test,
.btn-test {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--color-accent, #818cf8);
  border-radius: var(--email-radius, 0.5rem);
  color: var(--color-accent, #818cf8);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8125rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.btn-test:hover:not(:disabled) {
  background: var(--color-accent-subtle, rgba(99, 102, 241, 0.1));
}

.btn-test:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* Confirm Dialog */
.cp-confirm-box {
  background: var(--color-bg-card, #1e293b);
  border: 1px solid var(--color-border, #334155);
  border-radius: 0.75rem;
  padding: 1.5rem;
  width: min(400px, 85vw);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.cp-confirm-box h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.cp-confirm-box p {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.cp-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.cp-confirm-actions .btn-cancel {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--color-border, #334155);
  border-radius: var(--email-radius, 0.5rem);
  color: var(--color-text-secondary);
  cursor: pointer;
  font-family: inherit;
}

.cp-confirm-actions .btn-save {
  padding: 0.5rem 1rem;
  background: var(--color-accent, #818cf8);
  border: none;
  border-radius: var(--email-radius, 0.5rem);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

/* Compose button */
.btn-compose {
  width: 100%;
  padding: 0.625rem 1rem;
  background: linear-gradient(135deg, var(--color-accent, #6366f1), #818cf8);
  color: #fff;
  border: none;
  border-radius: var(--email-radius);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--email-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.btn-compose:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.45);
  filter: brightness(1.08);
}

.btn-compose:active {
  transform: translateY(0);
}

.btn-compose i {
  font-size: 0.875rem;
}

/* Folder list */
.email-folders {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.folder-section-label {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  padding: 0.75rem 1rem 0.375rem;
}

.folder-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: var(--email-transition);
  border-left: 3px solid transparent;
  position: relative;
  user-select: none;
}

.folder-item:hover {
  background: var(--color-bg-hover, #334155);
}

.folder-item.active {
  background: var(--color-accent-subtle, rgba(99, 102, 241, 0.15));
  border-left-color: var(--color-accent, #6366f1);
}

.folder-item.active .folder-name {
  color: var(--color-text-accent, #818cf8);
  font-weight: 600;
}

.folder-item .folder-icon {
  width: 18px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  flex-shrink: 0;
  transition: var(--email-transition);
}

.folder-item.active .folder-icon {
  color: var(--color-text-accent);
}

.folder-item .folder-name {
  font-size: 0.8125rem;
  color: var(--color-text-secondary, #94a3b8);
  flex: 1;
  transition: var(--email-transition);
}

.folder-item .folder-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  background: var(--color-accent);
  color: #fff;
  padding: 0.0625rem 0.4375rem;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
  line-height: 1.4;
}

.folder-item .folder-badge.muted {
  background: var(--color-bg-hover, #334155);
  color: var(--color-text-muted, #64748b);
  font-weight: 500;
}

.folder-item .folder-badge.unread {
  background: var(--color-accent);
  color: #fff;
}

.folder-item .folder-badge.empty {
  display: none;
}

/* Labels / Etiquetas */
.label-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Sidebar footer */
.email-sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.sidebar-account {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.375rem 0.5rem;
  border-radius: var(--email-radius);
  transition: var(--email-transition);
}

.sidebar-account:hover {
  background: var(--color-bg-hover);
}

.sidebar-account-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent), #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-account-info {
  flex: 1;
  min-width: 0;
}

.sidebar-account-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-account-email {
  font-size: 0.625rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   Column 2: Email List
   ============================================================ */
.email-list-panel {
  width: var(--email-list-w);
  min-width: 280px;
  max-width: 500px;
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  background: var(--color-bg-secondary, #1e293b);
  overflow: hidden;
  flex-shrink: 0;
  resize: horizontal;
}

/* List header with search */
.email-list-header {
  padding: 0.75rem;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.email-list-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.625rem;
}

.email-list-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.email-list-count {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  background: var(--color-bg-input, #334155);
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
}

.email-search-wrap {
  position: relative;
}

.email-search-wrap input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  background: var(--color-bg-input);
  border: 1px solid var(--color-border);
  border-radius: var(--email-radius);
  color: var(--color-text-primary);
  font-size: 0.8125rem;
  outline: none;
  transition: var(--email-transition);
  font-family: inherit;
}

.email-search-wrap input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-subtle);
}

.email-search-wrap input::placeholder {
  color: var(--color-text-muted);
}

.email-search-wrap .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  pointer-events: none;
}

/* Filter tabs */
.email-filters {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  background: var(--color-bg-secondary);
}

.email-filter-btn {
  padding: 0.3125rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: var(--email-transition);
  font-family: inherit;
}

.email-filter-btn:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-hover);
}

.email-filter-btn.active {
  color: var(--color-text-accent);
  background: var(--color-accent-subtle);
  border-color: rgba(99, 102, 241, 0.3);
}

/* Email list scroll */
.email-list-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Individual email item */
.email-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  transition: var(--email-transition);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  position: relative;
}

.email-item:hover {
  background: var(--color-bg-hover);
}

.email-item.selected {
  background: var(--color-accent-subtle);
  border-left: 3px solid var(--color-accent);
}

.email-item.unread {
  background: rgba(99, 102, 241, 0.06);
}

.email-item.unread .email-item-subject {
  font-weight: 700;
  color: var(--color-text-primary);
}

/* Unread indicator dot */
.email-item.unread::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
  animation: pulseDot 2s ease-in-out infinite;
}

@keyframes pulseDot {

  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.5);
  }

  50% {
    opacity: 0.7;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0);
  }
}

/* Avatar */
.email-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0.02em;
  position: relative;
  margin-top: 0.125rem;
}

/* Email content */
.email-item-content {
  flex: 1;
  min-width: 0;
}

.email-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.email-item-sender {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-item-date {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.email-item-subject {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-item-preview {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.email-item-bottom {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.125rem;
}

.email-item-tag {
  font-size: 0.5625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.0625rem 0.375rem;
  border-radius: 999px;
  line-height: 1.5;
}

.email-item-attachment {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
}

.email-item-star {
  margin-left: auto;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  transition: var(--email-transition);
  opacity: 0;
  padding: 0.125rem;
}

.email-item:hover .email-item-star,
.email-item-star.starred {
  opacity: 1;
}

.email-item-star.starred {
  color: #f59e0b;
}

.email-item-star:hover {
  color: #f59e0b;
  transform: scale(1.2);
}

/* ============================================================
   Column 3: Email Detail
   ============================================================ */
.email-detail-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-primary);
  overflow: hidden;
  min-width: 0;
  position: relative;
}

/* Detail toolbar */
.email-detail-toolbar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  background: var(--color-bg-secondary);
}

.toolbar-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.4375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--email-radius);
  cursor: pointer;
  transition: var(--email-transition);
  font-family: inherit;
  white-space: nowrap;
}

.toolbar-btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
  border-color: var(--color-border);
}

.toolbar-btn.primary {
  background: var(--color-accent-subtle);
  color: var(--color-text-accent);
  border-color: rgba(99, 102, 241, 0.2);
}

/* Refresh button */
.refresh-btn {
  padding: 0.375rem;
  margin-left: auto;
}

.refresh-btn.spinning i {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.toolbar-btn.primary:hover {
  background: var(--color-accent);
  color: #fff;
}

.toolbar-btn.danger:hover {
  background: rgba(239, 68, 68, 0.12);
  color: var(--color-danger, #ef4444);
  border-color: rgba(239, 68, 68, 0.2);
}

.toolbar-btn i {
  font-size: 0.8125rem;
}

.toolbar-separator {
  width: 1px;
  height: 24px;
  background: var(--color-border);
  margin: 0 0.375rem;
  flex-shrink: 0;
}

.toolbar-spacer {
  flex: 1;
}

/* Detail header â€” elevated card surface */
.email-detail-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  background: var(--email-surface-header, #1a2744);
}

.email-detail-subject {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 1rem;
  line-height: 1.3;
  padding: 0.75rem 1rem;
  background: var(--color-bg-input, #334155);
  border-radius: var(--email-radius);
  border-left: 4px solid var(--color-accent, #6366f1);
}

.email-detail-meta {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--color-bg-input, #334155);
  border-radius: var(--email-radius);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.email-detail-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.email-detail-meta-info {
  flex: 1;
  min-width: 0;
}

.email-detail-sender-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.125rem;
}

.email-detail-sender-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.email-detail-sender-email {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.email-detail-recipients {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.125rem;
}

.email-detail-date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
  text-align: right;
  padding: 0.25rem 0.5rem;
  background: var(--color-bg-input, #334155);
  border-radius: 999px;
  white-space: nowrap;
}

/* Detail body â€” distinct reading surface */
.email-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
}

.email-detail-body-content {
  font-size: 0.875rem;
  color: var(--color-text-primary);
  line-height: 1.75;
  max-width: 720px;
  background: var(--email-surface-body, #162033);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--email-radius-lg, 0.75rem);
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.email-detail-body-content p {
  margin-bottom: 0.75rem;
}

.email-detail-body-content ul,
.email-detail-body-content ol {
  padding-left: 1.25rem;
  margin-bottom: 0.75rem;
}

.email-detail-body-content li {
  margin-bottom: 0.25rem;
}

.email-detail-body-content a {
  color: var(--color-text-accent);
  text-decoration: underline;
}

.email-detail-body-content blockquote {
  border-left: 3px solid var(--color-accent, #6366f1);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  color: var(--color-text-secondary);
  font-style: italic;
  background: var(--color-bg-input, #334155);
  border-radius: 0 var(--email-radius) var(--email-radius) 0;
}

.email-detail-body-content code {
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.8125rem;
  background: var(--color-bg-input, #334155);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  color: var(--color-text-accent, #818cf8);
}

.email-detail-body-content strong {
  color: var(--color-text-primary);
  font-weight: 600;
}

/* Attachments bar â€” elevated surface */
.email-attachments {
  padding: 0.875rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  background: var(--email-surface-attachment, #1a2744);
  margin: 1rem 1.5rem 0;
  border-radius: var(--email-radius-lg, 0.75rem);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.email-attachments-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.email-attachments-title i {
  color: var(--color-accent, #6366f1);
}

.email-attachments-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  background: var(--color-bg-input, #334155);
  border: 1px solid var(--color-border);
  border-radius: var(--email-radius);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--email-transition);
}

.attachment-chip:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-accent);
  color: var(--color-text-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.attachment-chip i {
  font-size: 1rem;
  color: var(--color-text-accent, #818cf8);
}

.attachment-chip .att-size {
  font-size: 0.625rem;
  color: var(--color-text-muted);
  margin-left: 0.25rem;
}

/* Empty state */
.email-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  text-align: center;
  padding: 2rem;
}

.email-empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.3;
}

.email-empty-state h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 0.375rem;
}

.email-empty-state p {
  font-size: 0.8125rem;
}

/* ============================================================
   Inline Compose Panel (replaces Column 3)
   ============================================================ */
.compose-panel {
  display: none;
  flex-direction: column;
  position: absolute;
  inset: 0;
  background: var(--color-bg-primary, #0f172a);
  z-index: 10;
}

.compose-panel.active {
  display: flex;
}

/* Compose Header */
.compose-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--email-surface-header, #1a2744);
  flex-shrink: 0;
}

.compose-panel-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.compose-panel-title i {
  color: var(--color-accent, #6366f1);
  font-size: 0.875rem;
}

.compose-panel-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Address Fields */
.compose-panel-fields {
  flex-shrink: 0;
  border-bottom: 1px solid var(--color-border);
}

.compose-panel-field {
  display: flex;
  align-items: center;
  padding: 0.5rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.compose-panel-field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  width: 50px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.compose-panel-field input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--color-text-primary);
  font-size: 0.875rem;
  outline: none;
  font-family: inherit;
  padding: 0.375rem 0.5rem;
}

.compose-panel-field input::placeholder {
  color: var(--color-text-muted);
}

.compose-panel-field input:focus {
  background: var(--color-bg-input, #334155);
  border-radius: var(--email-radius);
}

.compose-field-toggle {
  padding: 0.25rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--color-text-accent, #818cf8);
  background: transparent;
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 999px;
  cursor: pointer;
  transition: var(--email-transition);
  font-family: inherit;
  white-space: nowrap;
}

.compose-field-toggle:hover {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent);
}

/* Rich Text Formatting Toolbar */
.compose-format-toolbar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 1.25rem;
  background: var(--email-surface-header, #1a2744);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.compose-format-group {
  display: flex;
  align-items: center;
  gap: 0.125rem;
}

.compose-format-sep {
  width: 1px;
  height: 20px;
  background: var(--color-border);
  margin: 0 0.375rem;
}

.compose-fmt-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  border-radius: var(--email-radius);
  transition: var(--email-transition);
  font-size: 0.8125rem;
}

.compose-fmt-btn:hover {
  background: var(--color-bg-input, #334155);
  color: var(--color-text-primary);
  border-color: var(--color-border);
}

.compose-fmt-btn:active,
.compose-fmt-btn.active {
  background: var(--color-accent-subtle);
  color: var(--color-text-accent);
  border-color: rgba(99, 102, 241, 0.3);
}

/* Editor Area */
.compose-editor-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}

.compose-editor {
  min-height: 200px;
  padding: 1rem 1.25rem;
  background: var(--email-surface-body, #162033);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--email-radius-lg);
  color: var(--color-text-primary);
  font-size: 0.875rem;
  line-height: 1.7;
  font-family: inherit;
  outline: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.compose-editor:focus {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 0 0 3px var(--color-accent-subtle), 0 1px 4px rgba(0, 0, 0, 0.15);
}

.compose-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--color-text-muted);
  pointer-events: none;
}

.compose-editor p {
  margin-bottom: 0.5rem;
}

.compose-editor ul,
.compose-editor ol {
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
}

.compose-editor a {
  color: var(--color-text-accent);
}

.compose-editor pre {
  background: var(--color-bg-input, #334155);
  padding: 0.75rem 1rem;
  border-radius: var(--email-radius);
  font-family: 'Fira Code', monospace;
  font-size: 0.8125rem;
  margin: 0.5rem 0;
}

/* Attachments Zone */
.compose-attachments-zone {
  flex-shrink: 0;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--color-border);
}

.compose-drop-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 2px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--email-radius-lg);
  color: var(--color-text-muted);
  font-size: 0.75rem;
  transition: var(--email-transition);
}

.compose-drop-area i {
  font-size: 1.125rem;
  color: var(--color-accent, #6366f1);
  opacity: 0.6;
}

.compose-drop-area.dragover {
  border-color: var(--color-accent);
  background: var(--color-accent-subtle);
  color: var(--color-text-accent);
}

.compose-drop-area.dragover i {
  opacity: 1;
}

.compose-browse-link {
  color: var(--color-text-accent, #818cf8);
  cursor: pointer;
  text-decoration: underline;
  font-weight: 500;
}

.compose-browse-link:hover {
  color: var(--color-accent, #6366f1);
}

.compose-file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.5rem;
}

.compose-file-chip {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.625rem;
  background: var(--color-bg-input, #334155);
  border: 1px solid var(--color-border);
  border-radius: var(--email-radius);
  font-size: 0.6875rem;
  color: var(--color-text-secondary);
}

.compose-file-chip i {
  color: var(--color-text-accent, #818cf8);
}

.compose-file-chip .remove-file {
  cursor: pointer;
  color: var(--color-text-muted);
  margin-left: 0.25rem;
  transition: var(--email-transition);
}

.compose-file-chip .remove-file:hover {
  color: var(--color-danger, #ef4444);
}

/* Compose Footer */
.compose-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--color-border);
  background: var(--email-surface-header, #1a2744);
  flex-shrink: 0;
}

.compose-footer-right {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.compose-action-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--email-radius);
  transition: var(--email-transition);
  font-size: 0.875rem;
}

.compose-action-btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
  border-color: var(--color-border);
}

.btn-send {
  padding: 0.5rem 1.5rem;
  background: linear-gradient(135deg, var(--color-accent, #6366f1), #818cf8);
  color: #fff;
  border: none;
  border-radius: var(--email-radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--email-transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: inherit;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
  letter-spacing: 0.02em;
}

.btn-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.5);
  filter: brightness(1.08);
}

/* Back button â€” hidden on desktop, visible on mobile */
.back-btn {
  display: none !important;
}

.btn-send:active {
  transform: translateY(0);
}

/* ============================================================
   Dropdown Menu Component
   ============================================================ */
.dropdown-wrapper {
  position: relative;
  display: inline-flex;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 240px;
  background: var(--color-bg-card, #1e293b);
  border: 1px solid var(--color-border);
  border-radius: var(--email-radius-lg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
  padding: 0.375rem 0;
  z-index: 9999;
  backdrop-filter: blur(12px);
  animation: dropdownIn 0.15s ease;
}

.dropdown-menu.dropdown-right {
  left: auto;
  right: 0;
}

.dropdown-menu.open {
  display: block;
}

@keyframes dropdownIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dropdown-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  padding: 0.5rem 0.875rem 0.25rem;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.5rem 0.875rem;
  border: none;
  background: transparent;
  color: var(--color-text-primary);
  font-size: 0.8125rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease;
}

.dropdown-item:hover {
  background: var(--color-bg-hover);
}

.dropdown-item i {
  width: 16px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.dropdown-item.dropdown-danger {
  color: #ef4444;
}

.dropdown-item.dropdown-warning {
  color: #f59e0b;
}

.dropdown-item.dropdown-danger i {
  color: #f87171;
}

.dropdown-divider {
  height: 1px;
  background: var(--color-border);
  margin: 0.375rem 0.5rem;
}

/* Radio dots in dropdown */
.dropdown-radio {
  position: relative;
  padding-left: 2rem;
}

.radio-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--color-text-muted);
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  transition: all 0.15s ease;
}

.radio-dot.active {
  border-color: var(--color-accent);
  background: var(--color-accent);
  box-shadow: inset 0 0 0 3px var(--color-bg-card, #1e293b);
}

/* List options button */
.list-options-btn {
  width: 28px !important;
  height: 28px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ============================================================
   Bulk Action Bar
   ============================================================ */
.bulk-action-bar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  background: var(--color-accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 500;
  animation: slideDown 0.2s ease;
}

.bulk-action-bar.hidden {
  display: none !important;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-100%);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bulk-count {
  margin-right: 0.5rem;
  font-weight: 600;
}

.bulk-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: var(--email-radius);
  color: #fff;
  cursor: pointer;
  font-size: 0.8125rem;
  transition: background 0.12s;
}

.bulk-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.bulk-btn.bulk-danger:hover {
  background: rgba(248, 113, 113, 0.6);
}

/* Sidebar settings button */
.sidebar-settings-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--email-radius);
  transition: all 0.2s ease;
  font-size: 0.875rem;
  margin-left: auto;
  flex-shrink: 0;
}

.sidebar-settings-btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-accent);
  transform: rotate(30deg);
}

/* Email item checkbox */
.email-item-checkbox {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 2px solid var(--color-text-muted);
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  appearance: none;
  -webkit-appearance: none;
  transition: all 0.15s ease;
  margin-right: 0.375rem;
}

.email-item-checkbox:checked {
  background: var(--color-accent);
  border-color: var(--color-accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23fff' d='M13.5 4.5l-7 7L3 8'/%3E%3C/svg%3E");
  background-size: 12px;
  background-position: center;
  background-repeat: no-repeat;
}

.email-item-checkbox:hover {
  border-color: var(--color-accent);
}

/* ============================================================
   Settings Panel
   ============================================================ */
.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.settings-overlay.open {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.settings-panel {
  width: 560px;
  max-width: 95vw;
  max-height: 85vh;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--email-radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  animation: settingsIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes settingsIn {
  from {
    transform: translateY(16px) scale(0.97);
    opacity: 0;
  }

  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.settings-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.settings-header h2 i {
  color: var(--color-accent);
}

.settings-tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  padding: 0 1rem;
  flex-shrink: 0;
  overflow-x: auto;
}

.settings-tab {
  padding: 0.75rem 0.875rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.settings-tab:hover {
  color: var(--color-text-primary);
}

.settings-tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}

.settings-content {
  display: none;
}

.settings-content.active {
  display: block;
}

.settings-section {
  margin-bottom: 1.5rem;
}

.settings-section h3 {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 0.75rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.settings-account-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--color-bg-secondary, rgba(255, 255, 255, 0.03));
  border-radius: var(--email-radius);
  border: 1px solid var(--color-border);
}

.settings-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 600;
  flex-shrink: 0;
}

.settings-field-label {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.settings-field-value {
  font-size: 0.875rem;
  color: var(--color-text-primary);
  font-weight: 500;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.settings-label {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.settings-value {
  font-size: 0.8125rem;
  color: var(--color-text-primary);
  font-family: 'JetBrains Mono', monospace;
}

/* Toggle switch */
.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.8125rem;
  color: var(--color-text-primary);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--color-border);
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.toggle-switch input:checked+.toggle-slider {
  background: var(--color-accent);
}

.toggle-switch input:checked+.toggle-slider::before {
  transform: translateX(18px);
}

/* Radio group */
.settings-radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.settings-radio {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.5rem;
  border-radius: var(--email-radius);
  font-size: 0.8125rem;
  color: var(--color-text-primary);
  cursor: pointer;
  transition: background 0.12s ease;
}

.settings-radio:hover {
  background: var(--color-bg-hover);
}

.settings-radio input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-accent);
}

/* Signature editor */
.settings-sig-editor {
  min-height: 100px;
  padding: 0.875rem;
  background: var(--color-bg-input, rgba(255, 255, 255, 0.06));
  border: 1px solid var(--color-border);
  border-radius: var(--email-radius);
  color: var(--color-text-primary);
  font-size: 0.8125rem;
  line-height: 1.6;
  outline: none;
  margin-top: 0.5rem;
  transition: border-color 0.2s ease;
}

.settings-sig-editor:focus {
  border-color: var(--color-accent);
}

.settings-footer {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

/* Settings form inputs */
.settings-form-group {
  margin-bottom: 0.875rem;
}

.settings-form-row {
  display: flex;
  gap: 0.75rem;
}

.settings-input-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 0.375rem;
}

.settings-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--color-bg-input, rgba(255, 255, 255, 0.06));
  border: 1px solid var(--color-border);
  border-radius: var(--email-radius);
  color: var(--color-text-primary);
  font-size: 0.8125rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.settings-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.settings-input::placeholder {
  color: var(--color-text-muted);
  opacity: 0.5;
}

/* Password wrapper */
.settings-password-wrap {
  position: relative;
}

.settings-password-wrap .settings-input {
  padding-right: 2.5rem;
}

.settings-eye-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 0.8125rem;
  transition: color 0.15s ease;
}

.settings-eye-btn:hover {
  color: var(--color-accent);
}

/* Test connection button */
.settings-test-btn {
  padding: 0.625rem 1.25rem;
  background: linear-gradient(135deg, var(--color-accent), #4f46e5);
  color: #fff;
  border: none;
  border-radius: var(--email-radius);
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.settings-test-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* ─── Signature HTML Editor ─── */
.sig-editor-wrapper {
  border: 1px solid var(--color-border);
  border-radius: var(--email-radius-lg);
  overflow: hidden;
  margin-top: 0.75rem;
}

.sig-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  padding: 0.375rem 0.5rem;
  background: var(--color-bg-hover);
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.sig-editor-toolbar button {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0.3rem 0.4rem;
  border-radius: var(--email-radius-sm);
  font-size: 0.75rem;
  font-family: inherit;
  transition: all 0.15s ease;
  line-height: 1;
}

.sig-editor-toolbar button:hover {
  background: rgba(99, 102, 241, 0.12);
  color: var(--color-accent);
}

.sig-toolbar-divider {
  width: 1px;
  height: 16px;
  background: var(--color-border);
  margin: 0 0.25rem;
}

.sig-editor-body {
  min-height: 250px;
  max-height: 400px;
  overflow-y: auto;
  padding: 1rem;
  background: #ffffff;
  color: #1e293b;
  font-size: 0.875rem;
  line-height: 1.6;
  outline: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.sig-editor-body:focus {
  box-shadow: inset 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.sig-editor-body p {
  margin: 0.25rem 0;
}

.sig-editor-body a {
  color: #6366f1;
  text-decoration: underline;
}

.sig-hint {
  margin-top: 0.5rem;
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  opacity: 0.7;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

/* Toolbar warning button (spam) */
.toolbar-btn.warning {
  color: #f59e0b;
}

.toolbar-btn.warning:hover {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
}

/* Custom input field for showInputDialog */
.cp-input-field {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 0.875rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  color: #111;
  background: #fafafa;
  outline: none;
  margin-bottom: 1.25rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cp-input-field:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  background: #fff;
}

/* ============================================================
   Folder Management
   ============================================================ */

/* Add folder button in section header */
.folder-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.folder-add-btn {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0.125rem 0.375rem;
  border-radius: var(--email-radius-sm);
  font-size: 0.625rem;
  opacity: 0;
  transition: all 0.2s ease;
}

.folder-section-label:hover .folder-add-btn {
  opacity: 1;
}

.folder-add-btn:hover {
  color: var(--color-accent);
  background: rgba(99, 102, 241, 0.12);
}

/* Drag-over highlight on folder */
.folder-item.drag-over {
  background: rgba(99, 102, 241, 0.15) !important;
  border: 1px dashed var(--color-accent);
  border-radius: var(--email-radius);
}

/* Folder tree chevron */
.folder-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 0.5rem;
  flex-shrink: 0;
  margin-right: 0.125rem;
  transition: transform 0.2s ease, color 0.15s ease;
  transform: rotate(0deg);
}

.folder-chevron.expanded {
  transform: rotate(90deg);
}

.folder-chevron:hover {
  color: var(--color-accent);
}

.folder-chevron-space {
  display: inline-block;
  width: 16px;
  flex-shrink: 0;
  margin-right: 0.125rem;
}

/* Folder items as drag sources */
.folder-item[draggable="true"] {
  cursor: pointer;
}

.folder-item[draggable="true"]:active {
  opacity: 0.7;
}

/* Draggable email cursor */
.email-item[draggable="true"] {
  cursor: grab;
}

.email-item[draggable="true"]:active {
  cursor: grabbing;
  opacity: 0.7;
}

/* Folder context menu */
.folder-context-menu {
  position: fixed;
  min-width: 180px;
  background: var(--color-bg-card, #1e293b);
  border: 1px solid var(--color-border);
  border-radius: var(--email-radius-lg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
  padding: 0.375rem 0;
  z-index: 99999;
  backdrop-filter: blur(12px);
  animation: dropdownIn 0.15s ease;
}

/* Folder picker dialog items */
.folder-picker-list {
  max-height: 280px;
  overflow-y: auto;
  margin: 0 -0.5rem;
}

.folder-picker-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  color: #333;
  font-size: 0.8125rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  border-radius: 8px;
}

.folder-picker-item:hover {
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
}

.folder-picker-item i {
  width: 20px;
  text-align: center;
  font-size: 0.8125rem;
}

/* ============================================================
   Scrollbar Styling
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
  .email-sidebar {
    width: 56px;
    min-width: 56px;
  }

  .email-sidebar-brand h1,
  .email-sidebar-brand span,
  .folder-name,
  .folder-badge,
  .folder-section-label,
  .sidebar-account-info,
  .btn-compose span {
    display: none;
  }

  .btn-compose {
    padding: 0.625rem;
    justify-content: center;
  }

  .folder-item {
    justify-content: center;
    padding: 0.625rem 0;
    border-left: none;
  }

  .folder-item.active {
    border-left: none;
    border-bottom: 2px solid var(--color-accent);
  }

  .sidebar-account {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .email-list-panel {
    width: 100%;
    max-width: none;
    resize: none;
  }

  .email-detail-panel {
    position: fixed;
    inset: 0;
    z-index: 50;
    transform: translateX(100%);
    transition: transform 0.3s ease;
  }

  .email-detail-panel.show {
    transform: translateX(0);
  }

  .back-btn {
    display: flex !important;
  }

  /* Hide toolbar text labels — icon-only mode */
  .toolbar-label {
    display: none !important;
  }

  .email-detail-toolbar {
    gap: 0.125rem;
    padding: 0.375rem 0.5rem;
  }

  .email-detail-toolbar .toolbar-btn {
    padding: 0.375rem 0.5rem;
    font-size: 0.8125rem;
    min-width: 32px;
    justify-content: center;
  }

  .toolbar-separator {
    margin: 0 0.125rem;
  }

  .toolbar-spacer {
    flex: 0 0 auto;
    min-width: 0.25rem;
  }
}

/* ─── Attachment icon in email list ─── */
.email-item-attachment {
  color: var(--color-text-muted);
  font-size: 0.6875rem;
  margin-left: auto;
  margin-right: 0.375rem;
  opacity: 0.7;
}

/* ─── Empty folder bar (trash/spam) ─── */
.empty-folder-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: rgba(245, 158, 11, 0.08);
  border-bottom: 1px solid rgba(245, 158, 11, 0.2);
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

.empty-folder-btn-inline {
  background: transparent;
  border: 1px solid var(--color-danger);
  color: var(--color-danger);
  padding: 0.25rem 0.625rem;
  border-radius: var(--email-radius);
  font-size: 0.6875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  transition: all 0.15s ease;
}

.empty-folder-btn-inline:hover {
  background: var(--color-danger);
  color: #fff;
}

.empty-folder-btn {
  margin-top: 1rem;
  background: transparent;
  border: 1px solid var(--color-danger);
  color: var(--color-danger);
  padding: 0.5rem 1.25rem;
  border-radius: var(--email-radius);
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.empty-folder-btn:hover {
  background: var(--color-danger);
  color: #fff;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* ============================================================
   Utility Classes
   ============================================================ */
.hidden {
  display: none !important;
}

.fade-in {
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Tag colors */
.tag-work {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

.tag-personal {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.tag-finance {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.tag-urgent {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.tag-promo {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
}

.tag-social {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
}

/* ─── Attachment Strip ─────────────────────────────────────── */
.email-attachments {
  background: var(--email-surface-attachment, #1a2744);
  padding: 0.75rem 1.25rem;
  margin: 1rem 1.5rem 0;
}

.email-attachments-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 0.625rem;
}

.email-attachments-title i {
  color: var(--color-text-accent);
}

.att-download-all {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-accent);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.25rem 0.625rem;
  border-radius: 0.375rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  transition: var(--email-transition);
}

.att-download-all:hover {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent);
}

.email-attachments-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-bg-input);
  border: 1px solid var(--color-border);
  border-radius: var(--email-radius);
  padding: 0.5rem 0.625rem;
  min-width: 180px;
  max-width: 260px;
  transition: var(--email-transition);
  cursor: default;
}

.attachment-chip:hover {
  border-color: var(--color-accent);
  background: rgba(99, 102, 241, 0.08);
}

.att-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 0.375rem;
  background: var(--color-accent-subtle);
  color: var(--color-text-accent);
  font-size: 0.9rem;
  flex-shrink: 0;
}

.att-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.att-name {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.att-size {
  font-size: 0.68rem;
  color: var(--color-text-muted);
}

.att-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.attachment-chip:hover .att-actions {
  opacity: 1;
}

.att-btn {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.25rem;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--email-transition);
}

.att-btn:hover {
  color: var(--color-text-accent);
  background: var(--color-accent-subtle);
}

/* ─── Paginator ─────────────────────────────────────────── */
.email-paginator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.5rem 1rem;
  background: var(--color-bg-sidebar);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.pag-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 0.375rem;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.15s;
}

.pag-btn:hover:not(:disabled) {
  background: var(--color-accent-subtle);
  color: var(--color-text-accent);
  border-color: var(--color-text-accent);
}

.pag-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pag-btn.active {
  background: var(--color-text-accent);
  color: #fff;
  border-color: var(--color-text-accent);
  font-weight: 600;
}

/* ─── Compose Chips + Contact Autocomplete ────────────── */
.compose-chips-wrap {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  flex: 1;
  gap: 4px;
  min-height: 32px;
}

.compose-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.compose-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(99, 102, 241, 0.2);
  color: var(--color-text-primary, #e2e8f0);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 100px;
  padding: 2px 8px 2px 10px;
  font-size: 0.6875rem;
  line-height: 1.4;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: chipIn 0.15s ease-out;
}

@keyframes chipIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.compose-chip-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compose-chip-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 9px;
  flex-shrink: 0;
  transition: background 0.15s;
}

.compose-chip-remove:hover {
  background: rgba(239, 68, 68, 0.5);
}

.compose-chips-wrap input {
  flex: 1;
  min-width: 120px;
}

.contact-suggest {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--color-bg-secondary, #1e293b);
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  max-height: 240px;
  overflow-y: auto;
  margin-top: 4px;
}

.contact-suggest.open {
  display: block;
}

.suggest-group {
  padding: 6px 10px 2px;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted, #64748b);
}

.suggest-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  transition: background 0.12s;
  border-radius: 4px;
  margin: 0 4px;
}

.suggest-item:hover {
  background: rgba(99, 102, 241, 0.12);
}

.suggest-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.suggest-info {
  overflow: hidden;
  flex: 1;
}

.suggest-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-primary, #e2e8f0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggest-email {
  font-size: 0.6875rem;
  color: var(--color-text-muted, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggest-empty {
  text-align: center;
  padding: 12px;
  font-size: 0.6875rem;
  color: var(--color-text-muted, #64748b);
}