/* =========================================================================
   Sovi.ai Mailist · Premium SaaS Admin Theme (UI-UX-Pro-Max Edition)
   - Highly refined minimalist SaaS interface with precise borders and grids
   - Sophisticated slate and indigo-accented corporate color system
   - High-contrast typography and standard 44px responsive touch targets
   - Butter-smooth micro-interactions and modern glassmorphic topbar
   ======================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Fira+Code:wght@400;500&display=swap');

:root {
  /* Google Modern Workspace Theme (Material Design 3 Edition) */
  --bg:             #F8F9FA; /* Google Classic Light Grey */
  --bg-gradient:    linear-gradient(180deg, #F8F9FA 0%, #F1F3F4 100%);
  --surface-1:      rgba(255, 255, 255, 0.9);
  --surface-2:      #FFFFFF;
  --surface-3:      #F1F3F4; /* Google Active Selection Grey */
  --hover:          #F1F3F4;
  --border:         #E8EAED; /* Google Light Grey Border */
  --border-strong:  #DADCE0; /* Google Standard Border Gray */

  /* Neutral Typography Palette */
  --text:           #202124; /* Google Dark Charcoal */
  --text-2:         #3C4043; /* Google Medium Charcoal */
  --muted:          #5F6368; /* Google Slate Muted Grey */
  --soft:           #80868B; /* Google Soft Grey */

  /* Precise SaaS Accent Tokens (Google Palette) */
  --primary:        #1A73E8; /* Classic Google Royal Blue */
  --primary-hover:  #1557B0; /* Google Deep Blue */
  --primary-soft:   #E8F0FE; /* Google Light Blue Active Background */
  --primary-ring:   rgba(26, 115, 232, 0.2);
  --danger:         #D93025; /* Google Red */
  --danger-hover:   #B31412;
  --danger-soft:    #FCE8E6;
  --warn:           #F9AB00; /* Google Yellow */
  --warn-soft:      #FEF7E0;
  --info:           #12B5CB; /* Google Cyan */
  --info-soft:      #E4F7FB;
  --success:        #1E8E3E; /* Google Green */
  --success-soft:   #E6F4EA;

  /* Typography / spacing */
  --font:           -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Inter', 'Segoe UI', Roboto, sans-serif;
  --mono:           'SF Mono', 'Fira Code', ui-monospace, SFMono-Regular, monospace;
  --radius-sm:      8px;
  --radius:         8px;
  --radius-lg:      8px;
  
  /* Premium Shadow Scale (Google Inspired) */
  --shadow-sm:      0 1px 2px 0 rgba(60,64,67,0.1), 0 1px 3px 1px rgba(60,64,67,0.05);
  --shadow:         0 1px 2px 0 rgba(60,64,67,0.15), 0 1px 3px 1px rgba(60,64,67,0.08);
  --shadow-md:      0 1px 3px 0 rgba(60,64,67,0.15), 0 4px 8px 3px rgba(60,64,67,0.1);
  --shadow-lg:      0 2px 6px 2px rgba(60,64,67,0.1), 0 6px 10px 4px rgba(60,64,67,0.15);
  --shadow-inset:   inset 0 2px 4px 0 rgba(32, 33, 36, 0.04);

  /* Clean transitions */
  --t-fast:         120ms ease;
  --t-base:         200ms cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg-gradient);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary); text-decoration: none; font-weight: 500; transition: color var(--t-fast); }
a:hover { color: var(--primary-hover); text-decoration: none; }
button { font: inherit; }
input, select, textarea, button { font-family: inherit; }

/* Splash Loading Screen */
.splash { display: grid; place-items: center; min-height: 100vh; gap: 16px; background: var(--bg); }
.brand { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; color: var(--text); }
.brand .dot { color: var(--primary); }

/* Main Framework Layout */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 60px 1fr;
  grid-template-areas: "sidebar topbar" "sidebar main";
  min-height: 100vh;
  transition: grid-template-columns var(--t-base);
}

/* Collapsed state on desktop */
.app.sidebar-collapsed {
  grid-template-columns: 64px 1fr;
}

@media (max-width: 768px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: 60px 1fr;
    grid-template-areas: "topbar" "main";
  }
}

/* Glassmorphic Minimal Topbar */
.topbar {
  grid-area: topbar;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar .brand { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }
.topbar .actions { display: flex; align-items: center; gap: 16px; }

/* Interactive Sidebar Collapse Toggle */
.btn-sidebar-toggle, .btn-mobile-menu {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
}
.btn-sidebar-toggle:hover, .btn-mobile-menu:hover {
  background: var(--surface-3);
  color: var(--text);
}
.btn-sidebar-toggle:active, .btn-mobile-menu:active {
  transform: scale(0.95);
}

.btn-mobile-menu {
  display: none; /* Hidden on desktop */
}

@media (max-width: 768px) {
  .btn-sidebar-toggle {
    display: none; /* Hidden on mobile */
  }
  .btn-mobile-menu {
    display: flex; /* Shown on mobile */
  }
}

/* Sidebar Layout Adjustments for Footer */
.sidebar {
  grid-area: sidebar;
  background: #FFFFFF;
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* push footer to bottom */
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 60;
  transition: width var(--t-base), padding var(--t-base);
  width: auto;
  overflow: hidden;
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px;
    transform: translateX(-100%);
    box-shadow: none;
    z-index: 100;
    transition: transform var(--t-base);
  }
  .app.mobile-sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
}

/* Sidebar Glassmorphic Overlay for Mobile */
.sidebar-overlay {
  display: none;
}
@media (max-width: 768px) {
  .sidebar-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    z-index: 90;
    transition: opacity var(--t-base);
  }
  .app.mobile-sidebar-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }
}

/* Collapsed states on desktop */
.app.sidebar-collapsed .sidebar {
  padding: 24px 8px;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  flex: 1;
}

