/* 
  Bulk Mail Studio - Jaanucorp Corporate Edition
  Dynamic Multi-Theme System: Purple (Royal SaaS Sample UI), White (Corporate Clean), Black (Executive Obsidian), Blue (Cobalt Enterprise)
*/

:root, [data-theme="purple"] {
  --theme-bg: #f8fafc;
  --theme-surface: #ffffff;
  --theme-surface-subtle: #faf5ff;
  --theme-surface-hover: #f3e8ff;
  --theme-border: #e2e8f0;
  --theme-border-strong: #cbd5e1;
  --theme-text-primary: #0f172a;
  --theme-text-secondary: #475569;
  --theme-text-muted: #94a3b8;

  --brand-primary: #6D28D9;
  --brand-hover: #5B21B6;
  --brand-light: #f5f3ff;
  --brand-border: #ddd6fe;
  --brand-text: #6D28D9;
  --brand-glow: 0 4px 14px rgba(109, 40, 217, 0.28);
  --brand-gradient: linear-gradient(135deg, #6D28D9 0%, #4C1D95 100%);
  --brand-banner: linear-gradient(135deg, #5B21B6 0%, #3B0764 100%);
  --brand-wing-1: #e9d5ff;
  --brand-wing-2: #c084fc;
  --brand-wing-3: #a855f7;

  --brand-blue: #6D28D9;
  --brand-blue-hover: #5B21B6;
  --brand-blue-light: #f5f3ff;
  --brand-blue-border: #ddd6fe;
  
  --table-header-bg: #f8fafc;
  --table-cell-bg: #ffffff;
  --table-cell-hover: #f5f3ff;
  --table-cell-selected: #ede9fe;
  --table-cell-active-border: #6D28D9;
  --nav-bg: #ffffff;

  --sidebar-gradient: linear-gradient(180deg, #5B21B6 0%, #4C1D95 100%);
  --sidebar-text: #ffffff;
  --sidebar-text-muted: #c4b5fd;
  --sidebar-hover-bg: rgba(255, 255, 255, 0.14);
  --sidebar-active-bg: #ffffff;
  --sidebar-active-text: #5B21B6;
  --sidebar-active-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

[data-theme="white"] {
  --theme-bg: #f8fafc;
  --theme-surface: #ffffff;
  --theme-surface-subtle: #f1f5f9;
  --theme-surface-hover: #e2e8f0;
  --theme-border: #e2e8f0;
  --theme-border-strong: #cbd5e1;
  --theme-text-primary: #09090b;
  --theme-text-secondary: #475569;
  --theme-text-muted: #94a3b8;

  --brand-primary: #0066FF;
  --brand-hover: #0052cc;
  --brand-light: #eff6ff;
  --brand-border: #bfdbfe;
  --brand-text: #0066FF;
  --brand-glow: 0 4px 14px rgba(0, 102, 255, 0.28);
  --brand-gradient: linear-gradient(135deg, #0066FF 0%, #0052cc 100%);
  --brand-banner: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  --brand-wing-1: #60a5fa;
  --brand-wing-2: #38bdf8;
  --brand-wing-3: #0066FF;

  --brand-blue: #0066FF;
  --brand-blue-hover: #0052cc;
  --brand-blue-light: #eff6ff;
  --brand-blue-border: #bfdbfe;
  
  --table-header-bg: #f8fafc;
  --table-cell-bg: #ffffff;
  --table-cell-hover: #f8fafc;
  --table-cell-selected: #eff6ff;
  --table-cell-active-border: #0066FF;
  --nav-bg: #ffffff;

  --sidebar-gradient: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  --sidebar-text: #ffffff;
  --sidebar-text-muted: #94a3b8;
  --sidebar-hover-bg: rgba(255, 255, 255, 0.08);
  --sidebar-active-bg: #0066FF;
  --sidebar-active-text: #ffffff;
  --sidebar-active-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
}

[data-theme="black"] {
  --theme-bg: #09090b;
  --theme-surface: #121216;
  --theme-surface-subtle: #18181c;
  --theme-surface-hover: #222228;
  --theme-border: #27272a;
  --theme-border-strong: #3f3f46;
  --theme-text-primary: #f4f4f5;
  --theme-text-secondary: #a1a1aa;
  --theme-text-muted: #71717a;

  --brand-primary: #27272a;
  --brand-hover: #3f3f46;
  --brand-light: rgba(255, 255, 255, 0.08);
  --brand-border: #3f3f46;
  --brand-text: #f4f4f5;
  --brand-glow: 0 0 16px rgba(255, 255, 255, 0.12);
  --brand-gradient: linear-gradient(135deg, #27272a 0%, #18181b 100%);
  --brand-banner: linear-gradient(135deg, #18181c 0%, #09090b 100%);
  --brand-wing-1: #e4e4e7;
  --brand-wing-2: #a1a1aa;
  --brand-wing-3: #71717a;

  --brand-blue: #3f3f46;
  --brand-blue-hover: #52525b;
  --brand-blue-light: rgba(255, 255, 255, 0.08);
  --brand-blue-border: #52525b;
  
  --table-header-bg: #18181c;
  --table-cell-bg: #121216;
  --table-cell-hover: #1c1c22;
  --table-cell-selected: rgba(255, 255, 255, 0.12);
  --table-cell-active-border: #a1a1aa;
  --nav-bg: #0f0f13;

  --sidebar-gradient: linear-gradient(180deg, #121216 0%, #09090b 100%);
  --sidebar-text: #f4f4f5;
  --sidebar-text-muted: #71717a;
  --sidebar-hover-bg: rgba(255, 255, 255, 0.08);
  --sidebar-active-bg: #27272a;
  --sidebar-active-text: #ffffff;
  --sidebar-active-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

/* ==========================================================================
   THEME ADAPTATION UTILITY CLASSES
   ========================================================================== */
.theme-accent-text {
  color: var(--brand-primary) !important;
}
.theme-accent-bg {
  background-color: var(--brand-light) !important;
}
.theme-accent-border {
  border-color: var(--brand-border) !important;
}
.theme-btn-primary {
  background: var(--brand-primary) !important;
  color: #ffffff !important;
  transition: all 0.15s ease;
}
.theme-btn-primary:hover {
  background: var(--brand-hover) !important;
}
.theme-banner {
  background: var(--brand-banner) !important;
}

/* ==========================================================================
   PROFESSIONAL RED CLOSE & DELETE BUTTONS
   ========================================================================== */
.btn-close-red {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 28px !important;
  height: 28px !important;
  border-radius: 8px !important;
  background: #fef2f2 !important;
  border: 1px solid #fecaca !important;
  color: #dc2626 !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  transition: all 0.15s ease !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  padding: 0 !important;
}
.btn-close-red:hover {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
  transform: scale(1.05);
}
.btn-close-red svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 2.2;
}

.btn-delete-format-red {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 18px !important;
  height: 18px !important;
  border-radius: 9999px !important;
  background: #fee2e2 !important;
  border: 1px solid #fca5a5 !important;
  color: #b91c1c !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  margin-left: 6px !important;
  transition: all 0.15s ease !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
}
.btn-delete-format-red:hover {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
}

[data-theme="blue"] {
  --theme-bg: #f8fafc;
  --theme-surface: #ffffff;
  --theme-surface-subtle: #eff6ff;
  --theme-surface-hover: #dbeafe;
  --theme-border: #e2e8f0;
  --theme-border-strong: #cbd5e1;
  --theme-text-primary: #0f172a;
  --theme-text-secondary: #475569;
  --theme-text-muted: #94a3b8;

  --brand-primary: #2563eb;
  --brand-hover: #1d4ed8;
  --brand-light: #eff6ff;
  --brand-border: #bfdbfe;
  --brand-text: #1e40af;
  --brand-glow: 0 4px 14px rgba(37, 99, 235, 0.28);
  --brand-gradient: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  --brand-banner: linear-gradient(135deg, #1e40af 0%, #172554 100%);
  --brand-wing-1: #38bdf8;
  --brand-wing-2: #60a5fa;
  --brand-wing-3: #2563eb;

  --brand-blue: #2563eb;
  --brand-blue-hover: #1d4ed8;
  --brand-blue-light: #eff6ff;
  --brand-blue-border: #bfdbfe;
  
  --table-header-bg: #f8fafc;
  --table-cell-bg: #ffffff;
  --table-cell-hover: #f1f5f9;
  --table-cell-selected: #eff6ff;
  --table-cell-active-border: #2563eb;
  --nav-bg: #ffffff;

  --sidebar-gradient: linear-gradient(180deg, #1e40af 0%, #1d4ed8 100%);
  --sidebar-text: #ffffff;
  --sidebar-text-muted: #bfdbfe;
  --sidebar-hover-bg: rgba(255, 255, 255, 0.12);
  --sidebar-active-bg: #ffffff;
  --sidebar-active-text: #1e40af;
  --sidebar-active-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   SIDEBAR NAVIGATION ENGINE (Matching Sample UI)
   ========================================================================== */
.app-sidebar {
  background: var(--sidebar-gradient);
  color: var(--sidebar-text);
  width: 240px;
  height: 100vh;
  min-height: 100vh;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: 35;
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.08);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

[data-theme="white"] .app-sidebar {
  border-right: 1px solid var(--theme-border);
}

[data-theme="black"] .app-sidebar {
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.app-sidebar .sidebar-brand-header {
  height: 56px;
}

.app-sidebar.collapsed {
  width: 68px;
}

.app-sidebar.collapsed .sidebar-hide-on-collapse {
  display: none !important;
}

.app-sidebar.collapsed .sidebar-brand-header {
  height: 56px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.app-sidebar.collapsed .sidebar-brand-header > div {
  justify-content: center !important;
  width: 100% !important;
}

.app-sidebar.collapsed .sidebar-shield-btn {
  margin: 0 auto !important;
  width: 40px !important;
  height: 40px !important;
  border-radius: 10px !important;
}

/* Collapsed footer / bottom dock styling (anchored, no empty void) */
.app-sidebar.collapsed .sidebar-footer {
  padding: 8px 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 4px !important;
}

/* Strict, non-stretching square squircle for all icons in collapsed mode */
.app-sidebar.collapsed .sidebar-item {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  max-width: 42px !important;
  min-height: 42px !important;
  max-height: 42px !important;
  padding: 0 !important;
  margin: 3px auto !important;
  border-radius: 10px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  position: relative !important;
}

.app-sidebar.collapsed .sidebar-item svg {
  width: 20px !important;
  height: 20px !important;
  margin: 0 !important;
  flex-shrink: 0 !important;
}

/* Active item in collapsed mode: crisp squircle, NO stretched vertical pill */
.app-sidebar.collapsed .sidebar-item.active {
  background: var(--sidebar-active-bg) !important;
  color: var(--sidebar-active-text) !important;
  border-radius: 10px !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22) !important;
}

.app-sidebar.collapsed .sidebar-item.active svg {
  color: var(--sidebar-active-text) !important;
  stroke: var(--sidebar-active-text) !important;
  width: 20px !important;
  height: 20px !important;
}

/* Hover state in collapsed mode */
.app-sidebar.collapsed .sidebar-item:hover:not(.active) {
  background-color: rgba(255, 255, 255, 0.16) !important;
  color: #ffffff !important;
}

/* Rotate collapse toggle icon to expand icon when collapsed */
.app-sidebar.collapsed #sidebar-toggle-icon {
  transform: rotate(180deg);
}

/* Subtle centered divider line in collapsed mode */
.app-sidebar.collapsed .sidebar-divider {
  width: 28px !important;
  margin: 6px auto !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
}

/* Standard Expanded Sidebar Item */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
  margin: 2px 10px;
  user-select: none;
  text-decoration: none;
}

.sidebar-item:hover {
  background-color: var(--sidebar-hover-bg);
  color: #ffffff;
}

.sidebar-item.active {
  background: var(--sidebar-active-bg) !important;
  color: var(--sidebar-active-text) !important;
  font-weight: 800 !important;
  box-shadow: var(--sidebar-active-shadow);
}

.sidebar-item.active svg {
  color: var(--sidebar-active-text) !important;
  stroke: var(--sidebar-active-text) !important;
}

/* Floating Tooltips in Collapsed Mode (Linear / Raycast Style) */
.app-sidebar.collapsed [data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) scale(0.95);
  background: #0f172a;
  color: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 5px 9px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.12);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.14s ease, transform 0.14s ease;
  z-index: 1000;
}

.app-sidebar.collapsed [data-tooltip]::before {
  content: '';
  position: absolute;
  left: calc(100% + 4px);
  top: 50%;
  transform: translateY(-50%);
  border-width: 5px 6px 5px 0;
  border-style: solid;
  border-color: transparent #0f172a transparent transparent;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.14s ease;
  z-index: 1000;
  pointer-events: none;
}

.app-sidebar.collapsed [data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) scale(1);
}

.app-sidebar.collapsed [data-tooltip]:hover::before {
  opacity: 1;
  visibility: visible;
}

.app-sidebar:not(.collapsed) [data-tooltip]::after,
.app-sidebar:not(.collapsed) [data-tooltip]::before {
  display: none !important;
}

/* Settings Modal Multi-Group Tabs */
.settings-group-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--theme-text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.settings-group-nav-btn:hover {
  background: var(--theme-surface-subtle);
  color: var(--theme-text-primary);
}

.settings-group-nav-btn.active {
  background: var(--brand-blue-light);
  color: var(--brand-blue);
  font-weight: 700;
}

.settings-group-nav-btn.active svg {
  color: var(--brand-blue) !important;
}

.theme-card-option {
  padding: 12px;
  border-radius: 12px;
  border: 2px solid var(--theme-border);
  background: var(--theme-surface);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.theme-card-option:hover {
  border-color: var(--brand-blue);
  transform: translateY(-1px);
}

.theme-card-option.active {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 2px var(--brand-blue-light);
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* Hide scrollbar utility */
.no-scrollbar::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}
.no-scrollbar {
  -ms-overflow-style: none !important;
  scrollbar-width: none !important;
}

html, body {
  height: 100%;
  height: 100vh;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Plus Jakarta Sans", sans-serif;
  background-color: var(--theme-bg);
  color: var(--theme-text-primary);
  margin: 0;
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--theme-surface-subtle);
}
::-webkit-scrollbar-thumb {
  background: var(--theme-border-strong);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--theme-text-muted);
}

/* Sidebar Specific Scrollbar: Transparent Track & Subtle Translucent Thumb
   CRITICAL: Prevents light workspace surface track from bleeding into the dark/brand sidebar */
.app-sidebar,
.app-sidebar nav,
.sidebar-nav,
.app-sidebar * {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.app-sidebar ::-webkit-scrollbar,
.app-sidebar nav::-webkit-scrollbar,
.sidebar-nav::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.app-sidebar ::-webkit-scrollbar-track,
.app-sidebar nav::-webkit-scrollbar-track,
.sidebar-nav::-webkit-scrollbar-track {
  background: transparent !important;
}

.app-sidebar ::-webkit-scrollbar-thumb,
.app-sidebar nav::-webkit-scrollbar-thumb,
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22) !important;
  border-radius: 9999px;
}

.app-sidebar ::-webkit-scrollbar-thumb:hover,
.app-sidebar nav::-webkit-scrollbar-thumb:hover,
.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.45) !important;
}

/* White Theme Adaptation for Sidebar Scrollbar */
[data-theme="white"] .app-sidebar,
[data-theme="white"] .app-sidebar nav,
[data-theme="white"] .sidebar-nav,
[data-theme="white"] .app-sidebar * {
  scrollbar-color: rgba(15, 23, 42, 0.2) transparent;
}

[data-theme="white"] .app-sidebar ::-webkit-scrollbar-thumb,
[data-theme="white"] .app-sidebar nav::-webkit-scrollbar-thumb,
[data-theme="white"] .sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.2) !important;
}

[data-theme="white"] .app-sidebar ::-webkit-scrollbar-thumb:hover,
[data-theme="white"] .app-sidebar nav::-webkit-scrollbar-thumb:hover,
[data-theme="white"] .sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 23, 42, 0.35) !important;
}

