:root {
  --emails-page-bg: var(--wh-page-canvas, #f1f5f9);
  --emails-card-bg: #ffffff;
  --emails-border: #e2e8f0;
  --emails-text: #111827;
  --emails-muted: #4b5563;
  --emails-accent: #225aea;
}

html[data-theme="dark"] {
  --emails-page-bg: #0f172a;
  --emails-card-bg: #111827;
  --emails-border: #334155;
  --emails-text: #f8fafc;
  --emails-muted: #94a3b8;
}

.emails-page-shell {
  background: var(--emails-page-bg);
  min-height: calc(100vh - 64px);
  margin-top: 64px;
}

.emails-page-header {
  margin-bottom: 20px;
}

.emails-page-title {
  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--emails-text);
  margin: 0 0 8px;
}

.emails-page-subtitle {
  margin: 0;
  color: var(--emails-muted);
  font-size: 14px;
}

/* ── Filters bar — matches Ads Library (dashboard-meta-filters-panel) ── */
.emails-filters-explore {
  --es-space-1: 8px;
  --es-space-2: 12px;
  --es-space-3: 16px;
  --es-radius-control: 8px;
  --es-border: rgba(34, 90, 234, 0.34);
  --es-border-hover: rgba(34, 90, 234, 0.52);
  --es-border-focus: #225aea;
  --es-control-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 1px rgba(15, 23, 42, 0.04);
  --es-control-shadow-hover: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --es-control-focus-ring: 0 0 0 3px rgba(34, 90, 234, 0.12), 0 1px 2px rgba(15, 23, 42, 0.06);
  --es-filter-text: #111827;
  --es-filter-font-weight: 500;
  --es-filter-surface: var(--wh-filter-surface, #f8fafc);
  --es-filter-surface-hover: var(--wh-filter-surface-hover, #f1f5f9);
  --es-filter-surface-focus: var(--wh-filter-surface-focus, #eff6ff);
  --es-filter-padding-left: 26px;
  --es-filter-chevron-inset: 28px;
  --es-filter-capsule-nudge: 1px;
  --es-filter-col-min: 190px;

  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--es-filter-col-min), 1fr));
  align-items: start;
  gap: var(--es-space-1);
  padding: var(--es-space-2) 14px;
  margin-bottom: var(--es-space-3);
  background: var(--wh-filter-bar-bg, #f8fafc);
  border: 1px solid var(--wh-filter-bar-border, #e5e7eb);
  border-radius: 12px;
  position: relative;
  isolation: isolate;
  font-weight: var(--es-filter-font-weight);
}

.emails-filter-field {
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.emails-filter-field--search {
  grid-column: 1 / -1;
}

@media (min-width: 768px) {
  .emails-filter-field--search {
    grid-column: span 2;
  }
}

.emails-filter-label-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.emails-filter-control {
  position: relative;
  width: 100%;
  min-width: 0;
}

.emails-filter-control::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 50%;
  width: 13px;
  height: 13px;
  transform: translateY(-50%);
  pointer-events: none;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 13px 13px;
  opacity: 1;
  filter: brightness(0);
  z-index: 2;
}

.emails-filter-field:has(#emailsBrandFilter) .emails-filter-control::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 3.5h9v9H3.5z' stroke='%2394a3b8' stroke-width='1.25' stroke-linejoin='round'/%3E%3Cpath d='M6.2 3.5V2.8c0-.55.45-1 1-1h1.6c.55 0 1 .45 1 1v.7M8 6.8l1.35 1.35L6.2 11.3' stroke='%2394a3b8' stroke-width='1.25' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.emails-filter-field:has(#emailsFormatFilter) .emails-filter-control::before,
.emails-filter-field:has(#emailsCampaignFilter) .emails-filter-control::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M2.5 4.5H13.5M4 8H12M6 11.5H10' stroke='%2394a3b8' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
}

.emails-filter-field:has(#emailsLeadFilter) .emails-filter-control::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 16 16' fill='none'%3E%3Ccircle cx='5.75' cy='5.25' r='1.65' stroke='%2394a3b8' stroke-width='1.25'/%3E%3Cpath d='M2.5 12.75v-.4c0-1.55 1.46-2.85 3.25-2.85s3.25 1.3 3.25 2.85' stroke='%2394a3b8' stroke-width='1.25' stroke-linecap='round'/%3E%3Ccircle cx='10.75' cy='5.75' r='1.35' stroke='%2394a3b8' stroke-width='1.2'/%3E%3Cpath d='M8.75 12.75v-.25c0-1.2 1-2.15 2.25-2.4' stroke='%2394a3b8' stroke-width='1.2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.emails-filter-field:has(#emailsDateFrom) .emails-filter-control::before,
.emails-filter-field:has(#emailsDateTo) .emails-filter-control::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E");
}

.emails-filter-field:has(#emailsSortFilter) .emails-filter-control::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 5.5h8M4 8h5.5M4 10.5h3' stroke='%2394a3b8' stroke-width='1.6' stroke-linecap='round'/%3E%3Cpath d='M11.5 4.5v7M9.5 6.5l2-2 2 2' stroke='%2394a3b8' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.emails-filter-control--search::before {
  display: none;
}

.emails-filter-control--search .emails-filter-search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: #5b6b82;
  pointer-events: none;
  z-index: 2;
}

.emails-filter-control:has(.emails-filter-select)::after {
  content: "";
  position: absolute;
  right: 11px;
  top: 50%;
  margin-top: -5px;
  width: 6px;
  height: 6px;
  border: solid #94a3b8;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  pointer-events: none;
  z-index: 2;
}

.emails-filter-input {
  width: 100%;
  min-height: 34px;
  box-sizing: border-box;
  border: 1px solid var(--es-border);
  border-radius: var(--es-radius-control);
  background: var(--es-filter-surface);
  color: var(--es-filter-text);
  font-size: 12px;
  font-weight: var(--es-filter-font-weight);
  padding: calc(3px + var(--es-filter-capsule-nudge)) var(--es-filter-chevron-inset)
    calc(3px - var(--es-filter-capsule-nudge)) var(--es-filter-padding-left);
  outline: none;
  box-shadow: var(--es-control-shadow);
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
}

.emails-filter-control--search .emails-filter-input {
  padding-left: var(--es-filter-padding-left);
}

.emails-filter-input:hover {
  border-color: var(--es-border-hover);
  background: var(--es-filter-surface-hover);
  box-shadow: var(--es-control-shadow-hover);
}

.emails-filter-input:focus {
  border-color: var(--es-border-focus);
  background: var(--es-filter-surface-focus);
  box-shadow: var(--es-control-focus-ring);
}

.emails-filter-select {
  cursor: pointer;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.emails-filter-date {
  cursor: pointer;
}

.emails-filter-date::-webkit-calendar-picker-indicator {
  opacity: 0.55;
  cursor: pointer;
}

html[data-theme="dark"] .emails-filters-explore {
  --es-filter-text: #f8fafc;
  --es-filter-surface: #0f172a;
  --es-filter-surface-hover: #1e293b;
  --es-filter-surface-focus: rgba(34, 90, 234, 0.12);
}

html[data-theme="dark"] .emails-filter-input {
  color-scheme: dark;
}

.emails-filters-meta {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--wh-filter-bar-border, #e5e7eb);
  color: var(--emails-muted);
  font-size: 12px;
  font-weight: 500;
}

.emails-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.email-card {
  background: var(--emails-card-bg);
  border: 1px solid var(--emails-border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 3px 1px 16px 0 rgba(0, 0, 0, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.email-card:hover {
  transform: translateY(-3px);
  border-color: rgba(34, 90, 234, 0.22);
  box-shadow: 3px 6px 24px 0 rgba(34, 90, 234, 0.1), 0 2px 8px rgba(15, 23, 42, 0.06);
}

.email-card-button {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0;
  cursor: pointer;
  color: inherit;
}

.email-card-preview {
  position: relative;
  height: 300px;
  background: #f1f5f9;
  border-bottom: 1px solid var(--emails-border);
  overflow: hidden;
}

html[data-theme="dark"] .email-card-preview {
  background: #0b1220;
}

.email-card-preview-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: top center;
  background: #fff;
}

.email-card-preview-image[hidden] {
  display: none !important;
}

.email-card-preview-frame {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: #fff;
  pointer-events: none;
}

.email-card-preview-frame[hidden] {
  display: none !important;
}

html[data-theme="dark"] .email-card-preview-frame {
  background: #0b1220;
}

.email-card-preview-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--emails-muted);
  font-size: 13px;
  text-align: center;
  padding: 12px;
}

.email-card-preview-fallback[hidden] {
  display: none !important;
}

.email-card-body {
  padding: 14px 16px 16px;
}

.email-card-subject {
  font-size: 14px;
  font-weight: 600;
  color: var(--emails-text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px;
  letter-spacing: -0.01em;
}

.email-card-snippet {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--emails-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.email-card-snippet mark {
  background: #fef08a;
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

.emails-search-engine-label {
  margin-left: 12px;
  font-size: 12px;
  color: var(--emails-muted);
}

.email-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--emails-muted);
}

.email-card-brand {
  font-weight: 600;
  color: var(--emails-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-card-date {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.email-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.email-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid rgba(34, 90, 234, 0.22);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
}

html[data-theme="dark"] .email-tag {
  background: rgba(34, 90, 234, 0.14);
  color: #93c5fd;
  border-color: rgba(34, 90, 234, 0.28);
}

.emails-empty-state,
.emails-loading-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--emails-muted);
}

.emails-pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}

.emails-pagination button {
  border: 1px solid var(--emails-border);
  background: var(--emails-card-bg);
  color: var(--emails-text);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

.emails-pagination button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Drawer */
.email-drawer {
  --drawer-bg: #ffffff;
  --drawer-muted: #64748b;
  --drawer-text: #0f172a;
  --drawer-border: #e8edf3;
  --drawer-preview-bg: #f3f4f6;
  --drawer-section-gap: 22px;
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html[data-theme="dark"] .email-drawer {
  --drawer-bg: var(--dk-surface, #15181e);
  --drawer-muted: var(--dk-text-3, #a0aabd);
  --drawer-text: var(--dk-text, #eef1f6);
  --drawer-border: var(--dk-border, #2c323d);
  --drawer-preview-bg: var(--dk-surface-deep, #0b0d11);
}

html[data-theme="dark"] .email-drawer-backdrop {
  background: rgba(0, 0, 0, 0.52);
}

html[data-theme="dark"] .email-drawer-panel {
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.42);
}

.email-drawer.is-open {
  pointer-events: auto;
}

.email-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.email-drawer.is-open .email-drawer-backdrop {
  opacity: 1;
}

.email-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(1280px, 94vw);
  height: 100%;
  background: var(--drawer-bg);
  transform: translate3d(100%, 0, 0);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -16px 0 48px rgba(15, 23, 42, 0.1);
  color: var(--drawer-text);
}

.email-drawer.is-open .email-drawer-panel {
  transform: translate3d(0, 0, 0);
}

.email-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--drawer-border);
  background: var(--drawer-bg);
}

.email-drawer-header-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.email-drawer-header-actions {
  flex-shrink: 0;
}

.email-drawer-close {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--drawer-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.email-drawer-close:hover {
  background: rgba(148, 163, 184, 0.12);
  color: var(--drawer-text);
}

.email-drawer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.email-drawer-brand-copy {
  min-width: 0;
}

.email-drawer-brand-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #f1f5f9;
  color: var(--emails-accent);
  border: 1px solid var(--drawer-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

.email-drawer-brand-avatar.has-image {
  padding: 0;
  background: #fff;
  border-color: var(--drawer-border);
}

.email-drawer-brand-avatar.has-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

html[data-theme="dark"] .email-drawer-brand-avatar {
  background: var(--dk-surface-2, #1b1f27);
  border-color: var(--dk-border, #2c323d);
}

html[data-theme="dark"] .email-drawer-brand-avatar.has-image {
  background: var(--dk-surface-2, #1b1f27);
}

html[data-theme="dark"] .email-drawer-close:hover {
  background: var(--dk-surface-2, #1b1f27);
}

.email-drawer-brand-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.3;
  color: var(--drawer-text);
  overflow-wrap: anywhere;
}

.email-drawer-brand-domain {
  margin-top: 1px;
  font-size: 11px;
  font-weight: 400;
  color: var(--drawer-muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.email-drawer-content {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
}

.email-drawer-preview-section {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--drawer-preview-bg);
}

.email-drawer-preview-shell {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.45) transparent;
}

.email-drawer-preview-shell::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.email-drawer-preview-shell::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.45);
}

.email-drawer-preview-shell.is-scrollable {
  cursor: grab;
}

.email-drawer-preview-shell.is-scrollable.is-dragging {
  cursor: grabbing;
  user-select: none;
}

.email-drawer-preview-shell.is-auto-scrolling {
  scroll-behavior: auto;
}

.email-drawer-preview-shell.is-auto-scrolling.is-scrollable {
  cursor: default;
}

.email-drawer-preview-shell.is-auto-scrolling.is-scrollable:hover {
  cursor: grab;
}

.email-drawer-preview-shell.is-scrollable.is-dragging * {
  pointer-events: none;
}

.email-drawer-zoom-float {
  position: absolute;
  top: 12px;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  padding: 0 16px;
  pointer-events: none;
}

.email-drawer-zoom-float-inner {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 2px 4px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.07);
}

html[data-theme="dark"] .email-drawer-zoom-float-inner {
  background: var(--dk-surface, #15181e);
  border-color: var(--dk-border-strong, #3a4252);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.32);
}

html[data-theme="dark"] .email-drawer-zoom-btn {
  color: var(--dk-text-3, #a0aabd);
}

html[data-theme="dark"] .email-drawer-zoom-btn:hover {
  background: var(--dk-surface-2, #1b1f27);
  color: var(--dk-text, #eef1f6);
}

.email-drawer-zoom-btn {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  color: #64748b;
  font-size: 17px;
  font-weight: 400;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.email-drawer-zoom-btn:hover {
  background: #f1f5f9;
  color: var(--drawer-text);
}

.email-drawer-zoom-label {
  min-width: 48px;
  padding: 0 4px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: #64748b;
  user-select: none;
}

.email-drawer-preview-stage {
  position: relative;
  display: block;
  width: max-content;
  min-width: 100%;
  margin: 0 auto;
  padding: 52px 24px 28px;
  box-sizing: border-box;
  text-align: center;
}

.email-drawer-preview-skeleton {
  position: absolute;
  inset: 0 0 28px;
  z-index: 1;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.email-drawer-preview-skeleton[hidden] {
  display: none !important;
}

.email-drawer-skel-block,
.email-drawer-skel-line {
  border-radius: 8px;
  background: linear-gradient(90deg, #eceff3 0%, #e2e8f0 45%, #f1f5f9 55%, #eceff3 100%);
  background-size: 200% 100%;
  animation: email-drawer-skel-shimmer 1.35s ease-in-out infinite;
}

html[data-theme="dark"] .email-drawer-skel-block,
html[data-theme="dark"] .email-drawer-skel-line {
  background: linear-gradient(90deg, #1b1f27 0%, #232936 45%, #1b1f27 55%, #1b1f27 100%);
  background-size: 200% 100%;
}

@keyframes email-drawer-skel-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.email-drawer-skel-block--preview {
  width: min(100%, 560px);
  min-height: 680px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.email-drawer-preview-zoom-host {
  display: inline-block;
  vertical-align: top;
  text-align: left;
  margin: 0 auto;
}

.email-drawer-preview-canvas {
  width: min(560px, calc(100vw - 460px));
  transform-origin: top center;
  transition: opacity 0.18s ease;
}

.email-drawer-preview-canvas.is-preview-hidden {
  opacity: 0;
}

.email-drawer-preview-image {
  display: block;
  width: 100%;
  height: auto;
  border: 0;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
}

.email-drawer-preview-image[hidden] {
  display: none !important;
}

.email-drawer-preview-frame {
  display: block;
  width: 100%;
  min-height: 720px;
  border: 0;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
}

.email-drawer-preview-frame[hidden] {
  display: none !important;
}

html[data-theme="dark"] .email-drawer-preview-image,
html[data-theme="dark"] .email-drawer-preview-frame {
  background: #1a1e26;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.32);
}

.email-drawer-sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border-left: 1px solid var(--drawer-border);
  background: var(--drawer-bg);
}

.email-drawer-sidebar-head {
  flex-shrink: 0;
  padding: 16px 20px 0;
  border-bottom: 1px solid var(--drawer-border);
}

.email-drawer-sidebar-title {
  margin: 0;
  padding: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--drawer-text);
  line-height: 1.3;
}

.email-drawer-sidebar-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 20px 28px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.45) transparent;
}

.email-drawer-sidebar-body::-webkit-scrollbar {
  width: 6px;
}

.email-drawer-sidebar-body::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.45);
}

.email-drawer-tab-panel[hidden] {
  display: none !important;
}

.email-drawer-sent-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding-bottom: 18px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--drawer-border);
}

.email-drawer-sent-item {
  min-width: 0;
}

.email-drawer-sent-label {
  display: block;
  margin-bottom: 4px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--drawer-muted);
}

.email-drawer-sent-value {
  display: block;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: -0.008em;
  color: var(--drawer-text);
  word-break: break-word;
}

.email-drawer-sent-value.is-empty {
  color: var(--drawer-muted);
  font-weight: 400;
}

.email-drawer-sidebar-skeleton {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 0 14px;
}

.email-drawer-sidebar-skeleton[hidden] {
  display: none !important;
}

.email-drawer:not(.is-loading) .email-drawer-sidebar-skeleton {
  display: none !important;
}

.email-drawer-skel-line {
  height: 11px;
  width: 100%;
}

.email-drawer-skel-line--md { width: 72%; }
.email-drawer-skel-line--sm { width: 48%; }

.email-drawer-mail-groups {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.email-drawer-mail-groups[hidden] {
  display: none !important;
}

.email-drawer-section {
  border: 1px solid var(--drawer-border);
  background: var(--drawer-bg);
  border-radius: 8px;
  padding: 12px 14px 6px;
}

html[data-theme="dark"] .email-drawer-section {
  background: var(--dk-surface-2, #1b1f27);
  border-color: var(--dk-border, #2c323d);
}

.email-drawer-section-head {
  margin-bottom: 6px;
  padding-bottom: 0;
  border-bottom: 0;
}

.email-drawer-section-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--drawer-text);
}

.email-drawer-section-body {
  display: flex;
  flex-direction: column;
}

.email-drawer-detail-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 8px 10px;
  align-items: center;
  padding: 6px 0;
}

.email-drawer-detail-row + .email-drawer-detail-row {
  border-top: 0;
}

.email-drawer-detail-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 11px;
  font-weight: 400;
  color: var(--drawer-muted);
  line-height: 1.45;
}

.email-drawer-detail-label-text {
  min-width: 0;
}

.email-drawer-detail-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: #5b6b82;
  opacity: 1;
}

.email-drawer-detail-icon svg {
  display: block;
  width: 14px;
  height: 14px;
}

.email-drawer-detail-value-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  min-width: 0;
  min-height: 26px;
  margin: -2px -2px -2px 0;
  padding: 2px 4px 2px 8px;
  border-radius: 6px;
  transition: background-color 0.12s ease;
}

.email-drawer-detail-value-cell:not(.is-static):hover,
.email-drawer-detail-value-cell:not(.is-static):focus-within {
  background: rgba(148, 163, 184, 0.12);
}

html[data-theme="dark"] .email-drawer-detail-value-cell:not(.is-static):hover,
html[data-theme="dark"] .email-drawer-detail-value-cell:not(.is-static):focus-within {
  background: var(--dk-surface-3, #232936);
}

html[data-theme="dark"] .email-drawer-detail-icon {
  color: var(--dk-text-3, #a0aabd);
}

html[data-theme="dark"] .email-drawer-tz-chip {
  background: var(--dk-surface-2, #1b1f27);
  border-color: var(--dk-border, #2c323d);
  color: var(--dk-text-3, #a0aabd);
}

.email-drawer-detail-value-cell.is-copy-dismissed:hover,
.email-drawer-detail-value-cell.is-copy-dismissed:focus-within {
  background: transparent;
}

.email-drawer-detail-value-cell.is-copy-dismissed:hover .email-drawer-detail-copy,
.email-drawer-detail-value-cell.is-copy-dismissed:focus-within .email-drawer-detail-copy {
  width: 0;
  opacity: 0;
  pointer-events: none;
}

.email-drawer-detail-value {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  color: var(--drawer-text);
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: -0.006em;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-drawer-detail-value.is-empty {
  color: var(--drawer-muted);
  font-weight: 400;
}

.email-drawer-detail-copy {
  flex: 0 0 auto;
  width: 0;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #64748b;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  cursor: pointer;
  padding: 0;
  transition:
    width 0.12s ease,
    opacity 0.12s ease,
    background-color 0.12s ease,
    color 0.12s ease;
}

.email-drawer-detail-copy svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.email-drawer-detail-value-cell:hover .email-drawer-detail-copy,
.email-drawer-detail-value-cell:focus-within .email-drawer-detail-copy {
  width: 22px;
  opacity: 1;
  pointer-events: auto;
}

.email-drawer-detail-copy:hover {
  background: rgba(148, 163, 184, 0.18);
  color: var(--drawer-text);
}

html[data-theme="dark"] .email-drawer-detail-copy:hover {
  background: var(--dk-surface-3, #232936);
  color: var(--dk-text, #eef1f6);
}

.email-drawer-origin-value {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
}

.email-drawer-flag-row {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.email-drawer-detail-value > .email-drawer-origin-value,
.email-drawer-detail-value > .email-drawer-flag-row {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-drawer-country-flag {
  width: 14px;
  height: 10px;
  object-fit: contain;
  object-position: center;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
  background: #fff;
  flex-shrink: 0;
}

.email-drawer-sent-date-line {
  display: block;
  margin-bottom: 3px;
  font-weight: 500;
}

.email-drawer-sent-time-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.email-drawer-sent-time-line time {
  font-weight: 500;
}

.email-drawer-tz-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--drawer-border);
  background: var(--drawer-bg);
  color: var(--drawer-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  cursor: default;
}

.email-drawer-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.email-drawer-action-menu {
  position: relative;
}

.email-drawer-action-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--drawer-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.email-drawer-action-btn:hover,
.email-drawer-action-btn.is-active {
  background: rgba(148, 163, 184, 0.12);
  color: var(--drawer-text);
}

.email-drawer-action-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.email-drawer-action-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 196px;
  max-width: 240px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.11), 0 2px 8px rgba(0, 0, 0, 0.06);
  font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
  font-size: 12px;
  z-index: 30;
  transform-origin: top right;
  animation: email-drawer-dropdown-in 0.14s cubic-bezier(0.16, 1, 0.3, 1);
}

.email-drawer-action-dropdown .explore-landers-sort-dropdown__list {
  padding: 4px 0;
}

.email-drawer-action-dropdown-item.explore-landers-sort-option {
  justify-content: flex-start;
  gap: 9px;
  padding: 7px 14px;
  border-radius: 0;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  color: #71717b;
}

.email-drawer-action-dropdown-item.explore-landers-sort-option svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  color: #5b6b82;
  transition: color 0.1s ease;
}

.email-drawer-action-dropdown-item.explore-landers-sort-option .explore-landers-sort-option__label {
  flex: 1;
  min-width: 0;
}

.email-drawer-action-dropdown-item.explore-landers-sort-option:hover {
  background: #f9fafb;
  color: #374151;
}

.email-drawer-action-dropdown-item.explore-landers-sort-option:hover svg {
  color: #64748b;
}

.email-drawer-action-dropdown-item.explore-landers-sort-option:focus-visible {
  outline: 2px solid rgba(34, 90, 234, 0.3);
  outline-offset: -2px;
}

@keyframes email-drawer-dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

html[data-theme="dark"] .email-drawer-action-dropdown {
  border-color: var(--dk-border, #2c323d);
  background: var(--dk-surface, #15181e);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .email-drawer-action-dropdown-item.explore-landers-sort-option {
  color: var(--dk-text-2, #cbd5e1);
}

html[data-theme="dark"] .email-drawer-action-dropdown-item.explore-landers-sort-option:hover {
  background: var(--dk-surface-2, #1b1f27);
  color: var(--dk-text, #eef1f6);
}

html[data-theme="dark"] .email-drawer-action-dropdown-item.explore-landers-sort-option:hover svg {
  color: #94a3b8;
}

.email-drawer-action-dropdown-item + .email-drawer-action-dropdown-item {
  margin-top: 0;
}

.email-drawer-action-dropdown-item:disabled,
.email-drawer-action-dropdown-item.is-disabled {
  opacity: 0.38;
  color: #5b6b82;
  cursor: not-allowed;
}

.email-drawer-action-dropdown-item:disabled:hover,
.email-drawer-action-dropdown-item.is-disabled:hover {
  background: transparent;
  color: #5b6b82;
}

.email-drawer-action-dropdown-item:disabled:hover svg,
.email-drawer-action-dropdown-item.is-disabled:hover svg {
  color: #5b6b82;
}

.email-drawer-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10050;
  max-width: min(320px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--drawer-border);
  background: var(--drawer-bg);
  color: var(--drawer-text);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.email-drawer-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.email-drawer-toast.is-error {
  border-color: rgba(239, 68, 68, 0.35);
  color: #b91c1c;
}

html[data-theme="dark"] .email-drawer-toast.is-error {
  color: #fca5a5;
}

@media (max-width: 960px) {
  .email-drawer-panel {
    width: 100vw;
  }

  .email-drawer-content {
    grid-template-columns: 1fr;
  }

  .email-drawer-sidebar {
    border-left: 0;
    border-top: 1px solid var(--drawer-border);
    max-height: 42vh;
  }

  .email-drawer-preview-stage {
    padding-left: 16px;
    padding-right: 16px;
  }

  .email-drawer-sent-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .emails-filters-explore {
    --es-filter-col-min: 140px;
  }

  .emails-filter-field--search {
    grid-column: 1 / -1;
  }

  .emails-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
  }

  .email-card-preview {
    height: 240px;
  }
}

/* Landers-style portaled tooltips (drawer actions, GMT chip, etc.) */
.landers-hint-tooltip-wrap {
  position: relative;
}

.landers-hint-tooltip {
  display: none !important;
}

.landers-url-tooltip-portal {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2147483000;
  margin: 0;
  max-width: min(480px, 94vw);
  width: max-content;
  padding: 8px 12px;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 11px;
  line-height: 1.45;
  color: #f8fafc;
  background: #1e293b;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(5px) scale(0.97);
  transition:
    opacity 0.1s cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 0.12s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0s linear 0.12s;
}

.landers-url-tooltip-portal.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition:
    opacity 0.08s cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 0.1s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0s;
}

.landers-url-tooltip-portal.is-hint {
  max-width: min(280px, 94vw);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  word-break: normal;
  white-space: normal;
}

.landers-url-tooltip-portal.hidden {
  display: none !important;
}