/* Custom Elegant Scrollbar for nav-links */
.nav-links::-webkit-scrollbar {
  width: 4px;
}
.nav-links::-webkit-scrollbar-track {
  background: transparent;
}
.nav-links::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 99px;
}
.nav-links::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.15);
}

/* Sidebar Footer Section */
.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all var(--t-base);
}

.user-profile {
  display: flex;
  align-items: center;
  width: 100%;
}

.user-profile .user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
  width: 100%;
  cursor: pointer;
  transition: all var(--t-fast);
}

.user-profile .user-chip:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.user-profile .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #FFFFFF;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  transition: all var(--t-fast);
}

.user-profile .user-info {
  display: flex;
  flex-direction: column;
  min-width: 0; /* allows text truncation */
  text-align: left;
  transition: opacity var(--t-base);
}

.user-profile .user-email {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-profile .user-role {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 1px;
}

.sidebar-bottom-links {
  display: flex;
  align-items: center;
  padding-left: 8px;
  padding-bottom: 16px; /* Spacing breathing room at bottom-left corner */
  transition: all var(--t-base);
}

.health-link {
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  transition: color var(--t-fast);
}

.health-link:hover {
  color: var(--primary);
}

.health-dot {
  width: 6px;
  height: 6px;
  background-color: var(--success);
  border-radius: 50%;
  display: inline-block;
  animation: health-pulse 2s infinite;
}

@keyframes health-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* Footer elements collapse behavior */
.app.sidebar-collapsed .user-profile .user-chip {
  padding: 8px;
  justify-content: center;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
.app.sidebar-collapsed .user-profile .user-info {
  display: none;
}
.app.sidebar-collapsed .sidebar-bottom-links {
  padding-left: 0;
  justify-content: center;
}
.app.sidebar-collapsed .health-link span {
  display: none;
}

/* Nav Link Hover & Active Style */
.nav-link {
  display: flex; align-items: center; gap: 10px;
  height: 40px;
  padding: 0 12px; border-radius: var(--radius);
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
  font-weight: 500;
  font-size: 13px;
  border: 1px solid transparent;
  transition: all var(--t-fast);
}
.nav-link svg {
  width: 16px; height: 16px;
  opacity: 0.7;
  transition: opacity var(--t-fast);
}
.app:not(.sidebar-collapsed) .nav-link:hover {
  background: var(--surface-3);
  color: var(--text);
  padding-left: 16px; /* Smooth elegant slide-right on hover */
}
.nav-link:hover svg {
  opacity: 0.95;
}
.nav-link.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  position: relative;
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 4.5px;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
}
.nav-link.active svg {
  opacity: 1;
  color: var(--primary);
}

/* Centered link behavior in collapsed sidebar */
.app.sidebar-collapsed .nav-link {
  justify-content: center;
  padding: 0;
  width: 40px;
  height: 40px;
  margin: 0 auto;
}
.app.sidebar-collapsed .nav-link svg {
  margin: 0;
}
.app.sidebar-collapsed .nav-link span {
  display: none;
}
.app.sidebar-collapsed .nav-section {
  opacity: 0;
  height: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

.nav-section {
  color: var(--soft); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 16px 12px 6px;
  transition: all var(--t-base);
}

/* Main Content Area */
.main { grid-area: main; padding: 40px 32px; max-width: 1200px; width: 100%; margin: 0 auto; }
.main h1 { font-size: 22px; font-weight: 700; margin: 0 0 24px; letter-spacing: -0.02em; color: var(--text); }
.muted { color: var(--muted); font-size: 13px; }

/* Premium Minimalist KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi {
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.kpi:hover {
  transform: translateY(-1.5px);
  box-shadow: var(--shadow-md);
}


.kpi .label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.kpi .value {
  font-size: 26px;
  font-weight: 700;
  margin-top: 6px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* Premium SaaS Content Card */
.card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 24px; }

/* Shared 2026 UI primitives */
.ui-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: currentColor;
  flex: 0 0 auto;
  line-height: 0;
}
.ui-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}
.ui-icon-inline {
  width: 15px;
  height: 15px;
  margin-right: 6px;
  vertical-align: -2px;
}
.btn .ui-icon-inline,
.cell-actions .ui-icon-inline,
.media-action-btn .ui-icon-inline {
  margin-right: 0;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 22px;
}
.page-head-main {
  min-width: 0;
  max-width: 760px;
}
.page-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}
.page-kicker-icon {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(26, 115, 232, 0.16);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #FFFFFF 0%, var(--primary-soft) 100%);
  box-shadow: var(--shadow-sm);
}
.page-head h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: 0;
}
.page-head p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
}
.page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.surface-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-sm);
}
.toolbar-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
.toolbar-meta strong {
  color: var(--text);
}
.search-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: min(320px, 100%);
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  color: var(--muted);
  box-shadow: var(--shadow-sm);
}
.search-field.compact {
  min-width: 230px;
  height: 36px;
}
.search-field input {
  height: 100% !important;
  min-width: 0;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--text);
}
.search-field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.segmented-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  max-width: 100%;
}
.segmented-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
}
.segmented-item:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
}
.segmented-item.active {
  background: #FFFFFF;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.row-title {
  color: var(--text);
  font-weight: 750;
}
.row-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.text-primary {
  color: var(--primary);
}
.state-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 36px 16px;
  color: var(--muted);
  text-align: center;
}
.state-empty-icon {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #FFFFFF 0%, var(--surface-3) 100%);
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
}
.state-empty strong {
  color: var(--text);
  font-size: 14px;
}
.state-empty span {
  max-width: 380px;
  font-size: 12.5px;
  line-height: 1.6;
}
.asset-panel {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.72);
  padding: 16px;
}
.settings-savebar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.btn-ai {
  background: linear-gradient(135deg, #0F766E 0%, #1A73E8 100%);
  border-color: transparent;
  color: #FFFFFF;
}
.btn-ai:hover {
  filter: brightness(0.96);
  color: #FFFFFF;
}

/* Dashboard redesign: dense, operational, and reusable */
.dashboard-page {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dashboard-hero,
.dashboard-stat-card,
.dashboard-rate-card,
.dashboard-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  box-shadow: var(--shadow);
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px 28px;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(232, 240, 254, 0.78) 0%, rgba(255, 255, 255, 0.94) 46%, rgba(230, 244, 234, 0.55) 100%);
}