/* ==========================================================================
   DYNAMIC THEME & WING SYSTEM (Purple, Blue, White, Black)
   ========================================================================== */

/* 1. Sovereign Wing Feathers (Dynamic Theme Colors) */
.nuncio-wing-1 { fill: var(--brand-wing-1, #38bdf8) !important; transition: fill 0.25s ease; }
.nuncio-wing-2 { fill: var(--brand-wing-2, #60a5fa) !important; transition: fill 0.25s ease; }
.nuncio-wing-3 { fill: var(--brand-wing-3, #93c5fd) !important; transition: fill 0.25s ease; }

/* 2. Universal Brand Button Overrides - Every component complements the theme */
[data-theme] .bg-purple-600,
[data-theme] .bg-blue-600,
.theme-btn-primary {
  background-color: var(--brand-primary) !important;
  color: #ffffff !important;
}

[data-theme] .hover\:bg-purple-700:hover,
[data-theme] .hover\:bg-blue-700:hover {
  background-color: var(--brand-hover) !important;
}

/* 3. Universal Brand Text */
[data-theme] .text-purple-600,
[data-theme] .text-purple-700,
[data-theme] .text-blue-600,
[data-theme] .text-blue-700,
[data-theme] .text-indigo-600,
[data-theme] .text-indigo-700 {
  color: var(--brand-text) !important;
}

/* 4. Universal Brand Badges & Light Backgrounds */
[data-theme] .bg-purple-50,
[data-theme] .bg-blue-50,
[data-theme] .bg-indigo-50,
[data-theme] .bg-purple-100,
[data-theme] .bg-blue-100 {
  background-color: var(--brand-light) !important;
}

[data-theme] .border-purple-200,
[data-theme] .border-purple-300,
[data-theme] .border-blue-200,
[data-theme] .border-blue-300,
[data-theme] .border-indigo-200 {
  border-color: var(--brand-border) !important;
}

[data-theme] .hover\:border-purple-300:hover,
[data-theme] .hover\:border-blue-300:hover {
  border-color: var(--brand-primary) !important;
}

[data-theme] .hover\:text-purple-700:hover,
[data-theme] .hover\:text-blue-700:hover {
  color: var(--brand-primary) !important;
}

[data-theme] .hover\:bg-purple-50:hover,
[data-theme] .hover\:bg-blue-50:hover {
  background-color: var(--brand-light) !important;
}

/* 5. Welcome Banner & Hero Gradients */
[data-theme] .theme-welcome-banner,
[data-theme] .from-purple-800.to-indigo-900 {
  background: var(--brand-banner) !important;
}

[data-theme] .from-purple-600.to-indigo-600 {
  background: var(--brand-gradient) !important;
}

/* 6. Format Tab Pills (Template Workspace) */
.format-tab-pill.active {
  background: var(--brand-light) !important;
  color: var(--brand-text) !important;
  border-color: var(--brand-border) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.format-tab-pill.inactive-enabled {
  background: var(--theme-surface);
  color: var(--theme-text-primary);
  border-color: var(--theme-border);
}

.format-tab-pill.inactive-enabled:hover {
  background: var(--theme-surface-hover);
}

.format-tab-pill.inactive-disabled {
  background: var(--theme-surface-subtle);
  color: var(--theme-text-muted);
  border-color: var(--theme-border);
}

/* 7. Quick Theme Switcher Pill in Topbar */
#topbar-theme-switcher button.active-theme {
  background: var(--theme-surface) !important;
  color: var(--theme-text-primary) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--theme-border-strong);
}

/* 8. Theme Adaptive Surfaces for Dark and Blue Variations */
[data-theme="black"] header,
[data-theme="blue"] header {
  background-color: var(--nav-bg) !important;
}

[data-theme="black"] .bg-white,
[data-theme="blue"] .bg-white {
  background-color: var(--theme-surface) !important;
}

[data-theme="black"] .bg-slate-50,
[data-theme="blue"] .bg-slate-50,
[data-theme="black"] .bg-slate-100,
[data-theme="blue"] .bg-slate-100 {
  background-color: var(--theme-surface-subtle) !important;
}

[data-theme="black"] .border-slate-200,
[data-theme="blue"] .border-slate-200,
[data-theme="black"] .border-slate-100,
[data-theme="blue"] .border-slate-100,
[data-theme="black"] .border-slate-300,
[data-theme="blue"] .border-slate-300 {
  border-color: var(--theme-border) !important;
}

[data-theme="black"] .text-slate-900,
[data-theme="black"] .text-slate-800,
[data-theme="black"] .text-slate-700,
[data-theme="blue"] .text-slate-900,
[data-theme="blue"] .text-slate-800,
[data-theme="blue"] .text-slate-700 {
  color: var(--theme-text-primary) !important;
}

.nuncio-wordmark {
  color: #09090b;
}

[data-theme="black"] .nuncio-wordmark,
[data-theme="blue"] .nuncio-wordmark {
  color: #ffffff !important;
}

[data-theme="black"] .text-slate-600,
[data-theme="black"] .text-slate-500,
[data-theme="black"] .text-slate-400,
[data-theme="blue"] .text-slate-600,
[data-theme="blue"] .text-slate-500,
[data-theme="blue"] .text-slate-400 {
  color: var(--theme-text-secondary) !important;
}

[data-theme="black"] input,
[data-theme="black"] select,
[data-theme="blue"] input,
[data-theme="blue"] select {
  background-color: var(--theme-surface-subtle) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text-primary) !important;
}

/* 9. Complete Modal Coverage for Dark Mode (No White Flash) */
[data-theme="black"] #modal-senders > div > div,
[data-theme="black"] #modal-settings > div > div,
[data-theme="black"] #modal-launch > div > div,
[data-theme="black"] #modal-dns > div > div,
[data-theme="black"] #modal-account > div > div,
[data-theme="black"] #modal-templates > div > div,
[data-theme="black"] #modal-pitch-agent > div > div,
[data-theme="black"] #modal-ai-generator > div > div,
[data-theme="black"] #modal-progress,
[data-theme="black"] #chat-drawer,
[data-theme="blue"] #modal-senders > div > div,
[data-theme="blue"] #modal-settings > div > div,
[data-theme="blue"] #modal-launch > div > div,
[data-theme="blue"] #modal-dns > div > div,
[data-theme="blue"] #modal-account > div > div,
[data-theme="blue"] #modal-templates > div > div,
[data-theme="blue"] #modal-pitch-agent > div > div,
[data-theme="blue"] #modal-ai-generator > div > div,
[data-theme="blue"] #modal-progress,
[data-theme="blue"] #nuncio-voice-settings-panel,
[data-theme="blue"] #chat-drawer {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text-primary) !important;
  border-color: var(--theme-border) !important;
}

[data-theme="black"] #modal-progress,
[data-theme="blue"] #modal-progress {
  border-color: var(--brand-primary) !important;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6) !important;
}

[data-theme="black"] #view-logs table thead,
[data-theme="blue"] #view-logs table thead {
  background-color: var(--theme-surface-subtle) !important;
  color: var(--theme-text-secondary) !important;
}