.dashboard-hero-copy {
  min-width: 0;
}

.dashboard-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 10px;
}

.dashboard-hero h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: 0;
}

.dashboard-hero p {
  margin: 12px 0 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.7;
  max-width: 680px;
}

.dashboard-hero-actions {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.dashboard-action {
  height: 40px;
  min-width: 112px;
}

.dashboard-action svg,
.dashboard-icon svg {
  width: 17px;
  height: 17px;
}

.dashboard-hero-strip {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid rgba(218, 220, 224, 0.72);
}

.dashboard-hero-strip div {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(218, 220, 224, 0.74);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.72);
}

.dashboard-hero-strip span,
.dashboard-hero-strip small {
  display: block;
}

.dashboard-hero-strip span {
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.dashboard-hero-strip small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

.dashboard-stat-grid,
.dashboard-rate-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.dashboard-stat-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 138px;
  padding: 18px;
  transition: transform var(--t-base), border-color var(--t-base), box-shadow var(--t-base);
}

.dashboard-stat-card:hover,
.dashboard-rate-card:hover,
.dashboard-panel:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.dashboard-stat-card:hover,
.dashboard-rate-card:hover {
  transform: translateY(-1px);
}

.dashboard-card-label,
.dashboard-rate-head span:first-child {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
}

.dashboard-card-value {
  margin-top: 10px;
  color: var(--text);
  font-size: 31px;
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.dashboard-card-note,
.dashboard-rate-detail {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 600;
}

.dashboard-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  color: var(--primary);
  background: var(--primary-soft);
}

.dashboard-stat-card.tone-info .dashboard-icon { color: var(--info); background: var(--info-soft); }
.dashboard-stat-card.tone-campaign .dashboard-icon { color: #6D5BD0; background: #F0EEFF; }
.dashboard-stat-card.tone-danger .dashboard-icon { color: var(--danger); background: var(--danger-soft); }
.dashboard-stat-card.tone-neutral .dashboard-icon { color: var(--muted); background: var(--surface-3); }

.dashboard-rate-card {
  padding: 18px;
  min-height: 150px;
}

.dashboard-rate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dashboard-rate-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
}

.dashboard-rate-value {
  margin-top: 14px;
  color: var(--text);
  font-size: 32px;
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.dashboard-progress {
  height: 8px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.dashboard-progress span {
  display: block;
  height: 100%;
  min-width: 3px;
  border-radius: inherit;
  background: var(--muted);
  transition: width var(--t-base);
}

.dashboard-rate-card.tone-success .dashboard-rate-badge { color: var(--success); background: var(--success-soft); }
.dashboard-rate-card.tone-success .dashboard-progress span { background: var(--success); }
.dashboard-rate-card.tone-info .dashboard-rate-badge { color: var(--info); background: var(--info-soft); }
.dashboard-rate-card.tone-info .dashboard-progress span { background: var(--info); }
.dashboard-rate-card.tone-warn .dashboard-rate-badge { color: #8A6100; background: var(--warn-soft); }
.dashboard-rate-card.tone-warn .dashboard-progress span { background: var(--warn); }
.dashboard-rate-card.tone-danger .dashboard-rate-badge { color: var(--danger); background: var(--danger-soft); }
.dashboard-rate-card.tone-danger .dashboard-progress span { background: var(--danger); }

.dashboard-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(340px, 0.84fr);
  gap: 16px;
  align-items: stretch;
}

.dashboard-panel {
  min-width: 0;
  padding: 18px;
}

.dashboard-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.dashboard-panel h2 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.3;
  font-weight: 800;
  letter-spacing: 0;
}

.dashboard-panel p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.dashboard-panel-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.dashboard-panel-link:hover {
  background: var(--primary-soft);
  border-color: rgba(26, 115, 232, 0.28);
}

.dashboard-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
}

.dashboard-table {
  min-width: 0;
  table-layout: fixed;
}

.dashboard-table th,
.dashboard-table td {
  padding: 12px 10px;
}

.dashboard-table th:first-child,
.dashboard-table td:first-child {
  width: 38%;
}

.dashboard-table th:not(:first-child),
.dashboard-table td:not(:first-child) {
  width: 15.5%;
}

.dashboard-table th:not(:first-child),
.dashboard-table td:not(:first-child) {
  text-align: center;
}

.dashboard-table td {
  font-size: 13px;
}

.dashboard-table .pill {
  min-width: 58px;
  justify-content: center;
  padding: 2px 8px;
  font-size: 10.5px;
  text-transform: none;
  letter-spacing: 0;
}

.dashboard-campaign-name {
  max-width: 220px;
  color: var(--text);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-empty {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 32px 16px;
  color: var(--muted);
  text-align: center;
}

.dashboard-empty strong {
  color: var(--text);
  font-size: 14px;
}

.dashboard-empty span {
  max-width: 360px;
  font-size: 12.5px;
  line-height: 1.55;
}

.dashboard-trend-panel {
  display: flex;
  flex-direction: column;
}

.dashboard-trend-chart {
  position: relative;
  min-height: 268px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #FFFFFF 0%, #FAFBFC 100%);
}

.dashboard-chart-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(218, 220, 224, 0.55) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(218, 220, 224, 0.7) 1px, transparent 1px);
  background-size: 25% 100%, 100% 25%;
}

.dashboard-trend-layer {
  position: absolute;
  inset: 28px 18px 24px;
  pointer-events: none;
}

.dashboard-trend-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.dashboard-placeholder-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text-2);
}

.dashboard-placeholder-icon svg {
  width: 24px;
  height: 24px;
}

.dashboard-trend-placeholder strong {
  color: var(--text);
  font-size: 14px;
}

.dashboard-trend-placeholder span {
  max-width: 280px;
  font-size: 12.5px;
  line-height: 1.55;
}

.dashboard-legend {
  display: flex;
  justify-content: center;
  gap: 18px;
  padding-top: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.dashboard-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.legend-dot.tone-info { background: var(--info); }
.legend-dot.tone-warn { background: var(--warn); }

@media (max-width: 1100px) {
  .dashboard-stat-grid,
  .dashboard-rate-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .main {
    padding: 24px 16px;
  }

  .dashboard-hero {
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .dashboard-hero-actions {
    align-items: stretch;
  }

  .dashboard-action {
    flex: 1;
  }

  .dashboard-hero-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .dashboard-page {
    gap: 16px;
  }

  .dashboard-stat-grid,
  .dashboard-rate-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .dashboard-hero h1 {
    font-size: 30px;
  }

  .dashboard-hero-actions {
    flex-direction: column;
  }

  .dashboard-action {
    width: 100%;
  }

  .dashboard-hero-strip {
    gap: 8px;
  }

  .dashboard-panel {
    padding: 14px;
  }

  .dashboard-panel-head {
    flex-direction: column;
  }

  .dashboard-panel-link {
    width: 100%;
    justify-content: center;
  }

  .dashboard-table {
    min-width: 560px;
    table-layout: auto;
  }

  .dashboard-table th,
  .dashboard-table td {
    padding: 12px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-stat-card,
  .dashboard-rate-card,
  .dashboard-progress span {
    transition: none;
  }

  .dashboard-stat-card:hover,
  .dashboard-rate-card:hover {
    transform: none;
  }
}

/* Toolbar */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 16px 0 20px; flex-wrap: wrap; }
.toolbar .filters { display: flex; gap: 8px; flex-wrap: wrap; }

/* Premium Flat Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; font-weight: 600; font-size: 13px;
  box-shadow: var(--shadow-sm);
  transition: all var(--t-fast);
  user-select: none;
  white-space: nowrap; /* Prevent button text wrapping vertically */
  flex-shrink: 0;      /* Prevent button from being squished */
}
.btn[disabled] { opacity: 0.5; cursor: not-allowed; box-shadow: none !important; transform: none !important; }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.btn-primary:active {
  transform: translateY(0.5px);
}

.btn-secondary {
  background: #FFFFFF;
  color: var(--text-2);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--surface-3);
  color: var(--text);
}
.btn-secondary:active {
  transform: translateY(0.5px);
}

.btn-danger {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
  box-shadow: none;
}
.btn-danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
  box-shadow: var(--shadow-sm);
}

.btn-ghost { background: transparent; color: var(--text-2); box-shadow: none; border-radius: var(--radius-sm); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-icon { width: 36px; padding: 0; justify-content: center; border-radius: 50%; }

/* Form inputs & rows */
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-row label {
  font-size: 12.5px;
  color: var(--text-2);
  font-weight: 600;
  display: inline-flex !important;
  align-items: center !important;
  height: 18px !important;
  margin-bottom: 2px !important;
}

input, select, textarea {
  width: 100%;
  border-radius: var(--radius);
  background: #FFFFFF; color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
  transition: all var(--t-fast);
  font-size: 13.5px;
  box-sizing: border-box !important;
}

input, select {
  height: 38px !important;
  padding: 8px 12px !important;
}

select[multiple] {
  height: auto !important;
  min-height: 120px;
  padding: 6px 10px !important;
  overflow-y: auto;
}

select[multiple] option {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--t-fast);
}

select[multiple] option:checked {
  background: var(--primary-soft) linear-gradient(0deg, var(--primary-soft) 0%, var(--primary-soft) 100%) !important;
  color: var(--primary) !important;
}