[data-theme="black"] #view-logs table tr:hover,
[data-theme="blue"] #view-logs table tr:hover {
  background-color: var(--theme-surface-hover) !important;
}

[data-theme="black"] #view-logs table td,
[data-theme="blue"] #view-logs table td {
  border-color: var(--theme-border) !important;
}

/* Excel-Like Spreadsheet Grid */
.excel-table-container {
  overflow: auto;
  max-height: calc(100vh - 280px);
  background: var(--table-cell-bg);
  border: 1px solid var(--theme-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.excel-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}

.excel-table th {
  background: var(--table-header-bg);
  color: var(--theme-text-secondary);
  font-weight: 600;
  padding: 8px 12px;
  border: 1px solid var(--theme-border);
  border-bottom: 2px solid var(--brand-blue-border);
  text-align: left;
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 10;
  white-space: nowrap;
}

.excel-table td {
  border: 1px solid var(--theme-border);
  padding: 6px 10px;
  color: var(--theme-text-primary);
  background: var(--table-cell-bg);
  white-space: nowrap;
  outline: none;
  transition: background 0.15s ease;
}

.excel-table tr:hover td {
  background-color: var(--table-cell-hover);
}

.excel-table tr.selected td {
  background-color: var(--table-cell-selected) !important;
}

.excel-table td.cell-active {
  outline: 2px solid var(--table-cell-active-border);
  outline-offset: -2px;
  background-color: var(--table-cell-bg);
}

.excel-row-num {
  background: var(--table-header-bg) !important;
  color: var(--theme-text-muted);
  font-family: monospace;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  width: 44px;
  min-width: 44px;
  user-select: none;
}

/* Brand Button, Blue Glows & Accents */
.blue-glow, .red-glow {
  box-shadow: var(--brand-glow) !important;
}

.bg-brand {
  background-color: var(--brand-blue) !important;
  color: #ffffff !important;
}
.bg-brand:hover {
  background-color: var(--brand-blue-hover) !important;
}

.text-brand {
  color: var(--brand-blue) !important;
}

.border-brand {
  border-color: var(--brand-blue) !important;
}

.badge-brand, .badge-red {
  background-color: var(--brand-blue-light) !important;
  color: var(--brand-blue) !important;
  border: 1px solid var(--brand-blue-border) !important;
}

.badge-green {
  background-color: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.badge-gray {
  background-color: var(--theme-surface-subtle);
  color: var(--theme-text-secondary);
  border: 1px solid var(--theme-border);
}

/* Chat Drawer Animations & Bubbles */
.chat-drawer {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-bubble-user {
  background: linear-gradient(135deg, #0066FF 0%, #0052cc 100%);
  color: #ffffff;
  border-radius: 16px 16px 4px 16px;
  box-shadow: var(--brand-glow);
  word-break: break-word;
  overflow-wrap: break-word;
  box-sizing: border-box;
}

.chat-bubble-ai {
  background: var(--theme-surface);
  color: var(--theme-text-primary);
  border: 1px solid var(--theme-border);
  border-radius: 16px 16px 16px 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  word-break: break-word;
  overflow-wrap: break-word;
  box-sizing: border-box;
  max-width: 100%;
}

/* Nuncio Action Cards & Professional Button Grid */
.nuncio-action-card {
  background: var(--theme-surface-subtle);
  border: 1px solid var(--theme-border-strong);
  border-radius: 12px;
  padding: 11px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  margin-top: 6px;
}

[data-theme="purple"] .nuncio-action-card {
  background: #faf5ff;
  border-color: #ddd6fe;
}
[data-theme="white"] .nuncio-action-card {
  background: #f8fafc;
  border-color: #e2e8f0;
}
[data-theme="black"] .nuncio-action-card {
  background: #18181b;
  border-color: #27272a;
}
[data-theme="blue"] .nuncio-action-card {
  background: #f0f7ff;
  border-color: #bfdbfe;
}

.nuncio-action-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.nuncio-action-card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--theme-text-primary);
  line-height: 1.3;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-theme="purple"] .nuncio-action-card-title {
  color: #581c87;
}

.nuncio-action-badge {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
  background: var(--brand-light);
  color: var(--brand-text);
  border: 1px solid var(--brand-border);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.nuncio-action-summary {
  font-size: 11px;
  color: var(--theme-text-secondary);
  line-height: 1.4;
  margin-bottom: 8px;
  word-break: break-word;
}

[data-theme="purple"] .nuncio-action-summary {
  color: #6b21a8;
}

.nuncio-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--theme-border);
}

[data-theme="purple"] .nuncio-action-grid {
  border-top-color: #e9d5ff;
}

.nuncio-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 32px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
  transition: all 0.15s ease;
  user-select: none;
  min-width: 0;
  width: 100%;
}