select[multiple] option:hover {
  background: var(--hover);
  color: var(--text);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
textarea { min-height: 120px; resize: vertical; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; padding: 10px 14px; }
.input-search {
  padding-left: 14px;
}
.help { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.error { font-size: 11.5px; color: var(--danger); margin-top: 4px; font-weight: 600; }

/* Elegant SaaS Table Container */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  background: #FFFFFF;
}
table { width: 100%; border-collapse: separate; border-spacing: 0; }
thead th {
  position: sticky; top: 0;
  background: var(--bg); color: var(--text-2);
  font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 14px 20px; text-align: left;
  border-bottom: 1px solid var(--border);
}
tbody td { padding: 14px 20px; border-bottom: 1px solid var(--surface-3); background: transparent; font-variant-numeric: tabular-nums; font-size: 13.5px; color: var(--text-2); }
tbody tr:hover td { background: var(--hover); }
tbody tr:last-child td { border-bottom: 0; }
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.cell-actions .btn { height: 30px; font-size: 12px; padding: 0 10px; border-radius: var(--radius-sm); }
.table-wrap th:last-child { text-align: right; }

/* Pagination */
.pagi { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding-top: 16px; }
.pagi button {
  background: #FFFFFF; border: 1px solid var(--border-strong);
  color: var(--text-2); padding: 6px 12px; border-radius: var(--radius-sm);
  cursor: pointer; font-weight: 500; font-size: 12px;
  box-shadow: var(--shadow-sm);
  transition: all var(--t-fast);
}
.pagi button:hover:not([disabled]) {
  background: var(--surface-3);
  color: var(--text);
}
.pagi button[disabled] { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

/* Elegant Minimalist Pills */
.pill {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: var(--radius-sm); font-size: 11px; font-weight: 600; border-radius: 9999px;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pill-success { background: var(--success-soft); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.15); }
.pill-warn    { background: var(--warn-soft); color: var(--warn); border: 1px solid rgba(245, 158, 11, 0.15); }
.pill-danger  { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.15); }
.pill-info    { background: var(--info-soft); color: var(--info); border: 1px solid rgba(14, 165, 233, 0.15); }
.pill-muted   { background: var(--surface-3); color: var(--muted); border: 1px solid var(--border); }

/* Body Scroll Lock for Modals */
body.modal-open {
  overflow: hidden !important;
  padding-right: var(--scrollbar-width, 0px) !important;
}

/* Modern Modal Overlay with backdrop-filter & butter-smooth animations */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: grid;
  place-items: center;
  z-index: 2000;
  opacity: 0;
  animation: modalFadeIn 250ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-overlay.closing {
  pointer-events: none;
  animation: modalFadeOut 200ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: min(540px, 94vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: scale(0.96) translateY(12px);
  animation: modalScaleIn 320ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards; /* Liquid spring-like physics curve */
}

.modal-overlay.closing .modal {
  animation: modalScaleOut 200ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.modal-head strong {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-title-icon {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #FFFFFF 0%, var(--surface-3) 100%);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.modal-title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg);
  flex-shrink: 0;
}

/* Modal Animation Keyframes */
@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes modalScaleIn {
  from { transform: scale(0.96) translateY(12px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes modalScaleOut {
  from { transform: scale(1) translateY(0); opacity: 1; }
  to { transform: scale(0.96) translateY(12px); opacity: 0; }
}

/* Premium Web Toasts */
.toast-stack { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 3000; }
.toast {
  background: #FFFFFF;
  border: 1px solid var(--border);
  padding: 10px 16px; border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  animation: slideUp .2s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 320px; font-weight: 500; font-size: 13px;
  color: var(--text-2);
}
.toast.success { color: var(--success); border-color: rgba(16, 185, 129, 0.3); background: var(--success-soft); }
.toast.error { color: var(--danger); border-color: rgba(239, 68, 68, 0.3); background: var(--danger-soft); }
@keyframes slideUp { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Empty state design */
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .title { color: var(--text); font-size: 16px; margin-bottom: 6px; font-weight: 700; letter-spacing: -0.01em; }

/* Layout utilities */
.row { display: flex; gap: 8px; align-items: center; }
.spacer { flex: 1; }
.code {
  font-family: var(--mono); font-size: 12px; color: var(--text);
  background: var(--surface-3); padding: 2px 6px; border-radius: 4px;
  border: 1px solid var(--border);
}

/* Premium login card */
.login-card {
  max-width: 380px; margin: 120px auto; padding: 32px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-card h1 { font-size: 20px; font-weight: 700; margin: 0 0 8px; letter-spacing: -0.02em; }
.login-card p { color: var(--muted); margin: 0 0 20px; line-height: 1.5; font-size: 13px; }
.btn-google {
  width: 100%; height: 40px; border-radius: var(--radius);
  background: #ffffff; color: var(--text-2);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; font-size: 13px;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--t-fast);
}
.btn-google:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}
.btn-google:active {
  transform: translateY(0.5px);
}
.btn-google svg { width: 16px; height: 16px; }

/* =========================================================================
   Sovi.ai Mailist · settings page layout styles (Premium SaaS Layout)
   ========================================================================= */
.settings-container {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  margin-top: 16px;
}
@media (max-width: 768px) {
  .settings-container {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}
.settings-sidebar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px;
  box-shadow: var(--shadow);
}
.settings-tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--text-2);
  font-weight: 500;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: all var(--t-fast);
}
.settings-tab-btn:hover {
  background: var(--hover);
  color: var(--text);
}
.settings-tab-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.settings-tab-btn .tab-icon {
  font-size: 14px;
}
.settings-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}
.settings-section-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 16px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.settings-row-full {
  grid-column: 1 / -1;
}
/* Style for custom visual toggle switches */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  transition: all var(--t-fast);
}
.toggle-row:hover {
  background: var(--surface-3);
}
.toggle-label-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.toggle-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.toggle-desc {
  font-size: 11px;
  color: var(--muted);
}
/* Visual toggle checkbox */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--soft);
  transition: .2s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 34px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.switch input:checked + .slider {
  background-color: var(--primary);
}
.switch input:checked + .slider:before {
  transform: translateX(18px);
}
.json-textarea {
  font-family: var(--mono);
  font-size: 12px !important;
  line-height: 1.5;
  background: #F8FAFC;
  color: #0F172A;
  border-color: #E2E8F0;
}

.info-trigger {
  color: var(--primary);
  margin-left: 4px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  opacity: 0.65;
  transition: opacity var(--t-fast);
}
.info-trigger:hover {
  opacity: 1;
}

/* Custom Interactive Tooltip */
.info-tooltip {
  position: absolute;
  background: var(--text); /* Slate 900 for premium contrast */
  color: #FFFFFF;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.45;
  max-width: 280px;
  z-index: 100000;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 150ms ease, transform 150ms ease;
  word-wrap: break-word;
  white-space: normal;
}
.info-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}
.info-tooltip::after {
  content: "";
  position: absolute;
  border-width: 5px;
  border-style: solid;
}
.info-tooltip.top::after {
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-color: var(--text) transparent transparent transparent;
}
.info-tooltip.bottom::after {
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-color: transparent transparent var(--text) transparent;
}

/* =========================================================================
   Sovi.ai Mailist · Premium Media Grid Styles
   ========================================================================= */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.media-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  transition: all var(--t-base);
  display: flex;
  flex-direction: column;
}
.media-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.media-preview {
  aspect-ratio: 1.2;
  background: var(--surface-3);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}
.media-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform var(--t-base);
}
.media-item:hover .media-preview img {
  transform: scale(1.05);
}
.media-info {
  margin-top: 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.media-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
.media-actions-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: auto;
}
.media-url-input {
  font-family: var(--mono);
  font-size: 11px !important;
  padding: 4px 8px !important;
  height: 28px !important;
  background: var(--bg) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: none !important;
  cursor: pointer;
  flex: 1;
  min-width: 0;
  transition: all var(--t-fast);
}
.media-url-input:hover {
  border-color: var(--primary) !important;
  background: var(--primary-soft) !important;
}
.media-action-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--t-fast);
}
.media-action-btn:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--border-strong);
}
.media-action-btn.delete:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}
.media-action-btn svg {
  width: 14px;
  height: 14px;
}

/* Template gallery */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.template-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  box-shadow: var(--shadow);
  transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base);
}
.template-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.preview-container {
  position: relative;
  height: 172px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(218, 220, 224, 0.4) 1px, transparent 1px),
    linear-gradient(180deg, rgba(218, 220, 224, 0.45) 1px, transparent 1px),
    #F8FAFC;
  background-size: 28px 28px;
  border-bottom: 1px solid var(--border);
}
.preview-scale {
  position: absolute;
  top: 0;
  left: 50%;
  width: 600px;
  height: 720px;
  transform: translateX(-50%) scale(0.24);
  transform-origin: top center;
  border: 1px solid var(--border);
  background: #FFFFFF;
  box-shadow: var(--shadow-sm);
}
.preview-scale iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #FFFFFF;
}
.template-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 10px;
}
.template-name {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.template-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.template-meta {
  padding: 0 14px 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.template-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 14px 14px;
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

/* =========================================================================
   Advanced Template Workspace & AI Creator
   ========================================================================= */
.template-workspace-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  opacity: 0;
  animation: modalFadeIn 250ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.template-workspace-overlay.closing {
  pointer-events: none;
  animation: modalFadeOut 200ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.workspace-header {
  height: 60px;
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.workspace-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}
.workspace-badge {
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
#ws-template-name {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 600;
  width: 240px;
  transition: all var(--t-fast);
}
#ws-template-name:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.workspace-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.workspace-actions select, .workspace-actions input {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 13px;
  height: 34px;
  outline: none;
  transition: all var(--t-fast);
}
.workspace-actions select:focus, .workspace-actions input:focus {
  border-color: var(--primary);
}
#ws-template-subject {
  width: 220px;
}

@media (max-width: 1200px) {
  #ws-template-name {
    width: 150px;
  }
  #ws-template-subject {
    width: 150px;
  }
  .workspace-header {
    padding: 0 12px;
    gap: 12px;
  }
}
.workspace-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}
.workspace-left {
  border-right: 1px solid var(--border);
  position: relative;
  height: 100%;
}
.workspace-right {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #FFFFFF;
}
.workspace-right-tabs {
  height: 40px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-3);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
}
.ws-tab-btn {
  background: transparent;
  border: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--t-fast);
}
.ws-tab-btn:hover {
  background: var(--border);
  color: var(--text);
}
.ws-tab-btn.active {
  background: #FFFFFF;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.workspace-right-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.ws-content-pane {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: none;
}
.ws-content-pane.active {
  display: block;
}
#ws-preview-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #FFFFFF;
}
#ws-pane-history {
  padding: 20px;
  overflow-y: auto;
}
.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.history-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  background: var(--hover);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all var(--t-fast);
}
.history-item:hover {
  border-color: var(--border-strong);
  background: #FFFFFF;
}
.history-item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.history-item-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.history-item-date {
  font-size: 11.5px;
  color: var(--muted);
}
.history-item-actions {
  display: flex;
  gap: 8px;
}
.history-item-actions button {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
}