.nuncio-action-btn:active {
  transform: scale(0.97);
}

.nuncio-action-btn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.nuncio-btn-full {
  grid-column: span 2;
}

/* Primary Theme Button */
.nuncio-btn-primary {
  background: var(--brand-primary);
  color: #ffffff;
  border: 1px solid transparent;
  box-shadow: 0 1px 2px rgba(109, 40, 217, 0.18);
}
.nuncio-btn-primary:hover {
  background: var(--brand-hover);
  color: #ffffff;
}

/* Secondary Outline Button (Undo, Options) */
.nuncio-btn-outline {
  background: var(--theme-surface);
  color: var(--theme-text-primary);
  border: 1px solid var(--theme-border-strong);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.nuncio-btn-outline:hover {
  background: var(--theme-surface-hover);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

[data-theme="purple"] .nuncio-btn-outline {
  color: #6b21a8;
  border-color: #ddd6fe;
}
[data-theme="purple"] .nuncio-btn-outline:hover {
  background: #f3e8ff;
  border-color: #7c3aed;
  color: #581c87;
}

/* Campaign Action Button */
.nuncio-btn-campaign {
  background: #0d9488;
  color: #ffffff;
  border: 1px solid #0f766e;
  box-shadow: 0 1px 2px rgba(13, 148, 136, 0.18);
}
.nuncio-btn-campaign:hover {
  background: #0f766e;
  color: #ffffff;
}

/* Report Action Button */
.nuncio-btn-report {
  background: #3b0764;
  color: #ffffff;
  border: 1px solid #4c1d95;
  box-shadow: 0 1px 2px rgba(59, 7, 100, 0.18);
}
.nuncio-btn-report:hover {
  background: #4c1d95;
  color: #ffffff;
}

[data-theme="white"] .nuncio-btn-report {
  background: #0f172a;
  border-color: #1e293b;
}
[data-theme="black"] .nuncio-btn-report {
  background: #27272a;
  border-color: #3f3f46;
}
[data-theme="blue"] .nuncio-btn-report {
  background: #1e3a8a;
  border-color: #1d4ed8;
}

/* Pulsing Live Dot */
@keyframes pulse-blue {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 102, 255, 0.7); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 6px rgba(0, 102, 255, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 102, 255, 0); }
}