/* AI Creator Modal Form */
.ai-modal-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ai-style-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.ai-style-option {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.ai-style-option:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.ai-style-option.selected {
  border-color: rgba(26, 115, 232, 0.42);
  background: var(--primary-soft);
  color: var(--primary);
}
.ai-style-option .ui-icon {
  width: 22px;
  height: 22px;
}
.ai-style-option strong {
  color: var(--text);
  font-size: 12.5px;
}
.ai-style-option small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}
.ai-preset-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ai-reference-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.ai-upload-preview-container {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 4px;
}
.ai-image-thumbnail {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.ai-loading-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  padding: 24px;
}
.ai-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: ws-spin 1s linear infinite;
}
@keyframes ws-spin {
  to { transform: rotate(360deg); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =========================================================================
   Sovi.ai Mailist Copilot Chatbot Widget Styles
   ======================================================================== */
.copilot-widget {
  position: fixed;
  z-index: 10000;
  font-family: var(--font);
  user-select: none;
}

.copilot-trigger {
  position: fixed;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1E1B4B 0%, #312E81 100%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  z-index: 10001;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}

.copilot-trigger:active {
  cursor: grabbing;
  transform: scale(0.95);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.copilot-trigger img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  pointer-events: none; /* Let drag event bypass the image */
  object-fit: contain;
}

.copilot-trigger .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid #FFFFFF;
}

.copilot-dialog {
  position: fixed;
  width: 380px;
  height: 550px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px -4px rgba(15, 23, 42, 0.12), 0 4px 12px -2px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10000;
  opacity: 0;
  transform: scale(0.95) translateY(10px);
  pointer-events: none;
  transition: opacity var(--t-base), transform var(--t-base);
}

.copilot-dialog.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

/* Header style matching our premium palette */
.copilot-header {
  padding: 14px 18px;
  background: linear-gradient(135deg, #1E1B4B 0%, #312E81 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.copilot-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.copilot-header-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.copilot-header-subtitle {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
}

.copilot-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.copilot-btn-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--t-fast);
}

.copilot-btn-icon:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Conversation Body */
.copilot-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.copilot-message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.copilot-message.assistant {
  align-self: flex-start;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.copilot-message.user {
  align-self: flex-end;
  background: var(--primary);
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.15);
}

.copilot-message.system-info {
  align-self: center;
  max-width: 95%;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  padding: 4px 8px;
}

.copilot-message p {
  margin: 0 0 8px 0;
}
.copilot-message p:last-child {
  margin-bottom: 0;
}
.copilot-message ul, .copilot-message ol {
  margin: 4px 0;
  padding-left: 18px;
}
.copilot-message li {
  margin-bottom: 4px;
}
.copilot-message code {
  font-family: var(--mono);
  background: rgba(0,0,0,0.05);
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
}
.copilot-message.user code {
  background: rgba(255,255,255,0.15);
}

.copilot-message pre {
  margin: 8px 0;
  padding: 10px 12px;
  background: #1E1B4B; /* Premium dark indigo */
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  max-width: 100%;
  box-sizing: border-box;
}

.copilot-message pre code {
  display: block;
  background: transparent;
  padding: 0;
  border-radius: 0;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: #E2E8F0; /* Slate-200 */
  white-space: pre-wrap; /* Auto wrap code lines to avoid horizontal scrollbar */
  word-break: break-all;
}

/* Custom styled thin scrollbar for code blocks in case wrapping is disabled or for long content */
.copilot-message pre::-webkit-scrollbar {
  height: 4px;
  width: 4px;
}
.copilot-message pre::-webkit-scrollbar-track {
  background: transparent;
}
.copilot-message pre::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
}
.copilot-message pre::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* Code Syntax Highlights for Premium dark theme */
.copilot-message pre .hl-tag { color: #F87171; font-weight: 500; }
.copilot-message pre .hl-attr { color: #FB923C; }
.copilot-message pre .hl-attr-val { color: #34D399; }
.copilot-message pre .hl-comment { color: #94A3B8; font-style: italic; }
.copilot-message pre .hl-liquid { color: #C084FC; font-weight: 600; }
.copilot-message pre .hl-selector { color: #60A5FA; font-weight: 500; }
.copilot-message pre .hl-property { color: #E2E8F0; }
.copilot-message pre .hl-value { color: #34D399; }
.copilot-message pre .hl-keyword { color: #C084FC; font-weight: 600; }
.copilot-message pre .hl-string { color: #34D399; }

/* Presets Container */
.copilot-presets-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  background: transparent;
}

.copilot-presets-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 2px;
}

.copilot-preset-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-2);
  padding: 8px 12px;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition: all var(--t-fast);
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.copilot-preset-btn:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

/* Input area */
.copilot-footer {
  padding: 12px 14px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
}

.copilot-input {
  flex: 1;
  height: 38px;
  min-height: 38px;
  max-height: 120px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  resize: none;
  line-height: 1.4;
  font-family: inherit;
  box-sizing: border-box;
}

.copilot-input:focus {
  border-color: var(--primary);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.copilot-btn-send {
  height: 38px;
  width: 38px;
  border-radius: var(--radius);
  background: var(--primary);
  border: none;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--t-fast), transform var(--t-fast);
}

.copilot-btn-send:hover {
  background: var(--primary-hover);
  transform: scale(1.02);
}

.copilot-btn-send:active {
  transform: scale(0.98);
}

.copilot-btn-send svg {
  width: 18px;
  height: 18px;
}

/* Typing Indicator Animation */
.copilot-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
}

.copilot-typing span {
  width: 6px;
  height: 6px;
  background: var(--muted);
  border-radius: 50%;
  opacity: 0.4;
  animation: copilot-blink 1.4s infinite both;
}

.copilot-typing span:nth-child(2) { animation-delay: .2s; }
.copilot-typing span:nth-child(3) { animation-delay: .4s; }

@keyframes copilot-blink {
  0% { opacity: .4; }
  20% { opacity: 1; }
  100% { opacity: .4; }
}

@media (max-width: 480px) {
  .copilot-dialog {
    width: calc(100vw - 32px);
    height: 480px;
  }
}

/* =========================================================================
   Markdown Preview & Editor Container Styling
   ========================================================================= */
.markdown-body {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-2);
}
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  color: var(--text);
  margin-top: 16px;
  margin-bottom: 8px;
  font-weight: 700;
}
.markdown-body h1 { font-size: 18px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.markdown-body h2 { font-size: 15px; }
.markdown-body h3 { font-size: 14px; }
.markdown-body p, .markdown-body ul, .markdown-body ol {
  margin-bottom: 12px;
}
.markdown-body ul, .markdown-body ol {
  padding-left: 20px;
}
.markdown-body li {
  margin-bottom: 4px;
}
.markdown-body code {
  font-family: var(--mono);
  background: var(--surface-3);
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 12px;
}
.markdown-body pre {
  background: var(--surface-3);
  padding: 12px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 12px;
}
.markdown-body pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
}
.markdown-body blockquote {
  border-left: 4px solid var(--primary-soft);
  margin: 0 0 12px 0;
  padding-left: 12px;
  color: var(--muted);
  font-style: italic;
}

/* =========================================================================
   Settings JSON & Code Editor Improvements (Ace)
   ========================================================================= */
.json-ace-container {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 8px;
  box-shadow: var(--shadow-sm);
  background: #1E1E2E;
  transition: border-color var(--t-fast);
}

.json-ace-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
}

.json-status-badge {
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.json-ace-actions {
  display: flex;
  gap: 8px;
}

.json-ace-btn {
  font-size: 11px;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  border: none;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background var(--t-fast);
}

.json-ace-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* =========================================================================
   Secondary Premium UI/UX Polish & Mobile Optimization
   ========================================================================= */

/* Elegant Slim Scrollbars for Modal Body and Sidebars */
.modal-body::-webkit-scrollbar,
.nav-links::-webkit-scrollbar,
.settings-sidebar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.modal-body::-webkit-scrollbar-track,
.nav-links::-webkit-scrollbar-track,
.settings-sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.modal-body::-webkit-scrollbar-thumb,
.nav-links::-webkit-scrollbar-thumb,
.settings-sidebar::-webkit-scrollbar-thumb {
  background-color: var(--border-strong);
  border-radius: 9999px;
}
.modal-body::-webkit-scrollbar-thumb:hover,
.nav-links::-webkit-scrollbar-thumb:hover,
.settings-sidebar::-webkit-scrollbar-thumb:hover {
  background-color: var(--soft);
}

/* Consistent Standard Button Sizing Utilities */
.btn-sm {
  height: 30px !important;
  font-size: 11.5px !important;
  padding: 0 10px !important;
  border-radius: var(--radius-sm) !important;
}
.btn-lg {
  height: 44px !important;
  font-size: 14.5px !important;
  padding: 0 18px !important;
  border-radius: var(--radius) !important;
}

/* Mobile responsive fixes (iOS Safari Zoom, Touch Clearance) */
@media (max-width: 768px) {
  /* Prevent iOS automatic viewport zoom-in when focusing text inputs */
  input, select, textarea {
    font-size: 16px !important;
  }
  
  /* Slightly expand main interactive heights for easier thumb-tapping */
  .btn:not(.btn-sm) {
    height: 40px !important;
    font-size: 13.5px !important;
  }
  input:not(.input-search), select {
    height: 40px !important;
  }
  
  /* Expand dialog padding on smaller screens */
  .modal-body {
    padding: 20px 16px;
  }
  .modal-head {
    padding: 16px 16px;
  }
  .modal-foot {
    padding: 12px 16px;
  }
}

@media (max-width: 900px) {
  .page-head {
    align-items: stretch;
    flex-direction: column;
  }
  .page-actions {
    justify-content: flex-start;
  }
  .surface-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .search-field,
  .search-field.compact {
    width: 100%;
    min-width: 0;
  }
  .ai-style-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ai-reference-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .page-head h1 {
    font-size: 26px;
  }
  .page-actions .btn,
  .surface-toolbar .btn {
    width: 100%;
  }
  .segmented-control {
    width: 100%;
  }
  .segmented-item {
    flex: 1 0 auto;
  }
  .templates-grid,
  .media-grid,
  .ai-style-grid {
    grid-template-columns: 1fr;
  }
  .template-actions,
  .modal-foot,
  .settings-savebar {
    align-items: stretch;
    flex-direction: column;
  }
  .template-actions .btn,
  .modal-foot .btn,
  .settings-savebar .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .template-card,
  .media-item,
  .ai-style-option,
  .btn {
    transition: none;
  }
  .template-card:hover,
  .media-item:hover,
  .ai-style-option:hover {
    transform: none;
  }
}

/* =========================================================================
   Info Tip — pure-CSS hover/focus tooltip for module headers and column heads
   (Built on the existing .info-tooltip skin; no JS required.)
   ========================================================================= */
.info-tip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  vertical-align: middle;
  color: var(--soft);
  cursor: help;
  outline: none;
  border-radius: 50%;
  transition: color var(--t-fast), background var(--t-fast);
}
.info-tip-wrap:hover,
.info-tip-wrap:focus-visible {
  color: var(--primary);
  background: var(--primary-soft);
}
.info-tip-wrap > svg {
  width: 14px;
  height: 14px;
}
.info-tip-wrap > .info-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translate(-50%, -4px);
  min-width: 220px;
  max-width: 320px;
  text-align: left;
  font-weight: 400;
  letter-spacing: 0;
  pointer-events: none;
  visibility: hidden;
}
.info-tip-wrap > .info-tooltip::after {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: transparent transparent var(--text) transparent;
}
.info-tip-wrap:hover > .info-tooltip,
.info-tip-wrap:focus-visible > .info-tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
  visibility: visible;
}
/* Align the tooltip flush-left when the icon is near the right edge of a th */
th .info-tip-wrap > .info-tooltip {
  left: 0;
  transform: translateY(-4px);
}
th .info-tip-wrap > .info-tooltip::after {
  left: 14px;
  transform: none;
}
th .info-tip-wrap:hover > .info-tooltip,
th .info-tip-wrap:focus-visible > .info-tooltip {
  transform: translateY(0);
}
/* Title row alignment — keep the icon vertically centered with the h1 */
.page-head-main h1 .info-tip-wrap {
  width: 22px;
  height: 22px;
  margin-left: 10px;
  position: relative;
  top: -3px;
}
.page-head-main h1 .info-tip-wrap > svg {
  width: 16px;
  height: 16px;
}

/* =========================================================================
   Campaign Report — drill-down funnel + anomalies + timeline
   ========================================================================= */
.report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 24px;
}
@media (max-width: 1100px) {
  .report-grid { grid-template-columns: 1fr; }
}