.pulse-red-dot, .pulse-blue-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: var(--brand-blue);
  border-radius: 50%;
  animation: pulse-blue 2s infinite ease-in-out;
}

/* Theme Switcher Component */
.theme-switcher-container {
  background: var(--theme-surface-subtle);
  border: 1px solid var(--theme-border);
  padding: 2px 4px;
  border-radius: 10px;
}

.theme-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 7px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  color: var(--theme-text-secondary);
  background: transparent;
}

.theme-switch-btn:hover {
  color: var(--theme-text-primary);
}

.theme-switch-btn.active {
  background: var(--theme-surface);
  color: var(--brand-blue);
  border-color: var(--theme-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* ==========================================================================
   SaaS Desktop-Grade Application Context Menu Styles
   ========================================================================== */
.saas-context-menu {
  position: fixed;
  z-index: 9999;
  min-width: 230px;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  box-shadow: 0 16px 36px -4px rgba(15, 23, 42, 0.15), 0 6px 16px -4px rgba(15, 23, 42, 0.08);
  padding: 5px;
  font-size: 12px;
  color: var(--theme-text-primary);
  user-select: none;
  animation: saas-menu-enter 0.12s cubic-bezier(0, 0, 0.2, 1);
  backdrop-filter: blur(8px);
}

@keyframes saas-menu-enter {
  from { opacity: 0; transform: scale(0.96) translateY(-4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.saas-menu-header {
  padding: 6px 10px 6px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--theme-text-secondary);
  border-bottom: 1px solid var(--theme-border);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.saas-badge-red {
  background-color: var(--brand-blue-light);
  color: var(--brand-blue);
  border: 1px solid var(--brand-blue-border);
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 9999px;
  font-weight: 800;
  text-transform: uppercase;
}

.saas-menu-group {
  display: flex;
  flex-direction: column;
}

.saas-menu-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  color: var(--theme-text-primary);
  transition: all 0.12s ease;
}

.saas-menu-item:hover {
  background-color: var(--brand-blue-light);
  color: var(--brand-blue);
}

.saas-menu-item.active-item {
  font-weight: 700;
  color: var(--brand-blue);
  background-color: var(--brand-blue-light);
}

.saas-shortcut {
  font-family: monospace;
  font-size: 10px;
  color: var(--theme-text-muted);
  background-color: var(--theme-surface-subtle);
  border: 1px solid var(--theme-border);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 10px;
}

.saas-menu-divider {
  height: 1px;
  background-color: var(--theme-border);
  margin: 4px 0;
}

/* Submenu System */
.saas-menu-item.has-submenu:hover > .saas-submenu {
  display: block;
}

.saas-submenu {
  display: none;
  position: absolute;
  top: -5px;
  left: 100%;
  margin-left: 4px;
  min-width: 230px;
  max-width: 320px;
  max-height: 380px;
  overflow-y: auto;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border-strong);
  border-radius: 12px;
  box-shadow: 0 16px 36px -4px rgba(15, 23, 42, 0.15), 0 6px 16px -4px rgba(15, 23, 42, 0.08);
  padding: 5px;
  z-index: 10000;
  animation: saas-menu-enter 0.1s ease;
}

/* Flipped submenu when near right edge of screen */
.saas-context-menu.flip-submenus .saas-submenu {
  left: auto !important;
  right: 100% !important;
  margin-left: 0 !important;
  margin-right: 4px !important;
}

/* ========================================================================= */
/* MS Office / Word Processor Visual Editor Styles                           */
/* ========================================================================= */
.office-editor-card {
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  position: relative;
  box-sizing: border-box !important;
  isolation: isolate;
  contain: paint;
}

.office-ribbon {
  background: var(--theme-surface-subtle);
  border-bottom: 1px solid var(--theme-border);
  padding: 8px 12px;
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  width: 100% !important;
  box-sizing: border-box !important;
  user-select: none;
}

.office-ribbon-group {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0 6px 0 2px;
  border-right: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.office-ribbon-group:last-child {
  border-right: none;
}

.office-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--theme-text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.office-btn:hover {
  background: var(--brand-blue-light);
  color: var(--brand-blue);
  border-color: var(--brand-blue-border);
}

.office-btn.active {
  background: var(--brand-blue-light);
  color: var(--brand-blue);
  border-color: var(--brand-blue-border);
}

.office-btn-wide {
  width: auto;
  padding: 0 8px;
  height: 28px;
  font-size: 11px;
  white-space: nowrap;
}

.office-select {
  height: 28px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--theme-text-primary);
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  flex-shrink: 0;
}

.office-select:focus {
  border-color: var(--brand-blue);
}

/* Document Paper Canvas Wrap & Paper Sheet */
.office-paper-wrap {
  background: var(--theme-surface-subtle);
  padding: 20px 20px 32px 20px;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  min-height: 480px;
  max-height: 620px;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  width: 100% !important;
  box-sizing: border-box !important;
  flex: 1 1 auto;
  position: relative;
  scrollbar-gutter: stable;
}

.office-canvas {
  background: #ffffff;
  width: 100%;
  max-width: 580px;
  min-height: 440px;
  height: auto;
  padding: 28px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  color: #1e293b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  outline: none;
  word-break: break-word;
  overflow-wrap: break-word;
  box-sizing: border-box !important;
  margin-bottom: 24px !important;
  flex-shrink: 0;
}

.office-canvas:focus {
  box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.25), 0 4px 14px rgba(15, 23, 42, 0.08);
}

.office-canvas p {
  margin: 0 0 14px 0;
}

.office-canvas p:last-child {
  margin-bottom: 0;
}

.office-canvas ul, .office-canvas ol {
  margin: 8px 0 14px 20px;
  padding: 0;
}

.office-canvas li {
  margin-bottom: 4px;
}

.office-canvas a {
  color: var(--brand-blue);
  text-decoration: underline;
}

.office-canvas img {
  max-width: 100%;
  height: auto;
  cursor: pointer;
  border-radius: 6px;
  transition: outline 0.15s ease;
}

/* Interactive Image Selection & Resizing */
.office-canvas img.selected-for-resize {
  outline: 2px solid var(--brand-blue) !important;
  outline-offset: 2px;
}

.office-canvas table {
  max-width: 100% !important;
  table-layout: fixed;
  word-break: break-word;
}

.office-canvas pre, .office-canvas code {
  white-space: pre-wrap;
  word-break: break-word;
}

.floating-image-bar {
  position: absolute;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 4px;
  background: #09090b;
  color: #ffffff;
  padding: 4px 8px;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  font-size: 11px;
  font-weight: 700;
  user-select: none;
  animation: saas-menu-enter 0.12s ease-out;
  border: 1px solid #27272a;
}

.floating-image-bar button {
  background: transparent;
  color: #e2e8f0;
  border: none;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}

.floating-image-bar button:hover {
  background: #27272a;
  color: #ffffff;
}

.floating-image-bar button.active {
  background: var(--brand-blue);
  color: #ffffff;
}

.floating-image-bar .bar-divider {
  width: 1px;
  height: 14px;
  background: #3f3f46;
  margin: 0 2px;
}

/* Interactive Corner Resize Handles */
.image-resize-handle {
  position: absolute;
  width: 11px;
  height: 11px;
  background: var(--brand-blue);
  border: 2px solid #ffffff;
  border-radius: 2px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  z-index: 51;
  user-select: none;
}

.image-resize-handle.handle-se {
  cursor: se-resize;
  bottom: -5px;
  right: -5px;
}

.image-resize-handle.handle-sw {
  cursor: sw-resize;
  bottom: -5px;
  left: -5px;
}

/* Merge Tag Chip in Editor */
.editor-merge-chip {
  display: inline-block;
  background: var(--brand-blue-light);
  color: var(--brand-blue);
  border: 1px solid var(--brand-blue-border);
  padding: 0 5px;
  border-radius: 4px;
  font-family: monospace;
  font-weight: 700;
  font-size: 12px;
  user-select: all;
}

/* ========================================================================= */
/* Dual-Device Live Preview Styles (Laptop vs. Smartphone)                   */
/* ========================================================================= */
.device-switch-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.device-switch-pill.active {
  background: var(--theme-surface);
  color: var(--brand-blue);
  border-color: var(--theme-border-strong);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.device-switch-pill:not(.active) {
  color: #64748b;
}

.device-switch-pill:not(.active):hover {
  color: #0f172a;
}

/* 1. Laptop Desktop Client Mockup */
.laptop-mockup-frame {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.laptop-titlebar {
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.window-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.window-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.window-dot.dot-red { background: #ef4444; }
.window-dot.dot-yellow { background: #f59e0b; }
.window-dot.dot-green { background: #10b981; }

.laptop-email-header {
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
  padding: 10px 16px;
  font-size: 11px;
  line-height: 1.5;
  color: #475569;
}

.laptop-email-body {
  padding: 20px;
  background: #ffffff;
  overflow-y: auto;
  max-height: 520px;
}

/* 2. Smartphone Mobile Mockup Frame */
.phone-mockup-container {
  display: flex;
  justify-content: center;
  padding: 10px 0;
}

.phone-mockup-frame {
  width: 375px;
  background: #0f172a;
  border-radius: 46px;
  padding: 12px;
  box-shadow: 0 24px 48px -12px rgba(15, 23, 42, 0.3), 0 0 0 4px #334155;
  position: relative;
  user-select: none;
}

.phone-screen {
  background: #ffffff;
  border-radius: 36px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 540px;
  max-height: 560px;
}

/* Top Phone Status Bar & Dynamic Island */
.phone-status-bar {
  background: #ffffff;
  padding: 8px 16px 4px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: #0f172a;
}

.phone-island {
  width: 86px;
  height: 18px;
  background: #0f172a;
  border-radius: 20px;
  margin: 0 auto;
}

.phone-email-app-header {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 14px;
  font-size: 11px;
}

.phone-email-body {
  padding: 14px;
  overflow-y: auto;
  font-size: 13px;
  flex: 1;
}

/* Project Nuncio Voice & Avatar Animations - Cute Birdy Flutter & Bounce */
.nuncio-avatar-talking {
  animation: nuncio-talk-bounce 0.5s infinite alternate cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes nuncio-talk-bounce {
  0% {
    transform: scale(1) rotate(-3deg);
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.4);
  }
  50% {
    transform: scale(1.1) rotate(3deg);
    box-shadow: 0 0 0 5px rgba(168, 85, 247, 0.7), 0 0 16px rgba(168, 85, 247, 0.4);
  }
  100% {
    transform: scale(1.04) rotate(-1.5deg);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.5);
  }
}

.nuncio-mic-pulse {
  animation: nuncio-mic-ring 1.2s infinite ease-out;
}

@keyframes nuncio-mic-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

/* Row Mutation Glow Pulse in Spreadsheet Grid */
@keyframes row-pulse-glow {
  0% {
    background-color: rgba(147, 51, 234, 0.35) !important;
    box-shadow: inset 0 0 12px rgba(147, 51, 234, 0.5);
  }
  40% {
    background-color: rgba(147, 51, 234, 0.18) !important;
    box-shadow: inset 0 0 6px rgba(147, 51, 234, 0.3);
  }
  100% {
    background-color: transparent;
  }
}

.row-highlight-pulse {
  animation: row-pulse-glow 2.8s ease-out forwards;
}



/* ==========================================================================
   DYNAMIC CHAT DRAWER RESIZER & CONTROLS
   ========================================================================== */
.chat-drawer-resizer {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 8px;
  cursor: ew-resize;
  z-index: 50;
  user-select: none;
  -webkit-user-select: none;
  background: transparent;
  transition: background-color 0.15s ease;
}

.chat-drawer-resizer:hover,
.chat-drawer-resizer.is-active {
  background-color: rgba(59, 130, 246, 0.45);
}

.chat-drawer-resizer::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 2px;
  transform: translateY(-50%);
  width: 4px;
  height: 38px;
  border-radius: 9999px;
  background-color: rgba(148, 163, 184, 0.7);
  opacity: 0;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

.chat-drawer-resizer:hover::before,
.chat-drawer-resizer.is-active::before {
  opacity: 1;
  background-color: #2563eb;
}

/* Resizing mode for smooth 60fps drag */
body.is-resizing-copilot {
  user-select: none !important;
  -webkit-user-select: none !important;
  cursor: ew-resize !important;
}

body.is-resizing-copilot * {
  cursor: ew-resize !important;
}

body.is-resizing-copilot #chat-drawer {
  transition: none !important;
}

/* Quick width cycle button */
.btn-drawer-width-toggle {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 28px !important;
  height: 28px !important;
  border-radius: 8px !important;
  border: 1px solid #e2e8f0 !important;
  background: #f8fafc !important;
  color: #475569 !important;
  font-size: 13px !important;
  transition: all 0.15s ease !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  padding: 0 !important;
}

.btn-drawer-width-toggle:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

[data-theme="black"] .btn-drawer-width-toggle {
  background: var(--theme-surface-subtle) !important;
  border-color: var(--theme-border) !important;
  color: var(--theme-text-secondary) !important;
}

[data-theme="black"] .btn-drawer-width-toggle:hover {
  background: var(--theme-surface-hover) !important;
  color: var(--theme-text-primary) !important;
}

/* Header action group flex safety */
#chat-drawer-header {
  position: relative !important;
  overflow: visible !important;
}

#chat-drawer-actions {
  display: flex !important;
  align-items: center !important;
  flex-shrink: 0 !important;
  margin-left: auto !important;
  gap: 6px !important;
  z-index: 20 !important;
}

#chat-drawer-actions .btn-close-red,
#chat-drawer .btn-close-red {
  display: inline-flex !important;
  flex-shrink: 0 !important;
  min-width: 28px !important;
  min-height: 28px !important;
  width: 28px !important;
  height: 28px !important;
  z-index: 25 !important;
  visibility: visible !important;
  opacity: 1 !important;
  background: #fef2f2 !important;
  border: 1px solid #fecaca !important;
  color: #dc2626 !important;
}

#chat-drawer-actions .btn-close-red:hover,
#chat-drawer .btn-close-red:hover {
  background: #dc2626 !important;
  color: #ffffff !important;
  border-color: #dc2626 !important;
}