.report-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.report-section-head h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.funnel-row {
  display: grid;
  grid-template-columns: 140px 1fr 140px;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}
.funnel-row-label {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--text-2);
}
.funnel-bar {
  height: 10px;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.funnel-bar-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width var(--t-base);
}
.funnel-bar-fill.tone-info     { background: linear-gradient(90deg, #0EA5E9, #38BDF8); }
.funnel-bar-fill.tone-primary  { background: linear-gradient(90deg, var(--primary), #4ADE80); }
.funnel-bar-fill.tone-success  { background: linear-gradient(90deg, #16A34A, var(--primary)); }
.funnel-bar-fill.tone-warn     { background: linear-gradient(90deg, var(--warn), #FCD34D); }
.funnel-bar-fill.tone-danger   { background: linear-gradient(90deg, var(--danger), #FB7185); }
.funnel-row-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-align: right;
}
.funnel-row-num .muted {
  font-weight: 400;
}

.report-anomaly-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.report-anomaly {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--soft);
}
.report-anomaly.tone-danger { border-left-color: var(--danger); }
.report-anomaly.tone-warn   { border-left-color: var(--warn); }
.report-anomaly.tone-info   { border-left-color: #0EA5E9; }
.report-anomaly.tone-success { border-left-color: var(--success); }
.report-anomaly-label {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.report-anomaly-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.report-timeline-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}
.report-timeline-row:last-child { border-bottom: none; }
.report-timeline-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
}
.report-timeline-chart {
  width: 100%;
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.legend-dot.tone-info     { background: #0EA5E9; }
.legend-dot.tone-primary  { background: var(--primary); }
.legend-dot.tone-success  { background: var(--success); }
.legend-dot.tone-warn     { background: var(--warn); }
.legend-dot.tone-danger   { background: var(--danger); }


